DUNE-FEM (unstable)

combineddofstorage.hh
1#ifndef DUNE_FEM_COMBINEDDOFSTORAGE_HH
2#define DUNE_FEM_COMBINEDDOFSTORAGE_HH
3
4//- local includes
5#include <dune/fem/space/common/dofstorage.hh>
6#include <dune/fem/storage/subvector.hh>
7
8namespace Dune
9{
10
11 namespace Fem
12 {
13
16 template< class ContainedMapper, int N, DofStoragePolicy policy >
18
19
22 template< class ContainedMapper , int N >
23 class CombinedDofConversionUtility< ContainedMapper, N, PointBased >
25 {
27
28 public:
29 typedef ContainedMapper ContainedMapperType;
30
31 CombinedDofConversionUtility ( const ContainedMapperType & mapper, const int numComponents )
32 : BaseType( numComponents )
33 {}
34 };
35
37 template< class ContainedMapper, int N >
38 class CombinedDofConversionUtility< ContainedMapper, N, VariableBased >
39 {
40 public:
41 typedef ContainedMapper ContainedMapperType;
42
48 CombinedDofConversionUtility ( const ContainedMapperType &mapper, int size )
49 : mapper_( mapper )
50 {}
51
53 static DofStoragePolicy policy ()
54 {
55 return VariableBased;
56 }
57
59 void newSize ( int size )
60 {}
61
64 int component ( int combinedIndex ) const
65 {
66 return combinedIndex / containedSize();
67 }
68
70 int containedDof ( int combinedIndex ) const
71 {
72 return combinedIndex % containedSize();
73 }
74
77 int combinedDof ( int containedIndex, int component ) const
78 {
79 return containedIndex + (component * containedSize());
80 }
81
82 protected:
83 const ContainedMapperType &mapper_;
84
85 int containedSize () const
86 {
87 return mapper_.size();
88 }
89 };
90
91
92
93 template< class MapperImp, int N, DofStoragePolicy policy >
94 class CombinedSubMapper
95 : public Fem :: IndexMapperInterface< CombinedSubMapper< MapperImp, N, policy > >
96 {
97 typedef CombinedSubMapper< MapperImp, N , policy > ThisType;
98
99 public:
100 // original mapper
101 typedef MapperImp ContainedMapperType;
103
104 CombinedSubMapper ( const ContainedMapperType& mapper, unsigned int component )
105 : mapper_( mapper ),
106 component_( component ),
107 utilGlobal_(mapper_, policy == PointBased ? N : mapper.size() )
108 {
109 assert(component_ < N);
110 }
111
112 CombinedSubMapper(const ThisType& ) = default;
113 CombinedSubMapper(ThisType&& ) = default;
114 ThisType& operator=(const ThisType& ) = delete;
115 ThisType& operator=(ThisType&& ) = delete;
116
118 unsigned int size () const
119 {
120 return mapper_.size();
121 }
122
123 unsigned int range () const
124 {
125 return size() * N;
126 }
127
128 unsigned int operator[] ( unsigned int index ) const
129 {
130 utilGlobal_.newSize( mapper_.size() );
131 return utilGlobal_.combinedDof(index, component_);
132 }
133
134 private:
135 const ContainedMapperType& mapper_;
136 const unsigned int component_;
137 mutable DofConversionType utilGlobal_;
138 };
139
140 } // namespace Fem
141
142} // namespace Dune
143
144#endif // #ifndef DUNE_FEM_COMBINEDDOFSTORAGE_HH
void newSize(int size)
Set new size after adaptation.
Definition: combineddofstorage.hh:59
int component(int combinedIndex) const
Definition: combineddofstorage.hh:64
int combinedDof(int containedIndex, int component) const
Definition: combineddofstorage.hh:77
CombinedDofConversionUtility(const ContainedMapperType &mapper, int size)
constructor
Definition: combineddofstorage.hh:48
int containedDof(int combinedIndex) const
Number of the (scalar) base function belonging to base function index.
Definition: combineddofstorage.hh:70
static DofStoragePolicy policy()
Find out what type of policy this is.
Definition: combineddofstorage.hh:53
Definition: combineddofstorage.hh:17
Specialisation for PointBased approach.
Definition: dofstorage.hh:101
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)