GridFormat 0.2.1
I/O-Library for grid-like data structures
Loading...
Searching...
No Matches
GridFormat::ImageGrid< dim, CoordinateType > Class Template Reference

Predefined grid implementation that represents a structured, equispaced grid. More...

#include <image_grid.hpp>

Detailed Description

template<std::size_t dim, Concepts::Scalar CoordinateType>
class GridFormat::ImageGrid< dim, CoordinateType >
Template Parameters
dimThe dimension of the grid (1 <= dim <= 3)
CoordinateTypeThe type used to represent coordinates (e.g. double)

Public Types

using Cell = Entity< 0 >
 The type used for grid cells.
 
using Point = Entity< dim >
 The type used for grid points.
 

Public Member Functions

template<Concepts::StaticallySizedMDRange< 1 > Size, Concepts::StaticallySizedMDRange< 1 > Cells>
 ImageGrid (Size &&size, Cells &&cells)
 Constructor overload for general range types.
 
template<Concepts::StaticallySizedMDRange< 1 > Origin, Concepts::StaticallySizedMDRange< 1 > Size, Concepts::StaticallySizedMDRange< 1 > Cells>
requires (static_size<Origin> == dim and static_size<Size> == dim and static_size<Cells> == dim and std::integral<std::ranges::range_value_t<Cells>>)
 ImageGrid (Origin &&origin, Size &&size, Cells &&cells)
 Constructor overload for general range types.
 
 ImageGrid (std::array< CoordinateType, dim > size, std::array< std::size_t, dim > cells)
 Construct a grid with the given size and discretization.
 
 ImageGrid (std::array< CoordinateType, dim > origin, std::array< CoordinateType, dim > size, std::array< std::size_t, dim > cells)
 Construct a grid with the given size and discretization.
 
std::size_t number_of_cells () const
 
std::size_t number_of_points () const
 
std::size_t number_of_cells (unsigned int direction) const
 
std::size_t number_of_points (unsigned int direction) const
 
const auto & origin () const
 
const auto & spacing () const
 
auto extents () const
 Return an array containing the number of cells in all directions.
 
auto ordinates (int direction) const
 Return the ordinates of the grid along the given direction.
 
auto position (const Point &p) const
 Return the physical position of the given grid point.
 
auto center (const Cell &c) const
 Return the physical center position of the given grid cell.
 
std::size_t id (const Point &p) const
 Return a unique id for the given point.
 
std::ranges::range auto cells () const
 Return a range over all cells of the grid.
 
std::ranges::range auto points () const
 Return a range over all points of the grid.
 
std::ranges::range auto points (const Cell &cell) const
 Return a range over all points in the given grid cell.
 

Constructor & Destructor Documentation

◆ ImageGrid() [1/2]

template<std::size_t dim, Concepts::Scalar CoordinateType>
GridFormat::ImageGrid< dim, CoordinateType >::ImageGrid ( std::array< CoordinateType, dim >  size,
std::array< std::size_t, dim >  cells 
)
inline
Parameters
sizeThe size of the grid
cellsThe number of cells in all directions

◆ ImageGrid() [2/2]

template<std::size_t dim, Concepts::Scalar CoordinateType>
GridFormat::ImageGrid< dim, CoordinateType >::ImageGrid ( std::array< CoordinateType, dim >  origin,
std::array< CoordinateType, dim >  size,
std::array< std::size_t, dim >  cells 
)
inline
Parameters
originThe origin of the grid (e.g. the lower-left corner in 2d)
sizeThe size of the grid
cellsThe number of cells in all directions

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