3 #ifndef DUNE_ONE_D_GRID_HH 4 #define DUNE_ONE_D_GRID_HH 9 #include <dune/common/deprecated.hh> 10 #include <dune/common/parallel/collectivecommunication.hh> 11 #include <dune/common/tuples.hh> 17 #include <dune/geometry/genericgeometry/topologytypes.hh> 23 #include "onedgrid/onedgridlist.hh" 24 #include "onedgrid/nulliteratorfactory.hh" 25 #include "onedgrid/onedgridentity.hh" 26 #include "onedgrid/onedgridentitypointer.hh" 27 #include "onedgrid/onedgridentityseed.hh" 28 #include "onedgrid/onedgridgeometry.hh" 29 #include "onedgrid/onedgridintersections.hh" 30 #include "onedgrid/onedgridintersectioniterators.hh" 31 #include "onedgrid/onedgridleveliterator.hh" 32 #include "onedgrid/onedgridleafiterator.hh" 33 #include "onedgrid/onedgridhieriterator.hh" 34 #include "onedgrid/onedgridindexsets.hh" 40 template<
int dim,
int dimw>
46 OneDGridEntityPointer,
47 OneDGridLevelIterator,
48 OneDGridLeafIntersection,
49 OneDGridLevelIntersection,
50 OneDGridLeafIntersectionIterator,
51 OneDGridLevelIntersectionIterator,
52 OneDGridHierarchicIterator,
54 OneDGridLevelIndexSet<const OneDGrid>,
55 OneDGridLeafIndexSet<const OneDGrid>,
56 OneDGridIdSet<const OneDGrid>,
58 OneDGridIdSet<const OneDGrid>,
60 CollectiveCommunication<Dune::OneDGrid>,
90 template <
int,
class >
91 friend class OneDGridEntityPointer;
93 template <
int , PartitionIteratorType,
class >
94 friend class OneDGridLevelIterator;
96 friend class OneDGridHierarchicIterator<const
OneDGrid>;
98 template <
int codim_,
int dim_,
class Gr
idImp_>
99 friend class OneDGridEntity;
101 friend class OneDGridLeafIntersection<const
OneDGrid>;
102 friend class OneDGridLevelIntersection<const
OneDGrid>;
103 friend class OneDGridLeafIntersectionIterator<const
OneDGrid>;
104 friend class OneDGridLevelIntersectionIterator<const
OneDGrid>;
106 friend class OneDGridLevelIndexSet<const
OneDGrid>;
110 template <
int codim_, PartitionIteratorType PiType_,
class Gr
idImp_>
111 friend class OneDGridLeafIterator;
113 template <
class Gr
idType_>
116 template<
int codim_,
int dim_,
class Gr
idImp_,
template<
int,
int,
class>
class EntityImp_>
143 OneDGrid(
const std::vector<ctype>& coords);
146 OneDGrid(
int numElements,
const ctype& leftBoundary,
const ctype& rightBoundary);
155 int maxLevel()
const {
return entityImps_.size()-1;}
166 template<
int codim, PartitionIteratorType PiType>
170 template<
int codim, PartitionIteratorType PiType>
182 template<
int codim, PartitionIteratorType PiType>
186 template<
int codim, PartitionIteratorType PiType>
190 template <
typename Seed>
194 enum {codim = Seed::codimension};
199 template <
typename Seed>
203 const int codim = Seed::codimension;
210 int size (
int level,
int codim)
const {
211 if (codim<0 || codim>1)
212 DUNE_THROW(
GridError,
"There are no codim " << codim <<
" entities in a OneDGrid!");
215 return elements(level).size();
217 return vertices(level).size();
225 return leafIndexSet().size(codim);
232 return size(level,1-type.dim());
238 return leafIndexSet().size(type);
290 if (! levelIndexSets_[level]) {
291 levelIndexSets_[level] =
292 new OneDGridLevelIndexSet<const OneDGrid>(*
this, level);
293 levelIndexSets_[level]->update();
296 return * levelIndexSets_[level];
302 return leafIndexSet_;
346 refinementType_ = type;
354 void globalRefine(
int refCount);
358 template<
class DataHandle>
362 template<
class DataHandle>
366 const CollectiveCommunication &
comm ()
const 375 OneDGridList<OneDEntityImp<0> >& vertices(
int level) {
376 return Dune::get<0>(entityImps_[level]);
380 const OneDGridList<OneDEntityImp<0> >& vertices(
int level)
const {
381 return Dune::get<0>(entityImps_[level]);
385 OneDGridList<OneDEntityImp<1> >& elements(
int level) {
386 return Dune::get<1>(entityImps_[level]);
390 const OneDGridList<OneDEntityImp<1> >& elements(
int level)
const {
391 return Dune::get<1>(entityImps_[level]);
394 CollectiveCommunication ccobj;
399 unsigned int getNextFreeId(
int codim) {
400 return (codim==0) ? freeElementIdCounter_++ : freeVertexIdCounter_++;
406 OneDGridList<OneDEntityImp<0> >::iterator getLeftUpperVertex(
const OneDEntityImp<1>* eIt);
408 OneDGridList<OneDEntityImp<0> >::iterator getRightUpperVertex(
const OneDEntityImp<1>* eIt);
413 OneDGridList<OneDEntityImp<1> >::iterator getLeftNeighborWithSon(OneDGridList<OneDEntityImp<1> >::iterator eIt);
416 std::vector<tuple<OneDGridList<OneDEntityImp<0> >,
417 OneDGridList<OneDEntityImp<1> > > > entityImps_;
420 mutable std::vector<OneDGridLevelIndexSet<const OneDGrid>* > levelIndexSets_;
422 OneDGridLeafIndexSet<const OneDGrid> leafIndexSet_;
424 OneDGridIdSet<const OneDGrid> idSet_;
426 unsigned int freeVertexIdCounter_;
428 unsigned int freeElementIdCounter_;
433 bool reversedBoundarySegmentNumbering_;
437 namespace Capabilities
453 static const bool v =
true;
454 static const unsigned int topologyId = GenericGeometry :: CubeTopology< 1 > :: type :: id ;
464 static const bool v =
true;
472 #ifndef DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING 473 DUNE_DEPRECATED_MSG(
"Capabilities::isParallel will be removed after dune-grid-2.4.")
478 #ifndef DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING 479 DUNE_DEPRECATED_MSG(
"Capabilities::isParallel will be removed after dune-grid-2.4.")
490 static const bool v =
true;
499 static const bool v =
true;
511 #include <dune/grid/onedgrid/onedgridfactory.hh> 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:1305
Id Set Interface.
Definition: common/grid.hh:362
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir) const
Definition: onedgrid.hh:363
Specialize with 'true' if implementation guarantees conforming level grids. (default=false) ...
Definition: common/capabilities.hh:98
New level consists only of the refined elements.
Definition: onedgrid.hh:339
const CollectiveCommunication & comm() const
Definition: onedgrid.hh:366
int maxLevel() const
Return maximum level defined in this grid.
Definition: onedgrid.hh:155
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
const Traits::LevelIndexSet & levelIndexSet(int level) const
Get an index set for the given level.
Definition: onedgrid.hh:288
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: common/capabilities.hh:26
double ctype
The type used to store coordinates.
Definition: onedgrid.hh:134
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false) ...
Definition: common/capabilities.hh:107
int overlapSize(int codim) const
The processor overlap for parallel computing. Always zero because this is a strictly sequential grid...
Definition: onedgrid.hh:253
int size(GeometryType type) const
number of leaf entities per geometry type in this process
Definition: onedgrid.hh:236
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
static Traits::template Codim< Seed::codimension >::EntityPointer entityPointer(const Seed &seed)
Create an EntityPointer from an EntitySeed.
Definition: onedgrid.hh:192
Wrapper class for entities.
Definition: common/entity.hh:61
OneDGridFamily< dim, dimworld > GridFamily
GridFamily of OneDGrid.
Definition: onedgrid.hh:137
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:263
static Traits::template Codim< Seed::codimension >::Entity entity(const Seed &seed)
Create an Entity from an EntitySeed.
Definition: onedgrid.hh:201
size_t numBoundarySegments() const
Return the number of coarse grid boundary segments.
Definition: onedgrid.hh:246
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: onedgrid.hh:210
Definition: common/geometry.hh:24
const Traits::GlobalIdSet & globalIdSet() const
Get the set of global ids.
Definition: onedgrid.hh:276
Provide a generic factory class for unstructured grids.
RefinementType
The different forms of grid refinement supported by OneDGrid.
Definition: onedgrid.hh:337
GridTraits< dim, dimw, Dune::OneDGrid, OneDGridGeometry, OneDGridEntity, OneDGridEntityPointer, 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:64
Index Set Interface base class.
Definition: common/grid.hh:361
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: onedgrid.hh:359
Definition: defaultgridview.hh:223
int size(int level, GeometryType type) const
number of entities per level and geometry type in this process
Definition: onedgrid.hh:229
const Traits::LeafIndexSet & leafIndexSet() const
Get an index set for the leaf level.
Definition: onedgrid.hh:300
Traits associated with a specific codim.
Definition: common/grid.hh:1365
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:271
Definition: defaultgridview.hh:23
int ghostSize(int codim) const
The processor ghost overlap for parallel computing. Always zero because this is a strictly sequential...
Definition: onedgrid.hh:259
Types for GridView.
Definition: common/grid.hh:420
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
Include standard header files.
Definition: agrid.hh:59
One-dimensional adaptive grid.
Definition: onedgrid.hh:84
const Traits::LocalIdSet & localIdSet() const
Get the set of local ids.
Definition: onedgrid.hh:282
A set of traits classes to store static information about grid implementation.
Specialize with 'true' for all codims that a grid implements entities for. (default=false) ...
Definition: common/capabilities.hh:57
Different resources needed by all grid implementations.
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1343
OneDGridFamily< dim, dimworld >::Traits Traits
Definition: onedgrid.hh:140
void setRefinementType(RefinementType type)
Sets the type of grid refinement.
Definition: onedgrid.hh:345
int size(int codim) const
number of leaf entities per codim in this process
Definition: onedgrid.hh:223
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:265
OneDGrid is not parallel.
Definition: onedgrid.hh:471
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:437
Definition: onedgrid.hh:41