dune-foamgrid 2.8.0
Loading...
Searching...
No Matches
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
19// TODO remove header and macro after release Dune 2.8
20#define DUNE_FUNCTION_HH_SILENCE_DEPRECATION // silence deprecation warning from <dune/common/function.hh>
21#include <dune/common/function.hh>
22
23#include <dune/common/version.hh>
24#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
25#include <dune/common/parallel/collectivecommunication.hh>
26#else
27#include <dune/common/parallel/communication.hh>
28#endif
29
30#include <dune/common/stdstreams.hh>
31#include <dune/grid/common/capabilities.hh>
32#include <dune/grid/common/grid.hh>
33
34// Implementation classes
38
39// The components of the FoamGrid interface
48
49namespace Dune {
50
51// Forward declaration
52template <int dimgrid, int dimworld, class ctype = double>
53class FoamGrid;
54
55
57template<int dimgrid, int dimworld, class ctype>
59{
60 typedef GridTraits<
61 dimgrid, // dimgrid
62 dimworld, // dimworld
76 unsigned int, // global id type
78 unsigned int, // local id type
79 CollectiveCommunication<Dune::FoamGrid<dimgrid, dimworld, ctype> > ,
80 DefaultLevelGridViewTraits,
81 DefaultLeafGridViewTraits,
84};
85
86
87
93template <int dimgrid, int dimworld, class ct>
94class FoamGrid :
95 public GridDefaultImplementation <dimgrid, dimworld, ct, FoamGridFamily<dimgrid, dimworld, ct> >
96{
97
98 friend class FoamGridLevelIndexSet<const FoamGrid >;
99 friend class FoamGridLeafIndexSet<const FoamGrid >;
100 friend class FoamGridIdSet<const FoamGrid >;
101 friend class FoamGridHierarchicIterator<const FoamGrid >;
102 friend class FoamGridLevelIntersectionIterator<const FoamGrid >;
103 friend class FoamGridLeafIntersectionIterator<const FoamGrid >;
104 friend class FoamGridLevelIntersection<const FoamGrid >;
105
106 template<int codim, PartitionIteratorType pitype, class GridImp_>
108
109 template<int codim, PartitionIteratorType pitype, class GridImp_>
111
112 template <class GridType_>
113 friend class GridFactory;
114
115 template <int dimgrid_, int dimworld_, class ct_>
116 friend class GridFactoryBase;
117
118 template<int codim_, int dim_, class GridImp_>
119 friend class FoamGridEntity;
120
121public:
122
124 static_assert(dimgrid==1 || dimgrid==2, "Use FoamGrid only for 1d and 2d grids!");
125
126 //**********************************************************
127 // The Interface Methods
128 //**********************************************************
129
132
135
137 typedef ct ctype;
138
142 : entityImps_(makeEntityImps_())
143 , levelIndexSets_(1) // we always have level 0 (even if it's empty)
144 , leafIndexSet_(*this)
145 , freeIdCounter_(0)
146 , globalRefined(0)
147 , numBoundarySegments_(0)
148 , growing_(false)
149 {}
150
153 {
154 // Delete level index sets
155 for (size_t i=0; i<levelIndexSets_.size(); i++)
156 if (levelIndexSets_[i])
157 delete (levelIndexSets_[i]);
158 }
159
160
163 int maxLevel() const {
164 return entityImps_.size()-1;
165 }
166
167
169 template<int codim>
170 typename Traits::template Codim<codim>::LevelIterator lbegin (int level) const {
171 if (level<0 || level>maxLevel())
172 DUNE_THROW(Dune::GridError, "LevelIterator in nonexisting level " << level << " requested!");
173
174 return Dune::FoamGridLevelIterator<codim,All_Partition, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).begin());
175 }
176
177
179 template<int codim>
180 typename Traits::template Codim<codim>::LevelIterator lend (int level) const {
181 if (level<0 || level>maxLevel())
182 DUNE_THROW(GridError, "LevelIterator in nonexisting level " << level << " requested!");
183
184 return Dune::FoamGridLevelIterator<codim,All_Partition, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).end());
185 }
186
187
189 template<int codim, PartitionIteratorType PiType>
190 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lbegin (int level) const {
191 if (level<0 || level>maxLevel())
192 DUNE_THROW(Dune::GridError, "LevelIterator in nonexisting level " << level << " requested!");
193
194 return Dune::FoamGridLevelIterator<codim,PiType, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).begin());
195 }
196
197
199 template<int codim, PartitionIteratorType PiType>
200 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lend (int level) const {
201 if (level<0 || level>maxLevel())
202 DUNE_THROW(GridError, "LevelIterator in nonexisting level " << level << " requested!");
203
204 return Dune::FoamGridLevelIterator<codim,PiType, const Dune::FoamGrid<dimgrid, dimworld, ctype> >(std::get<dimgrid-codim>(entityImps_[level]).end());
205 }
206
207
209 template<int codim>
210 typename Traits::template Codim<codim>::LeafIterator leafbegin() const {
212 }
213
214
216 template<int codim>
217 typename Traits::template Codim<codim>::LeafIterator leafend() const {
219 }
220
221
223 template<int codim, PartitionIteratorType PiType>
224 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafbegin() const {
226 }
227
228
230 template<int codim, PartitionIteratorType PiType>
231 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafend() const {
233 }
234
235
238 int size (int level, int codim) const {
239
240 // Turn dynamic index into static index
241 if ((codim==2 && dimgrid==2) || (codim==1 && dimgrid==1))
242 return std::get<0>(entityImps_[level]).size();
243 if ((codim==1 && dimgrid==2))
244 return std::get<1>(entityImps_[level]).size();
245 if (codim==0)
246 return std::get<dimgrid>(entityImps_[level]).size();
247
248 return 0;
249 }
250
251
253 int size (int codim) const{
254 return leafIndexSet().size(codim);
255 }
256
257
259 int size (int level, GeometryType type) const {
260 return this->levelIndexSet(level).size(type);
261 }
262
263
265 int size (GeometryType type) const
266 {
267 return this->leafIndexSet().size(type);
268 }
269
271 size_t numBoundarySegments() const
272 {
273 return numBoundarySegments_;
274 }
275
277 const typename Traits::GlobalIdSet& globalIdSet() const{
278 return idSet_;
279 }
280
281
283 const typename Traits::LocalIdSet& localIdSet() const{
284 return idSet_;
285 }
286
287
289 const typename Traits::LevelIndexSet& levelIndexSet(int level) const
290 {
291 if (level<0 || level>maxLevel())
292 DUNE_THROW(GridError, "LevelIndexSet for nonexisting level " << level << " requested!");
293
294 if (! levelIndexSets_[level])
295 {
296 levelIndexSets_[level] = new FoamGridLevelIndexSet<const FoamGrid>(*this, level);
297 levelIndexSets_[level]->update();
298 }
299 return *levelIndexSets_[level];
300 }
301
302
304 const typename Traits::LeafIndexSet& leafIndexSet() const
305 {
306 return leafIndexSet_;
307 }
308
310 template <class EntitySeed>
311 typename Traits::template Codim<EntitySeed::codimension>::Entity
312 entity(const EntitySeed& seed) const
313 {
314 const int codim = EntitySeed::codimension;
315 return FoamGridEntity<codim, dimgrid, const FoamGrid>(seed.impl().target());
316 }
317
318
321
322
326 void globalRefine (int refCount = 1);
327
338 bool mark(int refCount, const typename Traits::template Codim<0>::Entity & e)
339 {
340 if (!e.isLeaf())
341 return false;
342
344 if (refCount>=1)
346 else if (refCount<0)
348 else
350
351 return true;
352 }
353
358 int getMark(const typename Traits::template Codim<0>::Entity & e) const
359 {
360 switch(e.impl().target_->markState_)
361 {
364 return 0;
366 return 1;
368 return -1;
369 }
370 return 0;
371 }
372
374 bool preAdapt();
375
377 bool adapt();
378
380 void postAdapt();
381
392 void setPosition(const typename Traits::template Codim<dimgrid>::Entity & e,
393 const FieldVector<ctype, dimworld>& pos);
394
397
402 unsigned int insertVertex(const FieldVector<ctype,dimworld>& pos)
403 {
404 if(!growing_) initializeGrowth_();
405
406 // the final level of the vertex will be the minimum common vertex level of the new element
407 verticesToInsert_.push_back(FoamGridEntityImp<0, dimgrid, dimworld, ctype>(0, pos, -verticesToInsert_.size()-1)); // initialize with some invalid id
408 FoamGridEntityImp<0, dimgrid, dimworld, ctype>& newVertex = verticesToInsert_.back();
409 newVertex.isNew_ = true;
410 // new vertices are numbered consecutively starting from
411 // the highest available index in the leaf index set +1
412 newVertex.growthInsertionIndex_ = this->leafGridView().size(dimgrid) - 1 + verticesToInsert_.size();
413 return newVertex.growthInsertionIndex_;
414 }
415
422 unsigned int insertElement(const GeometryType& type,
423 const std::vector<unsigned int>& vertices)
424 {
425 // foamgrid only supports simplices until now
426 assert(type.isTriangle() || type.isLine());
427 assert(vertices.size() == dimgrid + 1);
428
429 // the final level of the element will be the minimum common vertex level
430 elementsToInsert_.push_back(FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>(0, -elementsToInsert_.size()-1)); // initialize with some invalid id
431 FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>& newElement = elementsToInsert_.back();
432 assert(vertices.size() == newElement.vertex_.size());
433
434 for(std::size_t i = 0; i < vertices.size(); i++)
435 {
436 if(int(vertices[i]) >= this->leafGridView().size(dimgrid))
437 {
438 // initialize with pointer to vertex in verticesToInsert_ vector, later overwrite with actual pointer
439 auto vIt = verticesToInsert_.begin();
440 std::advance(vIt, vertices[i] - this->leafGridView().size(dimgrid));
441 newElement.vertex_[i] = &*vIt;
442 }
443 else
444 {
445 // make sure the index to vertex map has been initialized
446 if(!growing_) initializeGrowth_();
447 // the vertex already exists in the grid, initialize with leaf vertex, later overwrite with lowest level father
448 assert(indexToVertexMap_[vertices[i]]->isLeaf());
449 newElement.vertex_[i] = indexToVertexMap_[vertices[i]];
450 }
451 }
452 newElement.isNew_ = true;
453 newElement.growthInsertionIndex_ = elementsToInsert_.size()-1;
454 return newElement.growthInsertionIndex_;
455 }
456
457DUNE_NO_DEPRECATED_BEGIN
465 [[deprecated("Signature with VirtualFunction is deprecated and will be removed after Dune 2.8. Use signature with std::function.")]]
466 unsigned int insertElement(const GeometryType& type,
467 const std::vector<unsigned int>& vertices,
468 const std::shared_ptr<VirtualFunction<FieldVector<ctype,dimgrid>,FieldVector<ctype,dimworld> > >& elementParametrization)
469 {
470 auto growthInsertionIndex = insertElement(type, vertices);
471 // save the pointer to the element parametrization
472 elementsToInsert_.back().elementParametrization_ =
473 [elementParametrization](const FieldVector<ctype,dimgrid>& x){
474 FieldVector<ctype,dimworld> y;
475 elementParametrization->evaluate(x, y);
476 return y;
477 };
479 }
480DUNE_NO_DEPRECATED_END
481
489 unsigned int insertElement(const GeometryType& type,
490 const std::vector<unsigned int>& vertices,
491 std::function<FieldVector<ctype,dimworld>(FieldVector<ctype,dimgrid>)> elementParametrization)
492 {
493 auto growthInsertionIndex = insertElement(type, vertices);
494 // save the pointer to the element parametrization
495 elementsToInsert_.back().elementParametrization_ = elementParametrization;
497 }
498
502 void removeElement(const typename Traits::template Codim<0>::Entity & e)
503 {
504 // save entity for later, actual removal happens in grow()
505 elementsToRemove_.push_back(const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>*> (e.impl().target_));
506 }
507
509 bool preGrow();
510
512 bool grow();
513
515 void postGrow();
516
525 unsigned int growthInsertionIndex(const typename Traits::template Codim<0>::Entity & e) const
526 {
527 int idx = e.impl().target_->growthInsertionIndex_;
528 assert(idx >= 0);
529 return static_cast<unsigned int>(idx);
530 }
531
540 unsigned int growthInsertionIndex(const typename Traits::template Codim<dimgrid>::Entity & e) const
541 {
542 int idx = e.impl().target_->growthInsertionIndex_;
543 assert(idx >= 0);
544 return static_cast<unsigned int>(idx);
545 }
546
551
553 unsigned int overlapSize(int codim) const {
554 return 0;
555 }
556
557
559 unsigned int ghostSize(int codim) const {
560 return 0;
561 }
562
563
565 unsigned int overlapSize(int level, int codim) const {
566 return 0;
567 }
568
569
571 unsigned int ghostSize(int level, int codim) const {
572 return 0;
573 }
574
577 template<class DataHandle>
578 bool loadBalance(DataHandle& data)
579 {
580 return loadBalance();
581 }
582
584 {
585 if (comm().size() > 1)
586 DUNE_THROW(Dune::NotImplemented, "Load balancing not implemented. Foamgrid does not run in parallel yet!");
587 return false;
588 }
589
601 template<class T, template<class> class P, int codim>
602 void communicate (T& t, InterfaceType iftype, CommunicationDirection dir, int level) const
603 {}
604
608 template<class DataHandle>
609 void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir, int level) const
610 {}
611
612 template<class DataHandle>
613 void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir) const
614 {}
615
617 const typename Traits::CollectiveCommunication& comm () const
618 {
619 return ccobj_;
620 }
624 // **********************************************************
625 // End of Interface Methods
626 // **********************************************************
627
628 private:
629
631 void initializeGrowth_()
632 {
633 // update the index to vertex map
634 indexToVertexMap_.resize(this->leafGridView().size(dimgrid));
635 for (const auto& vertex : vertices(this->leafGridView()))
636 {
637 std::size_t index = leafIndexSet().index(vertex);
638 indexToVertexMap_[index] = const_cast<FoamGridEntityImp<0, dimgrid ,dimworld, ctype>*>(vertex.impl().target_);
639 }
640
641 // tell the grid it's ready for growth
642 growing_ = true;
643 }
644
646 void erasePointersToEntities(std::list<FoamGridEntityImp<dimgrid, dimgrid ,dimworld, ctype> >& elements);
647
652 template<int i>
653 void eraseVanishedEntities(std::list<FoamGridEntityImp<i, dimgrid, dimworld, ctype> >& levelEntities);
654
657 void coarsenSimplexElement(FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>& element);
658
662 void refineSimplexElement(FoamGridEntityImp<2, 2, dimworld, ctype>& element, int refCount);
664 void refineSimplexElement(FoamGridEntityImp<1, 1, dimworld, ctype>& element, int refCount);
665
667 bool removeSimplexElement(FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>& element);
668
678 void overwriteFineLevelNeighbours(FoamGridEntityImp<dimgrid-1, dimgrid, dimworld, ctype>& edge,
679 const FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* son,
680 const FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* father);
681
688 void addElementForFacet(const FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* element,
689 FoamGridEntityImp<dimgrid-1, dimgrid, dimworld, ctype>* facet);
690
692 void addNewFacet(FoamGridEntityImp<dimgrid-1, dimgrid, dimworld, ctype>* &facet,
693 std::array<FoamGridEntityImp<0, dimgrid, dimworld, ctype>*,dimgrid> vertexArray,
694 int level);
695
697 void setIndices();
698
702 unsigned int getNextFreeId()
703 {
704 return freeIdCounter_++;
705 }
706
708 void computeTwoZeroConnectivity()
709 {
710 // the elements vector for vertices is already available as they are facets in 1d grids
711 for(int level = 0; level <= maxLevel(); ++level)
712 {
713 // do it everytime freshly so that we don't have to take care of 2-0 connectivity in adaptivity
714 for(auto&& vertex : std::get<0>(entityImps_[level]))
715 vertex.elements_.clear();
716
717 for(auto eIt = std::get<dimgrid>(entityImps_[level]).begin(); eIt != std::get<dimgrid>(entityImps_[level]).end(); ++eIt)
718 for(auto&& vertex : eIt->vertex_)
719 vertex->elements_.push_back(&*eIt);
720 }
721 }
722
724 typename Traits::CollectiveCommunication ccobj_;
725
726 template<std::size_t... dimEntity>
727 static auto makeEntityImpsImpl_(std::index_sequence<dimEntity...>, std::size_t numLevels)
728 { return std::vector<std::tuple<std::list<FoamGridEntityImp<dimEntity, dimgrid, dimworld, ctype>>...>>(numLevels); }
729
730 // Create the lists of vertices, edges, elements for each level
731 static auto makeEntityImps_(std::size_t numLevels = 1)
732 { return makeEntityImpsImpl_(std::make_index_sequence<dimgrid+1>{}, numLevels); }
733
734 // The vector type for tuple of lists of vertices, edges, elements for each level
735 using EntityImps = std::decay_t<decltype(makeEntityImps_())>;
736
737 // The tuple type of lists of vertices, edges, elements
738 using EntityTuple = typename EntityImps::value_type;
739
741 EntityImps entityImps_;
742
744 mutable std::vector<FoamGridLevelIndexSet<const FoamGrid>*> levelIndexSets_;
745
748
751
753 unsigned int freeIdCounter_;
754
756 int globalRefined;
757
759 std::size_t numBoundarySegments_;
760
761 // True if the last call to preadapt returned true
762 bool willCoarsen;
763
765 std::vector<FoamGridEntityImp<0, dimgrid, dimworld, ctype>* > indexToVertexMap_;
766
768 std::vector<FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype>* > elementsToRemove_;
769
771 std::list<FoamGridEntityImp<0, dimgrid, dimworld, ctype> > verticesToInsert_;
772
774 std::list<FoamGridEntityImp<dimgrid, dimgrid, dimworld, ctype> > elementsToInsert_;
775
777 bool growing_;
778
779}; // end Class FoamGrid
780
782
783namespace Capabilities
784{
789 template<int dimgrid, int dimworld, class ctype, int codim>
790 struct hasEntity< FoamGrid<dimgrid, dimworld, ctype>, codim>
791 {
792 static const bool v = true;
793 };
794
796 template <int dimgrid, int dimworld, class ctype>
797 struct isLevelwiseConforming< FoamGrid<dimgrid, dimworld, ctype> >
798 {
799 static const bool v = false;
800 };
801
803 template <int dimgrid, int dimworld, class ctype>
804 struct isLeafwiseConforming< FoamGrid<dimgrid, dimworld, ctype> >
805 {
806 static const bool v = false;
807 };
808}
809
810} // namespace Dune
811
812
813// The factory should be present whenever the user includes foamgrid.hh.
814// However since the factory needs to know the grid the include directive
815// comes here at the end.
817
818#endif
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.
Definition: dgffoam.cc:6
An implementation of the Dune grid interface: a 1- or 2-dimensional simplicial grid in an n-dimension...
Definition: foamgrid.hh:96
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: foamgrid.hh:200
void removeElement(const typename Traits::template Codim< 0 >::Entity &e)
Mark an element for removal from the grid.
Definition: foamgrid.hh:502
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: foamgrid.hh:565
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: foamgrid.hh:259
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: foamgrid.hh:283
size_t numBoundarySegments() const
The number of boundary edges on the coarsest level.
Definition: foamgrid.hh:271
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:602
FoamGrid()
Constructor, constructs an empty grid.
Definition: foamgrid.hh:141
friend class FoamGridLeafIndexSet< const FoamGrid >
Definition: foamgrid.hh:99
friend class GridFactory
Definition: foamgrid.hh:113
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:338
FoamGridFamily< dimgrid, dimworld, ct > GridFamily
FoamGrid is only implemented for 1 and 2 dimension.
Definition: foamgrid.hh:131
unsigned int insertVertex(const FieldVector< ctype, dimworld > &pos)
Add new vertex to be added the grid.
Definition: foamgrid.hh:402
~FoamGrid()
Destructor.
Definition: foamgrid.hh:152
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:525
void postGrow()
Clean up isNew markers.
Definition: foamgrid.cc:1325
friend class FoamGridLevelIndexSet< const FoamGrid >
Definition: foamgrid.hh:98
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: foamgrid.hh:358
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: foamgrid.hh:231
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:422
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: foamgrid.hh:609
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: foamgrid.hh:289
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: foamgrid.hh:277
DUNE_NO_DEPRECATED_BEGIN unsigned int insertElement(const GeometryType &type, const std::vector< unsigned int > &vertices, const std::shared_ptr< VirtualFunction< FieldVector< ctype, dimgrid >, FieldVector< ctype, dimworld > > > &elementParametrization)
Add a new element to be added to the grid.
Definition: foamgrid.hh:466
friend class FoamGridIdSet< const FoamGrid >
Definition: foamgrid.hh:100
bool loadBalance(DataHandle &data)
Distributes this grid over the available nodes in a distributed machine.
Definition: foamgrid.hh:578
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:134
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: foamgrid.hh:170
void postAdapt()
Clean up refinement markers.
Definition: foamgrid.cc:317
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir) const
Definition: foamgrid.hh:613
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: foamgrid.hh:265
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: foamgrid.hh:210
void globalRefine(int refCount=1)
Refine the grid uniformly.
Definition: foamgrid.cc:3
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: foamgrid.hh:217
ct ctype
The type used to store coordinates.
Definition: foamgrid.hh:137
bool loadBalance()
Definition: foamgrid.hh:583
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: foamgrid.hh:553
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: foamgrid.hh:190
const Traits::CollectiveCommunication & comm() const
Definition: foamgrid.hh:617
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: foamgrid.hh:224
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: foamgrid.hh:571
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create an Entity from an EntitySeed.
Definition: foamgrid.hh:312
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: foamgrid.hh:559
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: foamgrid.hh:180
DUNE_NO_DEPRECATED_END 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:489
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: foamgrid.hh:304
int maxLevel() const
Definition: foamgrid.hh:163
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:540
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: foamgrid.hh:238
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:253
Encapsulates loads of types exported by FoamGrid.
Definition: foamgrid.hh:59
GridTraits< dimgrid, dimworld, Dune::FoamGrid< dimgrid, dimworld, ctype >, FoamGridGeometry, FoamGridEntity, FoamGridLevelIterator, FoamGridLeafIntersection, FoamGridLevelIntersection, FoamGridLeafIntersectionIterator, FoamGridLevelIntersectionIterator, FoamGridHierarchicIterator, FoamGridLeafIterator, FoamGridLevelIndexSet< const FoamGrid< dimgrid, dimworld, ctype > >, FoamGridLeafIndexSet< const FoamGrid< dimgrid, dimworld, ctype > >, FoamGridIdSet< const FoamGrid< dimgrid, dimworld, ctype > >, unsigned int, FoamGridIdSet< const FoamGrid< dimgrid, dimworld, ctype > >, unsigned int, CollectiveCommunication< Dune::FoamGrid< dimgrid, dimworld, ctype > >, DefaultLevelGridViewTraits, DefaultLeafGridViewTraits, FoamGridEntitySeed > Traits
Definition: foamgrid.hh:83
The implementation of entities in a FoamGrid.
Definition: foamgridentity.hh:54
Iterator over all entities of a given codimension and level of a grid.
Definition: foamgridleveliterator.hh:18
Definition: foamgridintersectioniterators.hh:239
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: foamgridintersectioniterators.hh:28
Iterator over the descendants of an entity.Mesh entities of codimension 0 ("elements") allow to visit...
Definition: foamgridhierarchiciterator.hh:24
The EntitySeed class provides the minmal information needed to restore an Entity using the grid.
Definition: foamgridentityseed.hh:21
Specialization of the generic GridFactory for FoamGrid<dimgrid, dimworld>
Definition: foamgridfactory.hh:38
Definition: foamgridgeometry.hh:21
Definition: foamgridindexsets.hh:26
Definition: foamgridindexsets.hh:200
Definition: foamgridindexsets.hh:417
Definition: foamgridintersections.hh:252
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
The actual entity implementation.
Definition: foamgridvertex.hh:47