1#ifndef DUNE_FEM_GRIDPART_IDGRIDPART_HH
2#define DUNE_FEM_GRIDPART_IDGRIDPART_HH
4#include <dune/grid/common/gridview.hh>
6#include <dune/fem/gridpart/common/deaditerator.hh>
7#include <dune/fem/gridpart/common/entitysearch.hh>
8#include <dune/fem/gridpart/common/extendedentity.hh>
9#include <dune/fem/gridpart/common/gridpart.hh>
10#include <dune/fem/gridpart/common/metatwistutility.hh>
11#include <dune/fem/gridpart/idgridpart/capabilities.hh>
12#include <dune/fem/gridpart/idgridpart/datahandle.hh>
13#include <dune/fem/gridpart/idgridpart/entity.hh>
14#include <dune/fem/gridpart/idgridpart/geometry.hh>
15#include <dune/fem/gridpart/idgridpart/indexset.hh>
16#include <dune/fem/gridpart/idgridpart/intersection.hh>
17#include <dune/fem/gridpart/idgridpart/intersectioniterator.hh>
18#include <dune/fem/gridpart/idgridpart/iterator.hh>
29 template<
class HostGr
idPartImp >
36 template<
class HostGr
idPartImp >
37 struct IdGridPartTraits
39 typedef IdGridPart< HostGridPartImp > GridPartType;
42 typedef MetaTwistUtility< typename HostGridPartImp :: TwistUtilityType > TwistUtilityType;
47 typedef typename HostGridPartImp::ctype ctype;
49 static const int dimension = HostGridPartImp::dimension;
50 static const int dimensionworld = HostGridPartImp::dimensionworld;
54 typedef HostGridPartImp HostGridPartType;
60 typedef EmptyData ExtraData;
65 typedef Dune::Geometry< dimension - codim, dimensionworld,
const GridFamily, IdGeometry > Geometry;
66 typedef Dune::Geometry< dimension - codim, dimension,
const GridFamily, IdLocalGeometry > LocalGeometry;
69 typedef typename HostGridPartType::GridType::template Codim< codim >::EntitySeed EntitySeed;
72 typedef DeadIntersection< const GridFamily > IntersectionImplType;
73 typedef DeadIntersectionIterator< const GridFamily > IntersectionIteratorImplType;
86 :
public Traits::template Codim< codim >
89 typedef typename Traits::LeafIntersectionIterator LeafIntersectionIterator;
90 typedef typename Traits::LevelIntersectionIterator LevelIntersectionIterator;
92 typedef typename Traits::HierarchicIterator HierarchicIterator;
94 typedef typename GridFamily::Traits::HostGridPartType HostGridPartType;
96 typedef typename HostGridPartType::GridType GridType;
98 typedef IdIndexSet< const GridFamily > IndexSetType;
101 static const InterfaceType indexSetInterfaceType = HostGridPartType::indexSetInterfaceType;
103 typedef IdIntersectionIterator < const GridFamily > IntersectionIteratorImplType;
104 typedef IdIntersection< const GridFamily > IntersectionImplType;
105 typedef IntersectionIterator< const GridFamily, IntersectionIteratorImplType, IntersectionImplType > IntersectionIteratorType;
107 template<
int codim >
110 typedef typename GridFamily::Traits::template Codim< codim >::Geometry
GeometryType;
111 typedef typename GridFamily::Traits::template Codim< codim >::LocalGeometry LocalGeometryType;
113 typedef typename GridFamily::Traits::template Codim< codim >::Entity EntityType;
114 typedef typename GridFamily::Traits::template Codim< codim >::EntitySeed EntitySeedType;
116 template< PartitionIteratorType pitype >
119 typedef EntityIterator< codim, const GridFamily, IdIterator< codim, pitype, const GridFamily > > IteratorType;
123 typedef typename HostGridPartType::CommunicationType CommunicationType;
125 static const bool conforming = HostGridPartType::Traits::conforming;
133 template<
class HostGr
idPartImp >
135 :
public GridPartDefault< IdGridPartTraits< HostGridPartImp > >
137 typedef IdGridPart< HostGridPartImp > ThisType;
138 typedef GridPartDefault< IdGridPartTraits< HostGridPartImp > > BaseType;
140 typedef typename IdGridPartTraits< HostGridPartImp >::GridFamily GridFamily;
143 typedef typename GridFamily::Traits::HostGridPartType HostGridPartType;
151 template<
int codim >
153 :
public BaseType::template Codim< codim >
156 explicit IdGridPart ( GridType &grid )
158 hostGridPart_( grid ),
159 indexSet_( hostGridPart_.indexSet() )
162 explicit IdGridPart (
const IdGridPart &other )
164 hostGridPart_( other.hostGridPart() ),
165 indexSet_( hostGridPart_.indexSet() )
168 IdGridPart& operator= (
const IdGridPart& other ) =
default;
170 explicit IdGridPart (
const HostGridPartType &hostGridPart )
171 : BaseType( const_cast< GridType& > ( hostGridPart.
grid() ) ),
172 hostGridPart_( hostGridPart ),
173 indexSet_( hostGridPart_.indexSet() )
176 const IndexSetType &indexSet ()
const
181 template<
int codim >
182 typename Codim< codim >::IteratorType
185 return begin< codim, InteriorBorder_Partition >();
188 template<
int codim, PartitionIteratorType pitype >
189 typename Codim< codim >::template Partition< pitype >::IteratorType
192 return IdIterator< codim, pitype, const GridFamily >( data(), hostGridPart().
template begin< codim, pitype >() );
195 template<
int codim >
196 typename Codim< codim >::IteratorType
199 return end< codim, InteriorBorder_Partition >();
202 template<
int codim, PartitionIteratorType pitype >
203 typename Codim< codim >::template Partition< pitype >::IteratorType
206 return IdIterator< codim, pitype, const GridFamily >( data(), hostGridPart().
template end< codim, pitype >() );
211 return hostGridPart().level();
214 IntersectionIteratorType ibegin (
const typename Codim< 0 >::EntityType &entity )
const
216 return IdIntersectionIterator< const GridFamily >( data(), hostGridPart().ibegin( entity.impl().hostEntity() ) );
219 IntersectionIteratorType iend (
const typename Codim< 0 >::EntityType &entity )
const
221 return IdIntersectionIterator< const GridFamily >( data(), hostGridPart().iend( entity.impl().hostEntity() ) );
224 template<
class DataHandle,
class Data >
225 void communicate ( CommDataHandleIF< DataHandle, Data > &handle,
228 typedef CommDataHandleIF< DataHandle, Data > HostHandleType;
229 IdDataHandle< HostHandleType, GridFamily > handleWrapper( data(), handle );
230 hostGridPart().communicate( handleWrapper, iftype, dir );
233 template <
class EntitySeed >
234 typename Codim< EntitySeed::codimension >::EntityType
235 entity (
const EntitySeed &seed )
const
237 typedef typename Codim< EntitySeed::codimension >::EntityType::Implementation EntityImp;
238 return EntityImp( data(), hostGridPart().entity( seed ) );
242 template<
class Entity >
243 MakeableInterfaceObject< typename Codim< Entity::codimension >::EntityType >
244 convert (
const Entity &entity )
const
247 const auto& gridEntity = Fem::gridEntity( entity );
250 typedef typename Codim< Entity::codimension >::EntityType EntityType;
251 typedef typename EntityType::Implementation Implementation;
252 typedef MakeableInterfaceObject< EntityType > EntityObj;
254 return EntityObj( Implementation( data(), hostGridPart().convert( gridEntity ) ) );
257 const HostGridPartType &hostGridPart ()
const {
return hostGridPart_; }
259 HostGridPartType &hostGridPart () {
return hostGridPart_; }
261 typedef typename GridFamily::Traits::ExtraData ExtraData;
262 ExtraData data ()
const {
return ExtraData(); }
265 HostGridPartType hostGridPart_;
266 IndexSetType indexSet_;
274 template<
int codim,
int dim,
class Gr
idFamily >
275 struct GridEntityAccess<
Dune::ExtendedEntity< codim, dim, GridFamily, IdEntity > >
278 typedef GridEntityAccess< typename EntityType::Implementation::HostEntityType > HostAccessType;
279 typedef typename HostAccessType::GridEntityType GridEntityType;
281 static const GridEntityType &gridEntity (
const EntityType &entity )
283 return HostAccessType::gridEntity( entity.impl().hostEntity() );
292 template<
class HostGr
idPart,
int codim, PartitionIteratorType partition >
293 class EntitySearch< IdGridPart< HostGridPart >, codim, partition >
295 typedef EntitySearch< IdGridPart< HostGridPart >, codim, partition > ThisType;
298 typedef IdGridPart< HostGridPart > GridPartType;
299 typedef typename GridPartType::ExtraData ExtraData;
301 typedef typename GridPartType::template Codim< codim >::EntityType EntityType;
303 typedef typename EntityType::Geometry::GlobalCoordinate GlobalCoordinateType;
305 explicit EntitySearch (
const GridPartType &gridPart )
306 : hostEntitySearch_( gridPart.hostGridPart() ),
307 data_( gridPart.data() )
310 EntityType operator() (
const GlobalCoordinateType &x )
const
312 typedef typename EntityType::Implementation EntityImpl;
313 return EntityImpl( data_, hostEntitySearch_( x ) );
317 const EntitySearch< HostGridPart > hostEntitySearch_;
interface class for an iterator over grid entities
Definition: entityiterator.hh:32
Wrapper class for wrapped entities added a cast operator to the host entity.
Definition: extendedentity.hh:23
IntersectionIteratorType::Intersection IntersectionType
type of intersection
Definition: gridpart.hh:388
Traits::CommunicationType CommunicationType
Collective communication.
Definition: gridpart.hh:391
const GridType & grid() const
Returns const reference to the underlying grid.
Definition: gridpart.hh:423
Traits::IndexSetType IndexSetType
Index set implementation.
Definition: gridpart.hh:382
Traits::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition: gridpart.hh:385
Traits::GridType GridType
Grid implementation.
Definition: gridpart.hh:380
void communicate(CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir) const
corresponding communication method for grid part
Definition: gridpart.hh:292
Wrapper class for geometries.
Definition: geometry.hh:71
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: intersectioniterator.hh:83
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:164
@ conforming
Output conforming data.
Definition: common.hh:73
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Dune namespace.
Definition: alignedallocator.hh:13