File: vtkConduitToDataObject.h

package info (click to toggle)
paraview 5.13.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 544,220 kB
  • sloc: cpp: 3,374,605; ansic: 1,332,409; python: 150,381; xml: 122,166; sql: 65,887; sh: 7,317; javascript: 5,262; yacc: 4,417; java: 3,977; perl: 2,363; lex: 1,929; f90: 1,397; makefile: 170; objc: 153; tcl: 59; pascal: 50; fortran: 29
file content (153 lines) | stat: -rw-r--r-- 4,600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class vtkConduitToDataObject
 * @brief Convert conduit node to VTK data objects.
 */

#ifndef vtkConduitToDataObject_h
#define vtkConduitToDataObject_h

#include "vtkIOCatalystConduitModule.h" // For windows import/export of shared libraries

#include "vtkObject.h" // for ABI namespace
#include "vtkSmartPointer.h"

namespace conduit_cpp
{
class Node;
}

VTK_ABI_NAMESPACE_BEGIN
class vtkAbstractArray;
class vtkCellArray;
class vtkDataObject;
class vtkDataSet;
class vtkImageData;
class vtkOverlappingAMR;
class vtkPartitionedDataSet;
class vtkPoints;
class vtkRectilinearGrid;
class vtkStructuredGrid;
class vtkUnstructuredGrid;
VTK_ABI_NAMESPACE_END

namespace vtkConduitToDataObject
{
VTK_ABI_NAMESPACE_BEGIN

/**
 * Fill the vtkPartitionedDataSet input.
 * Create concrete vtkDataSet subclass to set it as partition and add arrays in its
 * DataSetAttributes.
 *
 * Return true if data was correctly generated, false if an error occurred.
 * Do not throw errors.
 */
VTKIOCATALYSTCONDUIT_EXPORT bool FillPartionedDataSet(
  vtkPartitionedDataSet* output, const conduit_cpp::Node& meshNode);

/**
 * Fill the vtkOverlappingAMR input.
 */
VTKIOCATALYSTCONDUIT_EXPORT bool FillAMRMesh(vtkOverlappingAMR* amr, const conduit_cpp::Node& node);

/**
 * vtkDataSet creation.
 */
///@{
/**
 * Create a vtkDataSet concrete subclass from the given a topology and a coordsets nodes.
 *
 * Throw runtime_error on unsupported input.
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkSmartPointer<vtkDataSet> CreateMesh(
  const conduit_cpp::Node& topology, const conduit_cpp::Node& coordsets);

/**
 * Create a vtkImageData from a coordset node.
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkSmartPointer<vtkImageData> CreateImageData(
  const conduit_cpp::Node& coordset);

/**
 * Create a vtkRectilinearGrid from a coordset node.
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkSmartPointer<vtkRectilinearGrid> CreateRectilinearGrid(
  const conduit_cpp::Node& coordset);

/**
 * Create a vtkStructuredGrid from a topology and a coordset nodes.
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkSmartPointer<vtkStructuredGrid> CreateStructuredGrid(
  const conduit_cpp::Node& topology, const conduit_cpp::Node& coordset);

/**
 * Create a vtkUnstructuredGrid from a topology and a coordset node.
 * Topology should have a unique cell type, i.e. its "elements/shape" should not be "mixed".
 * see CreateMixedUnstructuredGrid.
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkSmartPointer<vtkDataSet> CreateMonoShapedUnstructuredGrid(
  const conduit_cpp::Node& topologyNode, const conduit_cpp::Node& coordset);

/**
 * Create a vtkUnstructuredGrid from a coordset and a topology node.
 * Topology "elements/shape" is expected to be "mixed".
 * see CreateMonoShapedUnstructuredGrid
 * throw a runtime_error on invalid node
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkSmartPointer<vtkDataSet> CreateMixedUnstructuredGrid(
  const conduit_cpp::Node& topologyNode, const conduit_cpp::Node& coords);

///@}

/**
 * Add FieldData arrays to output data object.
 * Return true if node was correctly parsed, false if a fatal error occurred.
 * If isAMReX, data array is added as a `CellData`
 */
VTKIOCATALYSTCONDUIT_EXPORT bool AddFieldData(
  vtkDataObject* output, const conduit_cpp::Node& stateFields, bool isAMReX = false);

/**
 * Create a vtkPoints from a coordset node that respect the following requirements:
 * - "type" should be "explicit"
 * - "values" should have at max 3 components
 * throw a runtime_error on invalid node
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkSmartPointer<vtkPoints> CreatePoints(
  const conduit_cpp::Node& coords);

/**
 * Create polyhedron in grid from elements and subelements.
 */
VTKIOCATALYSTCONDUIT_EXPORT void SetPolyhedralCells(
  vtkUnstructuredGrid* grid, vtkCellArray* elements, vtkCellArray* subelements);

///@{
/**
 * Return the number of points in VTK cell type.
 * throw a runtime_error on unsupported type.
 */
VTKIOCATALYSTCONDUIT_EXPORT vtkIdType GetNumberOfPointsInCellType(int vtk_cell_type);

/**
 * Get vtk cell type from conduit shape name
 * throw a runtime_error on unsupported type.
 */
VTKIOCATALYSTCONDUIT_EXPORT int GetCellType(const std::string& shape);

/**
 * Get vtkDataObject attribute type from conduit association string.
 * Supports only "element" and "vertex".
 *
 * Throw runtime_error on unsupported association.
 */
VTKIOCATALYSTCONDUIT_EXPORT int GetAssociation(const std::string& association);
///@}

VTK_ABI_NAMESPACE_END
}

#endif
// VTK-HeaderTest-Exclude: vtkConduitToDataObject.h