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

Fixing missing superentities of vertices.

parent c88de206
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
#include <mesh/initializer/tnlMeshSuperentityStorageInitializer.h>
#include <mesh/initializer/tnlMeshSubentitySeedCreator.h>

#include "tnlMeshEntitySeed.h"

template< typename MeshConfig >
class tnlMeshInitializer;

@@ -452,7 +454,13 @@ class tnlMeshEntityInitializerLayer< MeshConfig,
   protected:
      
      static void initSubentities( EntityType& entity, GlobalIndexType entityIndex, const SeedType& entitySeed,
                                   InitializerType& meshInitializer ) {};
                                   InitializerType& meshInitializer )
      {
         //cout << "   Initiating subentities with " << DimensionsTag::value << " dimensions ... " << endl;
		   const IdArrayType &subentityIdsArray = InitializerType::template subentityIdsArray< DimensionsTag >(entity);
		   for( LocalIndexType i = 0; i < subentityIdsArray.getSize(); i++ )
			   meshInitializer.template getSuperentityInitializer< DimensionsTag >().addSuperentity( EntityDimensionsTag(), subentityIdsArray[ i ], entityIndex);
	}

};

+11 −4
Original line number Diff line number Diff line
@@ -53,10 +53,11 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,

   typedef tnlDimensionsTag< EntityTopology::dimensions >                                    EntityDimensions;
	
   typedef typename tnlMeshTraits< MeshConfig >::GlobalIdArrayType                 GlobalIdArrayType;
   typedef tnlMeshTraits< MeshConfig >                                          MeshTraits;
   typedef typename MeshTraits::GlobalIdArrayType                               GlobalIdArrayType;

      
   typedef typename tnlMeshTraits< MeshConfig >::GlobalIndexType                   GlobalIndexType;
   typedef typename MeshTraits::GlobalIndexType                                 GlobalIndexType;
   typedef tnlMeshInitializer< MeshConfig >                                              MeshInitializer;

   public:      
@@ -64,6 +65,7 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
	   
      void addSuperentity( DimensionsTag, GlobalIndexType entityIndex, GlobalIndexType superentityIndex)
      {
         //cout << "Adding superentity with " << DimensionsTag::value << " dimensions of enity with " << EntityDimensions::value << " ... " << endl;
         indexPairs.push_back( IndexPair{ entityIndex, superentityIndex } );
      }

@@ -78,7 +80,7 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
         superentityIdsArray.setSize( static_cast< GlobalIndexType >( indexPairs.size() )  );
         GlobalIndexType currentBegin = 0;
         GlobalIndexType lastEntityIndex = 0;
         //cout << "There are " << superentityIdsArray.getSize() << " superentities..." << endl;
         cout << "There are " << superentityIdsArray.getSize() << " superentities with " << DimensionsTag::value << " dimensions of enities with " << EntityDimensions::value << " ... " << endl;
         for( GlobalIndexType i = 0; i < superentityIdsArray.getSize(); i++)
         {
            superentityIdsArray[ i ] = indexPairs[i].superentityIndex;
@@ -95,6 +97,11 @@ class tnlMeshSuperentityStorageInitializerLayer< MeshConfig,
         meshInitializer.template superentityIdsArray< DimensionsTag >( meshInitializer.template meshEntitiesArray< EntityDimensions >()[ lastEntityIndex ] ).bind( superentityIdsArray, currentBegin, superentityIdsArray.getSize() - currentBegin );
         indexPairs.clear();
         
         /****
          * Network initializer
          */
         

         BaseType::initSuperentities( meshInitializer );
      }

+4 −2
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ class tnlMeshStorageLayer< MeshConfig,
            entities[ i ].print( str );
            str << endl;
         }
         SuperentityStorageBaseType::print( str );
      }

      bool operator==( const tnlMeshStorageLayer& meshLayer ) const
@@ -286,6 +287,7 @@ class tnlMeshStorageLayer< MeshConfig, tnlDimensionsTag< 0 >, true > :
      {
         str << i << vertices[ i ] << endl;
      }
      SuperentityStorageBaseType::print( str );
   }

   bool operator==( const tnlMeshStorageLayer& meshLayer ) const
+1 −1
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ class tnlMeshSubentityStorageLayer< MeshConfig,
      this->verticesIndices[ localIndex ] = globalIndex;
   }

   IdArrayType& subentityIdsArray( DimensionsTag ) { return this->subentitiesIndices; }
   IdArrayType& subentityIdsArray( DimensionsTag ) { return this->verticesIndices; }
   
   protected:
      
+3 −3
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ class tnlMeshSuperentityAccess :
                                         tnlDimensionsTag< tnlMeshTraits< MeshConfig >::meshDimensions > >
{
   public:
      
      bool operator == ( const tnlMeshSuperentityAccess< MeshConfig, MeshEntity>& a ) const { return true; } // TODO: fix
      
      void print( ostream& str ) const{};
@@ -57,11 +58,10 @@ class tnlMeshSuperentityAccessLayer< MeshConfig,
   public:
      
      typedef tnlMeshTraits< MeshConfig >                                   MeshTraits;
      typedef typename MeshTraits::template SuperentityTraits< MeshEntity, Dimensions > SuperentityTraits;
      typedef typename MeshTraits::template SuperentityTraits< MeshEntity, Dimensions::value > SuperentityTraits;
      typedef typename SuperentityTraits::SuperentityAccessorType               SuperentityAccessorType;
	   typedef typename tnlMeshTraits< MeshConfig >::IdArrayAccessorType    IdArrayAccessorType;            


	   using BaseType::superentityIds;
	   IdArrayAccessorType superentityIds( Dimensions ) const { return m_superentityIndices; }

Loading