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 VTK_ALWAYS_INLINE
140 template <
int Description = DataDescription>
141 typename std::enable_if<(Description != 9 ), ValueType>::type VTK_ALWAYS_INLINE
148 template <
int Description = DataDescription>
149 typename std::enable_if<(Description == 9 ), ValueType>::type VTK_ALWAYS_INLINE
153 template <
int Description = DataDescription>
154 typename std::enable_if<(Description != 9 ), ValueType>::type VTK_ALWAYS_INLINE
161 template <
int Description = DataDescription>
162 typename std::enable_if<(Description == 9 ), ValueType>::type VTK_ALWAYS_INLINE
166 template <
int Description = DataDescription>
167 typename std::enable_if<(Description != 9 ), ValueType>::type VTK_ALWAYS_INLINE
174 template <
int Description = DataDescription>
175 typename std::enable_if<(Description == 9 ),
void>::type VTK_ALWAYS_INLINE
179 template <
int Description = DataDescription>
180 typename std::enable_if<(Description != 9 ),
void>::type VTK_ALWAYS_INLINE
187 template <
int Description = DataDescription>
188 typename std::enable_if<(Description == 9 ),
void>::type VTK_ALWAYS_INLINE
192 template <
int Description = DataDescription>
193 typename std::enable_if<(Description == 1 ),
void>::type VTK_ALWAYS_INLINE
197 template <
int Description = DataDescription>
198 typename std::enable_if<(Description == 2 ),
void>::type VTK_ALWAYS_INLINE
202 template <
int Description = DataDescription>
203 typename std::enable_if<(Description == 3 ),
void>::type VTK_ALWAYS_INLINE
207 template <
int Description = DataDescription>
208 typename std::enable_if<(Description == 4 ),
void>::type VTK_ALWAYS_INLINE
212 template <
int Description = DataDescription>
213 typename std::enable_if<(Description == 5 ),
void>::type VTK_ALWAYS_INLINE
217 template <
int Description = DataDescription>
218 typename std::enable_if<(Description == 6 ),
void>::type VTK_ALWAYS_INLINE
222 template <
int Description = DataDescription>
223 typename std::enable_if<(Description == 7 ),
void>::type VTK_ALWAYS_INLINE
227 template <
int Description = DataDescription>
228 typename std::enable_if<(Description == 8 ),
void>::type VTK_ALWAYS_INLINE
235 template <
int Description = DataDescription>
236 typename std::enable_if<(Description == 9 ), ValueType>::type VTK_ALWAYS_INLINE
240 template <
int Description = DataDescription>
241 typename std::enable_if<(Description == 1 ), ValueType>::type
246 template <
int Description = DataDescription>
247 typename std::enable_if<(Description == 2 ), ValueType>::type VTK_ALWAYS_INLINE
251 template <
int Description = DataDescription>
252 typename std::enable_if<(Description == 3 ), ValueType>::type VTK_ALWAYS_INLINE
256 template <
int Description = DataDescription>
257 typename std::enable_if<(Description == 4 ), ValueType>::type VTK_ALWAYS_INLINE
261 template <
int Description = DataDescription>
262 typename std::enable_if<(Description == 5 ), ValueType>::type VTK_ALWAYS_INLINE
266 template <
int Description = DataDescription>
267 typename std::enable_if<(Description == 6 ), ValueType>::type VTK_ALWAYS_INLINE
271 template <
int Description = DataDescription>
272 typename std::enable_if<(Description == 7 ), ValueType>::type VTK_ALWAYS_INLINE
276 template <
int Description = DataDescription>
277 typename std::enable_if<(Description == 8 ), ValueType>::type VTK_ALWAYS_INLINE
291#if defined(VTK_STRUCTURED_POINT_BACKEND_INSTANTIATING)
293#define VTK_INSTANTIATE_STRUCTURED_POINT_BACKEND(ValueType) \
294 VTK_ABI_NAMESPACE_BEGIN \
295 template class VTKCOMMONCORE_EXPORT vtkStructuredPointBackend<ValueType>; \
296 VTK_ABI_NAMESPACE_END
297#elif defined(VTK_USE_EXTERN_TEMPLATE)
299#ifndef VTK_STRUCTURED_POINT_BACKEND_TEMPLATE_EXTERN
300#define VTK_STRUCTURED_POINT_BACKEND_TEMPLATE_EXTERN
303#pragma warning(disable : 4910)
305VTK_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.