VTK  9.4.20250509
vtkConduitArrayUtilities.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
17#ifndef vtkConduitArrayUtilities_h
18#define vtkConduitArrayUtilities_h
19
20#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_5_0
21#include "vtkIOCatalystConduitModule.h" // for exports
22#include "vtkObject.h"
23#include "vtkSmartPointer.h" // for vtkSmartPointer
24
25#include "conduit.h" // for conduit_node
26
27#include <string> // for std::string
28
29VTK_ABI_NAMESPACE_BEGIN
30class vtkCellArray;
31class vtkDataArray;
32
33class VTKIOCATALYSTCONDUIT_EXPORT vtkConduitArrayUtilities : public vtkObject
34{
35public:
38 void PrintSelf(ostream& os, vtkIndent indent) override;
40
48 static bool IsDevicePointer(const void* p, int8_t& id, bool& working);
50
52
55 static vtkSmartPointer<vtkDataArray> MCArrayToVTKArray(const conduit_node* mcarray);
57 const conduit_node* mcarray, const std::string& arrayname);
59
61
69 VTK_DEPRECATED_IN_9_5_0("This function is deprecated, because in the future "
70 "state/metadata/vtk_fields will only be used.")
71 static vtkSmartPointer<vtkDataArray> MCGhostArrayToVTKGhostArray(
72 const conduit_node* mcarray, bool is_cell_data);
74
81 VTK_DEPRECATED_IN_9_4_0("Version with additional `numberOfPoints` parameter needed with "
82 "zero-copy arrays stored on acceleration devices such as CUDA")
83 static vtkSmartPointer<vtkCellArray> MCArrayToVTKCellArray(
84 int cellType, vtkIdType cellSize, const conduit_node* mcarray);
85 static vtkSmartPointer<vtkCellArray> MCArrayToVTKCellArray(
86 vtkIdType numberOfPoints, int cellType, vtkIdType cellSize, const conduit_node* mcarray);
87
92 static vtkSmartPointer<vtkDataArray> SetNumberOfComponents(
93 vtkDataArray* array, int num_components);
94
98 VTK_DEPRECATED_IN_9_4_0("Version with additional `numberOfPoints` parameter needed with "
99 "zero-copy arrays stored on acceleration devices such as CUDA. "
100 "`leafname` is always connectivity, so it is removed in the new version.")
101 static vtkSmartPointer<vtkCellArray> O2MRelationToVTKCellArray(
102 const conduit_node* o2mrelation, const std::string& leafname);
103 static vtkSmartPointer<vtkCellArray> O2MRelationToVTKCellArray(
104 vtkIdType numberOfPoints, const conduit_node* o2mrelation);
105
106protected:
109
110 static bool IsDevicePointer(const void* p, int8_t& id);
111 static vtkSmartPointer<vtkDataArray> MCArrayToVTKArrayImpl(
112 const conduit_node* mcarray, bool force_signed);
113 static vtkSmartPointer<vtkDataArray> MCArrayToVTKAOSArray(
114 const conduit_node* mcarray, bool force_signed);
115 static vtkSmartPointer<vtkDataArray> MCArrayToVTKSOAArray(
116 const conduit_node* mcarray, bool force_signed);
117
118private:
120 void operator=(const vtkConduitArrayUtilities&) = delete;
121};
122
123VTK_ABI_NAMESPACE_END
124
125#endif
object to represent cell connectivity
helper to convert Conduit arrays to VTK arrays.
static vtkConduitArrayUtilities * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static bool IsDevicePointer(const void *p, int8_t &id, bool &working)
Returns true if p is a device pointer, false if it is a host pointer.
static vtkSmartPointer< vtkDataArray > MCArrayToVTKArray(const conduit_node *mcarray, const std::string &arrayname)
Returns a vtkDataArray from a conduit node in the conduit mcarray protocol.
static vtkSmartPointer< vtkDataArray > MCArrayToVTKArray(const conduit_node *mcarray)
Returns a vtkDataArray from a conduit node in the conduit mcarray protocol.
abstract superclass for arrays of numeric data
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Hold a reference to a vtkObjectBase instance.
#define VTK_DEPRECATED_IN_9_4_0(reason)
#define VTK_DEPRECATED_IN_9_5_0(reason)
int vtkIdType
Definition vtkType.h:332