3#ifndef DUNE_ALU3DINCLUDE_HH
4#define DUNE_ALU3DINCLUDE_HH
10#define COMPILE_ALUGRID_LIB 0
12#if COMPILE_ALUGRID_LIB
13 #define COMPILE_ALUGRID_INLINE 0
15 #define COMPILE_ALUGRID_INLINE 1
18#if COMPILE_ALUGRID_INLINE
19#define alu_inline inline
26#define ALU3DSPACE ALUGridSpace ::
30#include <dune/grid/alugrid/common/checkparallel.hh>
34#include <alugrid_parallel.h>
37#include <alugrid_serial.h>
41#include <dune/grid/alugrid/3d/topology.hh>
46 static const int ProcessorBoundary_t = Gitter::hbndseg_STI::closure;
49 typedef GatherScatter GatherScatterType;
59 typedef double alu3d_ctype;
66 template<
class Comm >
67 struct ALU3dBasicImplTraits;
70 struct ALU3dBasicImplTraits< No_Comm >
72 typedef ALU3DSPACE Gitter GitterType;
73 typedef ALU3DSPACE GitterDuneImpl GitterImplType;
75 typedef GitterType::helement_STI HElementType;
76 typedef GitterType::hface_STI HFaceType;
77 typedef GitterType::hedge_STI HEdgeType;
78 typedef GitterType::vertex_STI VertexType;
79 typedef GitterType::hbndseg_STI HBndSegType;
80 typedef GitterType::ghostpair_STI GhostPairType;
82 typedef HElementType PllElementType;
84 typedef GitterType::Geometric::hedge1_GEO GEOEdgeType;
87 template <
class BndFaceType>
88 static bool isGhost(
const BndFaceType* ghost )
96 struct ALU3dBasicImplTraits< MPI_Comm >
98 typedef ALU3DSPACE GitterDunePll GitterType;
99 typedef ALU3DSPACE GitterDunePll GitterImplType;
101 typedef GitterType::helement_STI HElementType;
102 typedef GitterType::hface_STI HFaceType;
103 typedef GitterType::hedge_STI HEdgeType;
104 typedef GitterType::vertex_STI VertexType;
105 typedef GitterType::hbndseg_STI HBndSegType;
106 typedef GitterType::ghostpair_STI GhostPairType;
108 typedef ALU3DSPACE ElementPllXIF_t PllElementType;
110 typedef GitterType::Geometric::hedge1_GEO GEOEdgeType;
113 template <
class BndFaceType>
114 static bool isGhost(
const BndFaceType* ghost )
116 return ( ghost != 0 );
126 template< ALU3dGr
idElementType elType,
class Comm,
int codim >
127 struct ALU3dCodimImplTraits;
129 template<
class Comm >
130 struct ALU3dCodimImplTraits< tetra, Comm, 0 >
132 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
133 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
136 typedef typename GitterType::Geometric::hasFace3 EntitySeedType;
137 typedef typename GitterImplType::Objects::tetra_IMPL ImplementationType;
138 typedef typename GitterType::hbndseg_STI GhostInterfaceType;
139 typedef typename GitterImplType::Objects::Hbnd3Default GhostImplementationType;
142 template<
class Comm >
143 struct ALU3dCodimImplTraits< hexa, Comm, 0 >
145 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
146 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
149 typedef typename GitterType::Geometric::hasFace4 EntitySeedType;
150 typedef typename GitterImplType::Objects::hexa_IMPL ImplementationType;
151 typedef typename GitterType::hbndseg_STI GhostInterfaceType;
152 typedef typename GitterImplType::Objects::Hbnd4Default GhostImplementationType;
155 template<
class Comm >
156 struct ALU3dCodimImplTraits< tetra, Comm, 1 >
158 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
162 typedef typename GitterType::Geometric::hface3_GEO ImplementationType;
165 template<
class Comm >
166 struct ALU3dCodimImplTraits< hexa, Comm, 1 >
168 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
172 typedef typename GitterType::Geometric::hface4_GEO ImplementationType;
175 template< ALU3dGr
idElementType elType,
class Comm >
176 struct ALU3dCodimImplTraits< elType, Comm, 2 >
178 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
182 typedef typename GitterType::Geometric::hedge1_GEO ImplementationType;
185 template< ALU3dGr
idElementType elType,
class Comm >
186 struct ALU3dCodimImplTraits< elType, Comm, 3 >
188 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
192 typedef typename GitterType::Geometric::VertexGeo ImplementationType;
200 template< ALU3dGr
idElementType elType,
class Comm >
201 struct ALU3dImplTraits;
203 template<
class Comm >
204 struct ALU3dImplTraits< tetra, Comm >
205 :
public ALU3dBasicImplTraits< Comm >
207 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
208 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
210 typedef typename GitterType::Geometric::hface3_GEO GEOFaceType;
211 typedef typename GitterType::Geometric::VertexGeo GEOVertexType;
212 typedef typename GitterImplType::Objects::tetra_IMPL IMPLElementType;
213 typedef typename GitterType::Geometric::tetra_GEO GEOElementType;
214 typedef typename GitterType::Geometric::periodic3_GEO GEOPeriodicType;
215 typedef typename GitterType::Geometric::hasFace3 HasFaceType;
216 typedef typename GitterType::Geometric::Hface3Rule HfaceRuleType;
217 typedef typename GitterImplType::Objects::Hbnd3Default BNDFaceType;
218 typedef typename GitterImplType::Objects::hbndseg3_IMPL ImplBndFaceType;
220 typedef typename GitterType::Geometric::TetraRule MarkRuleType;
223 enum { bisect_element_t =
224#ifdef ALUGRID_PERIODIC_BOUNDARY_PARALLEL
230 enum { refine_element_t = MarkRuleType::iso8 };
231 enum { coarse_element_t = MarkRuleType::crs };
232 enum { nosplit_element_t = MarkRuleType::nosplit };
234 typedef std::pair< GEOFaceType *, int > NeighbourFaceType;
235 typedef std::pair< HasFaceType *, int > NeighbourPairType;
237 template<
int codim >
239 :
public ALU3dCodimImplTraits< tetra, Comm, codim >
243 template <
class Elem>
244 static const GEOFaceType* getFace(
const Elem& elem,
const int aluFace )
246 return elem.myhface3( aluFace );
250 template<
class Comm >
251 struct ALU3dImplTraits< hexa, Comm >
252 :
public ALU3dBasicImplTraits< Comm >
254 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
255 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
257 typedef typename GitterType::Geometric::hface4_GEO GEOFaceType;
258 typedef typename GitterType::Geometric::VertexGeo GEOVertexType;
259 typedef typename GitterImplType::Objects::hexa_IMPL IMPLElementType;
260 typedef typename GitterType::Geometric::hexa_GEO GEOElementType;
261 typedef typename GitterType::Geometric::periodic4_GEO GEOPeriodicType;
262 typedef typename GitterType::Geometric::hasFace4 HasFaceType;
263 typedef typename GitterType::Geometric::Hface4Rule HfaceRuleType;
264 typedef typename GitterImplType::Objects::Hbnd4Default BNDFaceType;
265 typedef typename GitterImplType::Objects::hbndseg4_IMPL ImplBndFaceType;
267 typedef typename GitterType::Geometric::HexaRule MarkRuleType;
270 enum { refine_element_t = MarkRuleType::iso8 };
271 enum { bisect_element_t = MarkRuleType::iso8 };
272 enum { coarse_element_t = MarkRuleType::crs };
273 enum { nosplit_element_t = MarkRuleType::nosplit };
275 typedef std::pair< GEOFaceType *, int > NeighbourFaceType;
276 typedef std::pair< HasFaceType *, int > NeighbourPairType;
278 template<
int codim >
280 :
public ALU3dCodimImplTraits< hexa, Comm, codim >
284 template <
class Elem>
285 static const GEOFaceType* getFace(
const Elem& elem,
const int aluFace )
287 return elem.myhface4( aluFace );
295 template<
class Comm >
299 typedef typename ALU3dBasicImplTraits< Comm >::VertexType VertexType;
300 typedef std::vector< VertexType * > VertexListType;
301 typedef typename VertexListType::iterator IteratorType;
307 size_t size ()
const {
return vertexList_.size(); }
309 bool up2Date ()
const {
return up2Date_; }
310 void unsetUp2Date () { up2Date_ =
false; }
313 template <
class Gr
idType>
314 void setupVxList (
const GridType & grid,
int level);
316 IteratorType begin () {
return vertexList_.begin(); }
317 IteratorType end () {
return vertexList_.end(); }
319 VertexListType & getItemList() {
return vertexList_; }
322 VertexListType vertexList_;
328 template<
class Comm >
332 typedef typename ALU3dBasicImplTraits< Comm >::VertexType VertexType;
333 typedef std::pair< VertexType *, int > ItemType;
334 typedef std::vector< ItemType > VertexListType;
335 typedef typename VertexListType::iterator IteratorType;
341 size_t size ()
const {
return vertexList_.size(); }
343 bool up2Date ()
const {
return up2Date_; }
344 void unsetUp2Date () { up2Date_ =
false; }
347 template <
class Gr
idType>
348 void setupVxList (
const GridType & grid);
350 IteratorType begin () {
return vertexList_.begin(); }
351 IteratorType end () {
return vertexList_.end(); }
353 VertexListType & getItemList() {
return vertexList_; }
355 int getLevel (
const VertexType &vertex )
const
357 const int idx = vertex.getIndex();
359 assert( idx < (
int)size());
360 const ItemType & p = vertexList_[idx];
362 return vertex.level();
368 VertexListType vertexList_;
373 class ALU3dGridItemList
377 typedef std::vector < void * > ItemListType;
378 typedef ItemListType :: iterator IteratorType;
380 ALU3dGridItemList () : up2Date_(false) {}
382 size_t size ()
const {
return itemList_.size(); }
384 bool up2Date ()
const {
return up2Date_; }
385 void unsetUp2Date () { up2Date_ =
false; }
387 void markAsUp2Date() { up2Date_ =
true; }
389 IteratorType begin () {
return itemList_.begin(); }
390 IteratorType end () {
return itemList_.end(); }
392 ItemListType & getItemList() {
return itemList_; }
396 ItemListType itemList_;
399 typedef ALU3dGridItemList ALU3dGridItemListType;
405 template<
class Comm >
406 struct ALU3dGridFaceGetter
408 static const typename ALU3dImplTraits< tetra, Comm >::GEOFaceType *
409 getFace(
const typename ALU3dImplTraits< tetra, Comm >::GEOElementType& elem,
int index)
411 assert(index >= 0 && index < 4);
415 static const typename ALU3dImplTraits< hexa, Comm >::GEOFaceType*
416 getFace(
const typename ALU3dImplTraits< hexa, Comm >::GEOElementType &elem,
int index )
418 assert(index >= 0 && index < 6);
static int dune2aluFace(int index)
Maps face index from Dune onto ALU3dGrid reference element.
Definition: topology.hh:175
Dune namespace.
Definition: alignment.hh:14
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:80
Implements an utility class that provides MPI's collective communication methods.
Definition: alu3dinclude.hh:330
Definition: alu3dinclude.hh:297