DUNE-FEM (unstable)

space.hh
1#ifndef DUNE_FEM_SPACE_FOURIER_SPACE_HH
2#define DUNE_FEM_SPACE_FOURIER_SPACE_HH
3
4#include <cassert>
5#include <limits>
6
7#include <dune/fem/common/hybrid.hh>
8#include <dune/fem/function/common/functionset.hh>
9#include <dune/fem/function/localfunction/localfunctionsetadapter.hh>
10#include <dune/fem/space/basisfunctionset/simple.hh>
11#include <dune/fem/space/basisfunctionset/vectorial.hh>
12#include <dune/fem/space/common/defaultcommhandler.hh>
13#include <dune/fem/space/common/discretefunctionspace.hh>
14#include <dune/fem/space/mapper/codimensionmapper.hh>
15#include <dune/fem/space/mapper/nonblockmapper.hh>
16
17#include <dune/fem/space/fourier/capabilities.hh>
18#include <dune/fem/space/fourier/declaration.hh>
19#include <dune/fem/space/fourier/dofmapper.hh>
20#include <dune/fem/space/fourier/functionset.hh>
21#include <dune/fem/space/fourier/interpolate.hh>
22
23namespace Dune
24{
25
26 namespace Fem
27 {
28
29 // FourierDiscreteFunctionSpaceTraits
30 // ----------------------------------
31
32 template< class FunctionSpace, class GridPart, int order >
33 struct FourierDiscreteFunctionSpaceTraits
34 {
35 typedef FourierDiscreteFunctionSpace< FunctionSpace, GridPart, order > DiscreteFunctionSpaceType;
36
37 typedef GridPart GridPartType;
38 typedef GridFunctionSpace< GridPartType, FunctionSpace > FunctionSpaceType;
39
40 static const int codimension = 0;
41 typedef typename GridPartType::template Codim< codimension >::EntityType EntityType;
42
43 typedef typename FunctionSpaceType::ScalarFunctionSpaceType ScalarFunctionSpaceType;
44 typedef FourierFunctionSet< ScalarFunctionSpaceType, order > FunctionSetType;
45 typedef FunctionSetProxy< FunctionSetType > FunctionSetProxyType;
46 typedef LocalFunctionSetAdapter< EntityType, FunctionSetProxyType > LocalFunctionSetType;
47 typedef SimpleBasisFunctionSet< LocalFunctionSetType > ScalarBasisFunctionSetType;
48
49 typedef VectorialBasisFunctionSet< ScalarBasisFunctionSetType, typename FunctionSpaceType::RangeType > BasisFunctionSetType;
50
51 typedef Hybrid::IndexRange< int, FunctionSpaceType::dimRange * FourierFunctionSetSize< FunctionSpaceType::dimDomain, order >::v > LocalBlockIndices;
52
53 typedef FourierDofMapper< GridPartType, order > BlockMapperType;
54
55 template< class DiscreteFunction, class Operation = Dune::Fem::DFCommunicationOperation::Add >
56 struct CommDataHandle
57 {
59 typedef Operation OperationType;
60 };
61 };
62
63
64
65 // FourierDiscreteFunctionSpace
66 // ----------------------------
67
68 template< class FunctionSpace, class GridPart, int Order >
69 class FourierDiscreteFunctionSpace
70 : public DiscreteFunctionSpaceDefault< FourierDiscreteFunctionSpaceTraits< FunctionSpace, GridPart, Order > >
71 {
72 typedef FourierDiscreteFunctionSpaceTraits< FunctionSpace, GridPart, Order > ThisType;
73 typedef DiscreteFunctionSpaceDefault< FourierDiscreteFunctionSpaceTraits< FunctionSpace, GridPart, Order > > BaseType;
74
75 public:
76 typedef typename BaseType::Traits Traits;
77
78 static const int polynomialOrder = Order+1;
79
81 typedef typename BaseType::GridPartType GridPartType;
82 typedef typename BaseType::EntityType EntityType;
83 typedef typename BaseType::IntersectionType IntersectionType;
84
85 typedef typename Traits::FunctionSetType FunctionSetType;
86
87 typedef typename Traits::ScalarBasisFunctionSetType ScalarBasisFunctionSetType;
88 typedef typename BaseType::BasisFunctionSetType BasisFunctionSetType;
89
90 typedef typename BaseType::BlockMapperType BlockMapperType;
91
92 protected:
93 static const InterfaceType defaultInterface = InteriorBorder_All_Interface;
94 static const CommunicationDirection defaultDirection = ForwardCommunication;
95
96 public:
97 using BaseType::order;
98
99 explicit FourierDiscreteFunctionSpace ( GridPartType &gridPart,
101 const InterfaceType commInterface = defaultInterface,
102 const CommunicationDirection commDirection = defaultDirection )
103 : BaseType( gridPart, commInterface, commDirection ),
104 functionSet_( order )
105 {}
106
108 DFSpaceIdentifier type () const { return FourierSpace_id; }
109
111 BasisFunctionSetType basisFunctionSet ( const EntityType &entity ) const
112 {
113 typedef typename Traits::LocalFunctionSetType LocalFunctionSetType;
114 typedef typename Traits::ScalarBasisFunctionSetType ScalarBasisFunctionSetType;
115 return BasisFunctionSetType( ScalarBasisFunctionSetType( LocalFunctionSetType( entity, &functionSet_ ) ) );
116 }
117
119 bool continuous () const { return true; }
120
122 bool continuous ( const IntersectionType &intersection ) const { return true; }
123
125 int order () const { return functionSet_.order(); }
126
128 BlockMapperType &blockMapper () const { return blockMapper_; }
129
130 const FunctionSetType &functionSet () const { return functionSet_; }
131
132 private:
133 mutable BlockMapperType blockMapper_;
134 FunctionSetType functionSet_;
135 };
136
137 } // namespace Fem
138
139} // namespace Dune
140
141#endif // #ifndef DUNE_FEM_SPACE_FOURIER_SPACE_HH
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:38
int order(const EntityType &entity) const
default implementation of the method order
Definition: discretefunctionspace.hh:748
Traits::FunctionSpaceType FunctionSpaceType
type of function space
Definition: discretefunctionspace.hh:194
Traits::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discretefunctionspace.hh:201
GridPartType::IntersectionType IntersectionType
type of the intersections
Definition: discretefunctionspace.hh:226
const BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: discretefunctionspace.hh:307
int order() const
get global order of space
Definition: discretefunctionspace.hh:346
FunctionSpaceTraits::ScalarFunctionSpaceType ScalarFunctionSpaceType
corresponding scalar function space
Definition: functionspaceinterface.hh:83
A vector valued function space.
Definition: functionspace.hh:60
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:95
@ FourierSpace_id
id for Fourier space
Definition: discretefunctionspace.hh:100
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
@ InteriorBorder_All_Interface
send interior and border, receive all entities
Definition: gridenums.hh:88
constexpr auto max
Function object that returns the greater of the given values.
Definition: hybridutilities.hh:484
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)