VTK-m  2.2
DataSetBuilderUniform.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_DataSetBuilderUniform_h
11 #define vtk_m_cont_DataSetBuilderUniform_h
12 
14 #include <vtkm/cont/DataSet.h>
15 
16 namespace vtkm
17 {
18 namespace cont
19 {
20 
22 {
24 
25 public:
26  VTKM_CONT
28 
37  template <typename T>
38  VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id& dimension,
39  const T& origin,
40  const T& spacing,
41  const std::string& coordNm = "coords")
42  {
44  vtkm::Id3(dimension, 1, 1),
45  VecType(static_cast<vtkm::FloatDefault>(origin), 0, 0),
46  VecType(static_cast<vtkm::FloatDefault>(spacing), 1, 1),
47  coordNm);
48  }
49 
57  VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id& dimension,
58  const std::string& coordNm = "coords");
59 
68  template <typename T>
69  VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id2& dimensions,
70  const vtkm::Vec<T, 2>& origin,
71  const vtkm::Vec<T, 2>& spacing,
72  const std::string& coordNm = "coords")
73  {
74  return DataSetBuilderUniform::CreateDataSet(vtkm::Id3(dimensions[0], dimensions[1], 1),
75  VecType(static_cast<vtkm::FloatDefault>(origin[0]),
76  static_cast<vtkm::FloatDefault>(origin[1]),
77  0),
78  VecType(static_cast<vtkm::FloatDefault>(spacing[0]),
79  static_cast<vtkm::FloatDefault>(spacing[1]),
80  1),
81  coordNm);
82  }
83 
91  VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id2& dimensions,
92  const std::string& coordNm = "coords");
93 
102  template <typename T>
103  VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id3& dimensions,
104  const vtkm::Vec<T, 3>& origin,
105  const vtkm::Vec<T, 3>& spacing,
106  const std::string& coordNm = "coords")
107  {
109  vtkm::Id3(dimensions[0], dimensions[1], dimensions[2]),
110  VecType(static_cast<vtkm::FloatDefault>(origin[0]),
111  static_cast<vtkm::FloatDefault>(origin[1]),
112  static_cast<vtkm::FloatDefault>(origin[2])),
113  VecType(static_cast<vtkm::FloatDefault>(spacing[0]),
114  static_cast<vtkm::FloatDefault>(spacing[1]),
115  static_cast<vtkm::FloatDefault>(spacing[2])),
116  coordNm);
117  }
118 
126  VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id3& dimensions,
127  const std::string& coordNm = "coords");
128 
129 private:
130  VTKM_CONT
131  static vtkm::cont::DataSet CreateDataSet(const vtkm::Id3& dimensions,
132  const vtkm::Vec3f& origin,
133  const vtkm::Vec3f& spacing,
134  const std::string& coordNm);
135 };
136 
137 } // namespace cont
138 } // namespace vtkm
139 
140 #endif //vtk_m_cont_DataSetBuilderUniform_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::DataSetBuilderUniform::CreateDataSet
static vtkm::cont::DataSet CreateDataSet(const vtkm::Id3 &dimensions, const vtkm::Vec3f &origin, const vtkm::Vec3f &spacing, const std::string &coordNm)
vtkm::cont::DataSet
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
CoordinateSystem.h
vtkm::cont::DataSetBuilderUniform
Definition: DataSetBuilderUniform.h:21
vtkm::cont::DataSetBuilderUniform::Create
static vtkm::cont::DataSet Create(const vtkm::Id2 &dimensions, const vtkm::Vec< T, 2 > &origin, const vtkm::Vec< T, 2 > &spacing, const std::string &coordNm="coords")
Create a 2D uniform DataSet.
Definition: DataSetBuilderUniform.h:69
VTKM_CONT_EXPORT
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
vtkm::Vec< T, 2 >
Definition: Types.h:897
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::Vec3f
vtkm::Vec< vtkm::FloatDefault, 3 > Vec3f
Vec3f corresponds to a 3-dimensional vector of floating point values.
Definition: Types.h:1052
vtkm::Vec< T, 3 >
Definition: Types.h:1013
vtkm::Vec< vtkm::FloatDefault, 3 >
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
vtkm::cont::DataSetBuilderUniform::Create
static vtkm::cont::DataSet Create(const vtkm::Id &dimension, const T &origin, const T &spacing, const std::string &coordNm="coords")
Create a 1D uniform DataSet.
Definition: DataSetBuilderUniform.h:38
vtkm::cont::DataSetBuilderUniform::Create
static vtkm::cont::DataSet Create(const vtkm::Id3 &dimensions, const vtkm::Vec< T, 3 > &origin, const vtkm::Vec< T, 3 > &spacing, const std::string &coordNm="coords")
Create a 3D uniform DataSet.
Definition: DataSetBuilderUniform.h:103
DataSet.h