DUNE: Uniform Navigational Environment  2020.01.0
DUNE::Math::Grid< dim > Class Template Reference

Detailed Description

template<size_t dim>
class DUNE::Math::Grid< dim >

Converts between grid indices, coordinate points and row-major ordering.

Template Parameters
dimnumber of dimensions.

Public Member Functions

 Grid (std::vector< double > const &min, std::vector< double > const &max, std::vector< size_t > const &dimensions)
 
size_t getOffset (std::array< size_t, dim > const &indices) const
 
std::array< size_t, dim > getIndices (size_t offset) const
 
std::array< size_t, dim > getCorner (std::array< double, dim > const &coordinates) const
 
std::array< double, dim > getCoordinates (std::array< size_t, dim > const &indices) const
 
std::array< double, dim > getCoordinates (size_t offset) const
 
size_t getDimensions (size_t dimension) const
 
size_t size () const
 
double getUpper (size_t dimension) const
 
double getLower (size_t dimension) const
 
double getSpacing (size_t dimension) const
 

Constructor & Destructor Documentation

template<size_t dim>
DUNE::Math::Grid< dim >::Grid ( std::vector< double > const &  min,
std::vector< double > const &  max,
std::vector< size_t > const &  dimensions 
)

Constructor.

Parameters
[in]minthe lower limits of the grid in each dimension.
[in]maxthe upper limits of the grid in each dimension.
[in]dimensionsthe number of points in each dimension.

Member Function Documentation

template<size_t dim>
std::array< double, dim > DUNE::Math::Grid< dim >::getCoordinates ( std::array< size_t, dim > const &  indices) const

Get the coordinates of a gridpoint given by an array of indices.

Parameters
[in]indicesindices of a gridpoint.
Returns
the coordinates of the corresponding point in dim-dimensional space.

Referenced by DUNE::Math::Grid< dim >::getCoordinates(), and Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::getVelocity().

template<size_t dim>
std::array< double, dim > DUNE::Math::Grid< dim >::getCoordinates ( size_t  offset) const

Get the coordinates of a gridpoint given by a row-major offset.

Parameters
[in]offsetthe row-major offset of the gridpoint.
Returns
the coordinates of the corresponding point in dim-dimensional space.

References DUNE::Math::Grid< dim >::getCoordinates(), and DUNE::Math::Grid< dim >::getIndices().

template<size_t dim>
std::array< size_t, dim > DUNE::Math::Grid< dim >::getCorner ( std::array< double, dim > const &  coordinates) const

Get the indices of the "lower corner" of the grid cell where a point lies.

Parameters
[in]coordinatescoordinates of a point in dim-dimensional space.
Returns
grid indices of the "lower" vertex of the grid cell where the point lies.

Referenced by Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::getVelocity().

template<size_t dim>
size_t DUNE::Math::Grid< dim >::getDimensions ( size_t  dimension) const
inline

Get the number of points in the grid along a dimension.

Parameters
[in]dimensionindex of the dimension to query.
Returns
number of points along the given dimension.

Referenced by Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::getVelocity(), and Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::Gridded2DModelDataStreamGenerator().

template<size_t dim>
std::array< size_t, dim > DUNE::Math::Grid< dim >::getIndices ( size_t  offset) const

Convert a row-major ordered offset to an array of grid indices.

Parameters
[in]offsetthe row-major offset of the gridpoint.
Returns
indices of the gridpoint.

Referenced by DUNE::Math::Grid< dim >::getCoordinates().

template<size_t dim>
double DUNE::Math::Grid< dim >::getLower ( size_t  dimension) const
inline

Get the loer limit of the grid along a dimension.

Parameters
[in]dimensionindex of the dimension to query.
Returns
lower limit along the given dimension.

Referenced by Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::getVelocity().

template<size_t dim>
size_t DUNE::Math::Grid< dim >::getOffset ( std::array< size_t, dim > const &  indices) const

Convert an array of grid indices to a row-major ordered offset.

Parameters
[in]indicesthe indices of the grid point.
Returns
the row-major offset of the grid point.

Referenced by Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::getVelocity().

template<size_t dim>
double DUNE::Math::Grid< dim >::getSpacing ( size_t  dimension) const
inline

Get the grid spacing along a dimension.

Parameters
[in]dimensionindex of the dimension to query.
Returns
spacing along the given dimension.

Referenced by Simulators::StreamVelocity::StreamGenerator::Gridded2DModelDataStreamGenerator::getVelocity().

template<size_t dim>
double DUNE::Math::Grid< dim >::getUpper ( size_t  dimension) const
inline

Get the upper limit of the grid along a dimension.

Parameters
[in]dimensionindex of the dimension to query.
Returns
upper limit along the given dimension.
template<size_t dim>
size_t DUNE::Math::Grid< dim >::size ( void  ) const
inline
Returns
the total number of gridpoints.
Collaboration diagram for DUNE::Math::Grid< dim >:
Collaboration graph