Commit a5959f74 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Removed useless shortcuts from Mesh

parent dadc0a42
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -80,12 +80,6 @@ class Mesh
      template< int Dimension >
      const EntityType< Dimension >& getEntity( const GlobalIndexType& entityIndex ) const;

      GlobalIndexType getCellsCount() const;

      CellType& getCell( const GlobalIndexType& entityIndex );

      const CellType& getCell( const GlobalIndexType& entityIndex ) const;

      bool save( File& file ) const;

      bool load( File& file );
+0 −24
Original line number Diff line number Diff line
@@ -100,30 +100,6 @@ getEntity( const GlobalIndexType& entityIndex ) const
   return StorageBaseType::getEntity( DimensionTag< Dimension >(), entityIndex );
}

template< typename MeshConfig >
typename Mesh< MeshConfig >::GlobalIndexType
Mesh< MeshConfig >::
getCellsCount() const
{
   return this->template getEntitiesCount< getMeshDimension() >();
}

template< typename MeshConfig >
typename Mesh< MeshConfig >::CellType&
Mesh< MeshConfig >::
getCell( const GlobalIndexType& cellIndex )
{
   return this->template getEntity< getMeshDimension() >( cellIndex );
}

template< typename MeshConfig >
const typename Mesh< MeshConfig >::CellType&
Mesh< MeshConfig >::
getCell( const GlobalIndexType& cellIndex ) const
{
   return this->template getEntity< getMeshDimension() >( cellIndex );
}

template< typename MeshConfig >
bool
Mesh< MeshConfig >::
+12 −12
Original line number Diff line number Diff line
@@ -252,18 +252,18 @@ class MeshInitializerLayer< MeshConfig,
              cell < this->getMesh().template getEntitiesCount< typename MeshType::Cell >();
              cell++ )
            for( LocalIndexType i = 0;
                 i < this->getMesh().getCell( cell ).getVerticesCount();
                 i < this->getMesh().template getEntity< MeshType::getMeshDimension() >( cell ).getVerticesCount();
                 i++ )
            {
               if( this->getMesh().getCell( cell ).getVertexIndex( i ) == - 1 )
               if( this->getMesh().template getEntity< MeshType::getMeshDimension() >( cell ).getVertexIndex( i ) == - 1 )
               {
                  std::cerr << "The cell number " << cell << " does not have properly set vertex index number " << i << "." << std::endl;
                  return false;
               }
               if( this->getMesh().getCell( cell ).getVertexIndex( i ) >= numberOfVertices )
               if( this->getMesh().template getEntity< MeshType::getMeshDimension() >( cell ).getVertexIndex( i ) >= numberOfVertices )
               {
                  std::cerr << "The cell number " << cell << " does not have properly set vertex index number " << i
                       << ". The index " << this->getMesh().getCell( cell ).getVertexIndex( i )
                       << ". The index " << this->getMesh().template getEntity< MeshType::getMeshDimension() >( cell ).getVertexIndex( i )
                       << "is higher than the number of all vertices ( " << numberOfVertices
                       << " )." << std::endl;
                  return false;
@@ -309,9 +309,9 @@ class MeshInitializerLayer< MeshConfig,
         using SubentitySeedsCreator = MeshSubentitySeedsCreator< MeshConfig, Meshes::DimensionTag< MeshType::getMeshDimension() >, DimensionTag >;
         std::set< typename SeedIndexedSet::key_type > seedSet;

         for( GlobalIndexType i = 0; i < mesh.getCellsCount(); i++ )
         for( GlobalIndexType i = 0; i < mesh.template getEntitiesCount< MeshType::getMeshDimension() >(); i++ )
         {
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.getCell( i ), i ) );
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.template getEntity< MeshType::getMeshDimension() >( i ), i ) );
            for( LocalIndexType j = 0; j < subentitySeeds.getSize(); j++ )
               seedSet.insert( subentitySeeds[ j ] );
         }
@@ -332,9 +332,9 @@ class MeshInitializerLayer< MeshConfig,
         initializer.template setNumberOfEntities< DimensionTag::value >( numberOfEntities );

         using SubentitySeedsCreator = MeshSubentitySeedsCreator< MeshConfig, Meshes::DimensionTag< MeshType::getMeshDimension() >, DimensionTag >;
         for( GlobalIndexType i = 0; i < mesh.getCellsCount(); i++ )
         for( GlobalIndexType i = 0; i < mesh.template getEntitiesCount< MeshType::getMeshDimension() >(); i++ )
         {
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.getCell( i ), i ) );
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.template getEntity< MeshType::getMeshDimension() >( i ), i ) );
            for( LocalIndexType j = 0; j < subentitySeeds.getSize(); j++ )
            {
               auto& seed = subentitySeeds[ j ];
@@ -396,9 +396,9 @@ class MeshInitializerLayer< MeshConfig,
         using SubentitySeedsCreator = MeshSubentitySeedsCreator< MeshConfig, Meshes::DimensionTag< MeshType::getMeshDimension() >, DimensionTag >;
         std::set< typename SeedIndexedSet::key_type > seedSet;

         for( GlobalIndexType i = 0; i < mesh.getCellsCount(); i++ )
         for( GlobalIndexType i = 0; i < mesh.template getEntitiesCount< MeshType::getMeshDimension() >(); i++ )
         {
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.getCell( i ), i ) );
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.template getEntity< MeshType::getMeshDimension() >( i ), i ) );
            for( LocalIndexType j = 0; j < subentitySeeds.getSize(); j++ )
               seedSet.insert( subentitySeeds[ j ] );
         }
@@ -420,9 +420,9 @@ class MeshInitializerLayer< MeshConfig,
         this->referenceOrientations.setSize( numberOfEntities );

         using SubentitySeedsCreator = MeshSubentitySeedsCreator< MeshConfig, Meshes::DimensionTag< MeshType::getMeshDimension() >, DimensionTag >;
         for( GlobalIndexType i = 0; i < mesh.getCellsCount(); i++ )
         for( GlobalIndexType i = 0; i < mesh.template getEntitiesCount< MeshType::getMeshDimension() >(); i++ )
         {
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.getCell( i ), i ) );
            auto subentitySeeds = SubentitySeedsCreator::create( initializer.getSubvertices( mesh.template getEntity< MeshType::getMeshDimension() >( i ), i ) );
            for( LocalIndexType j = 0; j < subentitySeeds.getSize(); j++ )
            {
               auto& seed = subentitySeeds[ j ];
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public:
      std::cout << "NOTE: there is no real test, but the file was loaded fine..." << std::endl;

      std::cout << "vertices: " << mesh.template getEntitiesCount< 0 >() << std::endl;
      std::cout << "cells: " << mesh.getCellsCount() << std::endl;
      std::cout << "cells: " << mesh.template getEntitiesCount< MeshType::getMeshDimension() >() << std::endl;

      std::cout << "post-init\t";
      Debugging::printMemoryUsage();
+4 −4
Original line number Diff line number Diff line
@@ -415,12 +415,12 @@ TEST( MeshTest, RegularMeshOfTrianglesTest )
         const IndexType vertex2 = ( j + 1 ) * ( xSize + 1 ) + i;
         const IndexType vertex3 = ( j + 1 ) * ( xSize + 1 ) + i + 1;

         const TriangleMeshEntityType& leftCell = mesh.getCell( cellIdx++ );
         const TriangleMeshEntityType& leftCell = mesh.template getEntity< 2 >( cellIdx++ );
         EXPECT_EQ( leftCell.template getSubentityIndex< 0 >( 0 ), vertex0 );
         EXPECT_EQ( leftCell.template getSubentityIndex< 0 >( 1 ), vertex1 );
         EXPECT_EQ( leftCell.template getSubentityIndex< 0 >( 2 ), vertex2 );

         const TriangleMeshEntityType& rightCell = mesh.getCell( cellIdx++ );
         const TriangleMeshEntityType& rightCell = mesh.template getEntity< 2 >( cellIdx++ );
         EXPECT_EQ( rightCell.template getSubentityIndex< 0 >( 0 ), vertex1 );
         EXPECT_EQ( rightCell.template getSubentityIndex< 0 >( 1 ), vertex2 );
         EXPECT_EQ( rightCell.template getSubentityIndex< 0 >( 2 ), vertex3 );
@@ -516,7 +516,7 @@ TEST( MeshTest, RegularMeshOfQuadrilateralsTest )
         const IndexType vertex2 = ( j + 1 ) * ( xSize + 1 ) + i + 1;
         const IndexType vertex3 = ( j + 1 ) * ( xSize + 1 ) + i;

         const QuadrilateralMeshEntityType& cell = mesh.getCell( cellIdx++ );
         const QuadrilateralMeshEntityType& cell = mesh.template getEntity< 2 >( cellIdx++ );
         EXPECT_EQ( cell.template getSubentityIndex< 0 >( 0 ), vertex0 );
         EXPECT_EQ( cell.template getSubentityIndex< 0 >( 1 ), vertex1 );
         EXPECT_EQ( cell.template getSubentityIndex< 0 >( 2 ), vertex2 );
@@ -633,7 +633,7 @@ TEST( MeshTest, RegularMeshOfHexahedronsTest )
            const IndexType vertex6 = ( k + 1 ) * ( xSize + 1 ) * ( ySize + 1 ) + ( j + 1 ) * ( xSize + 1 ) + i + 1;
            const IndexType vertex7 = ( k + 1 ) * ( xSize + 1 ) * ( ySize + 1 ) + ( j + 1 ) * ( xSize + 1 ) + i;

            const HexahedronMeshEntityType& cell = mesh.getCell( cellIdx++ );
            const HexahedronMeshEntityType& cell = mesh.template getEntity< 3 >( cellIdx++ );
            EXPECT_EQ( cell.template getSubentityIndex< 0 >( 0 ), vertex0 );
            EXPECT_EQ( cell.template getSubentityIndex< 0 >( 1 ), vertex1 );
            EXPECT_EQ( cell.template getSubentityIndex< 0 >( 2 ), vertex2 );