dune-fem 2.8.0
Loading...
Searching...
No Matches
combinedspace/generic.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_SPACE_COMBINEDSPACE_GENERIC_HH
2#define DUNE_FEM_SPACE_COMBINEDSPACE_GENERIC_HH
3
4#include <algorithm>
5#include <memory>
6
7#include <dune/common/hybridutilities.hh>
8
11
12namespace Dune
13{
14
15 namespace Fem
16 {
17 // GenericCombinedDiscreteFunctionSpace
18 // ------------------------------------
19
20 template< class Traits >
22 : public DiscreteFunctionSpaceDefault< Traits >
23 {
26
27 typedef typename Traits::DiscreteFunctionSpaceTupleType DiscreteFunctionSpaceTupleType;
28
29 public:
30 // type of i-th contained sub space
31 template< int i >
33
36 typedef typename Traits::GridPartType GridPartType;
37 typedef typename Traits::GridType GridType;
38 typedef typename GridPartType::IntersectionType IntersectionType;
40 typedef typename Traits::IndexSetType IndexSetType;
41 typedef typename Traits::IteratorType IteratorType;
43 enum { dimension = GridType::dimension };
44
46 typedef typename Traits::FunctionSpaceType FunctionSpaceType;
47
49 typedef typename Traits::BasisFunctionSetType BasisFunctionSetType;
50
52 typedef typename Traits::BlockMapperType BlockMapperType;
53
55 typedef int IdentifierType;
57 static const IdentifierType id = 669;
58
61
63 static const InterfaceType defaultInterface = InteriorBorder_All_Interface;
64
66 static const CommunicationDirection defaultDirection = ForwardCommunication;
67
76 const InterfaceType commInterface = defaultInterface,
77 const CommunicationDirection commDirection = defaultDirection )
78 : BaseType( gridPart, commInterface, commDirection ),
79 spaceTuple_( Traits::createSpaces( gridPart, commInterface, commDirection ) ),
80 blockMapper_( Traits::getBlockMapper( spaceTuple_ ) )
81 {}
82
83 protected:
84
85 GenericCombinedDiscreteFunctionSpace ( DiscreteFunctionSpaceTupleType &&spaceTuple )
86 : BaseType(
90 spaceTuple_( std::move( spaceTuple ) ),
91 blockMapper_( Traits::getBlockMapper( spaceTuple_ ) )
92 {}
93
94 public:
95
97 ThisType &operator= ( const ThisType & ) = delete;
98
100
102 bool contains ( const int codim ) const
103 {
104 // forward to mapper since this information is held there
105 return blockMapper().contains( codim );
106 }
107
109 bool continuous () const
110 {
111 return Traits::accumulate( spaceTuple_, true, [] ( bool c, const auto &s ) { return c && s.continuous(); } );
112 }
113
115 bool continuous ( const IntersectionType &intersection ) const
116 {
117 return Traits::accumulate( spaceTuple_, true, [ &intersection ] ( bool c, const auto &s ) { return c && s.continuous( intersection ); } );
118 }
119
124 {
125 return DFSpaceIdentifier( -1 );
126 }
127
129 int order () const
130 {
131 return Traits::accumulate( spaceTuple_, int( 0 ), [] ( int o, const auto &s ) { return std::max( o, s.order() ); } );
132 }
133
135 template< class Entity >
136 int order ( const Entity &entity ) const
137 {
138 return Traits::accumulate( spaceTuple_, int( 0 ), [ &entity ] ( int o, const auto &s ) { return std::max( o, s.order( entity ) ); } );
139 }
140
142 template< class EntityType >
144 {
145 return Traits::getBasisFunctionSet( entity, spaceTuple_ );
146 }
147
152 {
153 return *blockMapper_;
154 }
155
157 template< int i >
159 {
161 }
162
163 private:
165 DiscreteFunctionSpaceTupleType spaceTuple_;
166
168 std::unique_ptr< BlockMapperType > blockMapper_;
169 };
170
171 } // namespace Fem
172
173} // namespace Dune
174
175#endif // #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_GENERIC_HH
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:94
STL namespace.
double max(const Dune::Fem::Double &v, const double p)
Definition: double.hh:965
Definition: bindguard.hh:11
Definition: combinedspace/generic.hh:23
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: combinedspace/generic.hh:115
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: combinedspace/generic.hh:109
Traits::IndexSetType IndexSetType
extract informations about IndexSet and Iterators
Definition: combinedspace/generic.hh:40
Traits::FunctionSpaceType FunctionSpaceType
the underlaying analytical function space
Definition: combinedspace/generic.hh:46
GenericCombinedDiscreteFunctionSpace(DiscreteFunctionSpaceTupleType &&spaceTuple)
Definition: combinedspace/generic.hh:85
BlockMapperType & blockMapper() const
obtain the DoF block mapper of this space
Definition: combinedspace/generic.hh:151
ThisType & operator=(const ThisType &)=delete
GenericCombinedDiscreteFunctionSpace(const ThisType &)=delete
Traits::IteratorType IteratorType
Definition: combinedspace/generic.hh:41
DFSpaceIdentifier type() const
get the type of this discrete function space
Definition: combinedspace/generic.hh:123
Traits::BlockMapperType BlockMapperType
mapper used to for block vector function
Definition: combinedspace/generic.hh:52
static const CommunicationDirection defaultDirection
default communication direction
Definition: combinedspace/generic.hh:66
const SubDiscreteFunctionSpace< i >::Type & subDiscreteFunctionSpace() const
obtain the i-th subspace
Definition: combinedspace/generic.hh:158
static const InterfaceType defaultInterface
default communication interface
Definition: combinedspace/generic.hh:63
Traits::GridPartType GridPartType
Definition: combinedspace/generic.hh:36
DofManager< GridType > DofManagerType
type of DofManager
Definition: combinedspace/generic.hh:60
GenericCombinedDiscreteFunctionSpace(GridPartType &gridPart, const InterfaceType commInterface=defaultInterface, const CommunicationDirection commDirection=defaultDirection)
constructor
Definition: combinedspace/generic.hh:75
@ dimension
Definition: combinedspace/generic.hh:43
int order(const Entity &entity) const
get global order of space
Definition: combinedspace/generic.hh:136
int order() const
get global order of space
Definition: combinedspace/generic.hh:129
Traits::GridType GridType
Definition: combinedspace/generic.hh:37
Traits::BasisFunctionSetType BasisFunctionSetType
type of the base function set(s)
Definition: combinedspace/generic.hh:49
int IdentifierType
type of identifier for this discrete function space
Definition: combinedspace/generic.hh:55
BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
Definition: combinedspace/generic.hh:143
bool contains(const int codim) const
Definition: combinedspace/generic.hh:102
GridPartType::IntersectionType IntersectionType
Definition: combinedspace/generic.hh:38
typename Traits::template SubDiscreteFunctionSpace< i > SubDiscreteFunctionSpace
Definition: combinedspace/generic.hh:32
Definition: dofmanager.hh:761
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:628
BaseType::EntityType EntityType
Definition: discretefunctionspace.hh:644
InterfaceType communicationInterface() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:821
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:745
CommunicationDirection communicationDirection() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:827
Traits Traits
Definition: discretefunctionspace.hh:630