Loading src/TNL/Meshes/Mesh.h +23 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <ostream> #include <TNL/Object.h> #include <TNL/Logger.h> #include <TNL/Meshes/MeshEntity.h> #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> #include <TNL/Meshes/MeshDetails/layers/MeshStorageLayer.h> Loading @@ -42,9 +43,8 @@ class Mesh using DeviceType = typename MeshTraitsType::DeviceType; using GlobalIndexType = typename MeshTraitsType::GlobalIndexType; using LocalIndexType = typename MeshTraitsType::LocalIndexType; using CellType = typename MeshTraitsType::CellType; using VertexType = typename MeshTraitsType::VertexType; using PointType = typename MeshTraitsType::PointType; using RealType = typename PointType::RealType; template< int Dimension > using EntityTraits = typename MeshTraitsType::template EntityTraits< Dimension >; Loading @@ -52,6 +52,13 @@ class Mesh template< int Dimension > using EntityType = typename EntityTraits< Dimension >::EntityType; static constexpr int getMeshDimension(); // types of common entities using Cell = EntityType< getMeshDimension() >; using Face = EntityType< getMeshDimension() - 1 >; using Vertex = EntityType< 0 >; static String getType(); virtual String getTypeVirtual() const; Loading @@ -60,8 +67,6 @@ class Mesh virtual String getSerializationTypeVirtual() const; static constexpr int getMeshDimension(); using StorageBaseType::isBoundaryEntity; using StorageBaseType::getBoundaryEntitiesCount; using StorageBaseType::getBoundaryEntityIndex; Loading @@ -80,6 +85,18 @@ class Mesh template< int Dimension > const EntityType< Dimension >& getEntity( const GlobalIndexType& entityIndex ) const; // duplicated for compatibility with grids template< typename EntityType > GlobalIndexType getEntitiesCount() const; template< typename EntityType > EntityType& getEntity( const GlobalIndexType& entityIndex ); template< typename EntityType > const EntityType& getEntity( const GlobalIndexType& entityIndex ) const; bool save( File& file ) const; bool load( File& file ); Loading @@ -95,6 +112,8 @@ class Mesh bool init( typename MeshTraitsType::PointArrayType& points, typename MeshTraitsType::CellSeedArrayType& cellSeeds ); void writeProlog( Logger& logger ); protected: // Methods for the mesh initializer using StorageBaseType::setNumberOfEntities; Loading src/TNL/Meshes/MeshDetails/Mesh_impl.h +49 −8 Original line number Diff line number Diff line Loading @@ -21,6 +21,14 @@ namespace TNL { namespace Meshes { template< typename MeshConfig > constexpr int Mesh< MeshConfig >:: getMeshDimension() { return MeshTraitsType::meshDimension; } template< typename MeshConfig > String Mesh< MeshConfig >:: Loading Loading @@ -53,14 +61,6 @@ getSerializationTypeVirtual() const return this->getSerializationType(); } template< typename MeshConfig > constexpr int Mesh< MeshConfig >:: getMeshDimension() { return MeshTraitsType::meshDimension; } template< typename MeshConfig > template< int Dimension > constexpr bool Loading Loading @@ -100,6 +100,36 @@ getEntity( const GlobalIndexType& entityIndex ) const return StorageBaseType::getEntity( DimensionTag< Dimension >(), entityIndex ); } // duplicated for compatibility with grids template< typename MeshConfig > template< typename Entity > typename Mesh< MeshConfig >::GlobalIndexType Mesh< MeshConfig >:: getEntitiesCount() const { return getEntitiesCount< Entity::getEntityDimension() >(); } template< typename MeshConfig > template< typename Entity > Entity& Mesh< MeshConfig >:: getEntity( const GlobalIndexType& entityIndex ) { return getEntity< Entity::getEntityDimension() >( entityIndex ); } template< typename MeshConfig > template< typename Entity > const Entity& Mesh< MeshConfig >:: getEntity( const GlobalIndexType& entityIndex ) const { return getEntity< Entity::getEntityDimension() >( entityIndex ); } template< typename MeshConfig > bool Mesh< MeshConfig >:: Loading Loading @@ -159,6 +189,17 @@ init( typename MeshTraitsType::PointArrayType& points, return true; } template< typename MeshConfig > void Mesh< MeshConfig >:: writeProlog( Logger& logger ) { logger.writeParameter( "Dimension:", getMeshDimension() ); logger.writeParameter( "Number of cells:", getEntitiesCount< getMeshDimension() >() ); logger.writeParameter( "Number of vertices:", getEntitiesCount< 0 >() ); // TODO: more parameters? } template< typename MeshConfig > std::ostream& operator<<( std::ostream& str, const Mesh< MeshConfig >& mesh ) Loading Loading
src/TNL/Meshes/Mesh.h +23 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <ostream> #include <TNL/Object.h> #include <TNL/Logger.h> #include <TNL/Meshes/MeshEntity.h> #include <TNL/Meshes/MeshDetails/traits/MeshTraits.h> #include <TNL/Meshes/MeshDetails/layers/MeshStorageLayer.h> Loading @@ -42,9 +43,8 @@ class Mesh using DeviceType = typename MeshTraitsType::DeviceType; using GlobalIndexType = typename MeshTraitsType::GlobalIndexType; using LocalIndexType = typename MeshTraitsType::LocalIndexType; using CellType = typename MeshTraitsType::CellType; using VertexType = typename MeshTraitsType::VertexType; using PointType = typename MeshTraitsType::PointType; using RealType = typename PointType::RealType; template< int Dimension > using EntityTraits = typename MeshTraitsType::template EntityTraits< Dimension >; Loading @@ -52,6 +52,13 @@ class Mesh template< int Dimension > using EntityType = typename EntityTraits< Dimension >::EntityType; static constexpr int getMeshDimension(); // types of common entities using Cell = EntityType< getMeshDimension() >; using Face = EntityType< getMeshDimension() - 1 >; using Vertex = EntityType< 0 >; static String getType(); virtual String getTypeVirtual() const; Loading @@ -60,8 +67,6 @@ class Mesh virtual String getSerializationTypeVirtual() const; static constexpr int getMeshDimension(); using StorageBaseType::isBoundaryEntity; using StorageBaseType::getBoundaryEntitiesCount; using StorageBaseType::getBoundaryEntityIndex; Loading @@ -80,6 +85,18 @@ class Mesh template< int Dimension > const EntityType< Dimension >& getEntity( const GlobalIndexType& entityIndex ) const; // duplicated for compatibility with grids template< typename EntityType > GlobalIndexType getEntitiesCount() const; template< typename EntityType > EntityType& getEntity( const GlobalIndexType& entityIndex ); template< typename EntityType > const EntityType& getEntity( const GlobalIndexType& entityIndex ) const; bool save( File& file ) const; bool load( File& file ); Loading @@ -95,6 +112,8 @@ class Mesh bool init( typename MeshTraitsType::PointArrayType& points, typename MeshTraitsType::CellSeedArrayType& cellSeeds ); void writeProlog( Logger& logger ); protected: // Methods for the mesh initializer using StorageBaseType::setNumberOfEntities; Loading
src/TNL/Meshes/MeshDetails/Mesh_impl.h +49 −8 Original line number Diff line number Diff line Loading @@ -21,6 +21,14 @@ namespace TNL { namespace Meshes { template< typename MeshConfig > constexpr int Mesh< MeshConfig >:: getMeshDimension() { return MeshTraitsType::meshDimension; } template< typename MeshConfig > String Mesh< MeshConfig >:: Loading Loading @@ -53,14 +61,6 @@ getSerializationTypeVirtual() const return this->getSerializationType(); } template< typename MeshConfig > constexpr int Mesh< MeshConfig >:: getMeshDimension() { return MeshTraitsType::meshDimension; } template< typename MeshConfig > template< int Dimension > constexpr bool Loading Loading @@ -100,6 +100,36 @@ getEntity( const GlobalIndexType& entityIndex ) const return StorageBaseType::getEntity( DimensionTag< Dimension >(), entityIndex ); } // duplicated for compatibility with grids template< typename MeshConfig > template< typename Entity > typename Mesh< MeshConfig >::GlobalIndexType Mesh< MeshConfig >:: getEntitiesCount() const { return getEntitiesCount< Entity::getEntityDimension() >(); } template< typename MeshConfig > template< typename Entity > Entity& Mesh< MeshConfig >:: getEntity( const GlobalIndexType& entityIndex ) { return getEntity< Entity::getEntityDimension() >( entityIndex ); } template< typename MeshConfig > template< typename Entity > const Entity& Mesh< MeshConfig >:: getEntity( const GlobalIndexType& entityIndex ) const { return getEntity< Entity::getEntityDimension() >( entityIndex ); } template< typename MeshConfig > bool Mesh< MeshConfig >:: Loading Loading @@ -159,6 +189,17 @@ init( typename MeshTraitsType::PointArrayType& points, return true; } template< typename MeshConfig > void Mesh< MeshConfig >:: writeProlog( Logger& logger ) { logger.writeParameter( "Dimension:", getMeshDimension() ); logger.writeParameter( "Number of cells:", getEntitiesCount< getMeshDimension() >() ); logger.writeParameter( "Number of vertices:", getEntitiesCount< 0 >() ); // TODO: more parameters? } template< typename MeshConfig > std::ostream& operator<<( std::ostream& str, const Mesh< MeshConfig >& mesh ) Loading