VTK  9.5.20251126
vtkStridedArray.h File Reference
#include "vtkCommonCoreModule.h"
#include "vtkImplicitArray.h"
#include "vtkStridedImplicitBackend.h"
Include dependency graph for vtkStridedArray.h:

Go to the source code of this file.

Macros

#define VTK_STRIDED_ARRAY_TEMPLATE_EXTERN
 

Typedefs

template<typename T>
using vtkStridedArray
 An implicit array to create a strided view on a buffer.
 

Functions

 vtkExternSecondOrderWithParameterTemplateMacro (extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray, vtkStridedImplicitBackend, vtkArrayTypes::VTK_STRIDED_ARRAY)
 

Macro Definition Documentation

◆ VTK_STRIDED_ARRAY_TEMPLATE_EXTERN

#define VTK_STRIDED_ARRAY_TEMPLATE_EXTERN

Definition at line 98 of file vtkStridedArray.h.

Typedef Documentation

◆ vtkStridedArray

template<typename T>
using vtkStridedArray
Initial value:
A read only array class that wraps an implicit function from integers to any value type supported by ...
@ VTK_STRIDED_ARRAY
Definition vtkType.h:96

An implicit array to create a strided view on a buffer.

Starting with a multi-dimensional buffer of data, a vtkStridedArray can provide the vtkDataArray interface on only one dimension.

An example of potential usage:

std::vector<float> localBuffer
{
1000, 2000, 3000,
1001, 2001, 3001,
1002, 2002, 3002,
1003, 2003, 3003,
1004, 2004, 3004,
1005, 2005, 3005,
1006, 2006, 3006,
1007, 2007, 3007,
1008, 2008, 3008,
1009, 2009, 3009
}
stridedArray->SetNumberOfComponents(2);
stridedArray->SetNumberOfTuples(10);
const int stride = 3;
const int offset = 1;
const int comp = 2;
stridedArray->ConstructBackend(localBuffer.data(), stride, comp, offset);
CHECK(stridedArr->GetComponent(2, 1) == 3002); // true
// more generically:
stridedArr->GetComponent(tupleIdx, compIdx) = buffer[offset + compIdx + tupleIdx * stride];
Allocate and hold a VTK object.
Definition vtkNew.h:167

You can see the stride as the number of components of the buffer.

Warning
The buffer is not owned by the vtkStridedArray: do not try to use the vtkStridedArray after the buffer memory is released.
Note
The different components of the array should be contiguous. vtkStridedArray supports a global stride but not a stride between component. In the previous example, one cannot create a vtkStridedArray using the 100X series as first component and the 300X series as a second component.
See also
vtkImplicitArray vtkStridedImplicitBackend

Definition at line 73 of file vtkStridedArray.h.

Function Documentation

◆ vtkExternSecondOrderWithParameterTemplateMacro()

vtkExternSecondOrderWithParameterTemplateMacro ( extern template class VTKCOMMONCORE_EXPORT vtkImplicitArray,
vtkStridedImplicitBackend ,
vtkArrayTypes::VTK_STRIDED_ARRAY  )