VectorField2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: VectorField2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 2-D vector field.
6 > Created Time: 2017/03/14
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_VECTOR_FIELD2_H
10 #define CUBBYFLOW_VECTOR_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 VectorField2 : public Field2
22  {
23  public:
25  VectorField2();
26 
28  virtual ~VectorField2();
29 
31  virtual Vector2D Sample(const Vector2D& x) const = 0;
32 
34  virtual double Divergence(const Vector2D& x) const;
35 
37  virtual double Curl(const Vector2D& x) const;
38 
40  virtual std::function<Vector2D(const Vector2D&)> Sampler() const;
41  };
42 
44  using VectorField2Ptr = std::shared_ptr<VectorField2>;
45 }
46 
47 #endif
Abstract base class for 2-D fields.
Definition: Field2.h:17
virtual std::function< Vector2D(const Vector2D &)> Sampler() const
Returns sampler function object.
Definition: pybind11Utils.h:24
std::shared_ptr< VectorField2 > VectorField2Ptr
Shared pointer for the VectorField2 type.
Definition: VectorField2.h:44
virtual Vector2D Sample(const Vector2D &x) const =0
Returns sampled value at given position x.
VectorField2()
Default constructor.
virtual double Divergence(const Vector2D &x) const
Returns divergence at given position x.
2-D vector class.
Definition: Vector2.h:26
Abstract base class for 2-D vector field.
Definition: VectorField2.h:21
virtual double Curl(const Vector2D &x) const
Returns curl at given position x.
virtual ~VectorField2()
Default destructor.