VTK
FieldTypeToType.h
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // Copyright (c) Kitware, Inc.
4 // All rights reserved.
5 // See LICENSE.txt for details.
6 //
7 // This software is distributed WITHOUT ANY WARRANTY; without even
8 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9 // PURPOSE. See the above copyright notice for more information.
10 //
11 // Copyright 2012 Sandia Corporation.
12 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
13 // the U.S. Government retains certain rights in this software.
14 //
15 //=============================================================================
16 
17 #ifndef vtkToDax_FieldTypeToType_h
18 #define vtkToDax_FieldTypeToType_h
19 
20 #include <stdint.h>
21 
22 class vtkIntArray;
23 class vtkIdTypeArray;
24 class vtkFloatArray;
26 
27 #include <dax/Types.h>
28 
29 namespace vtkToDax
30 {
31 
32 namespace internal {
33 
34 template<int NUM_COMP>
35 struct IdType
36 {
37  static const int NUM_COMPONENTS = NUM_COMP;
38  typedef dax::Tuple<dax::Id,NUM_COMPONENTS> DaxValueType;
39  typedef dax::Id DaxComponentType;
40 };
41 
42 template<>
43 struct IdType<1>
44 {
45  static const int NUM_COMPONENTS = 1;
46  typedef dax::Id DaxValueType;
47  typedef dax::Id DaxComponentType;
48 };
49 
50 template<int NUM_COMP>
51 struct ScalarType
52 {
53  static const int NUM_COMPONENTS = NUM_COMP;
54  typedef dax::Tuple<dax::Scalar,NUM_COMPONENTS> DaxValueType;
55  typedef dax::Scalar DaxComponentType;
56 };
57 
58 template<>
59 struct ScalarType<1>
60 {
61  static const int NUM_COMPONENTS = 1;
62  typedef dax::Scalar DaxValueType;
63  typedef dax::Scalar DaxComponentType;
64 };
65 
66 } // namespace internal
67 
68 template<typename VTKArrayType, int NUM_COMP> struct FieldTypeToType;
69 
70 template<int NUM_COMP>
71 struct FieldTypeToType<vtkIntArray,NUM_COMP> : internal::IdType<NUM_COMP>
72 {
73  typedef int VTKComponentType;
74 };
75 
76 template<int NUM_COMP>
77 struct FieldTypeToType<vtkIdTypeArray,NUM_COMP> : internal::IdType<NUM_COMP>
78 {
80 };
81 
82 
83 template<int NUM_COMP>
85 {
86  typedef float VTKComponentType;
87 };
88 
89 template<int NUM_COMP>
91 {
92  typedef double VTKComponentType;
93 };
94 
95 template<int NUM_COMP>
97 {
98  static const int NUM_COMPNENTS = NUM_COMP;
99  typedef dax::Tuple<uint8_t,NUM_COMPNENTS> DaxValueType;
100  typedef uint8_t DaxComponentType;
101  typedef uint8_t VTKComponentType;
102 };
103 
104 template<>
106 {
107  static const int NUM_COMPNENTS = 1;
108  typedef uint8_t DaxValueType;
109  typedef uint8_t DaxComponentType;
110  typedef uint8_t VTKComponentType;
111 };
112 }
113 
114 #endif // vtkToDax_FieldTypeToType_h
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
dax::Tuple< dax::Id, NUM_COMPONENTS > DaxValueType
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:287
dynamic, self-adjusting array of double
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
static const int NUM_COMPONENTS
dynamic, self-adjusting array of unsigned char
dax::Tuple< dax::Scalar, NUM_COMPONENTS > DaxValueType