core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::UniformGrid< Dim > Struct Template Reference

A box resolved by a regular cell grid. More...

#include <domain.hpp>

Public Member Functions

 UniformGrid ()=default
 
 UniformGrid (const IVec< Dim > &c, const Box< Dim > &b)
 
const Vec< Dim > & length () const
 
const Vec< Dim > & origin () const
 
bool periodic (int axis) const
 
const IVec< Dim > & resolution () const
 
Vec< Dim > spacing () const
 Cell size per axis: length / cells.
 
Real minSpacing () const
 The smallest cell size — the reference length the solvers non-dimensionalise with.
 
bool isIsotropic (Real tol=1e-12) const
 True when every axis has the same cell size to within tol relative.
 
Index numCells () const
 
Real cellVolume () const
 
Vec< Dim > cellCentre (const IVec< Dim > &idx) const
 Physical centre of cell idx: origin + (idx + 1/2) * h.
 
Vec< Dim > faceCentre (int axis, const IVec< Dim > &idx) const
 Physical centre of the axis-normal face at index idx (MAC staggering): the face coordinate is on the node in axis and cell-centred in the other axes.
 
Vec< Dim > nodePosition (const IVec< Dim > &idx) const
 Physical position of grid node idx (cell corner): origin + idx * h.
 
Vec< Dim > indexOf (const Vec< Dim > &p) const
 Continuous index coordinate of a physical point: xi = (p - origin) / h.
 
Vec< Dim > physicalOf (const Vec< Dim > &xi) const
 Physical point of a continuous index coordinate: p = origin + xi * h. Inverse of indexOf.
 
IVec< Dim > cellOf (const Vec< Dim > &p) const
 Index of the cell containing p (floor of the continuous index). No bounds check.
 
bool contains (const Vec< Dim > &p) const
 
Vec< Dim > wrap (const Vec< Dim > &p) const
 
Vec< Dim > minImage (const Vec< Dim > &a, const Vec< Dim > &b) const
 

Static Public Member Functions

static UniformGrid cellUnits (const IVec< Dim > &c, const std::array< bool, Dim > &per={})
 The historical cell-unit grid: extent == cells, origin 0, spacing exactly 1.
 
static constexpr int dim ()
 

Public Attributes

Box< Dim > box {}
 
IVec< Dim > cells {}
 

Detailed Description

template<int Dim = 3>
struct peclet::core::UniformGrid< Dim >

A box resolved by a regular cell grid.

Satisfies Domain plus resolution().

Constructed from cells + a box; spacing() is derived. UniformGrid::cellUnits(cells) builds the historical "cell units" grid (extent == cells, origin 0, spacing 1) that peclet solvers used before physical domains existed.

Definition at line 107 of file domain.hpp.

Constructor & Destructor Documentation

◆ UniformGrid() [1/2]

template<int Dim = 3>
peclet::core::UniformGrid< Dim >::UniformGrid ( )
default

◆ UniformGrid() [2/2]

template<int Dim = 3>
peclet::core::UniformGrid< Dim >::UniformGrid ( const IVec< Dim > &  c,
const Box< Dim > &  b 
)
inline

Definition at line 112 of file domain.hpp.

Member Function Documentation

◆ cellUnits()

template<int Dim = 3>
static UniformGrid peclet::core::UniformGrid< Dim >::cellUnits ( const IVec< Dim > &  c,
const std::array< bool, Dim > &  per = {} 
)
inlinestatic

The historical cell-unit grid: extent == cells, origin 0, spacing exactly 1.

Definition at line 115 of file domain.hpp.

◆ dim()

template<int Dim = 3>
static constexpr int peclet::core::UniformGrid< Dim >::dim ( )
inlinestaticconstexpr

Definition at line 126 of file domain.hpp.

◆ length()

template<int Dim = 3>
const Vec< Dim > & peclet::core::UniformGrid< Dim >::length ( ) const
inline

Definition at line 127 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box.

◆ origin()

template<int Dim = 3>
const Vec< Dim > & peclet::core::UniformGrid< Dim >::origin ( ) const
inline

Definition at line 128 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box.

◆ periodic()

template<int Dim = 3>
bool peclet::core::UniformGrid< Dim >::periodic ( int  axis) const
inline

Definition at line 129 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box.

◆ resolution()

template<int Dim = 3>
const IVec< Dim > & peclet::core::UniformGrid< Dim >::resolution ( ) const
inline

Definition at line 130 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::cells.

◆ spacing()

◆ minSpacing()

template<int Dim = 3>
Real peclet::core::UniformGrid< Dim >::minSpacing ( ) const
inline

The smallest cell size — the reference length the solvers non-dimensionalise with.

Definition at line 142 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::spacing().

◆ isIsotropic()

template<int Dim = 3>
bool peclet::core::UniformGrid< Dim >::isIsotropic ( Real  tol = 1e-12) const
inline

True when every axis has the same cell size to within tol relative.

Definition at line 151 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::spacing().

◆ numCells()

template<int Dim = 3>
Index peclet::core::UniformGrid< Dim >::numCells ( ) const
inline

Definition at line 162 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::cells.

◆ cellVolume()

template<int Dim = 3>
Real peclet::core::UniformGrid< Dim >::cellVolume ( ) const
inline

Definition at line 169 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::spacing().

◆ cellCentre()

template<int Dim = 3>
Vec< Dim > peclet::core::UniformGrid< Dim >::cellCentre ( const IVec< Dim > &  idx) const
inline

Physical centre of cell idx: origin + (idx + 1/2) * h.

Definition at line 178 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box, and peclet::core::UniformGrid< Dim >::spacing().

◆ faceCentre()

template<int Dim = 3>
Vec< Dim > peclet::core::UniformGrid< Dim >::faceCentre ( int  axis,
const IVec< Dim > &  idx 
) const
inline

Physical centre of the axis-normal face at index idx (MAC staggering): the face coordinate is on the node in axis and cell-centred in the other axes.

Definition at line 188 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box, and peclet::core::UniformGrid< Dim >::spacing().

◆ nodePosition()

template<int Dim = 3>
Vec< Dim > peclet::core::UniformGrid< Dim >::nodePosition ( const IVec< Dim > &  idx) const
inline

Physical position of grid node idx (cell corner): origin + idx * h.

Definition at line 199 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box, and peclet::core::UniformGrid< Dim >::spacing().

◆ indexOf()

template<int Dim = 3>
Vec< Dim > peclet::core::UniformGrid< Dim >::indexOf ( const Vec< Dim > &  p) const
inline

Continuous index coordinate of a physical point: xi = (p - origin) / h.

The inverse of physicalOf; cell centre (i+1/2) maps back to itself.

Definition at line 209 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box, and peclet::core::UniformGrid< Dim >::spacing().

Referenced by peclet::core::UniformGrid< Dim >::cellOf().

◆ physicalOf()

template<int Dim = 3>
Vec< Dim > peclet::core::UniformGrid< Dim >::physicalOf ( const Vec< Dim > &  xi) const
inline

Physical point of a continuous index coordinate: p = origin + xi * h. Inverse of indexOf.

Definition at line 218 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box, and peclet::core::UniformGrid< Dim >::spacing().

◆ cellOf()

template<int Dim = 3>
IVec< Dim > peclet::core::UniformGrid< Dim >::cellOf ( const Vec< Dim > &  p) const
inline

Index of the cell containing p (floor of the continuous index). No bounds check.

Definition at line 227 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::indexOf().

◆ contains()

template<int Dim = 3>
bool peclet::core::UniformGrid< Dim >::contains ( const Vec< Dim > &  p) const
inline

Definition at line 235 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box.

◆ wrap()

template<int Dim = 3>
Vec< Dim > peclet::core::UniformGrid< Dim >::wrap ( const Vec< Dim > &  p) const
inline

Definition at line 236 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box.

◆ minImage()

template<int Dim = 3>
Vec< Dim > peclet::core::UniformGrid< Dim >::minImage ( const Vec< Dim > &  a,
const Vec< Dim > &  b 
) const
inline

Definition at line 237 of file domain.hpp.

References peclet::core::UniformGrid< Dim >::box.

Member Data Documentation

◆ box

◆ cells


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