ABLATE Source Documentation  0.12.34
functionPointer.hpp
1 #ifndef ABLATELIBRARY_FUNCTIONPOINTER_HPP
2 #define ABLATELIBRARY_FUNCTIONPOINTER_HPP
3 #include "mathFunction.hpp"
4 
5 namespace ablate::mathFunctions {
6 
7 class FunctionPointer : public MathFunction {
8  private:
9  void* context;
10  PetscFunction function;
11 
12  public:
13  explicit FunctionPointer(ablate::mathFunctions::PetscFunction function, void* context = nullptr);
14 
15  explicit FunctionPointer();
16 
17  double Eval(const double& x, const double& y, const double& z, const double& t) const override;
18 
19  double Eval(const double* xyz, const int& ndims, const double& t) const override;
20 
21  void Eval(const double& x, const double& y, const double& z, const double& t, std::vector<double>& result) const override;
22 
23  void Eval(const double* xyz, const int& ndims, const double& t, std::vector<double>& result) const override;
24 
25  inline ablate::mathFunctions::PetscFunction GetPetscFunction() override { return function; }
26 
27  inline void* GetContext() override { return context; }
28 };
29 
30 } // namespace ablate::mathFunctions
31 #endif // ABLATELIBRARY_FUNCTIONPOINTER_HPP
Definition: functionPointer.hpp:7
double Eval(const double &x, const double &y, const double &z, const double &t) const override
Definition: functionPointer.cpp:4
ablate::mathFunctions::PetscFunction GetPetscFunction() override
Definition: functionPointer.hpp:25
void * GetContext() override
Definition: functionPointer.hpp:27
Definition: mathFunction.hpp:13