DefaultTypesVTK.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_cont_internal_DefaultTypesVTK_h
11 #define vtk_m_cont_internal_DefaultTypesVTK_h
12 
13 // This configures the default types to use when compiling VTK-m for use as an
14 // accelerator in VTK.
15 
16 #include <vtkm/TypeList.h>
17 
18 #include <vtkm/cont/CellSetList.h>
19 #include <vtkm/cont/StorageList.h>
20 
21 /* #undef VTKM_ADD_XGC_DEFAULT_TYPES */
22 
23 #ifdef VTKM_ADD_XGC_DEFAULT_TYPES
24 #include <vtkm/cont/ArrayHandleCartesianProduct.h>
25 #include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
26 #include <vtkm/cont/ArrayHandleXGCCoordinates.h>
27 #include <vtkm/cont/StorageList.h>
28 #endif
29 
30 namespace tovtkm
31 {
32 
33 //------------------------------------------------------------------------------
34 // All scalar types in vtkType.h
35 using VTKScalarTypes = vtkm::List< //
36  signed char, //
37  unsigned char, //
38  short, //
39  unsigned short, //
40  int, //
41  unsigned int, //
42  long long, //
43  unsigned long long, //
44  float, //
45  double, //
46  char, //
47  long, //
48  unsigned long //
49  >;
50 
52  vtkm::List<vtkm::Vec<vtkm::Vec<vtkm::Float32, 3>, 3>, vtkm::Vec<vtkm::Vec<vtkm::Float64, 3>, 3> >;
53 
54 using FieldTypeInVTK = vtkm::ListAppend<vtkm::TypeListVecCommon, VTKScalarTypes>;
55 
56 using FieldTypeOutVTK =
57  vtkm::ListAppend<vtkm::TypeListVecCommon, SpecialGradientOutTypes, VTKScalarTypes>;
58 
59 //------------------------------------------------------------------------------
61  vtkm::List<vtkm::cont::CellSetStructured<3>, vtkm::cont::CellSetStructured<2>, vtkm::cont::CellSetStructured<1> >;
63 
64 // vtkCellArray may use either 32 or 64 bit arrays to hold connectivity/offset
65 // data, so we may be using ArrayHandleCast to convert to vtkm::Ids.
66 #ifdef VTKM_USE_64BIT_IDS
67 using Int32AOSHandle = vtkm::cont::ArrayHandle<vtkm::Int32>;
68 using Int32AsIdAOSHandle = vtkm::cont::ArrayHandleCast<vtkm::Id, Int32AOSHandle>;
69 using Int32AsIdAOSStorage = typename Int32AsIdAOSHandle::StorageTag;
70 
71 using CellSetExplicit32Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
72  Int32AsIdAOSStorage, Int32AsIdAOSStorage>;
73 using CellSetExplicit64Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
74  vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic>;
75 using CellSetSingleType32Bit = vtkm::cont::CellSetSingleType<Int32AsIdAOSStorage>;
76 using CellSetSingleType64Bit = vtkm::cont::CellSetSingleType<vtkm::cont::StorageTagBasic>;
77 #else // VTKM_USE_64BIT_IDS
78 using Int64AOSHandle = vtkm::cont::ArrayHandle<vtkm::Int64, vtkm::cont::StorageTagBasic>;
79 using Int64AsIdAOSHandle = vtkm::cont::ArrayHandleCast<vtkm::Id, Int64AOSHandle>;
80 using Int64AsIdAOSStorage = typename Int64AsIdAOSHandle::StorageTag;
81 
82 using CellSetExplicit32Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
83  vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic>;
84 using CellSetExplicit64Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
86 using CellSetSingleType32Bit = vtkm::cont::CellSetSingleType<vtkm::cont::StorageTagBasic>;
87 using CellSetSingleType64Bit = vtkm::cont::CellSetSingleType<Int64AsIdAOSStorage>;
88 #endif // VTKM_USE_64BIT_IDS
89 
90 //------------------------------------------------------------------------------
91 using CellListUnstructuredInVTK = vtkm::List< //
96  vtkm::cont::CellSetExtrude //
97  >;
98 
99 using CellListUnstructuredOutVTK = vtkm::List< //
100  vtkm::cont::CellSetExplicit<>, //
101  vtkm::cont::CellSetSingleType<>, //
105  CellSetSingleType64Bit //
106  >;
107 
108 //------------------------------------------------------------------------------
109 using CellListAllInVTK = vtkm::ListAppend<CellListStructuredInVTK, CellListUnstructuredInVTK>;
110 using CellListAllOutVTK = vtkm::ListAppend<CellListStructuredOutVTK, CellListUnstructuredOutVTK>;
111 
112 #ifdef VTKM_ADD_XGC_DEFAULT_TYPES
113 using StorageListField = vtkm::ListAppend<
114  vtkm::cont::StorageListCommon,
115  vtkm::List<vtkm::cont::StorageTagXGCCoordinates>>;
116 #endif
117 
118 } // end namespace tovtkm
119 
120 #define VTKM_DEFAULT_TYPE_LIST ::tovtkm::FieldTypeInVTK
121 #define VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED ::tovtkm::CellListStructuredInVTK
122 #define VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED ::tovtkm::CellListUnstructuredInVTK
123 
124 #ifdef VTKM_ADD_XGC_DEFAULT_TYPES
125 #define VTKM_DEFAULT_STORAGE_LIST ::tovtkm::StorageListField
126 #endif
127 
128 #endif //vtk_m_cont_internal_DefaultTypesVTK_h
vtkm::cont::ArrayHandle< vtkm::Int64, vtkm::cont::StorageTagBasic > Int64AOSHandle
vtkm::cont::CellSetExplicit< vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic > CellSetExplicit32Bit
int
vtkm::List< signed char, unsigned char, short, unsigned short, int, unsigned int, long long, unsigned long long, float, double, char, long, unsigned long > VTKScalarTypes
vtkm::List< vtkm::Vec< vtkm::Vec< vtkm::Float32, 3 >, 3 >, vtkm::Vec< vtkm::Vec< vtkm::Float64, 3 >, 3 > > SpecialGradientOutTypes
vtkm::List< CellSetExplicit32Bit, CellSetExplicit64Bit, CellSetSingleType32Bit, CellSetSingleType64Bit, vtkm::cont::CellSetExtrude > CellListUnstructuredInVTK
vtkm::ListAppend< CellListStructuredOutVTK, CellListUnstructuredOutVTK > CellListAllOutVTK
float
vtkm::cont::ArrayHandleCast< vtkm::Id, Int64AOSHandle > Int64AsIdAOSHandle
double
vtkm::cont::CellSetSingleType< vtkm::cont::StorageTagBasic > CellSetSingleType32Bit
vtkm::List< vtkm::cont::CellSetStructured< 3 >, vtkm::cont::CellSetStructured< 2 >, vtkm::cont::CellSetStructured< 1 > > CellListStructuredInVTK
vtkm::ListAppend< vtkm::TypeListVecCommon, VTKScalarTypes > FieldTypeInVTK
vtkm::cont::CellSetExplicit< vtkm::cont::StorageTagBasic, Int64AsIdAOSStorage, Int64AsIdAOSStorage > CellSetExplicit64Bit
CellListStructuredInVTK CellListStructuredOutVTK
vtkm::ListAppend< vtkm::TypeListVecCommon, SpecialGradientOutTypes, VTKScalarTypes > FieldTypeOutVTK
vtkm::ListAppend< CellListStructuredInVTK, CellListUnstructuredInVTK > CellListAllInVTK
vtkm::cont::CellSetSingleType< Int64AsIdAOSStorage > CellSetSingleType64Bit
vtkm::List< vtkm::cont::CellSetExplicit<>, vtkm::cont::CellSetSingleType<>, CellSetExplicit32Bit, CellSetExplicit64Bit, CellSetSingleType32Bit, CellSetSingleType64Bit > CellListUnstructuredOutVTK
typename Int64AsIdAOSHandle::StorageTag Int64AsIdAOSStorage