Go to the documentation of this file.
7 #ifndef INCLUDE_JET_GRID2_H_
8 #define INCLUDE_JET_GRID2_H_
67 const std::function<
void(
size_t,
size_t)>& func)
const;
78 const std::function<
void(
size_t,
size_t)>& func)
const;
99 virtual void getData(std::vector<double>* data)
const = 0;
102 virtual void setData(
const std::vector<double>& data) = 0;
113 #define JET_GRID2_TYPE_NAME(DerivedClassName) \
114 std::string typeName() const override { return #DerivedClassName; }
118 #endif // INCLUDE_JET_GRID2_H_
void swapGrid(Grid2 *other)
Swaps the size parameters with given grid other.
virtual std::string typeName() const =0
Returns the type name of derived grid.
void forEachCellIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each grid cell.
virtual void getData(std::vector< double > *data) const =0
Fetches the data into a continuous linear array.
const Vector2D & origin() const
Returns the grid origin.
virtual void setData(const std::vector< double > &data)=0
Sets the data from a continuous linear array.
Vector2< double > Vector2D
Double-type 2D vector.
Definition: vector2.h:340
void setGrid(const Grid2 &other)
Sets the size parameters with given grid other.
Grid2()
Constructs an empty grid.
BoundingBox2< double > BoundingBox2D
Double-type 2-D BoundingBox.
Definition: bounding_box2.h:124
Abstract base class for 2-D cartesian grid structure.
Definition: grid2.h:30
std::function< Vector2D(size_t, size_t)> DataPositionFunc
Function type for mapping data index to actual position.
Definition: grid2.h:33
void setSizeParameters(const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin)
Definition: advection_solver2.h:18
2-D vector class.
Definition: vector2.h:24
virtual void swap(Grid2 *other)=0
Swaps the data with other grid.
virtual ~Grid2()
Default destructor.
Abstract base class for any serializable class.
Definition: serialization.h:17
2-D axis-aligned bounding box class.
Definition: bounding_box2.h:41
2-D size class.
Definition: size2.h:19
bool hasSameShape(const Grid2 &other) const
Returns true if resolution, grid-spacing and origin are same.
const Size2 & resolution() const
Returns the grid resolution.
std::shared_ptr< Grid2 > Grid2Ptr
Definition: grid2.h:111
const Vector2D & gridSpacing() const
Returns the grid spacing.
void parallelForEachCellIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each grid cell parallelly.
const BoundingBox2D & boundingBox() const
Returns the bounding box of the grid.
DataPositionFunc cellCenterPosition() const
Returns the function that maps grid index to the cell-center position.