FaceCenteredGrid2.h
Go to the documentation of this file.
137 void Fill(const std::function<Vector2D(const Vector2D&)>& func, ExecutionPolicy policy = ExecutionPolicy::Parallel) override;
Builder & WithResolution(const Size2 &resolution)
Returns builder with resolution.
double CurlAtCellCenter(size_t i, size_t j) const
Returns curl at cell-center location.
2-D read-only array accessor class.
Definition: ArrayAccessor2.h:261
ConstScalarDataAccessor GetVConstAccessor() const
Returns read-only v data accessor.
static Builder GetBuilder()
Returns builder fox FaceCenteredGrid2.
void ParallelForEachUIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each u-data point in parallel.
Builder & WithInitialValue(const Vector2D &initialVal)
Returns builder with initial value.
Abstract base class for 2-D vector grid builder.
Definition: VectorGrid2.h:93
Abstract base class for 2-D vector grid structure.
Definition: VectorGrid2.h:19
void SetData(const std::vector< double > &data) override
Sets the data from a continuous linear array.
DataPositionFunc GetVPosition() const
Returns function object that maps v data point to its actual position.
double Curl(const Vector2D &x) const override
Returns curl at given position x.
void Swap(Grid2 *other) override
Swaps the contents with the given other grid.
std::function< Vector2D(const Vector2D &)> Sampler() const override
Returns the sampler function.
FaceCenteredGrid2 & operator=(const FaceCenteredGrid2 &other)
Sets the contents with the given other grid.
std::shared_ptr< VectorGrid2 > Clone() const override
Returns the copy of the grid instance.
Vector2D GetVOrigin() const
Returns v-data position for the grid point at (0, 0).
void OnResize(const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin, const Vector2D &initialValue) final
Invoked when the resizing happens.
double & GetU(size_t i, size_t j)
Returns u-value at given data point.
void ParallelForEachVIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each v-data point in parallel.
2-D face-centered (a.k.a MAC or staggered) grid.
Definition: FaceCenteredGrid2.h:25
FaceCenteredGrid2Ptr MakeShared() const
Builds shared pointer of FaceCenteredGrid2 instance.
Vector2D Sample(const Vector2D &x) const override
Returns sampled value at given position x.
Vector2D ValueAtCellCenter(size_t i, size_t j) const
Returns interpolated value at cell center.
Builder & WithOrigin(const Vector2D &gridOrigin)
Returns builder with grid origin.
double & GetV(size_t i, size_t j)
Returns v-value at given data point.
Definition: pybind11Utils.h:24
std::shared_ptr< VectorGrid2 > VectorGrid2Ptr
Shared pointer for the VectorGrid2 type.
Definition: VectorGrid2.h:90
void ForEachVIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each v-data point.
void Fill(const Vector2D &value, ExecutionPolicy policy=ExecutionPolicy::Parallel) override
Fills the grid with given value.
DataPositionFunc GetUPosition() const
Returns function object that maps u data point to its actual position.
double Divergence(const Vector2D &x) const override
Returns divergence at given position x.
void ForEachUIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each u-data point.
Front-end to create FaceCenteredGrid2 objects step by step.
Definition: FaceCenteredGrid2.h:233
std::shared_ptr< FaceCenteredGrid2 > FaceCenteredGrid2Ptr
Shared pointer type for the FaceCenteredGrid2.
Definition: FaceCenteredGrid2.h:228
void GetData(std::vector< double > *data) const override
Fetches the data into a continuous linear array.
Vector2D GetUOrigin() const
Returns u-data position for the grid point at (0, 0).
double DivergenceAtCellCenter(size_t i, size_t j) const
Returns divergence at cell-center location.
2-D linear array sampler class.
Definition: ArraySamplers2.h:78
ConstScalarDataAccessor GetUConstAccessor() const
Returns read-only u data accessor.
std::function< Vector2D(size_t, size_t)> DataPositionFunc
Function type for mapping data index to actual position.
Definition: Grid2.h:34
void Set(const FaceCenteredGrid2 &other)
Sets the contents with the given other grid.
FaceCenteredGrid2 Build() const
Builds FaceCenteredGrid2 instance.
Builder & WithGridSpacing(const Vector2D &gridSpacing)
Returns builder with grid spacing.