Dune Core Modules (2.11.0)

foamgrid.hh
Go to the documentation of this file.
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set ts=8 sw=4 et sts=4:
3#ifndef DUNE_FOAMGRID_HH
4#define DUNE_FOAMGRID_HH
5
10#include <array>
11#include <list>
12#include <set>
13#include <map>
14#include <tuple>
15#include <utility>
16#include <type_traits>
17#include <functional>
18
20
24
25// Implementation classes
26#include "foamgrid/foamgridvertex.hh"
27#include "foamgrid/foamgridedge.hh"
28#include "foamgrid/foamgridelements.hh"
29
30// The components of the FoamGrid interface
39
40namespace Dune {
41
42// Forward declaration
43template <int dimgrid, int dimworld, class ctype = double>
44class FoamGrid;
45
46
48template<int dimgrid, int dimworld, class ctype>
50{
51 typedef GridTraits<
52 dimgrid, // dimgrid
53 dimworld, // dimworld
55 FoamGridGeometry,
59 FoamGridLevelIntersection,
65 FoamGridLeafIndexSet< const FoamGrid<dimgrid, dimworld, ctype> >,
66 FoamGridIdSet< const FoamGrid<dimgrid, dimworld, ctype> >, // global IdSet
67 unsigned int, // global id type
68 FoamGridIdSet< const FoamGrid<dimgrid, dimworld, ctype> >, // local IdSet
69 unsigned int, // local id type
71 DefaultLevelGridViewTraits,
72 DefaultLeafGridViewTraits,
74 > Traits;
75};
76
77
78
84template <int dimgrid, int dimworld, class ct>
85class FoamGrid :
86 public GridDefaultImplementation <dimgrid, dimworld, ct, FoamGridFamily<dimgrid, dimworld, ct> >
87{
88
89 friend class FoamGridLevelIndexSet<const FoamGrid >;
90 friend class FoamGridLeafIndexSet<const FoamGrid >;
91 friend class FoamGridIdSet<const FoamGrid >;
92 friend class FoamGridHierarchicIterator<const FoamGrid >;
94 friend class FoamGridLeafIntersectionIterator<const FoamGrid >;
95 friend class FoamGridLevelIntersection<const FoamGrid >;
96
97 template<int codim, PartitionIteratorType pitype, class GridImp_>
98 friend class FoamGridLevelIterator;
99
100 template<int codim, PartitionIteratorType pitype, class GridImp_>
101 friend class FoamGridLeafIterator;
102
103 template <class GridType_>
104 friend class GridFactory;
105
106 template <int dimgrid_, int dimworld_, class ct_>
107 friend class GridFactoryBase;
108
109 template<int codim_, int dim_, class GridImp_>
110 friend class FoamGridEntity;
111
112public:
113
115 static_assert(dimgrid==1 || dimgrid==2, "Use FoamGrid only for 1d and 2d grids!");
116
117 //**********************************************************
118 // The Interface Methods
119 //**********************************************************
120
123
126
128 typedef ct ctype;
129
133 : entityImps_(makeEntityImps_())
134 , levelIndexSets_(1) // we always have level 0 (even if it's empty)
135 , leafIndexSet_(*this)
136 , freeIdCounter_(0)
137 , globalRefined(0)
138 , numBoundarySegments_(0)
139 , growing_(false)
140 {}
141
144 {
145 // Delete level index sets
146 for (size_t i=0; i<levelIndexSets_.size(); i++)
147 if (levelIndexSets_[i])
148 delete (levelIndexSets_[i]);
149 }
150
151
154 int maxLevel() const {
155 return entityImps_.size()-1;
156 }
157
158
160 template<int codim>
161 typename Traits::template Codim<codim>::LevelIterator lbegin (int level) const {
162 if (level<0 || level>maxLevel())
163 DUNE_THROW(Dune::GridError, "LevelIterator in nonexisting level " << level << " requested!");
164
165 return Dune::FoamGridLevelIterator<codim,All_Partition, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).begin());
166 }
167
168
170 template<int codim>
171 typename Traits::template Codim<codim>::LevelIterator lend (int level) const {
172 if (level<0 || level>maxLevel())
173 DUNE_THROW(GridError, "LevelIterator in nonexisting level " << level << " requested!");
174
175 return Dune::FoamGridLevelIterator<codim,All_Partition, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).end());
176 }
177
178
180 template<int codim, PartitionIteratorType PiType>
181 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lbegin (int level) const {
182 if (level<0 || level>maxLevel())
183 DUNE_THROW(Dune::GridError, "LevelIterator in nonexisting level " << level << " requested!");
184
185 return Dune::FoamGridLevelIterator<codim,PiType, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).begin());
186 }
187
188
190 template<int codim, PartitionIteratorType PiType>
191 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lend (int level) const {
192 if (level<0 || level>maxLevel())
193 DUNE_THROW(GridError, "LevelIterator in nonexisting level " << level << " requested!");
194
195 return Dune::FoamGridLevelIterator<codim,PiType, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).end());
196 }
197
198
200 template<int codim>
201 typename Traits::template Codim<codim>::LeafIterator leafbegin() const {
203 }
204
205
207 template<int codim>
208 typename Traits::template Codim<codim>::LeafIterator leafend() const {
210 }
211
212
214 template<int codim, PartitionIteratorType PiType>
215 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafbegin() const {
217 }
218
219
221 template<int codim, PartitionIteratorType PiType>
222 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafend() const {
224 }
225
226
229 int size (int level, int codim) const {
230
231 // Turn dynamic index into static index
232 if ((codim==2 && dimgrid==2) || (codim==1 && dimgrid==1))
233 return std::get<0>(entityImps_[level]).size();
234 if ((codim==1 && dimgrid==2))
235 return std::get<1>(entityImps_[level]).size();
236 if (codim==0)
237 return std::get<dimgrid>(entityImps_[level]).size();
238
239 return 0;
240 }
241
242
244 int size (int codim) const{
245 return leafIndexSet().size(codim);
246 }
247
248
250 int size (int level, GeometryType type) const {
251 return this->levelIndexSet(level).size(type);
252 }
253
254
256 int size (GeometryType type) const
257 {
258 return this->leafIndexSet().size(type);
259 }
260
262 size_t numBoundarySegments() const
263 {
264 return numBoundarySegments_;
265 }
266
268 const typename Traits::GlobalIdSet& globalIdSet() const{
269 return idSet_;
270 }
271
272
274 const typename Traits::LocalIdSet& localIdSet() const{
275 return idSet_;
276 }
277
278
280 const typename Traits::LevelIndexSet& levelIndexSet(int level) const
281 {
282 if (level<0 || level>maxLevel())
283 DUNE_THROW(GridError, "LevelIndexSet for nonexisting level " << level << " requested!");
284
285 if (! levelIndexSets_[level])
286 {
287 levelIndexSets_[level] = new FoamGridLevelIndexSet<const FoamGrid>(*this, level);
288 levelIndexSets_[level]->update();
289 }
290 return *levelIndexSets_[level];
291 }
292
293
295 const typename Traits::LeafIndexSet& leafIndexSet() const
296 {
297 return leafIndexSet_;
298 }
299
301 template <class EntitySeed>
302 typename Traits::template Codim<EntitySeed::codimension>::Entity
303 entity(const EntitySeed& seed) const
304 {
305 const int codim = EntitySeed::codimension;
307 }
308
309
312
313
317 void globalRefine (int refCount = 1);
318
329 bool mark(int refCount, const typename Traits::template Codim<0>::Entity & e)
330 {
331 if (!e.isLeaf())
332 return false;
333
335 if (refCount>=1)
337 else if (refCount<0)
339 else
341
342 return true;
343 }
344
349 int getMark(const typename Traits::template Codim<0>::Entity & e) const
350 {
351 switch(e.impl().target_->markState_)
352 {
355 return 0;
357 return 1;
359 return -1;
360 }
361 return 0;
362 }
363
365 bool preAdapt();
366
368 bool adapt();
369
371 void postAdapt();
372
383 void setPosition(const typename Traits::template Codim<dimgrid>::Entity & e,
385
388
394 {
395 if(!growing_) initializeGrowth_();
396
397 // the final level of the vertex will be the minimum common vertex level of the new element
398 verticesToInsert_.push_back(FoamGridEntityImp<0, dimgrid, dimworld, ctype>(0, pos, -verticesToInsert_.size()-1)); // initialize with some invalid id
399 FoamGridEntityImp<0, dimgrid, dimworld, ctype>& newVertex = verticesToInsert_.back();
400 newVertex.isNew_ = true;
401 // new vertices are numbered consecutively starting from
402 // the highest available index in the leaf index set +1
403 newVertex.growthInsertionIndex_ = this->leafGridView().size(dimgrid) - 1 + verticesToInsert_.size();
404 return newVertex.growthInsertionIndex_;
405 }
406
413 unsigned int insertElement(const GeometryType& type,
414 const std::vector<unsigned int>& vertices)
415 {
416 // foamgrid only supports simplices until now
417 assert(type.isTriangle() || type.isLine());
418 assert(vertices.size() == dimgrid + 1);
419
420 // the final level of the element will be the minimum common vertex level
421 elementsToInsert_.push_back(FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>(0, -elementsToInsert_.size()-1)); // initialize with some invalid id
422 FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>& newElement = elementsToInsert_.back();
423 assert(vertices.size() == newElement.vertex_.size());
424
425 for(std::size_t i = 0; i < vertices.size(); i++)
426 {
427 if(int(vertices[i]) >= this->leafGridView().size(dimgrid))
428 {
429 // initialize with pointer to vertex in verticesToInsert_ vector, later overwrite with actual pointer
430 auto vIt = verticesToInsert_.begin();
431 std::advance(vIt, vertices[i] - this->leafGridView().size(dimgrid));
432 newElement.vertex_[i] = &*vIt;
433 }
434 else
435 {
436 // make sure the index to vertex map has been initialized
437 if(!growing_) initializeGrowth_();
438 // the vertex already exists in the grid, initialize with leaf vertex, later overwrite with lowest level father
439 assert(indexToVertexMap_[vertices[i]]->isLeaf());
440 newElement.vertex_[i] = indexToVertexMap_[vertices[i]];
441 }
442 }
443 newElement.isNew_ = true;
444 newElement.growthInsertionIndex_ = elementsToInsert_.size()-1;
445 return newElement.growthInsertionIndex_;
446 }
447
455 unsigned int insertElement(const GeometryType& type,
456 const std::vector<unsigned int>& vertices,
457 std::function<FieldVector<ctype,dimworld>(FieldVector<ctype,dimgrid>)> elementParametrization)
458 {
459 auto growthInsertionIndex = insertElement(type, vertices);
460 // save the pointer to the element parametrization
461 elementsToInsert_.back().elementParametrization_ = elementParametrization;
463 }
464
468 void removeElement(const typename Traits::template Codim<0>::Entity & e)
469 {
470 // save entity for later, actual removal happens in grow()
471 elementsToRemove_.push_back(const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>*> (e.impl().target_));
472 }
473
475 bool preGrow();
476
478 bool grow();
479
481 void postGrow();
482
491 unsigned int growthInsertionIndex(const typename Traits::template Codim<0>::Entity & e) const
492 {
493 int idx = e.impl().target_->growthInsertionIndex_;
494 assert(idx >= 0);
495 return static_cast<unsigned int>(idx);
496 }
497
506 unsigned int growthInsertionIndex(const typename Traits::template Codim<dimgrid>::Entity & e) const
507 {
508 int idx = e.impl().target_->growthInsertionIndex_;
509 assert(idx >= 0);
510 return static_cast<unsigned int>(idx);
511 }
512
517
519 unsigned int overlapSize(int codim) const {
520 return 0;
521 }
522
523
525 unsigned int ghostSize(int codim) const {
526 return 0;
527 }
528
529
531 unsigned int overlapSize(int level, int codim) const {
532 return 0;
533 }
534
535
537 unsigned int ghostSize(int level, int codim) const {
538 return 0;
539 }
540
543 template<class DataHandle>
544 bool loadBalance(DataHandle& data)
545 {
546 return loadBalance();
547 }
548
549 bool loadBalance()
550 {
551 if (comm().size() > 1)
552 DUNE_THROW(Dune::NotImplemented, "Load balancing not implemented. Foamgrid does not run in parallel yet!");
553 return false;
554 }
555
567 template<class T, template<class> class P, int codim>
568 void communicate (T& t, InterfaceType iftype, CommunicationDirection dir, int level) const
569 {}
570
574 template<class DataHandle>
575 void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir, int level) const
576 {}
577
578 template<class DataHandle>
579 void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir) const
580 {}
581
583 const typename Traits::Communication& comm () const
584 {
585 return ccobj_;
586 }
590 // **********************************************************
591 // End of Interface Methods
592 // **********************************************************
593
594 private:
595
597 void initializeGrowth_()
598 {
599 // update the index to vertex map
600 indexToVertexMap_.resize(this->leafGridView().size(dimgrid));
601 for (const auto& vertex : vertices(this->leafGridView()))
602 {
603 std::size_t index = leafIndexSet().index(vertex);
604 indexToVertexMap_[index] = const_cast<FoamGridEntityImp<0, dimgrid ,dimworld, ctype>*>(vertex.impl().target_);
605 }
606
607 // tell the grid it's ready for growth
608 growing_ = true;
609 }
610
612 void erasePointersToEntities(std::list<FoamGridEntityImp<dimgrid, dimgrid ,dimworld, ctype> >& elements);
613
618 template<int i>
619 void eraseVanishedEntities(std::list<FoamGridEntityImp<i, dimgrid, dimworld, ctype> >& levelEntities);
620
623 void coarsenSimplexElement(FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>& element);
624
628 void refineSimplexElement(FoamGridEntityImp<2, 2, dimworld, ctype>& element, int refCount);
630 void refineSimplexElement(FoamGridEntityImp<1, 1, dimworld, ctype>& element, int refCount);
631
633 bool removeSimplexElement(FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>& element);
634
644 void overwriteFineLevelNeighbours(FoamGridEntityImp<dimgrid-1, dimgrid, dimworld, ctype>& edge,
645 const FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* son,
646 const FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* father);
647
654 void addElementForFacet(const FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* element,
655 FoamGridEntityImp<dimgrid-1, dimgrid, dimworld, ctype>* facet);
656
658 void addNewFacet(FoamGridEntityImp<dimgrid-1, dimgrid, dimworld, ctype>* &facet,
659 std::array<FoamGridEntityImp<0, dimgrid, dimworld, ctype>*,dimgrid> vertexArray,
660 int level);
661
663 void setIndices();
664
668 unsigned int getNextFreeId()
669 {
670 return freeIdCounter_++;
671 }
672
674 void computeTwoZeroConnectivity()
675 {
676 // the elements vector for vertices is already available as they are facets in 1d grids
677 for(int level = 0; level <= maxLevel(); ++level)
678 {
679 // do it everytime freshly so that we don't have to take care of 2-0 connectivity in adaptivity
680 for(auto&& vertex : std::get<0>(entityImps_[level]))
681 vertex.elements_.clear();
682
683 for(auto eIt = std::get<dimgrid>(entityImps_[level]).begin(); eIt != std::get<dimgrid>(entityImps_[level]).end(); ++eIt)
684 for(auto&& vertex : eIt->vertex_)
685 vertex->elements_.push_back(&*eIt);
686 }
687 }
688
690 typename Traits::Communication ccobj_;
691
692 template<std::size_t... dimEntity>
693 static auto makeEntityImpsImpl_(std::index_sequence<dimEntity...>, std::size_t numLevels)
694 { return std::vector<std::tuple<std::list<FoamGridEntityImp<dimEntity, dimgrid, dimworld, ctype>>...>>(numLevels); }
695
696 // Create the lists of vertices, edges, elements for each level
697 static auto makeEntityImps_(std::size_t numLevels = 1)
698 { return makeEntityImpsImpl_(std::make_index_sequence<dimgrid+1>{}, numLevels); }
699
700 // The vector type for tuple of lists of vertices, edges, elements for each level
701 using EntityImps = std::decay_t<decltype(makeEntityImps_())>;
702
703 // The tuple type of lists of vertices, edges, elements
704 using EntityTuple = typename EntityImps::value_type;
705
707 EntityImps entityImps_;
708
710 mutable std::vector<FoamGridLevelIndexSet<const FoamGrid>*> levelIndexSets_;
711
713 FoamGridLeafIndexSet<const FoamGrid > leafIndexSet_;
714
716 FoamGridIdSet<const FoamGrid > idSet_;
717
719 unsigned int freeIdCounter_;
720
722 int globalRefined;
723
725 std::size_t numBoundarySegments_;
726
727 // True if the last call to preadapt returned true
728 bool willCoarsen;
729
731 std::vector<FoamGridEntityImp<0, dimgrid, dimworld, ctype>* > indexToVertexMap_;
732
734 std::vector<FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* > elementsToRemove_;
735
737 std::list<FoamGridEntityImp<0, dimgrid, dimworld, ctype> > verticesToInsert_;
738
740 std::list<FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype> > elementsToInsert_;
741
743 bool growing_;
744
745}; // end Class FoamGrid
746
747#include <dune/foamgrid/foamgrid/foamgrid.cc>
748
749namespace Capabilities
750{
755 template<int dimgrid, int dimworld, class ctype, int codim>
756 struct hasEntity< FoamGrid<dimgrid, dimworld, ctype>, codim>
757 {
758 static const bool v = true;
759 };
760
762 template <int dimgrid, int dimworld, class ctype>
763 struct isLevelwiseConforming< FoamGrid<dimgrid, dimworld, ctype> >
764 {
765 static const bool v = false;
766 };
767
769 template <int dimgrid, int dimworld, class ctype>
770 struct isLeafwiseConforming< FoamGrid<dimgrid, dimworld, ctype> >
771 {
772 static const bool v = false;
773 };
774
777 template<int dimgrid, int dimworld, class ctype>
778 struct viewThreadSafe< FoamGrid<dimgrid, dimworld, ctype> > {
779 static const bool v = true;
780 };
781}
782
783} // namespace Dune
784
785
786// The factory should be present whenever the user includes foamgrid.hh.
787// However since the factory needs to know the grid the include directive
788// comes here at the end.
790
791#endif
Collective communication interface and sequential default implementation.
Definition: communication.hh:100
Store a reference to an entity with a minimal memory footprint.
Definition: entityseed.hh:26
Implementation & impl()
access to the underlying implementation
Definition: entityseed.hh:59
static constexpr int codimension
codimension of underlying entity
Definition: entityseed.hh:30
Vertex specialization of FoamGridEntityImp.
Definition: foamgridvertex.hh:53
int growthInsertionIndex_
If this vertex was created in a growth step this will be the index of insertion So if this is the fir...
Definition: foamgridvertex.hh:148
bool isNew_
If the vertex was newly inserted (at run-time)
Definition: foamgridvertex.hh:141
Element specialization of FoamGridEntityImp. Element is a grid entity of topological codimension 0 an...
Definition: foamgridelements.hh:18
The actual entity implementation.
Definition: foamgridvertex.hh:47
The EntitySeed class provides the minmal information needed to restore an Entity using the grid.
Definition: foamgridentityseed.hh:21
The implementation of entities in a FoamGrid.
Definition: foamgridentity.hh:51
Iterator over the descendants of an entity.Mesh entities of codimension 0 ("elements") allow to visit...
Definition: foamgridhierarchiciterator.hh:24
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: foamgridintersectioniterators.hh:28
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: foamgridintersections.hh:386
Iterator over all entities of a given codimension and level of a grid.
Definition: foamgridleafiterator.hh:15
Definition: foamgridindexsets.hh:26
Definition: foamgridintersectioniterators.hh:239
Iterator over all entities of a given codimension and level of a grid.
Definition: foamgridleveliterator.hh:18
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: foamgrid.hh:191
void removeElement(const typename Traits::template Codim< 0 >::Entity &e)
Mark an element for removal from the grid.
Definition: foamgrid.hh:468
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: foamgrid.hh:531
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: foamgrid.hh:250
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: foamgrid.hh:274
size_t numBoundarySegments() const
The number of boundary edges on the coarsest level.
Definition: foamgrid.hh:262
void setPosition(const typename Traits::template Codim< dimgrid >::Entity &e, const FieldVector< ctype, dimworld > &pos)
Sets a (leaf) vertex to a new position.
Definition: foamgrid.cc:1422
void communicate(T &t, InterfaceType iftype, CommunicationDirection dir, int level) const
The communication interface.
Definition: foamgrid.hh:568
FoamGrid()
Constructor, constructs an empty grid.
Definition: foamgrid.hh:132
bool preGrow()
Book-keeping routine to be called before growth.
Definition: foamgrid.cc:1001
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark entity for refinement.
Definition: foamgrid.hh:329
FoamGridFamily< dimgrid, dimworld, ct > GridFamily
FoamGrid is only implemented for 1 and 2 dimension.
Definition: foamgrid.hh:122
unsigned int insertVertex(const FieldVector< ctype, dimworld > &pos)
Add new vertex to be added the grid.
Definition: foamgrid.hh:393
~FoamGrid()
Destructor.
Definition: foamgrid.hh:143
unsigned int growthInsertionIndex(const typename Traits::template Codim< 0 >::Entity &e) const
The index of insertion if the element was created in the current growth step. If this is the first el...
Definition: foamgrid.hh:491
void postGrow()
Clean up isNew markers.
Definition: foamgrid.cc:1325
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: foamgrid.hh:349
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: foamgrid.hh:222
unsigned int insertElement(const GeometryType &type, const std::vector< unsigned int > &vertices)
Add a new element to be added to the grid.
Definition: foamgrid.hh:413
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: foamgrid.hh:575
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: foamgrid.hh:280
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: foamgrid.hh:268
bool loadBalance(DataHandle &data)
Distributes this grid over the available nodes in a distributed machine.
Definition: foamgrid.hh:544
const Traits::Communication & comm() const
Definition: foamgrid.hh:583
bool preAdapt()
Book-keeping routine to be called before adaptation.
Definition: foamgrid.cc:152
FoamGridFamily< dimgrid, dimworld, ct >::Traits Traits
Exports various types belonging to this grid class.
Definition: foamgrid.hh:125
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: foamgrid.hh:161
void postAdapt()
Clean up refinement markers.
Definition: foamgrid.cc:317
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: foamgrid.hh:256
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: foamgrid.hh:201
void globalRefine(int refCount=1)
Refine the grid uniformly.
Definition: foamgrid.cc:3
unsigned int insertElement(const GeometryType &type, const std::vector< unsigned int > &vertices, std::function< FieldVector< ctype, dimworld >(FieldVector< ctype, dimgrid >)> elementParametrization)
Add a new element to be added to the grid.
Definition: foamgrid.hh:455
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: foamgrid.hh:208
ct ctype
The type used to store coordinates.
Definition: foamgrid.hh:128
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: foamgrid.hh:519
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: foamgrid.hh:181
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: foamgrid.hh:215
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: foamgrid.hh:537
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create an Entity from an EntitySeed.
Definition: foamgrid.hh:303
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: foamgrid.hh:525
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: foamgrid.hh:171
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: foamgrid.hh:295
int maxLevel() const
Definition: foamgrid.hh:154
bool grow()
Triggers the grid growth process.
Definition: foamgrid.cc:1008
unsigned int growthInsertionIndex(const typename Traits::template Codim< dimgrid >::Entity &e) const
The index of insertion if the vertex was created in the current growth step. If this is the first ver...
Definition: foamgrid.hh:506
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: foamgrid.hh:229
bool adapt()
Triggers the grid refinement process.
Definition: foamgrid.cc:206
int size(int codim) const
number of leaf entities per codim in this process
Definition: foamgrid.hh:244
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
constexpr bool isTriangle() const
Return true if entity is a triangle.
Definition: type.hh:289
constexpr bool isLine() const
Return true if entity is a line segment.
Definition: type.hh:284
Definition: grid.hh:848
Traits::LeafGridView leafGridView() const
View for the leaf grid for All_Partition.
Definition: grid.hh:868
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:20
Specialization of the generic GridFactory for FoamGrid<dimgrid, dimworld>
Definition: foamgridfactory.hh:29
Provide a generic factory class for unstructured grids.
Definition: gridfactory.hh:275
Id Set Interface.
Definition: indexidset.hh:447
Index Set Interface base class.
Definition: indexidset.hh:78
auto size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:223
IndexType index(const typename Traits::template Codim< cc >::Entity &e) const
Map entity to index. The result of calling this method with an entity that is not in the index set is...
Definition: indexidset.hh:113
Default exception for dummy implementations.
Definition: exceptions.hh:357
A set of traits classes to store static information about grid implementation.
Different resources needed by all grid implementations.
Implements an utility class that provides collective communication methods for sequential programs.
The FoamGridEntity class.
Implementation of EntitySeed for the FoamGrid grid manager.
The specialization of the generic GridFactory for FoamGrid.
The FoamGridGeometry class.
The FoamGridHierarchicIterator class.
The index and id sets for the FoamGrid class.
The FoamGridLeafIntersectionIterator and FoamGridLevelIntersectionIterator classes.
The FoamGridLeafIterator class.
The FoamGridLevelIterator class.
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
int size(int codim) const
obtain number of entities in a given codimension
Definition: gridview.hh:183
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition: type.hh:492
auto elements(const SubDomainGridView< HostGridView > &subDomainGridView)
ADL findable access to element range for a SubDomainGridView.
Definition: subdomain.hh:487
Dune namespace
Definition: alignedallocator.hh:13
Standard Dune debug streams.
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: capabilities.hh:58
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: capabilities.hh:115
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: capabilities.hh:106
Specialize with 'true' if the grid implementation is thread safe, while it is not modified....
Definition: capabilities.hh:169
Static tag representing a codimension.
Definition: dimension.hh:24
Encapsulates loads of types exported by FoamGrid.
Definition: foamgrid.hh:50
A traits struct that collects all associated types of one grid model.
Definition: grid.hh:1013
CCType Communication
The type of the communication.
Definition: grid.hh:1089
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Feb 14, 23:39, 2026)