46 #ifndef vtkDenseArray_h
47 #define vtkDenseArray_h
204 std::vector<vtkStdString> DimensionLabels;
223 std::vector<vtkIdType> Offsets;
228 std::vector<vtkIdType> Strides;
232 #include "vtkDenseArray.txx"
Stores coordinate into an N-way array.
Stores the number of dimensions and valid coordinate ranges along each dimension for vtkArray.
Abstract interface for N-dimensional arrays.
vtkArrayExtents::SizeT SizeT
vtkArrayExtents::DimensionT DimensionT
vtkArrayExtents::CoordinateT CoordinateT
MemoryBlock implementation that manages internally-allocated memory using new[] and delete[].
HeapMemoryBlock(const vtkArrayExtents &extents)
~HeapMemoryBlock() override
T * GetAddress() override
Returns a pointer to the block of memory to be used for storage.
Strategy object that contains a block of memory to be used by vtkDenseArray for value storage.
virtual T * GetAddress()=0
Returns a pointer to the block of memory to be used for storage.
MemoryBlock implementation that manages a static (will not be freed) memory block.
StaticMemoryBlock(T *const storage)
T * GetAddress() override
Returns a pointer to the block of memory to be used for storage.
Contiguous storage for N-way arrays.
void SetValueN(const SizeT n, const T &value) override
Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
vtkTemplateTypeMacro(vtkDenseArray< T >, vtkTypedArray< T >)
vtkArray::DimensionT DimensionT
SizeT GetNonNullSize() override
Returns the number of non-null values stored in the array.
void SetValue(CoordinateT i, const T &value) override
Overwrites the value stored in the array at the given coordinates.
T & operator[](const vtkArrayCoordinates &coordinates)
Returns a value by-reference, which is useful for performance and code-clarity.
~vtkDenseArray() override
Stores the current array extents (its size along each dimension)
T * GetStorage()
Returns a mutable reference to the underlying storage.
const T & GetValue(CoordinateT i, CoordinateT j, CoordinateT k) override
Returns the value stored in the array at the given coordinates.
bool IsDense() override
Returns true iff the underlying array storage is "dense", i.e.
void ExternalStorage(const vtkArrayExtents &extents, MemoryBlock *storage)
Initializes the array to use an externally-allocated memory block.
vtkArray * DeepCopy() override
Returns a new array that is a deep copy of this array.
vtkDenseArray()
Stores the current array extents (its size along each dimension)
void Fill(const T &value)
Fills every element in the array with the given value.
void GetCoordinatesN(const SizeT n, vtkArrayCoordinates &coordinates) override
Returns the coordinates of the n-th value in the array, where n is in the range [0,...
const T & GetValue(CoordinateT i, CoordinateT j) override
Returns the value stored in the array at the given coordinates.
const T * GetStorage() const
Returns a read-only reference to the underlying storage.
const vtkArrayExtents & GetExtents() override
Returns the extents (the number of dimensions and size along each dimension) of the array.
vtkArray::CoordinateT CoordinateT
const T & GetValueN(const SizeT n) override
Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
const T & GetValue(const vtkArrayCoordinates &coordinates) override
Returns the value stored in the array at the given coordinates.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetValue(CoordinateT i, CoordinateT j, const T &value) override
Overwrites the value stored in the array at the given coordinates.
void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T &value) override
Overwrites the value stored in the array at the given coordinates.
void SetValue(const vtkArrayCoordinates &coordinates, const T &value) override
Overwrites the value stored in the array at the given coordinates.
static vtkDenseArray< T > * New()
const T & GetValue(CoordinateT i) override
Returns the value stored in the array at the given coordinates.
a simple class to control print indentation
Wrapper around std::string to keep symbols short.
Provides a type-specific interface to N-way arrays.