24 #ifndef vtkScaledSOADataArrayTemplate_h
25 #define vtkScaledSOADataArrayTemplate_h
29 #include "vtkCommonCoreModule.h"
35 VTK_ABI_NAMESPACE_BEGIN
36 template <
class ValueTypeT>
64 if (scale != this->Scale)
68 vtkErrorMacro(
"Cannot set Scale to 0");
77 ValueType
GetScale()
const {
return this->Scale; }
88 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
101 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
111 for (
size_t cc = 0; cc < this->Data.size(); cc++)
113 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx] * this->Scale;
122 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
124 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc] / this->Scale;
133 return this->Data[comp]->GetBuffer()[tupleIdx] * this->Scale;
141 this->Data[comp]->GetBuffer()[tupleIdx] = value / this->Scale;
163 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
187 ValueType* GetComponentArrayPointer(
int comp);
240 this->Superclass::InsertTuples(dstIds, srcIds, source);
245 this->Superclass::InsertTuplesStartingAt(dstStart, srcIds, source);
264 std::vector<vtkBuffer<ValueType>*>
Data;
271 inline void GetTupleIndexFromValueIndex(
vtkIdType valueIdx,
vtkIdType& tupleIdx,
int& comp)
const
287 VTK_ABI_NAMESPACE_END
288 #endif // header guard
294 #ifdef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
295 #define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
296 namespace vtkDataArrayPrivate \
298 VTK_ABI_NAMESPACE_BEGIN \
299 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<T>, double); \
300 VTK_ABI_NAMESPACE_END \
302 VTK_ABI_NAMESPACE_BEGIN \
303 template class VTKCOMMONCORE_EXPORT vtkScaledSOADataArrayTemplate<T>; \
304 VTK_ABI_NAMESPACE_END
306 #elif defined(VTK_USE_EXTERN_TEMPLATE)
307 #ifndef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
308 #define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
310 #pragma warning(push)
313 #pragma warning(disable : 4910) // extern and dllexport incompatible
315 VTK_ABI_NAMESPACE_BEGIN
320 VTK_ABI_NAMESPACE_END
321 #endif // VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
324 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
325 #pragma warning(push)
328 #pragma warning(disable : 4091)
331 #pragma warning(disable : 4231)
344 #pragma warning(disable : 4910) // extern and dllexport incompatible
348 VTK_ABI_NAMESPACE_BEGIN
354 VTK_ABI_NAMESPACE_END
Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
void SetScale(ValueType scale)
Set/Get the Scale value for the object.
virtual void ShallowCopy(vtkDataArray *other)
Create a shallow copy of other into this, if possible.
Abstract superclass for all arrays.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
virtual int GetDataType() const =0
Return the underlying data type.
vtkBuffer< ValueType > * AoSCopy
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
Base interface for all typed vtkDataArray subclasses.
vtkScaledSOADataArrayTemplate< ValueTypeT > SelfType
ValueType GetScale() const
Set/Get the Scale value for the object.
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
std::vector< vtkBuffer< ValueType > * > Data
list of point or cell ids
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
abstract superclass for arrays of numeric data
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))
Abstract superclass to iterate over elements in an vtkAbstractArray.
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
virtual int GetArrayType() const
Method for type-checking in FastDownCast implementations.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
vtkArrayDownCast_TemplateFastCastMacro(vtkScaledSOADataArrayTemplate)
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
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.
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkScaledSOADataArrayTemplate)
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
Superclass::ValueType ValueType
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
static vtkScaledSOADataArrayTemplate< ValueType > * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
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.
Template defining traits of native types used by VTK.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
virtual void ExportToVoidPointer(void *out_ptr)
This method copies the array data to the void pointer specified by the user.