VTK  9.7.1
vtkStructuredPointArray.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkStructuredPointArray_h
19 #define vtkStructuredPointArray_h
20 
21 #include "vtkCommonCoreModule.h" // For export macro
22 #include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
23 #include "vtkImplicitArray.h" // For vtkImplicitArray
24 #include "vtkSmartPointer.h" // For vtkSmartPointer
25 #include "vtkStructuredPointBackend.h" // For vtkStructuredPointBackend
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 template <class ValueTypeT>
29 class VTKCOMMONCORE_EXPORT vtkStructuredPointArray
30 #ifndef __VTK_WRAP__
31  : public vtkImplicitArray<vtkStructuredPointBackend<ValueTypeT>,
32  vtkArrayTypes::VTK_STRUCTURED_POINT_ARRAY>
33 {
36 #else // Fake the superclass for the wrappers.
37  : public vtkDataArray
38 {
39  using ImplicitArrayType = vtkDataArray;
40 #endif
41 public:
43  vtkImplicitArrayTypeMacro(SelfType, ImplicitArrayType);
44 #ifndef __VTK_WRAP__
45  using typename Superclass::ArrayTypeTag;
46  using typename Superclass::DataTypeTag;
47  using typename Superclass::ValueType;
48 #else
49  using ValueType = ValueTypeT;
50 #endif
51 
52  static vtkStructuredPointArray* New();
53 
54  // This macro expands to the set of method declarations that
55  // make up the interface of vtkImplicitArray, which is ignored
56  // by the wrappers.
57 #if defined(__VTK_WRAP__) || defined(__WRAP_GCCXML__)
59 #endif
60 
65  {
66  return static_cast<vtkStructuredPointArray<ValueType>*>(Superclass::FastDownCast(source));
67  }
68 
70 
73  void ConstructBackend(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords,
74  VTK_FUTURE_CONST int extent[6], int dataDescription, double dirMatrix[9]);
75  void ConstructBackend(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords,
76  VTK_FUTURE_CONST int extent[6], int dataDescription);
78 
80 
83  vtkDataArray* GetXCoordinates();
84  vtkDataArray* GetYCoordinates();
85  vtkDataArray* GetZCoordinates();
87 
91  bool GetUsesDirectionMatrix();
92 
93 protected:
94  vtkStructuredPointArray() = default;
95  ~vtkStructuredPointArray() override = default;
96 
97 private:
99  void operator=(const vtkStructuredPointArray&) = delete;
100 };
101 
102 // Declare vtkArrayDownCast implementations for StructuredPoint arrays:
104 
105 VTK_ABI_NAMESPACE_END
106 
107 // This macro is used by the subclasses to create dummy
108 // declarations for these functions such that the wrapper
109 // can see them. The wrappers ignore vtkStructuredPointArray.
110 #define vtkCreateStructuredPointWrappedArrayInterface(T) \
111  vtkCreateImplicitWrappedArrayInterface(T); \
112  void ConstructBackend(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords, \
113  int extent[6], int dataDescription, double dirMatrix[9]); \
114  void ConstructBackend(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords, \
115  int extent[6], int dataDescription); \
116  vtkDataArray* GetXCoordinates(); \
117  vtkDataArray* GetYCoordinates(); \
118  vtkDataArray* GetZCoordinates(); \
119  bool GetUsesDirectionMatrix();
120 
121 namespace vtk
122 {
123 VTK_ABI_NAMESPACE_BEGIN
130 template <typename ValueTypeT>
132  vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords, int extent[6],
133  int dataDescription, double dirMatrix[9]);
134 VTK_ABI_NAMESPACE_END
135 }
136 
137 #endif // vtkStructuredPointArray_h
138 
139 // This portion must be OUTSIDE the include blockers. This is used to tell
140 // libraries other than vtkCommonCore that instantiations of
141 // vtkStructuredPointArray can be found externally. This prevents each library
142 // from instantiating these on their own.
143 #ifdef VTK_STRUCTURED_POINT_ARRAY_INSTANTIATING
144 #define VTK_STRUCTURED_POINT_ARRAY_INSTANTIATE(T) \
145  namespace vtkDataArrayPrivate \
146  { \
147  VTK_ABI_NAMESPACE_BEGIN \
148  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkStructuredPointArray<T>, double); \
149  VTK_ABI_NAMESPACE_END \
150  } \
151  VTK_ABI_NAMESPACE_BEGIN \
152  template class VTKCOMMONCORE_EXPORT vtkStructuredPointArray<T>; \
153  VTK_ABI_NAMESPACE_END \
154  namespace vtk \
155  { \
156  VTK_ABI_NAMESPACE_BEGIN \
157  template VTKCOMMONCORE_EXPORT vtkSmartPointer<vtkStructuredPointArray<T>> \
158  CreateStructuredPointArray(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords, \
159  int extent[6], int dataDescription, double dirMatrix[9]); \
160  VTK_ABI_NAMESPACE_END \
161  }
162 // We only provide these specializations for the 64-bit integer types, since
163 // other types can reuse the double-precision mechanism in
164 // vtkDataArray::GetRange without losing precision.
165 #define VTK_STRUCTURED_POINT_ARRAY_INSTANTIATE_VALUERANGE(T) \
166  namespace vtkDataArrayPrivate \
167  { \
168  VTK_ABI_NAMESPACE_BEGIN \
169  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkStructuredPointArray<T>, T); \
170  VTK_ABI_NAMESPACE_END \
171  }
172 #elif defined(VTK_USE_EXTERN_TEMPLATE)
173 #ifndef VTK_STRUCTURED_POINT_ARRAY_EXTERN
174 #define VTK_STRUCTURED_POINT_ARRAY_EXTERN
175 #ifdef _MSC_VER
176 #pragma warning(push)
177 // The following is needed when the vtkStructuredPointArray is declared
178 // dllexport and is used from another class in vtkCommonCore
179 #pragma warning(disable : 4910) // extern and dllexport incompatible
180 #endif
181 VTK_ABI_NAMESPACE_BEGIN
182 vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStructuredPointArray);
183 VTK_ABI_NAMESPACE_END
184 
185 namespace vtkDataArrayPrivate
186 {
187 VTK_ABI_NAMESPACE_BEGIN
188 
189 // These are instantiated in vtkGenericDataArrayValueRange${i}.cxx
191 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkStructuredPointArray<unsigned long>, unsigned long)
193 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkStructuredPointArray<unsigned long long>, unsigned long long)
194 // These are instantiated by vtkStructuredPointArrayInstantiate_double.cxx.inc, e.t.c.
208 
209 VTK_ABI_NAMESPACE_END
210 } // namespace vtkDataArrayPrivate
211 
212 #ifdef _MSC_VER
213 #pragma warning(pop)
214 #endif
215 #endif // VTK_STRUCTURED_POINT_ARRAY_EXTERN
216 
217 // The following clause is only for MSVC
218 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
219 #pragma warning(push)
220 
221 // C4091: 'extern ' : ignored on left of 'int' when no variable is declared
222 #pragma warning(disable : 4091)
223 
224 // Compiler-specific extension warning.
225 #pragma warning(disable : 4231)
226 
227 // We need to disable warning 4910 and do an extern dllexport
228 // anyway. When deriving new arrays from an
229 // instantiation of this template the compiler does an explicit
230 // instantiation of the base class. From outside the vtkCommon
231 // library we block this using an extern dllimport instantiation.
232 // For classes inside vtkCommon we should be able to just do an
233 // extern instantiation, but VS 2008 complains about missing
234 // definitions. We cannot do an extern dllimport inside vtkCommon
235 // since the symbols are local to the dll. An extern dllexport
236 // seems to be the only way to convince VS 2008 to do the right
237 // thing, so we just disable the warning.
238 #pragma warning(disable : 4910) // extern and dllexport incompatible
239 
240 // Use an "extern explicit instantiation" to give the class a DLL
241 // interface. This is a compiler-specific extension.
242 VTK_ABI_NAMESPACE_BEGIN
243 vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStructuredPointArray);
244 VTK_ABI_NAMESPACE_END
245 
246 #pragma warning(pop)
247 
248 #endif
249 
250 // VTK-HeaderTest-Exclude: vtkStructuredPointArray.h
vtkArrayDownCast_TemplateFastCastMacro(vtkStructuredPointArray)
Abstract superclass for all arrays.
vtkImplicitArrayTypeMacro(SelfType, GenericDataArrayType)
vtkSmartPointer< vtkStructuredPointArray< ValueTypeT > > CreateStructuredPointArray(vtkDataArray *xCoords, vtkDataArray *yCoords, vtkDataArray *zCoords, int extent[6], int dataDescription, double dirMatrix[9])
Create an implicit point array from the given coordinates and direction matrix which is optional...
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
Base interface for all typed vtkDataArray subclasses.
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStructuredPointArray)
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
A read only array class that wraps an implicit function from integers to any value type supported by ...
A structured point array used by vtkCartesianGrid subclasses.
#define vtkCreateImplicitWrappedArrayInterface(T)
static vtkImplicitArray * New()
void ConstructBackend(Params &&...params)
Utility method for setting backend parameterization directly.
static vtkStructuredPointArray< ValueType > * FastDownCast(vtkAbstractArray *source)
A faster alternative to SafeDownCast for downcasting vtkAbstractArrays.