dune-mmesh (1.4)

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 <string>
11#include <unordered_set>
12#include <unordered_map>
13#include <memory>
14
15#include <dune/common/deprecated.hh>
16#include <dune/common/parallel/communication.hh>
17#include <dune/common/parallel/mpihelper.hh>
18#include <dune/common/version.hh>
19#include <dune/grid/common/capabilities.hh>
20#include <dune/grid/common/grid.hh>
22
23// The components of the MMesh interface
25#include "entity.hh"
26#include "entityseed.hh"
27#include "connectedcomponent.hh"
28#include "dgfparser.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
41#if HAVE_MPI
42 using Comm = MPI_Comm;
43#else
44 using Comm = No_Comm;
45#endif
46
47 // MMeshInterfaceGrid family
48 template<class MMesh>
49 struct MMeshInterfaceGridFamily
50 {
51
52 public:
53
54 typedef GridTraits<
55 MMesh::dimension-1, // grid dimension
56 MMesh::dimension, // world dimension
57 MMeshInterfaceGrid<MMesh>,
58 MMeshInterfaceGridGeometry,
59 MMeshInterfaceGridEntity,
60 MMeshInterfaceGridLeafIterator, // LevelIterator
61 MMeshInterfaceGridLeafIntersection,
62 MMeshInterfaceGridLeafIntersection, // LevelIntersection
63 MMeshInterfaceGridLeafIntersectionIterator,
64 MMeshInterfaceGridLeafIntersectionIterator, // LevelIntersectionIterator
65 MMeshInterfaceGridHierarchicIterator,
66 MMeshInterfaceGridLeafIterator,
67 MMeshInterfaceGridLeafIndexSet< const MMeshInterfaceGrid<MMesh> >, // LevelIndexSet
68 MMeshInterfaceGridLeafIndexSet< const MMeshInterfaceGrid<MMesh> >,
69 MMeshInterfaceGridGlobalIdSet< const MMeshInterfaceGrid<MMesh> >,
70 MMeshImpl::MultiId, // GlobalIdSet::IdType,
71 MMeshInterfaceGridGlobalIdSet< const MMeshInterfaceGrid<MMesh> >, // LocalIdSet
72 MMeshImpl::MultiId, // LocalIdSet::IdType,
73 Communication< Comm >,
74 DefaultLevelGridViewTraits,
75 DefaultLeafGridViewTraits,
76 MMeshInterfaceGridEntitySeed
77 > Traits;
78 };
79
80 //**********************************************************************
81 //
82 // --MMeshInterfaceGrid class
83 //
84 //************************************************************************
90 template <class MMesh>
92#ifndef DOXYGEN_SHOULD_SKIP_THIS
93 : public GridDefaultImplementation< MMesh::dimension-1, MMesh::dimension,
94 typename MMesh::FieldType,
95 MMeshInterfaceGridFamily<MMesh> >
96#endif /* DOXYGEN_SHOULD_SKIP_THIS */
97 {
98 public:
99 static constexpr int dimension = MMesh::dimension-1;
100 static constexpr int dimensionworld = MMesh::dimension;
101
102 using FieldType = typename MMesh::FieldType;
103 using IdType = typename MMesh::IdType;
104
105 using BoundarySegments = std::unordered_map< IdType, std::size_t >;
106
107 //**********************************************************
108 // The Interface Methods
109 //**********************************************************
110
112 typedef MMeshInterfaceGridFamily<MMesh> GridFamily;
113 typedef typename GridFamily::Traits Traits;
114
116 using GridImp = typename GridFamily::Traits::Grid;
117
119 typedef std::unique_ptr< GridImp > GridPtrType;
120
123
126
128 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
129
131 typedef FieldType ctype;
132
134 typedef Dune::FieldVector<ctype, dimensionworld> GlobalCoordinate;
135
137 template<int cd>
138 using MMeshInterfaceEntity = typename HostGridEntityChooser_<HostGridType, dimensionworld, cd+1>::type;
139
142
144 using EdgeHandle = MMeshInterfaceEntity<dimension-1>;
145
147 using ElementOutput = std::list<MMeshInterfaceEntity<0>>;
148
150 using Entity = typename Traits::template Codim<0>::Entity;
151
153 using Vertex = typename Traits::template Codim<dimension>::Entity;
154
157
160
162 explicit MMeshInterfaceGrid(MMesh* mMesh, BoundarySegments boundarySegments = {})
163 : mMesh_(mMesh),
164 boundarySegments_(boundarySegments),
165 #ifdef HAVE_MPI
166 comm_( MPIHelper::getCommunicator() )
167 #endif
168 {
169 leafIndexSet_ = std::make_unique<MMeshInterfaceGridLeafIndexSet<const GridImp>>( this );
170 globalIdSet_ = std::make_unique<MMeshInterfaceGridGlobalIdSet<const GridImp>>( this );
171 }
172
177 int maxLevel() const {
178 return 0;
179 }
180
183 int size (int level, int codim) const {
184 // we only have one level
185 assert(level == 0);
186 return size(codim);
187 }
188
191 size_t numBoundarySegments () const {
192 return localBoundarySegments_.size();
193 }
194
195 const BoundarySegments& boundarySegments() const
196 {
197 return localBoundarySegments_;
198 }
199
200 void addBoundarySegment ( const std::vector< std::size_t >& ids, std::size_t bndSegIdx )
201 {
202 boundarySegments_[ ids ] = bndSegIdx;
203 }
204
205 void setBoundarySegments( const BoundarySegments boundarySegments )
206 {
207 boundarySegments_ = boundarySegments;
208 }
209
211 int size (int codim) const {
212 return leafIndexSet().size(codim);
213 }
214
215
217 int size (int level, GeometryType type) const {
218 // we only have one level
219 assert(level == 0);
220 return size(type);
221 }
222
223
225 int size (GeometryType type) const
226 {
227 return leafIndexSet().size(type);
228 }
229
231 const typename Traits::GlobalIdSet& globalIdSet() const {
232 return *globalIdSet_;
233 }
234
235
237 const typename Traits::LocalIdSet& localIdSet() const {
238 return *globalIdSet_;
239 }
240
241
243 const MMeshInterfaceGridLeafIndexSet<const GridImp>& levelIndexSet(int level) const
244 {
245 if (level != 0)
246 DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
247 return *leafIndexSet_;
248 }
249
251 const MMeshInterfaceGridLeafIndexSet<const GridImp>& leafIndexSet() const
252 {
253 return *leafIndexSet_;
254 }
255
257 template < class EntitySeed >
258 typename Traits::template Codim<EntitySeed::codimension>::Entity
259 entity(const EntitySeed& seed) const
260 {
262 EntitySeed::codimension,
263 dimension,
264 const typename Traits::Grid
265 > EntityImp;
266
267 auto hostEntity = seed.impl().hostEntity();
268 assert( hostEntity != decltype(hostEntity)() );
269 return EntityImp(this, hostEntity);
270 }
271
273 typename Traits::template Codim<dimension>::Entity entity(const MMeshInterfaceEntity<dimension>& hostEntity) const
274 {
275 return entity( typename Traits::template Codim<dimension>::EntitySeed( hostEntity ) );
276 }
277
279 typename Traits::template Codim<0>::Entity entity(const MMeshInterfaceEntity<0>& hostEntity) const
280 {
281 return entity( typename Traits::template Codim<0>::EntitySeed( hostEntity ) );
282 }
283
285 template<int dimw = dimension+1>
286 std::enable_if_t<dimw == 3, typename Traits::template Codim<1>::Entity> entity(const MMeshInterfaceEntity<1>& hostEntity) const
287 {
288 return entity( typename Traits::template Codim<1>::EntitySeed( hostEntity ) );
289 }
290
292 template<int codim>
293 typename Traits::template Codim<codim>::LevelIterator lbegin (int level) const {
295 }
296
297
299 template<int codim>
300 typename Traits::template Codim<codim>::LevelIterator lend (int level) const {
302 }
303
304
306 template<int codim, PartitionIteratorType PiType>
307 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lbegin (int level) const {
309 }
310
311
313 template<int codim, PartitionIteratorType PiType>
314 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator lend (int level) const {
316 }
317
318
320 template<int codim>
321 typename Traits::template Codim<codim>::LeafIterator leafbegin() const {
323 }
324
325
327 template<int codim>
328 typename Traits::template Codim<codim>::LeafIterator leafend() const {
330 }
331
332
334 template<int codim, PartitionIteratorType PiType>
335 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafbegin() const {
337 }
338
339
341 template<int codim, PartitionIteratorType PiType>
342 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator leafend() const {
344 }
345
350 void globalRefine(int steps = 1)
351 {
352 for(int i = 0; i < steps; ++i)
353 {
354 // mark all elements
355 for (const auto& element : elements(this->leafGridView()))
356 mark( 1, element );
357
358 preAdapt();
359 adapt();
360 postAdapt();
361 }
362 }
363
364
369 bool mark(int refCount, const typename Traits::template Codim<0>::Entity & e) const
370 {
371 if ( refCount != 0 )
372 {
373 mark_[ globalIdSet_->id( e ) ] = refCount;
374 return true;
375 }
376 return false;
377 }
378
383 int getMark(const typename Traits::template Codim<0>::Entity & e) const
384 {
385 auto entry = mark_.find( globalIdSet_->id( e ) );
386 if ( entry != mark_.end() )
387 return entry->second;
388 else
389 return 0;
390 }
391
393 bool preAdapt()
394 {
395 return mark_.size() > 0;
396 }
397
403 bool adapt()
404 {
405 return mMesh_->adapt();
406 }
407
409 template< class GridImp, class DataHandle >
410 bool adapt ( AdaptDataHandleInterface< GridImp, DataHandle > &handle )
411 {
412 preAdapt();
413 sequence_ += 1;
414
415 for (const auto& ielement : elements( this->leafGridView() ))
416 if (ielement.isNew())
417 {
418 bool initialize = true;
419 const auto &connComp = ielement.impl().connectedComponent();
420
421 for ( const auto& old : connComp.children() )
422 {
423 const Entity& father = old;
424
425 if (father.geometry().volume() > ielement.geometry().volume())
426 {
427 ielement.impl().bindFather( father );
428 handle.prolongLocal( father, ielement, true );
429 }
430 else
431 {
432 father.impl().bindFather( ielement );
433 handle.restrictLocal( ielement, father, initialize );
434 }
435
436 initialize = false;
437 }
438 }
439
440 postAdapt();
441 return true;
442 }
443
446 {
447 mark_.clear();
448 childrenConnectedComponentMap_.clear();
449 }
450
451 public:
453 unsigned int overlapSize(int codim) const {
454 return 0;
455 }
456
457
459 unsigned int ghostSize(int codim) const
460 {
461 std::size_t size = 0;
462
463 if (codim == 0)
464 for (const auto& e : elements(this->leafGridView()))
465 if (e.partitionType() == GhostEntity)
466 size++;
467
468 if (codim == dimension)
469 for (const auto& v : vertices(this->leafGridView()))
470 if (v.partitionType() == GhostEntity)
471 size++;
472
473 return size;
474 }
475
476
478 unsigned int overlapSize(int level, int codim) const {
479 return overlapSize(codim);
480 }
481
482
484 unsigned int ghostSize(int level, int codim) const {
485 return ghostSize(codim);
486 }
487
488
494 void loadBalance() {
496 };
497
498 template<class T>
499 bool loadBalance( const T& t ) { return false; };
500
501 void loadBalance(int strategy, int minlevel, int depth, int maxlevel, int minelement){
502 DUNE_THROW(NotImplemented, "MMeshInterfaceGrid::loadBalance()");
503 }
504
505
507 const Communication< Comm >& comm () const
508 {
509 return comm_;
510 }
511
512 template< class Data, class InterfaceType, class CommunicationDirection >
513 void communicate (
514 Data &dataHandle,
515 InterfaceType interface,
516 CommunicationDirection direction,
517 int level = 0 ) const
518 {
519 if (comm().size() <= 1)
520 return;
521
522#if HAVE_MPI
523 if( (interface == InteriorBorder_All_Interface) || (interface == All_All_Interface) )
524 {
525 MMeshCommunication<GridImp, MMeshType> communication( getMMesh().partitionHelper() );
526 const auto& gv = this->leafGridView();
527
528 switch( direction )
529 {
530 case ForwardCommunication:
531 communication( gv.template begin< 0, Interior_Partition >(), gv.template end< 0, Interior_Partition >(),
532 gv.template begin< 0, Ghost_Partition >(), gv.template end< 0, Ghost_Partition >(),
533 dataHandle, InteriorEntity, GhostEntity,
534 (interface == All_All_Interface) );
535 break;
536
537 case BackwardCommunication:
538 communication( gv.template begin< 0, Ghost_Partition >(), gv.template end< 0, Ghost_Partition >(),
539 gv.template begin< 0, Interior_Partition >(), gv.template end< 0, Interior_Partition >(),
540 dataHandle, GhostEntity, InteriorEntity,
541 (interface == All_All_Interface) );
542 break;
543 }
544 }
545 else
546 DUNE_THROW( NotImplemented, "Communication on interface type " << interface << " not implemented." );
547#else
548 DUNE_THROW( NotImplemented, "MPI not found!" );
549#endif //HAVE_MPI
550 }
551
553 bool isInterface( const MMeshInterfaceEntity<0>& segment ) const
554 {
555 int count = mMesh_->interfaceSegments().count( getVertexIds_( segment ) );
556 assert( count <= 1 );
557 return ( count > 0 );
558 }
559
561 template< int d = dimension >
562 std::enable_if_t< d == 2, bool > isInterface( const MMeshInterfaceEntity<1>& edge ) const
563 {
564 auto circulator = mMesh_->getHostGrid().incident_facets( edge );
565 for ( std::size_t i = 0; i < CGAL::circulator_size( circulator ); ++i, ++circulator )
566 if ( isInterface( *circulator ) )
567 return true;
568 return false;
569 }
570
572 bool isInterface( const VertexHandle& vertex ) const
573 {
574 return vertex->info().isInterface;
575 }
576
578 bool isInterface( const typename Traits::LeafIntersection& intersection ) const
579 {
580 return isInterface( intersection.impl().getHostIntersection() );
581 }
582
584 template< class Entity >
585 bool isInterface( const Entity& entity ) const
586 {
587 return isInterface( entity.impl().hostEntity() );
588 }
589
591 template< class Entity >
592 std::size_t domainMarker( const Entity& entity ) const
593 {
594 assert( isInterface( entity ) );
595 return mMesh_->interfaceSegments()[ getVertexIds_( entity.impl().hostEntity() ) ];
596 }
597
599 void markAsRefined( const std::vector< std::vector< std::size_t > >& children, const ConnectedComponent connectedComponent )
600 {
601 for( const auto& child : children )
602 childrenConnectedComponentMap_.insert( { child, connectedComponent } );
603 }
604
607 {
608 int count = childrenConnectedComponentMap_.count( getVertexIds_( entity.impl().hostEntity() ) );
609 assert( count <= 1 );
610 return (count == 1 );
611 }
612
615 {
616 auto it = childrenConnectedComponentMap_.find( getVertexIds_( entity.impl().hostEntity() ) );
617 assert( it != childrenConnectedComponentMap_.end() );
618 return it->second;
619 }
620
623 {
624 auto it = childrenConnectedComponentMap_.find( getVertexIds_( entity.impl().hostEntity() ) );
625 assert( it != childrenConnectedComponentMap_.end() );
626 return it->second;
627 }
628
629 // Return if MMeshInterfaceEntity can be mirrored
630 bool canBeMirrored(const MMeshInterfaceEntity<0>& hostEntity) const
631 {
632 using HostGridEntity = typename GridImp::MMeshType::template HostGridEntity<0>;
633
634 if (hostEntity.first->neighbor(hostEntity.second) == HostGridEntity())
635 return false;
636
637 if constexpr (dimensionworld == 2)
638 return hostEntity.first->dimension() >= 1;
639
640 return true;
641 }
642
644 template <int d = dimensionworld>
645 std::enable_if_t< d == 2, const MMeshInterfaceEntity<0> >
647 {
648 return mMesh_->getHostGrid().mirror_edge( other );
649 }
650
652 template <int d = dimensionworld>
653 std::enable_if_t< d == 3, const MMeshInterfaceEntity<0> >
655 {
656 return mMesh_->getHostGrid().mirror_facet( other );
657 }
658
659 // **********************************************************
660 // End of Interface Methods
661 // **********************************************************
662
663 private:
664 Communication<Comm> comm_;
665
666 static inline auto getVertexIds_( const MMeshInterfaceEntity<0>& entity )
667 {
668 std::vector<std::size_t> ids( dimensionworld );
669 for( int i = 0; i < dimensionworld; ++i )
670 ids[ i ] = entity.first->vertex((entity.second+i+1)%(dimensionworld+1))->info().id;
671 std::sort(ids.begin(), ids.end());
672 return ids;
673 }
674
675 public:
677 void setIds()
678 {
679 globalIdSet_->update(this);
680 }
681
684 {
685 leafIndexSet_->update(this);
686
687 localBoundarySegments_.clear();
688 std::size_t count = 0;
689 for (const auto& e : elements(this->leafGridView()))
690 for (const auto& is : intersections(this->leafGridView(), e))
691 if (is.boundary())
692 {
693 auto iid = globalIdSet_->id( entity( is.impl().getHostIntersection() ) );
694 localBoundarySegments_.insert( std::make_pair(iid, count++) );
695 }
696 }
697
699 const MMesh& getMMesh() const
700 {
701 return *mMesh_;
702 }
703
706 {
707 return mMesh_->getHostGrid();
708 }
709
711 int sequence() const
712 {
713 return sequence_;
714 }
715
716 const auto& partitionHelper() const
717 {
718 return mMesh_->partitionHelper();
719 }
720
721 private:
722 std::unique_ptr<MMeshInterfaceGridLeafIndexSet<const GridImp>> leafIndexSet_;
723
724 std::unique_ptr<MMeshInterfaceGridGlobalIdSet<const GridImp>> globalIdSet_;
725
726 std::unordered_map< std::vector< std::size_t >, ConnectedComponent, HashUIntVector > childrenConnectedComponentMap_;
727
728 protected:
731
732 BoundarySegments boundarySegments_, localBoundarySegments_;
733
734 mutable std::unordered_map< MMeshImpl::MultiId, int > mark_;
735
736 int sequence_ = 0;
737
738 }; // end Class MMeshInterfaceGrid
739
740
741 // DGFGridInfo for MMeshInterfaceGrid
742 // ----------------------------------
743
744 template<class MMesh>
745 struct DGFGridInfo< MMeshInterfaceGrid<MMesh> >
746 {
747 static int refineStepsForHalf ()
748 {
749 return MMesh::dimension-1;
750 }
751
752 static double refineWeight ()
753 {
754 return -1;
755 }
756 };
757
758 // Capabilites of MMeshInterfaceGrid
759 // ---------------------------------
760
762 namespace Capabilities
763 {
767 template<class MMesh>
768 struct hasSingleGeometryType<MMeshInterfaceGrid<MMesh>>
769 {
770 static const bool v = true;
771 static const unsigned int topologyId = Dune::GeometryType::simplex;
772 };
773
777 template<class MMesh, int codim>
778 struct hasEntity<MMeshInterfaceGrid<MMesh>, codim>
779 {
780 static const bool v = (codim >= 0 || codim <= MMesh::dimension-1);
781 };
782
783 template<class MMesh, int codim>
784 struct hasEntityIterator<MMeshInterfaceGrid<MMesh>, codim>
785 {
786 static const bool v = (codim >= 0 || codim <= MMesh::dimension-1);
787 };
788
792 template<class MMesh>
793 struct isLevelwiseConforming<MMeshInterfaceGrid<MMesh>>
794 {
795 static const bool v = true;
796 };
797
801 template<class MMesh>
802 struct isLeafwiseConforming<MMeshInterfaceGrid<MMesh>>
803 {
804 static const bool v = true;
805 };
806 } // end namespace Capabilities
808
809} // namespace Dune
810
811#endif // DUNE_MMESH_INTERFACE_GRID_HH
The implementation of connected components in a MMeshInterfaceGridThe connected component copies the ...
Definition: connectedcomponent.hh:33
The implementation of entities in a MMesh interface grid.
Definition: entity.hh:35
const MMeshInterfaceEntity & hostEntity() const
Return reference to the host entity.
Definition: entity.hh:327
Iterator over all entities of a given codimension and level of a grid (2D).
Definition: leafiterator.hh:22
Provides a DUNE grid interface class for the interface of a MMesh interface grid.
Definition: grid.hh:97
typename GridFamily::Traits::Grid GridImp
the grid implementation
Definition: grid.hh:116
void setIds()
compute the grid ids
Definition: grid.hh:677
bool isInterface(const VertexHandle &vertex) const
Return if vertex is part of the interface.
Definition: grid.hh:572
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e) const
Mark entity for refinement.
Definition: grid.hh:369
bool adapt(AdaptDataHandleInterface< GridImp, DataHandle > &handle)
Callback for the grid adaptation process with restrict/prolong.
Definition: grid.hh:410
bool preAdapt()
returns false, if at least one entity is marked for adaption
Definition: grid.hh:393
MMeshInterfaceConnectedComponent< const GridImp > ConnectedComponent
The type of a connected component.
Definition: grid.hh:156
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: grid.hh:314
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: grid.hh:478
const MMeshInterfaceGridLeafIndexSet< const GridImp > & leafIndexSet() const
Access to the LeafIndexSet.
Definition: grid.hh:251
bool isInterface(const Entity &entity) const
Return if dune entity is part of the interface.
Definition: grid.hh:585
std::list< MMeshInterfaceEntity< 0 > > ElementOutput
The type of the element output.
Definition: grid.hh:147
std::enable_if_t< d==2, bool > isInterface(const MMeshInterfaceEntity< 1 > &edge) const
Return if an edge is of the interface.
Definition: grid.hh:562
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: grid.hh:335
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: grid.hh:484
MMeshInterfaceGrid(MMesh *mMesh, BoundarySegments boundarySegments={})
Constructor.
Definition: grid.hh:162
const Communication< Comm > & comm() const
Collective communication.
Definition: grid.hh:507
MMeshInterfaceGridFamily< MMesh > GridFamily
the Traits
Definition: grid.hh:112
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: grid.hh:300
bool isInterface(const MMeshInterfaceEntity< 0 > &segment) const
Return if interface segment is part of the interface.
Definition: grid.hh:553
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: grid.hh:183
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: grid.hh:231
Traits::template Codim< 0 >::Entity entity(const MMeshInterfaceEntity< 0 > &hostEntity) const
Create codim 0 entity from a host entity.
Definition: grid.hh:279
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: grid.hh:307
typename HostGridEntityChooser_< HostGridType, dimensionworld, cd+1 >::type MMeshInterfaceEntity
The type of the underlying entities.
Definition: grid.hh:138
bool isInterface(const typename Traits::LeafIntersection &intersection) const
Return if intersection is part of the interface.
Definition: grid.hh:578
const ConnectedComponent & getConnectedComponent(const Entity &entity) const
Return the connected component for a given entity.
Definition: grid.hh:614
const HostGridType & getHostGrid() const
Return reference to underlying CGAL triangulation.
Definition: grid.hh:705
ConnectedComponent & getConnectedComponent(const Entity &entity)
Return a non-const reference to the connected component for a given entity.
Definition: grid.hh:622
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: grid.hh:217
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:599
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: grid.hh:225
typename MMesh::HostGridType HostGridType
the underlying hostgrid
Definition: grid.hh:122
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: grid.hh:383
int sequence() const
Return sequence number.
Definition: grid.hh:711
std::unique_ptr< GridImp > GridPtrType
the unique pointer to the grid
Definition: grid.hh:119
int maxLevel() const
Return maximum level defined in this grid.
Definition: grid.hh:177
Dune::FieldVector< ctype, dimensionworld > GlobalCoordinate
The type used for coordinates.
Definition: grid.hh:134
typename Traits::template Codim< dimension >::Entity Vertex
The type of a vertex.
Definition: grid.hh:153
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: grid.hh:293
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: grid.hh:459
bool hasConnectedComponent(const Entity &entity) const
Return if an entity has a connected component.
Definition: grid.hh:606
bool adapt()
Triggers the grid adaptation process.
Definition: grid.hh:403
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: grid.hh:328
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:286
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: grid.hh:259
std::enable_if_t< d==3, const MMeshInterfaceEntity< 0 > > mirrorHostEntity(const MMeshInterfaceEntity< 0 > &other) const
Mirror a host entity (3d)
Definition: grid.hh:654
const MMesh & getMMesh() const
Return reference to MMesh.
Definition: grid.hh:699
void postAdapt()
Clean up refinement markers.
Definition: grid.hh:445
typename Traits::template Codim< 0 >::Entity Entity
The type of a codim 0 entity.
Definition: grid.hh:150
void globalRefine(int steps=1)
Global refine.
Definition: grid.hh:350
void setIndices()
compute the grid indices
Definition: grid.hh:683
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: grid.hh:191
MMeshInterfaceEntity< dimension > VertexHandle
The type of the underlying vertex handle.
Definition: grid.hh:141
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: grid.hh:453
FieldType ctype
The type used to store coordinates, inherited from the MMesh.
Definition: grid.hh:131
MMesh * mMesh_
The host grid which contains the actual grid hierarchy structure.
Definition: grid.hh:730
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: grid.hh:321
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: grid.hh:237
MMeshInterfaceEntity< dimension-1 > EdgeHandle
The type of the underlying edge handle.
Definition: grid.hh:144
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: grid.hh:342
void loadBalance()
Distributes this grid over the available nodes in a distributed machine.
Definition: grid.hh:494
int size(int codim) const
number of leaf entities per codim in this process
Definition: grid.hh:211
std::enable_if_t< d==2, const MMeshInterfaceEntity< 0 > > mirrorHostEntity(const MMeshInterfaceEntity< 0 > &other) const
Mirror a host entity (2d)
Definition: grid.hh:646
const MMeshInterfaceGridLeafIndexSet< const GridImp > & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: grid.hh:243
Traits::template Codim< 0 >::LeafIterator LeafIterator
the leaf iterator
Definition: grid.hh:128
Traits::template Codim< dimension >::Entity entity(const MMeshInterfaceEntity< dimension > &hostEntity) const
Create Entity from a host entity.
Definition: grid.hh:273
std::size_t domainMarker(const Entity &entity) const
Return domain marker of entity.
Definition: grid.hh:592
The MMesh class templatized by the CGAL host grid type and the dimension.
Definition: mmesh.hh:140
const HostGrid & getHostGrid() const
Get reference to the underlying CGAL triangulation.
Definition: mmesh.hh:1815
const InterfaceSegments & interfaceSegments() const
returns the interface segment set
Definition: mmesh.hh:360
bool adapt()
Triggers the grid adaptation process.
Definition: mmesh.hh:853
static constexpr int dimension
The world dimension.
Definition: mmesh.hh:143
HostGrid HostGridType
The hostgrid type.
Definition: mmesh.hh:146
void loadBalance()
Distributes this grid over the available nodes in a distributed machine.
Definition: mmesh.hh:1742
typename Point::R::RT FieldType
The field type.
Definition: mmesh.hh:155
MMeshImpl::MultiId IdType
The type of an id.
Definition: mmesh.hh:158
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 (Apr 6, 22:49, 2025)