1 #ifndef DUNE_ALU3DGRIDGRID_HH
2 #define DUNE_ALU3DGRIDGRID_HH
11 #include <dune/common/bigunsignedint.hh>
12 #include <dune/common/deprecated.hh>
13 #include <dune/common/static_assert.hh>
15 #include <dune/geometry/referenceelements.hh>
32 #include "indexsets.hh"
33 #include "datahandle.hh"
37 #include <dune/common/mpihelper.hh>
39 #if ALU3DGRID_PARALLEL
40 #include <dune/common/mpicollectivecommunication.hh>
42 #include <dune/common/collectivecommunication.hh>
49 template<
int cd,
int dim,
class Gr
idImp>
50 class ALU3dGridEntity;
51 template<
int cd, PartitionIteratorType pitype,
class Gr
idImp >
52 class ALU3dGridLevelIterator;
53 template<
int cd,
class Gr
idImp >
54 class ALU3dGridEntityPointerBase;
55 template<
int cd,
class Gr
idImp >
56 class ALU3dGridEntitySeed;
57 template<
int cd,
class Gr
idImp >
58 class ALU3dGridEntityPointer;
59 template<
int mydim,
int coorddim,
class Gr
idImp>
60 class ALU3dGridGeometry;
61 template<
class Gr
idImp>
62 class ALU3dGridHierarchicIterator;
63 template<
class Gr
idImp>
64 class ALU3dGridIntersectionIterator;
65 template<
class Gr
idImp>
66 class ALU3dGridLevelIntersectionIterator;
67 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp>
68 class ALU3dGridLeafIterator;
69 template <
int mydim,
int coorddim,
class Gr
idImp>
70 class ALU3dGridMakeableEntity;
71 template <
class Gr
idImp>
72 class ALU3dGridFaceGeometryInfo;
73 template< ALU3dGr
idElementType,
class >
74 class ALU3dGridGlobalIdSet;
75 template< ALU3dGr
idElementType,
class >
76 class ALU3dGridLocalIdSet;
77 template< ALU3dGr
idElementType,
class >
78 class ALU3dGridHierarchicIndexSet;
79 template <
class EntityImp>
80 class ALUMemoryProvider;
82 class ALU3dGridFactory;
83 template <
class Gr
idImp,
class GeometryImp,
int nChild>
84 class ALULocalGeometryStorage;
85 template< ALU3dGr
idElementType elType,
class Comm >
86 struct ALU3dGridCommHelper;
93 #if ALU3DGRID_PARALLEL
94 template< ALU3dGr
idElementType elType,
class Comm = MPI_Comm >
96 #else // #if ALU3DGRID_PARALLEL
97 template< ALU3dGr
idElementType elType,
class Comm = No_Comm >
99 #endif // #else // #if ALU3DGRID_PARALLEL
101 template <
class Comm >
102 struct ALUGridBaseGrid< 3, 3,
cube, Comm >
107 template <
class Comm>
113 namespace DefaultIndexSetHelper
116 template< ALU3dGr
idElementType elType,
class Comm,
class Index >
125 return (container.getData( index ).index() >= 0);
136 template< ALU3dGr
idElementType elType,
class Comm >
137 struct ALU3dGridCommunications;
139 template< ALU3dGr
idElementType elType >
140 struct ALU3dGridCommunications< elType, No_Comm >
155 if( macroName.empty() )
163 static int getRank ( No_Comm comm ) {
return 0; }
167 return dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF &
>( grid.container() );
175 #if ALU3DGRID_PARALLEL
176 template< ALU3dGr
idElementType elType >
177 struct ALU3dGridCommunications< elType, MPI_Comm >
182 typedef ALU3DSPACE GitterDunePll GitterImplType;
184 typedef Dune::CollectiveCommunication< MPI_Comm > CollectiveCommunication;
186 explicit ALU3dGridCommunications ( MPI_Comm comm )
187 : ccobj_( comm ), mpAccess_( comm )
190 int nlinks ()
const {
return mpAccess_.nlinks(); }
192 GitterImplType *createALUGrid (
const std::string ¯oName,
ALU3DSPACE ProjectVertex *projection )
194 return new GitterImplType( macroName.c_str(), mpAccess_, projection );
197 static MPI_Comm defaultComm () {
return MPI_COMM_WORLD; }
199 static int getRank ( MPI_Comm comm )
202 MPI_Comm_rank( comm, &rank );
206 static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
208 return dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF &
>( grid.containerPll() );
211 static void duneNotifyMacroGridChanges ( GitterImplType &grid )
213 grid.duneNotifyMacroGridChanges();
216 CollectiveCommunication ccobj_;
219 #endif // #if ALU3DGRID_PARALLEL
226 template< ALU3dGr
idElementType elType,
class Comm >
239 typedef typename ALU3dGridCommunications< elType, Comm >::GlobalIdSet
GlobalIdSetImp;
242 typedef typename ALU3dGridCommunications< elType, Comm >::GlobalId
GlobalIdType;
287 template< PartitionIteratorType pitype >
298 template< PartitionIteratorType pitype >
356 template< ALU3dGr
idElementType elType,
class Comm >
359 ALU3dGridFamily< elType, Comm > >,
400 friend class ALU3dGridCommHelper< elType, Comm >;
522 ALU3dGrid (
const std::string ¯oTriangFilename,
533 static inline std::string
name ();
541 template<
int cd, PartitionIteratorType pitype>
546 template<
int cd, PartitionIteratorType pitype>
548 lend (
int level)
const;
560 lend (
int level)
const;
564 template <
int codim, PartitionIteratorType pitype>
566 leafbegin(
int level)
const;
569 template <
int codim, PartitionIteratorType pitype>
571 leafend(
int level)
const;
576 leafbegin(
int level)
const;
581 leafend(
int level)
const;
597 template <
int codim, PartitionIteratorType pitype>
602 template <
int codim, PartitionIteratorType pitype>
618 template <
int codim, PartitionIteratorType pitype>
620 createLeafIteratorBegin (
int level)
const;
623 template <
int codim, PartitionIteratorType pitype>
625 createLeafIteratorEnd(
int level)
const;
629 int size (
int level,
int cd)
const;
632 int size (
int codim)
const;
698 template <
class DataHandle>
701 template<
class DataHandleImpl,
class Data >
705 LBHandle lbHandle( *
this, dataHandle );
710 int ghostSize (
int level,
int codim)
const;
722 template<
class DataHandleImp,
class DataTypeImp>
729 template<
class DataHandleImp,
class DataTypeImp>
753 template<
class Gr
idImp,
class DataHandle >
759 template<
class Gr
idImp,
class DataHandle >
767 template <GrapeIOFileFormatType ftype>
776 bool writeMacroGrid(
const std::string path,
const std::string filename )
const ;
780 template <GrapeIOFileFormatType ftype>
794 bool mark(
int refCount ,
const typename Traits::template Codim<0>::Entity & e);
797 int getMark(
const typename Traits::template Codim<0>::Entity & e)
const;
802 return Communications::defaultComm();
807 template<
class IntersectionType >
808 static const typename BaseType
809 :: template ReturnImplementationType< IntersectionType >
810 :: ImplementationType &
847 template <
class EntitySeed >
848 typename Traits :: template Codim< EntitySeed :: codimension >
:: EntityPointer
851 enum { codim = EntitySeed :: codimension };
854 return ALUPointer(
factory(), seed ) ;
874 assert( level >= 0 );
883 assert( codim >= 1 );
884 assert( codim <= 3 );
890 assert( codim >= 1 );
891 assert( codim <= 3 );
893 assert( level >= 0 );
900 assert( level >= 0 );
910 const ThisType &
operator= (
const ThisType & );
938 assert( segmentIndex < (
int)
bndVec_->size() );
939 return (*
bndVec_)[ segmentIndex ];
950 #ifdef USE_SMP_PARALLEL
1014 #ifdef USE_SMP_PARALLEL
1015 std::vector< GridObjectFactoryType > factoryVec_;
1041 const std::string filename );
1044 namespace Capabilities
1047 template< ALU3dGr
idElementType elType,
class Comm,
int cdim >
1050 static const bool v =
true;
1053 template< ALU3dGr
idElementType elType,
class Comm >
1056 static const bool v =
true;
1059 template< ALU3dGr
idElementType elType,
class Comm >
1062 static const bool v =
true;
1065 template< ALU3dGr
idElementType elType,
class Comm >
1068 static const bool v =
true;
1076 #if COMPILE_ALUGRID_INLINE
1077 #include "grid_imp.cc"