dune-pdelab  2.5-dev
backend/istl/tags.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=8 sw=2 sts=2:
3 #ifndef DUNE_PDELAB_BACKEND_ISTL_TAGS_HH
4 #define DUNE_PDELAB_BACKEND_ISTL_TAGS_HH
5 
6 // this is here for backwards compatibility and deprecation warnings, remove after 2.5.0
7 #include "ensureistlinclude.hh"
8 
9 #include <dune/common/documentation.hh>
11 #include <cstddef>
12 
13 namespace Dune {
14 
15  namespace PDELab {
16 
17  namespace ISTL {
18 
19  // ********************************************************************************
20  // tag definitions
21  // ********************************************************************************
22 
23  namespace tags {
24 
26  struct block_vector
27  {
29  };
30 
33  {
35  };
36 
38 
46  struct field_vector
47  {
50  };
51 
54  : public field_vector
55  {};
56 
59  : public field_vector
60  {};
61 
63  struct bcrs_matrix
64  {
66  };
67 
70  {
72  };
73 
75 
83  struct field_matrix
84  {
87  };
88 
91  {};
92 
95  {};
96 
99  {};
100 
103  {};
104 
107  : public field_matrix
108  , public field_matrix_1_any
109  , public field_matrix_any_1
110  {};
111 
114  : public field_matrix
115  , public field_matrix_n_any
116  , public field_matrix_any_1
117  {};
118 
121  : public field_matrix
122  , public field_matrix_1_any
123  , public field_matrix_any_m
124  {};
125 
128  : public field_matrix
129  , public field_matrix_n_any
130  , public field_matrix_any_m
131  {};
132 
133 
134  // ********************************************************************************
135  // Tag extraction
136  // ********************************************************************************
137 
138 #ifdef DOXYGEN
139 
141 
144  template<typename T>
145  struct container
146  {
148  typedef ImplementationDefined type;
149  };
150 
151 #else // DOXYGEN
152 
153  // There is no standard implementation.
154  template<typename T>
155  struct container;
156 
157 
158  template<typename Block, typename Alloc>
159  struct container<Dune::BlockVector<Block,Alloc> >
160  {
161  typedef block_vector type;
162  };
163 
164 
165  // DynamicVector grew allocator support some time after the 2.3 release,
166  // so we have to adjust the forward declaration accordingly
167 
168 #if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
169 
170  template<typename F, typename Allocator>
171  struct container<DynamicVector<F,Allocator> >
172  {
173  typedef dynamic_vector type;
174  };
175 
176 #else
177 
178  template<typename F>
179  struct container<DynamicVector<F> >
180  {
181  typedef dynamic_vector type;
182  };
183 
184 #endif
185 
186  template<typename F, int n>
187  struct container<FieldVector<F,n> >
188  {
189  typedef field_vector_n type;
190  };
191 
192  template<typename F>
193  struct container<FieldVector<F,1> >
194  {
195  typedef field_vector_1 type;
196  };
197 
198 
199  template<typename Block, typename Alloc>
200  struct container<Dune::BCRSMatrix<Block,Alloc> >
201  {
202  typedef bcrs_matrix type;
203  };
204 
205  template<typename F>
206  struct container<DynamicMatrix<F> >
207  {
208  typedef dynamic_matrix type;
209  };
210 
211  template<typename F, int n, int m>
212  struct container<FieldMatrix<F,n,m> >
213  {
214  typedef field_matrix_n_m type;
215  };
216 
217  template<typename F, int n>
218  struct container<FieldMatrix<F,n,1> >
219  {
220  typedef field_matrix_n_1 type;
221  };
222 
223  template<typename F, int m>
224  struct container<FieldMatrix<F,1,m> >
225  {
226  typedef field_matrix_1_m type;
227  };
228 
229  template<typename F>
230  struct container<FieldMatrix<F,1,1> >
231  {
232  typedef field_matrix_1_1 type;
233  };
234 
235 #endif // DOXYGEN
236 
237  } // namespace tags
238 
240 
248  template<typename T>
250  {
251  return typename tags::container<T>::type();
252  }
253 
254  } // namespace ISTL
255 
256  } // namespace PDELab
257 } // namespace Dune
258 
259 
260 
261 #endif // DUNE_PDELAB_BACKEND_ISTL_TAGS_HH
Tag describing a BCRSMatrix.
Definition: backend/istl/tags.hh:63
Tag describing a FieldMatrix with row block size 1 and column block size > 1.
Definition: backend/istl/tags.hh:120
Definition: bcrsmatrix.hh:20
Tag describing an arbitrary FieldVector.
Definition: backend/istl/tags.hh:46
Tag describing a FieldMatrix with arbitrary row block size and column block size > 1...
Definition: backend/istl/tags.hh:102
Tag describing a FieldMatrix with row block size 1 and arbitrary column block size.
Definition: backend/istl/tags.hh:90
block_vector base_tag
Definition: backend/istl/tags.hh:28
Extracts the container tag from T.
Definition: backend/istl/tags.hh:145
Tag describing a FieldMatrix with row block size > 1 and column block size 1.
Definition: backend/istl/tags.hh:113
Definition: istl/vector.hh:28
Tag describing a field vector with block size > 1.
Definition: backend/istl/tags.hh:58
Tag describing a DynamicVector.
Definition: backend/istl/tags.hh:32
Tag describing a DynamicMatrix.
Definition: backend/istl/tags.hh:69
ImplementationDefined type
The container tag associated with T.
Definition: backend/istl/tags.hh:148
Tag describing a field vector with block size 1.
Definition: backend/istl/tags.hh:53
field_vector base_tag
Base tag for this tag category.
Definition: backend/istl/tags.hh:49
dynamic_matrix base_tag
Definition: backend/istl/tags.hh:71
bcrs_matrix base_tag
Definition: backend/istl/tags.hh:65
Tag describing a FieldMatrix with arbitrary row block size and column block size 1.
Definition: backend/istl/tags.hh:98
Tag describing an arbitrary FieldMatrix.
Definition: backend/istl/tags.hh:83
field_matrix base_tag
Base tag for this tag category.
Definition: backend/istl/tags.hh:86
dynamic_vector base_tag
Definition: backend/istl/tags.hh:34
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
Tag describing a FieldMatrix with row block size > 1 and column block size > 1.
Definition: backend/istl/tags.hh:127
Tag describing a FieldMatrix with row block size 1 and column block size 1.
Definition: backend/istl/tags.hh:106
tags::container< T >::type container_tag(const T &)
Gets instance of container tag associated with T.
Definition: backend/istl/tags.hh:249
Tag describing a BlockVector.
Definition: backend/istl/tags.hh:26
Tag describing a FieldMatrix with row block size > 1 and arbitrary column block size.
Definition: backend/istl/tags.hh:94