VTK  9.3.20240329
Public Member Functions | Protected Attributes | List of all members
vtkCompositeImplicitBackend< ValueType > Class Template Referencefinal

A utility structure serving as a backend for composite arrays: an array composed of multiple arrays concatenated together. More...

#include <vtkCompositeImplicitBackend.h>

Public Member Functions

 vtkCompositeImplicitBackend (const std::vector< vtkDataArray * > &arrays)
 Constructor for the backend. More...
 
 ~vtkCompositeImplicitBackend ()
 
ValueType operator() (int idx) const
 Indexing operator for the composite of the two arrays respecting the vtkImplicitArray expectations. More...
 
unsigned long getMemorySize () const
 Returns the smallest integer memory size in KiB needed to store the array. More...
 

Protected Attributes

std::unique_ptr< Internals > Internal
 

Detailed Description

template<typename ValueType>
class vtkCompositeImplicitBackend< ValueType >

A utility structure serving as a backend for composite arrays: an array composed of multiple arrays concatenated together.

This structure can be classified as a closure and can be called using syntax similar to a function call.

This class uses indirect addressing of cached arrays to provide an access compute complexity of O(log_2(number_of_arrays)) through its () operator.

At construction it takes an array arrays in order to represent their concatenation.

An example of potential usage in a vtkImplicitArray

leftArr->SetNumberOfTuples(1);
leftArr->SetValue(0, 0);
rightArr->SetNumberOfComponents(1);
rightArr->SetNumberOfTuples(1);
rightArr->SetValue(0, 1);
`vtkNew<vtkCompositeArray<int>> compositeArr;` if applicable
std::vector<vtkDataArray*> arrays({leftArr, rightArr});
compositeArr->SetBackend(std::make_shared<vtkCompositeImplicitBackend<int>>(arrays));
CHECK(compositArr->GetValue(1) == 1);
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
A utility structure serving as a backend for composite arrays: an array composed of multiple arrays c...
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
void SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.

WARNING: Arrays input to the backend are flattened upon use and are no longer sensitive to component information.

Definition at line 51 of file vtkCompositeImplicitBackend.h.

Constructor & Destructor Documentation

◆ vtkCompositeImplicitBackend()

template<typename ValueType >
vtkCompositeImplicitBackend< ValueType >::vtkCompositeImplicitBackend ( const std::vector< vtkDataArray * > &  arrays)

Constructor for the backend.

Parameters
arraysstd::vector of arrays to composite together leftArr->GetNumberOfTuples()

◆ ~vtkCompositeImplicitBackend()

template<typename ValueType >
vtkCompositeImplicitBackend< ValueType >::~vtkCompositeImplicitBackend ( )

Member Function Documentation

◆ operator()()

template<typename ValueType >
ValueType vtkCompositeImplicitBackend< ValueType >::operator() ( int  idx) const

Indexing operator for the composite of the two arrays respecting the vtkImplicitArray expectations.

Conceptually, the composite array uses a binary search algorithm through the use of std::upper_bounds to offer a compute complexity of O(log_2(n_arrays))

◆ getMemorySize()

template<typename ValueType >
unsigned long vtkCompositeImplicitBackend< ValueType >::getMemorySize ( ) const

Returns the smallest integer memory size in KiB needed to store the array.

The memory size of the composite array is calculated as the sum of the sizes of its components. Used to implement GetActualMemorySize on vtkCompositeArray.

Member Data Documentation

◆ Internal

template<typename ValueType >
std::unique_ptr<Internals> vtkCompositeImplicitBackend< ValueType >::Internal
protected

Definition at line 80 of file vtkCompositeImplicitBackend.h.


The documentation for this class was generated from the following file: