ABLATE Source Documentation  0.12.34
nearestPoint.hpp
1 #ifndef ABLATELIBRARY_NEARESTPOINT_HPP
2 #define ABLATELIBRARY_NEARESTPOINT_HPP
3 
4 #include <filesystem>
5 #include <istream>
6 #include <vector>
7 #include "mathFunction.hpp"
8 namespace ablate::mathFunctions {
9 
13 class NearestPoint : public MathFunction {
14  private:
16  const std::vector<double> coordinates;
17 
19  const std::vector<double> values;
20 
22  const std::size_t dimension;
23 
25  const std::size_t numberPoints;
26 
27  private:
38  static PetscErrorCode NearestPointPetscFunction(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar* u, void* ctx);
39 
46  std::size_t FindNearestPoint(const double* xyz, std::size_t xyzDimension) const;
47 
48  public:
54  NearestPoint(const std::vector<double>& coordinates, const std::vector<double>& values);
55 
56  double Eval(const double& x, const double& y, const double& z, const double& t) const override;
57 
58  double Eval(const double* xyz, const int& ndims, const double& t) const override;
59 
60  void Eval(const double& x, const double& y, const double& z, const double& t, std::vector<double>& result) const override;
61 
62  void Eval(const double* xyz, const int& ndims, const double& t, std::vector<double>& result) const override;
63 
64  void* GetContext() override { return this; }
65 
66  PetscFunction GetPetscFunction() override { return NearestPointPetscFunction; }
67 };
68 } // namespace ablate::mathFunctions
69 #endif // ABLATELIBRARY_NEARESTPOINT_HPP
Definition: mathFunction.hpp:13
Definition: nearestPoint.hpp:13
PetscFunction GetPetscFunction() override
Definition: nearestPoint.hpp:66
NearestPoint(const std::vector< double > &coordinates, const std::vector< double > &values)
Definition: nearestPoint.cpp:3
double Eval(const double &x, const double &y, const double &z, const double &t) const override
Definition: nearestPoint.cpp:40
void * GetContext() override
Definition: nearestPoint.hpp:64