VTK  9.6.20260403
vtkStridedImplicitBackend.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3#ifndef vtkStridedImplicitBackend_h
4#define vtkStridedImplicitBackend_h
5
19
20#include "vtkCommonCoreModule.h"
21
22#include "vtkType.h"
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkIdList;
26template <typename ValueType>
27class VTKCOMMONCORE_EXPORT vtkStridedImplicitBackend final
28{
29public:
31
43 const ValueType* buffer, vtkIdType stride, int components, vtkIdType offset);
44 vtkStridedImplicitBackend(const ValueType* buffer, vtkIdType stride, int components);
45 vtkStridedImplicitBackend(const ValueType* buffer, vtkIdType stride);
48
54 ValueType operator()(vtkIdType idx) const;
55
60 void mapTuple(vtkIdType tupleIdx, ValueType* tuple) const;
61
66 ValueType mapComponent(vtkIdType tupleIdx, int compIdx) const;
67
71 const ValueType* GetBuffer() const { return this->Buffer; }
72
76 vtkIdType GetStride() const { return this->Stride; }
77
81 vtkIdType GetOffset() const { return this->Offset; }
82
83private:
84 const ValueType* Buffer = nullptr;
85 vtkIdType Stride = 1;
86 vtkIdType Offset = 0;
87 int NumberOfComponents = 1;
88};
89VTK_ABI_NAMESPACE_END
90
91#endif // vtkStridedImplicitBackend_h
92
93#if defined(VTK_STRIDED_BACKEND_INSTANTIATING)
94
95#define VTK_INSTANTIATE_STRIDED_BACKEND(ValueType) \
96 VTK_ABI_NAMESPACE_BEGIN \
97 template class VTKCOMMONCORE_EXPORT vtkStridedImplicitBackend<ValueType>; \
98 VTK_ABI_NAMESPACE_END
99
100#elif defined(VTK_USE_EXTERN_TEMPLATE)
101
102#ifndef VTK_STRIDED_BACKEND_TEMPLATE_EXTERN
103#define VTK_STRIDED_BACKEND_TEMPLATE_EXTERN
104#ifdef _MSC_VER
105#pragma warning(push)
106#pragma warning(disable : 4910) // extern and dllexport incompatible
107#endif
108VTK_ABI_NAMESPACE_BEGIN
109vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkStridedImplicitBackend);
110VTK_ABI_NAMESPACE_END
111#ifdef _MSC_VER
112#pragma warning(pop)
113#endif
114#endif // VTK_STRIDED_IMPLICIT_BACKEND_TEMPLATE_EXTERN
115
116#endif
list of point or cell ids
Definition vtkIdList.h:135
A backend for the vtkImplicitArray framework to give a strided view on a buffer.
vtkStridedImplicitBackend(const ValueType *buffer, vtkIdType stride, int components, vtkIdType offset)
Constructors.
ValueType mapComponent(vtkIdType tupleIdx, int compIdx) const
Return the specified component value.
const ValueType * GetBuffer() const
Return the memory size of the buffer in bytes.
void mapTuple(vtkIdType tupleIdx, ValueType *tuple) const
Fill tuple with the content of the tupleIdx of the array.
vtkIdType GetStride() const
Return the stride of the buffer in number of values.
ValueType operator()(vtkIdType idx) const
Return the value at the given flat idx.
vtkIdType GetOffset() const
Return the offset of the buffer in number of values.
vtkStridedImplicitBackend(const ValueType *buffer, vtkIdType stride, int components)
Constructors.
vtkStridedImplicitBackend(const ValueType *buffer, vtkIdType stride)
Constructors.
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
Definition vtkType.h:458
int vtkIdType
Definition vtkType.h:363