ABLATE Source Documentation  0.12.34
simpleFormula.hpp
1 #ifndef ABLATELIBRARY_SIMPLEFORMULA_HPP
2 #define ABLATELIBRARY_SIMPLEFORMULA_HPP
3 #include <muParser.h>
4 #include "formulaBase.hpp"
5 
6 namespace ablate::mathFunctions {
12 class SimpleFormula : public FormulaBase {
13  private:
14  static PetscErrorCode ParsedPetscFunction(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar* u, void* ctx);
15 
16  public:
17  SimpleFormula(const SimpleFormula&) = delete;
18  void operator=(const SimpleFormula&) = delete;
19 
20  explicit SimpleFormula(std::string functionString);
21 
22  double Eval(const double& x, const double& y, const double& z, const double& t) const override;
23 
24  double Eval(const double* xyz, const int& ndims, const double& t) const override;
25 
26  void Eval(const double& x, const double& y, const double& z, const double& t, std::vector<double>& result) const override;
27 
28  void Eval(const double* xyz, const int& ndims, const double& t, std::vector<double>& result) const override;
29 
30  void* GetContext() override { return this; }
31 
32  PetscFunction GetPetscFunction() override { return ParsedPetscFunction; }
33 };
34 } // namespace ablate::mathFunctions
35 
36 #endif // ABLATELIBRARY_SIMPLEFORMULA_HPP
Definition: formulaBase.hpp:14
double time
the time linked to the parser
Definition: formulaBase.hpp:27
Definition: simpleFormula.hpp:12
void * GetContext() override
Definition: simpleFormula.hpp:30
PetscFunction GetPetscFunction() override
Definition: simpleFormula.hpp:32
double Eval(const double &x, const double &y, const double &z, const double &t) const override
Definition: simpleFormula.cpp:14