Jet  v1.3.3
cell_centered_vector_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_VECTOR_GRID3_H_
8 #define INCLUDE_JET_CELL_CENTERED_VECTOR_GRID3_H_
9 
10 #include <jet/array3.h>
12 #include <utility> // just make cpplint happy..
13 #include <vector>
14 
15 namespace jet {
16 
26  public:
28 
29  class Builder;
30 
33 
37  size_t resolutionX,
38  size_t resolutionY,
39  size_t resolutionZ,
40  double gridSpacingX = 1.0,
41  double gridSpacingY = 1.0,
42  double gridSpacingZ = 1.0,
43  double originX = 0.0,
44  double originY = 0.0,
45  double originZ = 0.0,
46  double initialValueU = 0.0,
47  double initialValueV = 0.0,
48  double initialValueW = 0.0);
49 
53  const Size3& resolution,
54  const Vector3D& gridSpacing = Vector3D(1.0, 1.0, 1.0),
55  const Vector3D& origin = Vector3D(),
56  const Vector3D& initialValue = Vector3D());
57 
60 
62  Size3 dataSize() const override;
63 
67  Vector3D dataOrigin() const override;
68 
70  std::shared_ptr<VectorGrid3> clone() const override;
71 
78  void swap(Grid3* other) override;
79 
81  void fill(const Vector3D& value,
83 
85  void fill(const std::function<Vector3D(const Vector3D&)>& func,
87 
89  void set(const CellCenteredVectorGrid3& other);
90 
93 
95  static Builder builder();
96 };
97 
99 typedef std::shared_ptr<CellCenteredVectorGrid3> CellCenteredVectorGrid3Ptr;
100 
101 
106  public:
109 
112  size_t resolutionX, size_t resolutionY, size_t resolutionZ);
113 
116 
119  double gridSpacingX, double gridSpacingY, double gridSpacingZ);
120 
122  Builder& withOrigin(const Vector3D& gridOrigin);
123 
126  double gridOriginX, double gridOriginY, double gridOriginZ);
127 
129  Builder& withInitialValue(const Vector3D& initialVal);
130 
133  double initialValX, double initialValY, double initialValZ);
134 
137 
140 
147  const Size3& resolution,
148  const Vector3D& gridSpacing,
149  const Vector3D& gridOrigin,
150  const Vector3D& initialVal) const override;
151 
152  private:
153  Size3 _resolution{1, 1, 1};
154  Vector3D _gridSpacing{1, 1, 1};
155  Vector3D _gridOrigin{0, 0, 0};
156  Vector3D _initialVal{0, 0, 0};
157 };
158 
159 } // namespace jet
160 
161 #endif // INCLUDE_JET_CELL_CENTERED_VECTOR_GRID3_H_
jet::ExecutionPolicy
ExecutionPolicy
Execution policy tag.
Definition: parallel.h:13
jet::VectorGrid3Ptr
std::shared_ptr< VectorGrid3 > VectorGrid3Ptr
Shared pointer for the VectorGrid3 type.
Definition: vector_grid3.h:103
jet::Grid3
Abstract base class for 3-D cartesian grid structure.
Definition: grid3.h:30
jet::CellCenteredVectorGrid3::Builder
Front-end to create CellCenteredScalarGrid3 objects step by step.
Definition: cell_centered_vector_grid3.h:105
jet::CellCenteredVectorGrid3::Builder::build
VectorGrid3Ptr build(const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin, const Vector3D &initialVal) const override
Builds shared pointer of CellCenteredVectorGrid3 instance.
jet::CellCenteredVectorGrid3::Builder::build
CellCenteredVectorGrid3 build() const
Builds CellCenteredScalarGrid3 instance.
jet::CellCenteredVectorGrid3::clone
std::shared_ptr< VectorGrid3 > clone() const override
Returns the copy of the grid instance.
jet::CellCenteredVectorGrid3::Builder::withGridSpacing
Builder & withGridSpacing(double gridSpacingX, double gridSpacingY, double gridSpacingZ)
Returns builder with grid spacing.
jet::CollocatedVectorGrid3
Abstract base class for 3-D collocated vector grid structure.
Definition: collocated_vector_grid3.h:18
jet::CellCenteredVectorGrid3::dataOrigin
Vector3D dataOrigin() const override
jet::CellCenteredVectorGrid3::CellCenteredVectorGrid3
CellCenteredVectorGrid3(const CellCenteredVectorGrid3 &other)
Copy constructor.
jet::CellCenteredVectorGrid3::Builder::makeShared
CellCenteredVectorGrid3Ptr makeShared() const
Builds shared pointer of CellCenteredVectorGrid3 instance.
jet
Definition: advection_solver2.h:18
jet::CellCenteredVectorGrid3::CellCenteredVectorGrid3
CellCenteredVectorGrid3()
Constructs zero-sized grid.
jet::Grid3::origin
const Vector3D & origin() const
Returns the grid origin.
jet::Grid3::resolution
const Size3 & resolution() const
Returns the grid resolution.
jet::CellCenteredVectorGrid3::operator=
CellCenteredVectorGrid3 & operator=(const CellCenteredVectorGrid3 &other)
Sets the contents with the given other grid.
jet::CellCenteredVectorGrid3::Builder::withInitialValue
Builder & withInitialValue(const Vector3D &initialVal)
Returns builder with initial value.
jet::CellCenteredVectorGrid3Ptr
std::shared_ptr< CellCenteredVectorGrid3 > CellCenteredVectorGrid3Ptr
Shared pointer for the CellCenteredVectorGrid3 type.
Definition: cell_centered_vector_grid3.h:99
jet::CellCenteredVectorGrid3::dataSize
Size3 dataSize() const override
Returns the actual data point size.
jet::VectorGridBuilder3
Abstract base class for 3-D vector grid builder.
Definition: vector_grid3.h:106
jet::Grid3::gridSpacing
const Vector3D & gridSpacing() const
Returns the grid spacing.
jet::CellCenteredVectorGrid3::Builder::withGridSpacing
Builder & withGridSpacing(const Vector3D &gridSpacing)
Returns builder with grid spacing.
jet::CellCenteredVectorGrid3::fill
void fill(const std::function< Vector3D(const Vector3D &)> &func, ExecutionPolicy policy=ExecutionPolicy::kParallel) override
Fills the grid with given function.
jet::CellCenteredVectorGrid3::Builder::withResolution
Builder & withResolution(const Size3 &resolution)
Returns builder with resolution.
jet::Size3
3-D size class.
Definition: size3.h:19
array3.h
jet::CellCenteredVectorGrid3::Builder::withOrigin
Builder & withOrigin(const Vector3D &gridOrigin)
Returns builder with grid origin.
jet::Vector3D
Vector3< double > Vector3D
Double-type 3D vector.
Definition: vector3.h:349
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::ExecutionPolicy::kParallel
@ kParallel
collocated_vector_grid3.h
jet::CellCenteredVectorGrid3::swap
void swap(Grid3 *other) override
Swaps the contents with the given other grid.
jet::CellCenteredVectorGrid3::Builder::withOrigin
Builder & withOrigin(double gridOriginX, double gridOriginY, double gridOriginZ)
Returns builder with grid origin.
jet::CellCenteredVectorGrid3::builder
static Builder builder()
Returns builder fox CellCenteredVectorGrid3.
jet::CellCenteredVectorGrid3::fill
void fill(const Vector3D &value, ExecutionPolicy policy=ExecutionPolicy::kParallel) override
Fills the grid with given value.
jet::CellCenteredVectorGrid3
3-D Cell-centered vector grid structure.
Definition: cell_centered_vector_grid3.h:25
jet::CellCenteredVectorGrid3::Builder::withResolution
Builder & withResolution(size_t resolutionX, size_t resolutionY, size_t resolutionZ)
Returns builder with resolution.
jet::CellCenteredVectorGrid3::CellCenteredVectorGrid3
CellCenteredVectorGrid3(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 initialValueU=0.0, double initialValueV=0.0, double initialValueW=0.0)
JET_GRID3_TYPE_NAME
#define JET_GRID3_TYPE_NAME(DerivedClassName)
Definition: grid3.h:119
jet::CellCenteredVectorGrid3::Builder::withInitialValue
Builder & withInitialValue(double initialValX, double initialValY, double initialValZ)
Returns builder with initial value.
jet::CellCenteredVectorGrid3::set
void set(const CellCenteredVectorGrid3 &other)
Sets the contents with the given other grid.
jet::CellCenteredVectorGrid3::CellCenteredVectorGrid3
CellCenteredVectorGrid3(const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1.0, 1.0, 1.0), const Vector3D &origin=Vector3D(), const Vector3D &initialValue=Vector3D())