Template Numerical Library: TNL::Meshes::Grid< Dimension, Real, Device, Index > Class Template Reference

Template Numerical Library version\ main:0b2c40fb1

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
TNL::Meshes::Grid< Dimension, Real, Device, Index > Class Template Reference

Orthogonal n-dimensional grid. More...

`#include <TNL/Meshes/Grid.h>`

Collaboration diagram for TNL::Meshes::Grid< Dimension, Real, Device, Index >:
[legend]

## Public Types
using | Cell = EntityType< Dimension >
| Type of grid entity expressing cells, i.e. grid entity with dimension equal to the grid dimension.
using | CoordinatesType = Containers::StaticVector< Dimension, Index >
| Type for grid entities coordinates.
using | DeviceType = Device
| Device to be used for the execution of grid operations.
using | Edge = EntityType< 1 >
| Type of grid entity expressing edges, i.e. grid entity with dimension equal to one.
using | EntitiesCounts = Containers::StaticVector< Dimension + 1, Index >
template<int EntityDimension>
using | EntityType = GridEntity< Grid, EntityDimension >
| Alias for grid entities with given dimension.
using | Face = EntityType< Dimension - 1 >
| Type of grid entity expressing faces, i.e. grid entity with dimension equal to the grid dimension minus one.
using | GlobalIndexType = Index
| Type for indexing of the mesh entities of the grid.
using | IndexType = Index
| Type for indexing of the mesh entities of the grid.
using | OrientationNormalsContainer = Containers::StaticVector< 1 << Dimension, CoordinatesType >
using | PointType = Containers::StaticVector< Dimension, Real >
| Type for world coordinates.
using | RealType = Real
| Type of the floating point numbers.
using | SpaceProductsContainer
using | Vertex = EntityType< 0 >
| Type of grid entity expressing vertices, i.e. grid entity with dimension equal to zero.

## Public Member Functions
| Grid ()
| Grid constructor with no parameters.
| Grid (const CoordinatesType &dimensions)
| Grid constructor with grid dimensions given as TNL::Meshes::Grid::CoordinatesType.
template<typename... Dimensions, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, Dimensions >... >, bool > = true, std::enable_if_t< sizeof...(Dimensions)==Dimension, bool > = true>
| Grid (Dimensions... dimensions)
| Grid constructor with grid dimensions parameters.
template<int EntityDimension, typename Func, typename... FuncArgs>
void | forAllEntities (Func func, FuncArgs... args) const
| Iterate over all mesh entities with given dimension and perform given lambda function on each of them.
template<int EntityDimension, typename Func, typename... FuncArgs>
void | forBoundaryEntities (const CoordinatesType &begin, const CoordinatesType &end, Func func, FuncArgs... args) const
| Iterate over all boundary mesh entities of given region with given dimension and perform given lambda function on each of them.
template<int EntityDimension, typename Func, typename... FuncArgs>
void | forBoundaryEntities (Func func, FuncArgs... args) const
| Iterate over all boundary mesh entities with given dimension and perform given lambda function on each of them.
template<int EntityDimension, typename Func, typename... FuncArgs>
void | forEntities (const CoordinatesType &begin, const CoordinatesType &end, Func func, FuncArgs... args) const
| Iterate over all mesh entities within given region with given dimension and perform given lambda function on each of them.
template<int EntityDimension, typename Func, typename... FuncArgs>
void | forInteriorEntities (Func func, FuncArgs... args) const
| Iterate over all interior mesh entities with given dimension and perform given lambda function on each of them.
template<int EntityDimension, typename Func, typename... FuncArgs>
void | forLocalEntities (Func func, FuncArgs... args) const
| Iterate over all mesh entities within the local subdomain with given dimension and perform given lambda function on each of them.
template<int EntityDimension>
__cuda_callable__ CoordinatesType | getBasis (Index orientation) const noexcept
| Returns basis of the entity with the specific orientation.
__cuda_callable__ Real | getCellMeasure () const
__cuda_callable__ const CoordinatesType & | getDimensions () const noexcept
| Returns dimensions as a number of edges along each axis in a form of coordinate vector.
template<typename Entity, std::enable_if_t< Templates::isInClosedInterval(0, Entity::getEntityDimension(), Dimension), bool > = true>
__cuda_callable__ Index | getEntitiesCount () const noexcept
| Returns number of entities of specific entity type as a template parameter.
template<int EntityDimension, std::enable_if_t< Templates::isInClosedInterval(0, EntityDimension, Dimension), bool > = true>
__cuda_callable__ Index | getEntitiesCount () const noexcept
| Returns number of entities of specific dimension given as a template parameter.
__cuda_callable__ Index | getEntitiesCount (IndexType dimension) const
| Returns number of entities of specific dimension.
__cuda_callable__ const EntitiesCounts & | getEntitiesCounts () const noexcept
| Returns count of entities for all dimensions.
template<typename... DimensionIndex, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, DimensionIndex >... >, bool > = true, std::enable_if_t<(sizeof...(DimensionIndex) > 0), bool > = true>
__cuda_callable__ Containers::StaticVector< sizeof...(DimensionIndex), Index > | getEntitiesCounts (DimensionIndex... indices) const
| Returns count of entities of specific dimensions.
template<int EntityDimension>
__cuda_callable__ EntityType< EntityDimension > | getEntity (const CoordinatesType &coordinates) const
| Grid entity getter based on entity dimension and entity coordinates.
template<typename EntityType>
__cuda_callable__ EntityType | getEntity (const CoordinatesType &coordinates) const
| Grid entity getter based on entity type and entity coordinates.
template<int EntityDimension>
__cuda_callable__ EntityType< EntityDimension > | getEntity (IndexType entityIdx) const
| Grid entity getter based on entity dimension and entity index.
template<typename EntityType>
__cuda_callable__ EntityType | getEntity (IndexType entityIdx) const
| Grid entity getter based on entity type and entity index.
template<int EntityDimension>
__cuda_callable__ CoordinatesType | getEntityCoordinates (IndexType entityIdx, CoordinatesType &normals, Index &orientation) const noexcept
| Computes coordinates of a grid entity based on an index of the entity.
template<typename Entity>
__cuda_callable__ Index | getEntityIndex (const Entity &entity) const
| Gets entity index using entity type.
const CoordinatesType & | getInteriorBegin () const
| Gets begin of the region of interior cells, i.e. all cells without the boundary cells.
const CoordinatesType & | getInteriorEnd () const
| Gets end of the region of interior cells, i.e. all cells without the boundary cells.
const CoordinatesType & | getLocalBegin () const
| Gets the "lower left" corner of subdomain for distributed grid.
const CoordinatesType & | getLocalEnd () const
| Gets the "upper right" corner of subdomain for distributed grid.
template<int EntityDimension>
__cuda_callable__ CoordinatesType | getNormals (Index orientation) const noexcept
| Returns normals of the entity with the specific orientation.
template<int EntityDimension>
__cuda_callable__ IndexType | getOrientation (const CoordinatesType &normals) const noexcept
| Computes orientation index of a grid entity based on normals.
template<int EntityDimension, int EntityOrientation, std::enable_if_t< Templates::isInClosedInterval(0, EntityDimension, Dimension), bool > = true, std::enable_if_t< Templates::isInClosedInterval(0, EntityOrientation, Dimension), bool > = true>
__cuda_callable__ Index | getOrientedEntitiesCount () const noexcept
| Returns number of entities of specific dimension and orientation given as template parameters.
__cuda_callable__ Index | getOrientedEntitiesCount (IndexType dimension, IndexType orientation) const
| Returns number of entities of specific dimension and orientation.
__cuda_callable__ const PointType & | getOrigin () const noexcept
| Returns the origin of the grid.
__cuda_callable__ const PointType & | getProportions () const noexcept
| Get the proportions of the grid.
__cuda_callable__ Real | getSmallestSpaceStep () const noexcept
| Get the smallest space step.
__cuda_callable__ const PointType & | getSpaceSteps () const noexcept
| Returns the space steps of the grid.
template<Index... Powers, std::enable_if_t< sizeof...(Powers)==Dimension, bool > = true>
__cuda_callable__ Real | getSpaceStepsProducts () const noexcept
| Returns product of space step powers given as template parameters.
__cuda_callable__ Real | getSpaceStepsProducts (const CoordinatesType &powers) const
| Returns product of space steps powers.
template<typename... Powers, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, Powers >... >, bool > = true, std::enable_if_t< sizeof...(Powers)==Dimension, bool > = true>
__cuda_callable__ Real | getSpaceStepsProducts (Powers... powers) const
| Returns product of given space steps powers.
void | setDimensions (const CoordinatesType &dimensions)
| Set the dimensions (or resolution) of the grid. This method accepts particular dimensions packed in a static vector.
template<typename... Dimensions, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, Dimensions >... >, bool > = true, std::enable_if_t< sizeof...(Dimensions)==Dimension, bool > = true>
void | setDimensions (Dimensions... dimensions)
| Set the dimensions (or resolution) of the grid. The resolution must be given in terms on grid cells not grid vertices. The method accepts as many indexes for the dimensions as the dimension of the grid.
void | setDomain (const PointType &origin, const PointType &proportions)
| Sets the origin and proportions of this grid.
void | setInteriorBegin (const CoordinatesType &begin)
| Sets begin of the region of interior cells, i.e. all cells without the boundary cells.
void | setInteriorEnd (const CoordinatesType &end)
| Sets end of the region of interior cells, i.e. all cells without the boundary cells.
void | setLocalBegin (const CoordinatesType &begin)
| Sets the "lower left" corfner of subdomain of distributed grid.
void | setLocalEnd (const CoordinatesType &end)
| Sets the "upper right" corfner of subdomain of distributed grid.
void | setLocalSubdomain (const CoordinatesType &begin, const CoordinatesType &end)
| Sets the subdomain of distributed grid.
void | setOrigin (const PointType &origin) noexcept
| Set the origin of the grid in a form of a point.
template<typename... Coordinates, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Real, Coordinates >... >, bool > = true, std::enable_if_t< sizeof...(Coordinates)==Dimension, bool > = true>
void | setOrigin (Coordinates... coordinates) noexcept
| Set the origin of the grid in a form of a pack of real numbers.
void | setSpaceSteps (const PointType &spaceSteps) noexcept
| Set the space steps along each dimension of the grid.
template<typename... Steps, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Real, Steps >... >, bool > = true, std::enable_if_t< sizeof...(Steps)==Dimension, bool > = true>
void | setSpaceSteps (Steps... spaceSteps) noexcept
| Set the space steps along each dimension of the grid in a form of a pack of real numbers.
void | writeProlog (TNL::Logger &logger) const noexcept
| Writes info about the grid.

## Static Public Member Functions
static constexpr Index | getEntityOrientationsCount (IndexType entityDimension)
| Returns the number of orientations for entity dimension. For example in 2-D Grid the edge can be vertical or horizontal.
static constexpr int | getMeshDimension ()
| Returns the dimension of grid.

## Static Public Attributes
static constexpr int | spaceStepsPowersSize = 5
| Returns the coefficient powers size.

## Protected Member Functions
void | fillEntitiesCount ()
void | fillNormals ()
void | fillProportions ()
void | fillSpaceSteps ()
void | fillSpaceStepsPowers ()
template<int EntityDimension, typename Func, typename... FuncArgs>
void | traverseAll (const CoordinatesType &from, const CoordinatesType &to, Func func, FuncArgs... args) const
template<int EntityDimension, typename Func, typename... FuncArgs>
void | traverseAll (Func func, FuncArgs... args) const
template<int EntityDimension, typename Func, typename... FuncArgs>
void | traverseBoundary (const CoordinatesType &from, const CoordinatesType &to, Func func, FuncArgs... args) const
template<int EntityDimension, typename Func, typename... FuncArgs>
void | traverseBoundary (Func func, FuncArgs... args) const
template<int EntityDimension, typename Func, typename... FuncArgs>
void | traverseInterior (const CoordinatesType &from, const CoordinatesType &to, Func func, FuncArgs... args) const
template<int EntityDimension, typename Func, typename... FuncArgs>
void | traverseInterior (Func func, FuncArgs... args) const

## Protected Attributes
Containers::StaticVector< Dimension+1, Index > | cumulativeEntitiesCountAlongNormals
| A cumulative map over dimensions.
CoordinatesType | dimensions
| Grid dimensions.
Containers::StaticVector< 1<< Dimension, Index > | entitiesCountAlongNormals
| A list of elements count along specific directions.
CoordinatesType | interiorBegin
CoordinatesType | interiorEnd
CoordinatesType | localBegin
| Region of subdomain if this grid represents one sudbdomain of distributed grid.
CoordinatesType | localEnd
OrientationNormalsContainer | normals
| Container with normals defining grid entity orientations.
PointType | origin
PointType | proportions
PointType | spaceSteps
SpaceProductsContainer | spaceStepsProducts

## Detailed Description

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
class TNL::Meshes::Grid< Dimension, Real, Device, Index >

Orthogonal n-dimensional grid.

This data structure represents regular orthogonal numerical mesh. It provides indexing of mesh entities like vertices, edges, faces or cells together with parallel traversing of all, interior or boundary mesh entities.

Template Parameters

  Dimension | is grid dimension.
  Real | is type of the floating point numbers.
  Device | is the device to be used for the execution of grid operations.
  Index | is type for indexing of the mesh entities of the grid.

## Member Typedef Documentation

## ◆ EntityType

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension>

using TNL::Meshes::Grid< Dimension, Real, Device, Index >::EntityType = GridEntity< Grid, EntityDimension >

Alias for grid entities with given dimension.

Template Parameters

  EntityDimension | is dimensions of the grid entity.

## ◆ GlobalIndexType

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

using TNL::Meshes::Grid< Dimension, Real, Device, Index >::GlobalIndexType = Index

Type for indexing of the mesh entities of the grid.

This is for compatibility with unstructured meshes.

## ◆ SpaceProductsContainer

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

using TNL::Meshes::Grid< Dimension, Real, Device, Index >::SpaceProductsContainer

Initial value:
Containers::StaticVector< std::integral_constant< Index, discretePow( spaceStepsPowersSize, Dimension ) >::value, Real >
TNL::Containers::StaticVector
Vector with constant size.
Definition StaticVector.h:19
TNL::Meshes::Grid::spaceStepsPowersSize
static constexpr int spaceStepsPowersSize
Returns the coefficient powers size.
Definition Grid.h:108
std::integral_constant
TNL::discretePow
constexpr Index discretePow(Index value, Index power)
Computes an integral power of an integer.
Definition DiscreteMath.h:63

## Constructor & Destructor Documentation

## ◆ Grid() [1/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename... Dimensions, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, Dimensions >... >, bool > = true, std::enable_if_t< sizeof...(Dimensions)==Dimension, bool > = true>

TNL::Meshes::Grid< Dimension, Real, Device, Index >::Grid | ( | Dimensions... | dimensions | ) |

Grid constructor with grid dimensions parameters.

Template Parameters

  Dimensions | is variadic template pack.

Parameters

  dimensions | are dimensions along particular axes of the grid. The number of parameters must be equal to the size od the grid.

## ◆ Grid() [2/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

TNL::Meshes::Grid< Dimension, Real, Device, Index >::Grid | ( | const CoordinatesType & | dimensions | ) |

Grid constructor with grid dimensions given as TNL::Meshes::Grid::CoordinatesType.

Parameters

  dimensions | are dimensions along particular axes of the grid.

## Member Function Documentation

## ◆ forAllEntities()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, typename Func, typename... FuncArgs>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::forAllEntities | ( | Func | func,
|  | FuncArgs... | args ) const

Iterate over all mesh entities with given dimension and perform given lambda function on each of them.

Entities processed by this method are such that their coordinates \(c\) fulfil \( origin \leq c < origin + proportions\).

Template Parameters

  EntityDimension | is dimension of the grid entities.

Parameters

  func | is an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:

auto func = [=] __cuda_callable__( const typename Grid< Dimension, Real, Device, Index >::template EntityType<
EntityDimension >&entity ) mutable {};
__cuda_callable__
#define __cuda_callable__
Definition Macros.h:49
TNL::Meshes::Grid::EntityType
GridEntity< Grid, EntityDimension > EntityType
Alias for grid entities with given dimension.
Definition Grid.h:72
TNL::Meshes::Grid::Grid
Grid()
Grid constructor with no parameters.

where entity represents given grid entity. See TNL::Meshes::GridEntity.

Parameters

  args | are packed arguments that are going to be passed to the lambda function.

## ◆ forBoundaryEntities() [1/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, typename Func, typename... FuncArgs>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::forBoundaryEntities | ( | const CoordinatesType & | begin,
|  | const CoordinatesType & | end,
|  | Func | func,
|  | FuncArgs... | args ) const

Iterate over all boundary mesh entities of given region with given dimension and perform given lambda function on each of them.

Template Parameters

  EntityDimension | is dimension of the grid entities.

Parameters

  begin | is the 'lower left' corner of the region.
  end | is the 'upper right' corner of the region.
  func | is an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:

auto func = [=] __cuda_callable__( const typename Grid< Dimension, Real, Device, Index >::template EntityType<
EntityDimension >&entity ) mutable {};

where entity represents given grid entity. See TNL::Meshes::GridEntity.

Parameters

  args | are packed arguments that are going to be passed to the lambda function.

## ◆ forBoundaryEntities() [2/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, typename Func, typename... FuncArgs>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::forBoundaryEntities | ( | Func | func,
|  | FuncArgs... | args ) const

Iterate over all boundary mesh entities with given dimension and perform given lambda function on each of them.

Template Parameters

  EntityDimension | is dimension of the grid entities.

Parameters

  func | is an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:

auto func = [=] __cuda_callable__( const typename Grid< Dimension, Real, Device, Index >::template EntityType<
EntityDimension >&entity ) mutable {};

where entity represents given grid entity. See TNL::Meshes::GridEntity.

Parameters

  args | are packed arguments that are going to be passed to the lambda function.

## ◆ forEntities()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, typename Func, typename... FuncArgs>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::forEntities | ( | const CoordinatesType & | begin,
|  | const CoordinatesType & | end,
|  | Func | func,
|  | FuncArgs... | args ) const

Iterate over all mesh entities within given region with given dimension and perform given lambda function on each of them.

Entities processed by this method are such that their coordinates \(c\) fulfil \( begin \leq c < end\).

Template Parameters

  EntityDimension | is dimension of the grid entities.

Parameters

  begin | is the 'lower left' corner of the region.
  end | is the 'upper right' corner of the region.
  func | is an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:

auto func = [=] __cuda_callable__( const typename Grid< Dimension, Real, Device, Index >::template EntityType<
EntityDimension >&entity ) mutable {};

where entity represents given grid entity. See TNL::Meshes::GridEntity.

Parameters

  args | are packed arguments that are going to be passed to the lambda function.

## ◆ forInteriorEntities()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, typename Func, typename... FuncArgs>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::forInteriorEntities | ( | Func | func,
|  | FuncArgs... | args ) const

Iterate over all interior mesh entities with given dimension and perform given lambda function on each of them.

Entities processed by this method are such that their coordinates \(c\) fulfil \( origin < c < origin + proportions - 1\).

Template Parameters

  EntityDimension | is dimension of the grid entities.

Parameters

  func | is an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:

auto func = [=] __cuda_callable__( const typename Grid< Dimension, Real, Device, Index >::template EntityType<
EntityDimension >&entity ) mutable {};

where entity represents given grid entity. See TNL::Meshes::GridEntity.

Parameters

  args | are packed arguments that are going to be passed to the lambda function.

## ◆ forLocalEntities()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, typename Func, typename... FuncArgs>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::forLocalEntities | ( | Func | func,
|  | FuncArgs... | args ) const

Iterate over all mesh entities within the local subdomain with given dimension and perform given lambda function on each of them.

Entities processed by this method are such that their coordinates \(c\) fulfil \( localBegin \leq c < localEnd\).

Template Parameters

  EntityDimension | is dimension of the grid entities. It is supposed to have the following form:

auto func = [=] __cuda_callable__( const typename Grid< Dimension, Real, Device, Index >::template EntityType<
EntityDimension >&entity ) mutable {};

where entity represents given grid entity. See TNL::Meshes::GridEntity.

Parameters

  func | is an instance of the lambda function to be performed on each grid entity.
  args | are packed arguments that are going to be passed to the lambda function.

## ◆ getBasis()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension>

__cuda_callable__ CoordinatesType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getBasis | ( | Index | orientation | ) | const
| nodiscardnoexcept

Returns basis of the entity with the specific orientation.

Basis is integer vector having ones for axis along which the entity has non-zero lengths. For example in 3D grid we have the following possibilities:

Entity | Basis
--- | ---
Cells | ( 1, 1, 1 )
Faces along x- and y- axes | ( 1, 1, 0 )
Faces along x- and z- axes | ( 1, 0, 1 )
Faces along y- and z- axes | ( 0, 1, 1 )
Edges along x-axis | ( 1, 0, 0 )
Edges along y-axis | ( 0, 1, 0 )
Edges along z-axis | ( 0, 0, 1 )
Vertices | ( 0, 0, 0 )

Template Parameters

  EntityDimension | is dimensions of grid entity.

Parameters

  [in] | orientation | is orientation of the entity

Returns
  normals of the grid entity.

## ◆ getDimensions()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ const CoordinatesType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getDimensions | ( |  | ) | const
| nodiscardnoexcept

Returns dimensions as a number of edges along each axis in a form of coordinate vector.

Returns
  Coordinate vector with number of edges along each axis.

## ◆ getEntitiesCount() [1/3]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename Entity, std::enable_if_t< Templates::isInClosedInterval(0, Entity::getEntityDimension(), Dimension), bool > = true>

__cuda_callable__ Index TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntitiesCount | ( |  | ) | const
| nodiscardnoexcept

Returns number of entities of specific entity type as a template parameter.

Template Parameters

  Entity | is type of grid entities to be counted.

Returns
  Number of grid entities with given dimension.

## ◆ getEntitiesCount() [2/3]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, std::enable_if_t< Templates::isInClosedInterval(0, EntityDimension, Dimension), bool > = true>

__cuda_callable__ Index TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntitiesCount | ( |  | ) | const
| nodiscardnoexcept

Returns number of entities of specific dimension given as a template parameter.

Template Parameters

  EntityDimension | is dimension of grid entities to be counted.

Returns
  Number of grid entities with given dimension.

## ◆ getEntitiesCount() [3/3]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ Index TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntitiesCount | ( | IndexType | dimension | ) | const
| nodiscard

Returns number of entities of specific dimension.

Parameters

  [in] | dimension | is a dimension of grid entities to be counted.

Returns
  number of entities of specific dimension.

## ◆ getEntitiesCounts() [1/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ const EntitiesCounts & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntitiesCounts | ( |  | ) | const
| nodiscardnoexcept

Returns count of entities for all dimensions.

Returns
  vector of count of entities for all dimensions.

## ◆ getEntitiesCounts() [2/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename... DimensionIndex, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, DimensionIndex >... >, bool > = true, std::enable_if_t<(sizeof...(DimensionIndex) > 0), bool > = true>

__cuda_callable__ Containers::StaticVector< sizeof...(DimensionIndex), Index > TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntitiesCounts | ( | DimensionIndex... | indices | ) | const
| nodiscard

Returns count of entities of specific dimensions.

Template Parameters

  DimensionsIndex | variadic template parameter for a list of dimensions.

Parameters

  [in] | indices | is a list of dimensions of grid entities to be counted.

Returns
  count of entities of specific dimensions.

## ◆ getEntity() [1/4]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension>

__cuda_callable__ EntityType< EntityDimension > TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity | ( | const CoordinatesType & | coordinates | ) | const
| nodiscard

Grid entity getter based on entity dimension and entity coordinates.

Grid entity orientation is set to the default value. This is especially no problem in case of cells and vertices.

Template Parameters

  EntityDimension | is dimension of the grid entity.

Parameters

  coordinates | are coordinates of the grid entity.

Returns
  grid entity of given type.

## ◆ getEntity() [2/4]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename EntityType>

__cuda_callable__ EntityType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity | ( | const CoordinatesType & | coordinates | ) | const
| nodiscard

Grid entity getter based on entity type and entity coordinates.

Grid entity orientation is set to the default value. This is especially no problem in case of cells and vertices.

Template Parameters

  EntityType | is type of the grid entity.

Parameters

  coordinates | are coordinates of the grid entity.

Returns
  grid entity of given type.

## ◆ getEntity() [3/4]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension>

__cuda_callable__ EntityType< EntityDimension > TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity | ( | IndexType | entityIdx | ) | const
| nodiscard

Grid entity getter based on entity dimension and entity index.

Remark: Computation of grid coordinates and its orientation based on the grid entity index is highly inefficient and it should not be used at critical parts of algorithms.

Template Parameters

  EntityDimension | is dimension of the grid entity.

Parameters

  entityIdx | is index of the grid entity.

Returns
  grid entity of given type.

## ◆ getEntity() [4/4]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename EntityType>

__cuda_callable__ EntityType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity | ( | IndexType | entityIdx | ) | const
| nodiscard

Grid entity getter based on entity type and entity index.

Remark: Computation of grid coordinates and its orientation based on the grid entity index is highly inefficient and it should not be used at critical parts of algorithms.

Template Parameters

  EntityType | is type of the grid entity.

Parameters

  entityIdx | is index of the grid entity.

Returns
  grid entity of given type.

## ◆ getEntityCoordinates()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension>

__cuda_callable__ CoordinatesType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntityCoordinates | ( | IndexType | entityIdx,
|  | CoordinatesType & | normals,
|  | Index & | orientation ) const
| nodiscardnoexcept

Computes coordinates of a grid entity based on an index of the entity.

Remark: Computation of grid coordinates and its orientation based on the grid entity index is highly inefficient and it should not be used at critical parts of algorithms.

Template Parameters

  EntityDimension | is dimension of an entity.

Parameters

  entityIdx | is an index of the entity.
  normals | this parameter is filled with the grid entity orientation in a form of normals.
  orientation | is an index of the grid entity orientation.

Returns
  coordinates of the grid entity.

## ◆ getEntityIndex()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename Entity>

__cuda_callable__ Index TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntityIndex | ( | const Entity & | entity | ) | const
| nodiscard

Gets entity index using entity type.

Template Parameters

  Entity | is a type of the entity.

Parameters

  entity | is instance of the entity.

Returns
  index of the entity.

## ◆ getEntityOrientationsCount()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

constexpr Index TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntityOrientationsCount | ( | IndexType | entityDimension | ) |
| staticconstexpr

Returns the number of orientations for entity dimension. For example in 2-D Grid the edge can be vertical or horizontal.

Parameters

  [in] | entityDimension | is dimension of grid entities to be counted.

## ◆ getInteriorBegin()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

const CoordinatesType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getInteriorBegin | ( |  | ) | const
| nodiscard

Gets begin of the region of interior cells, i.e. all cells without the boundary cells.

Returns
  begin of the region of interior cells.

## ◆ getInteriorEnd()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

const CoordinatesType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getInteriorEnd | ( |  | ) | const
| nodiscard

Gets end of the region of interior cells, i.e. all cells without the boundary cells.

Returns
  end of the region of interior cells.

## ◆ getLocalBegin()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

const CoordinatesType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getLocalBegin | ( |  | ) | const
| nodiscard

Gets the "lower left" corner of subdomain for distributed grid.

Returns
  const CoordinatesType& is "lower left" corner of subdomain for distributed grid.

## ◆ getLocalEnd()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

const CoordinatesType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getLocalEnd | ( |  | ) | const
| nodiscard

Gets the "upper right" corner of subdomain for distributed grid.

Returns
  const CoordinatesType& is "upper right" corner of subdomain for distributed grid.

## ◆ getNormals()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension>

__cuda_callable__ CoordinatesType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getNormals | ( | Index | orientation | ) | const
| nodiscardnoexcept

Returns normals of the entity with the specific orientation.

Normals is integer vector having ones for axis along which the entity has zero length. For example in 3D grid we have the following possibilities:

Entity | Normals
--- | ---
Cells | ( 0, 0, 0 )
Faces along x- and y- axes | ( 0, 0, 1 )
Faces along x- and z- axes | ( 0, 1, 0 )
Faces along y- and z- axes | ( 0, 1, 1 )
Edges along x-axis | ( 0, 1, 1 )
Edges along y-axis | ( 1, 0, 1 )
Edges along z-axis | ( 1, 1, 0 )
Vertices | ( 1, 1, 1 )

Template Parameters

  EntityDimension | is dimensions of grid entity.

Parameters

  [in] | orientation | is orientation of the entity

Returns
  normals of the grid entity.

## ◆ getOrientation()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension>

__cuda_callable__ IndexType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getOrientation | ( | const CoordinatesType & | normals | ) | const
| nodiscardnoexcept

Computes orientation index of a grid entity based on normals.

Template Parameters

  EntityDimension | is dimension of the grid entity.

Parameters

  normals | defines the orientation of an entity.

Returns
  index of grid entity orientation.

## ◆ getOrientedEntitiesCount() [1/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<int EntityDimension, int EntityOrientation, std::enable_if_t< Templates::isInClosedInterval(0, EntityDimension, Dimension), bool > = true, std::enable_if_t< Templates::isInClosedInterval(0, EntityOrientation, Dimension), bool > = true>

__cuda_callable__ Index TNL::Meshes::Grid< Dimension, Real, Device, Index >::getOrientedEntitiesCount | ( |  | ) | const
| nodiscardnoexcept

Returns number of entities of specific dimension and orientation given as template parameters.

Template Parameters

  EntityDimension | is dimension of the grid entities.
  EntityOrientation | is orientation of the grid entity.

Returns
  number of entities of specific dimension and orientation.

## ◆ getOrientedEntitiesCount() [2/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ Index TNL::Meshes::Grid< Dimension, Real, Device, Index >::getOrientedEntitiesCount | ( | IndexType | dimension,
|  | IndexType | orientation ) const
| nodiscard

Returns number of entities of specific dimension and orientation.

Parameters

  [in] | dimension | is dimension of grid entities.
  [in] | orientation | is orientation of the entities.

Returns
  number of entities of specific dimension and orientation.

## ◆ getOrigin()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ const PointType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getOrigin | ( |  | ) | const
| nodiscardnoexcept

Returns the origin of the grid.

Returns
  the origin of the grid.

## ◆ getProportions()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ const PointType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getProportions | ( |  | ) | const
| nodiscardnoexcept

Get the proportions of the grid.

Returns
  the proportions of the grid.

## ◆ getSmallestSpaceStep()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ Real TNL::Meshes::Grid< Dimension, Real, Device, Index >::getSmallestSpaceStep | ( |  | ) | const
| nodiscardnoexcept

Get the smallest space step.

Returns
  the smallest space step.

## ◆ getSpaceSteps()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ const PointType & TNL::Meshes::Grid< Dimension, Real, Device, Index >::getSpaceSteps | ( |  | ) | const
| nodiscardnoexcept

Returns the space steps of the grid.

Returns
  the space steps of the grid.

## ◆ getSpaceStepsProducts() [1/3]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<Index... Powers, std::enable_if_t< sizeof...(Powers)==Dimension, bool > = true>

__cuda_callable__ Real TNL::Meshes::Grid< Dimension, Real, Device, Index >::getSpaceStepsProducts | ( |  | ) | const
| nodiscardnoexcept

Returns product of space step powers given as template parameters.

The powers can be only integers.

For example in 3D grid if powers are \( 1, 2, 3 \) the methods returns \( h_x^1 \cdot h_y^2 \cdot h_z^3\).

Template Parameters

  Powers | is a pack of indexes.

Returns
  product of given space steps powers.

## ◆ getSpaceStepsProducts() [2/3]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

__cuda_callable__ Real TNL::Meshes::Grid< Dimension, Real, Device, Index >::getSpaceStepsProducts | ( | const CoordinatesType & | powers | ) | const
| nodiscard

Returns product of space steps powers.

For example in 3D grid if powers are \( 1, 2, 3 \) the methods returns \( h_x^1 \cdot h_y^2 \cdot h_z^3\).

Parameters

  [in] | powers | is vector of numbers telling power of particular space steps.

Returns
  product of given space steps powers.

## ◆ getSpaceStepsProducts() [3/3]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename... Powers, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, Powers >... >, bool > = true, std::enable_if_t< sizeof...(Powers)==Dimension, bool > = true>

__cuda_callable__ Real TNL::Meshes::Grid< Dimension, Real, Device, Index >::getSpaceStepsProducts | ( | Powers... | powers | ) | const
| nodiscard

Returns product of given space steps powers.

For example in 3D grid if powers are \( 1, 2, 3 \) the methods returns \( h_x^1 \cdot h_y^2 \cdot h_z^3\).

Template Parameters

  Powers | is a pack of template types.

Parameters

  [in] | powers | is a pack of numbers telling power of particular space steps.

Returns
  product of given space steps powers.

## ◆ setDimensions() [1/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setDimensions | ( | const CoordinatesType & | dimensions | ) |

Set the dimensions (or resolution) of the grid. This method accepts particular dimensions packed in a static vector.

Parameters

  dimensions | grid dimensions given in a form of coordinate vector.

## ◆ setDimensions() [2/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename... Dimensions, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Index, Dimensions >... >, bool > = true, std::enable_if_t< sizeof...(Dimensions)==Dimension, bool > = true>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setDimensions | ( | Dimensions... | dimensions | ) |

Set the dimensions (or resolution) of the grid. The resolution must be given in terms on grid cells not grid vertices. The method accepts as many indexes for the dimensions as the dimension of the grid.

Template Parameters

  Dimensions | variadic template accepting a series of indexes.

Parameters

  [in] | dimensions | series of indexes defining resolution of the grid.

## ◆ setDomain()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setDomain | ( | const PointType & | origin,
|  | const PointType & | proportions )

Sets the origin and proportions of this grid.

Parameters

  origin | is the origin of the grid.
  proportions | is total length of this grid along particular axis.

## ◆ setInteriorBegin()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setInteriorBegin | ( | const CoordinatesType & | begin | ) |

Sets begin of the region of interior cells, i.e. all cells without the boundary cells.

Parameters

  begin | is begin of the region of interior cells.

## ◆ setInteriorEnd()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setInteriorEnd | ( | const CoordinatesType & | end | ) |

Sets end of the region of interior cells, i.e. all cells without the boundary cells.

Parameters

  end | is end of the region of interior cells.

## ◆ setLocalBegin()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setLocalBegin | ( | const CoordinatesType & | begin | ) |

Sets the "lower left" corfner of subdomain of distributed grid.

Parameters

  begin | is "lower left" corner of the subdomain.

## ◆ setLocalEnd()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setLocalEnd | ( | const CoordinatesType & | end | ) |

Sets the "upper right" corfner of subdomain of distributed grid.

Parameters

  end | is "upper right" corner of the subdomain.

## ◆ setLocalSubdomain()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setLocalSubdomain | ( | const CoordinatesType & | begin,
|  | const CoordinatesType & | end )

Sets the subdomain of distributed grid.

Parameters

  begin | is "lower left" corner of the subdomain.
  end | is "upper right" corner of the subdomain.

## ◆ setOrigin() [1/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setOrigin | ( | const PointType & | origin | ) |
| noexcept

Set the origin of the grid in a form of a point.

Parameters

  [in] | origin | of the grid.

## ◆ setOrigin() [2/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename... Coordinates, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Real, Coordinates >... >, bool > = true, std::enable_if_t< sizeof...(Coordinates)==Dimension, bool > = true>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setOrigin | ( | Coordinates... | coordinates | ) |
| noexcept

Set the origin of the grid in a form of a pack of real numbers.

Template Parameters

  Coordinates | is a pack of templates types.

Parameters

  [in] | coordinates | is a pack of real numbers defining the origin.

## ◆ setSpaceSteps() [1/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setSpaceSteps | ( | const PointType & | spaceSteps | ) |
| noexcept

Set the space steps along each dimension of the grid.

Calling of this method may change the grid proportions.

Parameters

  [in] | spaceSteps | are the space steps along each dimension of the grid.

## ◆ setSpaceSteps() [2/2]

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
template<typename... Steps, std::enable_if_t< Templates::conjunction_v< std::is_convertible< Real, Steps >... >, bool > = true, std::enable_if_t< sizeof...(Steps)==Dimension, bool > = true>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::setSpaceSteps | ( | Steps... | spaceSteps | ) |
| noexcept

Set the space steps along each dimension of the grid in a form of a pack of real numbers.

Template Parameters

  Steps | is a pack of template types.

Parameters

  [in] | spaceSteps | is a pack of real numbers defining the space steps of the grid.

## ◆ writeProlog()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

void TNL::Meshes::Grid< Dimension, Real, Device, Index >::writeProlog | ( | TNL::Logger & | logger | ) | const
| noexcept

Writes info about the grid.

Parameters

  [in] | logger | is a logger used to write the grid.

## Member Data Documentation

## ◆ entitiesCountAlongNormals

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

Containers::StaticVector< 1 << Dimension, Index > TNL::Meshes::Grid< Dimension, Real, Device, Index >::entitiesCountAlongNormals
| protected

A list of elements count along specific directions.

First, elements will contain the count of 0 dimension elements. Second, elements will contain the count of 1-dimension elements and so on.

For example, let's have a 3-d grid, then the map indexing will be the next: 0 - 0 - count of vertices 1, 2, 3 - count of edges in x, y, z plane 4, 5, 6 - count of faces in xy, yz, zy plane 7 - count of cells in z y x plane

Warning
  The ordering of is lexicographical.

## ◆ normals

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>

OrientationNormalsContainer TNL::Meshes::Grid< Dimension, Real, Device, Index >::normals
| protected

Container with normals defining grid entity orientations.

normals[ orientationIdx ] gives normals for given orientation index.

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

- src/TNL/Meshes/Grid.h