VTK  9.6.20260320
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
17
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
27VTK_ABI_NAMESPACE_BEGIN
28template <class ValueTypeT>
29class 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
41public:
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
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 int extent[6], int dataDescription, double dirMatrix[9]);
75 void ConstructBackend(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords,
76 int extent[6], int dataDescription);
78
80
87
92
93protected:
95 ~vtkStructuredPointArray() override = default;
96
97private:
99 void operator=(const vtkStructuredPointArray&) = delete;
100};
101
102// Declare vtkArrayDownCast implementations for StructuredPoint arrays:
104
105VTK_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
121namespace vtk
122{
123VTK_ABI_NAMESPACE_BEGIN
130template <typename ValueTypeT>
132 vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords, int extent[6],
133 int dataDescription, double dirMatrix[9]);
134VTK_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
181VTK_ABI_NAMESPACE_BEGIN
182vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStructuredPointArray);
183VTK_ABI_NAMESPACE_END
184
185namespace vtkDataArrayPrivate
186{
187VTK_ABI_NAMESPACE_BEGIN
188
189// These are instantiated in vtkGenericDataArrayValueRange${i}.cxx
194// These are instantiated by vtkStructuredPointArrayInstantiate_double.cxx.inc, e.t.c.
208
209VTK_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.
242VTK_ABI_NAMESPACE_BEGIN
243vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStructuredPointArray);
244VTK_ABI_NAMESPACE_END
245
246#pragma warning(pop)
247
248#endif
249
250// VTK-HeaderTest-Exclude: vtkStructuredPointArray.h
Abstract superclass for all arrays.
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
Hold a reference to a vtkObjectBase instance.
A structured point array used by vtkCartesianGrid subclasses.
static vtkStructuredPointArray< ValueType > * FastDownCast(vtkAbstractArray *source)
A faster alternative to SafeDownCast for downcasting vtkAbstractArrays.
vtkStructuredPointArray< ValueTypeT > SelfType
vtkDataArray * GetZCoordinates()
Get the coordinate arrays used to construct the backend.
void ConstructBackend(vtkDataArray *xCoords, vtkDataArray *yCoords, vtkDataArray *zCoords, int extent[6], int dataDescription)
Set the parameters for the strided backend.
~vtkStructuredPointArray() override=default
bool GetUsesDirectionMatrix()
Return true if a non-identity direction matrix is being used.
vtkDataArray * GetXCoordinates()
Get the coordinate arrays used to construct the backend.
void ConstructBackend(vtkDataArray *xCoords, vtkDataArray *yCoords, vtkDataArray *zCoords, int extent[6], int dataDescription, double dirMatrix[9])
Set the parameters for the strided backend.
vtkDataArray * GetYCoordinates()
Get the coordinate arrays used to construct the backend.
static vtkStructuredPointArray * New()
vtkStructuredPointArray()=default
vtkImplicitArrayTypeMacro(SelfType, ImplicitArrayType)
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
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 vtkArrayDownCast_TemplateFastCastMacro(ArrayT)
Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the paramet...
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define vtkDataArray
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
#define vtkCreateImplicitWrappedArrayInterface(T)
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
Definition vtkType.h:458
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
Definition vtkType.h:411
@ VTK_STRUCTURED_POINT_ARRAY
Definition vtkType.h:97