AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType > Class Template Reference

A rectangular lattice maps all of space (of dimension NDIMS) into a rectangular grid of cells identified by integer coordinates. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/docs-essman-container_strict/src/axom/spin/RectangularLattice.hpp>

Inheritance diagram for axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >:

Public Types

using GridCell = primal::Point< CellCoordType, NDIMS >
 
using SpacePoint = primal::Point< SpaceCoordType, NDIMS >
 
using SpaceVector = primal::Vector< SpaceCoordType, NDIMS >
 
using SpatialBoundingBox = primal::BoundingBox< SpaceCoordType, NDIMS >
 

Public Member Functions

 RectangularLattice ()
 Default constructor. More...
 
 RectangularLattice (const SpacePoint &origin)
 Constructor from a given origin. More...
 
 RectangularLattice (const SpacePoint &origin, const SpaceVector &spacing)
 Constructor from a given origin and spacing. More...
 
 RectangularLattice (SpaceCoordType *origin_data, SpaceCoordType *spacing_data)
 Constructor from SpaceCoordType arrays. More...
 
const SpacePointorigin () const
 
const SpaceVectorspacing () const
 
GridCell gridCell (const SpacePoint &pt) const
 
SpacePoint spacePoint (const GridCell &cell) const
 
SpatialBoundingBox cellBounds (const GridCell &cell) const
 Find the spatial bounding box of a lattice cell. More...
 
std::ostream & print (std::ostream &os) const
 

Detailed Description

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
class axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >

A rectangular lattice maps all of space (of dimension NDIMS) into a rectangular grid of cells identified by integer coordinates.

Template Parameters
NDIMSthe dimension of the space
SpaceCoordTypethe type of the spatial coordinates. Default: double
CellCoordTypethe type of the integral lattice coordinates. Default: int

A rectangular lattice maps every point in space (a SpacePoint) to a unique rectangular cell with integral coordinates (a GridCell). Each lattice cell is identified with the integer grid point at its lowest corner in each dimension.

RectangularLattice also maps GridCell coordinates back to spatial coordinates or to the bounding box of the GridCell.

GridCells follow a half-open boundary convention. Points on their lower boundaries get mapped to the cell, while points on their upper boundaries get mapped to neighboring cells.

A RectangularLattice is defined by an origin (a SpacePoint) and a grid spacing (a SpaceVector).

Note
Grid spacing coordinates that are really small (magnitude less than 1E-50) are snapped to zero to avoid division by zero.

Member Typedef Documentation

◆ GridCell

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
using axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::GridCell = primal::Point<CellCoordType, NDIMS>

◆ SpacePoint

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
using axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::SpacePoint = primal::Point<SpaceCoordType, NDIMS>

◆ SpaceVector

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
using axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::SpaceVector = primal::Vector<SpaceCoordType, NDIMS>

◆ SpatialBoundingBox

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
using axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::SpatialBoundingBox = primal::BoundingBox<SpaceCoordType, NDIMS>

Constructor & Destructor Documentation

◆ RectangularLattice() [1/4]

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::RectangularLattice ( )
inline

Default constructor.

Note
Sets the origin to 0 and spacing to 1 in each dimension

◆ RectangularLattice() [2/4]

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::RectangularLattice ( const SpacePoint origin)
inline

Constructor from a given origin.

Parameters
originThe lattice's origin
Note
Spacing will be set to default (vector of ones)

◆ RectangularLattice() [3/4]

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::RectangularLattice ( const SpacePoint origin,
const SpaceVector spacing 
)
inline

Constructor from a given origin and spacing.

Parameters
originThe lattice's origin
spacingThe lattice's spacing
Note
The magnitude of the spacing coordinates should be greater than zero. If they are less than EPS = 1E-50, the lattice will be degenerate in that dimension.

◆ RectangularLattice() [4/4]

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::RectangularLattice ( SpaceCoordType *  origin_data,
SpaceCoordType *  spacing_data 
)
inline

Constructor from SpaceCoordType arrays.

Parameters
origin_dateAn array containing the origin's coordinates
spacing_dataAn array containing the spacing coordinates
Precondition
When origin_data is not NULL, it must have at least NDIMS entries
Note
Origin will be set to the zero vector if origin_data pointer is NULL
Precondition
When spacing_data is not NULL, it must have at least NDIMS entries
Note
Spacing will be set to vector or ones if pointer is NULL
The magnitude of the spacing coordinates should be greater than zero. If they are less than EPS = 1E-50, the lattice will be degenerate in that dimension.

Member Function Documentation

◆ origin()

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
const SpacePoint& axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::origin ( ) const
inline

Accessor for lattice origin

Referenced by axom::spin::operator==().

◆ spacing()

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
const SpaceVector& axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::spacing ( ) const
inline

Accessor for lattice spacing

Referenced by axom::spin::operator==(), and axom::spin::rectangular_lattice_from_bounding_box().

◆ gridCell()

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
GridCell axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::gridCell ( const SpacePoint pt) const
inline

◆ spacePoint()

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
SpacePoint axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::spacePoint ( const GridCell cell) const
inline

Returns the space point associated with lowest corner of GridCell cell

Referenced by axom::spin::RectangularLattice< NDIMS, double, int >::cellBounds().

◆ cellBounds()

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
SpatialBoundingBox axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::cellBounds ( const GridCell cell) const
inline

Find the spatial bounding box of a lattice cell.

Note
The bounding box covers all points in space that map to gridCell

◆ print()

template<int NDIMS, typename SpaceCoordType = double, typename CellCoordType = int>
std::ostream& axom::spin::RectangularLattice< NDIMS, SpaceCoordType, CellCoordType >::print ( std::ostream &  os) const
inline

Simple formatted print of a rectangular lattice

Referenced by axom::spin::operator<<().


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