Template Numerical Library version main:1655e92
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
 
class  GridEntity
 
class  GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >
 
class  GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >
 
class  GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >
 
class  GridEntityCenterGetter
 
class  GridEntityCrossStencilStorage
 
class  GridEntityNoStencilStorage
 
class  GridEntityStencilStorageTag
 
class  GridTypeResolver
 
struct  IndexPermutationApplier
 
class  Initializer
 
class  isDistributedGrid
 
class  isDistributedGrid< DistributedMeshes::DistributedMesh< Grid< Dimension, Real, Device, Index > > >
 
class  isGrid
 
class  isGrid< Grid< Dimension, Real, Device, Index > >
 
class  Mesh
 
class  MeshBuilder
 
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  NeighborGridEntityGetter
 
struct  TetrahedronConfig
 
class  Traverser
 
struct  TriangleConfig
 

Enumerations

enum class  EntityDecomposerVersion { ConnectEdgesToCentroid , ConnectEdgesToPoint }
 
enum class  EntityRefinerVersion { EdgeBisection }
 
enum  GridEntityStencilStorage { GridEntityNoStencil = 0 , GridEntityCrossStencil , GridEntityFullStencil }
 

Functions

template<EntityDecomposerVersion DecomposerVersion, EntityDecomposerVersion SubdecomposerVersion = EntityDecomposerVersion::ConnectEdgesToPoint, typename MeshConfig , std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polygon >::value, 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< typename MeshConfig::CellTopology, Topologies::Polygon >::value, bool > = true>
auto getDecomposedMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
 
template<typename Grid , int EntityDimension, typename Config >
__cuda_callable__ Grid::PointType getEntityCenter (const Grid &grid, const GridEntity< Grid, EntityDimension, Config > &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 , typename Config >
__cuda_callable__ Grid::RealType getEntityMeasure (const Grid &grid, const GridEntity< Grid, 0, Config > &entity)
 
template<typename Grid , int EntityDimension, typename Config >
__cuda_callable__ Grid::RealType getEntityMeasure (const Grid &grid, const GridEntity< Grid, EntityDimension, Config > &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==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 , typename Config >
__cuda_callable__ Grid::PointType getOutwardNormalVector (const Grid &grid, const GridEntity< Grid, 0, Config > &face, const typename Grid::PointType cellCenter)
 
template<typename Grid , typename Config >
__cuda_callable__ Grid::PointType getOutwardNormalVector (const Grid &grid, const GridEntity< Grid, 1, Config > &face, const typename Grid::PointType cellCenter)
 
template<typename Grid , typename Config >
__cuda_callable__ Grid::PointType getOutwardNormalVector (const Grid &grid, const GridEntity< Grid, 2, Config > &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< typename MeshConfig::CellTopology, Topologies::Polygon >::value||std::is_same< typename MeshConfig::CellTopology, Topologies::Polyhedron >::value), 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< typename MeshConfig::CellTopology, Topologies::Triangle >::value||std::is_same< typename MeshConfig::CellTopology, Topologies::Quadrangle >::value||std::is_same< typename MeshConfig::CellTopology, Topologies::Tetrahedron >::value||std::is_same< typename MeshConfig::CellTopology, Topologies::Hexahedron >::value, 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()==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 >
bool loadDistributedMesh (DistributedMeshes::DistributedMesh< Mesh > &distributedMesh, const std::string &fileName, const std::string &fileFormat="auto", const MPI::Comm &communicator=MPI_COMM_WORLD)
 
template<typename Mesh >
bool loadMesh (Mesh &mesh, const std::string &fileName, const std::string &fileFormat="auto")
 
template<typename MeshConfig >
bool 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)
 
template<int Dimension, typename Real , typename Device , typename Index >
std::ostreamoperator<< (std::ostream &str, const Grid< Dimension, Real, Device, Index > &grid)
 
template<typename MeshConfig , typename Device >
std::ostreamoperator<< (std::ostream &str, const Mesh< MeshConfig, Device > &mesh)
 
template<typename MeshConfig , typename Device , typename EntityTopology >
std::ostreamoperator<< (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)
 
template<EntityDecomposerVersion DecomposerVersion, typename MeshConfig , std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polygon >::value, bool > = true, std::enable_if_t< MeshConfig::spaceDimension==3, bool > = true>
auto planarCorrection (const Mesh< MeshConfig, Devices::Host > &inMesh)
 
template<EntityDecomposerVersion DecomposerVersion, typename MeshConfig , std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polyhedron >::value, bool > = true>
auto planarCorrection (const Mesh< MeshConfig, Devices::Host > &inMesh)
 
template<EntityRefinerVersion RefinerVersion, typename MeshConfig , std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Triangle >::value||std::is_same< typename MeshConfig::CellTopology, Topologies::Quadrangle >::value||std::is_same< typename MeshConfig::CellTopology, Topologies::Tetrahedron >::value||std::is_same< typename MeshConfig::CellTopology, Topologies::Hexahedron >::value, bool > = true>
auto refineMesh (const Mesh< MeshConfig, Devices::Host > &inMesh)
 
template<typename ConfigTag , typename Device , typename Functor >
bool 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 >
bool 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 >
bool resolveDistributedMeshType (Functor &&functor, const std::string &fileName, const std::string &fileFormat="auto")
 
template<typename ConfigTag , typename Device , typename Functor >
bool 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 >
bool 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.

◆ resolveAndLoadMesh()

template<typename ConfigTag , typename Device , typename Functor >
bool 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;
if( ! reader.readMesh( mesh ) )
return false;
return functor( reader, mesh );

◆ resolveMeshType()

template<typename ConfigTag , typename Device , typename Functor >
bool 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;
return 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 ) -> bool {};