![]() |
Chemical Data Processing Library C++ API - Version 1.4.0
|
3D grid data structure combining a Math::Grid data store with a coordinate-system transformation that maps grid-cell indices to 3D world positions. More...
#include <RegularSpatialGrid.hpp>
Inheritance diagram for CDPL::Math::RegularSpatialGrid< T, C, GD, XF >:Public Types | |
| typedef T | ValueType |
| The grid cell value type. More... | |
| typedef C | CoordinatesValueType |
| The coordinate (real) value type used in the world frame. More... | |
| typedef GD | GridDataType |
| The underlying grid data container type. More... | |
| typedef XF | CoordinatesTransformType |
| The coordinate transformation type mapping cell indices to world coordinates. More... | |
| typedef CoordinatesTransformType::MatrixTemporaryType | InvCoordinatesTransformType |
| The inverse coordinate transformation type. More... | |
| typedef std::conditional< std::is_const< GD >::value, typename GD::ConstReference, typename GD::Reference >::type | Reference |
Mutable reference type to a grid cell (degrades to ConstReference when the data container is const). More... | |
| typedef GD::ConstReference | ConstReference |
| Constant reference type to a grid cell. More... | |
| typedef GD::SizeType | SizeType |
| The unsigned size type used by the grid data container. More... | |
| typedef std::ptrdiff_t | SSizeType |
| A signed size type used for offset arithmetic. More... | |
| typedef GD::DifferenceType | DifferenceType |
| The signed difference type used by the grid data container. More... | |
| typedef SelfType | ClosureType |
| Closure type used when this grid appears inside another expression. More... | |
| typedef const SelfType | ConstClosureType |
| Constant closure type used when this grid appears inside another expression. More... | |
| typedef std::shared_ptr< SelfType > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated RegularSpatialGrid instances. More... | |
Public Types inherited from CDPL::Math::GridExpression< RegularSpatialGrid< T, typename TypeTraits< T >::RealType, Grid< T >, CMatrix< typename TypeTraits< T >::RealType, 4, 4 > > > | |
| typedef RegularSpatialGrid< T, typename TypeTraits< T >::RealType, Grid< T >, CMatrix< typename TypeTraits< T >::RealType, 4, 4 > > | ExpressionType |
| The derived grid expression type. More... | |
Public Types inherited from CDPL::Math::Expression< E > | |
| typedef E | ExpressionType |
| The derived expression type (made available to expression-template machinery). More... | |
Public Member Functions | |
| RegularSpatialGrid (const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs) | |
| Constructs an empty grid with anisotropic per-axis step sizes. More... | |
| RegularSpatialGrid (const GridDataType &data, const CoordinatesValueType &xs, const CoordinatesValueType &ys, const CoordinatesValueType &zs) | |
| Constructs the grid with anisotropic per-axis step sizes initialized to the supplied grid data. More... | |
| RegularSpatialGrid (const CoordinatesValueType &s) | |
| Constructs an empty grid with isotropic step size s on all three axes. More... | |
| RegularSpatialGrid (const GridDataType &data, const CoordinatesValueType &s) | |
| Constructs the grid with isotropic step size s and the supplied grid data. More... | |
| RegularSpatialGrid (const RegularSpatialGrid &usg) | |
Constructs a copy of the RegularSpatialGrid instance usg. More... | |
| RegularSpatialGrid (RegularSpatialGrid &&usg) | |
| Move-constructs the grid by moving usg. More... | |
| virtual | ~RegularSpatialGrid () |
| Virtual destructor. More... | |
| Reference | operator() (SizeType i) |
| Returns a mutable reference to the cell at the linear index i. More... | |
| ConstReference | operator() (SizeType i) const |
Returns a const reference to the cell at the linear index i. More... | |
| Reference | operator() (SizeType i, SizeType j, SizeType k) |
| Returns a mutable reference to the cell at the (i, j, k) position. More... | |
| ConstReference | operator() (SizeType i, SizeType j, SizeType k) const |
Returns a const reference to the cell at the (i, j, k) position. More... | |
| SizeType | getSize () const |
| Returns the total number of cells of the grid. More... | |
| SizeType | getSize1 () const |
| Returns the size of the grid along the first dimension. More... | |
| SizeType | getSize2 () const |
| Returns the size of the grid along the second dimension. More... | |
| SizeType | getSize3 () const |
| Returns the size of the grid along the third dimension. More... | |
| SizeType | getMaxSize () const |
| Returns the maximum total number of cells the grid can hold. More... | |
| SizeType | getMaxSize1 () const |
| Returns the maximum size of the grid along the first dimension. More... | |
| SizeType | getMaxSize2 () const |
| Returns the maximum size of the grid along the second dimension. More... | |
| SizeType | getMaxSize3 () const |
| Returns the maximum size of the grid along the third dimension. More... | |
| CoordinatesValueType | getXStepSize () const |
| Returns the per-cell step size along the X axis. More... | |
| CoordinatesValueType | getYStepSize () const |
| Returns the per-cell step size along the Y axis. More... | |
| CoordinatesValueType | getZStepSize () const |
| Returns the per-cell step size along the Z axis. More... | |
| void | setXStepSize (const CoordinatesValueType &xs) |
| Sets the per-cell step size along the X axis to xs. More... | |
| void | setYStepSize (const CoordinatesValueType &ys) |
| Sets the per-cell step size along the Y axis to ys. More... | |
| void | setZStepSize (const CoordinatesValueType &zs) |
| Sets the per-cell step size along the Z axis to zs. More... | |
| CoordinatesValueType | getXExtent () const |
| Returns the spatial extent of the grid along the X axis ( \( (\mathrm{size}_1 - 1) \cdot \mathrm{xStep} \) for non-empty grids). More... | |
| CoordinatesValueType | getYExtent () const |
| Returns the spatial extent of the grid along the Y axis. More... | |
| CoordinatesValueType | getZExtent () const |
| Returns the spatial extent of the grid along the Z axis. More... | |
| template<typename V > | |
| void | getCoordinates (SizeType i, V &coords) const |
| Writes the world-space 3D position of the cell with linear index i into coords. More... | |
| template<typename V > | |
| void | getCoordinates (SSizeType i, SSizeType j, SSizeType k, V &coords) const |
| Writes the world-space 3D position of the cell at (i, j, k) into coords. More... | |
| template<typename V > | |
| void | getLocalCoordinates (SSizeType i, SSizeType j, SSizeType k, V &coords) const |
| Writes the local-space 3D position of the cell at (i, j, k) into coords. More... | |
| template<typename V1 , typename V2 > | |
| void | getLocalCoordinates (const V1 &world_coords, V2 &local_coords) const |
| Transforms the world-space point world_coords into the grid's local coordinate frame and stores the result in local_coords. More... | |
| template<typename V > | |
| bool | containsPoint (const V &pos) const |
| Tells whether the world-space point pos lies within the grid bounds. More... | |
| template<typename V > | |
| bool | containsLocalPoint (const V &pos) const |
| Tells whether the local-space point pos lies within the grid bounds. More... | |
| template<typename V1 , typename V2 > | |
| void | getContainingCell (const V1 &pos, V2 &indices) const |
| Writes the (i, j, k) cell indices of the cell containing the world-space point pos into indices. More... | |
| template<typename V1 , typename V2 > | |
| void | getLocalContainingCell (const V1 &pos, V2 &indices) const |
| Writes the (i, j, k) cell indices of the cell containing the local-space point pos into indices. More... | |
| bool | isEmpty () const |
| Tells whether the grid is empty (zero cells along any dimension). More... | |
| const GridDataType & | getData () const |
Returns a const reference to the underlying grid data container. More... | |
| GridDataType & | getData () |
| Returns a mutable reference to the underlying grid data container. More... | |
| const CoordinatesTransformType & | getCoordinatesTransform () const |
| Returns the coordinate transformation mapping cell-index coordinates to world coordinates. More... | |
| template<typename T1 > | |
| void | setCoordinatesTransform (const T1 &xform) |
| Sets the cell-index to world-coordinate transformation to xform and caches its inverse. More... | |
| RegularSpatialGrid & | operator= (const RegularSpatialGrid &usg) |
| Copy-assigns from usg. More... | |
| RegularSpatialGrid & | operator= (RegularSpatialGrid &&usg) |
| Move-assigns from usg. More... | |
| template<typename E > | |
| RegularSpatialGrid & | operator= (const GridExpression< E > &e) |
| Assigns the grid expression e to the underlying grid data (the spatial parameters are left unchanged). More... | |
| template<typename E > | |
| RegularSpatialGrid & | operator+= (const GridExpression< E > &e) |
| Adds the grid expression e cell-wise to the underlying grid data. More... | |
| template<typename E > | |
| RegularSpatialGrid & | operator-= (const GridExpression< E > &e) |
| Subtracts the grid expression e cell-wise from the underlying grid data. More... | |
| template<typename T1 > | |
| std::enable_if< IsScalar< T >::value, RegularSpatialGrid >::type & | operator*= (const T1 &t) |
| Multiplies every cell by the scalar t. More... | |
| template<typename T1 > | |
| std::enable_if< IsScalar< T >::value, RegularSpatialGrid >::type & | operator/= (const T1 &t) |
| Divides every cell by the scalar t. More... | |
| template<typename E > | |
| RegularSpatialGrid & | assign (const GridExpression< E > &e) |
| Assigns the grid expression e to the underlying grid data without intermediate temporary. More... | |
| template<typename E > | |
| RegularSpatialGrid & | plusAssign (const GridExpression< E > &e) |
| Adds the grid expression e to the underlying grid data without intermediate temporary. More... | |
| template<typename E > | |
| RegularSpatialGrid & | minusAssign (const GridExpression< E > &e) |
| Subtracts the grid expression e from the underlying grid data without intermediate temporary. More... | |
| void | swap (RegularSpatialGrid &usg) |
| Swaps the contents of this grid with those of usg. More... | |
| void | clear (const ValueType &v=ValueType()) |
| Sets every cell of the grid to the value v. More... | |
| void | resize (SizeType m, SizeType n, SizeType o, bool preserve=true, const ValueType &v=ValueType()) |
| Resizes the grid to \( m \times n \times o \) cells. More... | |
Public Member Functions inherited from CDPL::Math::GridExpression< RegularSpatialGrid< T, typename TypeTraits< T >::RealType, Grid< T >, CMatrix< typename TypeTraits< T >::RealType, 4, 4 > > > | |
| const ExpressionType & | operator() () const |
Returns a const reference to the derived grid expression. More... | |
| ExpressionType & | operator() () |
| Returns a reference to the derived grid expression. More... | |
Friends | |
| void | swap (RegularSpatialGrid &usg1, RegularSpatialGrid &usg2) |
| ADL-enabled free-function form of swap(). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from CDPL::Math::GridExpression< RegularSpatialGrid< T, typename TypeTraits< T >::RealType, Grid< T >, CMatrix< typename TypeTraits< T >::RealType, 4, 4 > > > | |
| GridExpression () | |
| ~GridExpression () | |
Protected Member Functions inherited from CDPL::Math::Expression< E > | |
| Expression () | |
| ~Expression () | |
3D grid data structure combining a Math::Grid data store with a coordinate-system transformation that maps grid-cell indices to 3D world positions.
| T | The grid cell value type. |
| C | The coordinate (real) value type used in the world frame. |
| GD | The underlying grid data container type (default: Math::Grid). |
| XF | The transformation type that maps cell indices to world coordinates (default: Math::CMatrix \( 4 \times 4 \)). |
| typedef T CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ValueType |
The grid cell value type.
| typedef C CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::CoordinatesValueType |
The coordinate (real) value type used in the world frame.
| typedef GD CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::GridDataType |
The underlying grid data container type.
| typedef XF CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::CoordinatesTransformType |
The coordinate transformation type mapping cell indices to world coordinates.
| typedef CoordinatesTransformType::MatrixTemporaryType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::InvCoordinatesTransformType |
The inverse coordinate transformation type.
| typedef std::conditional<std::is_const<GD>::value, typename GD::ConstReference, typename GD::Reference>::type CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::Reference |
Mutable reference type to a grid cell (degrades to ConstReference when the data container is const).
| typedef GD::ConstReference CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ConstReference |
Constant reference type to a grid cell.
| typedef GD::SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::SizeType |
The unsigned size type used by the grid data container.
| typedef std::ptrdiff_t CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::SSizeType |
A signed size type used for offset arithmetic.
| typedef GD::DifferenceType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::DifferenceType |
The signed difference type used by the grid data container.
| typedef SelfType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ClosureType |
Closure type used when this grid appears inside another expression.
| typedef const SelfType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ConstClosureType |
Constant closure type used when this grid appears inside another expression.
| typedef std::shared_ptr<SelfType> CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated RegularSpatialGrid instances.
|
inline |
Constructs an empty grid with anisotropic per-axis step sizes.
| xs | The step size along the X axis. |
| ys | The step size along the Y axis. |
| zs | The step size along the Z axis. |
|
inline |
Constructs the grid with anisotropic per-axis step sizes initialized to the supplied grid data.
| data | The grid data container. |
| xs | The step size along the X axis. |
| ys | The step size along the Y axis. |
| zs | The step size along the Z axis. |
|
inlineexplicit |
Constructs an empty grid with isotropic step size s on all three axes.
| s | The step size used on every axis. |
|
inline |
Constructs the grid with isotropic step size s and the supplied grid data.
| data | The grid data container. |
| s | The step size used on every axis. |
|
inline |
Constructs a copy of the RegularSpatialGrid instance usg.
| usg | The grid to copy. |
|
inline |
Move-constructs the grid by moving usg.
| usg | The source grid (left in a valid but unspecified state). |
|
inlinevirtual |
Virtual destructor.
|
inline |
Returns a mutable reference to the cell at the linear index i.
| i | The zero-based linear cell index. |
|
inline |
Returns a const reference to the cell at the linear index i.
| i | The zero-based linear cell index. |
const reference to the cell value.
|
inline |
Returns a mutable reference to the cell at the (i, j, k) position.
| i | The zero-based first-dimension index. |
| j | The zero-based second-dimension index. |
| k | The zero-based third-dimension index. |
|
inline |
Returns a const reference to the cell at the (i, j, k) position.
| i | The zero-based first-dimension index. |
| j | The zero-based second-dimension index. |
| k | The zero-based third-dimension index. |
const reference to the cell value.
|
inline |
Returns the total number of cells of the grid.
|
inline |
Returns the size of the grid along the first dimension.
|
inline |
Returns the size of the grid along the second dimension.
|
inline |
Returns the size of the grid along the third dimension.
|
inline |
Returns the maximum total number of cells the grid can hold.
|
inline |
Returns the maximum size of the grid along the first dimension.
|
inline |
Returns the maximum size of the grid along the second dimension.
|
inline |
Returns the maximum size of the grid along the third dimension.
|
inline |
Returns the per-cell step size along the X axis.
|
inline |
Returns the per-cell step size along the Y axis.
|
inline |
Returns the per-cell step size along the Z axis.
|
inline |
Sets the per-cell step size along the X axis to xs.
| xs | The new X-axis step size. |
|
inline |
Sets the per-cell step size along the Y axis to ys.
| ys | The new Y-axis step size. |
|
inline |
Sets the per-cell step size along the Z axis to zs.
| zs | The new Z-axis step size. |
|
inline |
Returns the spatial extent of the grid along the X axis ( \( (\mathrm{size}_1 - 1) \cdot \mathrm{xStep} \) for non-empty grids).
|
inline |
Returns the spatial extent of the grid along the Y axis.
|
inline |
Returns the spatial extent of the grid along the Z axis.
|
inline |
Writes the world-space 3D position of the cell with linear index i into coords.
| V | The output vector type (must be indexable via operator[]). |
| i | The zero-based linear cell index. |
| coords | The output vector receiving the X/Y/Z position. |
|
inline |
Writes the world-space 3D position of the cell at (i, j, k) into coords.
| V | The output vector type. |
| i | The first-dimension cell index. |
| j | The second-dimension cell index. |
| k | The third-dimension cell index. |
| coords | The output vector receiving the X/Y/Z position. |
|
inline |
Writes the local-space 3D position of the cell at (i, j, k) into coords.
Local coordinates are centered at the grid origin (the cell-center cell-index coordinate system before applying the world-space transformation).
| V | The output vector type. |
| i | The first-dimension cell index. |
| j | The second-dimension cell index. |
| k | The third-dimension cell index. |
| coords | The output vector receiving the local X/Y/Z position. |
|
inline |
Transforms the world-space point world_coords into the grid's local coordinate frame and stores the result in local_coords.
| V1 | The input vector type. |
| V2 | The output vector type. |
| world_coords | The input world-space 3D position. |
| local_coords | The output vector receiving the local-frame 3D position. |
|
inline |
Tells whether the world-space point pos lies within the grid bounds.
| V | The point-vector type. |
| pos | The world-space 3D position to test. |
true if pos is inside the grid, and false otherwise.
|
inline |
Tells whether the local-space point pos lies within the grid bounds.
| V | The point-vector type. |
| pos | The local-frame 3D position to test. |
true if pos is inside the grid, and false otherwise.
|
inline |
Writes the (i, j, k) cell indices of the cell containing the world-space point pos into indices.
| V1 | The input point type. |
| V2 | The output indices type. |
| pos | The world-space 3D position. |
| indices | The output vector receiving the three cell indices. |
|
inline |
Writes the (i, j, k) cell indices of the cell containing the local-space point pos into indices.
| V1 | The input point type. |
| V2 | The output indices type. |
| pos | The local-frame 3D position. |
| indices | The output vector receiving the three cell indices. |
|
inline |
Tells whether the grid is empty (zero cells along any dimension).
true if the grid is empty, and false otherwise.
|
inline |
Returns a const reference to the underlying grid data container.
const reference to the grid data.
|
inline |
Returns a mutable reference to the underlying grid data container.
|
inline |
Returns the coordinate transformation mapping cell-index coordinates to world coordinates.
const reference to the transformation matrix.
|
inline |
Sets the cell-index to world-coordinate transformation to xform and caches its inverse.
| T1 | A type assignable to CoordinatesTransformType. |
| xform | The new transformation. |
| Base::CalculationFailed | if the transformation cannot be inverted (only when math checks are enabled). |
|
inline |
Copy-assigns from usg.
| usg | The source grid. |
|
inline |
Move-assigns from usg.
| usg | The source grid (left in a valid but unspecified state). |
|
inline |
Assigns the grid expression e to the underlying grid data (the spatial parameters are left unchanged).
| E | The source grid expression type. |
| e | The source grid expression. |
|
inline |
Adds the grid expression e cell-wise to the underlying grid data.
| E | The source grid expression type. |
| e | The grid expression to add. |
|
inline |
Subtracts the grid expression e cell-wise from the underlying grid data.
| E | The source grid expression type. |
| e | The grid expression to subtract. |
|
inline |
Multiplies every cell by the scalar t.
| T1 | The scalar type. |
| t | The scalar multiplier. |
|
inline |
Divides every cell by the scalar t.
| T1 | The scalar type. |
| t | The scalar divisor. |
|
inline |
Assigns the grid expression e to the underlying grid data without intermediate temporary.
| E | The source grid expression type. |
| e | The source grid expression. |
|
inline |
Adds the grid expression e to the underlying grid data without intermediate temporary.
| E | The source grid expression type. |
| e | The source grid expression. |
|
inline |
Subtracts the grid expression e from the underlying grid data without intermediate temporary.
| E | The source grid expression type. |
| e | The source grid expression. |
|
inline |
Swaps the contents of this grid with those of usg.
| usg | The grid to swap with. |
|
inline |
Sets every cell of the grid to the value v.
| v | The fill value. |
|
inline |
Resizes the grid to \( m \times n \times o \) cells.
| m | The new first-dimension size. |
| n | The new second-dimension size. |
| o | The new third-dimension size. |
| preserve | If true, existing cell values are kept where the indices remain valid; if false, all cells are set to v. |
| v | The fill value used for newly added cells (and for all cells if preserve is false). |
|
friend |
ADL-enabled free-function form of swap().
| usg1 | The first grid. |
| usg2 | The second grid. |