VTK  9.5.20251215
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 "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
20#include "vtkIOCatalystConduitModule.h" // for exports
21#include "vtkObject.h"
22#include "vtkSmartPointer.h" // for vtkSmartPointer
23
24#include "conduit.h" // for conduit_node
25
26#include <string> // for std::string
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkCellArray;
30class vtkDataArray;
31
32class VTKIOCATALYSTCONDUIT_EXPORT vtkConduitArrayUtilities : public vtkObject
33{
34public:
37 void PrintSelf(ostream& os, vtkIndent indent) override;
39
47 static bool IsDevicePointer(const void* p, int8_t& id, bool& working);
49
51
54 static vtkSmartPointer<vtkDataArray> MCArrayToVTKArray(const conduit_node* mcarray);
56 const conduit_node* mcarray, const std::string& arrayname);
58
60
68 VTK_DEPRECATED_IN_9_5_0("This function is deprecated, because in the future "
69 "state/metadata/vtk_fields will only be used.")
71 const conduit_node* mcarray, bool is_cell_data);
73
81 vtkIdType numberOfPoints, int cellType, vtkIdType cellSize, const conduit_node* mcarray);
82
88 vtkDataArray* array, int num_components);
89
94 vtkIdType numberOfPoints, const conduit_node* o2mrelation);
95
96protected:
99
100 static bool IsDevicePointer(const void* p, int8_t& id);
101 VTK_DEPRECATED_IN_9_6_0("Use MCArrayToVTKArray.")
102 static vtkSmartPointer<vtkDataArray> MCArrayToVTKArrayImpl(const conduit_node* mcarray)
103 {
104 return MCArrayToVTKArray(mcarray);
105 }
106 static vtkSmartPointer<vtkDataArray> MCArrayToVTKAOSArray(const conduit_node* mcarray);
107 static vtkSmartPointer<vtkDataArray> MCArrayToVTKSOAArray(const conduit_node* mcarray);
108 static vtkSmartPointer<vtkDataArray> MCArrayToVTKStridedArray(const conduit_node* mcarray);
109 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
111 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
112 {
113 return MCArrayToVTKArray(mcarray);
114 }
115 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
117 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
118 {
119 return MCArrayToVTKAOSArray(mcarray);
120 }
121 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
123 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
124 {
125 return MCArrayToVTKSOAArray(mcarray);
126 }
127 VTK_DEPRECATED_IN_9_6_0("Use the overload without force_signed parameter.")
129 const conduit_node* mcarray, bool vtkNotUsed(force_signed))
130 {
131 return MCArrayToVTKStridedArray(mcarray);
132 }
133
134private:
136 void operator=(const vtkConduitArrayUtilities&) = delete;
137};
138
139VTK_ABI_NAMESPACE_END
140
141#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 > MCGhostArrayToVTKGhostArray(const conduit_node *mcarray, bool is_cell_data)
Returns a vtkDataArray from a conduit node in the conduit mcarray protocol that is a conduit ghost ar...
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 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)
#define VTK_DEPRECATED_IN_9_5_0(reason)
int vtkIdType
Definition vtkType.h:368