Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | Friends | List of all members
CDPL::Math::RegularSpatialGrid< T, C, GD, XF > Class Template Reference

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< SelfTypeSharedPointer
 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 GridDataTypegetData () const
 Returns a const reference to the underlying grid data container. More...
 
GridDataTypegetData ()
 Returns a mutable reference to the underlying grid data container. More...
 
const CoordinatesTransformTypegetCoordinatesTransform () 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...
 
RegularSpatialGridoperator= (const RegularSpatialGrid &usg)
 Copy-assigns from usg. More...
 
RegularSpatialGridoperator= (RegularSpatialGrid &&usg)
 Move-assigns from usg. More...
 
template<typename E >
RegularSpatialGridoperator= (const GridExpression< E > &e)
 Assigns the grid expression e to the underlying grid data (the spatial parameters are left unchanged). More...
 
template<typename E >
RegularSpatialGridoperator+= (const GridExpression< E > &e)
 Adds the grid expression e cell-wise to the underlying grid data. More...
 
template<typename E >
RegularSpatialGridoperator-= (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 >
RegularSpatialGridassign (const GridExpression< E > &e)
 Assigns the grid expression e to the underlying grid data without intermediate temporary. More...
 
template<typename E >
RegularSpatialGridplusAssign (const GridExpression< E > &e)
 Adds the grid expression e to the underlying grid data without intermediate temporary. More...
 
template<typename E >
RegularSpatialGridminusAssign (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 ExpressionTypeoperator() () const
 Returns a const reference to the derived grid expression. More...
 
ExpressionTypeoperator() ()
 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 ()
 

Detailed Description

template<typename T, typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
class CDPL::Math::RegularSpatialGrid< T, C, GD, XF >

3D grid data structure combining a Math::Grid data store with a coordinate-system transformation that maps grid-cell indices to 3D world positions.

Template Parameters
TThe grid cell value type.
CThe coordinate (real) value type used in the world frame.
GDThe underlying grid data container type (default: Math::Grid).
XFThe transformation type that maps cell indices to world coordinates (default: Math::CMatrix \( 4 \times 4 \)).

Member Typedef Documentation

◆ ValueType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef T CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ValueType

The grid cell value type.

◆ CoordinatesValueType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef C CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::CoordinatesValueType

The coordinate (real) value type used in the world frame.

◆ GridDataType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef GD CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::GridDataType

The underlying grid data container type.

◆ CoordinatesTransformType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef XF CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::CoordinatesTransformType

The coordinate transformation type mapping cell indices to world coordinates.

◆ InvCoordinatesTransformType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef CoordinatesTransformType::MatrixTemporaryType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::InvCoordinatesTransformType

The inverse coordinate transformation type.

◆ Reference

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
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).

◆ ConstReference

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef GD::ConstReference CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ConstReference

Constant reference type to a grid cell.

◆ SizeType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef GD::SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::SizeType

The unsigned size type used by the grid data container.

◆ SSizeType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef std::ptrdiff_t CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::SSizeType

A signed size type used for offset arithmetic.

◆ DifferenceType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef GD::DifferenceType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::DifferenceType

The signed difference type used by the grid data container.

◆ ClosureType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef SelfType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ClosureType

Closure type used when this grid appears inside another expression.

◆ ConstClosureType

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef const SelfType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::ConstClosureType

Constant closure type used when this grid appears inside another expression.

◆ SharedPointer

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
typedef std::shared_ptr<SelfType> CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated RegularSpatialGrid instances.

Constructor & Destructor Documentation

◆ RegularSpatialGrid() [1/6]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::RegularSpatialGrid ( const CoordinatesValueType xs,
const CoordinatesValueType ys,
const CoordinatesValueType zs 
)
inline

Constructs an empty grid with anisotropic per-axis step sizes.

Parameters
xsThe step size along the X axis.
ysThe step size along the Y axis.
zsThe step size along the Z axis.

◆ RegularSpatialGrid() [2/6]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::RegularSpatialGrid ( const GridDataType data,
const CoordinatesValueType xs,
const CoordinatesValueType ys,
const CoordinatesValueType zs 
)
inline

Constructs the grid with anisotropic per-axis step sizes initialized to the supplied grid data.

Parameters
dataThe grid data container.
xsThe step size along the X axis.
ysThe step size along the Y axis.
zsThe step size along the Z axis.

◆ RegularSpatialGrid() [3/6]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::RegularSpatialGrid ( const CoordinatesValueType s)
inlineexplicit

Constructs an empty grid with isotropic step size s on all three axes.

Parameters
sThe step size used on every axis.

◆ RegularSpatialGrid() [4/6]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::RegularSpatialGrid ( const GridDataType data,
const CoordinatesValueType s 
)
inline

Constructs the grid with isotropic step size s and the supplied grid data.

Parameters
dataThe grid data container.
sThe step size used on every axis.

◆ RegularSpatialGrid() [5/6]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::RegularSpatialGrid ( const RegularSpatialGrid< T, C, GD, XF > &  usg)
inline

Constructs a copy of the RegularSpatialGrid instance usg.

Parameters
usgThe grid to copy.

◆ RegularSpatialGrid() [6/6]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::RegularSpatialGrid ( RegularSpatialGrid< T, C, GD, XF > &&  usg)
inline

Move-constructs the grid by moving usg.

Parameters
usgThe source grid (left in a valid but unspecified state).

◆ ~RegularSpatialGrid()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
virtual CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::~RegularSpatialGrid ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ operator()() [1/4]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
Reference CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator() ( SizeType  i)
inline

Returns a mutable reference to the cell at the linear index i.

Parameters
iThe zero-based linear cell index.
Returns
A mutable reference to the cell value.

◆ operator()() [2/4]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
ConstReference CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator() ( SizeType  i) const
inline

Returns a const reference to the cell at the linear index i.

Parameters
iThe zero-based linear cell index.
Returns
A const reference to the cell value.

◆ operator()() [3/4]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
Reference CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator() ( SizeType  i,
SizeType  j,
SizeType  k 
)
inline

Returns a mutable reference to the cell at the (i, j, k) position.

Parameters
iThe zero-based first-dimension index.
jThe zero-based second-dimension index.
kThe zero-based third-dimension index.
Returns
A mutable reference to the cell value.

◆ operator()() [4/4]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
ConstReference CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator() ( SizeType  i,
SizeType  j,
SizeType  k 
) const
inline

Returns a const reference to the cell at the (i, j, k) position.

Parameters
iThe zero-based first-dimension index.
jThe zero-based second-dimension index.
kThe zero-based third-dimension index.
Returns
A const reference to the cell value.

◆ getSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getSize ( ) const
inline

Returns the total number of cells of the grid.

Returns
The total cell count.

◆ getSize1()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getSize1 ( ) const
inline

Returns the size of the grid along the first dimension.

Returns
The first-dimension size.

◆ getSize2()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getSize2 ( ) const
inline

Returns the size of the grid along the second dimension.

Returns
The second-dimension size.

◆ getSize3()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getSize3 ( ) const
inline

Returns the size of the grid along the third dimension.

Returns
The third-dimension size.

◆ getMaxSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getMaxSize ( ) const
inline

Returns the maximum total number of cells the grid can hold.

Returns
The maximum total cell capacity.

◆ getMaxSize1()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getMaxSize1 ( ) const
inline

Returns the maximum size of the grid along the first dimension.

Returns
The maximum first-dimension size.

◆ getMaxSize2()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getMaxSize2 ( ) const
inline

Returns the maximum size of the grid along the second dimension.

Returns
The maximum second-dimension size.

◆ getMaxSize3()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
SizeType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getMaxSize3 ( ) const
inline

Returns the maximum size of the grid along the third dimension.

Returns
The maximum third-dimension size.

◆ getXStepSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CoordinatesValueType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getXStepSize ( ) const
inline

Returns the per-cell step size along the X axis.

Returns
The X-axis step size.

◆ getYStepSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CoordinatesValueType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getYStepSize ( ) const
inline

Returns the per-cell step size along the Y axis.

Returns
The Y-axis step size.

◆ getZStepSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CoordinatesValueType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getZStepSize ( ) const
inline

Returns the per-cell step size along the Z axis.

Returns
The Z-axis step size.

◆ setXStepSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::setXStepSize ( const CoordinatesValueType xs)
inline

Sets the per-cell step size along the X axis to xs.

Parameters
xsThe new X-axis step size.

◆ setYStepSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::setYStepSize ( const CoordinatesValueType ys)
inline

Sets the per-cell step size along the Y axis to ys.

Parameters
ysThe new Y-axis step size.

◆ setZStepSize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::setZStepSize ( const CoordinatesValueType zs)
inline

Sets the per-cell step size along the Z axis to zs.

Parameters
zsThe new Z-axis step size.

◆ getXExtent()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CoordinatesValueType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getXExtent ( ) const
inline

Returns the spatial extent of the grid along the X axis ( \( (\mathrm{size}_1 - 1) \cdot \mathrm{xStep} \) for non-empty grids).

Returns
The X-axis extent.

◆ getYExtent()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CoordinatesValueType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getYExtent ( ) const
inline

Returns the spatial extent of the grid along the Y axis.

Returns
The Y-axis extent.

◆ getZExtent()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
CoordinatesValueType CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getZExtent ( ) const
inline

Returns the spatial extent of the grid along the Z axis.

Returns
The Z-axis extent.

◆ getCoordinates() [1/2]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V >
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getCoordinates ( SizeType  i,
V &  coords 
) const
inline

Writes the world-space 3D position of the cell with linear index i into coords.

Template Parameters
VThe output vector type (must be indexable via operator[]).
Parameters
iThe zero-based linear cell index.
coordsThe output vector receiving the X/Y/Z position.

◆ getCoordinates() [2/2]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V >
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getCoordinates ( SSizeType  i,
SSizeType  j,
SSizeType  k,
V &  coords 
) const
inline

Writes the world-space 3D position of the cell at (i, j, k) into coords.

Template Parameters
VThe output vector type.
Parameters
iThe first-dimension cell index.
jThe second-dimension cell index.
kThe third-dimension cell index.
coordsThe output vector receiving the X/Y/Z position.

◆ getLocalCoordinates() [1/2]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V >
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getLocalCoordinates ( SSizeType  i,
SSizeType  j,
SSizeType  k,
V &  coords 
) const
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).

Template Parameters
VThe output vector type.
Parameters
iThe first-dimension cell index.
jThe second-dimension cell index.
kThe third-dimension cell index.
coordsThe output vector receiving the local X/Y/Z position.

◆ getLocalCoordinates() [2/2]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V1 , typename V2 >
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getLocalCoordinates ( const V1 &  world_coords,
V2 &  local_coords 
) const
inline

Transforms the world-space point world_coords into the grid's local coordinate frame and stores the result in local_coords.

Template Parameters
V1The input vector type.
V2The output vector type.
Parameters
world_coordsThe input world-space 3D position.
local_coordsThe output vector receiving the local-frame 3D position.

◆ containsPoint()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V >
bool CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::containsPoint ( const V &  pos) const
inline

Tells whether the world-space point pos lies within the grid bounds.

Template Parameters
VThe point-vector type.
Parameters
posThe world-space 3D position to test.
Returns
true if pos is inside the grid, and false otherwise.

◆ containsLocalPoint()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V >
bool CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::containsLocalPoint ( const V &  pos) const
inline

Tells whether the local-space point pos lies within the grid bounds.

Template Parameters
VThe point-vector type.
Parameters
posThe local-frame 3D position to test.
Returns
true if pos is inside the grid, and false otherwise.

◆ getContainingCell()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V1 , typename V2 >
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getContainingCell ( const V1 &  pos,
V2 &  indices 
) const
inline

Writes the (i, j, k) cell indices of the cell containing the world-space point pos into indices.

Template Parameters
V1The input point type.
V2The output indices type.
Parameters
posThe world-space 3D position.
indicesThe output vector receiving the three cell indices.

◆ getLocalContainingCell()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename V1 , typename V2 >
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getLocalContainingCell ( const V1 &  pos,
V2 &  indices 
) const
inline

Writes the (i, j, k) cell indices of the cell containing the local-space point pos into indices.

Template Parameters
V1The input point type.
V2The output indices type.
Parameters
posThe local-frame 3D position.
indicesThe output vector receiving the three cell indices.

◆ isEmpty()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
bool CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::isEmpty ( ) const
inline

Tells whether the grid is empty (zero cells along any dimension).

Returns
true if the grid is empty, and false otherwise.

◆ getData() [1/2]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
const GridDataType& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getData ( ) const
inline

Returns a const reference to the underlying grid data container.

Returns
A const reference to the grid data.

◆ getData() [2/2]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
GridDataType& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getData ( )
inline

Returns a mutable reference to the underlying grid data container.

Returns
A mutable reference to the grid data.

◆ getCoordinatesTransform()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
const CoordinatesTransformType& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::getCoordinatesTransform ( ) const
inline

Returns the coordinate transformation mapping cell-index coordinates to world coordinates.

Returns
A const reference to the transformation matrix.

◆ setCoordinatesTransform()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename T1 >
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::setCoordinatesTransform ( const T1 &  xform)
inline

Sets the cell-index to world-coordinate transformation to xform and caches its inverse.

Template Parameters
T1A type assignable to CoordinatesTransformType.
Parameters
xformThe new transformation.
Exceptions
Base::CalculationFailedif the transformation cannot be inverted (only when math checks are enabled).

◆ operator=() [1/3]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator= ( const RegularSpatialGrid< T, C, GD, XF > &  usg)
inline

Copy-assigns from usg.

Parameters
usgThe source grid.
Returns
A reference to itself.

◆ operator=() [2/3]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator= ( RegularSpatialGrid< T, C, GD, XF > &&  usg)
inline

Move-assigns from usg.

Parameters
usgThe source grid (left in a valid but unspecified state).
Returns
A reference to itself.

◆ operator=() [3/3]

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename E >
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator= ( const GridExpression< E > &  e)
inline

Assigns the grid expression e to the underlying grid data (the spatial parameters are left unchanged).

Template Parameters
EThe source grid expression type.
Parameters
eThe source grid expression.
Returns
A reference to itself.

◆ operator+=()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename E >
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator+= ( const GridExpression< E > &  e)
inline

Adds the grid expression e cell-wise to the underlying grid data.

Template Parameters
EThe source grid expression type.
Parameters
eThe grid expression to add.
Returns
A reference to itself.

◆ operator-=()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename E >
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator-= ( const GridExpression< E > &  e)
inline

Subtracts the grid expression e cell-wise from the underlying grid data.

Template Parameters
EThe source grid expression type.
Parameters
eThe grid expression to subtract.
Returns
A reference to itself.

◆ operator*=()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename T1 >
std::enable_if<IsScalar<T>::value, RegularSpatialGrid>::type& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator*= ( const T1 &  t)
inline

Multiplies every cell by the scalar t.

Template Parameters
T1The scalar type.
Parameters
tThe scalar multiplier.
Returns
A reference to itself.

◆ operator/=()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename T1 >
std::enable_if<IsScalar<T>::value, RegularSpatialGrid>::type& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::operator/= ( const T1 &  t)
inline

Divides every cell by the scalar t.

Template Parameters
T1The scalar type.
Parameters
tThe scalar divisor.
Returns
A reference to itself.

◆ assign()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename E >
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::assign ( const GridExpression< E > &  e)
inline

Assigns the grid expression e to the underlying grid data without intermediate temporary.

Template Parameters
EThe source grid expression type.
Parameters
eThe source grid expression.
Returns
A reference to itself.

◆ plusAssign()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename E >
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::plusAssign ( const GridExpression< E > &  e)
inline

Adds the grid expression e to the underlying grid data without intermediate temporary.

Template Parameters
EThe source grid expression type.
Parameters
eThe source grid expression.
Returns
A reference to itself.

◆ minusAssign()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
template<typename E >
RegularSpatialGrid& CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::minusAssign ( const GridExpression< E > &  e)
inline

Subtracts the grid expression e from the underlying grid data without intermediate temporary.

Template Parameters
EThe source grid expression type.
Parameters
eThe source grid expression.
Returns
A reference to itself.

◆ swap()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::swap ( RegularSpatialGrid< T, C, GD, XF > &  usg)
inline

Swaps the contents of this grid with those of usg.

Parameters
usgThe grid to swap with.

◆ clear()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::clear ( const ValueType v = ValueType())
inline

Sets every cell of the grid to the value v.

Parameters
vThe fill value.

◆ resize()

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
void CDPL::Math::RegularSpatialGrid< T, C, GD, XF >::resize ( SizeType  m,
SizeType  n,
SizeType  o,
bool  preserve = true,
const ValueType v = ValueType() 
)
inline

Resizes the grid to \( m \times n \times o \) cells.

Parameters
mThe new first-dimension size.
nThe new second-dimension size.
oThe new third-dimension size.
preserveIf true, existing cell values are kept where the indices remain valid; if false, all cells are set to v.
vThe fill value used for newly added cells (and for all cells if preserve is false).

Friends And Related Function Documentation

◆ swap

template<typename T , typename C = typename TypeTraits<T>::RealType, typename GD = Grid<T>, typename XF = CMatrix<C, 4, 4>>
void swap ( RegularSpatialGrid< T, C, GD, XF > &  usg1,
RegularSpatialGrid< T, C, GD, XF > &  usg2 
)
friend

ADL-enabled free-function form of swap().

Parameters
usg1The first grid.
usg2The second grid.

The documentation for this class was generated from the following file: