ABLATE Source Documentation  0.12.34
geometry.hpp
1 #ifndef ABLATELIBRARY_GEOMETRY_HPP
2 #define ABLATELIBRARY_GEOMETRY_HPP
3 
4 #include <mathFunctions/mathFunction.hpp>
5 #include <memory>
6 
7 namespace ablate::mathFunctions::geom {
8 
9 class Geometry : public MathFunction {
10  private:
11  const std::shared_ptr<mathFunctions::MathFunction> insideValues;
12  const std::shared_ptr<mathFunctions::MathFunction> outsideValues;
13 
15  const PetscFunction insidePetscFunction;
16  void* insidePetscContext;
17 
19  const PetscFunction outsidePetscFunction;
20  void* outsidePetscContext;
21 
22  protected:
23  explicit Geometry(const std::shared_ptr<mathFunctions::MathFunction>& insideValues, const std::shared_ptr<mathFunctions::MathFunction>& outsideValues);
24 
25  static PetscErrorCode GeometryPetscFunction(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf, PetscScalar* u, void* ctx);
26 
27  public:
28  double Eval(const double& x, const double& y, const double& z, const double& t) const override;
29 
30  double Eval(const double* xyz, const int& ndims, const double& t) const override;
31 
32  void Eval(const double& x, const double& y, const double& z, const double& t, std::vector<double>& result) const override;
33 
34  void Eval(const double* xyz, const int& ndims, const double& t, std::vector<double>& result) const override;
35 
36  void* GetContext() override { return this; }
37 
38  PetscFunction GetPetscFunction() override { return GeometryPetscFunction; }
39 
47  virtual bool InsideGeometry(const double* xyz, const int& ndims, const double& time) const = 0;
48 
52  inline const std::shared_ptr<mathFunctions::MathFunction>& InsideValues() const { return insideValues; };
53 
57  inline const std::shared_ptr<mathFunctions::MathFunction> OutsideValues() const { return outsideValues; };
58 };
59 
60 } // namespace ablate::mathFunctions::geom
61 #endif // ABLATELIBRARY_GEOMETRY_HPP
Definition: mathFunction.hpp:13
Definition: geometry.hpp:9
const std::shared_ptr< mathFunctions::MathFunction > OutsideValues() const
Definition: geometry.hpp:57
void * GetContext() override
Definition: geometry.hpp:36
PetscFunction GetPetscFunction() override
Definition: geometry.hpp:38
double Eval(const double &x, const double &y, const double &z, const double &t) const override
Definition: geometry.cpp:24
const std::shared_ptr< mathFunctions::MathFunction > & InsideValues() const
Definition: geometry.hpp:52
virtual bool InsideGeometry(const double *xyz, const int &ndims, const double &time) const =0