Template Numerical Library: TNL::Meshes Namespace Reference

Template Numerical Library version\ main:be7e16d88

Loading...
Searching...
No Matches
Namespaces | Classes | Enumerations | Functions
TNL::Meshes Namespace Reference

Namespace for numerical meshes and related objects. More...

## Namespaces
namespace | BuildConfigTags
| Namespace for the configuration of the GridTypeResolver and MeshTypeResolver using so-called build config tags and partial class template specializations.
namespace | Readers
| Namespace for mesh readers.
namespace | Topologies
| Namespace for unstructured mesh entity topologies.
namespace | Writers
| Namespace for mesh writers.

## Classes
class | BoundaryGridEntityChecker
struct | CuthillMcKeeOrdering
struct | DefaultConfig
class | DimensionTag
class | DimensionTag< 0 >
class | DummyMesh
struct | EntityDecomposer
struct | EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersion::ConnectEdgesToCentroid, SubentityDecomposerVersion >
struct | EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersion::ConnectEdgesToPoint, SubentityDecomposerVersion >
struct | EntityDecomposer< MeshConfig, Topologies::Polyhedron, EntityDecomposerVersion::ConnectEdgesToCentroid, SubentityDecomposerVersion >
struct | EntityDecomposer< MeshConfig, Topologies::Polyhedron, EntityDecomposerVersion::ConnectEdgesToPoint, SubentityDecomposerVersion >
struct | EntityRefiner
struct | EntityRefiner< MeshConfig, Topologies::Hexahedron, EntityRefinerVersion::EdgeBisection >
struct | EntityRefiner< MeshConfig, Topologies::Quadrangle, EntityRefinerVersion::EdgeBisection >
struct | EntityRefiner< MeshConfig, Topologies::Tetrahedron, EntityRefinerVersion::EdgeBisection >
struct | EntityRefiner< MeshConfig, Topologies::Triangle, EntityRefinerVersion::EdgeBisection >
class | EntityStorageRebinder
class | Grid
| Orthogonal n-dimensional grid. More...
class | GridEntity
| Structure describing a grid entity i.e., grid cells, faces, edges, vertices and so on. More...
class | GridEntityCenterGetter
class | GridTypeResolver
struct | IndexPermutationApplier
class | Initializer
class | isDistributedGrid
class | isDistributedGrid< DistributedMeshes::DistributedMesh< Grid< Dimension, Real, Device, Index > > >
class | isDistributedMesh
class | isDistributedMesh< DistributedMeshes::DistributedMesh< Mesh< Config, Device > > >
class | isGrid
class | isGrid< Grid< Dimension, Real, Device, Index > >
class | isMesh
class | isMesh< Mesh< Config, Device > >
class | Mesh
class | MeshBuilder
struct | MeshBuilderError
class | MeshEntity
class | MeshInitializableBase
class | MeshInitializableBase< MeshConfig, Devices::Cuda, MeshType >
struct | MeshOrdering
struct | MeshOrdering< TNL::Meshes::Mesh< MeshConfig, Device >, Ordering >
class | MeshTypeResolver
class | NDMetaGrid
| Minimal class usable as Mesh in the Writers::VTIWriter. More...
class | NeighbourGridEntityGetter
struct | TetrahedronConfig
struct | TriangleConfig

## Enumerations
enum class | EntityDecomposerVersion : std::uint8_t { ConnectEdgesToCentroid , ConnectEdgesToPoint }
enum class | EntityRefinerVersion : std::uint8_t { EdgeBisection }

## Functions
template<EntityDecomposerVersion DecomposerVersion, EntityDecomposerVersion SubdecomposerVersion, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polyhedron >, bool > = true>
auto | decomposeMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<EntityDecomposerVersion DecomposerVersion, EntityDecomposerVersion SubdecomposerVersion = EntityDecomposerVersion::ConnectEdgesToPoint, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polygon >, bool > = true>
auto | decomposeMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<EntityDecomposerVersion DecomposerVersion, EntityDecomposerVersion SubDecomposerVersion, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polyhedron >, bool > = true>
auto | getDecomposedMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<EntityDecomposerVersion DecomposerVersion, EntityDecomposerVersion SubdecomposerVersion = EntityDecomposerVersion::ConnectEdgesToPoint, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polygon >, bool > = true>
auto | getDecomposedMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<typename Grid, int EntityDimension>
__cuda_callable__ Grid::PointType | getEntityCenter (const Grid &grid, const GridEntity< Grid, EntityDimension > &entity)
template<typename MeshConfig, typename Device, typename EntityTopology>
__cuda_callable__ MeshTraits< MeshConfig >::PointType | getEntityCenter (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, EntityTopology > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshTraits< MeshConfig >::PointType | getEntityCenter (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Vertex > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityCircumradius (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Edge > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityCircumradius (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Tetrahedron > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityCircumradius (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Triangle > &entity)
template<typename MeshConfig, typename Device, typename Topology>
__cuda_callable__ MeshConfig::RealType | getEntityCircumradius (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topology > &entity)
template<typename Grid>
__cuda_callable__ Grid::RealType | getEntityMeasure (const Grid &grid, const GridEntity< Grid, 0 > &entity)
template<typename Grid, int EntityDimension, typename Config>
__cuda_callable__ Grid::RealType | getEntityMeasure (const Grid &grid, const GridEntity< Grid, EntityDimension > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Edge > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Hexahedron > &entity)
template<typename MeshConfig, typename Device, std::enable_if_t< MeshConfig::spaceDimension==3, bool > = true>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Polygon > &entity)
template<typename MeshConfig, typename Device, std::enable_if_t< MeshConfig::spaceDimension==2, bool > = true>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Polygon > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Polyhedron > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Pyramid > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Quadrangle > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Tetrahedron > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Triangle > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Vertex > &entity)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getEntityMeasure (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Wedge > &entity)
template<typename MeshConfig, typename Device, typename EntityTopology>
__cuda_callable__ MeshTraits< MeshConfig >::PointType | getNormalVector (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, EntityTopology > &entity)
template<typename Grid>
__cuda_callable__ Grid::PointType | getOutwardNormalVector (const Grid &grid, const GridEntity< Grid, 0 > &face, const typename Grid::PointType cellCenter)
template<typename Grid>
__cuda_callable__ Grid::PointType | getOutwardNormalVector (const Grid &grid, const GridEntity< Grid, 1 > &face, const typename Grid::PointType cellCenter)
template<typename Grid>
__cuda_callable__ Grid::PointType | getOutwardNormalVector (const Grid &grid, const GridEntity< Grid, 2 > &face, const typename Grid::PointType cellCenter)
template<typename MeshConfig, typename Device, typename EntityTopology>
__cuda_callable__ MeshTraits< MeshConfig >::PointType | getOutwardNormalVector (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, EntityTopology > &face, typename MeshTraits< MeshConfig >::PointType cellCenter)
template<typename MeshConfig, typename Device>
__cuda_callable__ MeshTraits< MeshConfig >::PointType | getOutwardNormalVector (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Edge > &face, typename MeshTraits< MeshConfig >::PointType cellCenter)
template<EntityDecomposerVersion DecomposerVersion, typename MeshConfig, std::enable_if_t< MeshConfig::spaceDimension==3 &&(std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polygon >||std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polyhedron >), bool > = true>
auto | getPlanarMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<int Coord1, int Coord2, typename MeshConfig, typename Device>
__cuda_callable__ MeshConfig::RealType | getPolygon2DArea (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Polygon > &entity)
template<EntityRefinerVersion RefinerVersion, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Triangle >||std::is_same_v< typename MeshConfig::CellTopology, Topologies::Quadrangle >||std::is_same_v< typename MeshConfig::CellTopology, Topologies::Tetrahedron >||std::is_same_v< typename MeshConfig::CellTopology, Topologies::Hexahedron >, bool > = true>
auto | getRefinedMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<typename VectorExpression>
__cuda_callable__ VectorExpression::RealType | getTetrahedronVolume (const VectorExpression &v1, const VectorExpression &v2, const VectorExpression &v3)
template<typename VectorExpression, std::enable_if_t< VectorExpression::getSize()==3, bool > = true>
__cuda_callable__ VectorExpression::RealType | getTriangleArea (const VectorExpression &v1, const VectorExpression &v2)
template<typename VectorExpression, std::enable_if_t< VectorExpression::getSize()==2, bool > = true>
__cuda_callable__ VectorExpression::RealType | getTriangleArea (const VectorExpression &v1, const VectorExpression &v2)
template<typename MeshConfig, typename Device, std::enable_if_t< MeshConfig::spaceDimension==3, bool > = true>
__cuda_callable__ bool | isPlanar (const Mesh< MeshConfig, Device > &mesh, const MeshEntity< MeshConfig, Device, Topologies::Polygon > &entity, const typename MeshConfig::RealType precision)
template<typename Mesh>
void | loadDistributedMesh (DistributedMeshes::DistributedMesh< Mesh > &distributedMesh, const std::string &fileName, const std::string &fileFormat="auto", const MPI::Comm &communicator=MPI_COMM_WORLD)
template<typename Mesh>
void | loadMesh (Mesh &mesh, const std::string &fileName, const std::string &fileFormat="auto")
template<typename MeshConfig>
void | loadMesh (Mesh< MeshConfig, Devices::Cuda > &mesh, const std::string &fileName, const std::string &fileFormat="auto")
template<int Dimension, typename Real, typename Device, typename Index>
bool | operator!= (const Grid< Dimension, Real, Device, Index > &lhs, const Grid< Dimension, Real, Device, Index > &rhs)
| Comparison operator for grid.
template<int Dimension, typename Real, typename Device, typename Index>
std::ostream & | operator<< (std::ostream &str, const Grid< Dimension, Real, Device, Index > &grid)
| Serialization of the grid structure.
template<class Grid, int EntityDimension>
std::ostream & | operator<< (std::ostream &str, const GridEntity< Grid, EntityDimension > &entity)
| Overloaded insertion operator for printing a grid entity to output stream.
template<typename MeshConfig, typename Device>
std::ostream & | operator<< (std::ostream &str, const Mesh< MeshConfig, Device > &mesh)
template<typename MeshConfig, typename Device, typename EntityTopology>
std::ostream & | operator<< (std::ostream &str, const MeshEntity< MeshConfig, Device, EntityTopology > &entity)
template<int Dimension, typename Real, typename Device, typename Index>
bool | operator== (const Grid< Dimension, Real, Device, Index > &lhs, const Grid< Dimension, Real, Device, Index > &rhs)
| Comparison operator for grid.
template<EntityDecomposerVersion DecomposerVersion, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polyhedron >, bool > = true>
auto | planarCorrection (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<EntityDecomposerVersion DecomposerVersion, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Polygon >, bool > = true, std::enable_if_t< MeshConfig::spaceDimension==3, bool > = true>
auto | planarCorrection (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<EntityRefinerVersion RefinerVersion, typename MeshConfig, std::enable_if_t< std::is_same_v< typename MeshConfig::CellTopology, Topologies::Triangle >||std::is_same_v< typename MeshConfig::CellTopology, Topologies::Quadrangle >||std::is_same_v< typename MeshConfig::CellTopology, Topologies::Tetrahedron >||std::is_same_v< typename MeshConfig::CellTopology, Topologies::Hexahedron >, bool > = true>
auto | refineMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
template<typename ConfigTag, typename Device, typename Functor>
void | resolveAndLoadDistributedMesh (Functor &&functor, const std::string &fileName, const std::string &fileFormat="auto", const MPI::Comm &communicator=MPI_COMM_WORLD)
template<typename ConfigTag, typename Device, typename Functor>
void | resolveAndLoadMesh (Functor &&functor, const std::string &fileName, const std::string &fileFormat="auto", const std::string &realType="auto", const std::string &globalIndexType="auto")
template<typename ConfigTag, typename Device, typename Functor>
void | resolveDistributedMeshType (Functor &&functor, const std::string &fileName, const std::string &fileFormat="auto")
template<typename ConfigTag, typename Device, typename Functor>
void | resolveMeshType (Functor &&functor, const std::string &fileName, const std::string &fileFormat="auto", const std::string &realType="auto", const std::string &globalIndexType="auto")

## Detailed Description

Namespace for numerical meshes and related objects.

## Function Documentation

## ◆ loadMesh()

template<typename Mesh>

void TNL::Meshes::loadMesh | ( | Mesh & | mesh,
|  | const std::string & | fileName,
|  | const std::string & | fileFormat = "auto" )

This function takes a file name and a mesh instance and attempts to load the mesh from the file into the object.

Remarks
  The use of this function in combination with resolveMeshType should be avoided. Use resolveAndLoadMesh instead to reuse the mesh reader instance created in resolveMeshType.

## ◆ operator!=()

template<int Dimension, typename Real, typename Device, typename Index>

bool TNL::Meshes::operator!= | ( | const Grid< Dimension, Real, Device, Index > & | lhs,
|  | const Grid< Dimension, Real, Device, Index > & | rhs )

Comparison operator for grid.

Template Parameters

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

Parameters

  lhs | is an instance of one grid.
  rhs | is an instance of another grid.

Returns
  true if the grids are different.
  false if both grids are equal.

## ◆ operator<<() [1/2]

template<int Dimension, typename Real, typename Device, typename Index>

std::ostream & TNL::Meshes::operator<< | ( | std::ostream & | str,
|  | const Grid< Dimension, Real, Device, Index > & | grid )

Serialization of the grid structure.

Template Parameters

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

Parameters

  str | is output stream.
  grid | is an instance of grid.

Returns
  std::ostream& is reference on the input stream.

## ◆ operator<<() [2/2]

template<class Grid, int EntityDimension>

std::ostream & TNL::Meshes::operator<< | ( | std::ostream & | str,
|  | const GridEntity< Grid, EntityDimension > & | entity )

Overloaded insertion operator for printing a grid entity to output stream.

Template Parameters

  Grid | type of grid the grid entity belongs to.
  EntityDimension | dimension of the grid entity.

Parameters

  str | insertion operator.
  entity | instance of the grid entity.

Returns
  std::ostream& reference to the insertion operator.

## ◆ operator==()

template<int Dimension, typename Real, typename Device, typename Index>

bool TNL::Meshes::operator== | ( | const Grid< Dimension, Real, Device, Index > & | lhs,
|  | const Grid< Dimension, Real, Device, Index > & | rhs )

Comparison operator for grid.

Template Parameters

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

Parameters

  lhs | is an instance of one grid.
  rhs | is an instance of another grid.

Returns
  true if both grids are equal.
  false if the grids are different.

## ◆ resolveAndLoadMesh()

template<typename ConfigTag, typename Device, typename Functor>

void TNL::Meshes::resolveAndLoadMesh | ( | Functor && | functor,
|  | const std::string & | fileName,
|  | const std::string & | fileFormat = "auto",
|  | const std::string & | realType = "auto",
|  | const std::string & | globalIndexType = "auto" )

This function dues the same as resolveMeshType, but also reuses the mesh reader instance to load the mesh before passing it to the functor. In pseudo-code:

using Reader = [based on file type detection]
Reader reader;
using MeshType = [black magic]
MeshType mesh;
reader.loadMesh( mesh );
functor( reader, mesh );

## ◆ resolveMeshType()

template<typename ConfigTag, typename Device, typename Functor>

void TNL::Meshes::resolveMeshType | ( | Functor && | functor,
|  | const std::string & | fileName,
|  | const std::string & | fileFormat = "auto",
|  | const std::string & | realType = "auto",
|  | const std::string & | globalIndexType = "auto" )

This function does the following (in pseudo-code):

using Reader = [based on file type detection]
Reader reader;
using MeshType = [black magic]
MeshType mesh;
functor( reader, mesh );

The functor should be a generic lambda expression with the following signature (or an equivalent functor):

auto functor = [] ( auto& reader, auto&& mesh ) -> void {};