VTK: Common/Core/vtkIndexedArray.h File Reference

| VTK 9.3.1

Macros | Typedefs | Functions
vtkIndexedArray.h File Reference
`#include "vtkCommonCoreModule.h"`
`#include "vtkImplicitArray.h"`
`#include "vtkIndexedImplicitBackend.h"`
`#include <vector>`
Include dependency graph for vtkIndexedArray.h:

Go to the source code of this file.

## Macros
#define | VTK_INDEXED_ARRAY_TEMPLATE_EXTERN

## Typedefs
template<typename T >
using | vtkIndexedArray = vtkImplicitArray< vtkIndexedImplicitBackend< T > >
| A utility alias for creating a wrapper array around an existing array and reindexing its components. More...

## Functions
| vtkExternSecondOrderTemplateMacro (extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, vtkIndexedImplicitBackend)

## Macro Definition Documentation

## ◆ VTK_INDEXED_ARRAY_TEMPLATE_EXTERN

#define VTK_INDEXED_ARRAY_TEMPLATE_EXTERN

Definition at line 79 of file vtkIndexedArray.h.

## Typedef Documentation

## ◆ vtkIndexedArray

template<typename T >

vtkIndexedArray

A utility alias for creating a wrapper array around an existing array and reindexing its components.

In order to be usefully included in the dispatchers, these arrays need to be instantiated at the vtk library compile time.

An example of potential usage:

vtkNew<vtkIntArray> baseArray;
baseArray->SetNumberOfComponents(1);
baseArray->SetNumberOfTuples(100);
auto range = vtk::DataArrayValueRange<1>(baseArray);
std::iota(range.begin(), range.end(), 0);
vtkNew<vtkIdList> handles;
handles->SetNumberOfIds(100);
for (vtkIdType idx = 0; idx < 100; idx++)
{
handles->SetId(idx, 99-idx);
}
vtkNew<vtkIndexed<int>> indexedArr;
indexedArr->SetBackend(std::make_shared<vtkIndexedImplicitBackend<int>>(handles, baseArray));
indexedArr->SetNumberOfComponents(1);
indexedArr->SetNumberOfTuples(100);
CHECK(indexedArr->GetValue(57) == 42); // always true
vtkGenericDataArray::SetNumberOfComponents
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
vtkGenericDataArray::SetNumberOfTuples
void SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.
vtkIdList::SetNumberOfIds
void SetNumberOfIds(vtkIdType number)
Specify the number of ids for this object to hold.
vtkIdList::SetId
void SetId(vtkIdType i, vtkIdType vtkid)
Set the id at location i.
Definition: vtkIdList.h:87
vtkIndexedImplicitBackend
A backend for the vtkImplicitArray framework allowing one to use a subset of a given data array,...
Definition: vtkIndexedImplicitBackend.h:54
vtkNew< vtkIntArray >
vtkX3D::range
@ range
Definition: vtkX3D.h:238
vtkIdType
int vtkIdType
Definition: vtkType.h:315

See also
  vtkImplicitArray vtkIndexedImplicitBackend

Definition at line 58 of file vtkIndexedArray.h.

## Function Documentation

## ◆ vtkExternSecondOrderTemplateMacro()

vtkExternSecondOrderTemplateMacro | ( | extern template class VTKCOMMONCORE_EXPORT | vtkImplicitArray,
|  | vtkIndexedImplicitBackend |
| ) |  |