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
};
// 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 >
struct ALU3dGridCommunications;
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 int GlobalId;
......@@ -154,19 +134,14 @@ namespace Dune
const bool conformingRefinement )
{
GitterImplType* grid = ( macroName.empty() ) ?
new GitterImplType( dim ) : new GitterImplType ( dim, macroName.c_str(), projections );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
new GitterImplType( dim, conformingRefinement ) : new GitterImplType ( dim, conformingRefinement, macroName.c_str(), projections );
return grid ;
}
GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projection,
const bool conformingRefinement )
{
GitterImplType* grid = new GitterImplType ( dim, stream, projection );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
return grid ;
return new GitterImplType ( dim, conformingRefinement, stream, projection );
}
static ALUGridNoComm defaultComm () { return ALUGridNoComm(); }
......@@ -192,10 +167,8 @@ namespace Dune
#if ALU3DGRID_PARALLEL
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 ALUGridId< ALUMacroKey > GlobalId;
......@@ -212,19 +185,13 @@ namespace Dune
GitterImplType *createALUGrid ( const std::string &macroName, const ALU3DSPACE ProjectVertexPtrPair& projections,
const bool conformingRefinement )
{
GitterImplType* grid = new GitterImplType( dim, macroName.c_str(), mpAccess_, projections );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
return grid;
return new GitterImplType( dim, conformingRefinement, macroName.c_str(), mpAccess_, projections );
}
GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projections,
const bool conformingRefinement )
{
GitterImplType* grid = new GitterImplType ( dim, stream, mpAccess_, projections );
// check whether conforming refinement should be enabled
checkForConformingRefinement( grid, conformingRefinement );
return grid ;
return new GitterImplType ( dim, conformingRefinement, stream, mpAccess_, projections );
}
static MPI_Comm defaultComm () { return MPI_COMM_WORLD; }
......
......@@ -86,6 +86,15 @@ namespace ALUGrid
// read status of grid istream
virtual void restore ( std::istream &in ) { restoreImpl(in, true ); }
protected:
void checkForConformingRefinement( const bool conformingRefinement )
{
if( conformingRefinement )
{
this->enableConformingClosure();
this->disableGhostCells();
}
}
void restoreImpl( std::istream &in, const bool restoreBndFaces );
};
......@@ -96,22 +105,30 @@ namespace ALUGrid
virtual IteratorSTI < Gitter::helement_STI > * leafIterator (const IteratorSTI < Gitter::helement_STI > *);
friend class PureElementLeafIterator < Gitter::helement_STI >;
using GitterDuneBasis :: checkForConformingRefinement;
public:
//! 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 )
{}
{
checkForConformingRefinement( conformingRefinement );
}
//! 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 )
{}
{
checkForConformingRefinement( conformingRefinement );
}
//! constructor creating empty grid
explicit GitterDuneImpl ( const int dim )
explicit GitterDuneImpl ( const int dim, const bool conformingRefinement )
: GitterBasisImpl ( dim )
{}
{
checkForConformingRefinement( conformingRefinement );
}
// compress memory of given grid and return new object (holding equivalent information)
static GitterDuneImpl* compress( GitterDuneImpl* grd )
......@@ -127,7 +144,7 @@ namespace ALUGrid
// free allocated memory (only works if all grids are deleted at this point)
MyAlloc::clearFreeMemory ();
// restore saved grid
grd = new GitterDuneImpl( grd->dimension(), backup );
grd = new GitterDuneImpl( grd->dimension(), grd->conformingClosureNeeded(), backup );
alugrid_assert ( grd );
grd->restore( backup );
}
......
......@@ -24,6 +24,8 @@ namespace ALUGrid
leafIterator (const IteratorSTI < Gitter::helement_STI > *);
friend class PackUnpackInteriorGhostData ;
using GitterDuneBasis :: checkForConformingRefinement;
protected:
bool balanceGrid_;
......@@ -46,28 +48,34 @@ namespace ALUGrid
typedef GitterBasisPll::ObjectsPll Objects;
// 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 ),
balanceGrid_ ( false )
{
// check and set conforming refinement if true
checkForConformingRefinement( conformingRefinement );
// build ghost cells after the macro grid has been assembled
rebuildGhostCells();
}
// 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 ),
balanceGrid_( false )
{
// check and set conforming refinement if true
checkForConformingRefinement( conformingRefinement );
// build ghost cells after the macro grid has been assembled
rebuildGhostCells();
}
// constructor creating empty grid
GitterDunePll (const int dim, MpAccessLocal &mp)
GitterDunePll (const int dim, const bool conformingRefinement, MpAccessLocal &mp)
: GitterBasisPll (dim, "", mp, ProjectVertexPtrPair() )
, balanceGrid_ (false)
{
// check and set conforming refinement if true
checkForConformingRefinement( conformingRefinement );
// build ghost cells after the macro grid has been assembled
rebuildGhostCells();
}
......@@ -151,7 +159,7 @@ namespace ALUGrid
// free allocated memory (only works if all grids are deleted at this point)
MyAlloc::clearFreeMemory ();
// restore saved grid
grd = new GitterDunePll( grd->dimension(), backup, mpa );
grd = new GitterDunePll( grd->dimension(), grd->conformingClosureNeeded(), backup, mpa );
alugrid_assert ( grd );
grd->restore( backup );
......
......@@ -548,10 +548,8 @@ namespace ALUGrid
typedef typename Gitter::GhostChildrenInfo GhostChildrenInfo;
GhostChildrenInfo ghostInfo;
// ghostInfo is filled by splitGhost, see gitter_tetra_top_pll.h
if( this->myhface(0)-> myvertex( 0 )->myGrid()->ghostCellsEnabled() )
{
this->splitGhost( ghostInfo );
}
//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) ) ;
......
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