Template Numerical Library version\ main:f17d0c8
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 >:
Collaboration graph
[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 cordinates.
 
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 vertexes, 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 CoordinatesTypegetDimensions () const noexcept
 Returns dimensions as a number of edges along each axis in a form of coordinate vector.
 
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.
 
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.
 
__cuda_callable__ Index getEntitiesCount (IndexType dimension) const
 Returns number of entities of specific dimension.
 
__cuda_callable__ const EntitiesCountsgetEntitiesCounts () 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<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 (const CoordinatesType &coordinates) const
 Grid entity getter based on entity dimension and entity coordinates.
 
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__ EntityType< EntityDimension > getEntity (IndexType entityIdx) const
 Grid entity getter based on entity dimension 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 CoordinatesTypegetInteriorBegin () const
 Gets begin of the region of interior cells, i.e. all cells without the boundary cells.
 
const CoordinatesTypegetInteriorEnd () const
 Gets end of the region of interior cells, i.e. all cells without the boundary cells.
 
const CoordinatesTypegetLocalBegin () const
 Gets the "lower left" corner of subdomain for distributed grid.
 
const CoordinatesTypegetLocalEnd () 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 PointTypegetOrigin () const noexcept
 Returns the origin of the grid.
 
__cuda_callable__ const PointTypegetProportions () const noexcept
 Get the proportions of the grid.
 
__cuda_callable__ Real getSmallestSpaceStep () const noexcept
 Get the smallest space step.
 
__cuda_callable__ const PointTypegetSpaceSteps () 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 mthod 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 vertexes, edges, faces or cells together with parallel traversing of all, interior or boundary mesh entities.

Template Parameters
Dimensionis grid dimension.
Realis type of the floating point numbers.
Deviceis the device to be used for the execution of grid operations.
Indexis 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
EntityDimensionis 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 compatiblity 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 >
static constexpr int spaceStepsPowersSize
Returns the coefficient powers size.
Definition Grid.h:108
constexpr Index discretePow(Index value, Index power)
Computes an integral power of an integer.
Definition DiscreteMath.h:73

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
Dimensionsis variadic template pack.
Parameters
dimensionsare 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
dimensionsare 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\) fullfil \( origin \leq c < origin + proportions\).

Template Parameters
EntityDimensionis dimension of the grid entities.
Parameters
funcis an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:
EntityDimension >&entity ) mutable {};
#define __cuda_callable__
Definition Macros.h:49
Structure describing a grid entity i.e., grid cells, faces, edges, vertexes and so on.
Definition GridEntity.h:27
Orthogonal n-dimensional grid.
Definition Grid.h:30

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

Parameters
argsare 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
EntityDimensionis dimension of the grid entities.
Parameters
beginis the 'lower left' corner of the region.
endis the 'upper right' corner of the region.
funcis an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:
EntityDimension >&entity ) mutable {};

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

Parameters
argsare 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
EntityDimensionis dimension of the grid entities.
Parameters
funcis an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:
EntityDimension >&entity ) mutable {};

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

Parameters
argsare 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\) fullfil \( begin \leq c < end\).

Template Parameters
EntityDimensionis dimension of the grid entities.
Parameters
beginis the 'lower left' corner of the region.
endis the 'upper right' corner of the region.
funcis an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:
EntityDimension >&entity ) mutable {};

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

Parameters
argsare 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\) fullfil \( origin < c < origin + proportions - 1\).

Template Parameters
EntityDimensionis dimension of the grid entities.
Parameters
funcis an instance of the lambda function to be performed on each grid entity. It is supposed to have the following form:
EntityDimension >&entity ) mutable {};

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

Parameters
argsare 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\) fullfil \( localBegin \leq c < localEnd\).

Template Parameters
EntityDimensionis dimension of the grid entities. It is supposed to have the following form:
EntityDimension >&entity ) mutable {};

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

Parameters
funcis an instance of the lambda function to be performed on each grid entity.
argsare 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
noexcept

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 posibilities:

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 )
Vertexes ( 0, 0, 0 )
Template Parameters
EntityDimensionis dimensions of grid entity.
Parameters
[in]orientationis 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
noexcept

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<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
noexcept

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

Template Parameters
EntityDimensionis dimension 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<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
noexcept

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

Template Parameters
Entityis type 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

Returns number of entities of specific dimension.

Parameters
[in]dimensionis 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
noexcept

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

Returns count of entities of specific dimensions.

Template Parameters
DimensionsIndexvariadic template parameter for a list of dimensions.
Parameters
[in]indicesis 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<typename EntityType >
__cuda_callable__ EntityType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity ( const CoordinatesType & coordinates) const

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 vertexes.

Template Parameters
EntityTypeis type of the grid entity.
Parameters
coordinatesare 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<int EntityDimension>
__cuda_callable__ EntityType< EntityDimension > TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity ( const CoordinatesType & coordinates) const

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 vertexes.

Template Parameters
EntityDimensionis dimension of the grid entity.
Parameters
coordinatesare 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<typename EntityType >
__cuda_callable__ EntityType TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity ( IndexType entityIdx) const

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
EntityTypeis type of the grid entity.
Parameters
entityIdxis 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<int EntityDimension>
__cuda_callable__ EntityType< EntityDimension > TNL::Meshes::Grid< Dimension, Real, Device, Index >::getEntity ( IndexType entityIdx) const

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
EntityDimensionis dimension of the grid entity.
Parameters
entityIdxis 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
noexcept

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
EntityDimensionis dimension of an entity.
Parameters
entityIdxis an index of the entity.
normalsthis parameter is filled with the grid entity orientation in a form of normals.
orientationis 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

Gets entity index using entity type.

Template Parameters
Entityis a type of the entity.
Parameters
entityis instance of the entity.
Returns
index of the entity.

◆ getEntityOrientationsCount()

template<int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int>
static 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]entityDimensionis 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

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

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

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

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
noexcept

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 posibilities:

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 )
Vertexes ( 1, 1, 1 )
Template Parameters
EntityDimensionis dimensions of grid entity.
Parameters
[in]orientationis 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
noexcept

Computes orientation index of a grid entity based on normals.

Template Parameters
EntityDimensionis dimension of the grid entity.
Parameters
normalsdefines 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
noexcept

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

Template Parameters
EntityDimensionis dimension of the grid entities.
EntityOrientationis orientation of the grid entitie.
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

Returns number of entities of specific dimension and orientation.

Parameters
[in]dimensionis dimension of grid entities.
[in]orientationis 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
noexcept

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
noexcept

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
noexcept

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
noexcept

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
noexcept

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
Powersis 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

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]powersis 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

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
Powersis a pack of template types.
Parameters
[in]powersis 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
dimensionsgrid 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 mthod accepts as many indexes for the dimensions as the dimension of the grid.

Template Parameters
Dimensionsvariadic template accepting a serie of indexes.
Parameters
[in]dimensionsserie 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
originis the origin of the grid.
proportionsis 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
beginis 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
endis 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
beginis "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
endis "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
beginis "lower left" corner of the subdomain.
endis "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]originof 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
Coordinatesis a pack of templates types.
Parameters
[in]coordinatesis 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]spaceStepsare 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
Stepsis a pack of template types.
Parameters
[in]spaceStepsis 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]loggeris 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 lexigraphical.

◆ 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: