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