DUNE-FEM (unstable)

lagrange.hh
1 #ifndef DUNE_FEM_SPACE_PADAPTIVE_LAGRANGE_HH
2 #define DUNE_FEM_SPACE_PADAPTIVE_LAGRANGE_HH
3 
4 #include <dune/fem/common/hybrid.hh>
5 #include <dune/fem/space/common/defaultcommhandler.hh>
6 #include <dune/fem/space/lagrange/shapefunctionset.hh>
7 #include <dune/fem/space/mapper/nonblockmapper.hh>
8 #include <dune/fem/space/lagrange/interpolation.hh>
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 >
43  struct PAdaptiveLagrangeSpaceTraits
44  {
45  static_assert((maxPolOrder > 0), "LagrangeSpace only defined for maxPolOrder > 0" );
46 
47  typedef PAdaptiveLagrangeSpace< FunctionSpace, GridPart, maxPolOrder, Storage > DiscreteFunctionSpaceType;
48 
49  typedef FunctionSpace FunctionSpaceType;
50  typedef GridPart GridPartType;
51 
52  static const int polynomialOrder = maxPolOrder;
53 
54  static const bool continuousSpace = true ;
55  typedef Hybrid::IndexRange< int, FunctionSpaceType::dimRange > LocalBlockIndices;
56 
57  typedef PAdaptiveLagrangeMapper< GridPartType, polynomialOrder > BlockMapperType;
58 
59  typedef LagrangePointSet< GridPartType, polynomialOrder > CompiledLocalKeyType;
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 
70  typedef LagrangeShapeFunctionInterface< ShapeFunctionSpaceType > ShapeFunctionType;
71  typedef SimpleShapeFunctionSet< ShapeFunctionType > SimpleShapeFunctionSetType;
72 
73  public:
74  typedef SelectCachingShapeFunctionSet< SimpleShapeFunctionSetType, Storage > ScalarShapeFunctionSetType;
75 
76  template< int pOrd >
77  struct ScalarShapeFunctionSetFactory
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 
91  typedef ShapeFunctionSetProxy< ScalarShapeFunctionSetType > ScalarShapeFunctionSetProxyType;
92  typedef VectorialShapeFunctionSet< ScalarShapeFunctionSetProxyType, typename FunctionSpaceType::RangeType > ShapeFunctionSetType;
93 
95 
96  template< class DiscreteFunction, class Operation = DFCommunicationOperation::Add >
97  struct CommDataHandle
98  {
99  typedef DefaultCommunicationHandler< DiscreteFunction, Operation > Type;
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 
127  typedef typename BaseType::GridPartType GridPartType;
128  typedef typename BaseType::IntersectionType IntersectionType;
129  typedef typename BaseType::BasisFunctionSetType BasisFunctionSetType;
130  typedef typename BaseType::EntityType EntityType;
131 
132  typedef typename BaseType::CompiledLocalKeyType CompiledLocalKeyType;
133  typedef CompiledLocalKeyType LagrangePointSetType;
134 
135  typedef LagrangeLocalInterpolation< GridPartType, maxPolOrder, BasisFunctionSetType > InterpolationImplType;
136  typedef LocalInterpolationWrapper< ThisType > InterpolationType;
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 = GridPart::indexSetInterfaceType;
148 
149  // default communication direction
150  static const CommunicationDirection defaultDirection = ForwardCommunication;
151 
159  explicit PAdaptiveLagrangeSpace ( GridPartType &gridPart,
160  const int order,
161  const InterfaceType commInterface = defaultInterface,
162  const CommunicationDirection commDirection = defaultDirection )
163  : BaseType( gridPart, order, commInterface, commDirection )
164  {}
165 
172  explicit PAdaptiveLagrangeSpace ( GridPartType &gridPart,
173  const InterfaceType commInterface = defaultInterface,
174  const CommunicationDirection commDirection = defaultDirection )
175  : BaseType( gridPart, maxPolOrder, commInterface, commDirection )
176  {}
177 
178  // copy constructor needed for p-adaption
180  : BaseType( other )
181  {}
182 
184  bool continuous (const IntersectionType &intersection) const
185  {
186  if ( order() > 0 && intersection.conforming())
187  {
188  return true;
189  if (intersection.neighbor())
190  return (order(intersection.inside()) == order(intersection.outside()));
191  else
192  return true;
193  }
194  return false;
195  }
196 
206  template< class EntityType >
207  const CompiledLocalKeyType &lagrangePointSet ( const EntityType &entity ) const
208  {
209  return compiledLocalKey( entity.type(), blockMapper().polynomOrder( entity ) );
210  }
211 
212  InterpolationType interpolation () const
213  {
214  return InterpolationType( *this );
215  }
216 
217  [[deprecated]]
218  InterpolationImplType interpolation ( const EntityType &entity ) const
219  {
220  return localInterpolation( entity );
221  }
222 
223  InterpolationImplType localInterpolation ( const EntityType &entity ) const
224  {
225  return InterpolationImplType( lagrangePointSet( entity ), basisFunctionSet( entity ) );
226  }
227 
228  };
229 
230  } // namespace Fem
231 
232 } // namespace Dune
233 
234 #endif // #ifndef DUNE_FEM_SPACE_PADAPTIVE_LAGRANGE_HH
Definition: default.hh:53
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:766
Traits Traits
type of traits class
Definition: discretefunctionspace.hh:188
VectorSpaceTraits< DomainField, RangeField, dimD, dimR > ::ScalarFunctionSpaceType ScalarFunctionSpaceType
corresponding scalar function space
Definition: functionspaceinterface.hh:83
A vector valued function space.
Definition: functionspace.hh:60
Please doc me.
Definition: generic.hh:43
const CompiledLocalKeyType & compiledLocalKey(const EntityType &entity) const
provide access to the compiled local keys for an entity
Definition: generic.hh:208
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: generic.hh:141
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: generic.hh:147
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: generic.hh:162
int order() const
get global order of space
Definition: generic.hh:150
Lagrange discrete function space.
Definition: lagrange.hh:118
PAdaptiveLagrangeSpace(GridPartType &gridPart, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
constructor
Definition: lagrange.hh:172
PAdaptiveLagrangeSpace(GridPartType &gridPart, const int order, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
constructor
Definition: lagrange.hh:159
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: lagrange.hh:184
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: generic.hh:141
const CompiledLocalKeyType & lagrangePointSet(const EntityType &entity) const
provide access to the Lagrange point set for an entity
Definition: lagrange.hh:207
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: generic.hh:162
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: generic.hh:223
int order() const
get global order of space
Definition: generic.hh:150
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
@ ForwardCommunication
communicate as given in InterfaceType
Definition: gridenums.hh:171
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)