Loading...
Searching...
No Matches
FaceCenteredGrid.hpp
Go to the documentation of this file.
#define CUBBYFLOW_GRID_TYPE_NAME(DerivedClassName, N)
Definition Grid.hpp:195
Front-end to create FaceCenteredGrid objects step by step.
Definition FaceCenteredGrid.hpp:444
Builder & WithGridSpacing(const Vector< double, N > &gridSpacing)
Returns builder with grid spacing.
std::shared_ptr< FaceCenteredGrid > MakeShared() const
Builds shared pointer of FaceCenteredGrid instance.
Builder & WithInitialValue(const Vector< double, N > &initialVal)
Returns builder with initial value.
FaceCenteredGrid Build() const
Builds FaceCenteredGrid instance.
std::shared_ptr< VectorGrid< N > > Build(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &gridOrigin, const Vector< double, N > &initialVal) const override
Builds shared pointer of FaceCenteredGrid instance.
Builder & WithOrigin(const Vector< double, N > &gridOrigin)
Returns builder with grid origin.
Builder & WithResolution(const Vector< size_t, N > &resolution)
Returns builder with resolution.
N-D face-centered (a.k.a MAC or staggered) grid.
Definition FaceCenteredGrid.hpp:32
double & U(const Vector< size_t, N > &idx)
Returns u-value at given data point.
void Fill(const Vector< double, N > &value, ExecutionPolicy policy=ExecutionPolicy::Parallel) override
Fills the grid with given value.
std::enable_if_t< M==3, const double & > W(size_t i, Indices... indices) const
Returns w-value at given data point.
Definition FaceCenteredGrid.hpp:151
void GetData(Array1< double > &data) const override
Fetches the data into a continuous linear array.
FaceCenteredGrid & operator=(const FaceCenteredGrid &other)
Copy assignment operator.
FaceCenteredGrid(const FaceCenteredGrid &other)
Copy constructor.
std::enable_if_t< M==3, double & > W(const Vector< size_t, N > &idx)
Returns w-value at given data point.
Definition FaceCenteredGrid.hpp:127
const double & U(const Vector< size_t, N > &idx) const
Returns u-value at given data point.
Vector< double, N > DataOrigin(size_t i) const
Returns i-th data position for the grid point at (0, 0, ...).
double DivergenceAtCellCenter(const Vector< size_t, N > &idx) const
Returns divergence at cell-center location.
std::function< Vector< double, N >(const Vector< double, N > &)> Sampler() const override
Returns the sampler function.
const double & U(size_t i, Indices... indices) const
Returns u-value at given data point.
Definition FaceCenteredGrid.hpp:100
const double & V(size_t i, Indices... indices) const
Returns v-value at given data point.
Definition FaceCenteredGrid.hpp:120
void ParallelForEachUIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each u-data point in parallel.
GridDataPositionFunc< N > UPosition() const
Returns function object that maps u data point to its actual position.
Vector< double, N > ValueAtCellCenter(size_t i, Indices... indices) const
Returns interpolated value at cell center.
Definition FaceCenteredGrid.hpp:163
Vector< double, N > UOrigin() const
Returns u-data position for the grid point at (0, 0, ...).
double & V(size_t i, Indices... indices)
Returns v-value at given data point.
Definition FaceCenteredGrid.hpp:110
double DivergenceAtCellCenter(size_t i, Indices... indices) const
Returns divergence at cell-center location.
Definition FaceCenteredGrid.hpp:175
double & V(const Vector< size_t, N > &idx)
Returns v-value at given data point.
void Swap(Grid< N > *other) override
Swaps the contents with the given other grid.
void SetData(const ConstArrayView1< double > &data) override
Sets the data from a continuous linear array.
Vector< double, N > ValueAtCellCenter(const Vector< size_t, N > &idx) const
Returns interpolated value at cell center.
void OnResize(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &origin, const Vector< double, N > &initialValue) final
Invoked when the resizing happens.
void ParallelForEachVIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each v-data point in parallel.
GetCurl< N >::Type Curl(const Vector< double, N > &x) const override
Returns curl at given position x.
void Fill(const std::function< Vector< double, N >(const Vector< double, N > &)> &func, ExecutionPolicy policy=ExecutionPolicy::Parallel) override
Fills the grid with given function.
FaceCenteredGrid & operator=(FaceCenteredGrid &&other) noexcept
Move assignment operator.
Vector< size_t, N > VSize() const
Returns data size of the v component.
double Divergence(const Vector< double, N > &x) const override
Returns divergence at given position x.
GridDataPositionFunc< N > VPosition() const
Returns function object that maps v data point to its actual position.
FaceCenteredGrid(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing=Vector< double, N >::MakeConstant(1.0), const Vector< double, N > &origin=Vector< double, N >{}, const Vector< double, N > &initialValue=Vector< double, N >{})
Resizes the grid using given parameters.
const double & V(const Vector< size_t, N > &idx) const
Returns v-value at given data point.
ConstScalarDataView DataView(size_t i) const
Returns read-only i-th data view.
void Set(const FaceCenteredGrid &other)
Sets the contents with the given other grid.
void ForEachUIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each u-data point.
std::enable_if_t< M==3, void > ParallelForEachWIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each w-data point parallelly.
Definition FaceCenteredGrid.hpp:374
std::enable_if_t< M==3, ScalarDataView > WView()
Returns w data view.
Definition FaceCenteredGrid.hpp:207
Vector< size_t, N > USize() const
Returns data size of the u component.
Vector< double, N > Sample(const Vector< double, N > &x) const override
Returns sampled value at given position x.
void ForEachVIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each v-data point.
FaceCenteredGrid(FaceCenteredGrid &&other) noexcept
Move constructor.
GetCurl< N >::Type CurlAtCellCenter(const Vector< size_t, N > &idx) const
Returns curl at cell-center location.
Vector< double, N > VOrigin() const
Returns v-data position for the grid point at (0, 0, ...).
std::shared_ptr< VectorGrid< N > > Clone() const override
Returns the copy of the grid instance.
Vector< size_t, N > DataSize(size_t i) const
Returns data size of the i-th component.
std::enable_if_t< M==3, GridDataPositionFunc< N > > WPosition() const
Returns function object that maps w data point to its actual position.
Definition FaceCenteredGrid.hpp:233
~FaceCenteredGrid() override=default
Default virtual destructor.
static Builder GetBuilder()
Returns builder fox FaceCenteredGrid.
std::enable_if_t< M==3, Vector< size_t, N > > WSize() const
Returns data size of the w component.
Definition FaceCenteredGrid.hpp:250
std::enable_if_t< M==3, ConstScalarDataView > WView() const
Returns read-only w data view.
Definition FaceCenteredGrid.hpp:214
GetCurl< N >::Type CurlAtCellCenter(size_t i, Indices... indices) const
Returns curl at cell-center location.
Definition FaceCenteredGrid.hpp:187
std::enable_if_t< M==3, double & > W(size_t i, Indices... indices)
Returns w-value at given data point.
Definition FaceCenteredGrid.hpp:135
GridDataPositionFunc< N > DataPosition(size_t i) const
Returns function object that maps data point to its actual position.
std::enable_if_t< M==3, Vector< double, N > > WOrigin() const
Returns w-data position for the grid point at (0, 0, ...).
Definition FaceCenteredGrid.hpp:281
double & U(size_t i, Indices... indices)
Returns u-value at given data point.
Definition FaceCenteredGrid.hpp:90
std::enable_if_t< M==3, void > ForEachWIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each w-data point.
Definition FaceCenteredGrid.hpp:358
std::enable_if_t< M==3, const double & > W(const Vector< size_t, N > &idx) const
Returns w-value at given data point.
Definition FaceCenteredGrid.hpp:143
const Vector< size_t, N > & Resolution() const
Returns the grid resolution.
const Vector< double, N > & GridSpacing() const
Returns the grid spacing.
void SetGrid(const Grid &other)
Sets the size parameters with given grid other.
static std::enable_if_t< IsMatrixSizeStatic< Rows, Cols >(), D > MakeConstant(ValueType val)
Makes a static matrix with constant entries.
Definition MatrixDenseBase-Impl.hpp:152
Definition Matrix.hpp:30
Abstract base class for N-D vector grid builder.
Definition VectorGrid.hpp:118
void Resize(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing=Vector< double, N >::MakeConstant(1.0), const Vector< double, N > &origin=Vector< double, N >{}, const Vector< double, N > &initialValue=Vector< double, N >{})
Resizes the grid using given parameters.
Definition pybind11Utils.hpp:21
void ForEachIndex(const Vector< IndexType, N > &begin, const Vector< IndexType, N > &end, const Func &func)
Definition IterationUtils-Impl.hpp:51
void ParallelForEachIndex(const Vector< IndexType, N > &begin, const Vector< IndexType, N > &end, const Func &func, ExecutionPolicy policy)
Definition IterationUtils-Impl.hpp:98
std::shared_ptr< FaceCenteredGrid2 > FaceCenteredGrid2Ptr
Shared pointer type for the FaceCenteredGrid2.
Definition FaceCenteredGrid.hpp:434
std::shared_ptr< FaceCenteredGrid3 > FaceCenteredGrid3Ptr
Shared pointer type for the FaceCenteredGrid3.
Definition FaceCenteredGrid.hpp:437
@ Parallel
Definition VectorField.hpp:24
Definition IterationUtils.hpp:93
1.9.8