Commit 08472516 authored by Robert K's avatar Robert K

[bugfix][GonformingGrids] conforming closure and disabling ghost cells

has to be done before ghost cells are rebuild during restore.
parent d2f643c1
Pipeline #17640 failed with stage
in 41 minutes and 31 seconds
...@@ -113,32 +113,12 @@ namespace Dune ...@@ -113,32 +113,12 @@ namespace Dune
}; };
// ALU3dGridCommunications
// -----------------------
struct ALU3dGridCommunicationsBase
{
template < class GitterImpl >
void checkForConformingRefinement( GitterImpl* grid,
const bool conformingRefinement )
{
if( grid && conformingRefinement )
{
grid->enableConformingClosure();
grid->disableGhostCells();
}
}
};
template< int dim, int dimworld, ALU3dGridElementType elType, class Comm > template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
struct ALU3dGridCommunications; struct ALU3dGridCommunications;
template< int dim, int dimworld, ALU3dGridElementType elType > template< int dim, int dimworld, ALU3dGridElementType elType >
struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridNoComm > : public ALU3dGridCommunicationsBase struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridNoComm >
{ {
using ALU3dGridCommunicationsBase :: checkForConformingRefinement ;
typedef ALU3dGridLocalIdSet< dim, dimworld, elType, ALUGridNoComm > GlobalIdSet; typedef ALU3dGridLocalIdSet< dim, dimworld, elType, ALUGridNoComm > GlobalIdSet;
typedef int GlobalId; typedef int GlobalId;
...@@ -154,19 +134,14 @@ namespace Dune ...@@ -154,19 +134,14 @@ namespace Dune
const bool conformingRefinement ) const bool conformingRefinement )
{ {
GitterImplType* grid = ( macroName.empty() ) ? GitterImplType* grid = ( macroName.empty() ) ?
new GitterImplType( dim ) : new GitterImplType ( dim, macroName.c_str(), projections ); new GitterImplType( dim, conformingRefinement ) : new GitterImplType ( dim, conformingRefinement, macroName.c_str(), projections );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
return grid ; return grid ;
} }
GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projection, GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projection,
const bool conformingRefinement ) const bool conformingRefinement )
{ {
GitterImplType* grid = new GitterImplType ( dim, stream, projection ); return new GitterImplType ( dim, conformingRefinement, stream, projection );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
return grid ;
} }
static ALUGridNoComm defaultComm () { return ALUGridNoComm(); } static ALUGridNoComm defaultComm () { return ALUGridNoComm(); }
...@@ -192,10 +167,8 @@ namespace Dune ...@@ -192,10 +167,8 @@ namespace Dune
#if ALU3DGRID_PARALLEL #if ALU3DGRID_PARALLEL
template< int dim, int dimworld, ALU3dGridElementType elType > template< int dim, int dimworld, ALU3dGridElementType elType >
struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridMPIComm > : public ALU3dGridCommunicationsBase struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridMPIComm >
{ {
using ALU3dGridCommunicationsBase :: checkForConformingRefinement ;
typedef ALU3dGridGlobalIdSet< dim, dimworld, elType, ALUGridMPIComm > GlobalIdSet; typedef ALU3dGridGlobalIdSet< dim, dimworld, elType, ALUGridMPIComm > GlobalIdSet;
typedef ALUGridId< ALUMacroKey > GlobalId; typedef ALUGridId< ALUMacroKey > GlobalId;
...@@ -212,19 +185,13 @@ namespace Dune ...@@ -212,19 +185,13 @@ namespace Dune
GitterImplType *createALUGrid ( const std::string &macroName, const ALU3DSPACE ProjectVertexPtrPair& projections, GitterImplType *createALUGrid ( const std::string &macroName, const ALU3DSPACE ProjectVertexPtrPair& projections,
const bool conformingRefinement ) const bool conformingRefinement )
{ {
GitterImplType* grid = new GitterImplType( dim, macroName.c_str(), mpAccess_, projections ); return new GitterImplType( dim, conformingRefinement, macroName.c_str(), mpAccess_, projections );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
return grid;
} }
GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projections, GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projections,
const bool conformingRefinement ) const bool conformingRefinement )
{ {
GitterImplType* grid = new GitterImplType ( dim, stream, mpAccess_, projections ); return new GitterImplType ( dim, conformingRefinement, stream, mpAccess_, projections );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
return grid ;
} }
static MPI_Comm defaultComm () { return MPI_COMM_WORLD; } static MPI_Comm defaultComm () { return MPI_COMM_WORLD; }
......
...@@ -86,6 +86,15 @@ namespace ALUGrid ...@@ -86,6 +86,15 @@ namespace ALUGrid
// read status of grid istream // read status of grid istream
virtual void restore ( std::istream &in ) { restoreImpl(in, true ); } virtual void restore ( std::istream &in ) { restoreImpl(in, true ); }
protected: protected:
void checkForConformingRefinement( const bool conformingRefinement )
{
if( conformingRefinement )
{
this->enableConformingClosure();
this->disableGhostCells();
}
}
void restoreImpl( std::istream &in, const bool restoreBndFaces ); void restoreImpl( std::istream &in, const bool restoreBndFaces );
}; };
...@@ -96,22 +105,30 @@ namespace ALUGrid ...@@ -96,22 +105,30 @@ namespace ALUGrid
virtual IteratorSTI < Gitter::helement_STI > * leafIterator (const IteratorSTI < Gitter::helement_STI > *); virtual IteratorSTI < Gitter::helement_STI > * leafIterator (const IteratorSTI < Gitter::helement_STI > *);
friend class PureElementLeafIterator < Gitter::helement_STI >; friend class PureElementLeafIterator < Gitter::helement_STI >;
using GitterDuneBasis :: checkForConformingRefinement;
public: public:
//! constructor creating grid from std::istream //! constructor creating grid from std::istream
GitterDuneImpl ( const int dim, std::istream &in, const ProjectVertexPtrPair& ppv = ProjectVertexPtrPair() ) GitterDuneImpl ( const int dim, const bool conformingRefinement, std::istream &in, const ProjectVertexPtrPair& ppv = ProjectVertexPtrPair() )
: GitterBasisImpl ( dim, in, ppv ) : GitterBasisImpl ( dim, in, ppv )
{} {
checkForConformingRefinement( conformingRefinement );
}
//! constructor creating grid from macro grid file //! constructor creating grid from macro grid file
inline GitterDuneImpl (const int dim, const char *filename, const ProjectVertexPtrPair& ppv = ProjectVertexPtrPair() ) inline GitterDuneImpl (const int dim, const bool conformingRefinement, const char *filename, const ProjectVertexPtrPair& ppv = ProjectVertexPtrPair() )
: GitterBasisImpl ( dim, filename, ppv ) : GitterBasisImpl ( dim, filename, ppv )
{} {
checkForConformingRefinement( conformingRefinement );
}
//! constructor creating empty grid //! constructor creating empty grid
explicit GitterDuneImpl ( const int dim ) explicit GitterDuneImpl ( const int dim, const bool conformingRefinement )
: GitterBasisImpl ( dim ) : GitterBasisImpl ( dim )
{} {
checkForConformingRefinement( conformingRefinement );
}
// compress memory of given grid and return new object (holding equivalent information) // compress memory of given grid and return new object (holding equivalent information)
static GitterDuneImpl* compress( GitterDuneImpl* grd ) static GitterDuneImpl* compress( GitterDuneImpl* grd )
...@@ -127,7 +144,7 @@ namespace ALUGrid ...@@ -127,7 +144,7 @@ namespace ALUGrid
// free allocated memory (only works if all grids are deleted at this point) // free allocated memory (only works if all grids are deleted at this point)
MyAlloc::clearFreeMemory (); MyAlloc::clearFreeMemory ();
// restore saved grid // restore saved grid
grd = new GitterDuneImpl( grd->dimension(), backup ); grd = new GitterDuneImpl( grd->dimension(), grd->conformingClosureNeeded(), backup );
alugrid_assert ( grd ); alugrid_assert ( grd );
grd->restore( backup ); grd->restore( backup );
} }
......
...@@ -24,6 +24,8 @@ namespace ALUGrid ...@@ -24,6 +24,8 @@ namespace ALUGrid
leafIterator (const IteratorSTI < Gitter::helement_STI > *); leafIterator (const IteratorSTI < Gitter::helement_STI > *);
friend class PackUnpackInteriorGhostData ; friend class PackUnpackInteriorGhostData ;
using GitterDuneBasis :: checkForConformingRefinement;
protected: protected:
bool balanceGrid_; bool balanceGrid_;
...@@ -46,28 +48,34 @@ namespace ALUGrid ...@@ -46,28 +48,34 @@ namespace ALUGrid
typedef GitterBasisPll::ObjectsPll Objects; typedef GitterBasisPll::ObjectsPll Objects;
// constructor taking filename containing the macro grid // constructor taking filename containing the macro grid
GitterDunePll ( const int dim, const char * filename, MpAccessLocal &mp, const ProjectVertexPtrPair &ppv = ProjectVertexPtrPair() ) GitterDunePll ( const int dim, const bool conformingRefinement, const char * filename, MpAccessLocal &mp, const ProjectVertexPtrPair &ppv = ProjectVertexPtrPair() )
: GitterBasisPll( dim, filename, mp, ppv ), : GitterBasisPll( dim, filename, mp, ppv ),
balanceGrid_ ( false ) balanceGrid_ ( false )
{ {
// check and set conforming refinement if true
checkForConformingRefinement( conformingRefinement );
// build ghost cells after the macro grid has been assembled // build ghost cells after the macro grid has been assembled
rebuildGhostCells(); rebuildGhostCells();
} }
// constructor taking std::istream containing the macro grid // constructor taking std::istream containing the macro grid
GitterDunePll ( const int dim, std::istream &in, MpAccessLocal &mp, const ProjectVertexPtrPair &ppv = ProjectVertexPtrPair() ) GitterDunePll ( const int dim, const bool conformingRefinement, std::istream &in, MpAccessLocal &mp, const ProjectVertexPtrPair &ppv = ProjectVertexPtrPair() )
: GitterBasisPll( dim, in, mp, ppv ), : GitterBasisPll( dim, in, mp, ppv ),
balanceGrid_( false ) balanceGrid_( false )
{ {
// check and set conforming refinement if true
checkForConformingRefinement( conformingRefinement );
// build ghost cells after the macro grid has been assembled // build ghost cells after the macro grid has been assembled
rebuildGhostCells(); rebuildGhostCells();
} }
// constructor creating empty grid // constructor creating empty grid
GitterDunePll (const int dim, MpAccessLocal &mp) GitterDunePll (const int dim, const bool conformingRefinement, MpAccessLocal &mp)
: GitterBasisPll (dim, "", mp, ProjectVertexPtrPair() ) : GitterBasisPll (dim, "", mp, ProjectVertexPtrPair() )
, balanceGrid_ (false) , balanceGrid_ (false)
{ {
// check and set conforming refinement if true
checkForConformingRefinement( conformingRefinement );
// build ghost cells after the macro grid has been assembled // build ghost cells after the macro grid has been assembled
rebuildGhostCells(); rebuildGhostCells();
} }
...@@ -151,7 +159,7 @@ namespace ALUGrid ...@@ -151,7 +159,7 @@ namespace ALUGrid
// free allocated memory (only works if all grids are deleted at this point) // free allocated memory (only works if all grids are deleted at this point)
MyAlloc::clearFreeMemory (); MyAlloc::clearFreeMemory ();
// restore saved grid // restore saved grid
grd = new GitterDunePll( grd->dimension(), backup, mpa ); grd = new GitterDunePll( grd->dimension(), grd->conformingClosureNeeded(), backup, mpa );
alugrid_assert ( grd ); alugrid_assert ( grd );
grd->restore( backup ); grd->restore( backup );
......
...@@ -548,10 +548,8 @@ namespace ALUGrid ...@@ -548,10 +548,8 @@ namespace ALUGrid
typedef typename Gitter::GhostChildrenInfo GhostChildrenInfo; typedef typename Gitter::GhostChildrenInfo GhostChildrenInfo;
GhostChildrenInfo ghostInfo; GhostChildrenInfo ghostInfo;
// ghostInfo is filled by splitGhost, see gitter_tetra_top_pll.h // ghostInfo is filled by splitGhost, see gitter_tetra_top_pll.h
if( this->myhface(0)-> myvertex( 0 )->myGrid()->ghostCellsEnabled() ) this->splitGhost( ghostInfo );
{
this->splitGhost( ghostInfo );
}
//int gFace = this->getGhost().second ; //int gFace = this->getGhost().second ;
innerbndseg_t * b0 = new innerbndseg_t (l, subface (0,0), twist (0), this , _bt, ghostInfo.child(0), ghostInfo.face(0) ) ; innerbndseg_t * b0 = new innerbndseg_t (l, subface (0,0), twist (0), this , _bt, ghostInfo.child(0), ghostInfo.face(0) ) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment