23 #include "vtkCommonCoreModule.h"
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkBitArrayLookup;
42 using ArrayTypeTag = std::integral_constant<int, vtkArrayTypes::VTK_BIT_ARRAY>;
212 ValueType GetTypedComponent(
vtkIdType tupleIdx,
int comp)
const
214 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents());
220 void SetTypedComponent(
vtkIdType tupleIdx,
int comp, ValueType
value)
221 VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + comp < GetNumberOfValues())
222 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents());
229 void GetTypedTuple(
vtkIdType tupleIdx, ValueType* tuple) const
230 VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples());
237 void SetTypedTuple(
vtkIdType tupleIdx, const ValueType* tuple)
238 VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples());
288 void InsertComponent(
vtkIdType i,
int j,
double c) override;
303 "vtkAbstractArray::SetNumberOf[Values/Tuples]() instead")
306 return this->WritePointer(
id, number);
320 #endif // __VTK_WRAP__
350 ValueType* array,
vtkIdType size,
int save,
int deleteMethod = VTK_DATA_ARRAY_DELETE);
354 this->SetArray(static_cast<ValueType*>(array), size, save);
358 this->SetArray(static_cast<ValueType*>(array), size, save, deleteMethod);
383 void LookupValue(
int value,
vtkIdList* ids);
394 void DataChanged() override;
401 void ClearLookup() override;
405 ~vtkBitArray() override;
418 virtual
void InitializeUnusedBitsInLastByte();
423 bool ReallocateTuples(
vtkIdType numTuples);
434 if (!this->
ReserveTuples(size / this->NumberOfComponents + 1))
438 return this->Buffer->GetBuffer();
448 vtkBitArrayLookup* Lookup;
457 const auto bitsetDiv = std::div(
id, static_cast<vtkIdType>(8));
458 const vtkIdType &bitsetId = bitsetDiv.quot, &bitId = bitsetDiv.rem;
476 if (valueIdx > this->
MaxId)
478 this->
MaxId = valueIdx;
503 VTK_ABI_NAMESPACE_END
vtkBuffer< ValueType > * Buffer
int GetDataType() const override
Return the underlying data type.
int GetDataTypeSize() const override
Return the size of the underlying data type.
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
virtual void DeepCopy(vtkAbstractArray *da)
Deep copy of data.
void SetVariantValue(vtkIdType idx, vtkVariant value) override
Set a value in the array from a variant.
virtual void ShallowCopy(vtkDataArray *other)
Create a shallow copy of other into this, if possible.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
Abstract superclass for all arrays.
virtual double * GetTuple(vtkIdType tupleIdx)=0
Get the data tuple at tupleIdx.
void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
virtual vtkTypeBool ReserveTuples(vtkIdType numTuples)=0
Reserve the array to the requested number of tuples and preserve data.
void DeepCopy(vtkAbstractArray *aa) override
Deep copy of data.
void InsertValue(vtkIdType id, int i)
Inserts values and checks to make sure there is enough memory.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A type representing the union of many types.
void SetValue(vtkIdType id, int value)
Set the data at a particular index.
int ToInt(bool *valid) const
Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type...
void * GetVoidPointer(vtkIdType id) override
Return a void pointer.
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
virtual void SetComponent(vtkIdType tupleIdx, int compIdx, double value)
Set the data component at the location specified by tupleIdx and compIdx to value.
vtkTypeBool ReserveTuples(vtkIdType numTuples) override
Reserve the array to the requested number of tuples and preserve data.
ScalarType * GetBuffer()
Access the buffer as a scalar pointer.
a simple class to control print indentation
void save(Archiver &ar, const std::string &str, const unsigned int version)
vtkArrayDownCast_FastCastMacro(vtkBitArray)
list of point or cell ids
void InsertVariantValue(vtkIdType idx, vtkVariant value) override
Inserts values from a variant and checks to ensure there is enough memory.
abstract superclass for arrays of numeric data
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
void DataChanged() override
Tell the array explicitly that the data has changed.
static vtkDataArray * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
void SetVoidArray(void *array, vtkIdType size, int save, int deleteMethod) override
This method lets the user specify data to be held by the array.
Abstract superclass to iterate over elements in an vtkAbstractArray.
int GetValue(vtkIdType id) const
Get the data at a particular index.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
virtual void InitializeUnusedBitsInLastByte()
This method should be called whenever MaxId needs to be changed, as this method fills the unused bits...
void DeepCopy(vtkAbstractArray *aa) override
Deep copy of another bit array.
virtual double GetComponent(vtkIdType tupleIdx, int compIdx)
Return the data component at the location specified by tupleIdx and compIdx.
dynamic, self-adjusting array of bits
virtual void SetArrayFreeFunction(void(*callback)(void *))=0
This method allows the user to specify a custom free function to be called when the array is dealloca...
Abstract base class for vtkBuffer providing buffer protocol support.
vtkIdType InsertNextValue(int i)
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
virtual void RemoveTuple(vtkIdType tupleIdx)=0
These methods remove tuples from the data array.
vtkVariant GetVariantValue(vtkIdType idx) override
Get a value in the array as a variant.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
virtual bool SetNumberOfValues(vtkIdType numValues)
Specify the number of values (tuples * components) for this object to hold.
virtual void Squeeze()=0
Free any unnecessary memory.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void ShallowCopy(vtkAbstractArray *src)
This method will copy the data from the source array to this array.
#define VTK_DEPRECATED_IN_9_7_0(reason)
void SetVoidArray(void *array, vtkIdType size, int save) override
This method lets the user specify data to be held by the array.
vtkBuffer< ValueType > * GetBuffer()
Return the underlying buffer object.