1 #ifndef DUNE_FEM_SPACE_RANNACHERTUREK_HH 2 #define DUNE_FEM_SPACE_RANNACHERTUREK_HH 7 #if HAVE_DUNE_LOCALFUNCTIONS 14 #include <dune/common/deprecated.hh> 17 #include <dune/geometry/type.hh> 20 #include <dune/localfunctions/rannacherturek.hh> 56 template<
class FunctionSpace,
class Gr
idPart,
template<
class >
class Storage >
57 struct RannacherTurekDiscreteFunctionSpaceTraits
60 "GridPart has more than one geometry type." );
62 typedef RannacherTurekDiscreteFunctionSpace< FunctionSpace, GridPart, Storage > DiscreteFunctionSpaceType;
64 typedef FunctionSpace FunctionSpaceType;
65 typedef GridPart GridPartType;
67 static const int codimension = 0;
70 typedef typename GridPartType::template Codim< codimension >::EntityType EntityType;
72 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
73 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
74 static const int dimLocal = GridPartType::dimension;
77 typedef Dune::RannacherTurekLocalFiniteElement< DomainFieldType, RangeFieldType, dimLocal > LocalFiniteElementType;
78 typedef typename LocalFiniteElementType::Traits::LocalBasisType LocalBasisType;
79 typedef typename LocalFiniteElementType::Traits::LocalCoefficientsType LocalCoefficientsType;
80 typedef typename LocalFiniteElementType::Traits::LocalInterpolationType LocalInterpolationType;
82 typedef RannacherTurekBlockMapperFactory< GridPartType, LocalCoefficientsType > BlockMapperFactoryType;
83 typedef typename BlockMapperFactoryType::BlockMapperType BlockMapperType;
85 static const int localBlockSize = FunctionSpaceType::dimRange;
87 typedef LocalFunctionsShapeFunctionSet< LocalBasisType > LocalFunctionsShapeFunctionSetType;
88 typedef SelectCachingShapeFunctionSet< LocalFunctionsShapeFunctionSetType, Storage > ScalarShapeFunctionSetType;
90 struct ScalarShapeFunctionSetFactory
92 static ScalarShapeFunctionSetType *createObject (
const GeometryType &type )
94 assert( type.isCube() );
95 return new ScalarShapeFunctionSetType( type, LocalFunctionsShapeFunctionSetType( LocalBasisType() ) );
98 static void deleteObject ( ScalarShapeFunctionSetType *
object ) {
delete object; }
101 typedef ScalarShapeFunctionSetFactory ScalarShapeFunctionSetFactoryType;
103 typedef ShapeFunctionSetProxy< ScalarShapeFunctionSetType > ScalarShapeFunctionSetProxyType;
104 typedef VectorialShapeFunctionSet< ScalarShapeFunctionSetProxyType, typename FunctionSpaceType::RangeType > ShapeFunctionSetType;
106 typedef DefaultBasisFunctionSet< EntityType, ShapeFunctionSetType > BasisFunctionSetType;
108 template<
class DiscreteFunction,
class Operation = DFCommunicationOperation::Add >
109 struct CommDataHandle
111 typedef DefaultCommunicationHandler< DiscreteFunction, Operation > Type;
112 typedef Operation OperationType;
130 template<
class FunctionSpace,
class Gr
idPart,
template<
class >
class Storage = CachingStorage >
131 struct RannacherTurekDiscreteFunctionSpace
132 :
public DiscreteFunctionSpaceDefault< RannacherTurekDiscreteFunctionSpaceTraits< FunctionSpace, GridPart, Storage > >
134 typedef RannacherTurekDiscreteFunctionSpace< FunctionSpace, GridPart, Storage > ThisType;
135 typedef DiscreteFunctionSpaceDefault< RannacherTurekDiscreteFunctionSpaceTraits< FunctionSpace, GridPart, Storage > > BaseType;
137 static const InterfaceType defaultInterface = InteriorBorder_All_Interface;
138 static const CommunicationDirection defaultDirection = ForwardCommunication;
141 static const int polynomialOrder = 1;
143 typedef typename BaseType::Traits Traits;
145 typedef typename BaseType::FunctionSpaceType FunctionSpaceType;
147 typedef typename BaseType::GridPartType GridPartType;
148 typedef typename BaseType::EntityType EntityType;
149 typedef typename BaseType::IntersectionType IntersectionType;
151 typedef typename BaseType::Traits::ShapeFunctionSetType ShapeFunctionSetType;
152 typedef typename BaseType::BasisFunctionSetType BasisFunctionSetType;
154 typedef typename BaseType::BlockMapperType BlockMapperType;
156 typedef RannacherTurekLocalInterpolation< BasisFunctionSetType, typename Traits::LocalInterpolationType > InterpolationType;
159 typedef typename Traits::ScalarShapeFunctionSetType ScalarShapeFunctionSetType;
160 typedef SingletonList< GeometryType, ScalarShapeFunctionSetType, typename Traits::ScalarShapeFunctionSetFactoryType > ScalarShapeFunctionSetProviderType;
162 typedef RannacherTurekBlockMapperSingletonKey< GridPartType > BlockMapperSingletonKeyType;
163 typedef typename Traits::BlockMapperFactoryType BlockMapperFactoryType;
164 typedef SingletonList< BlockMapperSingletonKeyType, BlockMapperType, BlockMapperFactoryType > BlockMapperProviderType;
167 using BaseType::order;
169 explicit RannacherTurekDiscreteFunctionSpace ( GridPartType &gridPart,
170 const InterfaceType commInterface = defaultInterface,
171 const CommunicationDirection commDirection = defaultDirection )
172 : BaseType( gridPart, commInterface, commDirection ),
173 scalarShapeFunctionSet_( nullptr ),
174 blockMapper_( nullptr )
178 scalarShapeFunctionSet_ = &( ScalarShapeFunctionSetProviderType::getObject( type ) );
181 BlockMapperSingletonKeyType key( gridPart );
182 blockMapper_ = &( BlockMapperProviderType::getObject( key ) );
185 ~RannacherTurekDiscreteFunctionSpace ()
188 BlockMapperProviderType::removeObject( *blockMapper_ );
189 blockMapper_ =
nullptr;
191 if( scalarShapeFunctionSet_ )
192 ScalarShapeFunctionSetProviderType::removeObject( *scalarShapeFunctionSet_ );
193 scalarShapeFunctionSet_ =
nullptr;
200 BasisFunctionSetType basisFunctionSet (
const EntityType &entity )
const 202 return BasisFunctionSetType( entity, shapeFunctionSet( entity ) );
212 ShapeFunctionSetType shapeFunctionSet (
const EntityType &entity )
const 214 assert( scalarShapeFunctionSet_);
215 return ShapeFunctionSetType( scalarShapeFunctionSet_ );
219 bool continuous ()
const {
return false; }
222 bool continuous (
const IntersectionType &intersection )
const {
return false; }
225 int order ()
const {
return polynomialOrder; }
228 inline bool multipleGeometryTypes ()
const {
return false; }
231 BlockMapperType &blockMapper ()
const 233 assert( blockMapper_ );
234 return *blockMapper_;
241 InterpolationType interpolation (
const EntityType &entity )
const 243 return InterpolationType( basisFunctionSet( entity ) );
251 template<
class LocalFunction,
class LocalDofVector >
253 void interpolate (
const LocalFunction &localFunction, LocalDofVector &dofs )
const 255 const EntityType &entity = localFunction.entity();
256 InterpolationType interpolation = this->interpolation( entity );
257 interpolation( localFunction, dofs );
261 RannacherTurekDiscreteFunctionSpace (
const ThisType & );
262 ThisType &operator= (
const ThisType & );
264 ScalarShapeFunctionSetType *scalarShapeFunctionSet_;
265 BlockMapperType *blockMapper_;
272 #endif // #if HAVE_DUNE_LOCALFUNCTIONS 274 #endif // #ifndef DUNE_FEM_SPACE_RANNACHERTUREK_HH
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:88
id for Rannacher-Turek space
Definition: discretefunctionspace.hh:96
Definition: coordinate.hh:4
specialize with 'true' for if the codimension 0 entity of the grid part has only one possible geometr...
Definition: gridpart/common/capabilities.hh:28
Provides a proxy class for pointers to a shape function set.
static void interpolate(const GridFunction &u, DiscreteFunction &v)
perform native interpolation of a discrete function space
Definition: interpolate.hh:41