diff --git a/Documentation/Tutorials/Meshes/GameOfLife.cpp b/Documentation/Tutorials/Meshes/GameOfLife.cpp index 9d3fc251b73e0b0ab0039908dfcb6bb5290ef94e..16cecc1ad33352c2937f7f74759db690e5b113e8 100644 --- a/Documentation/Tutorials/Meshes/GameOfLife.cpp +++ b/Documentation/Tutorials/Meshes/GameOfLife.cpp @@ -24,10 +24,10 @@ template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Quadrangle > { e //template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Tetrahedron > { enum { enabled = true }; }; //template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Hexahedron > { enum { enabled = true }; }; -// Meshes are enabled only for the world dimension equal to the cell dimension. -template< typename CellTopology, int WorldDimension > -struct MeshWorldDimensionTag< MyConfigTag, CellTopology, WorldDimension > -{ enum { enabled = ( WorldDimension == CellTopology::dimension ) }; }; +// Meshes are enabled only for the space dimension equal to the cell dimension. +template< typename CellTopology, int SpaceDimension > +struct MeshSpaceDimensionTag< MyConfigTag, CellTopology, SpaceDimension > +{ enum { enabled = ( SpaceDimension == CellTopology::dimension ) }; }; // Meshes are enabled only for types explicitly listed below. template<> struct MeshRealTag< MyConfigTag, float > { enum { enabled = false }; }; @@ -41,31 +41,28 @@ template<> struct MeshConfigTemplateTag< MyConfigTag > { template< typename Cell, - int WorldDimension = Cell::dimension, + int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = short int > struct MeshConfig - : public DefaultConfig< Cell, WorldDimension, Real, GlobalIndex, LocalIndex > + : public DefaultConfig< Cell, SpaceDimension, Real, GlobalIndex, LocalIndex > { - template< typename EntityTopology > - static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) + static constexpr bool subentityStorage( int entityDimension, int SubentityDimension ) { - return SubentityDimension == 0 && EntityTopology::dimension >= Cell::dimension - 1; + return SubentityDimension == 0 && entityDimension >= Cell::dimension - 1; } - template< typename EntityTopology > - static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) + static constexpr bool superentityStorage( int entityDimension, int SuperentityDimension ) { // return false; - return (EntityTopology::dimension == 0 || EntityTopology::dimension == Cell::dimension - 1) && SuperentityDimension == Cell::dimension; + return (entityDimension == 0 || entityDimension == Cell::dimension - 1) && SuperentityDimension == Cell::dimension; } - template< typename EntityTopology > - static constexpr bool entityTagsStorage( EntityTopology ) + static constexpr bool entityTagsStorage( int entityDimension ) { // return false; - return EntityTopology::dimension == 0 || EntityTopology::dimension >= Cell::dimension - 1; + return entityDimension == 0 || entityDimension >= Cell::dimension - 1; } static constexpr bool dualGraphStorage() diff --git a/Documentation/Tutorials/Meshes/MeshConfigurationExample.cpp b/Documentation/Tutorials/Meshes/MeshConfigurationExample.cpp index 174748ad310efdcb55878383a168de6d2d548205..312e7dd4bfbe2028ecd0e857d386e91ddf8e4e31 100644 --- a/Documentation/Tutorials/Meshes/MeshConfigurationExample.cpp +++ b/Documentation/Tutorials/Meshes/MeshConfigurationExample.cpp @@ -13,17 +13,16 @@ template<> struct MeshConfigTemplateTag< MyConfigTag > { template< typename Cell, - int WorldDimension = Cell::dimension, + int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = short int > struct MeshConfig - : public DefaultConfig< Cell, WorldDimension, Real, GlobalIndex, LocalIndex > + : public DefaultConfig< Cell, SpaceDimension, Real, GlobalIndex, LocalIndex > { - template< typename EntityTopology > - static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { - return SubentityDimension == 0 && EntityTopology::dimension >= Cell::dimension - 1; + return subentityDimension == 0 && entityDimension >= Cell::dimension - 1; } }; }; diff --git a/src/TNL/Meshes/DefaultConfig.h b/src/TNL/Meshes/DefaultConfig.h index a07ef511b0fac9a0635a22ed81a4fb4be14a58c1..abe1726a262d1da46b2986532f003d11db87b183 100644 --- a/src/TNL/Meshes/DefaultConfig.h +++ b/src/TNL/Meshes/DefaultConfig.h @@ -25,7 +25,7 @@ namespace Meshes { * Basic structure for mesh configuration. */ template< typename Cell, - int WorldDimension = Cell::dimension, + int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = short int > @@ -36,14 +36,13 @@ struct DefaultConfig using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; - static constexpr int worldDimension = WorldDimension; + static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; /**** * Storage of subentities of mesh entities. */ - template< typename EntityTopology > - static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; // Subvertices must be stored for all entities which appear in other @@ -54,8 +53,7 @@ struct DefaultConfig /**** * Storage of superentities of mesh entities. */ - template< typename EntityTopology > - static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } @@ -69,12 +67,10 @@ struct DefaultConfig * - if dim(entity) < dim(face), the entities on which the tags are stored * must be stored as subentities of faces */ - template< typename EntityTopology > - static constexpr bool entityTagsStorage( EntityTopology ) + static constexpr bool entityTagsStorage( int entityDimension ) { - using FaceTopology = typename Topologies::Subtopology< CellTopology, meshDimension - 1 >::Topology; - return superentityStorage( FaceTopology(), meshDimension ) && - ( EntityTopology::dimension >= meshDimension - 1 || subentityStorage( FaceTopology(), EntityTopology::dimension ) ); + return superentityStorage( meshDimension - 1, meshDimension ) && + ( entityDimension >= meshDimension - 1 || subentityStorage( meshDimension - 1, entityDimension ) ); //return false; } diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h b/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h index 210b6fa00f3e3dba163c76d28aca93dd1aa779ad..a0c5d29c50bd5f7dcd804afa08771df675f28926 100644 --- a/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h +++ b/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h @@ -90,9 +90,9 @@ public: using Face = typename MeshType::template EntityType< getMeshDimension() - 1 >; using Vertex = typename MeshType::template EntityType< 0 >; - static_assert( Mesh::Config::entityTagsStorage( typename Cell::EntityTopology{} ), + static_assert( Mesh::Config::entityTagsStorage( getMeshDimension() ), "DistributedMesh must store entity tags on cells" ); - static_assert( Mesh::Config::entityTagsStorage( typename Vertex::EntityTopology{} ), + static_assert( Mesh::Config::entityTagsStorage( 0 ), "DistributedMesh must store entity tags on vertices" ); diff --git a/src/TNL/Meshes/Geometry/getOutwardNormalVector.h b/src/TNL/Meshes/Geometry/getOutwardNormalVector.h index d3fa6ea50fef14482bc913aaf0fe2fec62f6c110..6221236f5942f4d274f4918f2246ce8b99462a62 100644 --- a/src/TNL/Meshes/Geometry/getOutwardNormalVector.h +++ b/src/TNL/Meshes/Geometry/getOutwardNormalVector.h @@ -99,7 +99,7 @@ getOutwardNormalVector( const Mesh< MeshConfig, Device > & mesh, using FaceType = MeshEntity< MeshConfig, Device, Topologies::Edge >; using PointType = typename MeshTraits< MeshConfig >::PointType; static_assert( std::is_same< typename MeshType::Face, FaceType >::value, "getOutwardNormalVector called for an entity which is not a face" ); - static_assert( MeshConfig::worldDimension == 2, "TODO: normal vectors for 2D meshes in a 3D space are not implemented yet" ); + static_assert( MeshConfig::spaceDimension == 2, "TODO: normal vectors for 2D meshes in a 3D space are not implemented yet" ); const auto& v0 = mesh.getPoint( face.template getSubentityIndex< 0 >( 0 ) ); const auto& v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( 1 ) ); @@ -125,7 +125,7 @@ getOutwardNormalVector( const Mesh< MeshConfig, Device > & mesh, using FaceType = MeshEntity< MeshConfig, Device, EntityTopology >; using PointType = typename MeshTraits< MeshConfig >::PointType; static_assert( std::is_same< typename MeshType::Face, FaceType >::value, "getOutwardNormalVector called for an entity which is not a face" ); - static_assert( MeshConfig::worldDimension == 3, "general overload intended for 3D was called with the wrong world dimension" ); + static_assert( MeshConfig::spaceDimension == 3, "general overload intended for 3D was called with the wrong space dimension" ); const auto& v0 = mesh.getPoint( face.template getSubentityIndex< 0 >( 0 ) ); const auto& v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( 1 ) ); diff --git a/src/TNL/Meshes/MeshDetails/ConfigValidator.h b/src/TNL/Meshes/MeshDetails/ConfigValidator.h index 0680026f02a4864d6e1f6b890122dbf90d8206da..665574c0d8291e89c47110701db286f1c732c3b1 100644 --- a/src/TNL/Meshes/MeshDetails/ConfigValidator.h +++ b/src/TNL/Meshes/MeshDetails/ConfigValidator.h @@ -28,11 +28,11 @@ template< typename MeshConfig, class ConfigValidatorSubtopologyLayer : public ConfigValidatorSubtopologyLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement > { - static_assert( ! MeshConfig::subentityStorage( EntityTopology(), DimensionTag::value ) || - MeshConfig::subentityStorage( EntityTopology(), 0 ), + static_assert( ! MeshConfig::subentityStorage( EntityTopology::dimension, DimensionTag::value ) || + MeshConfig::subentityStorage( EntityTopology::dimension, 0 ), "entities of which subentities are stored must store their subvertices" ); - static_assert( ! MeshConfig::subentityStorage( EntityTopology(), DimensionTag::value ) || - MeshConfig::subentityStorage( EntityTopology(), 0 ), + static_assert( ! MeshConfig::subentityStorage( EntityTopology::dimension, DimensionTag::value ) || + MeshConfig::subentityStorage( EntityTopology::dimension, 0 ), "entities that are stored as subentities must store their subvertices" ); }; @@ -48,11 +48,11 @@ template< typename MeshConfig, class ConfigValidatorSupertopologyLayer : public ConfigValidatorSupertopologyLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement > { - static_assert( ! MeshConfig::superentityStorage( EntityTopology(), DimensionTag::value ) || - MeshConfig::subentityStorage( EntityTopology(), 0 ), + static_assert( ! MeshConfig::superentityStorage( EntityTopology::dimension, DimensionTag::value ) || + MeshConfig::subentityStorage( EntityTopology::dimension, 0 ), "entities of which superentities are stored must store their subvertices"); - static_assert( ! MeshConfig::superentityStorage( EntityTopology(), DimensionTag::value ) || - MeshConfig::subentityStorage( EntityTopology(), 0 ), + static_assert( ! MeshConfig::superentityStorage( EntityTopology::dimension, DimensionTag::value ) || + MeshConfig::subentityStorage( EntityTopology::dimension, 0 ), "entities that are stored as superentities must store their subvertices"); }; @@ -87,7 +87,7 @@ class ConfigValidatorLayerCell { using CellTopology = typename MeshConfig::CellTopology; - static_assert( MeshConfig::subentityStorage( CellTopology(), 0 ), + static_assert( MeshConfig::subentityStorage( CellTopology::dimension, 0 ), "subvertices of cells must be stored" ); }; @@ -98,7 +98,7 @@ class ConfigValidator static constexpr int meshDimension = MeshConfig::CellTopology::dimension; static_assert( 1 <= meshDimension, "zero dimensional meshes are not supported" ); - static_assert( meshDimension <= MeshConfig::worldDimension, "world dimension must not be less than mesh dimension" ); + static_assert( meshDimension <= MeshConfig::spaceDimension, "space dimension must not be less than mesh dimension" ); }; } // namespace Meshes diff --git a/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h b/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h index 498dc27fe532df8c6cfe62b50e5810205c6c25b9..d7bab6523b863ecb864da50063d0c82e48656063 100644 --- a/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h +++ b/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h @@ -29,21 +29,16 @@ template< typename MeshConfig, typename SubdimensionTag, typename SuperdimensionTag, // storage in the superentity - bool SubentityStorage = - MeshConfig::subentityStorage( typename MeshTraits< MeshConfig >::template EntityTraits< SuperdimensionTag::value >::EntityTopology(), - SubdimensionTag::value ), + bool SubentityStorage = MeshConfig::subentityStorage( SuperdimensionTag::value, SubdimensionTag::value ), // storage in the subentity - bool SuperentityStorage = - MeshConfig::superentityStorage( typename MeshTraits< MeshConfig >::template EntityTraits< SubdimensionTag::value >::EntityTopology(), - SuperdimensionTag::value ), + bool SuperentityStorage = MeshConfig::superentityStorage( SubdimensionTag::value, SuperdimensionTag::value ), // necessary to disambiguate the stop condition for specializations bool valid_dimension = ! std::is_same< SubdimensionTag, SuperdimensionTag >::value > class EntityInitializerLayer; template< typename MeshConfig, typename EntityTopology, - bool SubvertexStorage = - MeshConfig::subentityStorage( typename MeshTraits< MeshConfig >::template EntityTraits< EntityTopology::dimension >::EntityTopology(), 0 ) > + bool SubvertexStorage = MeshConfig::subentityStorage( EntityTopology::dimension, 0 ) > class EntityInitializer : public EntityInitializerLayer< MeshConfig, DimensionTag< EntityTopology::dimension >, diff --git a/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h b/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h index f171f4469107b76b6904767ba5d02a8bae6a218a..3ca05fc00c6bab76f8ba982268107a611fa889c5 100644 --- a/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h +++ b/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h @@ -87,7 +87,7 @@ public: { static_assert( std::is_same< MeshConfig, typename Mesh::Config >::value, "mismatched MeshConfig type" ); - static_assert( MeshConfig::superentityStorage( typename Mesh::Vertex::EntityTopology{}, Mesh::getMeshDimension() ), + static_assert( MeshConfig::superentityStorage( 0, Mesh::getMeshDimension() ), "The dual graph cannot be initialized when links from vertices to cells are not stored in the mesh." ); static_assert( MeshConfig::dualGraphMinCommonVertices >= 1, "MeshConfig error: dualGraphMinCommonVertices must be at least 1." ); diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h index 3aa4963c344158ee2e1dc844c30b8b84a859685c..216c755e4ab555e6132262bca6f69dc46d4c6e7c 100644 --- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h +++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h @@ -18,21 +18,19 @@ namespace Meshes { namespace EntityTags { template< typename MeshConfig, - typename EntityTopology, - bool entityTagsStorage = MeshConfig::entityTagsStorage( EntityTopology() ) > + int EntityDimension, + bool entityTagsStorage = MeshConfig::entityTagsStorage( EntityDimension ) > class ConfigValidatorEntityTagsLayer { - using FaceTopology = typename Topologies::Subtopology< typename MeshConfig::CellTopology, MeshConfig::meshDimension - 1 >::Topology; - - static_assert( MeshConfig::superentityStorage( FaceTopology(), MeshConfig::meshDimension ), + static_assert( MeshConfig::superentityStorage( MeshConfig::meshDimension - 1, MeshConfig::meshDimension ), "Faces must store the cell superentity indices when any entity has boundary tags." ); - static_assert( EntityTopology::dimension >= MeshConfig::meshDimension - 1 || MeshConfig::subentityStorage( FaceTopology(), EntityTopology::dimension ), + static_assert( EntityDimension >= MeshConfig::meshDimension - 1 || MeshConfig::subentityStorage( MeshConfig::meshDimension - 1, EntityDimension ), "Faces must store the subentity indices of the entities on which the boundary tags are stored." ); }; template< typename MeshConfig, - typename EntityTopology > -class ConfigValidatorEntityTagsLayer< MeshConfig, EntityTopology, false > + int EntityDimension > +class ConfigValidatorEntityTagsLayer< MeshConfig, EntityDimension, false > { }; @@ -40,8 +38,7 @@ class ConfigValidatorEntityTagsLayer< MeshConfig, EntityTopology, false > template< typename MeshConfig, int dimension = MeshConfig::meshDimension > class ConfigValidatorLayer : public ConfigValidatorLayer< MeshConfig, dimension - 1 >, - public ConfigValidatorEntityTagsLayer< MeshConfig, - typename MeshTraits< MeshConfig >::template EntityTraits< dimension >::EntityTopology > + public ConfigValidatorEntityTagsLayer< MeshConfig, dimension > { }; diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h index 55d55890ff8d08c64d2626427e884666826ee096..8b44ae593434c8409ebb9bd1c7aad903235b72a4 100644 --- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h +++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h @@ -35,16 +35,14 @@ protected: template< typename CurrentDimension = DimensionTag< MeshConfig::meshDimension >, typename _T = void > struct EntityTagsNeedInitialization { - using EntityTopology = typename MeshEntityTraits< MeshConfig, DeviceType, CurrentDimension::value >::EntityTopology; - static constexpr bool value = MeshConfig::entityTagsStorage( EntityTopology() ) || + static constexpr bool value = MeshConfig::entityTagsStorage( CurrentDimension::value ) || EntityTagsNeedInitialization< typename CurrentDimension::Decrement >::value; }; template< typename _T > struct EntityTagsNeedInitialization< DimensionTag< 0 >, _T > { - using EntityTopology = typename MeshEntityTraits< MeshConfig, DeviceType, 0 >::EntityTopology; - static constexpr bool value = MeshConfig::entityTagsStorage( EntityTopology() ); + static constexpr bool value = MeshConfig::entityTagsStorage( 0 ); }; template< int Dimension > @@ -80,8 +78,7 @@ protected: template< int Subdimension > class InitializeSubentities { - using SubentityTopology = typename MeshEntityTraits< MeshConfig, DeviceType, Subdimension >::EntityTopology; - static constexpr bool enabled = MeshConfig::entityTagsStorage( SubentityTopology() ); + static constexpr bool enabled = MeshConfig::entityTagsStorage( Subdimension ); // _T is necessary to force *partial* specialization, since explicit specializations // at class scope are forbidden diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h index b7c28f15557d00722095fe7d71e32105bcde7ce1..eee755f7c5bf6bc869cf41cfaa776a9870e88670 100644 --- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h +++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h @@ -22,8 +22,7 @@ template< typename MeshConfig, bool sensible = (DimensionTag::value <= MeshConfig::meshDimension) > struct WeakStorageTrait { - using EntityTopology = typename MeshTraits< MeshConfig >::template EntityTraits< DimensionTag::value >::EntityTopology; - static constexpr bool entityTagsEnabled = MeshConfig::entityTagsStorage( EntityTopology() ); + static constexpr bool entityTagsEnabled = MeshConfig::entityTagsStorage( DimensionTag::value ); }; template< typename MeshConfig, diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h index b5d3df4d54188c28213e67ae5d146335eb35765f..830db3f2bb4d8d39ea7a6ee7ad7cdd5bf9eca626 100644 --- a/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h +++ b/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h @@ -36,7 +36,7 @@ public: static_assert( 0 <= Dimension && Dimension <= MeshConfig::meshDimension, "invalid dimension" ); static_assert( EntityTopology::dimension > Dimension, "Subentity dimension must be smaller than the entity dimension." ); - static constexpr bool storageEnabled = MeshConfig::subentityStorage( EntityTopology(), Dimension ); + static constexpr bool storageEnabled = MeshConfig::subentityStorage( EntityTopology::dimension, Dimension ); static constexpr int count = Topologies::Subtopology< EntityTopology, Dimension >::count; using SubentityTopology = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityTopology; diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h index 4b5e388195724582250d175d212dfdc0370030b2..7c2714843e4fbdaff17fc82b094807af6cec1690 100644 --- a/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h +++ b/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h @@ -34,7 +34,7 @@ public: static_assert( 0 <= Dimension && Dimension <= MeshConfig::meshDimension, "invalid dimension" ); static_assert( EntityTopology::dimension < Dimension, "Superentity dimension must be higher than the entity dimension." ); - static constexpr bool storageEnabled = MeshConfig::template superentityStorage< EntityTopology >( EntityTopology(), Dimension ); + static constexpr bool storageEnabled = MeshConfig::superentityStorage( EntityTopology::dimension, Dimension ); using SuperentityTopology = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityTopology; using SuperentityType = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityType; diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h index 1bad55de4c11347632ece834e3b82b71b1b3832a..3f8c5f4441e958ed2f9c623a98a490cf1368f3e9 100644 --- a/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h +++ b/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h @@ -45,7 +45,7 @@ class MeshTraits { public: static constexpr int meshDimension = MeshConfig::CellTopology::dimension; - static constexpr int worldDimension = MeshConfig::worldDimension; + static constexpr int spaceDimension = MeshConfig::spaceDimension; using DeviceType = Device; using GlobalIndexType = typename MeshConfig::GlobalIndexType; @@ -54,7 +54,7 @@ public: using CellTopology = typename MeshConfig::CellTopology; using CellType = MeshEntity< MeshConfig, Device, CellTopology >; using VertexType = MeshEntity< MeshConfig, Device, Topologies::Vertex >; - using PointType = Containers::StaticVector< worldDimension, typename MeshConfig::RealType >; + using PointType = Containers::StaticVector< spaceDimension, typename MeshConfig::RealType >; using CellSeedType = EntitySeed< MeshConfig, CellTopology >; using EntityTagType = std::uint8_t; diff --git a/src/TNL/Meshes/Readers/MeshReader.h b/src/TNL/Meshes/Readers/MeshReader.h index 778d0faa202d1ac46da505582b73b369de8ecb27..6d7398c28791a027f35b92eb908d08dd86ac8848 100644 --- a/src/TNL/Meshes/Readers/MeshReader.h +++ b/src/TNL/Meshes/Readers/MeshReader.h @@ -239,9 +239,9 @@ public: } int - getWorldDimension() const + getSpaceDimension() const { - return worldDimension; + return spaceDimension; } VTK::EntityShape @@ -279,7 +279,7 @@ protected: // attributes of the mesh std::size_t NumberOfPoints, NumberOfCells; - int meshDimension, worldDimension; + int meshDimension, spaceDimension; VTK::EntityShape cellShape = VTK::EntityShape::Vertex; // intermediate representation of a grid (this is relevant only for TNL::Meshes::Grid) @@ -296,7 +296,7 @@ protected: { meshType = ""; NumberOfPoints = NumberOfCells = 0; - meshDimension = worldDimension = 0; + meshDimension = spaceDimension = 0; cellShape = VTK::EntityShape::Vertex; gridExtent = {}; diff --git a/src/TNL/Meshes/Readers/NetgenReader.h b/src/TNL/Meshes/Readers/NetgenReader.h index 3cd69a1aba36e8991566f8d473bf4f295e5b9c94..432776ec48b011efd1aa94f5a5977faeaa228f74 100644 --- a/src/TNL/Meshes/Readers/NetgenReader.h +++ b/src/TNL/Meshes/Readers/NetgenReader.h @@ -70,7 +70,7 @@ public: std::vector< std::uint8_t > typesArray; // read points - worldDimension = 0; + spaceDimension = 0; for( std::size_t pointIndex = 0; pointIndex < NumberOfPoints; pointIndex++ ) { if( ! inputFile ) { reset(); @@ -78,7 +78,7 @@ public: } getline( inputFile, line ); - // read the coordinates and compute the world dimension + // read the coordinates and compute the space dimension iss.clear(); iss.str( line ); for( int i = 0; i < 3; i++ ) { @@ -89,13 +89,13 @@ public: aux = 0; } if( aux != 0.0 ) - worldDimension = std::max( worldDimension, i + 1 ); + spaceDimension = std::max( spaceDimension, i + 1 ); pointsArray.push_back( aux ); } } // netgen supports only triangular and tetrahedral meshes - meshDimension = worldDimension; + meshDimension = spaceDimension; if( meshDimension == 1 ) cellShape = VTK::EntityShape::Line; else if( meshDimension == 2 ) diff --git a/src/TNL/Meshes/Readers/PVTIReader.h b/src/TNL/Meshes/Readers/PVTIReader.h index 2d53908e43fd1126efe386eca77853b680cc15e5..3e9bf7200f1497654445db9ed229526c528ee8a9 100644 --- a/src/TNL/Meshes/Readers/PVTIReader.h +++ b/src/TNL/Meshes/Readers/PVTIReader.h @@ -104,7 +104,7 @@ class PVTIReader dim++; else break; - worldDimension = meshDimension = dim; + spaceDimension = meshDimension = dim; // populate cellShape (just for completeness, not necessary for GridTypeResolver) if( meshDimension == 1 ) @@ -153,8 +153,8 @@ class PVTIReader localReader.detectMesh(); // check that local attributes are the same as global attributes - if( getWorldDimension() != localReader.getWorldDimension() ) - throw MeshReaderError( "PVTIReader", "the world dimension of a subdomain does not match the global grid." ); + if( getSpaceDimension() != localReader.getSpaceDimension() ) + throw MeshReaderError( "PVTIReader", "the space dimension of a subdomain does not match the global grid." ); if( getMeshDimension() != localReader.getMeshDimension() ) throw MeshReaderError( "PVTIReader", "the mesh dimension of a subdomain does not match the global grid." ); if( getCellShape() != localReader.getCellShape() ) diff --git a/src/TNL/Meshes/Readers/PVTUReader.h b/src/TNL/Meshes/Readers/PVTUReader.h index 827f2c579501a90c700a9a5297768ab4edd712e2..87379c732cf548ff4f83ce3789c65094e13e5023 100644 --- a/src/TNL/Meshes/Readers/PVTUReader.h +++ b/src/TNL/Meshes/Readers/PVTUReader.h @@ -79,7 +79,7 @@ class PVTUReader localReader.detectMesh(); // copy attributes from the local reader - worldDimension = localReader.getWorldDimension(); + spaceDimension = localReader.getSpaceDimension(); meshDimension = localReader.getMeshDimension(); cellShape = localReader.getCellShape(); pointsType = localReader.getRealType(); diff --git a/src/TNL/Meshes/Readers/VTIReader.h b/src/TNL/Meshes/Readers/VTIReader.h index c1ea0cd51f827208e6cea651022e4010b4f91a1a..df6725bd7364144ade54e9149db2acee57a1a399 100644 --- a/src/TNL/Meshes/Readers/VTIReader.h +++ b/src/TNL/Meshes/Readers/VTIReader.h @@ -102,7 +102,7 @@ class VTIReader dim++; else break; - worldDimension = meshDimension = dim; + spaceDimension = meshDimension = dim; // populate cellShape (just for completeness, not necessary for GridTypeResolver) if( meshDimension == 1 ) diff --git a/src/TNL/Meshes/Readers/VTKReader.h b/src/TNL/Meshes/Readers/VTKReader.h index 530ef7b46d0e36f62a6a5c4c5362123a0eb0ac7e..a4a1c943ea92cdcd7ddf484ccef0c1bf1fd16fc4 100644 --- a/src/TNL/Meshes/Readers/VTKReader.h +++ b/src/TNL/Meshes/Readers/VTKReader.h @@ -78,12 +78,12 @@ public: std::vector< std::uint8_t > typesArray; // read points - worldDimension = 0; + spaceDimension = 0; for( std::size_t pointIndex = 0; pointIndex < NumberOfPoints; pointIndex++ ) { if( ! inputFile ) throw MeshReaderError( "VTKReader", "unable to read enough vertices, the file may be invalid or corrupted" ); - // read the coordinates and compute the world dimension + // read the coordinates and compute the space dimension for( int i = 0; i < 3; i++ ) { double aux = 0; if( pointsType == "float" ) @@ -93,7 +93,7 @@ public: if( ! inputFile ) throw MeshReaderError( "VTKReader", "unable to read " + std::to_string(i) + "th component of the vertex number " + std::to_string(pointIndex) ); if( aux != 0.0 ) - worldDimension = std::max( worldDimension, i + 1 ); + spaceDimension = std::max( spaceDimension, i + 1 ); pointsArray.push_back( aux ); } } diff --git a/src/TNL/Meshes/Readers/VTUReader.h b/src/TNL/Meshes/Readers/VTUReader.h index 3a7ce1aaef82ed11e271823466b01640c4ab5d8f..bae1c3381caa6ce3a3f09b592b7001d707b5d3a4 100644 --- a/src/TNL/Meshes/Readers/VTUReader.h +++ b/src/TNL/Meshes/Readers/VTUReader.h @@ -71,13 +71,13 @@ class VTUReader if( array.size() != 3 * NumberOfPoints ) throw MeshReaderError( "VTUReader", "invalid size of the Points data array (" + std::to_string(array.size()) + " vs " + std::to_string(NumberOfPoints) + ")" ); - // set worldDimension - worldDimension = 1; + // set spaceDimension + spaceDimension = 1; std::size_t i = 0; for( auto c : array ) { if( c != 0 ) { int dim = i % 3 + 1; - worldDimension = std::max( worldDimension, dim ); + spaceDimension = std::max( spaceDimension, dim ); } ++i; } diff --git a/src/TNL/Meshes/TypeResolver/BuildConfigTags.h b/src/TNL/Meshes/TypeResolver/BuildConfigTags.h index b2c138e9ef824ac8b7f7addeb0fd4103298b0b6f..dd83a017af9e440fbb6a5fb463f9264945da4449 100644 --- a/src/TNL/Meshes/TypeResolver/BuildConfigTags.h +++ b/src/TNL/Meshes/TypeResolver/BuildConfigTags.h @@ -87,8 +87,8 @@ template< typename ConfigTag, typename CellTopology > struct MeshCellTopologyTag // TODO: Simplex has not been tested yet //template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Simplex > { enum { enabled = true }; }; -// All sensible world dimensions are enabled by default. -template< typename ConfigTag, typename CellTopology, int WorldDimension > struct MeshWorldDimensionTag { enum { enabled = ( WorldDimension >= CellTopology::dimension && WorldDimension <= 3 ) }; }; +// All sensible space dimensions are enabled by default. +template< typename ConfigTag, typename CellTopology, int SpaceDimension > struct MeshSpaceDimensionTag { enum { enabled = ( SpaceDimension >= CellTopology::dimension && SpaceDimension <= 3 ) }; }; // Meshes are enabled only for the `float` and `double` real types by default. template< typename ConfigTag, typename Real > struct MeshRealTag { enum { enabled = false }; }; @@ -108,11 +108,11 @@ template< typename ConfigTag > struct MeshLocalIndexTag< ConfigTag, short int > template< typename ConfigTag > struct MeshConfigTemplateTag { - template< typename Cell, int WorldDimension, typename Real, typename GlobalIndex, typename LocalIndex > - using MeshConfig = DefaultConfig< Cell, WorldDimension, Real, GlobalIndex, LocalIndex >; + template< typename Cell, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex > + using MeshConfig = DefaultConfig< Cell, SpaceDimension, Real, GlobalIndex, LocalIndex >; }; -// The Mesh is enabled for allowed Device, CellTopology, WorldDimension, Real, +// The Mesh is enabled for allowed Device, CellTopology, SpaceDimension, Real, // GlobalIndex, LocalIndex and Id types as specified above. // // By specializing this tag you can enable or disable custom combinations of @@ -126,15 +126,15 @@ struct MeshConfigTemplateTag // // struct MeshTag< ConfigTag, // Mesh< typename MeshConfigTemplateTag< ConfigTag >:: -// template MeshConfig< CellTopology, WorldDimension, Real, GlobalIndex, LocalIndex > > > +// template MeshConfig< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex > > > // -template< typename ConfigTag, typename Device, typename CellTopology, int WorldDimension, typename Real, typename GlobalIndex, typename LocalIndex > +template< typename ConfigTag, typename Device, typename CellTopology, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex > struct MeshTag { enum { enabled = MeshDeviceTag< ConfigTag, Device >::enabled && MeshCellTopologyTag< ConfigTag, CellTopology >::enabled && - MeshWorldDimensionTag< ConfigTag, CellTopology, WorldDimension >::enabled && + MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled && MeshRealTag< ConfigTag, Real >::enabled && MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled && MeshLocalIndexTag< ConfigTag, LocalIndex >::enabled diff --git a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h index 46248e98cb7347c727b09fca2521bdb017d6272b..c2439287c2b8a29c3cb928b345432a9c29de0f0a 100644 --- a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h +++ b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h @@ -40,29 +40,29 @@ protected: template< typename CellTopology, typename = typename std::enable_if< ! BuildConfigTags::MeshCellTopologyTag< ConfigTag, CellTopology >::enabled >::type, typename = void > - static bool resolveWorldDimension( Reader& reader, Functor&& functor ); + static bool resolveSpaceDimension( Reader& reader, Functor&& functor ); // Overload for enabled cell topologies template< typename CellTopology, typename = typename std::enable_if< BuildConfigTags::MeshCellTopologyTag< ConfigTag, CellTopology >::enabled >::type > - static bool resolveWorldDimension( Reader& reader, Functor&& functor ); + static bool resolveSpaceDimension( Reader& reader, Functor&& functor ); - // Overload for disabled world dimensions + // Overload for disabled space dimensions template< typename CellTopology, - int WorldDimension, - typename = typename std::enable_if< ! BuildConfigTags::MeshWorldDimensionTag< ConfigTag, CellTopology, WorldDimension >::enabled >::type, + int SpaceDimension, + typename = typename std::enable_if< ! BuildConfigTags::MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled >::type, typename = void > static bool resolveReal( Reader& reader, Functor&& functor ); - // Overload for enabled world dimensions + // Overload for enabled space dimensions template< typename CellTopology, - int WorldDimension, - typename = typename std::enable_if< BuildConfigTags::MeshWorldDimensionTag< ConfigTag, CellTopology, WorldDimension >::enabled >::type > + int SpaceDimension, + typename = typename std::enable_if< BuildConfigTags::MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled >::type > static bool resolveReal( Reader& reader, Functor&& functor ); // Overload for disabled real types template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename = typename std::enable_if< ! BuildConfigTags::MeshRealTag< ConfigTag, Real >::enabled >::type, typename = void > @@ -70,14 +70,14 @@ protected: // Overload for enabled real types template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename = typename std::enable_if< BuildConfigTags::MeshRealTag< ConfigTag, Real >::enabled >::type > static bool resolveGlobalIndex( Reader& reader, Functor&& functor ); // Overload for disabled global index types template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename = typename std::enable_if< ! BuildConfigTags::MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled >::type, @@ -86,7 +86,7 @@ protected: // Overload for enabled global index types template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename = typename std::enable_if< BuildConfigTags::MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled >::type > @@ -94,7 +94,7 @@ protected: // Overload for disabled local index types template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex, @@ -104,7 +104,7 @@ protected: // Overload for enabled local index types template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex, @@ -117,7 +117,7 @@ protected: ! BuildConfigTags::MeshTag< ConfigTag, Device, typename MeshConfig::CellTopology, - MeshConfig::worldDimension, + MeshConfig::spaceDimension, typename MeshConfig::RealType, typename MeshConfig::GlobalIndexType, typename MeshConfig::LocalIndexType @@ -131,7 +131,7 @@ protected: BuildConfigTags::MeshTag< ConfigTag, Device, typename MeshConfig::CellTopology, - MeshConfig::worldDimension, + MeshConfig::spaceDimension, typename MeshConfig::RealType, typename MeshConfig::GlobalIndexType, typename MeshConfig::LocalIndexType diff --git a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp index 803cf84e9e07d3fc2fac796856ec20b5a4a655ce..72d3c8ef7102e847284c7cab880a29f810843e6f 100644 --- a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp +++ b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp @@ -42,15 +42,15 @@ resolveCellTopology( Reader& reader, Functor&& functor ) switch( reader.getCellShape() ) { case VTK::EntityShape::Line: - return resolveWorldDimension< Topologies::Edge >( reader, std::forward(functor) ); + return resolveSpaceDimension< Topologies::Edge >( reader, std::forward(functor) ); case VTK::EntityShape::Triangle: - return resolveWorldDimension< Topologies::Triangle >( reader, std::forward(functor) ); + return resolveSpaceDimension< Topologies::Triangle >( reader, std::forward(functor) ); case VTK::EntityShape::Quad: - return resolveWorldDimension< Topologies::Quadrangle >( reader, std::forward(functor) ); + return resolveSpaceDimension< Topologies::Quadrangle >( reader, std::forward(functor) ); case VTK::EntityShape::Tetra: - return resolveWorldDimension< Topologies::Tetrahedron >( reader, std::forward(functor) ); + return resolveSpaceDimension< Topologies::Tetrahedron >( reader, std::forward(functor) ); case VTK::EntityShape::Hexahedron: - return resolveWorldDimension< Topologies::Hexahedron >( reader, std::forward(functor) ); + return resolveSpaceDimension< Topologies::Hexahedron >( reader, std::forward(functor) ); default: std::cerr << "unsupported cell topology: " << VTK::getShapeName( reader.getCellShape() ) << std::endl; return false; @@ -65,7 +65,7 @@ template< typename ConfigTag, typename, typename > bool MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >:: -resolveWorldDimension( Reader& reader, Functor&& functor ) +resolveSpaceDimension( Reader& reader, Functor&& functor ) { std::cerr << "The cell topology " << getType< CellTopology >() << " is disabled in the build configuration." << std::endl; return false; @@ -79,9 +79,9 @@ template< typename ConfigTag, typename > bool MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >:: -resolveWorldDimension( Reader& reader, Functor&& functor ) +resolveSpaceDimension( Reader& reader, Functor&& functor ) { - switch( reader.getWorldDimension() ) + switch( reader.getSpaceDimension() ) { case 1: return resolveReal< CellTopology, 1 >( reader, std::forward(functor) ); @@ -90,7 +90,7 @@ resolveWorldDimension( Reader& reader, Functor&& functor ) case 3: return resolveReal< CellTopology, 3 >( reader, std::forward(functor) ); default: - std::cerr << "unsupported world dimension: " << reader.getWorldDimension() << std::endl; + std::cerr << "unsupported space dimension: " << reader.getSpaceDimension() << std::endl; return false; } } @@ -100,13 +100,13 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename, typename > bool MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >:: resolveReal( Reader& reader, Functor&& functor ) { - std::cerr << "The combination of world dimension (" << WorldDimension + std::cerr << "The combination of space dimension (" << SpaceDimension << ") and mesh dimension (" << CellTopology::dimension << ") is either invalid or disabled in the build configuration." << std::endl; return false; @@ -117,18 +117,18 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename > bool MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >:: resolveReal( Reader& reader, Functor&& functor ) { if( reader.getRealType() == "float" ) - return resolveGlobalIndex< CellTopology, WorldDimension, float >( reader, std::forward(functor) ); + return resolveGlobalIndex< CellTopology, SpaceDimension, float >( reader, std::forward(functor) ); if( reader.getRealType() == "double" ) - return resolveGlobalIndex< CellTopology, WorldDimension, double >( reader, std::forward(functor) ); + return resolveGlobalIndex< CellTopology, SpaceDimension, double >( reader, std::forward(functor) ); if( reader.getRealType() == "long double" ) - return resolveGlobalIndex< CellTopology, WorldDimension, long double >( reader, std::forward(functor) ); + return resolveGlobalIndex< CellTopology, SpaceDimension, long double >( reader, std::forward(functor) ); std::cerr << "Unsupported real type: " << reader.getRealType() << std::endl; return false; } @@ -138,7 +138,7 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename, typename > bool @@ -154,7 +154,7 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename > bool @@ -165,16 +165,16 @@ resolveGlobalIndex( Reader& reader, Functor&& functor ) reader.getGlobalIndexType() == "short int" || reader.getGlobalIndexType() == "std::int16_t" || reader.getGlobalIndexType() == "std::uint16_t" ) - return resolveLocalIndex< CellTopology, WorldDimension, Real, short int >( reader, std::forward(functor) ); + return resolveLocalIndex< CellTopology, SpaceDimension, Real, short int >( reader, std::forward(functor) ); if( reader.getGlobalIndexType() == "int" || reader.getGlobalIndexType() == "std::int32_t" || reader.getGlobalIndexType() == "std::uint32_t" ) - return resolveLocalIndex< CellTopology, WorldDimension, Real, int >( reader, std::forward(functor) ); + return resolveLocalIndex< CellTopology, SpaceDimension, Real, int >( reader, std::forward(functor) ); if( reader.getGlobalIndexType() == "long" || reader.getGlobalIndexType() == "long int" || reader.getGlobalIndexType() == "std::int64_t" || reader.getGlobalIndexType() == "std::uint64_t" ) - return resolveLocalIndex< CellTopology, WorldDimension, Real, long int >( reader, std::forward(functor) ); + return resolveLocalIndex< CellTopology, SpaceDimension, Real, long int >( reader, std::forward(functor) ); std::cerr << "Unsupported global index type: " << reader.getGlobalIndexType() << std::endl; return false; } @@ -184,7 +184,7 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename, typename > @@ -201,7 +201,7 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename > @@ -213,16 +213,16 @@ resolveLocalIndex( Reader& reader, Functor&& functor ) reader.getLocalIndexType() == "short int" || reader.getLocalIndexType() == "std::int16_t" || reader.getLocalIndexType() == "std::uint16_t" ) - return resolveMeshType< CellTopology, WorldDimension, Real, GlobalIndex, short int >( reader, std::forward(functor) ); + return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, short int >( reader, std::forward(functor) ); if( reader.getLocalIndexType() == "int" || reader.getLocalIndexType() == "std::int32_t" || reader.getLocalIndexType() == "std::uint32_t" ) - return resolveMeshType< CellTopology, WorldDimension, Real, GlobalIndex, int >( reader, std::forward(functor) ); + return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, int >( reader, std::forward(functor) ); if( reader.getLocalIndexType() == "long" || reader.getLocalIndexType() == "long int" || reader.getLocalIndexType() == "std::int64_t" || reader.getLocalIndexType() == "std::uint64_t" ) - return resolveMeshType< CellTopology, WorldDimension, Real, GlobalIndex, long int >( reader, std::forward(functor) ); + return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, long int >( reader, std::forward(functor) ); std::cerr << "Unsupported local index type: " << reader.getLocalIndexType() << std::endl; return false; } @@ -232,7 +232,7 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex, @@ -250,7 +250,7 @@ template< typename ConfigTag, template< typename Reader, typename Functor > template< typename CellTopology, - int WorldDimension, + int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex, @@ -259,7 +259,7 @@ bool MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >:: resolveMeshType( Reader& reader, Functor&& functor ) { - using MeshConfig = typename BuildConfigTags::MeshConfigTemplateTag< ConfigTag >::template MeshConfig< CellTopology, WorldDimension, Real, GlobalIndex, LocalIndex >; + using MeshConfig = typename BuildConfigTags::MeshConfigTemplateTag< ConfigTag >::template MeshConfig< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >; return resolveTerminate< MeshConfig >( reader, std::forward(functor) ); } diff --git a/src/TNL/Meshes/Writers/VTKWriter.h b/src/TNL/Meshes/Writers/VTKWriter.h index db0c09b1306ce3524d2d088215f29919a0c4740d..f5cae9efb68fc66abdcb376f4a4d3632b3656eb4 100644 --- a/src/TNL/Meshes/Writers/VTKWriter.h +++ b/src/TNL/Meshes/Writers/VTKWriter.h @@ -30,8 +30,8 @@ template< typename Mesh > class VTKWriter { static_assert( Mesh::getMeshDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." ); - // TODO: check also world dimension when grids allow it -// static_assert( Mesh::getWorldDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." ); + // TODO: check also space dimension when grids allow it +// static_assert( Mesh::getSpaceDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." ); template< int EntityDimension > using EntitiesWriter = details::MeshEntitiesVTKWriter< Mesh, EntityDimension >; diff --git a/src/TNL/Meshes/Writers/VTUWriter.h b/src/TNL/Meshes/Writers/VTUWriter.h index 00765cc0d14434379850d59d857a5cde463adfdb..3359566ba874b53397bab88f07fae9bdc05644ad 100644 --- a/src/TNL/Meshes/Writers/VTUWriter.h +++ b/src/TNL/Meshes/Writers/VTUWriter.h @@ -30,8 +30,8 @@ template< typename Mesh > class VTUWriter { static_assert( Mesh::getMeshDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." ); - // TODO: check also world dimension when grids allow it -// static_assert( Mesh::getWorldDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." ); + // TODO: check also space dimension when grids allow it +// static_assert( Mesh::getSpaceDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." ); template< int EntityDimension > using EntitiesCollector = details::MeshEntitiesVTUCollector< Mesh, EntityDimension >; diff --git a/src/Tools/tnl-decompose-mesh.cpp b/src/Tools/tnl-decompose-mesh.cpp index 3bd66fec89baf27bcf97db66e2a72cca5aa9a3ed..39612729b9585bdfac4386250b707e4f22402cbf 100644 --- a/src/Tools/tnl-decompose-mesh.cpp +++ b/src/Tools/tnl-decompose-mesh.cpp @@ -50,10 +50,10 @@ template<> struct MeshCellTopologyTag< DecomposeMeshConfigTag, Topologies::Quadr template<> struct MeshCellTopologyTag< DecomposeMeshConfigTag, Topologies::Tetrahedron > { enum { enabled = true }; }; template<> struct MeshCellTopologyTag< DecomposeMeshConfigTag, Topologies::Hexahedron > { enum { enabled = true }; }; -// Meshes are enabled only for the world dimension equal to the cell dimension. -template< typename CellTopology, int WorldDimension > -struct MeshWorldDimensionTag< DecomposeMeshConfigTag, CellTopology, WorldDimension > -{ enum { enabled = ( WorldDimension == CellTopology::dimension ) }; }; +// Meshes are enabled only for the space dimension equal to the cell dimension. +template< typename CellTopology, int SpaceDimension > +struct MeshSpaceDimensionTag< DecomposeMeshConfigTag, CellTopology, SpaceDimension > +{ enum { enabled = ( SpaceDimension == CellTopology::dimension ) }; }; // Meshes are enabled only for types explicitly listed below. template<> struct MeshRealTag< DecomposeMeshConfigTag, float > { enum { enabled = true }; }; @@ -67,7 +67,7 @@ template<> struct MeshConfigTemplateTag< DecomposeMeshConfigTag > { template< typename Cell, - int WorldDimension = Cell::dimension, + int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > @@ -78,27 +78,24 @@ struct MeshConfigTemplateTag< DecomposeMeshConfigTag > using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; - static constexpr int worldDimension = WorldDimension; + static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; - template< typename EntityTopology > - static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { // subvertices of faces are needed due to cell boundary tags - return SubentityDimension == 0 && EntityTopology::dimension >= meshDimension - 1; + return subentityDimension == 0 && entityDimension >= meshDimension - 1; } - template< typename EntityTopology > - static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { // superentities from faces to cells are needed due to cell boundary tags - return SuperentityDimension == meshDimension && EntityTopology::dimension == meshDimension - 1; + return superentityDimension == meshDimension && entityDimension == meshDimension - 1; } - template< typename EntityTopology > - static constexpr bool entityTagsStorage( EntityTopology ) + static constexpr bool entityTagsStorage( int entityDimension ) { - return EntityTopology::dimension >= meshDimension - 1; + return entityDimension >= meshDimension - 1; } static constexpr bool dualGraphStorage() diff --git a/src/Tools/tnl-game-of-life.cpp b/src/Tools/tnl-game-of-life.cpp index 8292d5483da6decfc14f759018713a5f9ba5de42..e2f19c2ea6abb0fffcdb99c1339a6f61b62f9294 100644 --- a/src/Tools/tnl-game-of-life.cpp +++ b/src/Tools/tnl-game-of-life.cpp @@ -38,10 +38,10 @@ template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Quadrangle > { e //template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Tetrahedron > { enum { enabled = true }; }; //template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Hexahedron > { enum { enabled = true }; }; -// Meshes are enabled only for the world dimension equal to the cell dimension. -template< typename CellTopology, int WorldDimension > -struct MeshWorldDimensionTag< MyConfigTag, CellTopology, WorldDimension > -{ enum { enabled = ( WorldDimension == CellTopology::dimension ) }; }; +// Meshes are enabled only for the space dimension equal to the cell dimension. +template< typename CellTopology, int SpaceDimension > +struct MeshSpaceDimensionTag< MyConfigTag, CellTopology, SpaceDimension > +{ enum { enabled = ( SpaceDimension == CellTopology::dimension ) }; }; // Meshes are enabled only for types explicitly listed below. template<> struct MeshRealTag< MyConfigTag, float > { enum { enabled = true }; }; @@ -55,31 +55,28 @@ template<> struct MeshConfigTemplateTag< MyConfigTag > { template< typename Cell, - int WorldDimension = Cell::dimension, + int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > struct MeshConfig - : public DefaultConfig< Cell, WorldDimension, Real, GlobalIndex, LocalIndex > + : public DefaultConfig< Cell, SpaceDimension, Real, GlobalIndex, LocalIndex > { - template< typename EntityTopology > - static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { - return SubentityDimension == 0 && EntityTopology::dimension >= Cell::dimension - 1; + return subentityDimension == 0 && entityDimension >= Cell::dimension - 1; } - template< typename EntityTopology > - static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { // return false; - return (EntityTopology::dimension == 0 || EntityTopology::dimension == Cell::dimension - 1) && SuperentityDimension == Cell::dimension; + return (entityDimension == 0 || entityDimension == Cell::dimension - 1) && superentityDimension == Cell::dimension; } - template< typename EntityTopology > - static constexpr bool entityTagsStorage( EntityTopology ) + static constexpr bool entityTagsStorage( int entityDimension ) { // return false; - return EntityTopology::dimension == 0 || EntityTopology::dimension >= Cell::dimension - 1; + return entityDimension == 0 || entityDimension >= Cell::dimension - 1; } static constexpr bool dualGraphStorage() diff --git a/src/Tools/tnl-mesh-converter.cpp b/src/Tools/tnl-mesh-converter.cpp index 5298ea8f4aa5d0791883aa5ce6befffabd25f855..bbaf821757191456a500a090e946ce98c536c67c 100644 --- a/src/Tools/tnl-mesh-converter.cpp +++ b/src/Tools/tnl-mesh-converter.cpp @@ -44,10 +44,10 @@ template<> struct MeshCellTopologyTag< MeshConverterConfigTag, Topologies::Quadr template<> struct MeshCellTopologyTag< MeshConverterConfigTag, Topologies::Tetrahedron > { enum { enabled = true }; }; template<> struct MeshCellTopologyTag< MeshConverterConfigTag, Topologies::Hexahedron > { enum { enabled = true }; }; -// Meshes are enabled only for the world dimension equal to the cell dimension. -template< typename CellTopology, int WorldDimension > -struct MeshWorldDimensionTag< MeshConverterConfigTag, CellTopology, WorldDimension > -{ enum { enabled = ( WorldDimension == CellTopology::dimension ) }; }; +// Meshes are enabled only for the space dimension equal to the cell dimension. +template< typename CellTopology, int SpaceDimension > +struct MeshSpaceDimensionTag< MeshConverterConfigTag, CellTopology, SpaceDimension > +{ enum { enabled = ( SpaceDimension == CellTopology::dimension ) }; }; // Meshes are enabled only for types explicitly listed below. template<> struct MeshRealTag< MeshConverterConfigTag, float > { enum { enabled = true }; }; @@ -61,7 +61,7 @@ template<> struct MeshConfigTemplateTag< MeshConverterConfigTag > { template< typename Cell, - int WorldDimension = Cell::dimension, + int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > @@ -72,23 +72,20 @@ struct MeshConfigTemplateTag< MeshConverterConfigTag > using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; - static constexpr int worldDimension = WorldDimension; + static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; - template< typename EntityTopology > - static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { - return SubentityDimension == 0 && EntityTopology::dimension == meshDimension; + return subentityDimension == 0 && entityDimension == meshDimension; } - template< typename EntityTopology > - static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return false; } - template< typename EntityTopology > - static constexpr bool entityTagsStorage( EntityTopology ) + static constexpr bool entityTagsStorage( int entityDimension ) { return false; } diff --git a/src/Tools/tnl-test-distributed-mesh.h b/src/Tools/tnl-test-distributed-mesh.h index 65e4c6348bf578496df56db12379864af9ea011c..47e3266767035b8f6288d994852bb18f671e95e6 100644 --- a/src/Tools/tnl-test-distributed-mesh.h +++ b/src/Tools/tnl-test-distributed-mesh.h @@ -40,10 +40,10 @@ template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Triangle > { enu template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Tetrahedron > { enum { enabled = true }; }; //template<> struct MeshCellTopologyTag< MyConfigTag, Topologies::Hexahedron > { enum { enabled = true }; }; -// Meshes are enabled only for the world dimension equal to the cell dimension. -template< typename CellTopology, int WorldDimension > -struct MeshWorldDimensionTag< MyConfigTag, CellTopology, WorldDimension > -{ enum { enabled = ( WorldDimension == CellTopology::dimension ) }; }; +// Meshes are enabled only for the space dimension equal to the cell dimension. +template< typename CellTopology, int SpaceDimension > +struct MeshSpaceDimensionTag< MyConfigTag, CellTopology, SpaceDimension > +{ enum { enabled = ( SpaceDimension == CellTopology::dimension ) }; }; // Meshes are enabled only for types explicitly listed below. template<> struct MeshRealTag< MyConfigTag, float > { enum { enabled = true }; }; @@ -57,7 +57,7 @@ template<> struct MeshConfigTemplateTag< MyConfigTag > { template< typename Cell, - int WorldDimension = Cell::dimension, + int SpaceDimension = Cell::dimension, typename Real = double, typename GlobalIndex = int, typename LocalIndex = GlobalIndex > @@ -68,28 +68,25 @@ struct MeshConfigTemplateTag< MyConfigTag > using GlobalIndexType = GlobalIndex; using LocalIndexType = LocalIndex; - static constexpr int worldDimension = WorldDimension; + static constexpr int spaceDimension = SpaceDimension; static constexpr int meshDimension = Cell::dimension; - template< typename EntityTopology > - static constexpr bool subentityStorage( EntityTopology, int SubentityDimension ) + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { - return ( SubentityDimension == 0 && EntityTopology::dimension >= meshDimension - 1 ) - || SubentityDimension == meshDimension - 1; + return ( subentityDimension == 0 && entityDimension >= meshDimension - 1 ) + || subentityDimension == meshDimension - 1; } - template< typename EntityTopology > - static constexpr bool superentityStorage( EntityTopology, int SuperentityDimension ) + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { // return false; - return (EntityTopology::dimension == 0 || EntityTopology::dimension == meshDimension - 1) && SuperentityDimension >= meshDimension - 1; + return (entityDimension == 0 || entityDimension == meshDimension - 1) && superentityDimension >= meshDimension - 1; } - template< typename EntityTopology > - static constexpr bool entityTagsStorage( EntityTopology ) + static constexpr bool entityTagsStorage( int entityDimension ) { // return false; - return EntityTopology::dimension == 0 || EntityTopology::dimension >= meshDimension - 1; + return entityDimension == 0 || entityDimension >= meshDimension - 1; } static constexpr bool dualGraphStorage() diff --git a/src/UnitTests/Meshes/EntityTagsTest.h b/src/UnitTests/Meshes/EntityTagsTest.h index 855e29249d53251545b6190531f785a5c675c855..775cb1aeb192c07e1c069363aac0a9bb1b222336 100644 --- a/src/UnitTests/Meshes/EntityTagsTest.h +++ b/src/UnitTests/Meshes/EntityTagsTest.h @@ -23,10 +23,9 @@ using IndexType = int; class TestQuadrangleMeshConfig : public DefaultConfig< Topologies::Quadrangle > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool boundaryTagsStorage( EntityTopology ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } + static constexpr bool boundaryTagsStorage( int entityDimension ) { return true; } }; TEST( MeshTest, RegularMeshOfQuadranglesTest ) diff --git a/src/UnitTests/Meshes/MeshOrderingTest.h b/src/UnitTests/Meshes/MeshOrderingTest.h index 4d5d2e51215fc72c7855f75b549c5efe91d9adc0..998e8b245afc501fc124c0d0d3f0137ab4886b4e 100644 --- a/src/UnitTests/Meshes/MeshOrderingTest.h +++ b/src/UnitTests/Meshes/MeshOrderingTest.h @@ -20,9 +20,8 @@ class TestTriangleMeshConfig : public DefaultConfig< Topologies::Triangle, 2, double, int, short int > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } }; template< typename Device > diff --git a/src/UnitTests/Meshes/MeshTest.h b/src/UnitTests/Meshes/MeshTest.h index aa5d4cfda423a32ae8ec040305c491daef9a04c3..9125e04e83b1404bd5e3e6e3f5c47e0b1ea1d0f6 100644 --- a/src/UnitTests/Meshes/MeshTest.h +++ b/src/UnitTests/Meshes/MeshTest.h @@ -30,33 +30,29 @@ using IndexType = int; class TestTriangleMeshConfig : public DefaultConfig< Topologies::Triangle > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } }; class TestQuadrangleMeshConfig : public DefaultConfig< Topologies::Quadrangle > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } }; class TestTetrahedronMeshConfig : public DefaultConfig< Topologies::Tetrahedron > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } }; class TestHexahedronMeshConfig : public DefaultConfig< Topologies::Hexahedron > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } }; template< typename Object1, typename Object2 > diff --git a/src/UnitTests/Meshes/MeshTraverserTest.h b/src/UnitTests/Meshes/MeshTraverserTest.h index 2a0a9ce9a9dfd9d4f422bb3cb7ce555efd3046c4..d0c16bfe45a47d4e64957e637af076302527d22e 100644 --- a/src/UnitTests/Meshes/MeshTraverserTest.h +++ b/src/UnitTests/Meshes/MeshTraverserTest.h @@ -23,17 +23,15 @@ using IndexType = int; class TestQuadrangleMeshConfig : public DefaultConfig< Topologies::Quadrangle > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } }; class TestHexahedronMeshConfig : public DefaultConfig< Topologies::Hexahedron > { public: - static constexpr bool entityStorage( int dimensions ) { return true; } - template< typename EntityTopology > static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { return true; } - template< typename EntityTopology > static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; } + static constexpr bool subentityStorage( int entityDimension, int subentityDimension ) { return true; } + static constexpr bool superentityStorage( int entityDimension, int superentityDimension ) { return true; } }; struct TestEntitiesProcessor