ConstantVectorField3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: ConstantVectorField3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: 3-D constant vector field.
6 > Created Time: 2017/04/01
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_CONSTANT_VECTOR_FIELD3_H
10 #define CUBBYFLOW_CONSTANT_VECTOR_FIELD3_H
11 
13 
14 namespace CubbyFlow
15 {
17  class ConstantVectorField3 final : public VectorField3
18  {
19  public:
20  class Builder;
21 
23  explicit ConstantVectorField3(const Vector3D& value);
24 
26  Vector3D Sample(const Vector3D& x) const override;
27 
29  std::function<Vector3D(const Vector3D&)> Sampler() const override;
30 
32  static Builder GetBuilder();
33 
34  private:
35  Vector3D m_value;
36  };
37 
39  using ConstantVectorField3Ptr = std::shared_ptr<ConstantVectorField3>;
40 
41 
46  {
47  public:
49  Builder& WithValue(const Vector3D& value);
50 
53 
56 
57  private:
58  Vector3D m_value{ 0, 0, 0 };
59  };
60 }
61 
62 #endif
3-D vector class.
Definition: Vector3.h:26
ConstantVectorField3(const Vector3D &value)
Constructs a constant vector field with given value.
3-D constant vector field.
Definition: ConstantVectorField3.h:17
std::function< Vector3D(const Vector3D &)> Sampler() const override
Returns the sampler function.
Front-end to create ConstantVectorField3 objects step by step.
Definition: ConstantVectorField3.h:45
Definition: pybind11Utils.h:24
Builder & WithValue(const Vector3D &value)
Returns builder with value.
std::shared_ptr< ConstantVectorField3 > ConstantVectorField3Ptr
Shared pointer for the ConstantVectorField3 type.
Definition: ConstantVectorField3.h:39
Abstract base class for 3-D vector field.
Definition: VectorField3.h:21
ConstantVectorField3 Build() const
Builds ConstantVectorField3.
Vector3D Sample(const Vector3D &x) const override
Returns the sampled value at given position x.
ConstantVectorField3Ptr MakeShared() const
Builds shared pointer of ConstantVectorField3 instance.
static Builder GetBuilder()
Returns builder fox ConstantVectorField3.