dune-fem 2.12-git
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
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
64
67 // this ctor is problematic: assume that one space is a DynamicLS
68 // then this constructor uses some default order (=1) silently.
69 // Not sure if we want that.
78 const InterfaceType commInterface = defaultInterface,
79 const CommunicationDirection commDirection = defaultDirection )
80 : BaseType( gridPart, commInterface, commDirection ),
81 spaceTuple_( Traits::createSpaces( gridPart, commInterface, commDirection ) ),
82 blockMapper_( Traits::getBlockMapper( spaceTuple_ ) )
83 {}
84
85 protected:
86
87 GenericCombinedDiscreteFunctionSpace ( DiscreteFunctionSpaceTupleType &&spaceTuple )
88 : BaseType(
92 spaceTuple_( std::move( spaceTuple ) ),
93 blockMapper_( Traits::getBlockMapper( spaceTuple_ ) )
94 {}
95
96 public:
97
99 ThisType &operator= ( const ThisType & ) = delete;
100
101 using BaseType::gridPart;
102
104 bool contains ( const int codim ) const
105 {
106 // forward to mapper since this information is held there
107 return blockMapper().contains( codim );
108 }
109
111 bool continuous () const
112 {
113 return Traits::accumulate( spaceTuple_, true, [] ( bool c, const auto &s ) { return c && s.continuous(); } );
114 }
115
117 bool continuous ( const IntersectionType &intersection ) const
118 {
119 return Traits::accumulate( spaceTuple_, true, [ &intersection ] ( bool c, const auto &s ) { return c && s.continuous( intersection ); } );
120 }
121
126 {
127 return DFSpaceIdentifier( -1 );
128 }
129
131 int order () const
132 {
133 return Traits::accumulate( spaceTuple_, int( 0 ), [] ( int o, const auto &s ) { return std::max( o, s.order() ); } );
134 }
135
137 template< class Entity >
138 int order ( const Entity &entity ) const
139 {
140 return Traits::accumulate( spaceTuple_, int( 0 ), [ &entity ] ( int o, const auto &s ) { return std::max( o, s.order( entity ) ); } );
141 }
142
144 template< class EntityType >
146 {
147 return Traits::getBasisFunctionSet( entity, spaceTuple_ );
148 }
149
154 {
155 return *blockMapper_;
156 }
157
159 template< int i >
164 private:
166 DiscreteFunctionSpaceTupleType spaceTuple_;
167
170 };
171
172 } // namespace Fem
173
174} // namespace Dune
175
176#endif // #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_GENERIC_HH
CommunicationDirection
InterfaceType
ForwardCommunication
InteriorBorder_All_Interface
DFSpaceIdentifier
enumerator for identification of spaces
Definition discretefunctionspace.hh:95
STL namespace.
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:117
bool continuous() const
returns true if the space contains only globally continuous functions
Definition combinedspace/generic.hh:111
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:87
BlockMapperType & blockMapper() const
obtain the DoF block mapper of this space
Definition combinedspace/generic.hh:153
ThisType & operator=(const ThisType &)=delete
GenericCombinedDiscreteFunctionSpace(const ThisType &)=delete
Traits::IteratorType IteratorType
Definition combinedspace/generic.hh:41
@ dimension
Definition combinedspace/generic.hh:43
DFSpaceIdentifier type() const
get the type of this discrete function space
Definition combinedspace/generic.hh:125
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:160
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:77
int order(const Entity &entity) const
get global order of space
Definition combinedspace/generic.hh:138
int order() const
get global order of space
Definition combinedspace/generic.hh:131
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:145
bool contains(const int codim) const
Definition combinedspace/generic.hh:104
GridPartType::IntersectionType IntersectionType
Definition combinedspace/generic.hh:38
typename Traits::template SubDiscreteFunctionSpace< i > SubDiscreteFunctionSpace
Definition combinedspace/generic.hh:32
Definition dofmanager.hh:786
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition discretefunctionspace.hh:649
BaseType::EntityType EntityType
Definition discretefunctionspace.hh:665
InterfaceType communicationInterface() const
return the communication interface appropriate for this space
Definition discretefunctionspace.hh:855
GridPartType & gridPart() const
Definition discretefunctionspace.hh:766
CommunicationDirection communicationDirection() const
return the communication interface appropriate for this space
Definition discretefunctionspace.hh:861
Traits Traits
Definition discretefunctionspace.hh:651
T max(T... args)