dune-pdelab  2.4-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 #include <dune/common/documentation.hh>
8 #include <cstddef>
9 
10 namespace Dune {
11 
12  namespace PDELab {
13 
14  namespace istl {
15 
16  // ********************************************************************************
17  // tag definitions
18  // ********************************************************************************
19 
20  namespace tags {
21 
23  struct block_vector
24  {
26  };
27 
30  {
32  };
33 
35 
43  struct field_vector
44  {
47  };
48 
51  : public field_vector
52  {};
53 
56  : public field_vector
57  {};
58 
60  struct bcrs_matrix
61  {
63  };
64 
67  {
69  };
70 
72 
80  struct field_matrix
81  {
84  };
85 
88  {};
89 
92  {};
93 
96  {};
97 
100  {};
101 
104  : public field_matrix
105  , public field_matrix_1_any
106  , public field_matrix_any_1
107  {};
108 
111  : public field_matrix
112  , public field_matrix_n_any
113  , public field_matrix_any_1
114  {};
115 
118  : public field_matrix
119  , public field_matrix_1_any
120  , public field_matrix_any_m
121  {};
122 
125  : public field_matrix
126  , public field_matrix_n_any
127  , public field_matrix_any_m
128  {};
129 
130 
131  // ********************************************************************************
132  // Tag extraction
133  // ********************************************************************************
134 
135 #ifdef DOXYGEN
136 
138 
141  template<typename T>
142  struct container
143  {
145  typedef ImplementationDefined type;
146  };
147 
148 #else // DOXYGEN
149 
150  // There is no standard implementation.
151  template<typename T>
152  struct container;
153 
154 
155  template<typename Block, typename Alloc>
156  struct container<Dune::BlockVector<Block,Alloc> >
157  {
158  typedef block_vector type;
159  };
160 
161 
162  // DynamicVector grew allocator support some time after the 2.3 release,
163  // so we have to adjust the forward declaration accordingly
164 
165 #if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
166 
167  template<typename F, typename Allocator>
168  struct container<DynamicVector<F,Allocator> >
169  {
170  typedef dynamic_vector type;
171  };
172 
173 #else
174 
175  template<typename F>
176  struct container<DynamicVector<F> >
177  {
178  typedef dynamic_vector type;
179  };
180 
181 #endif
182 
183  template<typename F, int n>
184  struct container<FieldVector<F,n> >
185  {
186  typedef field_vector_n type;
187  };
188 
189  template<typename F>
190  struct container<FieldVector<F,1> >
191  {
192  typedef field_vector_1 type;
193  };
194 
195 
196  template<typename Block, typename Alloc>
197  struct container<Dune::BCRSMatrix<Block,Alloc> >
198  {
199  typedef bcrs_matrix type;
200  };
201 
202  template<typename F>
203  struct container<DynamicMatrix<F> >
204  {
205  typedef dynamic_matrix type;
206  };
207 
208  template<typename F, int n, int m>
209  struct container<FieldMatrix<F,n,m> >
210  {
211  typedef field_matrix_n_m type;
212  };
213 
214  template<typename F, int n>
215  struct container<FieldMatrix<F,n,1> >
216  {
217  typedef field_matrix_n_1 type;
218  };
219 
220  template<typename F, int m>
221  struct container<FieldMatrix<F,1,m> >
222  {
223  typedef field_matrix_1_m type;
224  };
225 
226  template<typename F>
227  struct container<FieldMatrix<F,1,1> >
228  {
229  typedef field_matrix_1_1 type;
230  };
231 
232 #endif // DOXYGEN
233 
234  } // namespace tags
235 
237 
245  template<typename T>
247  {
248  return typename tags::container<T>::type();
249  }
250 
251  } // namespace istl
252 
253  } // namespace PDELab
254 } // namespace Dune
255 
256 
257 
258 #endif // DUNE_PDELAB_BACKEND_ISTL_TAGS_HH
ImplementationDefined type
The container tag associated with T.
Definition: backend/istl/tags.hh:145
Tag describing a FieldMatrix with arbitrary row block size and column block size 1.
Definition: backend/istl/tags.hh:95
tags::container< T >::type container_tag(const T &)
Gets instance of container tag associated with T.
Definition: backend/istl/tags.hh:246
Tag describing a FieldMatrix with row block size 1 and arbitrary column block size.
Definition: backend/istl/tags.hh:87
Tag describing a BlockVector.
Definition: backend/istl/tags.hh:23
Tag describing a FieldMatrix with row block size > 1 and arbitrary column block size.
Definition: backend/istl/tags.hh:91
Tag describing a field vector with block size 1.
Definition: backend/istl/tags.hh:50
Tag describing a FieldMatrix with row block size 1 and column block size > 1.
Definition: backend/istl/tags.hh:117
Tag describing a DynamicVector.
Definition: backend/istl/tags.hh:29
bcrs_matrix base_tag
Definition: backend/istl/tags.hh:62
Tag describing a FieldMatrix with row block size 1 and column block size 1.
Definition: backend/istl/tags.hh:103
Tag describing a BCRSMatrix.
Definition: backend/istl/tags.hh:60
Tag describing a FieldMatrix with row block size > 1 and column block size 1.
Definition: backend/istl/tags.hh:110
Tag describing a DynamicMatrix.
Definition: backend/istl/tags.hh:66
dynamic_matrix base_tag
Definition: backend/istl/tags.hh:68
Definition: istl/vector.hh:25
field_vector base_tag
Base tag for this tag category.
Definition: backend/istl/tags.hh:46
Tag describing an arbitrary FieldVector.
Definition: backend/istl/tags.hh:43
dynamic_vector base_tag
Definition: backend/istl/tags.hh:31
Definition: adaptivity.hh:27
block_vector base_tag
Definition: backend/istl/tags.hh:25
Tag describing an arbitrary FieldMatrix.
Definition: backend/istl/tags.hh:80
Tag describing a FieldMatrix with arbitrary row block size and column block size > 1...
Definition: backend/istl/tags.hh:99
Tag describing a field vector with block size > 1.
Definition: backend/istl/tags.hh:55
field_matrix base_tag
Base tag for this tag category.
Definition: backend/istl/tags.hh:83
Tag describing a FieldMatrix with row block size > 1 and column block size > 1.
Definition: backend/istl/tags.hh:124
Extracts the container tag from T.
Definition: backend/istl/tags.hh:142