5#ifndef DUNE_ONE_D_GRID_HH
6#define DUNE_ONE_D_GRID_HH
12#include <dune/common/parallel/communication.hh>
18#include <dune/geometry/axisalignedcubegeometry.hh>
19#include <dune/geometry/type.hh>
25#include "onedgrid/onedgridlist.hh"
26#include "onedgrid/nulliteratorfactory.hh"
27#include "onedgrid/onedgridentity.hh"
28#include "onedgrid/onedgridentityseed.hh"
29#include "onedgrid/onedgridintersections.hh"
30#include "onedgrid/onedgridintersectioniterators.hh"
31#include "onedgrid/onedgridleafiterator.hh"
32#include "onedgrid/onedgridviews.hh"
33#include "onedgrid/onedgridleveliterator.hh"
34#include "onedgrid/onedgridhieriterator.hh"
35#include "onedgrid/onedgridindexsets.hh"
46 template <
int mydim,
int coorddim,
class Gr
idImp>
56 OneDGridLevelIterator,
57 OneDGridLeafIntersection,
58 OneDGridLevelIntersection,
59 OneDGridLeafIntersectionIterator,
60 OneDGridLevelIntersectionIterator,
61 OneDGridHierarchicIterator,
63 OneDGridLevelIndexSet<const OneDGrid>,
64 OneDGridLeafIndexSet<const OneDGrid>,
65 OneDGridIdSet<const OneDGrid>,
67 OneDGridIdSet<const OneDGrid>,
69 Communication<No_Comm>,
70 OneDGridLevelGridViewTraits,
71 OneDGridLeafGridViewTraits,
75 std::array<GeometryType,1> >
99 constexpr static int dim = 1;
100 constexpr static int dimworld = 1;
102 template <
int , PartitionIteratorType,
class >
107 template <
int codim_,
int dim_,
class Gr
idImp_>
119 template <
int codim_, PartitionIteratorType PiType_,
class Gr
idImp_>
125 template <
class Gr
idType_>
128 template<
int codim_,
int dim_,
class Gr
idImp_,
template<
int,
int,
class>
class EntityImp_>
163 int maxLevel()
const {
return entityImps_.size()-1;}
166 template <
typename Seed>
167 static typename Traits::template Codim<Seed::codimension>::Entity
170 const int codim = Seed::codimension;
177 int size (
int level,
int codim)
const {
181 return elements(level).size();
183 return vertices(level).size();
198 int size (
int level, GeometryType type)
const
201 return size(level,1-type.dim());
205 int size (GeometryType type)
const
235 if (! levelIndexSets_[level]) {
236 levelIndexSets_[level] =
238 levelIndexSets_[level]->update();
241 return * levelIndexSets_[level];
247 return leafIndexSet_;
291 refinementType_ = type;
310 template <
class DataHandle>
314 DUNE_THROW(Dune::NotImplemented,
"communicate() for OneDGrid not implemented");
318 template <
class DataHandle>
322 DUNE_THROW(Dune::NotImplemented,
"communicate() for OneDGrid not implemented");
329 OneDGridList<OneDEntityImp<0> >& vertices(
int level) {
330 return std::get<0>(entityImps_[level]);
334 const OneDGridList<OneDEntityImp<0> >& vertices(
int level)
const {
335 return std::get<0>(entityImps_[level]);
339 OneDGridList<OneDEntityImp<1> >& elements(
int level) {
340 return std::get<1>(entityImps_[level]);
344 const OneDGridList<OneDEntityImp<1> >& elements(
int level)
const {
345 return std::get<1>(entityImps_[level]);
355 unsigned int getNextFreeId()
357 return freeIdCounter_++;
363 OneDGridList<OneDEntityImp<0> >::iterator getLeftUpperVertex(
const OneDEntityImp<1>* eIt);
365 OneDGridList<OneDEntityImp<0> >::iterator getRightUpperVertex(
const OneDEntityImp<1>* eIt);
370 OneDGridList<OneDEntityImp<1> >::iterator getLeftNeighborWithSon(OneDGridList<OneDEntityImp<1> >::iterator eIt);
373 std::vector<std::tuple<OneDGridList<OneDEntityImp<0> >,
374 OneDGridList<OneDEntityImp<1> > > > entityImps_;
377 mutable std::vector<OneDGridLevelIndexSet<const OneDGrid>* > levelIndexSets_;
385 unsigned int freeIdCounter_;
390 bool reversedBoundarySegmentNumbering_;
394 namespace Capabilities
410 static const bool v =
true;
411 static const unsigned int topologyId = GeometryTypes::cube(1).id();
421 static const bool v =
true;
431 static const bool v =
true;
440 static const bool v =
true;
449 static const bool v =
true;
461#include <dune/grid/onedgrid/onedgridfactory.hh>
CommunicationDirection
Define a type for communication direction parameter.
Definition gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition gridenums.hh:86
Include standard header files.
Definition agrid.hh:60
AxisAlignedCubeGeometry< double, mydim, coorddim > OneDGridGeometry
The type used to for OneDGrid geometries.
Definition onedgrid.hh:47
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition common/capabilities.hh:27
static const bool v
Definition common/capabilities.hh:28
static const unsigned int topologyId
Definition common/capabilities.hh:31
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition common/capabilities.hh:58
static const bool v
Definition common/capabilities.hh:59
specialize with 'true' for all codims that a grid provides an iterator for (default=hasEntity<codim>:...
Definition common/capabilities.hh:74
static const bool v
Definition common/capabilities.hh:75
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition common/capabilities.hh:106
static const bool v
Definition common/capabilities.hh:107
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition common/capabilities.hh:115
static const bool v
Definition common/capabilities.hh:116
Wrapper class for entities.
Definition common/entity.hh:66
Definition common/grid.hh:848
typename GridFamily::Traits::Communication Communication
A type that is a model of Dune::Communication. It provides a portable way for communication on the se...
Definition common/grid.hh:515
A Traits struct that collects all associated types of one implementation.
Definition common/grid.hh:411
A traits struct that collects all associated types of one grid model.
Definition common/grid.hh:1013
Traits associated with a specific codim.
Definition common/grid.hh:1035
Provide a generic factory class for unstructured grids.
Definition common/gridfactory.hh:275
Definition onedgrid.hh:50
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, Communication< No_Comm >, OneDGridLevelGridViewTraits, OneDGridLeafGridViewTraits, OneDGridEntitySeed, OneDGridGeometry, unsigned int, std::array< GeometryType, 1 > > Traits
Definition onedgrid.hh:76
One-dimensional adaptive grid.
Definition onedgrid.hh:97
OneDGridGeometry< 0, 1, OneDGrid >::ctype ctype
The type used to store coordinates.
Definition onedgrid.hh:142
const Traits::LevelIndexSet & levelIndexSet(int level) const
Get an index set for the given level.
Definition onedgrid.hh:233
friend class OneDGridLeafIterator
Definition onedgrid.hh:120
bool preAdapt()
Does nothing except return true if some element has been marked for refinement.
const Traits::LocalIdSet & localIdSet() const
Get the set of local ids.
Definition onedgrid.hh:227
int size(GeometryType type) const
number of leaf entities per geometry type in this process
Definition onedgrid.hh:205
OneDGrid(const std::vector< ctype > &coords)
Constructor with an explicit set of coordinates.
void postAdapt()
Adaptation post-processing: Reset all adaptation state flags.
bool adapt()
Triggers the grid refinement process.
RefinementType
The different forms of grid refinement supported by OneDGrid.
Definition onedgrid.hh:282
@ COPY
New level consists of the refined elements and the unrefined ones, too.
Definition onedgrid.hh:286
@ LOCAL
New level consists only of the refined elements.
Definition onedgrid.hh:284
size_t numBoundarySegments() const
Return the number of coarse grid boundary segments.
Definition onedgrid.hh:215
OneDGridFamily::Traits Traits
Definition onedgrid.hh:148
void communicate(DataHandle &, InterfaceType, CommunicationDirection, int) const
Communicate data of level gridView.
Definition onedgrid.hh:311
bool mark(int refCount, const Traits::Codim< 0 >::Entity &e)
Mark entity for refinement.
void setRefinementType(RefinementType type)
Sets the type of grid refinement.
Definition onedgrid.hh:290
int size(int level, GeometryType type) const
number of entities per level and geometry type in this process
Definition onedgrid.hh:198
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition onedgrid.hh:177
friend class OneDGridLeafIndexSet< const OneDGrid >
Definition onedgrid.hh:116
OneDGrid(int numElements, const ctype &leftBoundary, const ctype &rightBoundary)
Constructor for a uniform grid.
friend class OneDGridEntity
Definition onedgrid.hh:108
const Traits::LeafIndexSet & leafIndexSet() const
Get an index set for the leaf level.
Definition onedgrid.hh:245
const Traits::GlobalIdSet & globalIdSet() const
Get the set of global ids.
Definition onedgrid.hh:221
static Traits::template Codim< Seed::codimension >::Entity entity(const Seed &seed)
Create an Entity from an EntitySeed.
Definition onedgrid.hh:168
void communicate(DataHandle &, InterfaceType, CommunicationDirection) const
Communicate data of leaf gridView.
Definition onedgrid.hh:319
int size(int codim) const
number of leaf entities per codim in this process
Definition onedgrid.hh:192
OneDGridFamily GridFamily
GridFamily of OneDGrid.
Definition onedgrid.hh:145
friend class OneDGridLevelIndexSet< const OneDGrid >
Definition onedgrid.hh:115
int maxLevel() const
Return maximum level defined in this grid.
Definition onedgrid.hh:163
int getMark(const Traits::Codim< 0 >::Entity &e) const
return current adaptation marker of given entity
const Communication & comm() const
Definition onedgrid.hh:303
friend class OneDGridLevelIterator
Definition onedgrid.hh:103
void globalRefine(int refCount)
Does one uniform refinement step.
friend class OneDGridIdSet< const OneDGrid >
Definition onedgrid.hh:117
A set of traits classes to store static information about grid implementation.
Provide a generic factory class for unstructured grids.
Different resources needed by all grid implementations.