dune-fem  2.4.1-rc
combineddofstorage.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_COMBINEDDOFSTORAGE_HH
2 #define DUNE_FEM_COMBINEDDOFSTORAGE_HH
3 
4 //- local includes
7 
8 namespace 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 >
24  : public PointBasedDofConversionUtility< N >
25  {
26  public:
27  typedef ContainedMapper ContainedMapperType;
28 
29  private:
31 
32  public:
33  inline CombinedDofConversionUtility ( const ContainedMapperType & mapper,
34  const int numComponents )
35  : BaseType( numComponents )
36  {}
37  };
38 
40  template< class ContainedMapper, int N >
41  class CombinedDofConversionUtility< ContainedMapper, N, VariableBased >
42  {
43  public:
44  typedef ContainedMapper ContainedMapperType;
45 
46  protected:
47  const ContainedMapperType &mapper_;
48 
49  public:
55  inline CombinedDofConversionUtility ( const ContainedMapperType &mapper,
56  int size )
57  : mapper_( mapper )
58  {}
59 
61  inline static DofStoragePolicy policy ()
62  {
63  return VariableBased;
64  }
65 
67  inline void newSize ( int size )
68  {}
69 
72  int component ( int combinedIndex ) const
73  {
74  return combinedIndex / containedSize();
75  }
76 
78  int containedDof ( int combinedIndex ) const
79  {
80  return combinedIndex % containedSize();
81  }
82 
85  int combinedDof ( int containedIndex, int component ) const
86  {
87  return containedIndex + (component * containedSize());
88  }
89 
90  protected:
91  inline int containedSize () const
92  {
93  return mapper_.size();
94  }
95  };
96 
97 
98 
99  template< class MapperImp, int N, DofStoragePolicy policy >
101  : public Fem :: IndexMapperInterface< CombinedSubMapper< MapperImp, N, policy > >
102  {
103  public:
104  //- original mapper
105  typedef MapperImp ContainedMapperType;
106 
107  private:
109 
110  public:
112 
113  public:
114  //- Public methods
115  CombinedSubMapper ( const ContainedMapperType& mapper,
116  const unsigned int component )
117  : mapper_( mapper ),
118  component_( component ),
119  utilGlobal_(mapper_,
120  policy == PointBased ?
121  N : mapper.size() )
122  {
123  assert(component_ < N);
124  }
125 
126  CombinedSubMapper(const ThisType& other) :
127  mapper_(other.mapper_),
128  component_(other.component_),
129  utilGlobal_(other.utilGlobal_)
130  {
131  assert(component_ < N);
132  }
133 
135  inline unsigned int size () const {
136  return mapper_.size();
137  }
138  inline unsigned int range () const {
139  return size() * N;
140  }
141  inline const unsigned int operator[] ( unsigned int index ) const
142  {
143  utilGlobal_.newSize( mapper_.size() );
144  return utilGlobal_.combinedDof(index, component_);
145  }
146 
147  private:
148  ThisType& operator=(const ThisType& other);
149  //- Data members
150  const ContainedMapperType& mapper_;
151  const unsigned int component_;
152  mutable DofConversionType utilGlobal_;
153  };
154 
155  } // namespace Fem
156 
157 } // namespace Dune
158 
159 #endif // #ifndef DUNE_FEM_COMBINEDDOFSTORAGE_HH
ContainedMapper ContainedMapperType
Definition: combineddofstorage.hh:44
ContainedMapper ContainedMapperType
Definition: combineddofstorage.hh:27
Specialisation for PointBased approach.
Definition: dofstorage.hh:101
int containedDof(int combinedIndex) const
Number of the (scalar) base function belonging to base function index.
Definition: combineddofstorage.hh:78
unsigned int size() const
Total number of degrees of freedom.
Definition: combineddofstorage.hh:135
CombinedDofConversionUtility(const ContainedMapperType &mapper, const int numComponents)
Definition: combineddofstorage.hh:33
int combinedDof(int containedIndex, int component) const
Definition: combineddofstorage.hh:85
Definition: dofstorage.hh:16
static DofStoragePolicy policy()
Find out what type of policy this is.
Definition: combineddofstorage.hh:61
CombinedSubMapper(const ContainedMapperType &mapper, const unsigned int component)
Definition: combineddofstorage.hh:115
const ContainedMapperType & mapper_
Definition: combineddofstorage.hh:47
unsigned int range() const
Definition: combineddofstorage.hh:138
Definition: combineddofstorage.hh:17
Definition: coordinate.hh:4
MapperImp ContainedMapperType
Definition: combineddofstorage.hh:105
CombinedDofConversionUtility< ContainedMapperType, N, policy > DofConversionType
Definition: combineddofstorage.hh:111
CombinedDofConversionUtility(const ContainedMapperType &mapper, int size)
constructor
Definition: combineddofstorage.hh:55
void newSize(int size)
Set new size after adaptation.
Definition: combineddofstorage.hh:67
Definition: dofstorage.hh:16
int containedSize() const
Definition: combineddofstorage.hh:91
Definition: combineddofstorage.hh:100
Abstract index mapper interface.
Definition: subarray.hh:16
int component(int combinedIndex) const
Definition: combineddofstorage.hh:72
CombinedSubMapper(const ThisType &other)
Definition: combineddofstorage.hh:126
DofStoragePolicy
Definition: dofstorage.hh:16