24 #ifndef vtkScaledSOADataArrayTemplate_h
25 #define vtkScaledSOADataArrayTemplate_h
29 #include "vtkCommonCoreModule.h"
35 VTK_ABI_NAMESPACE_BEGIN
36 template <
class ValueTypeT>
55 using typename Superclass::ArrayTypeTag;
56 using typename Superclass::DataTypeTag;
57 using typename Superclass::ValueType;
78 if (scale != this->Scale)
82 vtkErrorMacro(
"Cannot set Scale to 0");
103 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
117 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
128 for (
size_t cc = 0; cc < this->Data.size(); cc++)
130 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx] * this->Scale;
140 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
142 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc] / this->Scale;
151 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents())
153 return this->Data[comp]->GetBuffer()[tupleIdx] * this->Scale;
161 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents())
163 this->Data[comp]->GetBuffer()[tupleIdx] =
value / this->Scale;
185 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
209 ValueType* GetComponentArrayPointer(
int comp);
221 #endif // __VTK_WRAP__
228 void ExportToVoidPointer(
void* ptr) override;
232 void SetNumberOfComponents(
int numComps) override;
243 this->Superclass::InsertTuples(dstIds, srcIds, source);
248 this->Superclass::InsertTuplesStartingAt(dstStart, srcIds, source);
265 bool AllocateTuples(
vtkIdType numTuples);
271 bool ReallocateTuples(
vtkIdType numTuples);
279 void GetTupleIndexFromValueIndex(
vtkIdType valueIdx,
vtkIdType& tupleIdx,
int& comp)
const
295 VTK_ABI_NAMESPACE_END
300 #define vtkCreateScaledSOAWrappedArrayInterface(T) \
301 vtkCreateWrappedArrayReadInterface(T); \
302 vtkCreateWrappedArrayWriteInterface(T); \
303 T* GetComponentArrayPointer(int id); \
304 vtkAbstractBuffer* GetComponentBuffer(int comp); \
305 void SetArray(int comp, VTK_ZEROCOPY T* array, vtkIdType size, bool updateMaxId, bool save, \
307 #endif // header guard
313 #ifdef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
314 #define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
315 namespace vtkDataArrayPrivate \
317 VTK_ABI_NAMESPACE_BEGIN \
318 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<T>, double); \
319 VTK_ABI_NAMESPACE_END \
321 VTK_ABI_NAMESPACE_BEGIN \
322 template class VTKCOMMONCORE_EXPORT vtkScaledSOADataArrayTemplate<T>; \
323 VTK_ABI_NAMESPACE_END
327 #define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE_VALUERANGE(T) \
328 namespace vtkDataArrayPrivate \
330 VTK_ABI_NAMESPACE_BEGIN \
331 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<T>, T); \
332 VTK_ABI_NAMESPACE_END \
342 #elif defined(VTK_USE_EXTERN_TEMPLATE) && !defined(__MINGW32__)
343 #ifndef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
344 #define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
346 #pragma warning(push)
349 #pragma warning(disable : 4910) // extern and dllexport incompatible
351 VTK_ABI_NAMESPACE_BEGIN
353 VTK_ABI_NAMESPACE_END
357 VTK_ABI_NAMESPACE_BEGIN
378 VTK_ABI_NAMESPACE_END
384 #endif // VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
387 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
388 #pragma warning(push)
391 #pragma warning(disable : 4091)
394 #pragma warning(disable : 4231)
407 #pragma warning(disable : 4910) // extern and dllexport incompatible
411 VTK_ABI_NAMESPACE_BEGIN
417 VTK_ABI_NAMESPACE_END
Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
Struct-Of-Arrays implementation of vtkGenericDataArray.
void SetScale(ValueType scale)
Set/Get the Scale value for the object.
#define vtkCreateGenericWrappedArrayInterface(T)
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
Abstract superclass for all arrays.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
Base interface for all typed vtkDataArray subclasses.
ValueType GetScale() const
Set/Get the Scale value for the object.
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
internal storage class used by vtkSOADataArrayTemplate, vtkAOSDataArrayTemplate, and others...
void save(Archiver &ar, const std::string &str, const unsigned int version)
list of point or cell ids
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
abstract superclass for arrays of numeric data
Abstract superclass to iterate over elements in an vtkAbstractArray.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
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.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkArrayDownCast_TemplateFastCastMacro(vtkScaledSOADataArrayTemplate)
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
Abstract base class for vtkBuffer providing buffer protocol support.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkScaledSOADataArrayTemplate)
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
#define VTK_DEPRECATED_IN_9_7_0(reason)
void Modified() override
Removes out-of-date L2_NORM_RANGE() and L2_NORM_FINITE_RANGE() values.
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.