Jet  v1.3.3
vertex_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_VERTEX_CENTERED_SCALAR_GRID3_H_
8 #define INCLUDE_JET_VERTEX_CENTERED_SCALAR_GRID3_H_
9 
10 #include <jet/array3.h>
11 #include <jet/scalar_grid3.h>
12 #include <utility> // just make cpplint happy..
13 
14 namespace jet {
15 
24 class VertexCenteredScalarGrid3 final : public ScalarGrid3 {
25  public:
27 
28  class Builder;
29 
32 
36  size_t resolutionX,
37  size_t resolutionY,
38  size_t resolutionZ,
39  double gridSpacingX = 1.0,
40  double gridSpacingY = 1.0,
41  double gridSpacingZ = 1.0,
42  double originX = 0.0,
43  double originY = 0.0,
44  double originZ = 0.0,
45  double initialValue = 0.0);
46 
50  const Size3& resolution,
51  const Vector3D& gridSpacing = Vector3D(1.0, 1.0, 1.0),
52  const Vector3D& origin = Vector3D(),
53  double initialValue = 0.0);
54 
57 
59  Size3 dataSize() const override;
60 
64  Vector3D dataOrigin() const override;
65 
67  std::shared_ptr<ScalarGrid3> clone() const override;
68 
75  void swap(Grid3* other) override;
76 
78  void set(const VertexCenteredScalarGrid3& other);
79 
82  const VertexCenteredScalarGrid3& other);
83 
85  static Builder builder();
86 };
87 
89 typedef std::shared_ptr<VertexCenteredScalarGrid3> VertexCenteredScalarGrid3Ptr;
90 
91 
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_VERTEX_CENTERED_SCALAR_GRID3_H_
scalar_grid3.h
jet::VertexCenteredScalarGrid3Ptr
std::shared_ptr< VertexCenteredScalarGrid3 > VertexCenteredScalarGrid3Ptr
Shared pointer for the VertexCenteredScalarGrid3 type.
Definition: vertex_centered_scalar_grid3.h:89
jet::VertexCenteredScalarGrid3::VertexCenteredScalarGrid3
VertexCenteredScalarGrid3(const VertexCenteredScalarGrid3 &other)
Copy constructor.
jet::VertexCenteredScalarGrid3::VertexCenteredScalarGrid3
VertexCenteredScalarGrid3(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::VertexCenteredScalarGrid3::Builder::withResolution
Builder & withResolution(size_t resolutionX, size_t resolutionY, size_t resolutionZ)
Returns builder with resolution.
jet::Grid3
Abstract base class for 3-D cartesian grid structure.
Definition: grid3.h:30
jet::VertexCenteredScalarGrid3::Builder::withOrigin
Builder & withOrigin(double gridOriginX, double gridOriginY, double gridOriginZ)
Returns builder with grid origin.
jet::VertexCenteredScalarGrid3::clone
std::shared_ptr< ScalarGrid3 > clone() const override
Returns the copy of the grid instance.
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::VertexCenteredScalarGrid3::builder
static Builder builder()
Returns builder fox VertexCenteredScalarGrid3.
jet::VertexCenteredScalarGrid3::Builder::withResolution
Builder & withResolution(const Size3 &resolution)
Returns builder with resolution.
jet::VertexCenteredScalarGrid3::dataSize
Size3 dataSize() const override
Returns the actual data point size.
jet::VertexCenteredScalarGrid3::Builder
A grid builder class that returns 3-D vertex-centered scalar grid.
Definition: vertex_centered_scalar_grid3.h:93
jet
Definition: advection_solver2.h:18
jet::VertexCenteredScalarGrid3::Builder::withOrigin
Builder & withOrigin(const Vector3D &gridOrigin)
Returns builder with grid origin.
jet::VertexCenteredScalarGrid3::Builder::build
VertexCenteredScalarGrid3 build() const
Builds VertexCenteredScalarGrid3 instance.
jet::Grid3::origin
const Vector3D & origin() const
Returns the grid origin.
jet::Grid3::resolution
const Size3 & resolution() const
Returns the grid resolution.
jet::VertexCenteredScalarGrid3::set
void set(const VertexCenteredScalarGrid3 &other)
Sets the contents with the given other grid.
jet::Grid3::gridSpacing
const Vector3D & gridSpacing() const
Returns the grid spacing.
jet::Size3
3-D size class.
Definition: size3.h:19
array3.h
jet::VertexCenteredScalarGrid3::VertexCenteredScalarGrid3
VertexCenteredScalarGrid3(const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1.0, 1.0, 1.0), const Vector3D &origin=Vector3D(), double initialValue=0.0)
jet::VertexCenteredScalarGrid3::swap
void swap(Grid3 *other) override
Swaps the contents with the given other grid.
jet::VertexCenteredScalarGrid3::Builder::makeShared
VertexCenteredScalarGrid3Ptr makeShared() const
Builds shared pointer of VertexCenteredScalarGrid3 instance.
jet::VertexCenteredScalarGrid3::Builder::withGridSpacing
Builder & withGridSpacing(const Vector3D &gridSpacing)
Returns builder with grid spacing.
jet::VertexCenteredScalarGrid3
3-D Vertex-centered scalar grid structure.
Definition: vertex_centered_scalar_grid3.h:24
jet::VertexCenteredScalarGrid3::Builder::withInitialValue
Builder & withInitialValue(double initialVal)
Returns builder with initial value.
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::VertexCenteredScalarGrid3::Builder::withGridSpacing
Builder & withGridSpacing(double gridSpacingX, double gridSpacingY, double gridSpacingZ)
Returns builder with grid spacing.
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::VertexCenteredScalarGrid3::dataOrigin
Vector3D dataOrigin() const override
jet::VertexCenteredScalarGrid3::Builder::build
ScalarGrid3Ptr build(const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin, double initialVal) const override
Builds shared pointer of VertexCenteredScalarGrid3 instance.
JET_GRID3_TYPE_NAME
#define JET_GRID3_TYPE_NAME(DerivedClassName)
Definition: grid3.h:119
jet::VertexCenteredScalarGrid3::VertexCenteredScalarGrid3
VertexCenteredScalarGrid3()
Constructs zero-sized grid.
jet::VertexCenteredScalarGrid3::operator=
VertexCenteredScalarGrid3 & operator=(const VertexCenteredScalarGrid3 &other)
Sets the contents with the given other grid.