13#ifndef vtkStructuredPointBackend_h
14#define vtkStructuredPointBackend_h
16#include "vtkCommonCoreModule.h"
22VTK_ABI_NAMESPACE_BEGIN
24template <
typename ValueType>
63template <
typename ValueType,
typename ArrayTypeX,
typename ArrayTypeY,
typename ArrayTypeZ,
64 int DataDescription,
bool UseDirMatrix>
73 const std::array<int, 6> Extent;
74 const std::array<vtkIdType, 3> Dimensions;
78 std::array<double, 16> IndexToPhysicalMatrix;
80 void TransformIndexToPhysicalPoint(
int i,
int j,
int k, ValueType* out)
const;
88 ArrayTypeX* arrayX, ArrayTypeY* arrayY, ArrayTypeZ* arrayZ,
int extent[6],
double dirMatrix[9])
90 , X(
vtk::DataArrayValueRange<1>(ArrayX))
92 , Y(
vtk::DataArrayValueRange<1>(ArrayY))
94 , Z(
vtk::DataArrayValueRange<1>(ArrayZ))
95 , Extent({ { extent[0], extent[1], extent[2], extent[3], extent[4], extent[5] } })
97 { { extent[1] - extent[0] + 1, extent[3] - extent[2] + 1, extent[5] - extent[4] + 1 } })
98 , Dimension_0_BY_1(this->Dimensions[0] * this->Dimensions[1])
99 , IndexToPhysicalMatrix({ {} })
103 assert(this->ArrayX->GetNumberOfTuples() == 2);
104 assert(this->ArrayY->GetNumberOfTuples() == 2);
105 assert(this->ArrayZ->GetNumberOfTuples() == 2);
107 std::array<double, 3> origin = { { this->X[0], this->Y[0], this->Z[0] } };
109 std::array<double, 3>
spacing = { { this->X[1] - this->X[0], this->Y[1] - this->Y[0],
110 this->Z[1] - this->Z[0] } };
112 this->IndexToPhysicalMatrix[0] = dirMatrix[0] *
spacing[0];
113 this->IndexToPhysicalMatrix[1] = dirMatrix[1] *
spacing[1];
114 this->IndexToPhysicalMatrix[2] = dirMatrix[2] *
spacing[2];
115 this->IndexToPhysicalMatrix[3] = origin[0];
116 this->IndexToPhysicalMatrix[4] = dirMatrix[3] *
spacing[0];
117 this->IndexToPhysicalMatrix[5] = dirMatrix[4] *
spacing[1];
118 this->IndexToPhysicalMatrix[6] = dirMatrix[5] *
spacing[2];
119 this->IndexToPhysicalMatrix[7] = origin[1];
120 this->IndexToPhysicalMatrix[8] = dirMatrix[6] *
spacing[0];
121 this->IndexToPhysicalMatrix[9] = dirMatrix[7] *
spacing[1];
122 this->IndexToPhysicalMatrix[10] = dirMatrix[8] *
spacing[2];
123 this->IndexToPhysicalMatrix[11] = origin[2];
124 this->IndexToPhysicalMatrix[12] = 0.0;
125 this->IndexToPhysicalMatrix[13] = 0.0;
126 this->IndexToPhysicalMatrix[14] = 0.0;
127 this->IndexToPhysicalMatrix[15] = 1.0;
135 template <
int Description = DataDescription>
136 typename std::enable_if<(Description == 9 ), ValueType>::type
141 template <
int Description = DataDescription>
142 typename std::enable_if<(Description != 9 ), ValueType>::type
150 template <
int Description = DataDescription>
151 typename std::enable_if<(Description == 9 ), ValueType>::type
156 template <
int Description = DataDescription>
157 typename std::enable_if<(Description != 9 ), ValueType>::type
165 template <
int Description = DataDescription>
166 typename std::enable_if<(Description == 9 ), ValueType>::type
171 template <
int Description = DataDescription>
172 typename std::enable_if<(Description != 9 ), ValueType>::type
180 template <
int Description = DataDescription>
181 typename std::enable_if<(Description == 9 ),
void>::type VTK_ALWAYS_INLINE
185 template <
int Description = DataDescription>
186 typename std::enable_if<(Description != 9 ),
void>::type VTK_ALWAYS_INLINE
193 template <
int Description = DataDescription>
194 typename std::enable_if<(Description == 9 ),
void>::type VTK_ALWAYS_INLINE
198 template <
int Description = DataDescription>
199 typename std::enable_if<(Description == 1 ),
void>::type
204 template <
int Description = DataDescription>
205 typename std::enable_if<(Description == 2 ),
void>::type
210 template <
int Description = DataDescription>
211 typename std::enable_if<(Description == 3 ),
void>::type
216 template <
int Description = DataDescription>
217 typename std::enable_if<(Description == 4 ),
void>::type
222 template <
int Description = DataDescription>
223 typename std::enable_if<(Description == 5 ),
void>::type
228 template <
int Description = DataDescription>
229 typename std::enable_if<(Description == 6 ),
void>::type
234 template <
int Description = DataDescription>
235 typename std::enable_if<(Description == 7 ),
void>::type
240 template <
int Description = DataDescription>
241 typename std::enable_if<(Description == 8 ),
void>::type
249 template <
int Description = DataDescription>
250 typename std::enable_if<(Description == 9 ), ValueType>::type
255 template <
int Description = DataDescription>
256 typename std::enable_if<(Description == 1 ), ValueType>::type
261 template <
int Description = DataDescription>
262 typename std::enable_if<(Description == 2 ), ValueType>::type
267 template <
int Description = DataDescription>
268 typename std::enable_if<(Description == 3 ), ValueType>::type
273 template <
int Description = DataDescription>
274 typename std::enable_if<(Description == 4 ), ValueType>::type
279 template <
int Description = DataDescription>
280 typename std::enable_if<(Description == 5 ), ValueType>::type
285 template <
int Description = DataDescription>
286 typename std::enable_if<(Description == 6 ), ValueType>::type
291 template <
int Description = DataDescription>
292 typename std::enable_if<(Description == 7 ), ValueType>::type
297 template <
int Description = DataDescription>
298 typename std::enable_if<(Description == 8 ), ValueType>::type
313#if defined(VTK_STRUCTURED_POINT_BACKEND_INSTANTIATING)
315#define VTK_INSTANTIATE_STRUCTURED_POINT_BACKEND(ValueType) \
316 VTK_ABI_NAMESPACE_BEGIN \
317 template class VTKCOMMONCORE_EXPORT vtkStructuredPointBackend<ValueType>; \
318 VTK_ABI_NAMESPACE_END
319#elif defined(VTK_USE_EXTERN_TEMPLATE)
321#ifndef VTK_STRUCTURED_POINT_BACKEND_TEMPLATE_EXTERN
322#define VTK_STRUCTURED_POINT_BACKEND_TEMPLATE_EXTERN
325#pragma warning(disable : 4910)
327VTK_ABI_NAMESPACE_BEGIN
Hold a reference to a vtkObjectBase instance.
A backend for the vtkImplicitArray to query structured points efficiently.
vtkStructuredPointBackend()
virtual ~vtkStructuredPointBackend()
virtual ValueType mapStructuredXComponent(int i) const =0
These function should only be used when direction matrix is NOT identity.
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 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
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
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
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
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.