13 #ifndef vtkStructuredPointBackend_h
14 #define vtkStructuredPointBackend_h
16 #include "vtkCommonCoreModule.h"
22 VTK_ABI_NAMESPACE_BEGIN
24 template <
typename ValueType>
37 virtual ValueType mapStructuredXComponent(
int i)
const = 0;
42 virtual ValueType mapStructuredYComponent(
int j)
const = 0;
47 virtual ValueType mapStructuredZComponent(
int k)
const = 0;
50 virtual void mapStructuredTuple(
int ijk[3], ValueType tuple[3])
const = 0;
53 virtual void mapTuple(
vtkIdType tupleId, ValueType tuple[3])
const = 0;
56 virtual ValueType mapComponent(
vtkIdType tupleId,
int comp)
const = 0;
59 virtual ValueType map(
vtkIdType valueId)
const = 0;
73 virtual bool GetUsesDirectionMatrix()
const = 0;
77 template <
typename ValueType,
typename ArrayTypeX,
typename ArrayTypeY,
typename ArrayTypeZ,
78 int DataDescription,
bool UseDirMatrix>
87 const std::array<int, 6> Extent;
88 const std::array<vtkIdType, 3> Dimensions;
92 std::array<double, 16> IndexToPhysicalMatrix;
94 void TransformIndexToPhysicalPoint(
int i,
int j,
int k, ValueType* out)
const;
102 VTK_FUTURE_CONST
int extent[6],
double dirMatrix[9])
109 , Extent({ { extent[0], extent[1], extent[2], extent[3], extent[4], extent[5] } })
111 { {
extent[1] -
extent[0] + 1, extent[3] - extent[2] + 1, extent[5] - extent[4] + 1 } })
112 , Dimension_0_BY_1(this->Dimensions[0] * this->Dimensions[1])
113 , IndexToPhysicalMatrix({ {} })
117 assert(this->ArrayX->GetNumberOfTuples() == 2);
118 assert(this->ArrayY->GetNumberOfTuples() == 2);
119 assert(this->ArrayZ->GetNumberOfTuples() == 2);
121 std::array<double, 3> origin = { { this->X[0], this->Y[0], this->Z[0] } };
123 std::array<double, 3>
spacing = { { this->X[1] - this->X[0], this->Y[1] - this->Y[0],
124 this->Z[1] - this->Z[0] } };
126 this->IndexToPhysicalMatrix[0] = dirMatrix[0] * spacing[0];
127 this->IndexToPhysicalMatrix[1] = dirMatrix[1] * spacing[1];
128 this->IndexToPhysicalMatrix[2] = dirMatrix[2] * spacing[2];
129 this->IndexToPhysicalMatrix[3] = origin[0];
130 this->IndexToPhysicalMatrix[4] = dirMatrix[3] * spacing[0];
131 this->IndexToPhysicalMatrix[5] = dirMatrix[4] * spacing[1];
132 this->IndexToPhysicalMatrix[6] = dirMatrix[5] * spacing[2];
133 this->IndexToPhysicalMatrix[7] = origin[1];
134 this->IndexToPhysicalMatrix[8] = dirMatrix[6] * spacing[0];
135 this->IndexToPhysicalMatrix[9] = dirMatrix[7] * spacing[1];
136 this->IndexToPhysicalMatrix[10] = dirMatrix[8] * spacing[2];
137 this->IndexToPhysicalMatrix[11] = origin[2];
138 this->IndexToPhysicalMatrix[12] = 0.0;
139 this->IndexToPhysicalMatrix[13] = 0.0;
140 this->IndexToPhysicalMatrix[14] = 0.0;
141 this->IndexToPhysicalMatrix[15] = 1.0;
149 template <
int Description = DataDescription>
150 typename std::enable_if<(Description == 9 ), ValueType>::
type
155 template <
int Description = DataDescription>
156 typename std::enable_if<(Description != 9 ), ValueType>::
type
164 template <
int Description = DataDescription>
165 typename std::enable_if<(Description == 9 ), ValueType>::
type
170 template <
int Description = DataDescription>
171 typename std::enable_if<(Description != 9 ), ValueType>::
type
179 template <
int Description = DataDescription>
180 typename std::enable_if<(Description == 9 ), ValueType>::
type
185 template <
int Description = DataDescription>
186 typename std::enable_if<(Description != 9 ), ValueType>::
type
194 template <
int Description = DataDescription>
195 typename std::enable_if<(Description == 9 ),
void>::
type VTK_ALWAYS_INLINE
199 template <
int Description = DataDescription>
200 typename std::enable_if<(Description != 9 ),
void>::
type VTK_ALWAYS_INLINE
207 template <
int Description = DataDescription>
208 typename std::enable_if<(Description == 9 ),
void>::
type VTK_ALWAYS_INLINE
212 template <
int Description = DataDescription>
213 typename std::enable_if<(Description == 1 ),
void>::
type
218 template <
int Description = DataDescription>
219 typename std::enable_if<(Description == 2 ),
void>::
type
224 template <
int Description = DataDescription>
225 typename std::enable_if<(Description == 3 ),
void>::
type
230 template <
int Description = DataDescription>
231 typename std::enable_if<(Description == 4 ),
void>::
type
236 template <
int Description = DataDescription>
237 typename std::enable_if<(Description == 5 ),
void>::
type
242 template <
int Description = DataDescription>
243 typename std::enable_if<(Description == 6 ),
void>::
type
248 template <
int Description = DataDescription>
249 typename std::enable_if<(Description == 7 ),
void>::
type
254 template <
int Description = DataDescription>
255 typename std::enable_if<(Description == 8 ),
void>::
type
263 template <
int Description = DataDescription>
264 typename std::enable_if<(Description == 9 ), ValueType>::
type
269 template <
int Description = DataDescription>
270 typename std::enable_if<(Description == 1 ), ValueType>::
type
275 template <
int Description = DataDescription>
276 typename std::enable_if<(Description == 2 ), ValueType>::
type
281 template <
int Description = DataDescription>
282 typename std::enable_if<(Description == 3 ), ValueType>::
type
287 template <
int Description = DataDescription>
288 typename std::enable_if<(Description == 4 ), ValueType>::
type
293 template <
int Description = DataDescription>
294 typename std::enable_if<(Description == 5 ), ValueType>::
type
299 template <
int Description = DataDescription>
300 typename std::enable_if<(Description == 6 ), ValueType>::
type
305 template <
int Description = DataDescription>
306 typename std::enable_if<(Description == 7 ), ValueType>::
type
311 template <
int Description = DataDescription>
312 typename std::enable_if<(Description == 8 ), ValueType>::
type
334 VTK_ABI_NAMESPACE_END
336 #endif // vtkStructuredPointBackend_h
339 #if defined(VTK_STRUCTURED_POINT_BACKEND_INSTANTIATING)
341 #define VTK_INSTANTIATE_STRUCTURED_POINT_BACKEND(ValueType) \
342 VTK_ABI_NAMESPACE_BEGIN \
343 template class VTKCOMMONCORE_EXPORT vtkStructuredPointBackend<ValueType>; \
344 VTK_ABI_NAMESPACE_END
345 #elif defined(VTK_USE_EXTERN_TEMPLATE)
347 #ifndef VTK_STRUCTURED_POINT_BACKEND_TEMPLATE_EXTERN
348 #define VTK_STRUCTURED_POINT_BACKEND_TEMPLATE_EXTERN
350 #pragma warning(push)
351 #pragma warning(disable : 4910) // extern and dllexport incompatible
353 VTK_ABI_NAMESPACE_BEGIN
355 VTK_ABI_NAMESPACE_END
359 #endif // VTK_STRUCTURED_POINT_BACKEND_TEMPLATE_EXTERN
ValueType mapStructuredYComponent(int j) const override
These function should only be used when direction matrix is NOT identity.
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredYComponentImpl(int j) const
std::enable_if<(Description==9), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
vtkStructuredTPointBackend(ArrayTypeX *arrayX, ArrayTypeY *arrayY, ArrayTypeZ *arrayZ, VTK_FUTURE_CONST int extent[6], double dirMatrix[9])
std::enable_if<(Description==9), void >::type VTK_ALWAYS_INLINE mapStructuredTupleImpl(int ijk[3], ValueType tuple[3]) const
vtkDataArray * GetXCoordinates() const override
Get the coordinate arrays used to construct this backend.
bool GetUsesDirectionMatrix() const override
Return true if a non-identity direction matrix is being used.
ValueType map(vtkIdType valueId) const override
abstract superclass for arrays of numeric data
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredZComponentImpl(int k) const
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
void mapStructuredTuple(int ijk[3], ValueType tuple[3]) const override
VTK_ITER_INLINE auto DataArrayValueRange(const ArrayTypePtr &array, ValueIdType start=-1, ValueIdType end=-1) -> typename detail::SelectValueRange< ArrayTypePtr, TupleSize, ForceValueTypeForVtkDataArray >::type
Generate an stl and for-range compatible range of flat AOS iterators from a vtkDataArray.
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredXComponentImpl(int i) const
vtkDataArray * GetZCoordinates() const override
Get the coordinate arrays used to construct this backend.
ValueType mapComponent(vtkIdType tupleId, int comp) const override
~vtkStructuredTPointBackend() override
vtkDataArray * GetYCoordinates() const override
Get the coordinate arrays used to construct this backend.
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStructuredPointBackend)
A backend for the vtkImplicitArray to query structured points efficiently.
void mapTuple(vtkIdType tupleId, ValueType tuple[3]) const override
ValueType mapStructuredZComponent(int k) const override
These function should only be used when direction matrix is NOT identity.
ValueType mapStructuredXComponent(int i) const override
These function should only be used when direction matrix is NOT identity.
STL-compatible iterable ranges that provide access to vtkDataArray elements.
vtkStructuredTPointBackend()