Commit 9fa0f157 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Simplified mesh configuration

Storage of subentities, superentities and tags is configured by
dimension rather than entity topology.
parent fdd8c9b3
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -48,24 +48,21 @@ struct MeshConfigTemplateTag< MyConfigTag >
   struct MeshConfig
      : 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()
+2 −3
Original line number Diff line number Diff line
@@ -20,10 +20,9 @@ struct MeshConfigTemplateTag< MyConfigTag >
   struct MeshConfig
      : 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;
      }
   };
};
+5 −9
Original line number Diff line number Diff line
@@ -42,8 +42,7 @@ struct DefaultConfig
   /****
    * 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;
   }

+2 −2
Original line number Diff line number Diff line
@@ -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" );


+9 −9
Original line number Diff line number Diff line
@@ -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" );
};

Loading