1#ifndef DUNE_FEM_GRIDPART_GEOGRIDPART_HH
2#define DUNE_FEM_GRIDPART_GEOGRIDPART_HH
6#include <dune/grid/common/gridview.hh>
8#include <dune/fem/gridpart/common/deaditerator.hh>
9#include <dune/fem/gridpart/common/entitysearch.hh>
10#include <dune/fem/gridpart/common/extendedentity.hh>
11#include <dune/fem/gridpart/common/gridpart.hh>
12#include <dune/fem/gridpart/common/metatwistutility.hh>
13#include <dune/fem/gridpart/geogridpart/capabilities.hh>
14#include <dune/fem/gridpart/geogridpart/datahandle.hh>
15#include <dune/fem/gridpart/geogridpart/entity.hh>
16#include <dune/fem/gridpart/geogridpart/geometry.hh>
17#include <dune/fem/gridpart/geogridpart/intersection.hh>
18#include <dune/fem/gridpart/geogridpart/intersectioniterator.hh>
19#include <dune/fem/gridpart/idgridpart/indexset.hh>
20#include <dune/fem/gridpart/idgridpart/iterator.hh>
31 template<
class CoordFunction >
34 template<
class CoordFunction >
35 struct GeoGridPartFamily;
42 template<
class CoordFunction >
43 struct GeoGridPartData
45 typedef CoordFunction CoordFunctionType;
47 GeoGridPartData () =
default;
48 GeoGridPartData (
const CoordFunctionType &coordFunction ) : coordFunction_( &coordFunction ) {}
50 operator const CoordFunctionType & ()
const { assert( coordFunction_ );
return *coordFunction_; }
53 const CoordFunctionType *coordFunction_ =
nullptr;
62 template<
class CoordFunction >
63 struct GeoGridPartFamily
65 typedef typename CoordFunction::RangeFieldType ctype;
67 static const int dimension = CoordFunction::GridPartType::dimension;
68 static const int dimensionworld = CoordFunction::FunctionSpaceType::dimRange;
70 typedef GeoGridPartFamily< CoordFunction > GridPartFamily;
74 typedef GeoGridPartData< CoordFunction > ExtraData;
75 typedef CoordFunction CoordFunctionType;
77 typedef typename CoordFunctionType::GridPartType HostGridPartType;
82 typedef Dune::Geometry< dimension - codim, dimensionworld,
const GridPartFamily, GeoGeometry > Geometry;
83 typedef typename HostGridPartType::template Codim< codim >::LocalGeometryType LocalGeometry;
86 typedef typename HostGridPartType::GridType::template Codim< codim >::EntitySeed EntitySeed;
89 typedef DeadIntersection< const GridPartFamily > IntersectionImplType;
90 typedef DeadIntersectionIterator< const GridPartFamily > IntersectionIteratorImplType;
101 template<
int codim >
103 :
public Traits::template Codim< codim >
106 typedef typename Traits::LeafIntersectionIterator LeafIntersectionIterator;
107 typedef typename Traits::LevelIntersectionIterator LevelIntersectionIterator;
109 typedef typename Traits::HierarchicIterator HierarchicIterator;
114 template<
class CoordFunction >
115 struct GeoGridPartTraits
117 typedef GeoGridPart< CoordFunction > GridPartType;
118 typedef GeoGridPartFamily< CoordFunction > GridPartFamily;
119 typedef GeoGridPartFamily< CoordFunction > GridFamily;
121 typedef typename GridPartFamily::Traits::HostGridPartType HostGridPartType;
123 typedef typename HostGridPartType::GridType GridType;
126 typedef MetaTwistUtility< typename HostGridPartType :: TwistUtilityType > TwistUtilityType;
128 typedef IdIndexSet< const GridPartFamily > IndexSetType;
131 static const InterfaceType indexSetInterfaceType = HostGridPartType::indexSetInterfaceType;
133 typedef GeoIntersection< const GridPartFamily > IntersectionImplType;
134 typedef GeoIntersectionIterator< const GridPartFamily > IntersectionIteratorImplType;
136 typedef IntersectionIterator< const GridPartFamily, IntersectionIteratorImplType, IntersectionImplType > IntersectionIteratorType;
138 template<
int codim >
141 typedef typename GridPartFamily::Traits::template Codim< codim >::Geometry
GeometryType;
142 typedef typename GridPartFamily::Traits::template Codim< codim >::LocalGeometry LocalGeometryType;
144 typedef typename GridPartFamily::Traits::template Codim< codim >::Entity EntityType;
146 typedef typename GridPartFamily::Traits::template Codim< codim >::EntitySeed EntitySeedType;
148 template< PartitionIteratorType pitype >
151 typedef EntityIterator< codim, const GridPartFamily, IdIterator< codim, pitype, const GridPartFamily > > IteratorType;
155 typedef typename HostGridPartType::CommunicationType CommunicationType;
157 static const bool conforming = HostGridPartType::Traits::conforming;
165 template<
class CoordFunction >
167 :
public GridPartDefault< GeoGridPartTraits< CoordFunction > >
169 typedef GeoGridPart< CoordFunction > ThisType;
170 typedef GridPartDefault< GeoGridPartTraits< CoordFunction > > BaseType;
172 typedef typename GeoGridPartTraits< CoordFunction >::GridPartFamily GridPartFamily;
175 typedef typename GridPartFamily::Traits::HostGridPartType HostGridPartType;
177 typedef CoordFunction CoordFunctionType;
185 template<
int codim >
187 :
public BaseType::template Codim< codim >
190 explicit GeoGridPart (
const CoordFunctionType &coordFunction )
191 : BaseType( const_cast< GridType& > (coordFunction.gridPart().
grid() ) ),
192 coordFunction_( &coordFunction ),
193 indexSet_( hostGridPart().indexSet() )
196 const IndexSetType &indexSet ()
const
201 template<
int codim >
202 typename Codim< codim >::IteratorType
205 return begin< codim, InteriorBorder_Partition >();
208 template<
int codim, PartitionIteratorType pitype >
209 typename Codim< codim >::template Partition< pitype >::IteratorType
212 return IdIterator< codim, pitype, const GridPartFamily >( coordFunction(), hostGridPart().
template begin< codim, pitype >() );
215 template<
int codim >
216 typename Codim< codim >::IteratorType
219 return end< codim, InteriorBorder_Partition >();
222 template<
int codim, PartitionIteratorType pitype >
223 typename Codim< codim >::template Partition< pitype >::IteratorType
226 return IdIterator< codim, pitype, const GridPartFamily >( coordFunction(), hostGridPart().
template end< codim, pitype >() );
231 return hostGridPart().level();
234 IntersectionIteratorType ibegin (
const typename Codim< 0 >::EntityType &entity )
const
236 return GeoIntersectionIterator< const GridPartFamily >( entity, hostGridPart().ibegin( entity.impl().hostEntity() ) );
239 IntersectionIteratorType iend (
const typename Codim< 0 >::EntityType &entity )
const
241 return GeoIntersectionIterator< const GridPartFamily >( entity, hostGridPart().iend( entity.impl().hostEntity() ) );
244 template<
class DataHandle,
class Data >
245 void communicate ( CommDataHandleIF< DataHandle, Data > &handle,
248 typedef CommDataHandleIF< DataHandle, Data > HostHandleType;
249 GeoDataHandle< GridPartFamily, HostHandleType > handleWrapper( coordFunction(), handle );
250 hostGridPart().communicate( handleWrapper, iftype, dir );
253 template<
class LocalFunction >
254 typename Codim< 0 >::EntityType
255 exchangeGeometry (
const typename Codim< 0 >::EntityType &entity,
256 const LocalFunction &localCoordFunction )
const
258 return typename Codim< 0 >::EntityType::Implementation( entity.impl(), localCoordFunction );
261 template <
class EntitySeed >
262 typename Codim< EntitySeed::codimension >::EntityType
263 entity (
const EntitySeed &seed )
const
265 return typename Codim< EntitySeed::codimension >::EntityType
266 ::Implementation( coordFunction(), hostGridPart().entity( seed ) );
270 template<
class Entity >
271 MakeableInterfaceObject< typename Codim< Entity::codimension >::EntityType >
272 convert (
const Entity &entity )
const
275 const auto& gridEntity = Fem::gridEntity( entity );
278 typedef typename Codim< Entity::codimension >::EntityType EntityType;
279 typedef typename EntityType::Implementation Implementation;
280 typedef MakeableInterfaceObject< EntityType > EntityObj;
283 return EntityObj( Implementation( coordFunction(), hostGridPart().convert( gridEntity ) ) );
287 const CoordFunctionType &coordFunction ()
const
289 assert( coordFunction_);
290 return *coordFunction_;
294 const HostGridPartType &hostGridPart ()
const
296 return coordFunction().gridPart();
300 HostGridPartType &hostGridPart ()
302 return const_cast< HostGridPartType &
>( coordFunction().gridPart() );
306 const CoordFunctionType *coordFunction_;
307 IndexSetType indexSet_;
315 template<
int codim,
int dim,
class Gr
idFamily >
316 struct GridEntityAccess<
Dune::ExtendedEntity< codim, dim, GridFamily, GeoEntity > >
319 typedef GridEntityAccess< typename EntityType::Implementation::HostEntityType > HostAccessType;
320 typedef typename HostAccessType::GridEntityType GridEntityType;
322 static const GridEntityType &gridEntity (
const EntityType &entity )
324 return HostAccessType::gridEntity( entity.impl().hostEntity() );
333 template<
class CoordFunction,
int codim, PartitionIteratorType partition >
334 class EntitySearch< GeoGridPart< CoordFunction >, codim, partition >
335 :
public DefaultEntitySearch< GeoGridPart< CoordFunction >, codim, partition >
337 typedef EntitySearch< GeoGridPart< CoordFunction >, codim, partition > ThisType;
338 typedef DefaultEntitySearch< GeoGridPart< CoordFunction >, codim, partition > BaseType;
341 typedef typename BaseType::GridPartType GridPartType;
343 explicit EntitySearch (
const GridPartType &gridPart )
344 : BaseType( gridPart )
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