dune-fem  2.8-git
padaptivespace/lagrange.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_PADAPTIVE_LAGRANGE_HH
2 #define DUNE_FEM_SPACE_PADAPTIVE_LAGRANGE_HH
3 
9 
10 #include "adaptmanager.hh"
11 #include "declaration.hh"
12 #include "generic.hh"
13 #include "mapper.hh"
14 #include "restrictprolong.hh"
15 
16 
17 namespace Dune
18 {
19 
20  namespace Fem
21  {
22 
39  // PAdaptiveLagrangeSpaceTraits
40  // ----------------------------
41 
42  template< class FunctionSpace, class GridPart, int maxPolOrder, class Storage >
44  {
45  static_assert((maxPolOrder > 0), "LagrangeSpace only defined for maxPolOrder > 0" );
46 
48 
50  typedef GridPart GridPartType;
51 
52  static const int polynomialOrder = maxPolOrder;
53 
54  static const bool continuousSpace = true ;
56 
58 
60 
61  static const int codimension = 0;
62 
63  private:
64  typedef typename GridPartType::template Codim< codimension >::EntityType EntityType;
65 
66  static const int dimLocal = GridPartType::dimension;
67  typedef typename FunctionSpace::ScalarFunctionSpaceType ScalarFunctionSpaceType;
68  typedef typename ToNewDimDomainFunctionSpace< ScalarFunctionSpaceType, dimLocal >::Type ShapeFunctionSpaceType;
69 
72 
73  public:
75 
76  template< int pOrd >
78  {
79  struct Type
80  {
81  static ScalarShapeFunctionSetType *createObject ( const GeometryType &type )
82  {
83  typedef LagrangeShapeFunctionFactory< ShapeFunctionSpaceType, maxPolOrder > SimpleShapeFunctionSetFactoryType;
84  return new ScalarShapeFunctionSetType( type, SimpleShapeFunctionSetType( SimpleShapeFunctionSetFactoryType( type, pOrd ) ) );
85  }
86 
87  static void deleteObject ( ScalarShapeFunctionSetType *object ) { delete object; }
88  };
89  };
90 
93 
95 
96  template< class DiscreteFunction, class Operation = DFCommunicationOperation::Add >
98  {
100  typedef Operation OperationType;
101  };
102  };
103 
104 
105 
106  // PAdaptiveLagrangeSpace
107  // ----------------------
108 
115  template< class FunctionSpace, class GridPart, int maxPolOrder, class Storage = CachingStorage >
117  : public GenericDiscreteFunctionSpace< PAdaptiveLagrangeSpaceTraits< FunctionSpace, GridPart, maxPolOrder, Storage > >
118  {
121 
122  public:
124 
125  typedef typename BaseType::Traits Traits;
126 
131 
134 
137 
138  public:
139  using BaseType::blockMapper;
141  using BaseType::continuous;
142  using BaseType::gridPart;
143  using BaseType::order;
145 
146  // default communication interface
147  static const InterfaceType defaultInterface = InteriorBorder_InteriorBorder_Interface;
148  // default communication direction
149  static const CommunicationDirection defaultDirection = ForwardCommunication;
150 
159  const int order,
160  const InterfaceType commInterface = defaultInterface,
161  const CommunicationDirection commDirection = defaultDirection )
162  : BaseType( gridPart, order, commInterface, commDirection )
163  {}
164 
172  const InterfaceType commInterface = defaultInterface,
173  const CommunicationDirection commDirection = defaultDirection )
174  : BaseType( gridPart, maxPolOrder, commInterface, commDirection )
175  {}
176 
177  // copy constructor needed for p-adaption
179  : BaseType( other )
180  {}
181 
183  bool continuous (const IntersectionType &intersection) const
184  {
185  if ( order() > 0 && intersection.conforming())
186  {
187  return true;
188  if (intersection.neighbor())
189  return (order(intersection.inside()) == order(intersection.outside()));
190  else
191  return true;
192  }
193  return false;
194  }
195 
205  template< class EntityType >
206  const CompiledLocalKeyType &lagrangePointSet ( const EntityType &entity ) const
207  {
208  return compiledLocalKey( entity.type(), blockMapper().polynomOrder( entity ) );
209  }
210 
212  {
213  return InterpolationType( *this );
214  }
215 
216  [[deprecated]]
218  {
219  return localInterpolation( entity );
220  }
221 
223  {
224  return InterpolationImplType( lagrangePointSet( entity ), basisFunctionSet( entity ) );
225  }
226 
227  };
228 
229  } // namespace Fem
230 
231 } // namespace Dune
232 
233 #endif // #ifndef DUNE_FEM_SPACE_PADAPTIVE_LAGRANGE_HH
Definition: bindguard.hh:11
Definition: hybrid.hh:86
Definition: space/basisfunctionset/default.hh:52
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:29
Traits Traits
type of traits class
Definition: discretefunctionspace.hh:187
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:745
A vector valued function space.
Definition: functionspace.hh:60
convert functions space to space with new dim domain
Definition: functionspace.hh:246
VectorSpaceTraits< DomainField, RangeField, dimD, dimR > ::ScalarFunctionSpaceType ScalarFunctionSpaceType
corresponding scalar function space
Definition: functionspaceinterface.hh:83
Definition: common/localinterpolation.hh:74
Definition: lagrange/interpolation.hh:21
Definition: lagrangepoints.hh:685
abstract base class for Lagrange shape functions
Definition: lagrange/shapefunctionset.hh:41
factory class
Definition: lagrange/shapefunctionset.hh:126
Lagrange discrete function space.
Definition: padaptivespace/lagrange.hh:118
PAdaptiveLagrangeSpace(GridPartType &gridPart, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
constructor
Definition: padaptivespace/lagrange.hh:171
BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: padaptivespace/lagrange.hh:129
PAdaptiveLagrangeSpace(GridPartType &gridPart, const int order, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
constructor
Definition: padaptivespace/lagrange.hh:158
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: padaptivespace/lagrange.hh:183
LagrangeLocalInterpolation< GridPartType, maxPolOrder, BasisFunctionSetType > InterpolationImplType
Definition: padaptivespace/lagrange.hh:135
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: padaptivespace/generic.hh:141
BaseType::GridPartType GridPartType
Definition: padaptivespace/lagrange.hh:127
const CompiledLocalKeyType & lagrangePointSet(const EntityType &entity) const
provide access to the Lagrange point set for an entity
Definition: padaptivespace/lagrange.hh:206
static const CommunicationDirection defaultDirection
Definition: padaptivespace/lagrange.hh:149
BaseType::CompiledLocalKeyType CompiledLocalKeyType
Definition: padaptivespace/lagrange.hh:132
BaseType::Traits Traits
Definition: padaptivespace/lagrange.hh:125
LocalInterpolationWrapper< ThisType > InterpolationType
Definition: padaptivespace/lagrange.hh:136
BaseType::IntersectionType IntersectionType
Definition: padaptivespace/lagrange.hh:128
ThisType PAdaptiveLagrangeSpaceType
Definition: padaptivespace/lagrange.hh:123
InterpolationType interpolation() const
Definition: padaptivespace/lagrange.hh:211
PAdaptiveLagrangeSpace(const PAdaptiveLagrangeSpace &other)
Definition: padaptivespace/lagrange.hh:178
static const InterfaceType defaultInterface
Definition: padaptivespace/lagrange.hh:147
BaseType::EntityType EntityType
Definition: padaptivespace/lagrange.hh:130
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: padaptivespace/generic.hh:162
InterpolationImplType interpolation(const EntityType &entity) const
Definition: padaptivespace/lagrange.hh:217
CompiledLocalKeyType LagrangePointSetType
Definition: padaptivespace/lagrange.hh:133
const CompiledLocalKeyType & compiledLocalKey(const GeometryType type, const int order=polynomialOrder) const
provide access to the compiled local keys for a geometry type and polynomial order
Definition: padaptivespace/generic.hh:223
InterpolationImplType localInterpolation(const EntityType &entity) const
Definition: padaptivespace/lagrange.hh:222
int order() const
get global order of space
Definition: padaptivespace/generic.hh:150
Please doc me.
Definition: padaptivespace/generic.hh:43
const CompiledLocalKeyType & compiledLocalKey(const EntityType &entity) const
provide access to the compiled local keys for an entity
Definition: padaptivespace/generic.hh:208
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: padaptivespace/generic.hh:141
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: padaptivespace/generic.hh:147
BaseType::GridPartType GridPartType
Definition: padaptivespace/generic.hh:53
BaseType::IntersectionType IntersectionType
Definition: padaptivespace/generic.hh:58
BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: padaptivespace/generic.hh:61
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: padaptivespace/generic.hh:162
Traits::CompiledLocalKeyType CompiledLocalKeyType
Definition: padaptivespace/generic.hh:88
IteratorType::Entity EntityType
Definition: padaptivespace/generic.hh:57
int order() const
get global order of space
Definition: padaptivespace/generic.hh:150
Definition: padaptivespace/lagrange.hh:44
static const int polynomialOrder
Definition: padaptivespace/lagrange.hh:52
SelectCachingShapeFunctionSet< SimpleShapeFunctionSetType, Storage > ScalarShapeFunctionSetType
Definition: padaptivespace/lagrange.hh:74
static const int codimension
Definition: padaptivespace/lagrange.hh:61
FunctionSpace FunctionSpaceType
Definition: padaptivespace/lagrange.hh:49
LagrangePointSet< GridPartType, polynomialOrder > CompiledLocalKeyType
Definition: padaptivespace/lagrange.hh:59
ShapeFunctionSetProxy< ScalarShapeFunctionSetType > ScalarShapeFunctionSetProxyType
Definition: padaptivespace/lagrange.hh:91
Dune::Fem::DefaultBasisFunctionSet< EntityType, ShapeFunctionSetType > BasisFunctionSetType
Definition: padaptivespace/lagrange.hh:94
PAdaptiveLagrangeSpace< FunctionSpace, GridPart, maxPolOrder, Storage > DiscreteFunctionSpaceType
Definition: padaptivespace/lagrange.hh:45
VectorialShapeFunctionSet< ScalarShapeFunctionSetProxyType, typename FunctionSpaceType::RangeType > ShapeFunctionSetType
Definition: padaptivespace/lagrange.hh:92
PAdaptiveLagrangeMapper< GridPartType, polynomialOrder > BlockMapperType
Definition: padaptivespace/lagrange.hh:57
static const bool continuousSpace
Definition: padaptivespace/lagrange.hh:54
GridPart GridPartType
Definition: padaptivespace/lagrange.hh:50
Hybrid::IndexRange< int, FunctionSpaceType::dimRange > LocalBlockIndices
Definition: padaptivespace/lagrange.hh:55
static void deleteObject(ScalarShapeFunctionSetType *object)
Definition: padaptivespace/lagrange.hh:87
static ScalarShapeFunctionSetType * createObject(const GeometryType &type)
Definition: padaptivespace/lagrange.hh:81
Definition: padaptivespace/lagrange.hh:98
Operation OperationType
Definition: padaptivespace/lagrange.hh:100
DefaultCommunicationHandler< DiscreteFunction, Operation > Type
Definition: padaptivespace/lagrange.hh:99
Definition: mapper.hh:67
Definition: proxy.hh:35
Definition: selectcaching.hh:26
Definition: space/shapefunctionset/simple.hh:50
Definition: shapefunctionset/vectorial.hh:447