VTK
ArrayConverters.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 vtkmlib_ArrayConverters_h
18 #define vtkmlib_ArrayConverters_h
19 #ifndef __VTK_WRAP__
20 
21 #include "vtkAcceleratorsVTKmModule.h" //required for correct implementation
22 #include "vtkmConfig.h" //required for general vtkm setup
23 
24 #include <vtkm/cont/Field.h>
25 
26 #include <type_traits> // for std::underlying_type
27 
28 class vtkDataArray;
29 class vtkDataSet;
30 class vtkPoints;
31 
32 namespace vtkm {
33 namespace cont {
34 class DataSet;
35 class CoordinateSystem;
36 }
37 }
38 
39 namespace tovtkm {
40 
41 enum class FieldsFlag
42 {
43  None = 0x0,
44  Points = 0x1,
45  Cells = 0x2,
46 
48 };
49 
50 VTKACCELERATORSVTKM_EXPORT
51 void ProcessFields(vtkDataSet *input, vtkm::cont::DataSet &dataset,
52  tovtkm::FieldsFlag fields);
53 
54 // determine the type and call the proper Convert routine
55 VTKACCELERATORSVTKM_EXPORT
56 vtkm::cont::Field Convert(vtkDataArray* input, int association);
57 }
58 
59 namespace fromvtkm {
60 
61 VTKACCELERATORSVTKM_EXPORT
62 vtkDataArray* Convert(const vtkm::cont::Field& input);
63 
64 VTKACCELERATORSVTKM_EXPORT
65 vtkPoints* Convert(const vtkm::cont::CoordinateSystem& input);
66 
67 VTKACCELERATORSVTKM_EXPORT
68 bool ConvertArrays(const vtkm::cont::DataSet& input, vtkDataSet* output);
69 }
70 
72  const tovtkm::FieldsFlag &b)
73 {
75  return static_cast<tovtkm::FieldsFlag>(static_cast<T>(a) & static_cast<T>(b));
76 }
77 
79  const tovtkm::FieldsFlag &b)
80 {
82  return static_cast<tovtkm::FieldsFlag>(static_cast<T>(a) | static_cast<T>(b));
83 }
84 
85 #endif
86 #endif // vtkmlib_ArrayConverters_h
tovtkm::FieldsFlag operator&(const tovtkm::FieldsFlag &a, const tovtkm::FieldsFlag &b)
VTKACCELERATORSVTKM_EXPORT bool ConvertArrays(const vtkm::cont::DataSet &input, vtkDataSet *output)
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
VTKACCELERATORSVTKM_EXPORT vtkPoints * Convert(const vtkm::cont::CoordinateSystem &input)
tovtkm::FieldsFlag operator|(const tovtkm::FieldsFlag &a, const tovtkm::FieldsFlag &b)
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
VTKACCELERATORSVTKM_EXPORT void ProcessFields(vtkDataSet *input, vtkm::cont::DataSet &dataset, tovtkm::FieldsFlag fields)
represent and manipulate 3D points
Definition: vtkPoints.h:39