dune-pdelab  2.7-git
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  template<typename F, typename Allocator>
166  struct container<DynamicVector<F,Allocator> >
167  {
168  typedef dynamic_vector type;
169  };
170 
171  template<typename F, int n>
172  struct container<FieldVector<F,n> >
173  {
174  typedef field_vector_n type;
175  };
176 
177  template<typename F>
178  struct container<FieldVector<F,1> >
179  {
180  typedef field_vector_1 type;
181  };
182 
183 
184  template<typename Block, typename Alloc>
185  struct container<Dune::BCRSMatrix<Block,Alloc> >
186  {
187  typedef bcrs_matrix type;
188  };
189 
190  template<typename F>
191  struct container<DynamicMatrix<F> >
192  {
193  typedef dynamic_matrix type;
194  };
195 
196  template<typename F, int n, int m>
197  struct container<FieldMatrix<F,n,m> >
198  {
199  typedef field_matrix_n_m type;
200  };
201 
202  template<typename F, int n>
203  struct container<FieldMatrix<F,n,1> >
204  {
205  typedef field_matrix_n_1 type;
206  };
207 
208  template<typename F, int m>
209  struct container<FieldMatrix<F,1,m> >
210  {
211  typedef field_matrix_1_m type;
212  };
213 
214  template<typename F>
215  struct container<FieldMatrix<F,1,1> >
216  {
217  typedef field_matrix_1_1 type;
218  };
219 
220 #endif // DOXYGEN
221 
222  } // namespace tags
223 
225 
233  template<typename T>
235  {
236  return typename tags::container<T>::type();
237  }
238 
239  } // namespace ISTL
240 
241  } // namespace PDELab
242 } // namespace Dune
243 
244 
245 
246 #endif // DUNE_PDELAB_BACKEND_ISTL_TAGS_HH
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
tags::container< T >::type container_tag(const T &)
Gets instance of container tag associated with T.
Definition: backend/istl/tags.hh:234
Tag describing a BlockVector.
Definition: backend/istl/tags.hh:24
block_vector base_tag
Definition: backend/istl/tags.hh:25
Tag describing a DynamicVector.
Definition: backend/istl/tags.hh:30
dynamic_vector base_tag
Definition: backend/istl/tags.hh:31
Tag describing an arbitrary FieldVector.
Definition: backend/istl/tags.hh:44
field_vector base_tag
Base tag for this tag category.
Definition: backend/istl/tags.hh:46
Tag describing a field vector with block size 1.
Definition: backend/istl/tags.hh:52
Tag describing a field vector with block size > 1.
Definition: backend/istl/tags.hh:57
Tag describing a BCRSMatrix.
Definition: backend/istl/tags.hh:61
bcrs_matrix base_tag
Definition: backend/istl/tags.hh:62
Tag describing a DynamicMatrix.
Definition: backend/istl/tags.hh:67
dynamic_matrix base_tag
Definition: backend/istl/tags.hh:68
Tag describing an arbitrary FieldMatrix.
Definition: backend/istl/tags.hh:81
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 arbitrary column block size.
Definition: backend/istl/tags.hh:88
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:96
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 column block size 1.
Definition: backend/istl/tags.hh:107
Tag describing a FieldMatrix with row block size > 1 and column block size 1.
Definition: backend/istl/tags.hh:114
Tag describing a FieldMatrix with row block size 1 and column block size > 1.
Definition: backend/istl/tags.hh:121
Tag describing a FieldMatrix with row block size > 1 and column block size > 1.
Definition: backend/istl/tags.hh:128
Extracts the container tag from T.
Definition: backend/istl/tags.hh:143
ImplementationDefined type
The container tag associated with T.
Definition: backend/istl/tags.hh:145
Definition: istl/vector.hh:30