diff --git a/dune/alugrid/3d/alugrid.hh b/dune/alugrid/3d/alugrid.hh index 47cc701024c90d08c1d56bf16c4ae55a372745af..7772023aa83d2a39476742b3dba7a89cf99bd6b9 100644 --- a/dune/alugrid/3d/alugrid.hh +++ b/dune/alugrid/3d/alugrid.hh @@ -39,7 +39,7 @@ namespace Dune public: //! type of boundary projection - typedef typename BaseType :: ALUGridVertexProjectionPointerType ALUGridVertexProjectionPointerType; + typedef typename BaseType :: ALUGridVertexProjectionPairType ALUGridVertexProjectionPairType; enum { dimension=BaseType::dimension, dimensionworld=BaseType::dimensionworld}; static const ALUGridRefinementType refinementType = refineType; @@ -67,7 +67,7 @@ namespace Dune //! stdout. ALUGrid(const std::string macroName, const MPICommunicatorType mpiComm = BaseType::defaultCommunicator(), - const ALUGridVertexProjectionPointerType& bndPrj = ALUGridVertexProjectionPointerType(), + const ALUGridVertexProjectionPairType& bndPrj = ALUGridVertexProjectionPairType(), const bool verb = true ) : BaseType(macroName, mpiComm, bndPrj, refineType ) { @@ -101,7 +101,7 @@ namespace Dune //! \param verb Whether to write a notice about grid creation to //! stdout. ALUGrid(const MPICommunicatorType mpiComm, - const ALUGridVertexProjectionPointerType& bndPrj, + const ALUGridVertexProjectionPairType& bndPrj, const std::string macroName, const bool verb = true ) : BaseType("", mpiComm, bndPrj, refineType ) @@ -120,7 +120,7 @@ namespace Dune //! constructor creating empty grid, empty string creates empty grid ALUGrid(const MPICommunicatorType mpiComm = BaseType::defaultCommunicator()) : - BaseType("", mpiComm, ALUGridVertexProjectionPointerType(), refineType ) + BaseType("", mpiComm, ALUGridVertexProjectionPairType(), refineType ) { if(this->comm().rank() == 0) { diff --git a/dune/alugrid/3d/grid.hh b/dune/alugrid/3d/grid.hh index 8b0eb82e8756dfbd672ee4df34678ed348a22f13..583576f696c65a5fd06c0fe351724f9ed797668c 100644 --- a/dune/alugrid/3d/grid.hh +++ b/dune/alugrid/3d/grid.hh @@ -642,7 +642,7 @@ namespace Dune //! or given GridFile ALU3dGrid ( const std::string ¯oTriangFilename, const MPICommunicatorType mpiComm, - const ALUGridVertexProjectionPointerType& bndPrj, + const ALUGridVertexProjectionPairType& bndPrj, const ALUGridRefinementType refinementType ); //! \brief Desctructor @@ -1154,7 +1154,7 @@ namespace Dune ALUGridVertexProjectionPairType vertexProjections() const { - return std::make_pair( vertexProjection_, nullptr ); + return vertexProjections_ ; } // return appropriate ALUGrid builder @@ -1367,7 +1367,9 @@ namespace Dune bool lockPostAdapt_; // boundary projection for vertices - ALUGridVertexProjectionPointerType vertexProjection_ ; + // pair: first is globalProjection_ for boundaries + // second is surfaceProjection_ for manifolds + ALUGridVertexProjectionPairType vertexProjections_ ; // pointer to communications object std::unique_ptr< Communications > communications_; diff --git a/dune/alugrid/3d/grid_inline.hh b/dune/alugrid/3d/grid_inline.hh index ded23fad62fdd5331a6735ccf8d0cefe2f71c8e8..5a47e23004fbe8987eb2f0588a082dcb03b5674c 100644 --- a/dune/alugrid/3d/grid_inline.hh +++ b/dune/alugrid/3d/grid_inline.hh @@ -21,7 +21,7 @@ namespace Dune inline ALU3dGrid< dim, dimworld, elType, Comm > ::ALU3dGrid ( const std::string ¯oTriangFilename, const MPICommunicatorType mpiComm, - const ALUGridVertexProjectionPointerType& bndPrj, + const ALUGridVertexProjectionPairType& bndPrj, const ALUGridRefinementType refinementType ) : mygrid_() , maxlevel_( 0 ) @@ -34,7 +34,7 @@ namespace Dune , levelIndexVec_( 1, nullptr ) , leafIndexSet_() , sizeCache_ () , lockPostAdapt_( false ) - , vertexProjection_( bndPrj ) + , vertexProjections_( bndPrj ) , communications_( new Communications( mpiComm ) ) , refinementType_( refinementType ) { diff --git a/dune/alugrid/3d/gridfactory.cc b/dune/alugrid/3d/gridfactory.cc index efb482c8f42e98e8f4cd88751cbd6868896a1605..c87a70b14d69a98cf3d3a191bfb139c557a17cc7 100644 --- a/dune/alugrid/3d/gridfactory.cc +++ b/dune/alugrid/3d/gridfactory.cc @@ -203,16 +203,23 @@ namespace Dune template< class ALUGrid > alu_inline void ALU3dGridFactory< ALUGrid > :: - insertBoundaryProjection( const DuneBoundaryProjectionType& bndProjection, const bool projectInside) + insertBoundaryProjection( const DuneBoundaryProjectionType& bndProjection, const bool isSurfaceProjection ) { #ifndef NDEBUG - std::cout << "Project Inner Vertices:" << std::boolalpha << projectInside << std::endl << std::endl; + std::cout << "Inserting Surface Projection:" << std::boolalpha << isSurfaceProjection << std::endl << std::endl; #endif - if( globalProjection_ ) - DUNE_THROW(InvalidStateException,"You can only insert one globalProjection"); - - projectInside_ = projectInside; - globalProjection_ = &bndProjection; + if( isSurfaceProjection ) + { + if( surfaceProjection_ ) + DUNE_THROW(InvalidStateException,"You can only insert one Surface Projection"); + surfaceProjection_ = &bndProjection; + } + else + { + if( globalProjection_ ) + DUNE_THROW(InvalidStateException,"You can only insert one global boundary Projection"); + globalProjection_ = &bndProjection; + } } @@ -705,10 +712,8 @@ namespace Dune globalProjection.reset( new Projection( globalProjection_, Projection::global ) ); } - // TODO: create new pointer for specific surface projection - const DuneBoundaryProjectionType* surfaceProjection_ = globalProjection_; ALU3DSPACE ProjectVertexPtr surfaceProjection; - if( projectInside_ ) + if( surfaceProjection_ ) { surfaceProjection.reset( new Projection( surfaceProjection_, Projection::surface ) ); } @@ -734,8 +739,8 @@ namespace Dune { pv.reset( new Projection( projection, Projection::segment ) ); } - else if( ((it->second == int(ALU3DSPACE Gitter::hbndseg_STI::closure_2d)) == projectInside_) - && surfaceProjection ) + else if( (it->second == int(ALU3DSPACE Gitter::hbndseg_STI::closure_2d) + && surfaceProjection ) ) { pv = surfaceProjection; } diff --git a/dune/alugrid/3d/gridfactory.hh b/dune/alugrid/3d/gridfactory.hh index 12d3241f3ee89aaa7595b9a66bcd486a22b8f572..bad8e7c2ad176a52c26e6357cf2e5a922cb1dd5d 100644 --- a/dune/alugrid/3d/gridfactory.hh +++ b/dune/alugrid/3d/gridfactory.hh @@ -156,7 +156,9 @@ namespace Dune virtual Grid* createGridObj( const std::string& name ) const { typedef ALUGridBoundaryProjection2< Grid > Projection ; - ALU3DSPACE ProjectVertexPtr pv( new Projection( globalProjection_, Projection::global ) ); + ALU3DSPACE ProjectVertexPtr gpv( new Projection( globalProjection_, Projection::global ) ); + ALU3DSPACE ProjectVertexPtr spv( new Projection( surfaceProjection_, Projection::surface ) ); + ALU3DSPACE ProjectVertexPtrPair pv = std::make_pair( gpv, spv ); return new Grid( communicator_, pv, name, realGrid_ ); } @@ -267,7 +269,7 @@ namespace Dune * * \param[in] bndProjection instance of an ALUGridBoundaryProjection projecting vertices to a curved */ - virtual void insertBoundaryProjection ( const DuneBoundaryProjectionType& bndProjection, const bool projectInside = (dimension != dimensionworld) ); + virtual void insertBoundaryProjection ( const DuneBoundaryProjectionType& bndProjection, const bool isSurfaceProjection = (dimension != dimensionworld) ); /** \brief add a face transformation (for periodic identification) * @@ -404,8 +406,8 @@ namespace Dune ElementVector elements_; BoundaryIdMap boundaryIds_,insertionOrder_; PeriodicBoundaryVector periodicBoundaries_; - bool projectInside_; const DuneBoundaryProjectionType* globalProjection_ ; + const DuneBoundaryProjectionType* surfaceProjection_ ; BoundaryProjectionMap boundaryProjections_; FaceTransformationVector faceTransformations_; unsigned int numFacesInserted_; @@ -517,8 +519,8 @@ namespace Dune :: ALU3dGridFactory ( const MPICommunicatorType &communicator, bool removeGeneratedFile ) : rank_( ALU3dGridCommunications< ALUGrid::dimension, ALUGrid::dimensionworld, elementType, MPICommunicatorType >::getRank( communicator ) ), - projectInside_(false), globalProjection_ ( 0 ), + surfaceProjection_ ( 0 ), numFacesInserted_ ( 0 ), realGrid_( true ), allowGridGeneration_( rank_ == 0 ), @@ -537,8 +539,8 @@ namespace Dune :: ALU3dGridFactory ( const std::string &filename, const MPICommunicatorType &communicator ) : rank_( ALU3dGridCommunications< ALUGrid::dimension, ALUGrid::dimensionworld, elementType, MPICommunicatorType >::getRank( communicator ) ), - projectInside_(false), globalProjection_ ( 0 ), + surfaceProjection_ ( 0 ), numFacesInserted_ ( 0 ), realGrid_( true ), allowGridGeneration_( rank_ == 0 ), @@ -557,8 +559,8 @@ namespace Dune :: ALU3dGridFactory ( const bool realGrid, const MPICommunicatorType &communicator ) : rank_( ALU3dGridCommunications< ALUGrid::dimension, ALUGrid::dimensionworld, elementType, MPICommunicatorType >::getRank( communicator ) ), - projectInside_(false), globalProjection_ ( 0 ), + surfaceProjection_ ( 0 ), numFacesInserted_ ( 0 ), realGrid_( realGrid ), allowGridGeneration_( true ), diff --git a/dune/alugrid/dgf.hh b/dune/alugrid/dgf.hh index f52ad8151aa2f7bff02a9caa586d4772efdb4232..2049530a288ea21f9b239e7cb34e03abc697a905 100644 --- a/dune/alugrid/dgf.hh +++ b/dune/alugrid/dgf.hh @@ -537,17 +537,12 @@ namespace Dune const DuneBoundaryProjection< dimworld > *projection = projectionBlock.defaultProjection< dimworld >(); - //True, if we want to project inner vertices - const bool projectInside = (dimworld != dimgrid); - //True, if we want to project boundary vertices - const bool projectBoundary = (projection != 0); - - //Currently, we only allow ONE global projection, so - //we just insert this projection once - //If we want to allow multiple projections, - //we need to change the dgf parser first. - if( projectBoundary ) - factory_.insertBoundaryProjection( *projection, projectInside ); + //There is currently only the possibility to insert one + //surface OR a global BOUNDARY projection + //This is done via a second argument bool + //that defaults to dimgrid != dimworld + if( projection ) + factory_.insertBoundaryProjection( *projection ); const size_t numBoundaryProjections = projectionBlock.numBoundaryProjections(); GeometryType type( faceTopoId, dimgrid-1 );