Go to the documentation of this file.
3 #ifndef DUNE_ONE_D_GRID_HH
4 #define DUNE_ONE_D_GRID_HH
10 #include <dune/common/parallel/collectivecommunication.hh>
16 #include <dune/geometry/axisalignedcubegeometry.hh>
17 #include <dune/geometry/type.hh>
23 #include "onedgrid/onedgridlist.hh"
24 #include "onedgrid/nulliteratorfactory.hh"
25 #include "onedgrid/onedgridentity.hh"
26 #include "onedgrid/onedgridentityseed.hh"
27 #include "onedgrid/onedgridintersections.hh"
28 #include "onedgrid/onedgridintersectioniterators.hh"
29 #include "onedgrid/onedgridleafiterator.hh"
30 #include "onedgrid/onedgridviews.hh"
31 #include "onedgrid/onedgridleveliterator.hh"
32 #include "onedgrid/onedgridhieriterator.hh"
33 #include "onedgrid/onedgridindexsets.hh"
44 template <
int mydim,
int coorddim,
class Gr
idImp>
54 OneDGridLevelIterator,
55 OneDGridLeafIntersection,
56 OneDGridLevelIntersection,
57 OneDGridLeafIntersectionIterator,
58 OneDGridLevelIntersectionIterator,
59 OneDGridHierarchicIterator,
61 OneDGridLevelIndexSet<const OneDGrid>,
62 OneDGridLeafIndexSet<const OneDGrid>,
63 OneDGridIdSet<const OneDGrid>,
65 OneDGridIdSet<const OneDGrid>,
67 CollectiveCommunication<Dune::OneDGrid>,
68 OneDGridLevelGridViewTraits,
69 OneDGridLeafGridViewTraits,
97 template <
int , PartitionIteratorType,
class >
100 friend class OneDGridHierarchicIterator<const
OneDGrid>;
102 template <
int codim_,
int dim_,
class Gr
idImp_>
105 friend class OneDGridLeafIntersection<const
OneDGrid>;
106 friend class OneDGridLevelIntersection<const
OneDGrid>;
107 friend class OneDGridLeafIntersectionIterator<const
OneDGrid>;
108 friend class OneDGridLevelIntersectionIterator<const
OneDGrid>;
110 friend class OneDGridLevelIndexSet<const
OneDGrid>;
114 template <
int codim_, PartitionIteratorType PiType_,
class Gr
idImp_>
118 friend class OneDGridLevelGridView<const
OneDGrid>;
120 template <
class Gr
idType_>
123 template<
int codim_,
int dim_,
class Gr
idImp_,
template<
int,
int,
class>
class EntityImp_>
146 OneDGrid(
const std::vector<ctype>& coords);
158 int maxLevel()
const {
return entityImps_.size()-1;}
161 template <
typename Seed>
162 static typename Traits::template Codim<Seed::codimension>::Entity
165 const int codim = Seed::codimension;
172 int size (
int level,
int codim)
const {
173 if (codim<0 || codim>1)
174 DUNE_THROW(
GridError,
"There are no codim " << codim <<
" entities in a OneDGrid!");
177 return elements(level).size();
179 return vertices(level).size();
194 return size(level,1-type.dim());
228 if (! levelIndexSets_[level]) {
229 levelIndexSets_[level] =
231 levelIndexSets_[level]->update();
234 return * levelIndexSets_[level];
240 return leafIndexSet_;
284 refinementType_ = type;
296 const CollectiveCommunication &
comm ()
const
305 OneDGridList<OneDEntityImp<0> >& vertices(
int level) {
306 return std::get<0>(entityImps_[level]);
310 const OneDGridList<OneDEntityImp<0> >& vertices(
int level)
const {
311 return std::get<0>(entityImps_[level]);
315 OneDGridList<OneDEntityImp<1> >& elements(
int level) {
316 return std::get<1>(entityImps_[level]);
320 const OneDGridList<OneDEntityImp<1> >& elements(
int level)
const {
321 return std::get<1>(entityImps_[level]);
324 CollectiveCommunication ccobj;
331 unsigned int getNextFreeId()
333 return freeIdCounter_++;
339 OneDGridList<OneDEntityImp<0> >::iterator getLeftUpperVertex(
const OneDEntityImp<1>* eIt);
341 OneDGridList<OneDEntityImp<0> >::iterator getRightUpperVertex(
const OneDEntityImp<1>* eIt);
346 OneDGridList<OneDEntityImp<1> >::iterator getLeftNeighborWithSon(OneDGridList<OneDEntityImp<1> >::iterator eIt);
349 std::vector<std::tuple<OneDGridList<OneDEntityImp<0> >,
350 OneDGridList<OneDEntityImp<1> > > > entityImps_;
353 mutable std::vector<OneDGridLevelIndexSet<const OneDGrid>* > levelIndexSets_;
361 unsigned int freeIdCounter_;
366 bool reversedBoundarySegmentNumbering_;
370 namespace Capabilities
386 static const bool v =
true;
387 static const unsigned int topologyId = Impl::CubeTopology< 1 >::type::id;
397 static const bool v =
true;
407 static const bool v =
false;
416 static const bool v =
true;
425 static const bool v =
true;
437 #include <dune/grid/onedgrid/onedgridfactory.hh>
Index Set Interface base class.
Definition: common/grid.hh:346
Wrapper class for entities.
Definition: common/entity.hh:63
Different resources needed by all grid implementations.
static const bool v
Definition: common/capabilities.hh:57
One-dimensional adaptive grid.
Definition: onedgrid.hh:91
OneDGridFamily GridFamily
GridFamily of OneDGrid.
Definition: onedgrid.hh:140
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:112
friend class OneDGridLevelIterator
Definition: onedgrid.hh:98
const CollectiveCommunication & comm() const
Definition: onedgrid.hh:296
friend class OneDGridLevelIndexSet< const OneDGrid >
Definition: onedgrid.hh:110
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:103
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Provide a generic factory class for unstructured grids.
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1063
int getMark(const Traits::Codim< 0 >::Entity &e) const
return current adaptation marker of given entity
const Traits::LeafIndexSet & leafIndexSet() const
Get an index set for the leaf level.
Definition: onedgrid.hh:238
Dune::Entity< cd, dim, const GridImp, EntityImp > Entity
The type of the entity.
Definition: common/grid.hh:1097
Definition: onedgrid.hh:47
OneDGridGeometry< 0, 1, OneDGrid >::ctype ctype
The type used to store coordinates.
Definition: onedgrid.hh:137
const Traits::LocalIdSet & localIdSet() const
Get the set of local ids.
Definition: onedgrid.hh:220
bool preAdapt()
Does nothing except return true if some element has been marked for refinement.
friend class OneDGridLeafIndexSet< const OneDGrid >
Definition: onedgrid.hh:111
void globalRefine(int refCount)
Does one uniform refinement step.
int size(int codim) const
number of leaf entities per codim in this process
Definition: onedgrid.hh:185
@ LOCAL
New level consists only of the refined elements.
Definition: onedgrid.hh:277
specialize with 'true' for all codims that a grid provides an iterator for (default=false)
Definition: common/capabilities.hh:71
const Traits::GlobalIdSet & globalIdSet() const
Get the set of global ids.
Definition: onedgrid.hh:214
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:24
Id Set Interface.
Definition: common/grid.hh:347
OneDGridFamily::Traits Traits
Definition: onedgrid.hh:143
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:263
int size(GeometryType type) const
number of leaf entities per geometry type in this process
Definition: onedgrid.hh:198
A set of traits classes to store static information about grid implementation.
const Traits::LevelIndexSet & levelIndexSet(int level) const
Get an index set for the given level.
Definition: onedgrid.hh:226
static std::conditional< std::is_reference< InterfaceType >::value, typename std::add_lvalue_reference< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type, typename std::remove_const< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation(InterfaceType &&i)
return real implementation of interface class
Definition: common/grid.hh:1026
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:55
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:220
friend class OneDGridIdSet< const OneDGrid >
Definition: onedgrid.hh:112
size_t numBoundarySegments() const
Return the number of coarse grid boundary segments.
Definition: onedgrid.hh:208
int size(int level, GeometryType type) const
number of entities per level and geometry type in this process
Definition: onedgrid.hh:191
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: onedgrid.hh:172
GridTraits< 1, 1, Dune::OneDGrid, OneDGridGeometry, OneDGridEntity, OneDGridLevelIterator, OneDGridLeafIntersection, OneDGridLevelIntersection, OneDGridLeafIntersectionIterator, OneDGridLevelIntersectionIterator, OneDGridHierarchicIterator, OneDGridLeafIterator, OneDGridLevelIndexSet< const OneDGrid >, OneDGridLeafIndexSet< const OneDGrid >, OneDGridIdSet< const OneDGrid >, unsigned int, OneDGridIdSet< const OneDGrid >, unsigned int, CollectiveCommunication< Dune::OneDGrid >, OneDGridLevelGridViewTraits, OneDGridLeafGridViewTraits, OneDGridEntitySeed > Traits
Definition: onedgrid.hh:71
static const unsigned int topologyId
Definition: common/capabilities.hh:29
void setRefinementType(RefinementType type)
Sets the type of grid refinement.
Definition: onedgrid.hh:283
AxisAlignedCubeGeometry< double, mydim, coorddim > OneDGridGeometry
The type used to for OneDGrid geometries.
Definition: onedgrid.hh:45
static const bool v
Definition: common/capabilities.hh:73
static const bool v
Definition: common/capabilities.hh:26
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
bool adapt()
Triggers the grid refinement process.
bool mark(int refCount, const Traits::Codim< 0 >::Entity &e)
Mark entity for refinement.
void postAdapt()
Adaptation post-processing: Reset all adaptation state flags.
friend class OneDGridLeafIterator
Definition: onedgrid.hh:115
static const bool v
Definition: common/capabilities.hh:114
Include standard header files.
Definition: agrid.hh:58
static const bool v
Definition: common/capabilities.hh:105
int maxLevel() const
Return maximum level defined in this grid.
Definition: onedgrid.hh:158
RefinementType
The different forms of grid refinement supported by OneDGrid.
Definition: onedgrid.hh:275
friend class OneDGridEntity
Definition: onedgrid.hh:103
Definition: common/geometry.hh:24
@ COPY
New level consists of the refined elements and the unrefined ones, too.
Definition: onedgrid.hh:279
static Traits::template Codim< Seed::codimension >::Entity entity(const Seed &seed)
Create an Entity from an EntitySeed.
Definition: onedgrid.hh:163