Go to the documentation of this file.
3 #ifndef DUNE_ONE_D_GRID_HH
4 #define DUNE_ONE_D_GRID_HH
9 #include <dune/common/parallel/collectivecommunication.hh>
10 #include <dune/common/tuples.hh>
16 #include <dune/geometry/genericgeometry/topologytypes.hh>
17 #include <dune/geometry/axisalignedcubegeometry.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/onedgridleveliterator.hh"
30 #include "onedgrid/onedgridleafiterator.hh"
31 #include "onedgrid/onedgridhieriterator.hh"
32 #include "onedgrid/onedgridindexsets.hh"
43 template <
int mydim,
int coorddim,
class Gr
idImp>
53 OneDGridLevelIterator,
54 OneDGridLeafIntersection,
55 OneDGridLevelIntersection,
56 OneDGridLeafIntersectionIterator,
57 OneDGridLevelIntersectionIterator,
58 OneDGridHierarchicIterator,
60 OneDGridLevelIndexSet<const OneDGrid>,
61 OneDGridLeafIndexSet<const OneDGrid>,
62 OneDGridIdSet<const OneDGrid>,
64 OneDGridIdSet<const OneDGrid>,
66 CollectiveCommunication<Dune::OneDGrid>,
96 template <
int , PartitionIteratorType,
class >
99 friend class OneDGridHierarchicIterator<const
OneDGrid>;
101 template <
int codim_,
int dim_,
class Gr
idImp_>
104 friend class OneDGridLeafIntersection<const
OneDGrid>;
105 friend class OneDGridLevelIntersection<const
OneDGrid>;
106 friend class OneDGridLeafIntersectionIterator<const
OneDGrid>;
107 friend class OneDGridLevelIntersectionIterator<const
OneDGrid>;
109 friend class OneDGridLevelIndexSet<const
OneDGrid>;
113 template <
int codim_, PartitionIteratorType PiType_,
class Gr
idImp_>
116 template <
class Gr
idType_>
119 template<
int codim_,
int dim_,
class Gr
idImp_,
template<
int,
int,
class>
class EntityImp_>
142 OneDGrid(
const std::vector<ctype>& coords);
154 int maxLevel()
const {
return entityImps_.size()-1;}
165 template<
int codim, PartitionIteratorType PiType>
166 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lbegin (
int level)
const;
169 template<
int codim, PartitionIteratorType PiType>
170 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lend (
int level)
const;
181 template<
int codim, PartitionIteratorType PiType>
182 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafbegin()
const;
185 template<
int codim, PartitionIteratorType PiType>
186 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafend()
const;
189 template <
typename Seed>
193 const int codim = Seed::codimension;
200 int size (
int level,
int codim)
const {
201 if (codim<0 || codim>1)
202 DUNE_THROW(
GridError,
"There are no codim " << codim <<
" entities in a OneDGrid!");
205 return elements(level).size();
207 return vertices(level).size();
222 return size(level,1-type.dim());
280 if (! levelIndexSets_[level]) {
281 levelIndexSets_[level] =
283 levelIndexSets_[level]->update();
286 return * levelIndexSets_[level];
292 return leafIndexSet_;
336 refinementType_ = type;
348 template<
class DataHandle>
352 template<
class DataHandle>
365 OneDGridList<OneDEntityImp<0> >& vertices(
int level) {
366 return std::get<0>(entityImps_[level]);
370 const OneDGridList<OneDEntityImp<0> >& vertices(
int level)
const {
371 return std::get<0>(entityImps_[level]);
375 OneDGridList<OneDEntityImp<1> >& elements(
int level) {
376 return std::get<1>(entityImps_[level]);
380 const OneDGridList<OneDEntityImp<1> >& elements(
int level)
const {
381 return std::get<1>(entityImps_[level]);
389 unsigned int getNextFreeId(
int codim) {
390 return (codim==0) ? freeElementIdCounter_++ : freeVertexIdCounter_++;
396 OneDGridList<OneDEntityImp<0> >::iterator getLeftUpperVertex(
const OneDEntityImp<1>* eIt);
398 OneDGridList<OneDEntityImp<0> >::iterator getRightUpperVertex(
const OneDEntityImp<1>* eIt);
403 OneDGridList<OneDEntityImp<1> >::iterator getLeftNeighborWithSon(OneDGridList<OneDEntityImp<1> >::iterator eIt);
406 std::vector<tuple<OneDGridList<OneDEntityImp<0> >,
407 OneDGridList<OneDEntityImp<1> > > > entityImps_;
410 mutable std::vector<OneDGridLevelIndexSet<const OneDGrid>* > levelIndexSets_;
416 unsigned int freeVertexIdCounter_;
418 unsigned int freeElementIdCounter_;
423 bool reversedBoundarySegmentNumbering_;
427 namespace Capabilities
443 static const bool v =
true;
444 static const unsigned int topologyId = GenericGeometry :: CubeTopology< 1 > :: type :: id ;
454 static const bool v =
true;
463 static const bool v =
true;
472 static const bool v =
true;
484 #include <dune/grid/onedgrid/onedgridfactory.hh>
static const unsigned int topologyId
Definition: common/capabilities.hh:29
Different resources needed by all grid implementations.
Provide a generic factory class for unstructured grids.
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:263
friend class OneDGridLeafIndexSet< const OneDGrid >
Definition: onedgrid.hh:110
void setRefinementType(RefinementType type)
Sets the type of grid refinement.
Definition: onedgrid.hh:335
Include standard header files.
Definition: agrid.hh:59
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
const CollectiveCommunication & comm() const
Definition: onedgrid.hh:356
void globalRefine(int refCount)
Does one uniform refinement step.
GridFamily::Traits::CollectiveCommunication CollectiveCommunication
A type that is a model of Dune::CollectiveCommunication. It provides a portable way for collective co...
Definition: common/grid.hh:519
friend class OneDGridIdSet< const OneDGrid >
Definition: onedgrid.hh:111
OneDGridGeometry< 0, 1, OneDGrid >::ctype ctype
The type used to store coordinates.
Definition: onedgrid.hh:133
int size(int codim) const
number of leaf entities per codim in this process
Definition: onedgrid.hh:213
int ghostSize(int level, int codim) const
The processor ghost overlap for parallel computing. Always zero because this is a strictly sequential...
Definition: onedgrid.hh:261
void postAdapt()
Adaptation post-processing: Reset all adaptation state flags.
OneDGridFamily::Traits Traits
Definition: onedgrid.hh:139
New level consists only of the refined elements.
Definition: onedgrid.hh:329
int size(int level, GeometryType type) const
number of entities per level and geometry type in this process
Definition: onedgrid.hh:219
GridFamily::Traits::template Codim< cd >::LeafIterator LeafIterator
A type that is a model of Dune::LeafIterator with partition type All_Partition.
Definition: common/grid.hh:454
bool preAdapt()
Does nothing except return true if some element has been marked for refinement.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: onedgrid.hh:200
Wrapper class for entities.
Definition: common/entity.hh:61
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:86
const Traits::GlobalIdSet & globalIdSet() const
Get the set of global ids.
Definition: onedgrid.hh:266
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:55
Definition: onedgrid.hh:46
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir) const
Definition: onedgrid.hh:353
int ghostSize(int codim) const
The processor ghost overlap for parallel computing. Always zero because this is a strictly sequential...
Definition: onedgrid.hh:249
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:522
OneDGridFamily GridFamily
GridFamily of OneDGrid.
Definition: onedgrid.hh:136
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1156
friend class OneDGridEntity
Definition: onedgrid.hh:102
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
static const bool v
Definition: common/capabilities.hh:88
friend class OneDGridLevelIterator
Definition: onedgrid.hh:97
int maxLevel() const
Return maximum level defined in this grid.
Definition: onedgrid.hh:154
One-dimensional adaptive grid.
Definition: onedgrid.hh:90
Id Set Interface.
Definition: common/grid.hh:347
int size(GeometryType type) const
number of leaf entities per geometry type in this process
Definition: onedgrid.hh:226
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:24
bool adapt()
Triggers the grid refinement process.
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:77
static const bool v
Definition: common/capabilities.hh:26
Definition: defaultgridview.hh:221
GridFamily::Traits::template Codim< cd >::LevelIterator LevelIterator
A type that is a model of Dune::LevelIterator with partition type All_Partition.
Definition: common/grid.hh:450
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:215
A set of traits classes to store static information about grid implementation.
friend class OneDGridLeafIterator
Definition: onedgrid.hh:114
const Traits::LeafIndexSet & leafIndexSet() const
Get an index set for the leaf level.
Definition: onedgrid.hh:290
size_t numBoundarySegments() const
Return the number of coarse grid boundary segments.
Definition: onedgrid.hh:236
Definition: common/geometry.hh:24
Index Set Interface base class.
Definition: common/grid.hh:346
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first entity of given codim on leaf level.
New level consists of the refined elements and the unrefined ones, too.
Definition: onedgrid.hh:331
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:1119
static const bool v
Definition: common/capabilities.hh:57
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
GridFamily::Traits::template Codim< cd >::Entity Entity
A type that is a model of a Dune::Entity<cd,dim,...>.
Definition: common/grid.hh:423
RefinementType
The different forms of grid refinement supported by OneDGrid.
Definition: onedgrid.hh:327
bool mark(int refCount, const Traits::Codim< 0 >::Entity &e)
Mark entity for refinement.
static const bool v
Definition: common/capabilities.hh:79
friend class OneDGridLevelIndexSet< const OneDGrid >
Definition: onedgrid.hh:109
Definition: defaultgridview.hh:23
AxisAlignedCubeGeometry< double, mydim, coorddim > OneDGridGeometry
The type used to for OneDGrid geometries.
Definition: onedgrid.hh:44
Dune::Entity< cd, dim, const GridImp, EntityImp > Entity
The type of the entity.
Definition: common/grid.hh:1190
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 >, DefaultLevelGridViewTraits, DefaultLeafGridViewTraits, OneDGridEntitySeed > Traits
Definition: onedgrid.hh:70
int getMark(const Traits::Codim< 0 >::Entity &e) const
return current adaptation marker of given entity
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end on leaf level
const Traits::LevelIndexSet & levelIndexSet(int level) const
Get an index set for the given level.
Definition: onedgrid.hh:278
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
int overlapSize(int level, int codim) const
The processor overlap for parallel computing. Always zero because this is a strictly sequential grid.
Definition: onedgrid.hh:255
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: onedgrid.hh:349
static Traits::template Codim< Seed::codimension >::Entity entity(const Seed &seed)
Create an Entity from an EntitySeed.
Definition: onedgrid.hh:191
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
int overlapSize(int codim) const
The processor overlap for parallel computing. Always zero because this is a strictly sequential grid.
Definition: onedgrid.hh:243
const Traits::LocalIdSet & localIdSet() const
Get the set of local ids.
Definition: onedgrid.hh:272