Loading...
Searching...
No Matches
ScalarGrid.hpp
Go to the documentation of this file.
void SetSizeParameters(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &origin)
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.
Definition Matrix.hpp:30
Abstract base class for N-D scalar grid builder.
Definition ScalarGrid.hpp:274
ScalarGridBuilder & operator=(const ScalarGridBuilder &other)=delete
Deleted copy assignment operator.
virtual ~ScalarGridBuilder()=default
Default virtual destructor.
ScalarGridBuilder & operator=(ScalarGridBuilder &&other) noexcept=delete
Deleted move assignment operator.
ScalarGridBuilder(const ScalarGridBuilder &other)=delete
Deleted copy constructor.
ScalarGridBuilder(ScalarGridBuilder &&other) noexcept=delete
Deleted move constructor.
virtual std::shared_ptr< ScalarGrid< N > > Build(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &gridOrigin, double initialVal) const =0
Returns N-D scalar grid with given parameters.
virtual Vector< size_t, N > DataSize() const =0
Returns the size of the grid data.
virtual std::shared_ptr< ScalarGrid > Clone() const =0
Returns the copy of the grid instance.
void Resize(const Vector< double, N > &gridSpacing, const Vector< double, N > &origin)
Resizes the grid using given parameters.
void Deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the input buffer to the grid instance.
std::enable_if_t< M==2, void > ParallelForEachDataPointIndex(const std::function< void(size_t, size_t)> &func) const
Definition ScalarGrid.hpp:189
Vector< double, N > Gradient(const Vector< double, N > &x) const override
Returns the gradient vector at given position x.
std::enable_if_t< M==2, void > ForEachDataPointIndex(const std::function< void(size_t, size_t)> &func) const
Definition ScalarGrid.hpp:161
void Fill(double value, ExecutionPolicy policy=ExecutionPolicy::Parallel)
Fills the grid with given value.
double LaplacianAtDataPoint(size_t i, Indices... indices) const
Returns the Laplacian at given data point.
Definition ScalarGrid.hpp:128
double & operator()(const Vector< size_t, N > &idx)
Returns the grid data at given data point.
void Fill(const std::function< double(const Vector< double, N > &)> &func, ExecutionPolicy policy=ExecutionPolicy::Parallel)
Fills the grid with given position-to-value mapping function.
double Laplacian(const Vector< double, N > &x) const override
Returns the Laplacian at given position x.
virtual Vector< double, N > DataOrigin() const =0
Returns the origin of the grid data.
GridDataPositionFunc< N > DataPosition() const
Returns the function that maps data point to its position.
double Sample(const Vector< double, N > &x) const override
Returns the sampled value at given position x.
void GetData(Array1< double > &data) const override
Fetches the data into a continuous linear array.
void SwapScalarGrid(ScalarGrid *other)
Swaps the data storage and predefined samplers with given grid.
double LaplacianAtDataPoint(const Vector< size_t, N > &idx) const
Returns the Laplacian at given data point.
ConstScalarDataView DataView() const
Returns the read-only data array accessor.
std::enable_if_t< M==3, void > ForEachDataPointIndex(const std::function< void(size_t, size_t, size_t)> &func) const
Definition ScalarGrid.hpp:169
double & operator()(size_t i, Indices... indices)
Returns the grid data at given data point.
Definition ScalarGrid.hpp:105
void SetScalarGrid(const ScalarGrid &other)
Sets the data storage and predefined samplers with given grid.
ScalarGrid & operator=(const ScalarGrid &other)
Copy assignment operator.
const double & operator()(const Vector< size_t, N > &idx) const
Returns the grid data at given data point.
void SetData(const ConstArrayView1< double > &data) override
Sets the data from a continuous linear array.
std::function< double(const Vector< double, N > &)> Sampler() const override
Returns the sampler function.
Vector< double, N > GradientAtDataPoint(const Vector< size_t, N > &idx) const
Returns the gradient vector at given data point.
std::enable_if_t< M==3, void > ParallelForEachDataPointIndex(const std::function< void(size_t, size_t, size_t)> &func) const
Definition ScalarGrid.hpp:197
void Serialize(std::vector< uint8_t > *buffer) const override
Serializes the grid instance to the output buffer.
void Resize(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing=Vector< double, N >::MakeConstant(1), const Vector< double, N > &origin=Vector< double, N >{}, double initialValue=0.0)
Resizes the grid using given parameters.
const double & operator()(size_t i, Indices... indices) const
Returns the grid data at given data point.
Definition ScalarGrid.hpp:98
Vector< double, N > GradientAtDataPoint(size_t i, Indices... indices) const
Returns the gradient vector at given data point.
Definition ScalarGrid.hpp:116
void ParallelForEachDataPointIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each data point in parallel.
ScalarGrid & operator=(ScalarGrid &&other) noexcept
Move assignment operator.
void ForEachDataPointIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each data point.
Definition pybind11Utils.hpp:21
std::shared_ptr< ScalarGridBuilder2 > ScalarGridBuilder2Ptr
Shared pointer for the ScalarGridBuilder2 type.
Definition ScalarGrid.hpp:308
std::shared_ptr< ScalarGrid3 > ScalarGrid3Ptr
Shared pointer for the ScalarGrid3 type.
Definition ScalarGrid.hpp:269
std::shared_ptr< ScalarGridBuilder3 > ScalarGridBuilder3Ptr
Shared pointer for the ScalarGridBuilder3 type.
Definition ScalarGrid.hpp:311
std::shared_ptr< ScalarGrid2 > ScalarGrid2Ptr
Shared pointer for the ScalarGrid2 type.
Definition ScalarGrid.hpp:266
@ Parallel
1.9.8