dune-fem  2.4.1-rc
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, template< class > 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;
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, template< class > class Storage = CachingStorage >
117  : public GenericDiscreteFunctionSpace< PAdaptiveLagrangeSpaceTraits< FunctionSpace, GridPart, maxPolOrder, Storage > >
118  {
121 
122  public:
123  typedef ThisType PAdaptiveLagrangeSpaceType;
124 
125  typedef typename BaseType::Traits Traits;
126 
127  typedef typename BaseType::GridPartType GridPartType;
128  typedef typename BaseType::IntersectionType IntersectionType;
129 
130  typedef typename BaseType::CompiledLocalKeyType CompiledLocalKeyType;
131  typedef CompiledLocalKeyType LagrangePointSetType;
132 
133  protected:
134  using BaseType::dfList_ ;
135  using BaseType::searchFunction ;
136 
137  public:
138  using BaseType::blockMapper;
139  using BaseType::compiledLocalKey;
140  using BaseType::continuous;
141  using BaseType::gridPart;
142  using BaseType::order;
143 
144  // default communication interface
145  static const InterfaceType defaultInterface = InteriorBorder_InteriorBorder_Interface;
146  // default communication direction
147  static const CommunicationDirection defaultDirection = ForwardCommunication;
148 
155  explicit PAdaptiveLagrangeSpace ( GridPartType &gridPart,
156  const InterfaceType commInterface = defaultInterface,
157  const CommunicationDirection commDirection = defaultDirection )
158  : BaseType( gridPart, commInterface, commDirection )
159  {}
160 
161  // copy constructor needed for p-adaption
163  : BaseType( other )
164  {}
165 
167  bool continuous (const IntersectionType &intersection) const
168  {
169  if ( order() > 0 && intersection.conforming())
170  {
171  return true;
172  if (intersection.neighbor())
173  return (order(make_entity(intersection.inside())) == order(make_entity(intersection.outside())));
174  else
175  return true;
176  }
177  return false;
178  }
179 
189  template< class EntityType >
190  const CompiledLocalKeyType &lagrangePointSet ( const EntityType &entity ) const
191  {
192  return compiledLocalKey( entity.type(),
193  blockMapper().polynomOrder( entity ) );
194  }
195 
206  const CompiledLocalKeyType &lagrangePointSet ( const GeometryType &type, const int order = BaseType::polynomialOrder ) const DUNE_DEPRECATED
207  {
208  return compiledLocalKey( type, order );
209  }
210 
214  template< class DiscreteFunction >
215  void addFunction( DiscreteFunction &df ) const
216  {
217  assert( searchFunction( df ) == dfList_.end() );
218 
219  // select LagrangeInterpolation to be the LocalInterpolation
220  typedef typename BaseType :: template PAdaptiveDiscreteFunctionEntry<
221  DiscreteFunction, LagrangeInterpolation< DiscreteFunction, DiscreteFunction > > RealEntryType ;
222  typedef typename BaseType :: PAdaptiveDiscreteFunctionEntryInterface
223  EntryInterface;
224  EntryInterface *entry = new RealEntryType( df );
225 
226  assert( entry );
227  dfList_.push_front( entry );
228  }
229  };
230 
231  } // namespace Fem
232 
233 } // namespace Dune
234 
235 #endif // #ifndef DUNE_FEM_SPACE_PADAPTIVE_LAGRANGE_HH
const CompiledLocalKeyType & lagrangePointSet(const EntityType &entity) const
provide access to the Lagrange point set for an entity
Definition: padaptivespace/lagrange.hh:190
Definition: selectcaching.hh:28
BaseType::IntersectionType IntersectionType
Definition: padaptivespace/lagrange.hh:128
static const int polynomialOrder
Definition: padaptivespace/lagrange.hh:52
Definition: selectcaching.hh:17
Definition: padaptivespace/lagrange.hh:43
abstract base class for Lagrange shape functions
Definition: lagrange/shapefunctionset.hh:41
static void deleteObject(ScalarShapeFunctionSetType *object)
Definition: padaptivespace/lagrange.hh:87
A vector valued function space.
Definition: functionspace.hh:16
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:23
Definition: shapefunctionset/vectorial.hh:428
static ScalarShapeFunctionSetType * createObject(const GeometryType &type)
Definition: padaptivespace/lagrange.hh:81
Definition: padaptivespace/lagrange.hh:97
PAdaptiveLagrangeMapper< GridPartType, polynomialOrder > BlockMapperType
Definition: padaptivespace/lagrange.hh:57
Please doc me.
Definition: padaptivespace/generic.hh:37
Lagrange discrete function space.
Definition: space/padaptivespace/declaration.hh:21
PAdaptiveLagrangeSpace(GridPartType &gridPart, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
constructor
Definition: padaptivespace/lagrange.hh:155
Definition: mapper.hh:30
ThisType PAdaptiveLagrangeSpaceType
Definition: padaptivespace/lagrange.hh:123
dimension of range vector space
Definition: functionspaceinterface.hh:47
Definition: shapefunctionset/simple.hh:49
SelectCachingShapeFunctionSet< SimpleShapeFunctionSetType, Storage > ScalarShapeFunctionSetType
Definition: padaptivespace/lagrange.hh:74
factory class
Definition: lagrange/shapefunctionset.hh:126
static const bool continuousSpace
Definition: padaptivespace/lagrange.hh:54
Dune::EntityPointer< Grid, Implementation >::Entity make_entity(const Dune::EntityPointer< Grid, Implementation > &entityPointer)
Definition: compatibility.hh:23
Definition: shapefunctionset/proxy.hh:35
BaseType::CompiledLocalKeyType CompiledLocalKeyType
Definition: padaptivespace/lagrange.hh:130
GridPart GridPartType
Definition: padaptivespace/lagrange.hh:50
void addFunction(DiscreteFunction &df) const
add function to discrete function space for p-adaptation (currently only supported by AdaptiveDiscret...
Definition: padaptivespace/lagrange.hh:215
static const int localBlockSize
Definition: padaptivespace/lagrange.hh:55
Definition: coordinate.hh:4
DefaultCommunicationHandler< DiscreteFunction, Operation > Type
Definition: padaptivespace/lagrange.hh:99
PAdaptiveLagrangeSpace(const PAdaptiveLagrangeSpace &other)
Definition: padaptivespace/lagrange.hh:162
Dune::Fem::DefaultBasisFunctionSet< EntityType, ShapeFunctionSetType > BasisFunctionSetType
Definition: padaptivespace/lagrange.hh:94
CompiledLocalKeyType LagrangePointSetType
Definition: padaptivespace/lagrange.hh:131
ShapeFunctionSetProxy< ScalarShapeFunctionSetType > ScalarShapeFunctionSetProxyType
Definition: padaptivespace/lagrange.hh:91
PAdaptiveLagrangeSpace< FunctionSpace, GridPart, maxPolOrder, Storage > DiscreteFunctionSpaceType
Definition: padaptivespace/lagrange.hh:45
const CompiledLocalKeyType & lagrangePointSet(const GeometryType &type, const int order=BaseType::polynomialOrder) const
provide access to the Lagrange point set for a geometry type
Definition: padaptivespace/lagrange.hh:206
BaseType::GridPartType GridPartType
Definition: padaptivespace/lagrange.hh:127
static const int codimension
Definition: padaptivespace/lagrange.hh:61
FunctionSpace FunctionSpaceType
Definition: padaptivespace/lagrange.hh:49
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: padaptivespace/lagrange.hh:167
LagrangePointSet< GridPartType, polynomialOrder > CompiledLocalKeyType
Definition: padaptivespace/lagrange.hh:59
VectorialShapeFunctionSet< ScalarShapeFunctionSetProxyType, typename FunctionSpaceType::RangeType > ShapeFunctionSetType
Definition: padaptivespace/lagrange.hh:92
Generates the Lagrange Interpolation of an analytic function.
Definition: lagrangeinterpolation.hh:21
GridPartType::template Codim< Traits::codimension >::EntityType EntityType
type of entity of codimension 0
Definition: discretefunctionspace.hh:200
convert functions space to space with new dim domain
Definition: functionspace.hh:242
Definition: lagrangepoints.hh:461
BaseType::Traits Traits
Definition: padaptivespace/lagrange.hh:125
Operation OperationType
Definition: padaptivespace/lagrange.hh:100
implementation of a basis function set for given entity
Definition: default.hh:46