13#ifndef vtkStructuredPointBackend_h
14#define vtkStructuredPointBackend_h
16#include "vtkCommonCoreModule.h"
22VTK_ABI_NAMESPACE_BEGIN
24template <
typename ValueType>
77template <
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 ArrayTypeX* arrayX, ArrayTypeY* arrayY, ArrayTypeZ* arrayZ,
int extent[6],
double dirMatrix[9])
104 , X(
vtk::DataArrayValueRange<1>(ArrayX))
106 , Y(
vtk::DataArrayValueRange<1>(ArrayY))
108 , Z(
vtk::DataArrayValueRange<1>(ArrayZ))
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
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
351#pragma warning(disable : 4910)
353VTK_ABI_NAMESPACE_BEGIN
Hold a reference to a vtkObjectBase instance.
A backend for the vtkImplicitArray to query structured points efficiently.
virtual vtkDataArray * GetZCoordinates() const =0
Get the coordinate arrays used to construct this backend.
vtkStructuredPointBackend()
virtual ~vtkStructuredPointBackend()
virtual ValueType mapStructuredXComponent(int i) const =0
These function should only be used when direction matrix is NOT identity.
virtual vtkDataArray * GetYCoordinates() const =0
Get the coordinate arrays used to construct this backend.
virtual bool GetUsesDirectionMatrix() const =0
Return true if a non-identity direction matrix is being used.
virtual ValueType mapComponent(vtkIdType tupleId, int comp) const =0
virtual void mapStructuredTuple(int ijk[3], ValueType tuple[3]) const =0
virtual ValueType mapStructuredYComponent(int j) const =0
These function should only be used when direction matrix is NOT identity.
virtual vtkDataArray * GetXCoordinates() const =0
Get the coordinate arrays used to construct this backend.
virtual ValueType mapStructuredZComponent(int k) const =0
These function should only be used when direction matrix is NOT identity.
virtual void mapTuple(vtkIdType tupleId, ValueType tuple[3]) const =0
virtual ValueType map(vtkIdType valueId) const =0
std::enable_if<(Description==2), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description==4), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description==1), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
std::enable_if<(Description!=9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredZComponentImpl(int k) const
std::enable_if<(Description==1), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description==7), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
std::enable_if<(Description==5), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
std::enable_if<(Description!=9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredXComponentImpl(int i) const
ValueType mapComponent(vtkIdType tupleId, int comp) const override
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredZComponentImpl(int k) const
vtkStructuredTPointBackend(ArrayTypeX *arrayX, ArrayTypeY *arrayY, ArrayTypeZ *arrayZ, int extent[6], double dirMatrix[9])
void mapStructuredTuple(int ijk[3], ValueType tuple[3]) const override
std::enable_if<(Description==3), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
~vtkStructuredTPointBackend() override
std::enable_if<(Description==8), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
ValueType mapStructuredZComponent(int k) const override
These function should only be used when direction matrix is NOT identity.
std::enable_if<(Description!=9), void >::type VTK_ALWAYS_INLINE mapStructuredTupleImpl(int ijk[3], ValueType tuple[3]) const
std::enable_if<(Description==5), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description!=9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredYComponentImpl(int j) const
std::enable_if<(Description==2), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
vtkDataArray * GetZCoordinates() const override
Get the coordinate arrays used to construct this backend.
ValueType mapStructuredYComponent(int j) const override
These function should only be used when direction matrix is NOT identity.
std::enable_if<(Description==9), void >::type VTK_ALWAYS_INLINE mapStructuredTupleImpl(int ijk[3], ValueType tuple[3]) const
vtkDataArray * GetYCoordinates() const override
Get the coordinate arrays used to construct this backend.
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
ValueType mapStructuredXComponent(int i) const override
These function should only be used when direction matrix is NOT identity.
void mapTuple(vtkIdType tupleId, ValueType tuple[3]) const override
vtkStructuredTPointBackend()
std::enable_if<(Description==7), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredYComponentImpl(int j) const
ValueType map(vtkIdType valueId) const override
std::enable_if<(Description==9), ValueType >::type VTK_ALWAYS_INLINE mapStructuredXComponentImpl(int i) const
std::enable_if<(Description==3), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description==6), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description==6), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
bool GetUsesDirectionMatrix() const override
Return true if a non-identity direction matrix is being used.
std::enable_if<(Description==8), ValueType >::type VTK_ALWAYS_INLINE mapComponentImpl(vtkIdType tupleId, int comp) const
std::enable_if<(Description==4), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
std::enable_if<(Description==9), void >::type VTK_ALWAYS_INLINE ComputePointStructuredCoords(vtkIdType pointId, int ijk[3]) const
vtkDataArray * GetXCoordinates() const override
Get the coordinate arrays used to construct this backend.
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
STL-compatible iterable ranges that provide access to vtkDataArray elements.
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.