1#ifndef DUNE_ALU3DGRIDGRID_HH
2#define DUNE_ALU3DGRIDGRID_HH
14#include <dune/geometry/referenceelements.hh>
22#include <dune/alugrid/common/typetraits.hh>
25#include <dune/grid/common/boundaryprojection.hh>
26#include <dune/alugrid/common/bndprojection.hh>
27#include <dune/alugrid/common/backuprestore.hh>
28#include <dune/alugrid/common/macrogridview.hh>
29#include <dune/alugrid/common/twists.hh>
32#include "alu3dinclude.hh"
34#include "indexsets.hh"
35#include "datahandle.hh"
37#include <dune/alugrid/3d/communication.hh>
38#include <dune/alugrid/3d/gridview.hh>
51 template<
int cd,
int dim,
class Gr
idImp>
52 class ALU3dGridEntity;
53 template<
int cd, PartitionIteratorType pitype,
class Gr
idImp >
54 class ALU3dGridLevelIterator;
55 template<
int cd,
class Gr
idImp >
56 class ALU3dGridEntityPointerBase;
57 template<
int cd,
class Gr
idImp >
58 class ALU3dGridEntitySeed;
59 template<
int cd,
class Gr
idImp >
60 class ALU3dGridEntityPointer;
61 template<
int mydim,
int coorddim,
class Gr
idImp>
62 class ALU3dGridGeometry;
63 template<
class Gr
idImp>
64 class ALU3dGridHierarchicIterator;
65 template<
class Gr
idImp>
66 class ALU3dGridIntersectionIterator;
67 template<
class Gr
idImp>
68 class ALU3dGridLevelIntersectionIterator;
69 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp>
70 class ALU3dGridLeafIterator;
71 template <
int mydim,
int coorddim,
class Gr
idImp>
72 class ALU3dGridMakeableEntity;
73 template <
class Gr
idImp>
74 class ALU3dGridFaceGeometryInfo;
75 template<
int,
int, ALU3dGr
idElementType,
class >
76 class ALU3dGridGlobalIdSet;
77 template<
int,
int, ALU3dGr
idElementType,
class >
78 class ALU3dGridLocalIdSet;
79 template<
int,
int, ALU3dGr
idElementType,
class >
80 class ALU3dGridHierarchicIndexSet;
82 class ALU3dGridFactory;
83 template <
class Gr
idImp,
class GeometryImp,
int nChild>
84 class ALULocalGeometryStorage;
92 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm = ALUGr
idMPIComm >
95 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm = ALUGr
idNoComm >
103 template <
int dim,
int dimw,
class Comm >
104 struct ALUGridBaseGrid< dim, dimw,
cube, Comm >
106 typedef ALU3dGrid< dim, dimw, hexa, Comm > BaseGrid ;
109 template <
int dim,
int dimw,
class Comm >
110 struct ALUGridBaseGrid< dim, dimw,
simplex, Comm >
112 typedef ALU3dGrid< dim, dimw, tetra, Comm > BaseGrid ;
116 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
117 struct ALU3dGridCommunications;
119 template<
int dim,
int dimworld, ALU3dGr
idElementType elType >
120 struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridNoComm >
122 typedef ALU3dGridLocalIdSet< dim, dimworld, elType, ALUGridNoComm > GlobalIdSet;
123 typedef int GlobalId;
125 typedef ALU3DSPACE GitterDuneImpl GitterImplType;
130 explicit ALU3dGridCommunications ( ALUGridNoComm comm ) {}
132 int nlinks ()
const {
return 0; }
134 GitterImplType *createALUGrid (
const std::string ¯oName,
const ALU3DSPACE ProjectVertexPtrPair& projections,
135 const bool conformingRefinement )
137 GitterImplType* grid = ( macroName.empty() ) ?
138 new GitterImplType( dim, conformingRefinement ) :
new GitterImplType ( dim, conformingRefinement, macroName.c_str(), projections );
142 GitterImplType *createALUGrid ( std::istream& stream,
const ALU3DSPACE ProjectVertexPtrPair& projection,
143 const bool conformingRefinement )
145 return new GitterImplType ( dim, conformingRefinement, stream, projection );
149 static ALUGridNoComm defaultComm () {
return ALUGridNoComm(); }
151 static int getRank ( ALUGridNoComm comm ) {
return 0; }
153 static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
155 ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
156 dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF*
>( &grid.container() );
158 DUNE_THROW(InvalidStateException,
"dynamic_cast of ALUGrid builder failed");
162 static void completeGrid ( GitterImplType &grid ) {}
164 void print( std::ostream& out )
const
167 Communication ccobj_;
170#if ALU3DGRID_PARALLEL
171 template<
int dim,
int dimworld, ALU3dGr
idElementType elType >
172 struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridMPIComm >
174 typedef ALU3dGridGlobalIdSet< dim, dimworld, elType, ALUGridMPIComm > GlobalIdSet;
175 typedef ALUGridId< ALUMacroKey > GlobalId;
177 typedef ALU3DSPACE GitterDunePll GitterImplType;
182 explicit ALU3dGridCommunications ( MPI_Comm comm )
183 : ccobj_( comm ), mpAccess_( comm )
186 int nlinks ()
const {
return mpAccess_.sendLinks(); }
188 GitterImplType *createALUGrid (
const std::string ¯oName,
const ALU3DSPACE ProjectVertexPtrPair& projections,
189 const bool conformingRefinement )
191 return new GitterImplType( dim, conformingRefinement, macroName.c_str(), mpAccess_, projections );
194 GitterImplType *createALUGrid ( std::istream& stream,
const ALU3DSPACE ProjectVertexPtrPair& projections,
195 const bool conformingRefinement )
197 return new GitterImplType ( dim, conformingRefinement, stream, mpAccess_, projections );
201 static ALUGridMPIComm defaultComm () {
return ALUGridMPIComm(); }
203 static int getRank ( MPI_Comm comm )
206 MPI_Comm_rank( comm, &rank );
210 void print( std::ostream& out )
const
212 mpAccess_.printLinkage( out );
215 static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
217 ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
218 dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF*
>( &grid.containerPll() );
220 DUNE_THROW(InvalidStateException,
"dynamic_cast of ALUGrid builder failed");
224 static void completeGrid ( GitterImplType &grid )
227 grid.notifyMacroGridChanges();
229 grid.rebuildGhostCells();
232 Communication ccobj_;
233 ALU3DSPACE MpAccessMPI mpAccess_;
242 template<
int dim, ALU3dGr
idElementType elType,
int codim >
243 struct ALU3dGridTwists;
246 struct ALU3dGridTwists< dim, tetra, 0 >
249 typedef TrivialTwists< topoId, dim > Type;
253 struct ALU3dGridTwists< dim, hexa, 0 >
256 typedef TrivialTwists< topoId, dim > Type;
259 template<
int dim, ALU3dGr
idElementType elType >
260 struct ALU3dGridTwists< dim, elType, 1 >
262 typedef ALUTwists< dim == 2 ? 2 : ElementTopologyMapping< elType >::numVerticesPerFace, dim-1 > Type;
265 template< ALU3dGr
idElementType elType >
266 struct ALU3dGridTwists< 3, elType, 2 >
268 typedef ALUTwists< 2, 1 > Type;
271 template< ALU3dGr
idElementType elType >
272 struct ALU3dGridTwists< 2, elType, 2 >
274 typedef TrivialTwists< 0u, 0 > Type;
277 template<
int dim, ALU3dGr
idElementType elType >
278 struct ALU3dGridTwists< dim, elType, 3 >
280 typedef TrivialTwists< 0u, 0 > Type;
288 template<
int dimG,
int dimW, ALU3dGr
idElementType elType,
class Comm >
289 struct ALU3dGridFamily
291 static const int dim = dimG;
292 static const int dimworld = dimW;
294 typedef ALU3dGrid< dim, dimworld, elType, Comm > GridImp;
295 typedef ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily;
298 typedef ALU3dGridLocalIdSet< dim, dimworld, elType, Comm > LocalIdSetImp;
301 typedef typename ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalIdSet GlobalIdSetImp;
304 typedef typename ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalId GlobalIdType;
307 typedef int LocalIdType;
312 typedef typename GridFamily::LocalIdType LocalIdType;
315 typedef typename GridFamily::GlobalIdType GlobalIdType;
317 typedef typename GridFamily::GridImp Grid;
329 typedef DuneBoundaryProjection< dimworld > DuneBoundaryProjectionType;
330 typedef std::vector< const DuneBoundaryProjectionType * > DuneBoundaryProjectionVector;
335 typedef typename ALU3dGridTwists< dim, elType, cd >::Type Twists;
336 typedef typename Twists::Twist Twist;
339 typedef ALU3dGridGeometry< dim-cd, dimworld,
const Grid > GeometryImpl;
340 typedef ALU3dGridGeometry< dim-cd, dim,
const Grid > LocalGeometryImpl;
341 typedef Dune::Geometry< dim-cd, dimworld,
const Grid, ALU3dGridGeometry > Geometry;
342 typedef Dune::Geometry< dim-cd, dim,
const Grid, ALU3dGridGeometry > LocalGeometry;
344 typedef ALU3dGridEntity< cd, dim, const Grid > EntityImp;
348 typedef ALU3dGridEntitySeed< cd , const Grid> EntitySeed ;
350 template< PartitionIteratorType pitype >
357 typedef typename Partition< All_Partition >::LevelIterator LevelIterator;
358 typedef typename Partition< All_Partition >::LeafIterator LeafIterator;
361 template< PartitionIteratorType pitype >
366 typedef Dune::MacroGridView<const Grid, pitype> MacroGridView;
369 typedef typename Partition< All_Partition > :: MacroGridView MacroGridView;
370 typedef typename Partition< All_Partition > :: LeafGridView LeafGridView;
371 typedef typename Partition< All_Partition > :: LevelGridView LevelGridView;
374 typedef DefaultIndexSet< Grid, typename Codim< 0 > :: LevelIterator > LevelIndexSetImp;
377 typedef DefaultIndexSet< Grid, typename Codim< 0 > :: LeafIterator > LeafIndexSetImp;
379 typedef IndexSet< Grid, LevelIndexSetImp > LevelIndexSet;
380 typedef IndexSet< Grid, LeafIndexSetImp > LeafIndexSet;
381 typedef IdSet< Grid, LocalIdSetImp, LocalIdType > LocalIdSet;
382 typedef IdSet< Grid, GlobalIdSetImp, GlobalIdType > GlobalIdSet;
385 typedef typename ALU3dGridCommunications< dim, dimworld, elType, Comm >::Communication Communication;
387 [[deprecated(
"Use Communication instead!")]]
392 typedef typename Traits :: LevelIndexSetImp LevelIndexSetImp;
395 typedef typename Traits :: LeafIndexSetImp LeafIndexSetImp;
428 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
431 ALU3dGridFamily< dim, dimworld, elType, Comm > >,
454 friend class ALU3dGridEntityPointer< 0, const
ThisType >;
455 friend class ALU3dGridEntityPointer< 1, const
ThisType >;
456 friend class ALU3dGridEntityPointer< 2, const
ThisType >;
457 friend class ALU3dGridEntityPointer< dim, const
ThisType >;
460 friend class ALU3dGridHierarchicIterator< const
ThisType >;
463 friend class ALU3dGridGlobalIdSet< dim, dimworld, elType, Comm >;
464 friend class ALU3dGridLocalIdSet< dim, dimworld, elType, Comm >;
472 typedef ALU3dGridLevelIntersectionIterator<const ThisType>
473 LevelIntersectionIteratorImp;
484 enum { refineStepsForHalf = 1 };
486 static const ALU3dGridElementType elementType = elType;
488 typedef typename ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType;
489 typedef ObjectStreamType InStreamType ;
490 typedef ObjectStreamType OutStreamType ;
492 typedef ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily;
493 typedef typename GridFamily::Traits Traits;
498 template<
int codim >
500 :
public BaseType::template Codim< codim >
502 typedef typename Traits::template Codim< codim >::EntityImp EntityImp;
503 typedef typename Traits::template Codim< codim >::Twists Twists;
504 typedef typename Twists::Twist Twist;
513 template <PartitionIteratorType pitype>
516 typedef typename GridFamily::Traits::template Partition<pitype>::LevelGridView
518 typedef typename GridFamily::Traits::template Partition<pitype>::LeafGridView
520 typedef typename GridFamily::Traits::template Partition<pitype>::MacroGridView
542 typedef std::decay_t< decltype( ReferenceElementContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceElementType;
544 typedef std::decay_t< decltype( ReferenceFaceContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceFaceType;
554 typedef ALU3DSPACE ProjectVertexPtrPair ALUGridVertexProjectionPairType;
559 [[deprecated(
"Use Communication instead!")]]
562 typedef ALULeafCommunication< dim, dimworld, elType, Comm > LeafCommunication;
563 typedef ALULevelCommunication< dim, dimworld, elType, Comm > LevelCommunication;
569 typedef typename GridFamily::GlobalIdSetImp GlobalIdSetImp;
580 typedef typename Traits::template Codim< 0 >::LeafIterator LeafIteratorType;
581 typedef typename Traits::template Codim< 0 >::LeafIterator LeafIterator;
583 typedef ALU3dGridHierarchicIterator< const ThisType > HierarchicIteratorImp;
585 typedef typename ALU3dImplTraits< elType, Comm >::GitterImplType GitterImplType;
600 typedef Comm MPICommunicatorType;
602 typedef ALU3dGridCommunications< dim, dimworld, elType, Comm > Communications;
613 ALU3dGrid (
const std::string ¯oTriangFilename,
614 const MPICommunicatorType mpiComm,
615 const ALUGridVertexProjectionPairType& bndPrj,
622 static inline std::string
name ();
630 template<
int cd, PartitionIteratorType pitype>
635 template<
int cd, PartitionIteratorType pitype>
637 lend (
int level)
const;
642 template Partition<All_Partition>::LevelIterator
648 template Partition<All_Partition>::LevelIterator
649 lend (
int level)
const;
654 typename Traits::LeafIntersectionIterator
657 return LefInterItWrapperType( *
this,
659 entity.level(),
false );
662 typename Traits::LeafIntersectionIterator
663 ileafend(
const typename Traits::template Codim< 0 >::Entity& entity )
const
665 return LefInterItWrapperType( *
this,
667 entity.level(),
true );
670 typename Traits::LevelIntersectionIterator
671 ilevelbegin(
const typename Traits::template Codim< 0 >::Entity& entity )
const
673 return LvlInterItWrapperType( *
this,
675 entity.level(),
false );
678 typename Traits::LevelIntersectionIterator
679 ilevelend(
const typename Traits::template Codim< 0 >::Entity& entity )
const
681 return LvlInterItWrapperType( *
this,
683 entity.level(),
true );
688 template <
int codim, PartitionIteratorType pitype>
689 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
693 template <
int codim, PartitionIteratorType pitype>
694 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
699 typename Traits::template Codim<codim>::LeafIterator
704 typename Traits::template Codim<codim>::LeafIterator
709 int size (
int level,
int cd)
const;
712 int size (
int codim)
const;
715 int size (
int level, GeometryType type)
const;
721 int size (GeometryType type)
const;
727 int hierSetSize (
int cd)
const;
734 globalIdSet_.reset(
new GlobalIdSetImp( *
this ) );
736 return *globalIdSet_;
740 template<PartitionIteratorType pitype>
743 typedef typename Traits::template Partition<pitype>::MacroGridView View;
750 typedef MacroGridView View;
758 const typename Traits :: LeafIndexSet &
leafIndexSet ()
const;
761 const typename Traits :: LevelIndexSet &
levelIndexSet (
int level)
const;
770 std::shared_ptr< LevelIndexSetImp > createLevelIndexSet (
int level )
const;
776 assert( type.
dim() == dimension - cd );
782 typedef ALU3DSPACE GatherScatter GatherScatterType;
853 const double ldbUnder = 0.0,
854 const double ldbOver = 1.2 )
856 using DataBase = ALU3DSPACE LoadBalancer::DataBase ;
857 if( mthd <
int( DataBase::NONE ) && mthd > DataBase::ZOLTAN_LB_PARMETIS )
862 ALU3DSPACE ALUGridExternalParameters::setLoadBalanceParameters( mthd, ldbUnder, ldbOver );
882 template<
class DataHandleImpl,
class Data >
885 typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
886 <
ThisType, GatherScatterType, DataHandleImpl, Data,
false > DataHandleType;
887 DataHandleType dataHandle( *
this, dataHandleIF );
902 template<
class LBWeights,
class DataHandleImpl,
class Data >
906 typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
907 <
ThisType, LBWeights, DataHandleImpl, Data,
false > DataHandleType;
908 DataHandleType dataHandle( *
this, dataHandleIF, weights );
921 template<
class LBWeights >
922 typename std::enable_if< !IsDataHandle< LBWeights >::value,
bool >::type
loadBalance ( LBWeights &weights )
924 typedef ALU3DSPACE GatherScatterLoadBalance < ThisType, LBWeights, false > LoadBalanceHandleType;
925 LoadBalanceHandleType loadBalanceHandle( *
this, weights );
937 template<
class LBDestinations >
940 typedef ALU3DSPACE GatherScatterLoadBalance< ThisType, LBDestinations, true > LoadBalanceHandleType ;
941 LoadBalanceHandleType loadBalanceHandle( *
this, destinations );
955 template<
class LBDestinations,
class DataHandleImpl,
class Data >
959 typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle< ThisType, LBDestinations, DataHandleImpl, Data, true > DataHandleType;
960 DataHandleType dataHandle( *
this, dataHandleIF, destinations );
968 int ghostSize (
int level,
int codim)
const;
980 template<
class DataHandle,
class Data >
986 return LevelCommunication( *
this, data, iftype, dir, level );
992 template<
class DataHandle,
class Data >
997 return LeafCommunication( *
this, data, iftype, dir );
1002 void finalizeGridCreation();
1024 template<
class Gr
idImp,
class DataHandle >
1030 template<
class Gr
idImp,
class DataHandle >
1038 bool writeMacroGrid(
const std::string path,
const std::string filename,
1039 const ALU3DSPACE MacroFileHeader::Format format = ALU3DSPACE MacroFileHeader::defaultFormat )
const ;
1042 void backup( std::ostream&,
const ALU3DSPACE MacroFileHeader::Format format )
const ;
1045 void restore( std::istream& ) ;
1051 void updateStatus ();
1054 bool mark(
int refCount ,
const typename Traits::template Codim<0>::Entity & e);
1057 int getMark(
const typename Traits::template Codim<0>::Entity & e)
const;
1060 static MPICommunicatorType defaultCommunicator ()
1062 return Communications::defaultComm();
1066 const std::vector<GeometryType>&
geomTypes (
int codim)
const {
return geomTypes_[codim]; }
1071 GitterImplType &myGrid ()
const;
1073 virtual GitterImplType *createALUGrid (
const std::string ¯oName )
1075 alugrid_assert ( communications_ );
1076 return communications_->createALUGrid( macroName, vertexProjections(), conformingRefinement() );
1079 virtual GitterImplType *createALUGrid ( std::istream& stream )
1081 alugrid_assert ( communications_ );
1082 return communications_->createALUGrid( stream, vertexProjections(), conformingRefinement() );
1085 ALUGridVertexProjectionPairType vertexProjections()
const
1087 return vertexProjections_ ;
1091 virtual typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ()
const
1093 return Communications::getBuilder( myGrid() );
1097 virtual void completeGrid ()
1099 Communications::completeGrid( myGrid() );
1102 macroBoundarySegmentIndexSet_.invalidate();
1108 static const auto& refElem = ( elType == tetra ) ?
1117 static const auto& refElem = ( elType == tetra ) ?
1123 template <
class EntitySeed >
1125 entityPointer(
const EntitySeed& seed )
const
1128 return typename Traits :: template Codim< codim > :: EntityPointerImpl( seed );
1131 template <
class EntitySeed >
1132 typename Traits :: template Codim< EntitySeed :: codimension > :: Entity
1133 entity(
const EntitySeed& seed )
const
1135 typedef typename Traits :: template Codim< EntitySeed :: codimension > :: Entity Entity;
1136 return Entity(
typename Traits :: template Codim< EntitySeed :: codimension > :: EntityImp( seed ) );
1140 int nlinks ()
const {
return communications().nlinks(); }
1142 LeafVertexListType & getLeafVertexList()
const
1144 if( !leafVertexList_.up2Date() ) leafVertexList_.setupVxList(*
this);
1145 return leafVertexList_;
1148 int getLevelOfLeafVertex (
const typename ALU3dImplTraits< elType, Comm >::VertexType &
vertex )
const
1150 alugrid_assert ( leafVertexList_.up2Date() );
1151 return leafVertexList_.getLevel(
vertex);
1154 VertexListType & getVertexList(
int level)
const
1156 alugrid_assert ( level >= 0 );
1157 alugrid_assert ( level <=
maxLevel() );
1158 VertexListType & vxList = vertexList_[level];
1159 if(!vxList.up2Date()) vxList.setupVxList(*
this,level);
1163 ALU3dGridItemListType & getGhostLeafList(
int codim)
const
1165 alugrid_assert ( codim >= 1 );
1166 alugrid_assert ( codim <= 3 );
1167 return ghostLeafList_[codim-1];
1170 ALU3dGridItemListType & getGhostLevelList(
int codim,
int level)
const
1172 alugrid_assert ( codim >= 1 );
1173 alugrid_assert ( codim <= 3 );
1175 alugrid_assert ( level >= 0 );
1176 alugrid_assert ( level <=
maxLevel() );
1177 alugrid_assert ( level <
int(ghostLevelList_[codim-1].
size()) );
1178 return ghostLevelList_[codim-1][level];
1181 ALU3dGridItemListType & getEdgeList(
int level)
const
1183 alugrid_assert ( level >= 0 );
1184 alugrid_assert ( level <=
maxLevel() );
1185 return levelEdgeList_[level];
1210 const Communications &communications ()
const
1212 alugrid_assert ( communications_ );
1213 return *communications_;
1217 void makeGeometries();
1221 bool conformingRefinement()
const
1227 bool ghostCellsEnabled ()
const
1229 return comm().size() > 1 && myGrid().ghostCellsEnabled();
1232 const BoundarySegmentIndexSetType& macroBoundarySegmentIndexSet()
const
1234 if( ! macroBoundarySegmentIndexSet_.valid() )
1238 alugrid_assert( macroBoundarySegmentIndexSet_.valid() );
1239 return macroBoundarySegmentIndexSet_;
1250 mutable std::unique_ptr< GitterImplType > mygrid_;
1256 mutable int coarsenMarked_;
1257 mutable int refineMarked_;
1260 enum { numberOfGeomTypes = 1 };
1261 std::vector< std::vector<GeometryType> > geomTypes_;
1267 mutable std::unique_ptr< GlobalIdSetImp > globalIdSet_;
1273 mutable std::vector < std::shared_ptr< LevelIndexSetImp > > levelIndexVec_;
1276 mutable std::unique_ptr< LeafIndexSetImp > leafIndexSet_;
1278 mutable std::vector< VertexListType > vertexList_;
1282 mutable ALU3dGridItemListType ghostLeafList_[ 3 ];
1283 mutable std::vector< ALU3dGridItemListType > ghostLevelList_[ 3 ];
1285 mutable std::vector< ALU3dGridItemListType > levelEdgeList_;
1287 mutable LeafVertexListType leafVertexList_;
1290 typedef SizeCache<MyType> SizeCacheType;
1291 std::unique_ptr< SizeCacheType > sizeCache_;
1294 mutable BoundarySegmentIndexSetType macroBoundarySegmentIndexSet_;
1297 bool lockPostAdapt_;
1302 ALUGridVertexProjectionPairType vertexProjections_ ;
1305 std::unique_ptr< Communications > communications_;
1312 bool checkMacroGrid ( ALU3dGridElementType elType ,
1313 const std::string filename );
1314 const char* elType2Name( ALU3dGridElementType elType );
1316 namespace Capabilities
1319 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm,
int cdim >
1320 struct hasEntity<
Dune::ALU3dGrid< dim, dimworld, elType, Comm >, cdim >
1322 static const bool v =
true;
1325 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
1326 struct isLevelwiseConforming< ALU3dGrid< dim, dimworld, elType, Comm > >
1328 static const bool v =
true;
1331 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
1332 struct hasBackupRestoreFacilities< ALU3dGrid< dim, dimworld, elType, Comm > >
1334 static const bool v =
true;
1341#include "grid_inline.hh"
1342#if COMPILE_ALUGRID_INLINE
1343 #include "grid_imp.cc"
Portable very large unsigned integers.
Definition: entity.hh:449
hierarchic index set of ALU3dGrid
Definition: indexsets.hh:39
Definition: iterator.hh:56
Leaf iterator.
Definition: iterator.hh:648
[ provides Dune::Grid ]
Definition: grid.hh:434
bool repartition(LBDestinations &destinations, CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Distribute the grid based on a user defined partitioning.
Definition: grid.hh:956
static const ReferenceElementType & referenceElement()
return reference to Dune reference element according to elType
Definition: grid.hh:1106
ALU3dGrid(const std::string ¯oTriangFilename, const MPICommunicatorType mpiComm, const ALUGridVertexProjectionPairType &bndPrj, const ALUGridRefinementType refinementType)
Definition: grid_inline.hh:24
const Traits::LeafIndexSet & leafIndexSet() const
get leaf index set of the grid
Definition: grid_inline.hh:431
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Marks an entity to be refined/coarsened in a subsequent adapt.
Definition: grid_inline.hh:190
LevelCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: grid.hh:981
int overlapSize(int level, int codim) const
overlapSize is zero for this grid
Definition: grid.hh:971
bool loadBalance()
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition: grid.hh:871
static void setLoadBalanceMethod(const int mthd, const double ldbUnder=0.0, const double ldbOver=1.2)
Set load balancing method and lower and upper bound for decision on whether to load balance or not.
Definition: grid.hh:852
ALU3dGrid(const ThisType &)
Copy constructor should not be used.
static const ReferenceFaceType & faceReferenceElement()
return reference to Dune face reference element according to elType
Definition: grid.hh:1115
int maxLevel() const
Return maximum level defined in this grid. Levels are numbered maxLevel with 0 the coarsest level.
Definition: grid_inline.hh:81
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafend() const
General definition for an end iterator on leaf level.
Definition: grid_inline.hh:171
Traits::DuneBoundaryProjectionType DuneBoundaryProjectionType
boundary projection type
Definition: grid.hh:547
const Traits::LevelIndexSet & levelIndexSet(int level) const
get level index set of the grid
Definition: grid_inline.hh:446
Traits::LocalIdSet LocalIdSet
Type of the local id set.
Definition: grid.hh:576
void checkMacroGridFile(const std::string filename)
check whether macro grid format is of our type
Definition: grid_imp.cc:304
bool loadBalance(LBWeights &weights, CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Calculates load of each process and repartition by using ALUGrid's default partitioning method,...
Definition: grid.hh:903
const LocalIdSet & localIdSet() const
get global id set of grid
Definition: grid.hh:755
virtual ~ALU3dGrid()
Desctructor.
Definition: grid.hh:619
void globalRefine(int refCount)
uses the interface, mark on entity and refineLocal
Definition: grid_inline.hh:488
const std::vector< GeometryType > & geomTypes(int codim) const
deliver all geometry types used in this grid
Definition: grid.hh:1066
bool adapt()
Refine all positive marked leaf entities, coarsen all negative marked entities if possible.
Definition: grid_inline.hh:516
ALU3DSPACE ProjectVertex ALUGridVertexProjectionType
type of vertex projection
Definition: grid.hh:550
bool repartition(LBDestinations &destinations)
Distribute the grid based on a user defined partitioning.
Definition: grid.hh:938
Traits::Communication Communication
type of collective communication object
Definition: grid.hh:557
static std::string name()
for grid identification
Definition: grid_inline.hh:278
const ThisType & operator=(const ThisType &)
assignment operator should not be used
Definition: grid_imp.cc:205
std::shared_ptr< LevelIndexSetImp > accessLevelIndexSet(int level) const
return instance of level index set
Definition: grid_inline.hh:463
GridFamily::LevelIndexSetImp LevelIndexSetImp
Type of the level index set, needed by data handle.
Definition: grid.hh:532
GridFamily::LocalIdSetImp LocalIdSetImp
Type of the local id set.
Definition: grid.hh:567
ALU3DSPACE ProjectVertexPtr ALUGridVertexProjectionPointerType
type of ALUGrid Vertex Projection Interface (shared_ptr)
Definition: grid.hh:553
void recalcGlobalSize()
make grid walkthrough and calc global size
Partition< All_Partition >::LevelGridView LevelGridView
View types for All_Partition.
Definition: grid.hh:524
LeafCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
Communicate information on distributed entities on the leaf grid. Template parameter is a model of Du...
Definition: grid.hh:993
void backup(std::ostream &, const ALU3DSPACE MacroFileHeader::Format format) const
backup to ostream
Definition: grid_imp.cc:268
void clearIsNewMarkers()
clear all entity new markers
Definition: grid_imp.cc:444
@ refineEstimate_
if one element is refined then it causes apporximately not more than this number of new elements
Definition: grid.hh:597
void postAdapt()
clear all entity new markers if lockPostAdapt_ is set
Definition: grid_imp.cc:429
void restore(std::istream &)
restore from istream
Definition: grid_imp.cc:276
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: grid_inline.hh:99
void calcMaxLevel()
calculate maxlevel
Definition: grid_imp.cc:214
const GlobalIdSet & globalIdSet() const
get global id set of grid
Definition: grid.hh:730
bool preAdapt()
returns if a least one entity was marked for coarsening
Definition: grid_inline.hh:507
void calcExtras()
reset size and global size, update Level- and LeafIndexSet, if they exist
Definition: grid_inline.hh:371
GridFamily::LeafIndexSetImp LeafIndexSetImp
Type of the leaf index set, needed by data handle.
Definition: grid.hh:534
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
returns adaptation mark for given entity
Definition: grid_inline.hh:205
std::enable_if<!IsDataHandle< LBWeights >::value, bool >::type loadBalance(LBWeights &weights)
Calculates load of each process and repartition by using ALUGrid's default partitioning method,...
Definition: grid.hh:922
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafbegin() const
General definiton for a leaf iterator.
Definition: grid_inline.hh:148
MacroGridView macroGridView() const
View for te macro grid with some alu specific methods (All_Partition)
Definition: grid.hh:748
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
Definition: grid_inline.hh:113
@ newElementsChunk_
normal default number of new elements for new adapt method
Definition: grid.hh:590
bool loadBalance(CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition: grid.hh:883
int global_size(int cd) const
number of grid entities on all levels for given codim
Definition: grid_inline.hh:63
int ghostSize(int level, int codim) const
ghostSize is one for codim 0 and zero otherwise for this grid
Definition: grid_inline.hh:352
int size(int level, int cd) const
number of grid entities per level and codim
Definition: grid_inline.hh:289
size_t numBoundarySegments() const
number of boundary segments
Definition: grid_inline.hh:303
void checkMacroGrid()
check whether macro grid has the right element type
Definition: grid_imp.cc:343
bool writeMacroGrid(const std::string path, const std::string filename, const ALU3DSPACE MacroFileHeader::Format format=ALU3DSPACE MacroFileHeader::defaultFormat) const
write macro grid in ALUGrid macro format to path/filename.rank
Definition: grid_imp.cc:246
Traits::GlobalIdSet GlobalIdSet
Type of the global id set.
Definition: grid.hh:573
Partition< pitype >::MacroGridView macroGridView() const
View for te macro grid with some alu specific methods.
Definition: grid.hh:741
const Communication & comm() const
return const reference to a communication object. The return type is a model of Dune::Communication.
Definition: grid.hh:1009
ALU3dGridHierarchicIndexSet< dim, dimworld, elType, Comm > HierarchicIndexSet
Type of the hierarchic index set.
Definition: grid.hh:529
int overlapSize(int codim) const
overlapSize is zero for this grid
Definition: grid.hh:977
Interface class for the Grid's adapt method where the parameter is a AdaptDataHandleInterface.
Definition: adaptcallback.hh:33
CommDataHandleIF describes the features of a data handle for communication in parallel runs using the...
Definition: datahandleif.hh:78
Specialization of Communication for MPI.
Definition: mpicommunication.hh:108
void update(const GridViewType &gridView)
Definition: defaultindexsets.hh:399
DefaultIndexSet creates an index set by using the grids persistent container an a given pair of itera...
Definition: defaultindexsets.hh:68
interface class for an iterator over grid entities
Definition: entityiterator.hh:32
Store a reference to an entity with a minimal memory footprint.
Definition: entityseed.hh:26
static constexpr int codimension
codimension of underlying entity
Definition: entityseed.hh:30
Wrapper class for entities.
Definition: entity.hh:66
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:125
constexpr unsigned int dim() const
Return dimension of the type.
Definition: type.hh:371
constexpr bool isCube() const
Return true if entity is a cube of any dimension.
Definition: type.hh:335
constexpr unsigned int id() const
Return the topology id of the type.
Definition: type.hh:376
constexpr bool isSimplex() const
Return true if entity is a simplex of any dimension.
Definition: type.hh:330
Wrapper class for geometries.
Definition: geometry.hh:71
Grid view abstract base class.
Definition: gridview.hh:66
static constexpr int dimension
The dimension of the grid.
Definition: grid.hh:387
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:390
Id Set Interface.
Definition: indexidset.hh:452
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:23
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:83
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:164
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:281
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:246
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:346
Describes the parallel communication interface class for MessageBuffers and DataHandles.
Provides default index set implementations for Level- and LeafIndexsets used by ALUGrid.
Provides a Interfaces for detection of specific behavior.
Implements an utility class that provides collective communication methods for sequential programs.
A set of traits classes to store static information about grid implementation.
Different resources needed by all grid implementations.
topology of a Cartesian grid
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:472
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:463
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition: type.hh:506
Provides proxy classes for IntersectionsIterators.
Implements an utility class that provides MPI's collective communication methods.
Helpers for dealing with MPI.
Dune namespace.
Definition: alignedallocator.hh:13
@ simplex
use only simplex elements (i.e., triangles or tetrahedra)
Definition: declaration.hh:18
@ cube
use only cube elements (i.e., quadrilaterals or hexahedra)
Definition: declaration.hh:19
Communication< T > CollectiveCommunication
Definition: communication.hh:541
ALUGridRefinementType
available refinement types for ALUGrid
Definition: declaration.hh:24
@ conforming
use only conforming bisection refinement
Definition: declaration.hh:25
Provides size cache classes to implement the grids size method efficiently.
Definition: alu3dinclude.hh:364
Definition: alu3dinclude.hh:328
Types for GridView.
Definition: grid.hh:515
Static tag representing a codimension.
Definition: dimension.hh:24
Interface class for vertex projection at the boundary.
Definition: boundaryprojection.hh:33
Class providing access to the singletons of the reference elements.
Definition: referenceelements.hh:170
static const ReferenceElement & cube()
get hypercube reference elements
Definition: referenceelements.hh:210
Tagging interface to indicate that Grid has HierarchicIndexSet.
Definition: interfaces.hh:49
Tagging interface to indicate that Grid provides typedef ObjectStreamType.
Definition: interfaces.hh:14
Various macros to work with Dune module version numbers.