VTK-m  2.0
ArrayHandleUniformPointCoordinates.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_ArrayHandleUniformPointCoordinates_h
11 #define vtk_m_cont_ArrayHandleUniformPointCoordinates_h
12 
16 
17 namespace vtkm
18 {
19 namespace cont
20 {
21 
23 {
24 };
25 
26 namespace internal
27 {
28 
29 using StorageTagUniformPointsSuperclass =
31 
32 template <>
34  : Storage<vtkm::Vec3f, StorageTagUniformPointsSuperclass>
35 {
36 };
37 
38 } // namespace internal
39 
45 class VTKM_CONT_EXPORT ArrayHandleUniformPointCoordinates
46  : public vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>
47 {
48 public:
52 
53 private:
54  using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
55 
56 public:
57  VTKM_CONT
59  ValueType origin = ValueType(0.0f, 0.0f, 0.0f),
60  ValueType spacing = ValueType(1.0f, 1.0f, 1.0f));
61 
68 
69  VTKM_CONT vtkm::Id3 GetDimensions() const;
70  VTKM_CONT vtkm::Vec3f GetOrigin() const;
71  VTKM_CONT vtkm::Vec3f GetSpacing() const;
72 };
73 
74 namespace internal
75 {
76 
77 template <>
78 struct VTKM_CONT_EXPORT ArrayExtractComponentImpl<vtkm::cont::StorageTagUniformPoints>
79 {
82  vtkm::IdComponent componentIndex,
83  vtkm::CopyFlag allowCopy) const;
84 };
85 
86 } // namespace internal
87 
88 }
89 } // namespace vtkm::cont
90 
91 //=============================================================================
92 // Specializations of serialization related classes
94 namespace vtkm
95 {
96 namespace cont
97 {
98 
99 template <>
100 struct SerializableTypeString<vtkm::cont::ArrayHandleUniformPointCoordinates>
101 {
102  static VTKM_CONT const std::string Get() { return "AH_UniformPointCoordinates"; }
103 };
104 
105 template <>
106 struct SerializableTypeString<
107  vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>>
108  : SerializableTypeString<vtkm::cont::ArrayHandleUniformPointCoordinates>
109 {
110 };
111 }
112 } // vtkm::cont
113 
114 namespace mangled_diy_namespace
115 {
116 
117 template <>
118 struct Serialization<vtkm::cont::ArrayHandleUniformPointCoordinates>
119 {
120 private:
123 
124 public:
125  static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
126  {
127  auto portal = obj.ReadPortal();
128  vtkmdiy::save(bb, portal.GetDimensions());
129  vtkmdiy::save(bb, portal.GetOrigin());
130  vtkmdiy::save(bb, portal.GetSpacing());
131  }
132 
133  static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
134  {
135  vtkm::Id3 dims;
136  typename BaseType::ValueType origin, spacing;
137 
138  vtkmdiy::load(bb, dims);
139  vtkmdiy::load(bb, origin);
140  vtkmdiy::load(bb, spacing);
141 
142  obj = vtkm::cont::ArrayHandleUniformPointCoordinates(dims, origin, spacing);
143  }
144 };
145 
146 template <>
147 struct Serialization<vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>>
148  : Serialization<vtkm::cont::ArrayHandleUniformPointCoordinates>
149 {
150 };
151 
152 } // diy
154 
155 #endif //vtk_+m_cont_ArrayHandleUniformPointCoordinates_h
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:283
ArrayExtractComponent.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ArrayPortalUniformPointCoordinates.h
VTKM_ARRAY_HANDLE_SUBCLASS_NT
#define VTKM_ARRAY_HANDLE_SUBCLASS_NT(classname, superclass)
Macro to make default methods in ArrayHandle subclasses.
Definition: ArrayHandle.h:249
vtkm::cont::StorageTagImplicit
An implementation for read-only implicit arrays.
Definition: ArrayHandleImplicit.h:86
vtkm::Get
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC_CONT auto Get(const vtkm::Tuple< Ts... > &tuple) -> decltype(tuple.template Get< Index >())
Retrieve the object from a vtkm::Tuple at the given index.
Definition: Tuple.h:83
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
mangled_diy_namespace
Definition: Particle.h:331
vtkm::exec::arg::load
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC T load(const U &u, vtkm::Id v)
Definition: FetchTagArrayDirectIn.h:36
vtkm::cont::ArrayHandleStride
An ArrayHandle that accesses a basic array with strides and offsets.
Definition: ArrayHandleStride.h:251
vtkm::cont::StorageTagUniformPoints
Definition: ArrayHandleUniformPointCoordinates.h:22
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageType
vtkm::cont::internal::Storage< ValueType, StorageTag > StorageType
Definition: ArrayHandleUniformPointCoordinates.h:54
vtkm::Vec< vtkm::FloatDefault, 3 >
vtkm::cont::ArrayHandleUniformPointCoordinates
ArrayHandleUniformPointCoordinates is a specialization of ArrayHandle.
Definition: ArrayHandleUniformPointCoordinates.h:45
vtkm::CopyFlag
CopyFlag
Definition: Flags.h:16
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:92
ArrayHandleImplicit.h