VTK  9.7.20260927
vtkmDataArrayFactory.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
59
60#ifndef vtkmDataArrayFactory_h
61#define vtkmDataArrayFactory_h
62
63#include "vtkAcceleratorsVTKmCoreModule.h" // For export macro
64#include "vtkObject.h"
65#include "vtkmlib/vtkmInitializer.h" // Need for initializing viskores
66
67#include <vector> // For std::vector
68
69VTK_ABI_NAMESPACE_BEGIN
70
71class vtkDataArray;
73
74class VTKACCELERATORSVTKMCORE_EXPORT vtkmDataArrayFactory : public vtkObject
75{
76public:
79 void PrintSelf(ostream& os, vtkIndent indent) override;
80
82
88
90
93 vtkSetMacro(NumberOfComponents, int);
94 vtkGetMacro(NumberOfComponents, int);
96
98
101 vtkSetMacro(DataType, int);
102 vtkGetMacro(DataType, int);
104
112
118
123
138
139protected:
142
145 int DataType = 10; // VTK_FLOAT
146
147 std::vector<vtkMemoryDescriptor*> Buffers;
148
149private:
151 void operator=(const vtkmDataArrayFactory&) = delete;
152
153 // Viskores has to be initialized before any of its devices is touched, and
154 // this class is the one place in Core that hands it device memory. Every
155 // vtkm *filter* carries this member; nothing in Core did, so a program that
156 // only wrapped external memory -- which is exactly what the DLPack import
157 // path does -- never initialized it. On a Kokkos-backed build that is not a
158 // warning: the first host read of a device array calls Kokkos::HIP::HIP(),
159 // which calls host_abort(). The process dies with no exception to catch.
160 vtkmInitializer Initializer;
161};
162
163VTK_ABI_NAMESPACE_END
164#endif // vtkmDataArrayFactory_h
a simple class to control print indentation
Definition vtkIndent.h:108
Describes a memory buffer on host or device, and who keeps it alive.
~vtkmDataArrayFactory() override
void ClearBuffers()
Drop all added descriptors without creating an array.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddBuffer(vtkMemoryDescriptor *descriptor)
Add a buffer descriptor.
std::vector< vtkMemoryDescriptor * > Buffers
static vtkmDataArrayFactory * New()
int GetNumberOfBuffers() const
Number of buffers added so far.
vtkDataArray * CreateArray()
Create the vtkmDataArray, or nullptr on error.
#define vtkDataArray
int vtkIdType
Definition vtkType.h:363
#define VTK_NEWINSTANCE