ScalarField2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: ScalarField2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 2-D scalar field.
6 > Created Time: 2017/03/14
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_SCALAR_FIELD2_H
10 #define CUBBYFLOW_SCALAR_FIELD2_H
11 
12 #include <Core/Field/Field2.h>
13 #include <Core/Vector/Vector2.h>
14 
15 #include <functional>
16 #include <memory>
17 
18 namespace CubbyFlow
19 {
21  class ScalarField2 : public Field2
22  {
23  public:
25  ScalarField2();
26 
28  virtual ~ScalarField2();
29 
31  virtual double Sample(const Vector2D& x) const = 0;
32 
34  virtual Vector2D Gradient(const Vector2D& x) const;
35 
37  virtual double Laplacian(const Vector2D& x) const;
38 
40  virtual std::function<double(const Vector2D&)> Sampler() const;
41  };
42 
44  using ScalarField2Ptr = std::shared_ptr<ScalarField2>;
45 }
46 
47 #endif
Abstract base class for 2-D scalar field.
Definition: ScalarField2.h:21
virtual Vector2D Gradient(const Vector2D &x) const
Returns gradient vector at given position x.
virtual double Sample(const Vector2D &x) const =0
Returns sampled value at given position x.
virtual ~ScalarField2()
Default destructor.
Abstract base class for 2-D fields.
Definition: Field2.h:17
std::shared_ptr< ScalarField2 > ScalarField2Ptr
Shared pointer for the ScalarField2 type.
Definition: ScalarField2.h:44
Definition: pybind11Utils.h:24
virtual double Laplacian(const Vector2D &x) const
Returns Laplacian at given position x.
2-D vector class.
Definition: Vector2.h:26
virtual std::function< double(const Vector2D &)> Sampler() const
Returns sampler function object.
ScalarField2()
Default constructor.