Jet  v1.3.3
vertex_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_VERTEX_CENTERED_VECTOR_GRID3_H_
8 #define INCLUDE_JET_VERTEX_CENTERED_VECTOR_GRID3_H_
9 
11 #include <utility> // just make cpplint happy..
12 
13 namespace jet {
14 
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 initialValueU = 0.0,
45  double initialValueV = 0.0,
46  double initialValueW = 0.0);
47 
51  const Size3& resolution,
52  const Vector3D& gridSpacing = Vector3D(1.0, 1.0, 1.0),
53  const Vector3D& origin = Vector3D(),
54  const Vector3D& initialValue = Vector3D());
55 
57  Size3 dataSize() const override;
58 
62  Vector3D dataOrigin() const override;
63 
70  void swap(Grid3* other) override;
71 
73  void fill(const Vector3D& value,
75 
77  void fill(const std::function<Vector3D(const Vector3D&)>& func,
79 
81  std::shared_ptr<VectorGrid3> clone() const override;
82 
84  void set(const VertexCenteredVectorGrid3& other);
85 
88  const VertexCenteredVectorGrid3& other);
89 
91  static Builder builder();
92 };
93 
95 typedef std::shared_ptr<VertexCenteredVectorGrid3> VertexCenteredVectorGrid3Ptr;
96 
97 
102  public:
105 
108  size_t resolutionX, size_t resolutionY, size_t resolutionZ);
109 
112 
115  double gridSpacingX, double gridSpacingY, double gridSpacingZ);
116 
118  Builder& withOrigin(const Vector3D& gridOrigin);
119 
122  double gridOriginX, double gridOriginY, double gridOriginZ);
123 
125  Builder& withInitialValue(const Vector3D& initialVal);
126 
129  double initialValX, double initialValY, double initialValZ);
130 
133 
136 
143  const Size3& resolution,
144  const Vector3D& gridSpacing,
145  const Vector3D& gridOrigin,
146  const Vector3D& initialVal) const override;
147 
148  private:
149  Size3 _resolution{1, 1, 1};
150  Vector3D _gridSpacing{1, 1, 1};
151  Vector3D _gridOrigin{0, 0, 0};
152  Vector3D _initialVal{0, 0, 0};
153 };
154 
155 } // namespace jet
156 
157 #endif // INCLUDE_JET_VERTEX_CENTERED_VECTOR_GRID3_H_
jet::VertexCenteredVectorGrid3::Builder::withResolution
Builder & withResolution(size_t resolutionX, size_t resolutionY, size_t resolutionZ)
Returns builder with resolution.
jet::VertexCenteredVectorGrid3::Builder::withInitialValue
Builder & withInitialValue(double initialValX, double initialValY, double initialValZ)
Returns builder with initial value.
jet::ExecutionPolicy
ExecutionPolicy
Execution policy tag.
Definition: parallel.h:13
jet::VertexCenteredVectorGrid3::swap
void swap(Grid3 *other) override
Swaps the contents with the given other grid.
jet::VertexCenteredVectorGrid3::operator=
VertexCenteredVectorGrid3 & operator=(const VertexCenteredVectorGrid3 &other)
Sets the contents with the given other grid.
jet::VertexCenteredVectorGrid3::Builder::build
VertexCenteredVectorGrid3 build() const
Builds VertexCenteredVectorGrid3 instance.
jet::VectorGrid3Ptr
std::shared_ptr< VectorGrid3 > VectorGrid3Ptr
Shared pointer for the VectorGrid3 type.
Definition: vector_grid3.h:103
jet::VertexCenteredVectorGrid3::Builder::withGridSpacing
Builder & withGridSpacing(double gridSpacingX, double gridSpacingY, double gridSpacingZ)
Returns builder with grid spacing.
jet::Grid3
Abstract base class for 3-D cartesian grid structure.
Definition: grid3.h:30
jet::VertexCenteredVectorGrid3::VertexCenteredVectorGrid3
VertexCenteredVectorGrid3(const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1.0, 1.0, 1.0), const Vector3D &origin=Vector3D(), const Vector3D &initialValue=Vector3D())
jet::VertexCenteredVectorGrid3::dataSize
Size3 dataSize() const override
Returns the actual data point size.
jet::VertexCenteredVectorGrid3::VertexCenteredVectorGrid3
VertexCenteredVectorGrid3()
Constructs zero-sized grid.
jet::VertexCenteredVectorGrid3::Builder
Front-end to create VertexCenteredVectorGrid3 objects step by step.
Definition: vertex_centered_vector_grid3.h:101
jet::VertexCenteredVectorGrid3::dataOrigin
Vector3D dataOrigin() const override
jet::CollocatedVectorGrid3
Abstract base class for 3-D collocated vector grid structure.
Definition: collocated_vector_grid3.h:18
jet::VertexCenteredVectorGrid3::fill
void fill(const Vector3D &value, ExecutionPolicy policy=ExecutionPolicy::kParallel) override
Fills the grid with given value.
jet
Definition: advection_solver2.h:18
jet::VertexCenteredVectorGrid3::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::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::VertexCenteredVectorGrid3::clone
std::shared_ptr< VectorGrid3 > clone() const override
Returns the copy of the grid instance.
jet::VertexCenteredVectorGrid3Ptr
std::shared_ptr< VertexCenteredVectorGrid3 > VertexCenteredVectorGrid3Ptr
Shared pointer for the VertexCenteredVectorGrid3 type.
Definition: vertex_centered_vector_grid3.h:95
jet::Size3
3-D size class.
Definition: size3.h:19
jet::VertexCenteredVectorGrid3::VertexCenteredVectorGrid3
VertexCenteredVectorGrid3(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::VertexCenteredVectorGrid3
3-D Vertex-centered vector grid structure.
Definition: vertex_centered_vector_grid3.h:23
jet::Vector3D
Vector3< double > Vector3D
Double-type 3D vector.
Definition: vector3.h:349
jet::VertexCenteredVectorGrid3::set
void set(const VertexCenteredVectorGrid3 &other)
Sets the contents with the given other grid.
jet::VertexCenteredVectorGrid3::Builder::withInitialValue
Builder & withInitialValue(const Vector3D &initialVal)
Returns builder with initial value.
jet::Vector< T, 3 >
3-D vector class.
Definition: vector3.h:25
jet::ExecutionPolicy::kParallel
@ kParallel
collocated_vector_grid3.h
jet::VertexCenteredVectorGrid3::Builder::withOrigin
Builder & withOrigin(const Vector3D &gridOrigin)
Returns builder with grid origin.
jet::VertexCenteredVectorGrid3::builder
static Builder builder()
Returns builder fox VertexCenteredVectorGrid3.
jet::VertexCenteredVectorGrid3::Builder::build
VectorGrid3Ptr build(const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &gridOrigin, const Vector3D &initialVal) const override
Builds shared pointer of VertexCenteredVectorGrid3 instance.
jet::VertexCenteredVectorGrid3::Builder::makeShared
VertexCenteredVectorGrid3Ptr makeShared() const
Builds shared pointer of VertexCenteredVectorGrid3 instance.
JET_GRID3_TYPE_NAME
#define JET_GRID3_TYPE_NAME(DerivedClassName)
Definition: grid3.h:119
jet::VertexCenteredVectorGrid3::fill
void fill(const std::function< Vector3D(const Vector3D &)> &func, ExecutionPolicy policy=ExecutionPolicy::kParallel) override
Fills the grid with given function.
jet::VertexCenteredVectorGrid3::Builder::withOrigin
Builder & withOrigin(double gridOriginX, double gridOriginY, double gridOriginZ)
Returns builder with grid origin.
jet::VertexCenteredVectorGrid3::Builder::withGridSpacing
Builder & withGridSpacing(const Vector3D &gridSpacing)
Returns builder with grid spacing.