VTK  9.6.20260221
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
15
16#ifndef vtkConduitArrayUtilities_h
17#define vtkConduitArrayUtilities_h
18
19#include "vtkIOCatalystConduitModule.h" // for exports
20#include "vtkObject.h"
21#include "vtkSmartPointer.h" // for vtkSmartPointer
22
23#include "conduit.h" // for conduit_node
24
25#include <string> // for std::string
26
27VTK_ABI_NAMESPACE_BEGIN
28class vtkCellArray;
29class vtkDataArray;
30
31class VTKIOCATALYSTCONDUIT_EXPORT vtkConduitArrayUtilities : public vtkObject
32{
33public:
36 void PrintSelf(ostream& os, vtkIndent indent) override;
38
46 static bool IsDevicePointer(const void* p, int8_t& id, bool& working);
48
50
53 static vtkSmartPointer<vtkDataArray> MCArrayToVTKArray(const conduit_node* mcarray);
55 const conduit_node* mcarray, const std::string& arrayname);
57
65 vtkIdType numberOfPoints, int cellType, vtkIdType cellSize, const conduit_node* mcarray);
66
72 vtkDataArray* array, int num_components);
73
78 vtkIdType numberOfPoints, const conduit_node* o2mrelation);
79
80protected:
83
84 static bool IsDevicePointer(const void* p, int8_t& id);
85 VTK_DEPRECATED_IN_9_6_0("Use MCArrayToVTKArray.")
86 static vtkSmartPointer<vtkDataArray> MCArrayToVTKArrayImpl(const conduit_node* mcarray)
87 {
88 return MCArrayToVTKArray(mcarray);
89 }
90 static vtkSmartPointer<vtkDataArray> MCArrayToVTKAOSArray(const conduit_node* mcarray);
91 static vtkSmartPointer<vtkDataArray> MCArrayToVTKSOAArray(const conduit_node* mcarray);
92 static vtkSmartPointer<vtkDataArray> MCArrayToVTKStridedArray(const conduit_node* mcarray);
93 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
95 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
96 {
97 return MCArrayToVTKArray(mcarray);
98 }
99 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
101 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
102 {
103 return MCArrayToVTKAOSArray(mcarray);
104 }
105 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
107 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
108 {
109 return MCArrayToVTKSOAArray(mcarray);
110 }
111 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
113 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
114 {
115 return MCArrayToVTKStridedArray(mcarray);
116 }
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 vtkSmartPointer< vtkCellArray > MCArrayToVTKCellArray(vtkIdType numberOfPoints, int cellType, vtkIdType cellSize, const conduit_node *mcarray)
Converts an mcarray to vtkCellArray.
static vtkConduitArrayUtilities * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkSmartPointer< vtkDataArray > SetNumberOfComponents(vtkDataArray *array, int num_components)
If the number of components in the array does not match the target, a new array is created.
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 > MCArrayToVTKStridedArray(const conduit_node *mcarray)
static vtkSmartPointer< vtkCellArray > O2MRelationToVTKCellArray(vtkIdType numberOfPoints, const conduit_node *o2mrelation)
Read a O2MRelation element.
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.
static vtkSmartPointer< vtkDataArray > MCArrayToVTKSOAArray(const conduit_node *mcarray)
static vtkSmartPointer< vtkDataArray > MCArrayToVTKAOSArray(const conduit_node *mcarray)
static bool IsDevicePointer(const void *p, int8_t &id)
~vtkConduitArrayUtilities() override
static vtkSmartPointer< vtkDataArray > MCArrayToVTKArrayImpl(const conduit_node *mcarray)
a simple class to control print indentation
Definition vtkIndent.h:108
Hold a reference to a vtkObjectBase instance.
#define vtkDataArray
#define VTK_DEPRECATED_IN_9_6_0(reason)
int vtkIdType
Definition vtkType.h:363