From 025b71511b64007559495984259adae449deb276 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz>
Date: Thu, 20 Oct 2016 15:52:44 +0200
Subject: [PATCH] Renamed MeshEntity to EntityTopology where appropriate.
 Readability changes in MeshConfigValidator.

---
 src/TNL/Meshes/MeshConfigBase.h               |  15 +--
 .../MeshDetails/config/MeshConfigValidator.h  | 108 ++++++++++--------
 src/UnitTests/Meshes/MeshEntityTest.h         |  16 +--
 3 files changed, 74 insertions(+), 65 deletions(-)

diff --git a/src/TNL/Meshes/MeshConfigBase.h b/src/TNL/Meshes/MeshConfigBase.h
index 1595c17cc8..24c434e8d0 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 ba079790e1..e8f711c64e 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 112ed6519d..1ab9364465 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;
       }
-- 
GitLab