Go to the documentation of this file.
7 #ifndef INCLUDE_JET_GRID3_H_
8 #define INCLUDE_JET_GRID3_H_
67 const std::function<
void(
size_t,
size_t,
size_t)>& func)
const;
78 const std::function<
void(
size_t,
size_t,
size_t)>& func)
const;
81 virtual void serialize(std::vector<uint8_t>* buffer)
const = 0;
84 virtual void deserialize(
const std::vector<uint8_t>& buffer) = 0;
105 virtual void getData(std::vector<double>* data)
const = 0;
108 virtual void setData(
const std::vector<double>& data) = 0;
119 #define JET_GRID3_TYPE_NAME(DerivedClassName) \
120 std::string typeName() const override { return #DerivedClassName; }
124 #endif // INCLUDE_JET_GRID3_H_
virtual void deserialize(const std::vector< uint8_t > &buffer)=0
Deserializes the input buffer to the grid instance.
DataPositionFunc cellCenterPosition() const
Returns the function that maps grid index to the cell-center position.
const BoundingBox3D & boundingBox() const
Returns the bounding box of the grid.
virtual ~Grid3()
Default destructor.
void swapGrid(Grid3 *other)
Swaps the size parameters with given grid other.
Abstract base class for 3-D cartesian grid structure.
Definition: grid3.h:30
void parallelForEachCellIndex(const std::function< void(size_t, size_t, size_t)> &func) const
Invokes the given function func for each grid cell parallelly.
3-D axis-aligned bounding box class.
Definition: bounding_box3.h:41
Grid3()
Constructs an empty grid.
bool hasSameShape(const Grid3 &other) const
Returns true if resolution, grid-spacing and origin are same.
Definition: advection_solver2.h:18
BoundingBox3< double > BoundingBox3D
Double-type 3-D BoundingBox.
Definition: bounding_box3.h:127
virtual void swap(Grid3 *other)=0
Swaps the data with other grid.
virtual void setData(const std::vector< double > &data)=0
Sets the data from a continuous linear array.
const Vector3D & origin() const
Returns the grid origin.
void setGrid(const Grid3 &other)
Sets the size parameters with given grid other.
const Size3 & resolution() const
Returns the grid resolution.
virtual void serialize(std::vector< uint8_t > *buffer) const =0
Serializes the grid instance to the output buffer.
const Vector3D & gridSpacing() const
Returns the grid spacing.
3-D size class.
Definition: size3.h:19
virtual std::string typeName() const =0
Returns the type name of derived grid.
Abstract base class for any serializable class.
Definition: serialization.h:17
std::function< Vector3D(size_t, size_t, size_t)> DataPositionFunc
Function type for mapping data index to actual position.
Definition: grid3.h:33
void forEachCellIndex(const std::function< void(size_t, size_t, size_t)> &func) const
Invokes the given function func for each grid cell.
void setSizeParameters(const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &origin)
Vector3< double > Vector3D
Double-type 3D vector.
Definition: vector3.h:349
3-D vector class.
Definition: vector3.h:25
std::shared_ptr< Grid3 > Grid3Ptr
Definition: grid3.h:117
virtual void getData(std::vector< double > *data) const =0
Fetches the data into a continuous linear array.