dune-mmesh (unstable)

grid.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_MMESH_INTERFACE_GRID_HH
4#define DUNE_MMESH_INTERFACE_GRID_HH
5
10#include <dune/common/deprecated.hh>
11#include <dune/common/parallel/communication.hh>
12#include <dune/common/parallel/mpihelper.hh>
13#include <dune/common/version.hh>
14#include <dune/grid/common/capabilities.hh>
15#include <dune/grid/common/grid.hh>
17#include <memory>
18#include <string>
19#include <unordered_map>
20#include <unordered_set>
21
22// The components of the MMesh interface
24
25#include "connectedcomponent.hh"
26#include "dgfparser.hh"
27#include "entity.hh"
28#include "entityseed.hh"
29#include "geometry.hh"
30#include "gridfactory.hh"
31#include "hierarchiciterator.hh"
32#include "indexsets.hh"
34#include "intersections.hh"
35#include "leafiterator.hh"
36#include "traits.hh"
37
38namespace Dune {
39
40#if HAVE_MPI
41using Comm = MPI_Comm;
42#else
43using Comm = No_Comm;
44#endif
45
46// MMeshInterfaceGrid family
47template <class MMesh>
48struct MMeshInterfaceGridFamily {
49 public:
50 typedef GridTraits<
51 MMesh::dimension - 1, // grid dimension
52 MMesh::dimension, // world dimension
53 MMeshInterfaceGrid<MMesh>, MMeshInterfaceGridGeometry,
54 MMeshInterfaceGridEntity,
55 MMeshInterfaceGridLeafIterator, // LevelIterator
56 MMeshInterfaceGridLeafIntersection,
57 MMeshInterfaceGridLeafIntersection, // LevelIntersection
58 MMeshInterfaceGridLeafIntersectionIterator,
59 MMeshInterfaceGridLeafIntersectionIterator, // LevelIntersectionIterator
60 MMeshInterfaceGridHierarchicIterator, MMeshInterfaceGridLeafIterator,
61 MMeshInterfaceGridLeafIndexSet<
62 const MMeshInterfaceGrid<MMesh>>, // LevelIndexSet
63 MMeshInterfaceGridLeafIndexSet<const MMeshInterfaceGrid<MMesh>>,
64 MMeshInterfaceGridGlobalIdSet<const MMeshInterfaceGrid<MMesh>>,
65 MMeshImpl::MultiId, // GlobalIdSet::IdType,
66 MMeshInterfaceGridGlobalIdSet<
67 const MMeshInterfaceGrid<MMesh>>, // LocalIdSet
68 MMeshImpl::MultiId, // LocalIdSet::IdType,
69 Communication<Comm>, DefaultLevelGridViewTraits,
70 DefaultLeafGridViewTraits, MMeshInterfaceGridEntitySeed>
71 Traits;
72};
73
74//**********************************************************************
75//
76// --MMeshInterfaceGrid class
77//
78//************************************************************************
83template <class MMesh>
85#ifndef DOXYGEN_SHOULD_SKIP_THIS
86 : public GridDefaultImplementation<MMesh::dimension - 1, MMesh::dimension,
87 typename MMesh::FieldType,
88 MMeshInterfaceGridFamily<MMesh>>
89#endif /* DOXYGEN_SHOULD_SKIP_THIS */
90{
91 public:
92 static constexpr int dimension = MMesh::dimension - 1;
93 static constexpr int dimensionworld = MMesh::dimension;
94
95 using FieldType = typename MMesh::FieldType;
96 using IdType = typename MMesh::IdType;
97
98 using BoundarySegments = std::unordered_map<IdType, std::size_t>;
99
100 //**********************************************************
101 // The Interface Methods
102 //**********************************************************
103
105 typedef MMeshInterfaceGridFamily<MMesh> GridFamily;
106 typedef typename GridFamily::Traits Traits;
107
109 using GridImp = typename GridFamily::Traits::Grid;
110
112 typedef std::unique_ptr<GridImp> GridPtrType;
113
116
119
121 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
122
124 typedef FieldType ctype;
125
127 typedef Dune::FieldVector<ctype, dimensionworld> GlobalCoordinate;
128
130 template <int cd>
132 typename HostGridEntityChooser_<HostGridType, dimensionworld,
133 cd + 1>::type;
134
137
139 using EdgeHandle = MMeshInterfaceEntity<dimension - 1>;
140
142 using ElementOutput = std::list<MMeshInterfaceEntity<0>>;
143
145 using Entity = typename Traits::template Codim<0>::Entity;
146
148 using Vertex = typename Traits::template Codim<dimension>::Entity;
149
152
155
157 explicit MMeshInterfaceGrid(MMesh* mMesh,
158 BoundarySegments boundarySegments = {})
159 : mMesh_(mMesh),
160 boundarySegments_(boundarySegments)
161#ifdef HAVE_MPI
162 ,
163 comm_(MPIHelper::getCommunicator())
164#endif
165 {
166 leafIndexSet_ =
167 std::make_unique<MMeshInterfaceGridLeafIndexSet<const GridImp>>(this);
168 globalIdSet_ =
169 std::make_unique<MMeshInterfaceGridGlobalIdSet<const GridImp>>(this);
170 }
171
176 int maxLevel() const { return 0; }
177
180 int size(int level, int codim) const {
181 // we only have one level
182 assert(level == 0);
183 return size(codim);
184 }
185
188 size_t numBoundarySegments() const { return localBoundarySegments_.size(); }
189
190 const BoundarySegments& boundarySegments() const {
191 return localBoundarySegments_;
192 }
193
194 void addBoundarySegment(const std::vector<std::size_t>& ids,
195 std::size_t bndSegIdx) {
196 boundarySegments_[ids] = bndSegIdx;
197 }
198
199 void setBoundarySegments(const BoundarySegments boundarySegments) {
200 boundarySegments_ = boundarySegments;
201 }
202
204 int size(int codim) const { return leafIndexSet().size(codim); }
205
207 int size(int level, GeometryType type) const {
208 // we only have one level
209 assert(level == 0);
210 return size(type);
211 }
212
214 int size(GeometryType type) const { return leafIndexSet().size(type); }
215
217 const typename Traits::GlobalIdSet& globalIdSet() const {
218 return *globalIdSet_;
219 }
220
222 const typename Traits::LocalIdSet& localIdSet() const {
223 return *globalIdSet_;
224 }
225
227 const MMeshInterfaceGridLeafIndexSet<const GridImp>& levelIndexSet(
228 int level) const {
229 if (level != 0)
230 DUNE_THROW(GridError, "levelIndexSet of nonexisting level "
231 << level << " requested!");
232 return *leafIndexSet_;
233 }
234
236 const MMeshInterfaceGridLeafIndexSet<const GridImp>& leafIndexSet() const {
237 return *leafIndexSet_;
238 }
239
241 template <class EntitySeed>
242 typename Traits::template Codim<EntitySeed::codimension>::Entity entity(
243 const EntitySeed& seed) const {
244 typedef MMeshInterfaceGridEntity<EntitySeed::codimension, dimension,
245 const typename Traits::Grid>
246 EntityImp;
247
248 auto hostEntity = seed.impl().hostEntity();
249 assert(hostEntity != decltype(hostEntity)());
250 return EntityImp(this, hostEntity);
251 }
252
254 typename Traits::template Codim<dimension>::Entity entity(
255 const MMeshInterfaceEntity<dimension>& hostEntity) const {
256 return entity(
257 typename Traits::template Codim<dimension>::EntitySeed(hostEntity));
258 }
259
261 typename Traits::template Codim<0>::Entity entity(
262 const MMeshInterfaceEntity<0>& hostEntity) const {
263 return entity(typename Traits::template Codim<0>::EntitySeed(hostEntity));
264 }
265
267 template <int dimw = dimension + 1>
268 std::enable_if_t<dimw == 3, typename Traits::template Codim<1>::Entity>
269 entity(const MMeshInterfaceEntity<1>& hostEntity) const {
270 return entity(typename Traits::template Codim<1>::EntitySeed(hostEntity));
271 }
272
274 template <int codim>
275 typename Traits::template Codim<codim>::LevelIterator lbegin(
276 int level) const {
278 this);
279 }
280
282 template <int codim>
283 typename Traits::template Codim<codim>::LevelIterator lend(int level) const {
285 this, true);
286 }
287
289 template <int codim, PartitionIteratorType PiType>
290 typename Traits::template Codim<codim>::template Partition<
291 PiType>::LevelIterator
292 lbegin(int level) const {
294 }
295
297 template <int codim, PartitionIteratorType PiType>
298 typename Traits::template Codim<codim>::template Partition<
299 PiType>::LevelIterator
300 lend(int level) const {
302 true);
303 }
304
306 template <int codim>
307 typename Traits::template Codim<codim>::LeafIterator leafbegin() const {
309 this);
310 }
311
313 template <int codim>
314 typename Traits::template Codim<codim>::LeafIterator leafend() const {
316 this, true);
317 }
318
320 template <int codim, PartitionIteratorType PiType>
321 typename Traits::template Codim<codim>::template Partition<
322 PiType>::LeafIterator
323 leafbegin() const {
325 }
326
328 template <int codim, PartitionIteratorType PiType>
329 typename Traits::template Codim<codim>::template Partition<
330 PiType>::LeafIterator
331 leafend() const {
333 true);
334 }
335
340 void globalRefine(int steps = 1) {
341 for (int i = 0; i < steps; ++i) {
342 // mark all elements
343 for (const auto& element : elements(this->leafGridView()))
344 mark(1, element);
345
346 preAdapt();
347 adapt();
348 postAdapt();
349 }
350 }
351
356 bool mark(int refCount,
357 const typename Traits::template Codim<0>::Entity& e) const {
358 if (refCount != 0) {
359 mark_[globalIdSet_->id(e)] = refCount;
360 return true;
361 }
362 return false;
363 }
364
369 int getMark(const typename Traits::template Codim<0>::Entity& e) const {
370 auto entry = mark_.find(globalIdSet_->id(e));
371 if (entry != mark_.end())
372 return entry->second;
373 else
374 return 0;
375 }
376
378 bool preAdapt() { return mark_.size() > 0; }
379
385 bool adapt() { return mMesh_->adapt(); }
386
388 template <class GridImp, class DataHandle>
389 bool adapt(AdaptDataHandleInterface<GridImp, DataHandle>& handle) {
390 preAdapt();
391 sequence_ += 1;
392
393 for (const auto& ielement : elements(this->leafGridView()))
394 if (ielement.isNew()) {
395 bool initialize = true;
396 const auto& connComp = ielement.impl().connectedComponent();
397
398 for (const auto& old : connComp.children()) {
399 const Entity& father = old;
400
401 if (father.geometry().volume() > ielement.geometry().volume()) {
402 ielement.impl().bindFather(father);
403 handle.prolongLocal(father, ielement, true);
404 } else {
405 father.impl().bindFather(ielement);
406 handle.restrictLocal(ielement, father, initialize);
407 }
408
409 initialize = false;
410 }
411 }
412
413 postAdapt();
414 return true;
415 }
416
418 void postAdapt() {
419 mark_.clear();
420 childrenConnectedComponentMap_.clear();
421 }
422
423 public:
425 unsigned int overlapSize(int codim) const { return 0; }
426
428 unsigned int ghostSize(int codim) const {
429 std::size_t size = 0;
430
431 if (codim == 0)
432 for (const auto& e : elements(this->leafGridView()))
433 if (e.partitionType() == GhostEntity) size++;
434
435 if (codim == dimension)
436 for (const auto& v : vertices(this->leafGridView()))
437 if (v.partitionType() == GhostEntity) size++;
438
439 return size;
440 }
441
443 unsigned int overlapSize(int level, int codim) const {
444 return overlapSize(codim);
445 }
446
448 unsigned int ghostSize(int level, int codim) const {
449 return ghostSize(codim);
450 }
451
459
460 template <class T>
461 bool loadBalance(const T& t) {
462 return false;
463 };
464
465 void loadBalance(int strategy, int minlevel, int depth, int maxlevel,
466 int minelement) {
467 DUNE_THROW(NotImplemented, "MMeshInterfaceGrid::loadBalance()");
468 }
469
471 const Communication<Comm>& comm() const { return comm_; }
472
473 template <class Data, class InterfaceType, class CommunicationDirection>
474 void communicate(Data& dataHandle, InterfaceType interface,
475 CommunicationDirection direction, int level = 0) const {
476 if (comm().size() <= 1) return;
477
478#if HAVE_MPI
479 if ((interface == InteriorBorder_All_Interface) ||
480 (interface == All_All_Interface)) {
481 MMeshCommunication<GridImp, MMeshType> communication(
482 getMMesh().partitionHelper());
483 const auto& gv = this->leafGridView();
484
485 switch (direction) {
486 case ForwardCommunication:
487 communication(gv.template begin<0, Interior_Partition>(),
488 gv.template end<0, Interior_Partition>(),
489 gv.template begin<0, Ghost_Partition>(),
490 gv.template end<0, Ghost_Partition>(), dataHandle,
491 InteriorEntity, GhostEntity,
492 (interface == All_All_Interface));
493 break;
494
495 case BackwardCommunication:
496 communication(gv.template begin<0, Ghost_Partition>(),
497 gv.template end<0, Ghost_Partition>(),
498 gv.template begin<0, Interior_Partition>(),
499 gv.template end<0, Interior_Partition>(), dataHandle,
500 GhostEntity, InteriorEntity,
501 (interface == All_All_Interface));
502 break;
503 }
504 } else
505 DUNE_THROW(NotImplemented, "Communication on interface type "
506 << interface << " not implemented.");
507#else
508 DUNE_THROW(NotImplemented, "MPI not found!");
509#endif // HAVE_MPI
510 }
511
513 bool isInterface(const MMeshInterfaceEntity<0>& segment) const {
514 int count = mMesh_->interfaceSegments().count(getVertexIds_(segment));
515 assert(count <= 1);
516 return (count > 0);
517 }
518
520 template <int d = dimension>
521 std::enable_if_t<d == 2, bool> isInterface(
522 const MMeshInterfaceEntity<1>& edge) const {
523 auto circulator = mMesh_->getHostGrid().incident_facets(edge);
524 for (std::size_t i = 0; i < CGAL::circulator_size(circulator);
525 ++i, ++circulator)
526 if (isInterface(*circulator)) return true;
527 return false;
528 }
529
531 bool isInterface(const VertexHandle& vertex) const {
532 return vertex->info().isInterface;
533 }
534
537 const typename Traits::LeafIntersection& intersection) const {
538 return isInterface(intersection.impl().getHostIntersection());
539 }
540
542 template <class Entity>
543 bool isInterface(const Entity& entity) const {
544 return isInterface(entity.impl().hostEntity());
545 }
546
548 template <class Entity>
549 std::size_t domainMarker(const Entity& entity) const {
550 assert(isInterface(entity));
551 return mMesh_
552 ->interfaceSegments()[getVertexIds_(entity.impl().hostEntity())];
553 }
554
556 void markAsRefined(const std::vector<std::vector<std::size_t>>& children,
557 const ConnectedComponent connectedComponent) {
558 for (const auto& child : children)
559 childrenConnectedComponentMap_.insert({child, connectedComponent});
560 }
561
564 int count = childrenConnectedComponentMap_.count(
565 getVertexIds_(entity.impl().hostEntity()));
566 assert(count <= 1);
567 return (count == 1);
568 }
569
572 auto it = childrenConnectedComponentMap_.find(
573 getVertexIds_(entity.impl().hostEntity()));
574 assert(it != childrenConnectedComponentMap_.end());
575 return it->second;
576 }
577
580 auto it = childrenConnectedComponentMap_.find(
581 getVertexIds_(entity.impl().hostEntity()));
582 assert(it != childrenConnectedComponentMap_.end());
583 return it->second;
584 }
585
586 // Return if MMeshInterfaceEntity can be mirrored
587 bool canBeMirrored(const MMeshInterfaceEntity<0>& hostEntity) const {
588 using HostGridEntity =
589 typename GridImp::MMeshType::template HostGridEntity<0>;
590
591 if (hostEntity.first->neighbor(hostEntity.second) == HostGridEntity())
592 return false;
593
594 if constexpr (dimensionworld == 2)
595 return hostEntity.first->dimension() >= 1;
596
597 return true;
598 }
599
601 template <int d = dimensionworld>
602 std::enable_if_t<d == 2, const MMeshInterfaceEntity<0>> mirrorHostEntity(
603 const MMeshInterfaceEntity<0>& other) const {
604 return mMesh_->getHostGrid().mirror_edge(other);
605 }
606
608 template <int d = dimensionworld>
609 std::enable_if_t<d == 3, const MMeshInterfaceEntity<0>> mirrorHostEntity(
610 const MMeshInterfaceEntity<0>& other) const {
611 return mMesh_->getHostGrid().mirror_facet(other);
612 }
613
614 // **********************************************************
615 // End of Interface Methods
616 // **********************************************************
617
618 private:
619 Communication<Comm> comm_;
620
621 static inline auto getVertexIds_(const MMeshInterfaceEntity<0>& entity) {
622 std::vector<std::size_t> ids(dimensionworld);
623 for (int i = 0; i < dimensionworld; ++i)
624 ids[i] =
625 entity.first->vertex((entity.second + i + 1) % (dimensionworld + 1))
626 ->info()
627 .id;
628 std::sort(ids.begin(), ids.end());
629 return ids;
630 }
631
632 public:
634 void setIds() { globalIdSet_->update(this); }
635
637 void setIndices() {
638 leafIndexSet_->update(this);
639
640 localBoundarySegments_.clear();
641 std::size_t count = 0;
642 for (const auto& e : elements(this->leafGridView()))
643 for (const auto& is : intersections(this->leafGridView(), e))
644 if (is.boundary()) {
645 auto iid = globalIdSet_->id(entity(is.impl().getHostIntersection()));
646 localBoundarySegments_.insert(std::make_pair(iid, count++));
647 }
648 }
649
651 const MMesh& getMMesh() const { return *mMesh_; }
652
654 const HostGridType& getHostGrid() const { return mMesh_->getHostGrid(); }
655
657 int sequence() const { return sequence_; }
658
659 const auto& partitionHelper() const { return mMesh_->partitionHelper(); }
660
661 private:
662 std::unique_ptr<MMeshInterfaceGridLeafIndexSet<const GridImp>> leafIndexSet_;
663
664 std::unique_ptr<MMeshInterfaceGridGlobalIdSet<const GridImp>> globalIdSet_;
665
666 std::unordered_map<std::vector<std::size_t>, ConnectedComponent,
667 HashUIntVector>
668 childrenConnectedComponentMap_;
669
670 protected:
673
674 BoundarySegments boundarySegments_, localBoundarySegments_;
675
676 mutable std::unordered_map<MMeshImpl::MultiId, int> mark_;
677
678 int sequence_ = 0;
679
680}; // end Class MMeshInterfaceGrid
681
682// DGFGridInfo for MMeshInterfaceGrid
683// ----------------------------------
684
685template <class MMesh>
686struct DGFGridInfo<MMeshInterfaceGrid<MMesh>> {
687 static int refineStepsForHalf() { return MMesh::dimension - 1; }
688
689 static double refineWeight() { return -1; }
690};
691
692// Capabilites of MMeshInterfaceGrid
693// ---------------------------------
694
696namespace Capabilities {
700template <class MMesh>
701struct hasSingleGeometryType<MMeshInterfaceGrid<MMesh>> {
702 static const bool v = true;
703 static const unsigned int topologyId = Dune::GeometryType::simplex;
704};
705
709template <class MMesh, int codim>
710struct hasEntity<MMeshInterfaceGrid<MMesh>, codim> {
711 static const bool v = (codim >= 0 || codim <= MMesh::dimension - 1);
712};
713
714template <class MMesh, int codim>
715struct hasEntityIterator<MMeshInterfaceGrid<MMesh>, codim> {
716 static const bool v = (codim >= 0 || codim <= MMesh::dimension - 1);
717};
718
722template <class MMesh>
723struct isLevelwiseConforming<MMeshInterfaceGrid<MMesh>> {
724 static const bool v = true;
725};
726
730template <class MMesh>
731struct isLeafwiseConforming<MMeshInterfaceGrid<MMesh>> {
732 static const bool v = true;
733};
734} // end namespace Capabilities
736
737} // namespace Dune
738
739#endif // DUNE_MMESH_INTERFACE_GRID_HH
The implementation of connected components in a MMeshInterfaceGridThe connected component copies the ...
Definition: connectedcomponent.hh:31
The implementation of entities in a MMesh interface grid.
Definition: entity.hh:34
const MMeshInterfaceEntity & hostEntity() const
Return reference to the host entity.
Definition: entity.hh:289
Iterator over all entities of a given codimension and level of a grid (2D).
Definition: leafiterator.hh:21
Provides a DUNE grid interface class for the interface of a MMesh interface grid .
Definition: grid.hh:90
typename GridFamily::Traits::Grid GridImp
the grid implementation
Definition: grid.hh:109
void setIds()
compute the grid ids
Definition: grid.hh:634
bool isInterface(const VertexHandle &vertex) const
Return if vertex is part of the interface.
Definition: grid.hh:531
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e) const
Mark entity for refinement.
Definition: grid.hh:356
bool adapt(AdaptDataHandleInterface< GridImp, DataHandle > &handle)
Callback for the grid adaptation process with restrict/prolong.
Definition: grid.hh:389
bool preAdapt()
returns false, if at least one entity is marked for adaption
Definition: grid.hh:378
MMeshInterfaceConnectedComponent< const GridImp > ConnectedComponent
The type of a connected component.
Definition: grid.hh:151
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: grid.hh:300
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: grid.hh:443
const MMeshInterfaceGridLeafIndexSet< const GridImp > & leafIndexSet() const
Access to the LeafIndexSet.
Definition: grid.hh:236
bool isInterface(const Entity &entity) const
Return if dune entity is part of the interface.
Definition: grid.hh:543
std::list< MMeshInterfaceEntity< 0 > > ElementOutput
The type of the element output.
Definition: grid.hh:142
std::enable_if_t< d==2, bool > isInterface(const MMeshInterfaceEntity< 1 > &edge) const
Return if an edge is of the interface.
Definition: grid.hh:521
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: grid.hh:323
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: grid.hh:448
MMeshInterfaceGrid(MMesh *mMesh, BoundarySegments boundarySegments={})
Constructor.
Definition: grid.hh:157
const Communication< Comm > & comm() const
Collective communication.
Definition: grid.hh:471
MMeshInterfaceGridFamily< MMesh > GridFamily
the Traits
Definition: grid.hh:105
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: grid.hh:283
bool isInterface(const MMeshInterfaceEntity< 0 > &segment) const
Return if interface segment is part of the interface.
Definition: grid.hh:513
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: grid.hh:180
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: grid.hh:217
Traits::template Codim< 0 >::Entity entity(const MMeshInterfaceEntity< 0 > &hostEntity) const
Create codim 0 entity from a host entity.
Definition: grid.hh:261
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: grid.hh:292
bool isInterface(const typename Traits::LeafIntersection &intersection) const
Return if intersection is part of the interface.
Definition: grid.hh:536
const ConnectedComponent & getConnectedComponent(const Entity &entity) const
Return the connected component for a given entity.
Definition: grid.hh:571
const HostGridType & getHostGrid() const
Return reference to underlying CGAL triangulation.
Definition: grid.hh:654
ConnectedComponent & getConnectedComponent(const Entity &entity)
Return a non-const reference to the connected component for a given entity.
Definition: grid.hh:579
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: grid.hh:207
void markAsRefined(const std::vector< std::vector< std::size_t > > &children, const ConnectedComponent connectedComponent)
Mark a set of children elements as refinement of a connected component.
Definition: grid.hh:556
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: grid.hh:214
typename MMesh::HostGridType HostGridType
the underlying hostgrid
Definition: grid.hh:115
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: grid.hh:369
int sequence() const
Return sequence number.
Definition: grid.hh:657
std::unique_ptr< GridImp > GridPtrType
the unique pointer to the grid
Definition: grid.hh:112
int maxLevel() const
Return maximum level defined in this grid.
Definition: grid.hh:176
Dune::FieldVector< ctype, dimensionworld > GlobalCoordinate
The type used for coordinates.
Definition: grid.hh:127
typename Traits::template Codim< dimension >::Entity Vertex
The type of a vertex.
Definition: grid.hh:148
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: grid.hh:275
typename HostGridEntityChooser_< HostGridType, dimensionworld, cd+1 >::type MMeshInterfaceEntity
The type of the underlying entities.
Definition: grid.hh:133
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: grid.hh:428
bool hasConnectedComponent(const Entity &entity) const
Return if an entity has a connected component.
Definition: grid.hh:563
bool adapt()
Triggers the grid adaptation process.
Definition: grid.hh:385
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: grid.hh:314
std::enable_if_t< dimw==3, typename Traits::template Codim< 1 >::Entity > entity(const MMeshInterfaceEntity< 1 > &hostEntity) const
Create codim 0 entity from a host entity.
Definition: grid.hh:269
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: grid.hh:242
std::enable_if_t< d==3, const MMeshInterfaceEntity< 0 > > mirrorHostEntity(const MMeshInterfaceEntity< 0 > &other) const
Mirror a host entity (3d)
Definition: grid.hh:609
const MMesh & getMMesh() const
Return reference to MMesh.
Definition: grid.hh:651
MMeshInterfaceEntity< dimension - 1 > EdgeHandle
The type of the underlying edge handle.
Definition: grid.hh:139
void postAdapt()
Clean up refinement markers.
Definition: grid.hh:418
typename Traits::template Codim< 0 >::Entity Entity
The type of a codim 0 entity.
Definition: grid.hh:145
void globalRefine(int steps=1)
Global refine.
Definition: grid.hh:340
void setIndices()
compute the grid indices
Definition: grid.hh:637
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: grid.hh:188
MMeshInterfaceEntity< dimension > VertexHandle
The type of the underlying vertex handle.
Definition: grid.hh:136
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: grid.hh:425
FieldType ctype
The type used to store coordinates, inherited from the MMesh.
Definition: grid.hh:124
MMesh * mMesh_
The host grid which contains the actual grid hierarchy structure.
Definition: grid.hh:672
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: grid.hh:307
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: grid.hh:222
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: grid.hh:331
void loadBalance()
Distributes this grid over the available nodes in a distributed machine.
Definition: grid.hh:458
int size(int codim) const
number of leaf entities per codim in this process
Definition: grid.hh:204
std::enable_if_t< d==2, const MMeshInterfaceEntity< 0 > > mirrorHostEntity(const MMeshInterfaceEntity< 0 > &other) const
Mirror a host entity (2d)
Definition: grid.hh:602
const MMeshInterfaceGridLeafIndexSet< const GridImp > & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: grid.hh:227
Traits::template Codim< 0 >::LeafIterator LeafIterator
the leaf iterator
Definition: grid.hh:121
Traits::template Codim< dimension >::Entity entity(const MMeshInterfaceEntity< dimension > &hostEntity) const
Create Entity from a host entity.
Definition: grid.hh:254
std::size_t domainMarker(const Entity &entity) const
Return domain marker of entity.
Definition: grid.hh:549
The MMesh class templatized by the CGAL host grid type and the dimension. .
Definition: mmesh.hh:158
const HostGrid & getHostGrid() const
Get reference to the underlying CGAL triangulation.
Definition: mmesh.hh:1750
const InterfaceSegments & interfaceSegments() const
returns the interface segment set
Definition: mmesh.hh:366
bool adapt()
Triggers the grid adaptation process.
Definition: mmesh.hh:826
static constexpr int dimension
The world dimension.
Definition: mmesh.hh:161
HostGrid HostGridType
The hostgrid type.
Definition: mmesh.hh:164
void loadBalance()
Distributes this grid over the available nodes in a distributed machine.
Definition: mmesh.hh:1683
typename Point::R::RT FieldType
The field type.
Definition: mmesh.hh:173
MMeshImpl::MultiId IdType
The type of an id.
Definition: mmesh.hh:176
The MMesh class.
The MMeshInterfaceConnectedComponent class.
The MMeshInterfaceGridEntity class.
The MMeshInterfaceGridEntitySeed class.
The MMeshInterfaceGridGeometry class and its specializations Inherits from Dune::AffineGeometry.
The MMeshInterfaceGridHierarchicIterator class.
The index and id sets for the MMesh class.
The intersection iterator for the MMesh class.
The MMeshInterfaceGridLeafIntersection and MMeshLevelIntersection classes.
The MMeshInterfaceGridLeafIterator class.
The multi id class.
The MMeshInterfaceGrid traits class.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Sep 4, 22:38, 2025)