OpenFPM  5.2.0
Project that contain the implementation of distributed structures
is_vtk_writable.hpp
1 /*
2  * is_vtk_writable.hpp
3  *
4  * Created on: Jul 18, 2016
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_IO_SRC_VTKWRITER_IS_VTK_WRITABLE_HPP_
9 #define OPENFPM_IO_SRC_VTKWRITER_IS_VTK_WRITABLE_HPP_
10 
12 template<typename T, bool is_w>
13 struct vtk_type
14 {
16  typedef decltype(std::declval<T>().get_vtk(0)) type;
17 };
18 
20 template<typename T>
21 struct vtk_type<T,false>
22 {
24  typedef void type;
25 };
26 
31 template<typename ObjType, typename Sfinae = void>
32 struct is_custom_vtk_writable: std::false_type {};
33 
39 template<typename ObjType>
40 struct is_custom_vtk_writable <ObjType, typename Void< typename ObjType::is_vtk_writable >::type> : std::true_type
41 {};
42 
47 template<typename ObjType, typename Sfinae = void>
48 struct is_vtk_vector_dims: std::false_type {};
49 
51 template<typename ObjType, bool has_dims = is_vtk_vector_dims<ObjType>::value >
52 struct vtk_dims
53 {
55  enum
56  {
57  value = 1
58  };
59 };
60 
62 template<typename ObjType >
63 struct vtk_dims<ObjType,true>
64 {
67  enum
68  {
69  value = ObjType::dims
70  };
71 };
72 
78 template<typename ObjType>
79 struct is_vtk_vector_dims<ObjType, typename Void< decltype(ObjType::dims) >::type> : std::true_type
80 {};
81 
83 template<typename T>
85 {
86  typedef T base;
87 
89  enum
90  {
92  };
93 };
94 
96 template<>
97 struct is_vtk_writable<float>
98 {
99  typedef float base;
100 
102  enum
103  {
104  value = true
105  };
106 };
107 
109 template<>
110 struct is_vtk_writable<double>
111 {
112  typedef double base;
113 
115  enum
116  {
117  value = true
118  };
119 };
120 
122 template<>
123 struct is_vtk_writable<char>
124 {
125  typedef char base;
126 
128  enum
129  {
130  value = true
131  };
132 };
133 
135 template<>
136 struct is_vtk_writable<unsigned char>
137 {
138  typedef unsigned char base;
139 
141  enum
142  {
143  value = true
144  };
145 };
146 
148 template<>
149 struct is_vtk_writable<short>
150 {
151  typedef short base;
152 
154  enum
155  {
156  value = true
157  };
158 };
159 
161 template<>
162 struct is_vtk_writable<unsigned short>
163 {
164  typedef unsigned short base;
165 
167  enum
168  {
169  value = true
170  };
171 };
172 
174 template<>
176 {
177  typedef int base;
178 
180  enum
181  {
182  value = true
183  };
184 };
185 
187 template<>
188 struct is_vtk_writable<unsigned int>
189 {
190  typedef unsigned int base;
191 
193  enum
194  {
195  value = true
196  };
197 };
198 
200 template<>
201 struct is_vtk_writable<long int>
202 {
203  typedef int base;
204 
206  enum
207  {
208  value = true
209  };
210 };
211 
213 template<>
214 struct is_vtk_writable<unsigned long int>
215 {
216  typedef unsigned int base;
217 
219  enum
220  {
221  value = true
222  };
223 };
224 
226 template<>
227 struct is_vtk_writable<bool>
228 {
229  typedef bool base;
230 
232  enum
233  {
234  value = true
235  };
236 };
237 
238 #endif /* OPENFPM_IO_SRC_VTKWRITER_IS_VTK_WRITABLE_HPP_ */
is_custom_vtk_writable
it check if the type is vtk writable
Definition: is_vtk_writable.hpp:32
cub::int
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
Definition: dispatch_radix_sort.cuh:336
is_vtk_vector_dims
it check if the type is vtk writable
Definition: is_vtk_writable.hpp:48
vtk_type< T, false >::type
void type
non writable vtk property (so void)
Definition: is_vtk_writable.hpp:24
is_vtk_writable
check for T to be writable
Definition: is_vtk_writable.hpp:84
vtk_type
the vtk type
Definition: is_vtk_writable.hpp:13
vtk_type::type
decltype(std::declval< T >().get_vtk(0)) typedef type
get the vtk type for the property
Definition: is_vtk_writable.hpp:16
Void
Void structure.
Definition: common.hpp:73
vtk_dims
If it has not dims property defined the object is considered scalar.
Definition: is_vtk_writable.hpp:52