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 >
98 friend class OneDGridLevelIterator;
100 friend class OneDGridHierarchicIterator<const
OneDGrid>;
102 template <
int codim_,
int dim_,
class Gr
idImp_>
103 friend class OneDGridEntity;
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_>
115 friend class OneDGridLeafIterator;
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);
149 OneDGrid(
int numElements,
const ctype& leftBoundary,
const ctype& rightBoundary);
158 int maxLevel()
const {
return entityImps_.size()-1;}
161 template <
typename Seed>
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();
187 return leafIndexSet().size(codim);
194 return size(level,1-type.dim());
200 return leafIndexSet().size(type);
215 DUNE_DEPRECATED_MSG(
"overlapSize() is deprecated. Use the method on the LeafGridView instead.")
216 int overlapSize(
int codim)
const {
222 DUNE_DEPRECATED_MSG(
"ghostSize() is deprecated. Use the method on the LeafGridView instead.")
223 int ghostSize(
int codim)
const {
229 DUNE_DEPRECATED_MSG(
"overlapSize() is deprecated. Use the method on the LevelGridView instead.")
230 int overlapSize(
int level,
int codim)
const {
236 DUNE_DEPRECATED_MSG(
"ghostSize() is deprecated. Use the method on the LevelGridView instead.")
237 int ghostSize(
int level,
int codim)
const {
256 if (! levelIndexSets_[level]) {
257 levelIndexSets_[level] =
258 new OneDGridLevelIndexSet<const OneDGrid>(*
this, level);
259 levelIndexSets_[level]->update();
262 return * levelIndexSets_[level];
268 return leafIndexSet_;
312 refinementType_ = type;
320 void globalRefine(
int refCount);
324 template<
class DataHandle>
325 DUNE_DEPRECATED_MSG(
"communicate() is deprecated. Use the method on the LevelGridView instead.")
329 template<
class DataHandle>
330 DUNE_DEPRECATED_MSG(
"communicate() is deprecated. Use the method on the LeafGridView instead.")
334 const CollectiveCommunication &
comm ()
const 343 OneDGridList<OneDEntityImp<0> >& vertices(
int level) {
344 return std::get<0>(entityImps_[level]);
348 const OneDGridList<OneDEntityImp<0> >& vertices(
int level)
const {
349 return std::get<0>(entityImps_[level]);
353 OneDGridList<OneDEntityImp<1> >& elements(
int level) {
354 return std::get<1>(entityImps_[level]);
358 const OneDGridList<OneDEntityImp<1> >& elements(
int level)
const {
359 return std::get<1>(entityImps_[level]);
362 CollectiveCommunication ccobj;
367 unsigned int getNextFreeId(
int codim) {
368 return (codim==0) ? freeElementIdCounter_++ : freeVertexIdCounter_++;
374 OneDGridList<OneDEntityImp<0> >::iterator getLeftUpperVertex(
const OneDEntityImp<1>* eIt);
376 OneDGridList<OneDEntityImp<0> >::iterator getRightUpperVertex(
const OneDEntityImp<1>* eIt);
381 OneDGridList<OneDEntityImp<1> >::iterator getLeftNeighborWithSon(OneDGridList<OneDEntityImp<1> >::iterator eIt);
384 std::vector<std::tuple<OneDGridList<OneDEntityImp<0> >,
385 OneDGridList<OneDEntityImp<1> > > > entityImps_;
388 mutable std::vector<OneDGridLevelIndexSet<const OneDGrid>* > levelIndexSets_;
390 OneDGridLeafIndexSet<const OneDGrid> leafIndexSet_;
392 OneDGridIdSet<const OneDGrid> idSet_;
394 unsigned int freeVertexIdCounter_;
396 unsigned int freeElementIdCounter_;
401 bool reversedBoundarySegmentNumbering_;
405 namespace Capabilities
421 static const bool v =
true;
422 static const unsigned int topologyId = Impl::CubeTopology< 1 >::type::id;
432 static const bool v =
true;
441 static const bool v =
true;
450 static const bool v =
true;
462 #include <dune/grid/onedgrid/onedgridfactory.hh> A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1152
const Traits::LocalIdSet & localIdSet() const
Get the set of local ids.
Definition: onedgrid.hh:248
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: onedgrid.hh:172
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:263
const Traits::GlobalIdSet & globalIdSet() const
Get the set of global ids.
Definition: onedgrid.hh:242
const CollectiveCommunication & comm() const
Definition: onedgrid.hh:334
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
AxisAlignedCubeGeometry< double, mydim, coorddim > OneDGridGeometry
The type used to for OneDGrid geometries.
Definition: onedgrid.hh:45
OneDGridFamily::Traits Traits
Definition: onedgrid.hh:143
Definition: common/geometry.hh:24
const Traits::LeafIndexSet & leafIndexSet() const
Get an index set for the leaf level.
Definition: onedgrid.hh:266
Provide a generic factory class for unstructured grids.
int size(int codim) const
number of leaf entities per codim in this process
Definition: onedgrid.hh:185
OneDGridFamily GridFamily
GridFamily of OneDGrid.
Definition: onedgrid.hh:140
New level consists only of the refined elements.
Definition: onedgrid.hh:305
void setRefinementType(RefinementType type)
Sets the type of grid refinement.
Definition: onedgrid.hh:311
Definition: onedgrid.hh:47
int size(int level, GeometryType type) const
number of entities per level and geometry type in this process
Definition: onedgrid.hh:191
A set of traits classes to store static information about grid implementation.
int maxLevel() const
Return maximum level defined in this grid.
Definition: onedgrid.hh:158
static Traits::template Codim< Seed::codimension >::Entity entity(const Seed &seed)
Create an Entity from an EntitySeed.
Definition: onedgrid.hh:163
Include standard header files.
Definition: agrid.hh:59
Id Set Interface.
Definition: common/grid.hh:347
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:24
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:1115
const Traits::LevelIndexSet & levelIndexSet(int level) const
Get an index set for the given level.
Definition: onedgrid.hh:254
Wrapper class for entities.
Definition: common/entity.hh:64
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false) ...
Definition: common/capabilities.hh:86
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:414
Specialize with 'true' for all codims that a grid implements entities for. (default=false) ...
Definition: common/capabilities.hh:55
int size(GeometryType type) const
number of leaf entities per geometry type in this process
Definition: onedgrid.hh:198
Index Set Interface base class.
Definition: common/grid.hh:346
OneDGridGeometry< 0, 1, OneDGrid >::ctype ctype
The type used to store coordinates.
Definition: onedgrid.hh:137
One-dimensional adaptive grid.
Definition: onedgrid.hh:91
Traits associated with a specific codim.
Definition: common/grid.hh:1174
Different resources needed by all grid implementations.
Specialize with 'true' if implementation guarantees conforming level grids. (default=false) ...
Definition: common/capabilities.hh:77
RefinementType
The different forms of grid refinement supported by OneDGrid.
Definition: onedgrid.hh:303
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
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
size_t numBoundarySegments() const
Return the number of coarse grid boundary segments.
Definition: onedgrid.hh:208