Commit 844cfb88 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Refactoring the mesh.

parent 6bd460ca
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -68,13 +68,13 @@ template< typename MeshConfig, int dimensions >
class tnlMeshConfigValidatorLayer :
 public tnlMeshConfigValidatorLayer< MeshConfig, dimensions - 1 >,
 public tnlMeshConfigValidatorSubtopologyLayer< MeshConfig, 
                                                typename tnlSubentities< typename MeshConfig::CellTopology, dimensions >::Tag,
                                                typename tnlMeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology,
                                                tnlDimensionsTag< dimensions - 1 > >,
 public tnlMeshConfigValidatorSupertopologyLayer< MeshConfig, 
                                                  typename tnlSubentities< typename MeshConfig::CellTopology, dimensions >::Tag,
                                                  typename tnlMeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology,
                                                  tnlDimensionsTag< MeshConfig::CellTopology::dimensions > >
{
	typedef typename tnlSubentities< typename MeshConfig::CellTopology, dimensions >::Tag Topology;
	typedef typename tnlMeshSubtopology< typename MeshConfig::CellTopology, dimensions >::Topology Topology;

	static_assert( ! MeshConfig::entityStorage( dimensions ) || MeshConfig::subentityStorage( Topology(), 0 ), "subvertices of all stored entities must be stored");
};
+9 −11
Original line number Diff line number Diff line
@@ -20,8 +20,7 @@

#include <core/tnlFile.h>
#include <mesh/traits/tnlMeshTraits.h>
#include <mesh/traits/tnlMeshEntitiesTraits.h>
#include <mesh/traits/tnlStorageTraits.h>
#include <mesh/traits/tnlMeshEntityTraits.h>
#include <mesh/traits/tnlMeshTraits.h>

template< typename MeshConfig >
@@ -30,14 +29,13 @@ class tnlMesh;
template< typename DimensionsTag,
          typename Device,
          typename MeshConfig,
          typename EntityStorageTag = typename tnlMeshEntitiesTraits< MeshConfig,
          typename EntityStorageTag = typename tnlMeshEntityTraits< MeshConfig,
                                                                      DimensionsTag::value >::EntityStorageTag >
class tnlMeshStorageTag;

template< typename MeshConfig,
          typename DimensionsTag,
          typename EntityStorageTag = typename tnlMeshEntitiesTraits< MeshConfig,
                                                                      DimensionsTag::value >::EntityStorageTag >
          bool EntityStorage = tnlMeshEntityTraits< MeshConfig, DimensionsTag::value >::storageEnabled >
class tnlMeshStorageLayer;


@@ -53,7 +51,7 @@ template< typename MeshConfig,
          typename DimensionsTag >
class tnlMeshStorageLayer< MeshConfig,
                           DimensionsTag,
                           tnlStorageTraits< true > >
                           true >
   : public tnlMeshStorageLayer< MeshConfig, typename DimensionsTag::Decrement >,
     public tnlMeshSuperentityStorageLayers< MeshConfig, 
                                             typename tnlMeshTraits< MeshConfig >::template EntityTraits< DimensionsTag::value >::Tag >
@@ -181,7 +179,7 @@ template< typename MeshConfig,
          typename DimensionsTag >
class tnlMeshStorageLayer< MeshConfig,
                           DimensionsTag,
                           tnlStorageTraits< false > >
                           false >
   : public tnlMeshStorageLayer< MeshConfig,
                                 typename DimensionsTag::Decrement >
{
@@ -190,9 +188,9 @@ class tnlMeshStorageLayer< MeshConfig,
template< typename MeshConfig >
class tnlMeshStorageLayer< MeshConfig,
                           tnlDimensionsTag< 0 >,
                           tnlStorageTraits< true > > :
                           true > :
   public tnlMeshSuperentityStorageLayers< MeshConfig, 
                                           tnlMeshVertexTag >
                                           tnlMeshVertexTopology >

{
   public:
@@ -200,7 +198,7 @@ class tnlMeshStorageLayer< MeshConfig,
   typedef tnlDimensionsTag< 0 >                        DimensionsTag;
   
   typedef tnlMeshSuperentityStorageLayers< MeshConfig, 
                                            tnlMeshVertexTag > SuperentityStorageBaseType;
                                            tnlMeshVertexTopology > SuperentityStorageBaseType;

   typedef tnlMeshTraits< MeshConfig >                                          MeshTraits;
   typedef typename MeshTraits::template EntityTraits< DimensionsTag::value >   EntityTraits; 
@@ -341,7 +339,7 @@ class tnlMeshStorageLayer< MeshConfig,
template< typename MeshConfig >
class tnlMeshStorageLayer< MeshConfig,
                           tnlDimensionsTag< 0 >,
                           tnlStorageTraits< false > >
                           false >
{
};

+18 −21
Original line number Diff line number Diff line
@@ -20,20 +20,16 @@

#include <core/tnlFile.h>
#include <mesh/tnlDimensionsTag.h>
#include <mesh/traits/tnlStorageTraits.h>
#include <mesh/traits/tnlMeshSubentitiesTraits.h>
#include <mesh/traits/tnlMeshSubentityTraits.h>
#include <mesh/tnlMeshEntityOrientation.h>

template< typename MeshConfig,
          typename EntityTag,
          typename DimensionsTag,
          typename SubentityStorageTag = 
             typename tnlMeshSubentitiesTraits< MeshConfig,
                                                EntityTag,
                                                DimensionsTag::value >::SubentityStorageTag,
          typename SubentityOrientationStorage =
             tnlStorageTraits< tnlMeshTraits< MeshConfig>::
                template SubentityTraits< EntityTag, DimensionsTag::value >::orientationEnabled > >
          bool SubentityStorage = 
            tnlMeshTraits< MeshConfig >::template SubentityTraits< EntityTag, DimensionsTag::value >::storageEnabled,
          bool SubentityOrientationStorage =
            tnlMeshTraits< MeshConfig >::template SubentityTraits< EntityTag, DimensionsTag::value >::orientationEnabled >
class tnlMeshSubentityStorageLayer;


@@ -53,8 +49,8 @@ template< typename MeshConfig,
class tnlMeshSubentityStorageLayer< MeshConfig,
                                    EntityTag,
                                    DimensionsTag,
                                    tnlStorageTraits< true >,
                                    tnlStorageTraits< true > >
                                    true,
                                    true >
   : public tnlMeshSubentityStorageLayer< MeshConfig,
                                          EntityTag,
                                          typename DimensionsTag::Decrement >
@@ -63,7 +59,7 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
                                         EntityTag,
                                         typename DimensionsTag::Decrement > BaseType;

   typedef tnlMeshSubentitiesTraits< MeshConfig,
   typedef tnlMeshSubentityTraits< MeshConfig,
                                     EntityTag,
                                     DimensionsTag::value > SubentityTraits;

@@ -197,8 +193,8 @@ template< typename MeshConfig,
class tnlMeshSubentityStorageLayer< MeshConfig,
                                    EntityTag,
                                    DimensionsTag,
                                    tnlStorageTraits< true >,
                                    tnlStorageTraits< false > >
                                    true,
                                    false >
   : public tnlMeshSubentityStorageLayer< MeshConfig,
                                          EntityTag,
                                          typename DimensionsTag::Decrement >
@@ -207,7 +203,7 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
                                         EntityTag,
                                         typename DimensionsTag::Decrement > BaseType;

   typedef tnlMeshSubentitiesTraits< MeshConfig,
   typedef tnlMeshSubentityTraits< MeshConfig,
                                     EntityTag,
                                     DimensionsTag::value > SubentityTraits;

@@ -329,8 +325,8 @@ template< typename MeshConfig,
class tnlMeshSubentityStorageLayer< MeshConfig,
                                    EntityTag,
                                    DimensionsTag,
                                    tnlStorageTraits< false >,
                                    tnlStorageTraits< false > >
                                    false,
                                    false >
   : public tnlMeshSubentityStorageLayer< MeshConfig,
                                          EntityTag,
                                          typename DimensionsTag::Decrement >
@@ -343,12 +339,12 @@ template< typename MeshConfig,
class tnlMeshSubentityStorageLayer< MeshConfig,
                                    EntityTag,
                                    tnlDimensionsTag< 0 >,
                                    tnlStorageTraits< true >,
                                    tnlStorageTraits< false > >
                                    true,
                                    false >
{
   typedef tnlDimensionsTag< 0 >                           DimensionsTag;

   typedef tnlMeshSubentitiesTraits< MeshConfig,
   typedef tnlMeshSubentityTraits< MeshConfig,
                                     EntityTag,
                                     DimensionsTag::value > SubentityTraits;

@@ -453,7 +449,8 @@ template< typename MeshConfig,
class tnlMeshSubentityStorageLayer< MeshConfig,
                                    EntityTag,
                                    tnlDimensionsTag< 0 >,
                                    tnlStorageTraits< false > >
                                    false,
                                    false >
{
   public:

+7 −8
Original line number Diff line number Diff line
@@ -18,15 +18,14 @@
#ifndef TNLSUPERENTITYACCESS_H
#define	TNLSUPERENTITYACCESS_H

#include <mesh/traits/tnlStorageTraits.h>
#include <mesh/traits/tnlMeshTraits.h>


template< typename MeshConfig,
          typename MeshEntity,
          typename Dimensions,
          typename SuperentityStorage = 
             tnlStorageTraits< tnlMeshTraits< MeshConfig >::template SuperentityTraits< MeshEntity, Dimensions>::storageEnabled > >
          typename DimensionsTag,
          bool SuperentityStorage = 
             tnlMeshTraits< MeshConfig >::template SuperentityTraits< MeshEntity, DimensionsTag::value >::storageEnabled >
class tnlMeshSuperentityAccessLayer;


@@ -50,7 +49,7 @@ template< typename MeshConfig,
class tnlMeshSuperentityAccessLayer< MeshConfig,
                                     MeshEntity,
                                     Dimensions,
                                     tnlStorageTraits< true > > :
                                     true > :
   public tnlMeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement >
{
	typedef tnlMeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement > BaseType;
@@ -76,7 +75,7 @@ template< typename MeshConfig,
class tnlMeshSuperentityAccessLayer< MeshConfig,
                                     MeshEntity,
                                     Dimensions,
                                     tnlStorageTraits< false > > :
                                     false > :
   public tnlMeshSuperentityAccessLayer< MeshConfig, MeshEntity, typename Dimensions::Decrement >
{
};
@@ -86,7 +85,7 @@ template< typename MeshConfig,
class tnlMeshSuperentityAccessLayer< MeshConfig,
                                     MeshEntity,
                                     tnlDimensionsTag< MeshEntity::dimensions >,
                                     tnlStorageTraits< false > >
                                     false >
{
   protected:
	   /***
@@ -101,7 +100,7 @@ template< typename MeshConfig,
class tnlMeshSuperentityAccessLayer< MeshConfig,
                                     MeshEntity,
                                     tnlDimensionsTag< MeshEntity::dimensions >,
                                     tnlStorageTraits< true > >
                                     true >
{
   protected:
	   /***
+29 −31
Original line number Diff line number Diff line
@@ -20,18 +20,16 @@

#include <core/tnlFile.h>
#include <mesh/tnlDimensionsTag.h>
#include <mesh/traits/tnlStorageTraits.h>
#include <mesh/traits/tnlMeshTraits.h>
#include <mesh/traits/tnlMeshTraits.h>
#include <mesh/traits/tnlMeshSuperentitiesTraits.h>
#include <mesh/traits/tnlMeshSuperentityTraits.h>

template< typename MeshConfig,
          typename EntityTag,
          typename DimensionsTag,
          typename SuperentityStorageTag =
             typename tnlMeshSuperentitiesTraits< MeshConfig,
          bool SuperentityStorage =
             tnlMeshSuperentityTraits< MeshConfig,
                                       EntityTag,
                                                  DimensionsTag >::SuperentityStorageTag >
                                       DimensionsTag::value >::storageEnabled >
class tnlMeshSuperentityStorageLayer;

template< typename MeshConfig,
@@ -49,7 +47,7 @@ template< typename MeshConfig,
class tnlMeshSuperentityStorageLayer< MeshConfig,
                                      EntityTag,
                                      DimensionsTag,
                                      tnlStorageTraits< true > >
                                      true >
   : public tnlMeshSuperentityStorageLayer< MeshConfig,
                                            EntityTag,
                                            typename DimensionsTag::Decrement >
@@ -60,14 +58,14 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
                                      typename DimensionsTag::Decrement >  BaseType;

   typedef
      tnlMeshSuperentitiesTraits< MeshConfig, EntityTag, DimensionsTag >          SuperentityTag;
      tnlMeshSuperentityTraits< MeshConfig, EntityTag, DimensionsTag::value >          SuperentityTraits;

   protected:

   typedef typename SuperentityTag::ContainerType       ContainerType;
   typedef typename SuperentityTag::SharedContainerType SharedContainerType;
   typedef typename ContainerType::ElementType          GlobalIndexType;
   typedef int                                          LocalIndexType;
   typedef typename SuperentityTraits::StorageArrayType       StorageArrayType;
   typedef typename SuperentityTraits::AccessArrayType        AccessArrayType;
   typedef typename SuperentityTraits::GlobalIndexType        GlobalIndexType;
   typedef typename SuperentityTraits::LocalIndexType         LocalIndexType;

   /****
     * Make visible setters and getters of the lower superentities
@@ -130,12 +128,12 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
       return this->superentitiesIndices[ localIndex ];
    }

    SharedContainerType& getSuperentitiesIndices( DimensionsTag )
    AccessArrayType& getSuperentitiesIndices( DimensionsTag )
    {
       return this->sharedSuperentitiesIndices;
    }

    const SharedContainerType& getSuperentitiesIndices( DimensionsTag ) const
    const AccessArrayType& getSuperentitiesIndices( DimensionsTag ) const
    {
       return this->sharedSuperentitiesIndices;
    }
@@ -176,9 +174,9 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,

    private:              

    ContainerType superentitiesIndices;
    StorageArrayType superentitiesIndices;

    SharedContainerType sharedSuperentitiesIndices;
    AccessArrayType sharedSuperentitiesIndices;
    
   // TODO: this is only for the mesh initializer - fix it
   public:
@@ -196,7 +194,7 @@ template< typename MeshConfig,
class tnlMeshSuperentityStorageLayer< MeshConfig,
                                      EntityTag,
                                      DimensionsTag,
                                      tnlStorageTraits< false > >
                                      false >
   : public tnlMeshSuperentityStorageLayer< MeshConfig,
                                            EntityTag,
                                            typename DimensionsTag::Decrement >
@@ -210,18 +208,18 @@ template< typename MeshConfig,
class tnlMeshSuperentityStorageLayer< MeshConfig,
                                      EntityTag,
                                      tnlDimensionsTag< EntityTag::dimensions >,
                                      tnlStorageTraits< false > >
                                      false >
{
   typedef tnlDimensionsTag< EntityTag::dimensions >        DimensionsTag;

   typedef tnlMeshSuperentitiesTraits< MeshConfig,
   typedef tnlMeshSuperentityTraits< MeshConfig,
                                       EntityTag,
                                       DimensionsTag >      SuperentityTag;
                                       DimensionsTag::value >      SuperentityTag;

   typedef tnlMeshSuperentityStorageLayer< MeshConfig,
                                           EntityTag,
                                           DimensionsTag,
                                           tnlStorageTraits< false > > ThisType;
                                           false > ThisType;

   protected:

@@ -275,23 +273,23 @@ template< typename MeshConfig,
class tnlMeshSuperentityStorageLayer< MeshConfig,
                                      EntityTag,
                                      tnlDimensionsTag< EntityTag::dimensions >,
                                      tnlStorageTraits< true > >
                                      true >
{
   typedef tnlDimensionsTag< EntityTag::dimensions >        DimensionsTag;

   typedef tnlMeshSuperentitiesTraits< MeshConfig,
   typedef tnlMeshSuperentityTraits< MeshConfig,
                                       EntityTag,
                                       DimensionsTag >      SuperentityTag;
                                       DimensionsTag::value >      SuperentityTraits;
   typedef tnlMeshSuperentityStorageLayer< MeshConfig,
                                           EntityTag,
                                           DimensionsTag,
                                           tnlStorageTraits< true > > ThisType;
                                           true > ThisType;

   protected:

   typedef typename SuperentityTag::ContainerType              ContainerType;
   typedef typename ContainerType::ElementType                 GlobalIndexType;
   typedef int                                                 LocalIndexType;
   typedef typename SuperentityTraits::StorageArrayType              StorageArrayType;
   typedef typename SuperentityTraits::GlobalIndexType               GlobalIndexType;
   typedef typename SuperentityTraits::LocalIndexType                LocalIndexType;

   /****
    * These methods are due to 'using BaseType::...;' in the derived classes.
@@ -312,9 +310,9 @@ class tnlMeshSuperentityStorageLayer< MeshConfig,
      return true;
   }

   ContainerType& getSuperentitiesIndices(){}
   StorageArrayType& getSuperentitiesIndices(){}

   const ContainerType& getSuperentitiesIndices() const{}
   const StorageArrayType& getSuperentitiesIndices() const{}

   bool save( tnlFile& file ) const
   {
Loading