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