Dune Core Modules (2.9.0)

alu3dinclude.hh
1#ifndef DUNE_ALUGRID_ALU3DINCLUDE_HH
2#define DUNE_ALUGRID_ALU3DINCLUDE_HH
3
4#include "aluinline.hh"
5
6// all methods and classes of the ALUGrid are defined in the namespace
7#define ALU3DSPACE ::ALUGrid::
8
9#include <dune/alugrid/common/declaration.hh>
10
11#include <dune/alugrid/impl/serial/gatherscatter.hh>
12#include <dune/alugrid/impl/serial/key.h>
13#include <dune/alugrid/impl/serial/myalloc.h>
14#include <dune/alugrid/impl/serial/serialize.h>
15
16#include <dune/alugrid/impl/parallel/mpAccess.h>
17#include <dune/alugrid/impl/parallel/gitter_pll_ldb.h>
18
19#include <dune/alugrid/impl/serial/gitter_sti.h>
20
21#include <dune/alugrid/impl/serial/gitter_hexa_top.h>
22#include <dune/alugrid/impl/serial/mapp_tetra_3d_ext.h>
23#include <dune/alugrid/impl/serial/gitter_tetra_top.h>
24#include <dune/alugrid/impl/serial/walk.h>
25#include <dune/alugrid/impl/serial/gitter_impl.h>
26#include <dune/alugrid/impl/serial/gitter_mgb.h>
27#include <dune/alugrid/impl/serial/key.h>
28#include <dune/alugrid/impl/serial/lock.h>
29
30#include <dune/alugrid/impl/duneinterface/gitter_dune_impl.h>
31
32namespace ALUGrid
33{
34
35 typedef Gitter::AdaptRestrictProlong AdaptRestrictProlongType;
36
37 static const int ProcessorBoundary_t = Gitter::hbndseg_STI::closure;
38
39 // general GatherScatter type
40 typedef GatherScatter GatherScatterType;
41
42} // namespace ALUGrid
43
44
45// headers for parallel grid structures
46#include <dune/alugrid/impl/parallel/gitter_pll_sti.h>
47#include <dune/alugrid/impl/parallel/gitter_pll_impl.h>
48#include <dune/alugrid/impl/parallel/gitter_pll_ldb.h>
49#include <dune/alugrid/impl/parallel/gitter_tetra_top_pll.h>
50#include <dune/alugrid/impl/parallel/gitter_hexa_top_pll.h>
51#include <dune/alugrid/impl/parallel/gitter_pll_mgb.h>
52#include <dune/alugrid/impl/duneinterface/gitter_dune_pll_impl.h>
53
54#if ALU3DGRID_PARALLEL
55// if MPI was found include MPI communications
56#include <dune/alugrid/impl/parallel/mpAccess_MPI.h>
57#endif // #if ALU3DGRID_PARALLEL
58
59//- local includes
60#include <dune/alugrid/3d/topology.hh>
61
62namespace Dune
63{
64
65 // typedef of ALU3dGridElementType see topology.hh
66
67 // i.e. double or float
68 typedef double alu3d_ctype;
69
70
71 // ALU3dBasicImplTraits
72 // --------------------
73
74 template< class Comm >
75 struct ALU3dBasicImplTraits;
76
77 template<>
78 struct ALU3dBasicImplTraits< ALUGridNoComm >
79 {
80 typedef ALU3DSPACE Gitter GitterType;
81 typedef ALU3DSPACE GitterDuneImpl GitterImplType;
82
83 typedef GitterType::helement_STI HElementType; // Interface Element
84 typedef GitterType::hface_STI HFaceType; // Interface Face
85 typedef GitterType::hedge_STI HEdgeType; // Interface Edge
86 typedef GitterType::vertex_STI VertexType; // Interface Vertex
87 typedef GitterType::hbndseg_STI HBndSegType;
88 typedef GitterType::ghostpair_STI GhostPairType;
89
90 typedef HElementType PllElementType;
91
92 typedef GitterType::Geometric::hedge1_GEO GEOEdgeType;
93
95 template <class BndFaceType>
96 static bool isGhost( const BndFaceType* ghost )
97 {
98 return false ;
99 }
100 };
101
102 template<>
103 struct ALU3dBasicImplTraits< ALUGridMPIComm >
104 {
105 typedef ALU3DSPACE GitterDunePll GitterType;
106 typedef ALU3DSPACE GitterDunePll GitterImplType;
107
108 typedef GitterType::helement_STI HElementType; // Interface Element
109 typedef GitterType::hface_STI HFaceType; // Interface Face
110 typedef GitterType::hedge_STI HEdgeType; // Interface Edge
111 typedef GitterType::vertex_STI VertexType; // Interface Vertex
112 typedef GitterType::hbndseg_STI HBndSegType;
113 typedef GitterType::ghostpair_STI GhostPairType;
114
115 typedef ALU3DSPACE ElementPllXIF_t PllElementType;
116
117 typedef GitterType::Geometric::hedge1_GEO GEOEdgeType;
118
119 // method for ghost check
120 template <class BndFaceType>
121 static bool isGhost( const BndFaceType* ghost )
122 {
123 return ( ghost != 0 );
124 }
125 };
126
127
128 // ALU3dCodimImplTraits
129 // --------------------
130
131 template< ALU3dGridElementType elType, class Comm, int dim, int codim >
132 struct ALU3dCodimImplTraits;
133
134 template< class Comm, int dim>
135 struct ALU3dCodimImplTraits< tetra, Comm, dim, 0 >
136 {
137 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
138 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
139
140 typedef typename GitterType::helement_STI InterfaceType;
141 typedef typename GitterType::Geometric::hasFace3 EntitySeedType;
142 typedef typename GitterImplType::Objects::tetra_IMPL ImplementationType;
143 typedef typename GitterType::hbndseg_STI GhostInterfaceType;
144 typedef typename GitterImplType::Objects::Hbnd3Default GhostImplementationType;
145 };
146
147 template< class Comm, int dim >
148 struct ALU3dCodimImplTraits< hexa, Comm, dim, 0 >
149 {
150 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
151 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
152
153 typedef typename GitterType::helement_STI InterfaceType;
154 typedef typename GitterType::Geometric::hasFace4 EntitySeedType;
155 typedef typename GitterImplType::Objects::hexa_IMPL ImplementationType;
156 typedef typename GitterType::hbndseg_STI GhostInterfaceType;
157 typedef typename GitterImplType::Objects::Hbnd4Default GhostImplementationType;
158 };
159
160 template< class Comm, int dim >
161 struct ALU3dCodimImplTraits< tetra, Comm, dim, 1 >
162 {
163 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
164
165 typedef typename GitterType::hface_STI InterfaceType;
166 typedef InterfaceType EntitySeedType;
167 typedef typename GitterType::Geometric::hface3_GEO ImplementationType;
168 };
169
170 template< class Comm, int dim >
171 struct ALU3dCodimImplTraits< hexa, Comm, dim, 1 >
172 {
173 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
174
175 typedef typename GitterType::hface_STI InterfaceType;
176 typedef InterfaceType EntitySeedType;
177 typedef typename GitterType::Geometric::hface4_GEO ImplementationType;
178 };
179
180 template< ALU3dGridElementType elType, class Comm >
181 struct ALU3dCodimImplTraits< elType, Comm, 3, 2 >
182 {
183 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
184
185 typedef typename GitterType::hedge_STI InterfaceType;
186 typedef InterfaceType EntitySeedType;
187 typedef typename GitterType::Geometric::hedge1_GEO ImplementationType;
188 };
189
190
191 template< ALU3dGridElementType elType, class Comm >
192 struct ALU3dCodimImplTraits< elType, Comm, 2, 2 >
193 {
194 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
195
196 typedef typename GitterType::vertex_STI InterfaceType;
197 typedef InterfaceType EntitySeedType;
198 typedef typename GitterType::Geometric::VertexGeo ImplementationType;
199 };
200
201 template< ALU3dGridElementType elType, class Comm >
202 struct ALU3dCodimImplTraits< elType, Comm, 3, 3 >
203 {
204 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
205
206 typedef typename GitterType::vertex_STI InterfaceType;
207 typedef InterfaceType EntitySeedType;
208 typedef typename GitterType::Geometric::VertexGeo ImplementationType;
209 };
210
211 // Refinement rules in general
212 template< class MarkRuleType, ALU3dGridElementType elType >
213 struct ALU3dRefinementTraits {};
214
215 // Refinement rules for simplices
216 template< class MarkRuleType >
217 struct ALU3dRefinementTraits < MarkRuleType, tetra >
218 {
219 // refinement and coarsening enum
220 enum { bisect_element_t = MarkRuleType::bisect };
221 enum { refine_element_t = MarkRuleType::regular };
222 enum { coarse_element_t = MarkRuleType::crs };
223 enum { nosplit_element_t = MarkRuleType::nosplit };
224 };
225
226 // Refinement rules for cubes
227 template< class MarkRuleType >
228 struct ALU3dRefinementTraits < MarkRuleType, hexa >
229 {
230 // refinement and coarsening enum
231 enum { bisect_element_t = MarkRuleType::regular };
232 enum { refine_element_t = MarkRuleType::regular };
233 enum { coarse_element_t = MarkRuleType::crs };
234 enum { nosplit_element_t = MarkRuleType::nosplit };
235 };
236
237
238 // ALU3dImplTraits
239 // ---------------
240
241 template< ALU3dGridElementType elType, class Comm >
242 struct ALU3dImplTraits;
243
244 template< class Comm >
245 struct ALU3dImplTraits< tetra, Comm >
246 : public ALU3dBasicImplTraits< Comm >
247 {
248 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
249 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
250
251 typedef typename GitterType::Geometric::hface3_GEO GEOFaceType;
252 typedef typename GitterType::Geometric::VertexGeo GEOVertexType;
253 typedef typename GitterImplType::Objects::tetra_IMPL IMPLElementType;
254 typedef typename GitterType::Geometric::tetra_GEO GEOElementType;
255 typedef typename GitterType::Geometric::periodic3_GEO GEOPeriodicType;
256 typedef typename GitterType::Geometric::hasFace3 HasFaceType;
257 typedef typename GitterType::Geometric::Hface3Rule HfaceRuleType;
258 typedef typename GitterImplType::Objects::Hbnd3Default BNDFaceType;
259 typedef typename GitterImplType::Objects::hbndseg3_IMPL ImplBndFaceType;
260
261 typedef typename GitterType::Geometric::TetraRule MarkRuleType;
262
263 struct RefinementRules
264 : public ALU3dRefinementTraits<MarkRuleType, tetra>
265 {};
266
267 typedef std::pair< GEOFaceType *, int > NeighbourFaceType;
268 typedef std::pair< HasFaceType *, int > NeighbourPairType;
269
270 template< int dim, int codim >
271 struct Codim
272 : public ALU3dCodimImplTraits< tetra, Comm, dim, codim >
273 {};
274
275 // access of faces
276 template <class Elem>
277 static const GEOFaceType* getFace( const Elem& elem, const int aluFace )
278 {
279 return elem.myhface( aluFace );
280 }
281 };
282
283 template< class Comm >
284 struct ALU3dImplTraits< hexa, Comm >
285 : public ALU3dBasicImplTraits< Comm >
286 {
287 typedef typename ALU3dBasicImplTraits< Comm >::GitterType GitterType;
288 typedef typename ALU3dBasicImplTraits< Comm >::GitterImplType GitterImplType;
289
290 typedef typename GitterType::Geometric::hface4_GEO GEOFaceType;
291 typedef typename GitterType::Geometric::VertexGeo GEOVertexType;
292 typedef typename GitterImplType::Objects::hexa_IMPL IMPLElementType;
293 typedef typename GitterType::Geometric::hexa_GEO GEOElementType;
294 typedef typename GitterType::Geometric::periodic4_GEO GEOPeriodicType;
295 typedef typename GitterType::Geometric::hasFace4 HasFaceType;
296 typedef typename GitterType::Geometric::Hface4Rule HfaceRuleType;
297 typedef typename GitterImplType::Objects::Hbnd4Default BNDFaceType;
298 typedef typename GitterImplType::Objects::hbndseg4_IMPL ImplBndFaceType;
299
300 typedef typename GitterType::Geometric::HexaRule MarkRuleType;
301
302 struct RefinementRules
303 : public ALU3dRefinementTraits<MarkRuleType, hexa>
304 {};
305
306 typedef std::pair< GEOFaceType *, int > NeighbourFaceType;
307 typedef std::pair< HasFaceType *, int > NeighbourPairType;
308
309 template< int dim, int codim >
310 struct Codim
311 : public ALU3dCodimImplTraits< hexa, Comm, dim, codim >
312 {};
313
314 // access of faces
315 template <class Elem>
316 static const GEOFaceType* getFace( const Elem& elem, const int aluFace )
317 {
318 return elem.myhface( aluFace );
319 }
320 };
321
322
323
326 template< class Comm >
328 {
329 // level vertex iterator list
330 typedef typename ALU3dBasicImplTraits< Comm >::VertexType VertexType;
331 typedef std::vector< VertexType * > VertexListType;
332 typedef typename VertexListType::iterator IteratorType;
333
335 : up2Date_( false )
336 {}
337
338 size_t size () const { return vertexList_.size(); }
339
340 bool up2Date () const { return up2Date_; }
341 void unsetUp2Date () { up2Date_ = false; }
342
343 // make grid walkthrough and calc global size
344 template <class GridType>
345 void setupVxList (const GridType & grid, int level);
346
347 IteratorType begin () { return vertexList_.begin(); }
348 IteratorType end () { return vertexList_.end(); }
349
350 VertexListType & getItemList() { return vertexList_; }
351
352 private:
353 bool up2Date_;
354 //careful: due to the setupVxList structure the ordering of vertexList_ and validateList_ differ in the level Case
355 //for validateList_ we want the ALUGrid Index as ordering, as we want to use it for faces
356 VertexListType vertexList_;
357 };
358
359
362 template< class Comm >
364 {
365 // level vertex iterator list
366 typedef typename ALU3dBasicImplTraits< Comm >::VertexType VertexType;
367 typedef std::pair< VertexType *, int > ItemType;
368 typedef std::vector< ItemType > VertexListType;
369 typedef typename VertexListType::iterator IteratorType;
370
372 : up2Date_( false )
373 {}
374
375 size_t size () const { return vertexList_.size(); }
376
377 bool up2Date () const { return up2Date_; }
378 void unsetUp2Date () { up2Date_ = false; }
379
380 // make grid walkthrough and calc global size
381 template <class GridType>
382 void setupVxList (const GridType & grid);
383
384 IteratorType begin () { return vertexList_.begin(); }
385 IteratorType end () { return vertexList_.end(); }
386
387 VertexListType & getItemList() { return vertexList_; }
388
389 int getLevel ( const VertexType &vertex ) const
390 {
391 const int idx = vertex.getIndex();
392 alugrid_assert ( idx >= 0 );
393 alugrid_assert ( idx < (int)size());
394 const ItemType & p = vertexList_[idx];
395 if( p.first == 0 )
396 return vertex.level();
397 else
398 return p.second;
399 }
400
401 private:
402 bool up2Date_;
403 VertexListType vertexList_;
404 };
405
406
407
408 class ALU3dGridItemList
409 {
410 public:
411 // level vertex iterator list
412 typedef std::vector < void * > ItemListType;
413 typedef ItemListType :: iterator IteratorType;
414
415 ALU3dGridItemList () : up2Date_(false) {}
416
417 size_t size () const { return itemList_.size(); }
418
419 bool up2Date () const { return up2Date_; }
420 void unsetUp2Date () { up2Date_ = false; }
421
422 void markAsUp2Date() { up2Date_ = true; }
423
424 IteratorType begin () { return itemList_.begin(); }
425 IteratorType end () { return itemList_.end(); }
426
427 ItemListType & getItemList() { return itemList_; }
428
429 private:
430 bool up2Date_;
431 ItemListType itemList_;
432 };
433
434 typedef ALU3dGridItemList ALU3dGridItemListType;
435
437 // some helper functions
439
440 template< class Comm >
441 struct ALU3dGridFaceGetter
442 {
443 static const typename ALU3dImplTraits< tetra, Comm >::GEOFaceType *
444 getFace( const typename ALU3dImplTraits< tetra, Comm >::GEOElementType& elem, int index)
445 {
446 alugrid_assert (index >= 0 && index < 4);
447 return elem.myhface( ElementTopologyMapping< tetra >::dune2aluFace(index) );
448 }
449
450 static const typename ALU3dImplTraits< hexa, Comm >::GEOFaceType*
451 getFace( const typename ALU3dImplTraits< hexa, Comm >::GEOElementType &elem, int index )
452 {
453 alugrid_assert (index >= 0 && index < 6);
454 return elem.myhface( ElementTopologyMapping< hexa >::dune2aluFace(index) );
455 }
456 };
457
458} // end namespace Dune
459
460#endif // #ifndef DUNE_ALUGRID_ALU3DINCLUDE_HH
static int dune2aluFace(int index)
Maps face index from Dune onto ALU3dGrid reference element.
Definition: topology.cc:387
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition: type.hh:506
Dune namespace.
Definition: alignedallocator.hh:13
Definition: alu3dinclude.hh:364
Definition: alu3dinclude.hh:328
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)