24#ifndef vtkScaledSOADataArrayTemplate_h
25#define vtkScaledSOADataArrayTemplate_h
29#include "vtkCommonCoreModule.h"
35VTK_ABI_NAMESPACE_BEGIN
36template <
class ValueTypeT>
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;
153 return this->
Data[comp]->GetBuffer()[tupleIdx] * this->Scale;
163 this->
Data[comp]->GetBuffer()[tupleIdx] = value / this->Scale;
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, \
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 \
334#elif defined(VTK_USE_EXTERN_TEMPLATE)
335#ifndef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
336#define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
341#pragma warning(disable : 4910)
343VTK_ABI_NAMESPACE_BEGIN
349VTK_ABI_NAMESPACE_BEGIN
379#elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
383#pragma warning(disable : 4091)
386#pragma warning(disable : 4231)
399#pragma warning(disable : 4910)
403VTK_ABI_NAMESPACE_BEGIN
405 extern template class VTKCOMMONCORE_EXPORT vtkScaledSOADataArrayTemplate);
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
@ VTK_DATA_ARRAY_USER_DEFINED
@ VTK_DATA_ARRAY_ALIGNED_FREE
virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source)=0
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
virtual void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source)=0
Copy the tuples indexed in srcIds from the source array to the tuple locations starting at index dstS...
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
Abstract base class for vtkBuffer providing buffer protocol support.
Abstract superclass to iterate over elements in an vtkAbstractArray.
internal storage class used by vtkSOADataArrayTemplate, vtkAOSDataArrayTemplate, and others.
void Modified() override
Removes out-of-date L2_NORM_RANGE() and L2_NORM_FINITE_RANGE() values.
Base interface for all typed vtkDataArray subclasses.
list of point or cell ids
Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
void ShallowCopy(vtkDataArray *other) override
Create a shallow copy of other into this, if possible.
@ VTK_DATA_ARRAY_USER_DEFINED
@ VTK_DATA_ARRAY_ALIGNED_FREE
void SetNumberOfComponents(int numComps) override
Set/Get the dimension (n) of the components.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
static vtkScaledSOADataArrayTemplate * New()
void SetArray(int comp, ValueType *array, vtkIdType size, bool updateMaxId=false, bool save=false, int deleteMethod=VTK_DATA_ARRAY_FREE)
Use this API to pass externally allocated memory to this instance.
void SetArrayFreeFunction(int comp, void(*callback)(void *))
This method allows the user to specify a custom free function to be called when the array is dealloca...
std::vector< vtkBuffer< ValueType > * > Data
vtkTemplateTypeMacro(SelfType, GenericDataArrayType)
void SetArrayFreeFunction(void(*callback)(void *)) override
This method allows the user to specify a custom free function to be called when the array is dealloca...
ValueType * GetComponentArrayPointer(int comp)
Return a pointer to a contiguous block of memory containing all values for a particular components (i...
vtkScaledSOADataArrayTemplate< ValueTypeT > SelfType
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
vtkScaledSOADataArrayTemplate()
void SetScale(ValueType scale)
Set/Get the Scale value for the object.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
~vtkScaledSOADataArrayTemplate() override
void ExportToVoidPointer(void *ptr) override
Export a copy of the data in AoS ordering to the preallocated memory buffer.
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
void FillTypedComponent(int compIdx, ValueType value) override
Set component comp of all tuples to value.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
vtkBuffer< ValueTypeT > * GetComponentBuffer(int comp)
Return the underlying buffer object for a particular component.
ValueType GetScale() const
Set/Get the Scale value for the object.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
#define vtkArrayDownCast_TemplateFastCastMacro(ArrayT)
Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the paramet...
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_DEPRECATED_IN_9_7_0(reason)
#define vtkCreateGenericWrappedArrayInterface(T)
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
void save(Archiver &ar, const std::string &str, const unsigned int version)