diff --git a/src/TNL/Meshes/MeshConfigBase.h b/src/TNL/Meshes/MeshConfigBase.h index 1595c17cc88b7124e673a1e01229f4e69ec3ea57..24c434e8d05afd41063cfc06832e174bef3caf9f 100644 --- a/src/TNL/Meshes/MeshConfigBase.h +++ b/src/TNL/Meshes/MeshConfigBase.h @@ -67,9 +67,8 @@ struct MeshConfigBase /**** * Storage of subentities of mesh entities */ - // TODO: MeshEntity -> EntityTopology - template< typename MeshEntity > - static constexpr bool subentityStorage( MeshEntity, int SubentityDimensions ) + template< typename EntityTopology > + static constexpr bool subentityStorage( EntityTopology, int SubentityDimensions ) { /**** * Vertices must always be stored @@ -82,9 +81,8 @@ struct MeshConfigBase * Storage of subentity orientations of mesh entities. * It must be false for vertices and cells. */ - // TODO: MeshEntity -> EntityTopology - template< typename MeshEntity > - static constexpr bool subentityOrientationStorage( MeshEntity, int SubentityDimensions ) + template< typename EntityTopology > + static constexpr bool subentityOrientationStorage( EntityTopology, int SubentityDimensions ) { return ( SubentityDimensions > 0 ); } @@ -92,9 +90,8 @@ struct MeshConfigBase /**** * Storage of superentities of mesh entities */ - // TODO: MeshEntity -> EntityTopology - template< typename MeshEntity > - static constexpr bool superentityStorage( MeshEntity, int SuperentityDimensions ) + template< typename EntityTopology > + static constexpr bool superentityStorage( EntityTopology, int SuperentityDimensions ) { return true; //return false; diff --git a/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h b/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h index ba079790e1d18079e881b4b19af4935fa68df1b6..e8f711c64efac8fa87ed1cfbf37325a8993d8eb5 100644 --- a/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h +++ b/src/TNL/Meshes/MeshDetails/config/MeshConfigValidator.h @@ -24,60 +24,69 @@ namespace TNL { namespace Meshes { template< typename MeshConfig, - typename MeshEntity, + typename EntityTopology, typename dimensions > -class MeshConfigValidatorSubtopologyLayer : -public MeshConfigValidatorSubtopologyLayer< MeshConfig, MeshEntity, typename dimensions::Decrement > +class MeshConfigValidatorSubtopologyLayer + : public MeshConfigValidatorSubtopologyLayer< MeshConfig, EntityTopology, typename dimensions::Decrement > { - static_assert( ! MeshConfig::subentityStorage( MeshEntity(), dimensions::value ) || - MeshConfig::entityStorage( MeshEntity::dimensions ), "entities of which subentities are stored must be stored" ); - static_assert( ! MeshConfig::subentityStorage( MeshEntity(), dimensions::value ) || - MeshConfig::entityStorage( dimensions::value ), "entities that are stored as subentities must be stored"); - static_assert( ! MeshConfig::subentityOrientationStorage( MeshEntity(), dimensions::value ) || - MeshConfig::subentityStorage( MeshEntity(), dimensions::value ), "orientation can be stored only for subentities that are stored"); + static_assert( ! MeshConfig::subentityStorage( EntityTopology(), dimensions::value ) || + MeshConfig::entityStorage( EntityTopology::dimensions ), + "entities of which subentities are stored must be stored" ); + static_assert( ! MeshConfig::subentityStorage( EntityTopology(), dimensions::value ) || + MeshConfig::entityStorage( dimensions::value ), + "entities that are stored as subentities must be stored"); + static_assert( ! MeshConfig::subentityOrientationStorage( EntityTopology(), dimensions::value ) || + MeshConfig::subentityStorage( EntityTopology(), dimensions::value ), + "orientation can be stored only for subentities that are stored"); }; template< typename MeshConfig, - typename MeshEntity > -class MeshConfigValidatorSubtopologyLayer< MeshConfig, MeshEntity, MeshDimensionTag< 0 > > + typename EntityTopology > +class MeshConfigValidatorSubtopologyLayer< MeshConfig, EntityTopology, MeshDimensionsTag< 0 > > { - static_assert( ! MeshConfig::subentityStorage( MeshEntity(), 0 ) || - MeshConfig::entityStorage( 0 ), "entities that are stored as subentities must be stored" ); - static_assert( ! MeshConfig::subentityOrientationStorage( MeshEntity(), 0 ), "storage of vertex orientation does not make sense" ); + static_assert( ! MeshConfig::subentityStorage( EntityTopology(), 0 ) || + MeshConfig::entityStorage( 0 ), + "entities that are stored as subentities must be stored" ); + static_assert( ! MeshConfig::subentityOrientationStorage( EntityTopology(), 0 ), + "storage of vertex orientation does not make sense" ); }; template< typename MeshConfig, - typename MeshEntity, + typename EntityTopology, typename dimensions > -class MeshConfigValidatorSupertopologyLayer : -public MeshConfigValidatorSupertopologyLayer< MeshConfig, MeshEntity, typename dimensions::Decrement > +class MeshConfigValidatorSupertopologyLayer + : public MeshConfigValidatorSupertopologyLayer< MeshConfig, EntityTopology, typename dimensions::Decrement > { - static_assert( ! MeshConfig::superentityStorage( MeshEntity(), 0 ) || - MeshConfig::entityStorage( MeshEntity::dimensions ), "entities of which superentities are stored must be stored"); - static_assert( ! MeshConfig::superentityStorage( MeshEntity(), 0 ) || - MeshConfig::entityStorage( dimensions::value ), "entities that are stored as superentities must be stored"); + static_assert( ! MeshConfig::superentityStorage( EntityTopology(), 0 ) || + MeshConfig::entityStorage( EntityTopology::dimensions ), + "entities of which superentities are stored must be stored"); + static_assert( ! MeshConfig::superentityStorage( EntityTopology(), 0 ) || + MeshConfig::entityStorage( dimensions::value ), + "entities that are stored as superentities must be stored"); }; template< typename MeshConfig, - typename MeshEntity > -class MeshConfigValidatorSupertopologyLayer< MeshConfig, MeshEntity, MeshDimensionTag< MeshEntity::dimensions > > + typename EntityTopology > +class MeshConfigValidatorSupertopologyLayer< MeshConfig, EntityTopology, MeshDimensionsTag< EntityTopology::dimensions > > {}; template< typename MeshConfig, int dimensions > -class MeshConfigValidatorLayer : - public MeshConfigValidatorLayer< MeshConfig, dimensions - 1 >, - public MeshConfigValidatorSubtopologyLayer< MeshConfig, - typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology, - MeshDimensionTag< dimensions - 1 > >, - public MeshConfigValidatorSupertopologyLayer< MeshConfig, - typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology, - MeshDimensionTag< MeshConfig::CellTopology::dimensions > > +class MeshConfigValidatorLayer + : public MeshConfigValidatorLayer< MeshConfig, dimensions - 1 >, + public MeshConfigValidatorSubtopologyLayer< MeshConfig, + typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology, + MeshDimensionsTag< dimensions - 1 > >, + public MeshConfigValidatorSupertopologyLayer< MeshConfig, + typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology, + MeshDimensionsTag< MeshConfig::CellTopology::dimensions > > { - typedef typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology Topology; + using Topology = typename MeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology; - static_assert( ! MeshConfig::entityStorage( dimensions ) || MeshConfig::subentityStorage( Topology(), 0 ), "subvertices of all stored entities must be stored"); + static_assert( ! MeshConfig::entityStorage( dimensions ) || + MeshConfig::subentityStorage( Topology(), 0 ), + "subvertices of all stored entities must be stored"); }; template< typename MeshConfig > @@ -86,28 +95,31 @@ class MeshConfigValidatorLayer< MeshConfig, 0 > }; template< typename MeshConfig > -class MeshConfigValidatorLayerCell : - public MeshConfigValidatorLayer< MeshConfig, MeshConfig::CellTopology::dimensions - 1 >, - public MeshConfigValidatorSubtopologyLayer< MeshConfig, - typename MeshConfig::CellTopology, - MeshDimensionTag< MeshConfig::CellTopology::dimensions - 1 > > +class MeshConfigValidatorLayerCell + : public MeshConfigValidatorLayer< MeshConfig, MeshConfig::CellTopology::dimensions - 1 >, + public MeshConfigValidatorSubtopologyLayer< MeshConfig, + typename MeshConfig::CellTopology, + MeshDimensionsTag< MeshConfig::CellTopology::dimensions - 1 > > { - typedef typename MeshConfig::CellTopology CellTopology; - static const int dimensions = CellTopology::dimensions; + using CellTopology = typename MeshConfig::CellTopology; + static constexpr int dimensions = CellTopology::dimensions; - static_assert( !MeshConfig::entityStorage( dimensions ) || MeshConfig::subentityStorage( CellTopology(), 0 ), "subvertices of all stored entities must be stored"); + static_assert( ! MeshConfig::entityStorage( dimensions ) || + MeshConfig::subentityStorage( CellTopology(), 0 ), + "subvertices of all stored entities must be stored" ); }; -template<typename MeshConfig > -class MeshConfigValidator : public MeshConfigValidatorLayerCell< MeshConfig > +template< typename MeshConfig > +class MeshConfigValidator + : public MeshConfigValidatorLayerCell< MeshConfig > { - static const int meshDimension = MeshConfig::CellTopology::dimensions; + static constexpr int meshDimensions = MeshConfig::CellTopology::dimensions; - 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( 1 <= meshDimensions, "zero dimensional meshes are not supported" ); + static_assert( meshDimensions <= MeshConfig::worldDimensions, "world dimension must not be less than mesh dimension" ); - static_assert( MeshConfig::entityStorage( 0 ), "mesh vertices must be stored"); - static_assert( MeshConfig::entityStorage( meshDimension ), "mesh cells must be stored"); + static_assert( MeshConfig::entityStorage( 0 ), "mesh vertices must be stored" ); + static_assert( MeshConfig::entityStorage( meshDimensions ), "mesh cells must be stored" ); }; } // namespace Meshes diff --git a/src/UnitTests/Meshes/MeshEntityTest.h b/src/UnitTests/Meshes/MeshEntityTest.h index 112ed6519ddda4ccaf6a7f2ee924ccaf4bc43996..1ab9364465eb0970898de2f453e43d15548d8783 100644 --- a/src/UnitTests/Meshes/MeshEntityTest.h +++ b/src/UnitTests/Meshes/MeshEntityTest.h @@ -21,14 +21,14 @@ class TestTriangleMeshConfig : public MeshConfigBase< MeshTriangleTopology > { public: - template< typename MeshEntity > - static constexpr bool subentityStorage( MeshEntity entity, int subentityDimensions ) + template< typename EntityTopology > + static constexpr bool subentityStorage( EntityTopology entity, int subentityDimensions ) { return true; } - template< typename MeshEntity > - static constexpr bool superentityStorage( MeshEntity entity, int superentityDimensions ) + template< typename EntityTopology > + static constexpr bool superentityStorage( EntityTopology entity, int superentityDimensions ) { return true; } @@ -38,14 +38,14 @@ class TestTetrahedronMeshConfig : public MeshConfigBase< MeshTetrahedronTopology { public: - template< typename MeshEntity > - static constexpr bool subentityStorage( MeshEntity entity, int subentityDimensions ) + template< typename EntityTopology > + static constexpr bool subentityStorage( EntityTopology entity, int subentityDimensions ) { return true; } - template< typename MeshEntity > - static constexpr bool superentityStorage( MeshEntity entity, int superentityDimensions ) + template< typename EntityTopology > + static constexpr bool superentityStorage( EntityTopology entity, int superentityDimensions ) { return true; }