Jet  v1.3.3
cell_centered_scalar_grid3.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_CELL_CENTERED_SCALAR_GRID3_H_
8 #define INCLUDE_JET_CELL_CENTERED_SCALAR_GRID3_H_
9 
10 #include <jet/scalar_grid3.h>
11 #include <utility> // just make cpplint happy..
12 
13 namespace jet {
14 
23 class CellCenteredScalarGrid3 final : public ScalarGrid3 {
24  public:
26 
27  class Builder;
28 
31 
35  size_t resolutionX,
36  size_t resolutionY,
37  size_t resolutionZ,
38  double gridSpacingX = 1.0,
39  double gridSpacingY = 1.0,
40  double gridSpacingZ = 1.0,
41  double originX = 0.0,
42  double originY = 0.0,
43  double originZ = 0.0,
44  double initialValue = 0.0);
45 
49  const Size3& resolution,
50  const Vector3D& gridSpacing = Vector3D(1.0, 1.0, 1.0),
51  const Vector3D& origin = Vector3D(),
52  double initialValue = 0.0);
53 
56 
58  Size3 dataSize() const override;
59 
63  Vector3D dataOrigin() const override;
64 
66  std::shared_ptr<ScalarGrid3> clone() const override;
67 
74  void swap(Grid3* other) override;
75 
77  void set(const CellCenteredScalarGrid3& other);
78 
81 
83  static Builder builder();
84 };
85 
87 typedef std::shared_ptr<CellCenteredScalarGrid3> CellCenteredScalarGrid3Ptr;
88 
89 
94  public:
97 
100  size_t resolutionX, size_t resolutionY, size_t resolutionZ);
101 
104 
107  double gridSpacingX, double gridSpacingY, double gridSpacingZ);
108 
110  Builder& withOrigin(const Vector3D& gridOrigin);
111 
114  double gridOriginX, double gridOriginY, double gridOriginZ);
115 
117  Builder& withInitialValue(double initialVal);
118 
121 
124 
131  const Size3& resolution,
132  const Vector3D& gridSpacing,
133  const Vector3D& gridOrigin,
134  double initialVal) const override;
135 
136  private:
137  Size3 _resolution{1, 1, 1};
138  Vector3D _gridSpacing{1, 1, 1};
139  Vector3D _gridOrigin{0, 0, 0};
140  double _initialVal = 0.0;
141 };
142 
143 } // namespace jet
144 
145 #endif // INCLUDE_JET_CELL_CENTERED_SCALAR_GRID3_H_
jet::CellCenteredScalarGrid3::Builder::withResolution
Builder & withResolution(size_t resolutionX, size_t resolutionY, size_t resolutionZ)
Returns builder with resolution.
scalar_grid3.h
jet::CellCenteredScalarGrid3::dataSize
Size3 dataSize() const override
Returns the actual data point size.
jet::Grid3
Abstract base class for 3-D cartesian grid structure.
Definition: grid3.h:30
jet::CellCenteredScalarGrid3::operator=
CellCenteredScalarGrid3 & operator=(const CellCenteredScalarGrid3 &other)
Sets the contents with the given other grid.
jet::CellCenteredScalarGrid3Ptr
std::shared_ptr< CellCenteredScalarGrid3 > CellCenteredScalarGrid3Ptr
Shared pointer for the CellCenteredScalarGrid3 type.
Definition: cell_centered_scalar_grid3.h:87
jet::ScalarGrid3Ptr
std::shared_ptr< ScalarGrid3 > ScalarGrid3Ptr
Shared pointer for the ScalarGrid3 type.
Definition: scalar_grid3.h:193
jet::ScalarGridBuilder3
Abstract base class for 3-D scalar grid builder.
Definition: scalar_grid3.h:196
jet::CellCenteredScalarGrid3::Builder::withGridSpacing
Builder & withGridSpacing(double gridSpacingX, double gridSpacingY, double gridSpacingZ)
Returns builder with grid spacing.
jet
Definition: advection_solver2.h:18
jet::CellCenteredScalarGrid3::Builder::withResolution
Builder & withResolution(const Size3 &resolution)
Returns builder with resolution.
jet::Grid3::origin
const Vector3D & origin() const
Returns the grid origin.
jet::Grid3::resolution
const Size3 & resolution() const
Returns the grid resolution.
jet::CellCenteredScalarGrid3::CellCenteredScalarGrid3
CellCenteredScalarGrid3()
Constructs zero-sized grid.
jet::CellCenteredScalarGrid3::Builder::withOrigin
Builder & withOrigin(double gridOriginX, double gridOriginY, double gridOriginZ)
Returns builder with grid origin.
jet::CellCenteredScalarGrid3::swap
void swap(Grid3 *other) override
Swaps the contents with the given other grid.
jet::CellCenteredScalarGrid3::builder
static Builder builder()
Returns builder fox CellCenteredScalarGrid3.
jet::CellCenteredScalarGrid3::Builder::withInitialValue
Builder & withInitialValue(double initialVal)
Returns builder with initial value.
jet::Grid3::gridSpacing
const Vector3D & gridSpacing() const
Returns the grid spacing.
jet::CellCenteredScalarGrid3::Builder
Front-end to create CellCenteredScalarGrid3 objects step by step.
Definition: cell_centered_scalar_grid3.h:93
jet::Size3
3-D size class.
Definition: size3.h:19
jet::CellCenteredScalarGrid3::CellCenteredScalarGrid3
CellCenteredScalarGrid3(const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1.0, 1.0, 1.0), const Vector3D &origin=Vector3D(), double initialValue=0.0)
jet::CellCenteredScalarGrid3::Builder::build
ScalarGrid3Ptr build(const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin, double initialVal) const override
Builds shared pointer of CellCenteredScalarGrid3 instance.
jet::ScalarGrid3
Abstract base class for 3-D scalar grid structure.
Definition: scalar_grid3.h:21
jet::Vector3D
Vector3< double > Vector3D
Double-type 3D vector.
Definition: vector3.h:349
jet::CellCenteredScalarGrid3::clone
std::shared_ptr< ScalarGrid3 > clone() const override
Returns the copy of the grid instance.
jet::CellCenteredScalarGrid3::CellCenteredScalarGrid3
CellCenteredScalarGrid3(const CellCenteredScalarGrid3 &other)
Copy constructor.
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::CellCenteredScalarGrid3::Builder::withGridSpacing
Builder & withGridSpacing(const Vector3D &gridSpacing)
Returns builder with grid spacing.
jet::CellCenteredScalarGrid3::dataOrigin
Vector3D dataOrigin() const override
jet::CellCenteredScalarGrid3::CellCenteredScalarGrid3
CellCenteredScalarGrid3(size_t resolutionX, size_t resolutionY, size_t resolutionZ, double gridSpacingX=1.0, double gridSpacingY=1.0, double gridSpacingZ=1.0, double originX=0.0, double originY=0.0, double originZ=0.0, double initialValue=0.0)
jet::CellCenteredScalarGrid3::Builder::build
CellCenteredScalarGrid3 build() const
Builds CellCenteredScalarGrid3 instance.
JET_GRID3_TYPE_NAME
#define JET_GRID3_TYPE_NAME(DerivedClassName)
Definition: grid3.h:119
jet::CellCenteredScalarGrid3
3-D Cell-centered scalar grid structure.
Definition: cell_centered_scalar_grid3.h:23
jet::CellCenteredScalarGrid3::set
void set(const CellCenteredScalarGrid3 &other)
Sets the contents with the given other grid.
jet::CellCenteredScalarGrid3::Builder::makeShared
CellCenteredScalarGrid3Ptr makeShared() const
Builds shared pointer of CellCenteredScalarGrid3 instance.
jet::CellCenteredScalarGrid3::Builder::withOrigin
Builder & withOrigin(const Vector3D &gridOrigin)
Returns builder with grid origin.