dune-fem  2.8-git
discontinuousgalerkin/space.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
2 #define DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
3 
4 #include <utility>
5 
6 #include <dune/geometry/type.hh>
7 
8 #include <dune/grid/common/gridenums.hh>
9 
18 
19 #include "basisfunctionsets.hh"
20 #include "declaration.hh"
21 #include "generic.hh"
22 #include "localinterpolation.hh"
23 #include "interpolation.hh"
24 #include "shapefunctionsets.hh"
25 
26 namespace Dune
27 {
28 
29  namespace Fem
30  {
31 
32  // DiscontinuousGalerkinSpaceTraits
33  // --------------------------------
34 
35  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
37  {
39 
40  typedef GridPart GridPartType;
42 
43  static const int codimension = 0;
44 
47  GridPartType::dimension, 1
49 
51  : public Dune::Fem::OrthonormalShapeFunctionSet< ScalarShapeFunctionSpaceType >
52  {
54 
55  static constexpr int numberShapeFunctions =
56  OrthonormalShapeFunctions< ScalarShapeFunctionSpaceType::dimDomain >::size(polOrder);
57  public:
58  explicit ScalarShapeFunctionSet ( Dune::GeometryType type )
59  : BaseType( type, polOrder )
60  {
61  assert( size() == BaseType::size() );
62  }
63 
64  // overload size method because it's a static value
65  static constexpr unsigned int size() { return numberShapeFunctions; }
66  };
67 
68 
69 
72 
75 
77 
79 
80  template <class DiscreteFunction, class Operation = DFCommunicationOperation::Copy >
82  {
83  typedef Operation OperationType;
85  };
86  };
87 
88 
89 
90  // DiscontinuousGalerkinSpace
91  // --------------------------
92 
93  template< class FunctionSpace, class GridPart, int polOrder, class Storage = CachingStorage >
95  : public GenericDiscontinuousGalerkinSpace< DiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, polOrder, Storage > >
96  {
99 
100  public:
102 
103  static const int polynomialOrder = polOrder;
104 
107 
110 
113 
114 
116  const InterfaceType commInterface = InteriorBorder_All_Interface,
117  const CommunicationDirection commDirection = ForwardCommunication )
118  : BaseType( gridPart, makeBasisFunctionSets( gridPart ), commInterface, commDirection )
119  {}
120 
122  {
123  return InterpolationType( *this );
124  }
125 
126  [[deprecated]]
128  {
129  return interpolation ();
130  }
131 
133  {
134  return interpolation ();
135  }
136 
137  private:
138  static BasisFunctionSetsType makeBasisFunctionSets ( const GridPartType &gridPart )
139  {
140  typedef typename BasisFunctionSetsType::ShapeFunctionSetsType ShapeFunctionSetsType;
141  ShapeFunctionSetsType shapeFunctionSets( gridPart );
142  return BasisFunctionSetsType( std::move( shapeFunctionSets ) );
143  }
144  };
145 
146 
147 
148  namespace Capabilities
149  {
150 
151  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
152  struct hasFixedPolynomialOrder< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
153  {
154  static const bool v = true;
155  };
156 
157  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
158  struct hasStaticPolynomialOrder< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
159  {
160  static const bool v = true;
161  static const int order = polOrder;
162  };
163 
164  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
165  struct isContinuous< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
166  {
167  static const bool v = false;
168  };
169 
170  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
171  struct isLocalized< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
172  {
173  static const bool v = true;
174  };
175 
176  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
177  struct isAdaptive< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
178  {
179  static const bool v = true;
180  };
181 
182  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
183  struct threadSafe< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
184  {
185  static const bool v = false;
186  };
187 
188  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
189  struct viewThreadSafe< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
190  {
191  static const bool v = true;
192  };
193 
194  template< class FunctionSpace, class GridPart, int polOrder, class Storage >
195  struct isHierarchic< DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > >
196  {
197  static const bool v = true;
198  };
199 
200  } // namespace Capabilities
201 
202  } // namespace Fem
203 
204 } // namespace Dune
205 
206 #endif // #ifndef DUNE_FEM_SPACE_DISCONTINUOUSGALERKIN_SPACE_HH
Definition: bindguard.hh:11
typename Impl::GridFunctionSpace< GridPart, T >::Type GridFunctionSpace
Definition: functionspace.hh:317
Definition: hybrid.hh:86
Definition: space/basisfunctionset/default.hh:52
specialize with true if polynomial order does not depend on the grid (part) entity
Definition: space/common/capabilities.hh:24
static const bool v
Definition: space/common/capabilities.hh:25
specialize with true if polynomial order fixed and compile time static
Definition: space/common/capabilities.hh:37
static const bool v
Definition: space/common/capabilities.hh:38
static const int order
Definition: space/common/capabilities.hh:39
specialize with true if space is always continuous
Definition: space/common/capabilities.hh:50
static const bool v
Definition: space/common/capabilities.hh:51
specialize with true if the space is localized, * i.e., the basis function set is based on a shape fu...
Definition: space/common/capabilities.hh:68
static const bool v
Definition: space/common/capabilities.hh:69
specialize with true if space can be used with AdaptiveDiscreteFunction
Definition: space/common/capabilities.hh:81
static const bool v
Definition: space/common/capabilities.hh:82
specialize with true if the space implementation is thread safe
Definition: space/common/capabilities.hh:94
static const bool v
Definition: space/common/capabilities.hh:95
specialize with true if the space implementation is thread safe, while it is not modified
Definition: space/common/capabilities.hh:108
static const bool v
Definition: space/common/capabilities.hh:109
specialize with true if for a space the basis functions are sorted by the polynomial order,...
Definition: space/common/capabilities.hh:120
static const bool v
Definition: space/common/capabilities.hh:121
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:29
Traits ::GridPartType GridPartType
type of underlying grid part
Definition: discretefunctionspace.hh:210
GridPartType ::template Codim< Traits::codimension >::EntityType EntityType
type of entity of codimension 0
Definition: discretefunctionspace.hh:223
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:745
A vector valued function space.
Definition: functionspace.hh:60
FunctionSpaceTraits::DomainFieldType DomainFieldType
Intrinsic type used for values in the domain field (usually a double)
Definition: functionspaceinterface.hh:60
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63
generate a set of default basis function sets from given set of shape function sets
Definition: discontinuousgalerkin/basisfunctionsets.hh:83
Definition: discontinuousgalerkin/space.hh:96
InterpolationType localInterpolation(const EntityType &entity) const
Definition: discontinuousgalerkin/space.hh:132
BaseType::GridPartType GridPartType
Definition: discontinuousgalerkin/space.hh:105
DiscontinuousGalerkinSpace(GridPartType &gridPart, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
Definition: discontinuousgalerkin/space.hh:115
InterpolationType InterpolationImplType
Definition: discontinuousgalerkin/space.hh:112
BaseType::BasisFunctionSetsType BasisFunctionSetsType
Definition: discontinuousgalerkin/space.hh:108
DiscontinuousGalerkinLocalInterpolation< ThisType > InterpolationType
Definition: discontinuousgalerkin/space.hh:111
InterpolationType interpolation() const
Definition: discontinuousgalerkin/space.hh:121
static const int polynomialOrder
Definition: discontinuousgalerkin/space.hh:103
InterpolationType interpolation(const EntityType &entity) const
Definition: discontinuousgalerkin/space.hh:127
BaseType::EntityType EntityType
Definition: discontinuousgalerkin/space.hh:106
BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: discontinuousgalerkin/space.hh:109
generic implementation of a Discontinuous Galerkin space based on a fixed family of basis function se...
Definition: discontinuousgalerkin/generic.hh:31
BaseType::GridPartType GridPartType
type of underlying grid part
Definition: discontinuousgalerkin/generic.hh:40
BaseType::EntityType EntityType
type of entity of codimension 0
Definition: discontinuousgalerkin/generic.hh:42
BaseType::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discontinuousgalerkin/generic.hh:49
Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets
Definition: discontinuousgalerkin/generic.hh:47
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: discontinuousgalerkin/generic.hh:106
Definition: discontinuousgalerkin/localinterpolation.hh:30
Definition: shapefunctionsets.hh:197
Definition: shapefunctionsets.hh:271
Definition: discontinuousgalerkin/space.hh:37
DiscontinuousGalerkinSpace< FunctionSpace, GridPart, polOrder, Storage > DiscreteFunctionSpaceType
Definition: discontinuousgalerkin/space.hh:38
SelectCachingShapeFunctionSets< GridPartType, ScalarShapeFunctionSet, Storage > ScalarShapeFunctionSetsType
Definition: discontinuousgalerkin/space.hh:70
GridFunctionSpace< GridPartType, FunctionSpace > FunctionSpaceType
Definition: discontinuousgalerkin/space.hh:41
BasisFunctionSetsType::BasisFunctionSetType BasisFunctionSetType
Definition: discontinuousgalerkin/space.hh:74
Dune::Fem::FunctionSpace< typename FunctionSpace::DomainFieldType, typename FunctionSpace::RangeFieldType, GridPartType::dimension, 1 > ScalarShapeFunctionSpaceType
Definition: discontinuousgalerkin/space.hh:48
CodimensionMapper< GridPartType, codimension > BlockMapperType
Definition: discontinuousgalerkin/space.hh:76
Hybrid::IndexRange< int, FunctionSpaceType::dimRange *ScalarShapeFunctionSet::numberShapeFunctions > LocalBlockIndices
Definition: discontinuousgalerkin/space.hh:78
GridPart GridPartType
Definition: discontinuousgalerkin/space.hh:40
DefaultBasisFunctionSets< GridPartType, ShapeFunctionSetsType > BasisFunctionSetsType
Definition: discontinuousgalerkin/space.hh:73
static const int codimension
Definition: discontinuousgalerkin/space.hh:43
VectorialShapeFunctionSets< ScalarShapeFunctionSetsType, typename FunctionSpaceType::RangeType > ShapeFunctionSetsType
Definition: discontinuousgalerkin/space.hh:71
Definition: discontinuousgalerkin/space.hh:52
Dune::Fem::OrthonormalShapeFunctionSet< ScalarShapeFunctionSpaceType > BaseType
Definition: discontinuousgalerkin/space.hh:53
ScalarShapeFunctionSet(Dune::GeometryType type)
Definition: discontinuousgalerkin/space.hh:58
static constexpr unsigned int size()
Definition: discontinuousgalerkin/space.hh:65
static constexpr int numberShapeFunctions
Definition: discontinuousgalerkin/space.hh:55
Definition: discontinuousgalerkin/space.hh:82
Operation OperationType
Definition: discontinuousgalerkin/space.hh:83
DefaultCommunicationHandler< DiscreteFunction, Operation > Type
Definition: discontinuousgalerkin/space.hh:84
mapper allocating one DoF per subentity of a given codimension
Definition: codimensionmapper.hh:330
Definition: space/shapefunctionset/orthonormal.hh:67
constexpr std::size_t size() const
return number of shape functions
Definition: space/shapefunctionset/orthonormal.hh:209