dune-grid  2.7.0
uggrid.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 
4 #ifndef DUNE_UGGRID_HH
5 #define DUNE_UGGRID_HH
6 
11 #include <memory>
12 
13 #include <dune/common/classname.hh>
14 #include <dune/common/parallel/communication.hh>
15 #include <dune/common/exceptions.hh>
16 #include <dune/common/parallel/mpihelper.hh>
17 #include <dune/common/deprecated.hh>
18 
21 #include <dune/grid/common/grid.hh>
22 
23 #if HAVE_UG || DOXYGEN
24 
25 #ifdef ModelP
26 #include <dune/common/parallel/mpicommunication.hh>
27 #endif
28 
29 /* [Before reading the following: the macros UG_DIM_2 and UG_DIM_3 where named
30  * _2 and _3, respectively, up until ug-3.12.0.]
31  *
32  * The following lines including the necessary UG headers are somewhat
33  tricky. Here's what's happening:
34  UG can support two- and three-dimensional grids. You choose by setting
35  either UG_DIM_2 or UG_DIM_3 while compiling. This changes all sorts of stuff, in
36  particular data structures in the headers.
37  UG was never supposed to provide 2d and 3d grids at the same time.
38  However, when compiling it as c++, the dimension-dependent parts are
39  wrapped up cleanly in the namespaces UG::D2 and UG::D3, respectively. That
40  way it is possible to link together the UG lib for 2d and the one for 3d.
41  But we also need the headers twice! Once with UG_DIM_2 set and once with UG_DIM_3!
42  So here we go:*/
43 
44 /* The following define tells the UG headers that we want access to a few
45  special fields, for example the extra index fields in the element data structures.
46  This define remains only for backwards compatibility with older version of UG.
47  All dune-uggrid versions since 2016-08-05 do not need this #define or the #undef
48  further below. */
49 #define FOR_DUNE
50 
51 // Set UG's space-dimension flag to 2d
52 #ifdef UG_USE_NEW_DIMENSION_DEFINES
53 #define UG_DIM_2
54 #else
55 #define _2
56 #endif
57 // And include all necessary UG headers
58 #include "uggrid/ugincludes.hh"
59 
60 // Wrap a few large UG macros by functions before they get undef'ed away.
61 // Here: The 2d-version of the macros
62 #define UG_DIM 2
63 #include "uggrid/ugwrapper.hh"
64 #undef UG_DIM
65 
66 // UG defines a whole load of preprocessor macros. ug_undefs.hh undefines
67 // them all, so we don't get name clashes.
68 #include "uggrid/ug_undefs.hh"
69 #ifdef UG_USE_NEW_DIMENSION_DEFINES
70 #undef UG_DIM_2
71 #else
72 #undef _2
73 #endif
74 
75 /* Now we're done with 2d, and we can do the whole thing over again for 3d */
76 
77 /* All macros set by UG have been unset. This includes the macros that ensure
78  single inclusion of headers. We can thus include them again. However, we
79  only want to include those headers again that contain dimension-dependent stuff.
80  Therefore, we set a few single-inclusion defines manually before including
81  ugincludes.hh again.
82  */
83 #define UGTYPES_H
84 #define __HEAPS__
85 #define __UGENV__
86 #define __DEVICESH__
87 #ifdef ModelP
88 #define __PPIF__
89 #endif
90 
91 #ifdef UG_USE_NEW_DIMENSION_DEFINES
92 #define UG_DIM_3
93 #else
94 #define _3
95 #endif
96 
97 #include "uggrid/ugincludes.hh"
98 
99 // Wrap a few large UG macros by functions before they get undef'ed away.
100 // This time it's the 3d-versions.
101 #define UG_DIM 3
102 #include "uggrid/ugwrapper.hh"
103 #undef UG_DIM
104 
105 // undef all macros defined by UG
106 #include "uggrid/ug_undefs.hh"
107 
108 #ifdef UG_USE_NEW_DIMENSION_DEFINES
109 #undef UG_DIM_3
110 #else
111 #undef _3
112 #endif
113 #undef FOR_DUNE
114 
115 // The components of the UGGrid interface
116 #include "uggrid/uggridgeometry.hh"
117 #include "uggrid/uggridlocalgeometry.hh"
118 #include "uggrid/uggridentity.hh"
119 #include "uggrid/uggridentityseed.hh"
120 #include "uggrid/uggridintersections.hh"
121 #include "uggrid/uggridintersectioniterators.hh"
122 #include "uggrid/uggridleveliterator.hh"
123 #include "uggrid/uggridleafiterator.hh"
124 #include "uggrid/uggridhieriterator.hh"
125 #include "uggrid/uggridindexsets.hh"
126 #include <dune/grid/uggrid/uggridviews.hh>
127 #ifdef ModelP
128 #include "uggrid/ugmessagebuffer.hh"
129 #include "uggrid/uglbgatherscatter.hh"
130 #endif
131 
132 // Not needed here, but included for user convenience
133 #include "uggrid/uggridfactory.hh"
134 
135 #ifdef ModelP
136 template <class DataHandle, int GridDim, int codim>
137 const Dune::UGGrid<GridDim>* Dune::UGMessageBufferBase<DataHandle, GridDim, codim>::grid_;
138 
139 template <class DataHandle, int GridDim, int codim>
140 DataHandle *Dune::UGMessageBufferBase<DataHandle,GridDim,codim>::duneDataHandle_ = 0;
141 
142 template <class DataHandle, int GridDim, int codim>
143 int Dune::UGMessageBufferBase<DataHandle,GridDim,codim>::level = -1;
144 #endif // ModelP
145 
146 namespace Dune {
147 
148 #ifdef ModelP
149  using UGCollectiveCommunication = CollectiveCommunication<MPI_Comm>;
150 #else
151  using UGCollectiveCommunication = CollectiveCommunication<No_Comm>;
152 #endif
153 
154  template<int dim>
156  {
158  UGGridGeometry,
159  UGGridEntity,
160  UGGridLevelIterator,
161  UGGridLeafIntersection,
162  UGGridLevelIntersection,
163  UGGridLeafIntersectionIterator,
164  UGGridLevelIntersectionIterator,
165  UGGridHierarchicIterator,
166  UGGridLeafIterator,
167  UGGridLevelIndexSet< const UGGrid<dim> >,
168  UGGridLeafIndexSet< const UGGrid<dim> >,
169  UGGridIdSet< const UGGrid<dim> >,
170  typename UG_NS<dim>::UG_ID_TYPE,
171  UGGridIdSet< const UGGrid<dim> >,
172  typename UG_NS<dim>::UG_ID_TYPE,
174  UGGridLevelGridViewTraits,
175  UGGridLeafGridViewTraits,
176  UGGridEntitySeed,
177  UGGridLocalGeometry>
179  };
180 
181 
182  //**********************************************************************
183  //
184  // --UGGrid
185  //
186  //**********************************************************************
187 
225  template <int dim>
226  class UGGrid : public GridDefaultImplementation <dim, dim, double, UGGridFamily<dim> >
227  {
229 
230  friend class UGGridGeometry<0,dim,const UGGrid<dim> >;
231  friend class UGGridGeometry<dim,dim,const UGGrid<dim> >;
232  friend class UGGridGeometry<1,2,const UGGrid<dim> >;
233  friend class UGGridGeometry<2,3,const UGGrid<dim> >;
234 
235  friend class UGGridEntity <0,dim,const UGGrid<dim> >;
236  friend class UGGridEntity <1,dim,const UGGrid<dim> >;
237  friend class UGGridEntity <dim,dim,const UGGrid<dim> >;
238  friend class UGEdgeEntity <dim,const UGGrid<dim> >;
239  friend class UGGridHierarchicIterator<const UGGrid<dim> >;
240  friend class UGGridLeafIntersection<const UGGrid<dim> >;
241  friend class UGGridLevelIntersection<const UGGrid<dim> >;
242  friend class UGGridLeafIntersectionIterator<const UGGrid<dim> >;
243  friend class UGGridLevelIntersectionIterator<const UGGrid<dim> >;
244 
245  friend class UGGridLevelIndexSet<const UGGrid<dim> >;
246  friend class UGGridLeafIndexSet<const UGGrid<dim> >;
247  friend class UGGridIdSet<const UGGrid<dim> >;
248  template <class GridImp_>
249  friend class UGGridLeafGridView;
250  template <class GridImp_>
251  friend class UGGridLevelGridView;
252 
253  friend class GridFactory<UGGrid<dim> >;
254 
255 #ifdef ModelP
256  friend class UGLBGatherScatter;
257 #endif
258 
259  template <int codim_, PartitionIteratorType PiType_, class GridImp_>
260  friend class UGGridLeafIterator;
261  template <int codim_, PartitionIteratorType PiType_, class GridImp_>
262  friend class UGGridLevelIterator;
263 
265  static_assert(dim==2 || dim==3, "Use UGGrid only for 2d and 3d!");
266 
267  // The different instantiations are mutual friends so they can access
268  // each others numOfUGGrids field
269  friend class UGGrid<2>;
270  friend class UGGrid<3>;
271 
272  //**********************************************************
273  // The Interface Methods
274  //**********************************************************
275  public:
278 
279  // the Traits
281 
283  typedef UG::DOUBLE ctype;
284 
286  typedef unsigned int Rank;
287 
291 
293  ~UGGrid() noexcept(false);
294 
297  int maxLevel() const;
298 
300  template <typename Seed>
301  typename Traits::template Codim<Seed::codimension>::Entity
302  entity(const Seed& seed) const
303  {
304  const int codim = Seed::codimension;
305  return typename Traits::template Codim<codim>::Entity(UGGridEntity<codim,dim,const UGGrid<dim> >(seed.impl().target(),this));
306  }
307 
310  int size (int level, int codim) const;
311 
313  int size (int codim) const
314  {
315  return leafIndexSet().size(codim);
316  }
317 
319  int size (int level, GeometryType type) const
320  {
321  return this->levelIndexSet(level).size(type);
322  }
323 
325  int size (GeometryType type) const
326  {
327  return this->leafIndexSet().size(type);
328  }
329 
331  size_t numBoundarySegments() const {
332  // The number is stored as a member of UGGrid upon grid creation.
333  // The corresponding data structure is not exported by UG. (It is in ug/dom/std/std_internal.h)
334  return numBoundarySegments_;
335  }
336 
338  const typename Traits::GlobalIdSet& globalIdSet() const
339  {
340  return idSet_;
341  }
342 
344  const typename Traits::LocalIdSet& localIdSet() const
345  {
346  return idSet_;
347  }
348 
350  const typename Traits::LevelIndexSet& levelIndexSet(int level) const
351  {
352  if (level<0 || level>maxLevel())
353  DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!");
354  return *levelIndexSets_[level];
355  }
356 
358  const typename Traits::LeafIndexSet& leafIndexSet() const
359  {
360  return leafIndexSet_;
361  }
362 
365 
378  bool mark(int refCount, const typename Traits::template Codim<0>::Entity & e );
379 
435  bool mark(const typename Traits::template Codim<0>::Entity & e,
436  typename UG_NS<dim>::RefinementRule rule,
437  int side=0);
438 
440  int getMark(const typename Traits::template Codim<0>::Entity& e) const;
441 
444  bool preAdapt();
445 
447  bool adapt();
448 
450  void postAdapt();
460  template<class DataHandle>
461  bool loadBalance (DataHandle& dataHandle)
462  {
463 #ifdef ModelP
464  // gather element data
465  if (dataHandle.contains(dim, 0))
466  UGLBGatherScatter::template gather<0>(this->leafGridView(), dataHandle);
467 
468  // gather node data
469  if (dataHandle.contains(dim,dim))
470  UGLBGatherScatter::template gather<dim>(this->leafGridView(), dataHandle);
471 #endif
472 
473  // the load balancing step now also attaches
474  // the data to the entities and distributes it
475  loadBalance();
476 
477 #ifdef ModelP
478  // scatter element data
479  if (dataHandle.contains(dim, 0))
480  UGLBGatherScatter::template scatter<0>(this->leafGridView(), dataHandle);
481 
482  // scatter node data
483  if (dataHandle.contains(dim,dim))
484  UGLBGatherScatter::template scatter<dim>(this->leafGridView(), dataHandle);
485 #endif
486 
487  return true;
488  }
489 
496  bool loadBalance(int minlevel=0);
497 
528  bool loadBalance(const std::vector<Rank>& targetProcessors, unsigned int fromLevel);
529 
539  template<class DataHandle>
540  bool loadBalance (const std::vector<Rank>& targetProcessors, unsigned int fromLevel, DataHandle& dataHandle)
541  {
542 #ifdef ModelP
543  // gather element data
544  // UGLBGatherScatter::template gather<0>(this->leafGridView(), dataHandle);
545 
546  // gather node data
547  UGLBGatherScatter::template gather<dim>(this->leafGridView(), dataHandle);
548 #endif
549 
550  // the load balancing step now also attaches
551  // the data to the entities and distributes it
552  loadBalance(targetProcessors,fromLevel);
553 
554 #ifdef ModelP
555  // scatter element data
556  // UGLBGatherScatter::template scatter<0>(this->leafGridView(), dataHandle);
557 
558  // scatter node data
559  UGLBGatherScatter::template scatter<dim>(this->leafGridView(), dataHandle);
560 #endif
561 
562  return true;
563  }
564 
567  {
568  return ccobj_;
569  }
570 
571  protected:
572 #ifdef ModelP
573  template <int codim, class GridView, class DataHandle>
574  void communicateUG_(const GridView& gv, int level,
575  DataHandle &dataHandle,
576  InterfaceType iftype,
577  CommunicationDirection dir) const
578  {
579  typename UG_NS<dim>::DDD_IF_DIR ugIfDir;
580  // Translate the communication direction from Dune-Speak to UG-Speak
581  if (dir==ForwardCommunication)
582  ugIfDir = UG_NS<dim>::IF_FORWARD();
583  else
584  ugIfDir = UG_NS<dim>::IF_BACKWARD();
585 
586  typedef UGMessageBuffer<DataHandle,dim,codim> UGMsgBuf;
587  UGMsgBuf::duneDataHandle_ = &dataHandle;
588 
589  UGMsgBuf::level = level;
590 
591  std::vector<typename UG_NS<dim>::DDD_IF> ugIfs;
592  findDDDInterfaces_(ugIfs, iftype, codim);
593 
594  unsigned bufSize = UGMsgBuf::ugBufferSize_(gv);
595  if (!bufSize)
596  return; // we don't need to communicate if we don't have any data!
597  UGMsgBuf::grid_ = this;
598  for (unsigned i=0; i < ugIfs.size(); ++i)
599  UG_NS<dim>::DDD_IFOneway(
600 #if DUNE_UGGRID_HAVE_DDDCONTEXT
601  multigrid_->dddContext(),
602 #endif
603  ugIfs[i],
604  ugIfDir,
605  bufSize,
606  &UGMsgBuf::ugGather_,
607  &UGMsgBuf::ugScatter_);
608  }
609 
610  void findDDDInterfaces_(std::vector<typename UG_NS<dim>::DDD_IF > &dddIfaces,
611  InterfaceType iftype,
612  int codim) const
613  {
614 #if DUNE_UGGRID_HAVE_DDDCONTEXT
615 # define DDD_CONTEXT multigrid_->dddContext()
616 #else
617 # define DDD_CONTEXT
618 #endif
619  dddIfaces.clear();
620  if (codim == 0)
621  {
622  switch (iftype) {
624  // do not communicate anything: Elements can not be in
625  // the interior of two processes at the same time
626  return;
628  // The communicated elements are in the sender's
629  // interior and it does not matter what they are for
630  // the receiver
631  dddIfaces.push_back(UG_NS<dim>::ElementVHIF(DDD_CONTEXT));
632  return;
633  case All_All_Interface :
634  // It does neither matter what the communicated
635  // elements are for sender nor for the receiver. If
636  // they are seen by these two processes, data is send
637  // and received.
638  dddIfaces.push_back(UG_NS<dim>::ElementSymmVHIF(DDD_CONTEXT));
639  return;
640  default :
641  DUNE_THROW(GridError,
642  "Element communication not supported for "
643  "interfaces of type "
644  << iftype);
645  }
646  }
647  else if (codim == dim)
648  {
649  switch (iftype)
650  {
652  dddIfaces.push_back(UG_NS<dim>::BorderNodeSymmIF(DDD_CONTEXT));
653  return;
655  dddIfaces.push_back(UG_NS<dim>::BorderNodeSymmIF(DDD_CONTEXT));
656  dddIfaces.push_back(UG_NS<dim>::NodeIF(DDD_CONTEXT));
657  return;
658  case All_All_Interface :
659  dddIfaces.push_back(UG_NS<dim>::NodeAllIF(DDD_CONTEXT));
660  return;
661  default :
662  DUNE_THROW(GridError,
663  "Node communication not supported for "
664  "interfaces of type "
665  << iftype);
666  }
667  }
668  else if (codim == dim-1)
669  {
670  switch (iftype)
671  {
673  dddIfaces.push_back(UG_NS<dim>::BorderEdgeSymmIF(DDD_CONTEXT));
674  return;
676  dddIfaces.push_back(UG_NS<dim>::BorderEdgeSymmIF(DDD_CONTEXT));
677  // Is the following line needed or not?
678  // dddIfaces.push_back(UG_NS<dim>::EdgeIF(DDD_CONTEXT));
679  return;
680  case All_All_Interface :
681  dddIfaces.push_back(UG_NS<dim>::EdgeSymmVHIF(DDD_CONTEXT));
682  return;
683  default :
684  DUNE_THROW(GridError,
685  "Edge communication not supported for "
686  "interfaces of type "
687  << iftype);
688  }
689  }
690  else if (codim == 1)
691  {
692  switch (iftype)
693  {
696  dddIfaces.push_back(UG_NS<dim>::BorderVectorSymmIF(DDD_CONTEXT));
697  return;
698  default :
699  DUNE_THROW(GridError,
700  "Face communication not supported for "
701  "interfaces of type "
702  << iftype);
703  }
704  }
705  else
706  {
707  DUNE_THROW(GridError,
708  "Communication for codim "
709  << codim
710  << " entities is not yet supported "
711  << " by the DUNE UGGrid interface!");
712  }
713 #undef DDD_CONTEXT
714  };
715 #endif // ModelP
716 
717  public:
718  // **********************************************************
719  // End of Interface Methods
720  // **********************************************************
721 
729  void getChildrenOfSubface(const typename Traits::template Codim<0>::Entity & e,
730  int elementSide,
731  int maxl,
732  std::vector<typename Traits::template Codim<0>::Entity>& childElements,
733  std::vector<unsigned char>& childElementSides) const;
734 
741  };
742 
744  enum ClosureType {
749  };
750 
753  refinementType_ = type;
754  }
755 
758  closureType_ = type;
759  }
760 
767  static void setDefaultHeapSize(unsigned size)
768  DUNE_DEPRECATED_MSG("Do not set the UGGrid default heap size---it is ignored anyway!")
769  {}
770 
774  void setPosition(const typename Traits::template Codim<dim>::Entity& e,
775  const FieldVector<double, dim>& pos);
776 
781  void globalRefine(int n);
782 
787  void saveState(const std::string& filename) const;
788 
793  void loadState(const std::string& filename);
794 
795  private:
797  typename UG_NS<dim>::MultiGrid* multigrid_;
798 
801 
807  void setIndices(bool setLevelZero,
808  std::vector<unsigned int>* nodePermutation);
809 
810  // Each UGGrid object has a unique name to identify it in the
811  // UG environment structure
812  std::string name_;
813 
814  // Our set of level indices
815  std::vector<std::shared_ptr<UGGridLevelIndexSet<const UGGrid<dim> > > > levelIndexSets_;
816 
817  UGGridLeafIndexSet<const UGGrid<dim> > leafIndexSet_;
818 
819  // One id set implementation
820  // Used for both the local and the global UGGrid id sets
821  UGGridIdSet<const UGGrid<dim> > idSet_;
822 
824  RefinementType refinementType_;
825 
827  ClosureType closureType_;
828 
836  static int numOfUGGrids;
837 
843  bool someElementHasBeenMarkedForRefinement_;
844 
850  bool someElementHasBeenMarkedForCoarsening_;
851 
853  std::vector<std::shared_ptr<BoundarySegment<dim> > > boundarySegments_;
854 
860  unsigned int numBoundarySegments_;
861 
862  }; // end Class UGGrid
863 
864  namespace Capabilities
865  {
881  template<int dim>
882  struct hasEntity< UGGrid<dim>, 0>
883  {
884  static const bool v = true;
885  };
886 
890  template<int dim>
891  struct hasEntity< UGGrid<dim>, dim>
892  {
893  static const bool v = true;
894  };
895 
900  template<int dim>
901  struct hasEntityIterator<UGGrid<dim>, 0>
902  {
903  static const bool v = true;
904  };
905 
910  template<int dim>
911  struct hasEntityIterator<UGGrid<dim>, dim>
912  {
913  static const bool v = true;
914  };
915 
919  template<int dim>
921  {
922  static const bool v = true;
923  };
924 
928  template<int dim>
930  {
931  static const bool v = false;
932  };
933 
934  }
935 
936 } // namespace Dune
937 
938 #endif // HAVE_UG || DOXYGEN
939 #endif // DUNE_UGGRID_HH
Dune::UGGridFamily::Traits
GridTraits< dim, dim, Dune::UGGrid< dim >, UGGridGeometry, UGGridEntity, UGGridLevelIterator, UGGridLeafIntersection, UGGridLevelIntersection, UGGridLeafIntersectionIterator, UGGridLevelIntersectionIterator, UGGridHierarchicIterator, UGGridLeafIterator, UGGridLevelIndexSet< const UGGrid< dim > >, UGGridLeafIndexSet< const UGGrid< dim > >, UGGridIdSet< const UGGrid< dim > >, typename UG_NS< dim >::UG_ID_TYPE, UGGridIdSet< const UGGrid< dim > >, typename UG_NS< dim >::UG_ID_TYPE, UGCollectiveCommunication, UGGridLevelGridViewTraits, UGGridLeafGridViewTraits, UGGridEntitySeed, UGGridLocalGeometry > Traits
Definition: uggrid.hh:178
Dune::Capabilities::isLevelwiseConforming::v
static const bool v
Definition: common/capabilities.hh:105
Dune::Capabilities::hasEntityIterator
specialize with 'true' for all codims that a grid provides an iterator for (default=false)
Definition: common/capabilities.hh:71
Dune::UGGrid::setDefaultHeapSize
static void setDefaultHeapSize(unsigned size) DUNE_DEPRECATED_MSG("Do not set the UGGrid default heap size---it is ignored anyway!")
Sets the default heap size.
Definition: uggrid.hh:767
Dune::Capabilities::isLeafwiseConforming
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:112
Dune::UGGrid< dimworld >::RefinementType
RefinementType
The different forms of grid refinement that UG supports.
Definition: uggrid.hh:736
Dune::Capabilities::hasEntity::v
static const bool v
Definition: common/capabilities.hh:57
Dune::GridDefaultImplementation< dim, dim, double, UGGridFamily< dim > >::DUNE_DEPRECATED_MSG
DUNE_DEPRECATED_MSG("use the facade class' `impl()` method instead") static typename std
return real implementation of interface class
Definition: common/grid.hh:1007
Dune::UGCollectiveCommunication
CollectiveCommunication< No_Comm > UGCollectiveCommunication
Definition: uggrid.hh:151
Dune::Capabilities::hasEntity
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:55
Dune::UGGrid::saveState
void saveState(const std::string &filename) const
Save entire grid hierarchy to disk.
Dune::GridError
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
Dune::UGGrid
Front-end for the grid manager of the finite element toolbox UG.
Definition: uggrid.hh:226
Dune::GridTraits::GlobalIdSet
IdSet< const GridImp, GlobalIdSetImp, GIDType > GlobalIdSet
The type of the global id set.
Definition: common/grid.hh:1136
Dune::InteriorBorder_InteriorBorder_Interface
@ InteriorBorder_InteriorBorder_Interface
send/receive interior and border entities
Definition: gridenums.hh:85
Dune::Capabilities::isLeafwiseConforming::v
static const bool v
Definition: common/capabilities.hh:114
Dune::GridDefaultImplementation< dim, dim, double, UGGridFamily< dim > >::loadBalance
bool loadBalance()
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:941
Dune::UGGrid::maxLevel
int maxLevel() const
Dune::UGGrid::loadBalance
bool loadBalance(DataHandle &dataHandle)
Distributes the grid and some data over the available nodes in a distributed machine.
Definition: uggrid.hh:461
Dune::GridFactory
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:269
Dune::UGGrid::Rank
unsigned int Rank
The type used for process ranks.
Definition: uggrid.hh:286
Dune::UGGrid::setClosureType
void setClosureType(ClosureType type)
Sets the type of grid refinement closure.
Definition: uggrid.hh:757
Dune::UGGrid::setPosition
void setPosition(const typename Traits::template Codim< dim >::Entity &e, const FieldVector< double, dim > &pos)
Sets a vertex to a new position.
Dune::UGGrid< dimworld >::ClosureType
ClosureType
Decide whether to add a green closure to locally refined grid sections or not.
Definition: uggrid.hh:744
Dune::UGGrid::~UGGrid
~UGGrid() noexcept(false)
Destructor.
Dune::All_All_Interface
@ All_All_Interface
send all and receive all entities
Definition: gridenums.hh:89
Dune::UGGrid::size
int size(GeometryType type) const
number of leaf entities per geometry type in this process
Definition: uggrid.hh:325
Dune::UGGrid::postAdapt
void postAdapt()
Clean up refinement markers.
Dune::UGGrid::leafIndexSet
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: uggrid.hh:358
Dune::UGGrid::UGGridLeafIterator
friend class UGGridLeafIterator
Definition: uggrid.hh:260
Dune::Capabilities::hasEntityIterator::v
static const bool v
Definition: common/capabilities.hh:73
Dune::UGGrid::mark
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark element for refinement.
Dune::UGGrid::levelIndexSet
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: uggrid.hh:350
Dune::UGGridFamily
Definition: uggrid.hh:155
Dune::UGGrid::GridFamily
UGGridFamily< dim > GridFamily
type of the used GridFamily for this grid
Definition: uggrid.hh:277
Dune::UGGrid::setRefinementType
void setRefinementType(RefinementType type)
Sets the type of grid refinement.
Definition: uggrid.hh:752
Dune::UGGrid::loadState
void loadState(const std::string &filename)
Read entire grid hierarchy from disk.
Dune::UGGrid::entity
Traits::template Codim< Seed::codimension >::Entity entity(const Seed &seed) const
Create an Entity from an EntitySeed.
Definition: uggrid.hh:302
Dune::UGGrid::adapt
bool adapt()
Triggers the grid refinement process.
Dune::UGGrid::size
int size(int level, int codim) const
Number of grid entities per level and codim.
capabilities.hh
A set of traits classes to store static information about grid implementation.
Dune::UGGrid::NONE
@ NONE
No closure, results in nonconforming meshes.
Definition: uggrid.hh:748
Dune::GridDefaultImplementation
Definition: common/geometry.hh:24
Dune::UGGrid::UGGridLevelGridView
friend class UGGridLevelGridView
Definition: uggrid.hh:251
Dune::GridTraits::LocalIdSet
IdSet< const GridImp, LocalIdSetImp, LIDType > LocalIdSet
The type of the local id set.
Definition: common/grid.hh:1138
Dune::UGGrid::size
int size(int level, GeometryType type) const
number of entities per level and geometry type in this process
Definition: uggrid.hh:319
Dune::UGGrid::ctype
UG::DOUBLE ctype
The type used to store coordinates.
Definition: uggrid.hh:283
Dune::GridTraits::LevelIndexSet
IndexSet< const GridImp, LevelIndexSetImp > LevelIndexSet
The type of the level index set.
Definition: common/grid.hh:1132
Dune::Capabilities::isLevelwiseConforming
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:103
Dune::GridTraits
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1064
Dune::GridView
Grid view abstract base class.
Definition: common/gridview.hh:59
Dune::UGGrid::UGGridLeafGridView
friend class UGGridLeafGridView
Definition: uggrid.hh:249
Dune::InteriorBorder_All_Interface
@ InteriorBorder_All_Interface
send interior and border, receive all entities
Definition: gridenums.hh:86
Dune::UGGrid::LOCAL
@ LOCAL
New level consists only of the refined elements and the closure.
Definition: uggrid.hh:738
Dune::ForwardCommunication
@ ForwardCommunication
communicate as given in InterfaceType
Definition: gridenums.hh:169
Dune::UGGrid::Traits
UGGridFamily< dim >::Traits Traits
Definition: uggrid.hh:280
Dune::UGGrid::UGGridLevelIterator
friend class UGGridLevelIterator
Definition: uggrid.hh:262
Dune::UGGrid::loadBalance
bool loadBalance(const std::vector< Rank > &targetProcessors, unsigned int fromLevel, DataHandle &dataHandle)
Distributes the grid over the processes of a parallel machine, and sends data along with it.
Definition: uggrid.hh:540
Dune::UGGrid::GREEN
@ GREEN
Standard red/green refinement.
Definition: uggrid.hh:746
Dune::UGGrid::COPY
@ COPY
New level consists of the refined elements and the unrefined ones, too.
Definition: uggrid.hh:740
Dune::UGGrid::size
int size(int codim) const
number of leaf entities per codim in this process
Definition: uggrid.hh:313
Dune::UGGrid::UGGrid
UGGrid(UGCollectiveCommunication comm={})
Default constructor.
boundarysegment.hh
Base class for grid boundary segments of arbitrary geometry.
Dune::UGGrid::globalRefine
void globalRefine(int n)
Does uniform refinement.
Dune::UGGrid::comm
const UGCollectiveCommunication & comm() const
Definition: uggrid.hh:566
Dune::IndexSet::size
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:220
Dune::UGGrid::globalIdSet
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: uggrid.hh:338
Dune::CommunicationDirection
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
Dune::UGGrid::localIdSet
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: uggrid.hh:344
Dune::UGGrid::preAdapt
bool preAdapt()
returns true, if some elements might be coarsend during grid adaption, here always returns true
uggridfactory.hh
The specialization of the generic GridFactory for UGGrid.
Dune::InterfaceType
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
Dune::UGGrid::numBoundarySegments
size_t numBoundarySegments() const
Return the number of boundary segments.
Definition: uggrid.hh:331
grid.hh
Different resources needed by all grid implementations.
Dune::GridDefaultImplementation< dim, dim, double, UGGridFamily< dim > >::leafGridView
Traits::LeafGridView leafGridView() const
View for the leaf grid for All_Partition.
Definition: common/grid.hh:875
Dune::UGGrid::getMark
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Query whether element is marked for refinement.
Dune
Include standard header files.
Definition: agrid.hh:58
Dune::VTK::GeometryType
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:180
Dune::Entity
Wrapper class for entities.
Definition: common/entity.hh:63
Dune::UGGrid::getChildrenOfSubface
void getChildrenOfSubface(const typename Traits::template Codim< 0 >::Entity &e, int elementSide, int maxl, std::vector< typename Traits::template Codim< 0 >::Entity > &childElements, std::vector< unsigned char > &childElementSides) const
Rudimentary substitute for a hierarchic iterator on faces.
Dune::GridTraits::LeafIndexSet
IndexSet< const GridImp, LeafIndexSetImp > LeafIndexSet
The type of the leaf index set.
Definition: common/grid.hh:1134