VTK  9.6.20260708
vtkXdmfHeavyData.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
3#ifndef vtkXdmfHeavyData_h
4#define vtkXdmfHeavyData_h
5
6#include "vtk_xdmf2.h"
7#include VTKXDMF2_HEADER(XdmfDataItem.h)
8#include VTKXDMF2_HEADER(XdmfGrid.h) //won't compile without it
9#include "vtkIOXdmf2Module.h" // For export macro
10#include "vtkSetGet.h"
11
12VTK_ABI_NAMESPACE_BEGIN
13class vtkAlgorithm;
14class vtkDataArray;
15class vtkDataObject;
16class vtkDataSet;
17class vtkImageData;
19class vtkPoints;
23class vtkXdmfDomain;
24
25// vtkXdmfHeavyData helps in reading heavy data from Xdmf and putting that into
26// vtkDataObject subclasses.
27class VTKIOXDMF2_EXPORT vtkXdmfHeavyData
28{
29 vtkXdmfDomain* Domain;
30 xdmf2::XdmfDataItem DataItem;
31 vtkAlgorithm* Reader;
32
33public:
34 // These must be set before using this class.
35 int Piece;
38 int Extents[6]; // < these are original extents without the stride taken in
39 // consideration
40 int Stride[3];
41 XdmfFloat64 Time;
42
45
46 // Description:
47 vtkDataObject* ReadData(xdmf2::XdmfGrid* xmfGrid, int blockId = -1);
48
49 // Description:
51
52 // Description:
53 // Returns the VTKCellType for the given xdmf topology. Returns VTK_EMPTY_CELL
54 // on error and VTK_NUMBER_OF_CELL_TYPES for XDMF_MIXED.
55 static int GetVTKCellType(XdmfInt32 topologyType);
56
57 // Description:
58 // Returns the number of points per cell. -1 for error. 0 when no fixed number
59 // of points possible.
60 static int GetNumberOfPointsPerCell(int vtk_cell_type);
61
62private:
63 // Description:
64 // Read a temporal collection.
65 vtkDataObject* ReadTemporalCollection(xdmf2::XdmfGrid* xmfTemporalCollection, int blockId);
66
67 // Description:
68 // Read a spatial-collection or a tree.
69 vtkDataObject* ReadComposite(xdmf2::XdmfGrid* xmfColOrTree);
70
71 // Description:
72 // Read a non-composite grid. Note here uniform has nothing to do with
73 // vtkUniformGrid but to what Xdmf's GridType="Uniform".
74 vtkDataObject* ReadUniformData(xdmf2::XdmfGrid* xmfGrid, int blockId);
75
76 // Description:
77 // Reads the topology and geometry for an unstructured grid. Does not read any
78 // data attributes or geometry.
79 vtkDataObject* ReadUnstructuredGrid(xdmf2::XdmfGrid* xmfGrid);
80
81 // Description:
82 // Read the image data. Simply initializes the extents and origin and spacing
83 // for the image, doesn't really read any attributes including the active
84 // point attributes.
85 vtkImageData* RequestImageData(xdmf2::XdmfGrid* xmfGrid, bool use_uniform_grid);
86
87 // Description:
88 // Reads the geometry and topology for a vtkStructuredGrid.
89 vtkStructuredGrid* RequestStructuredGrid(xdmf2::XdmfGrid* xmfGrid);
90
91 // Description:
92 // Reads the geometry and topology for a vtkRectilinearGrid.
93 vtkRectilinearGrid* RequestRectilinearGrid(xdmf2::XdmfGrid* xmfGrid);
94
95 // Description:
96 // Reads geometry for vtkUnstructuredGrid or vtkStructuredGrid i.e. of
97 // vtkPointSet subclasses. The extents only make sense when reading
98 // vtkStructuredGrid. If non-null, then the only the points for the sub-grid
99 // are read.
100 vtkPoints* ReadPoints(xdmf2::XdmfGeometry* xmfGeometry,
101 VTK_FUTURE_CONST int update_extents[6] = nullptr,
102 VTK_FUTURE_CONST int whole_extents[6] = nullptr);
103
104 // Description:
105 // Read attributes.
106 bool ReadAttributes(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid,
107 VTK_FUTURE_CONST int update_extents[6] = nullptr);
108
109 // Description:
110 // Reads an attribute.
111 // If update_extents are non-null, then we are reading structured attributes
112 // and we read only the sub-set specified by update_extents.
113 vtkDataArray* ReadAttribute(xdmf2::XdmfAttribute* xmfAttribute, int data_dimensionality,
114 VTK_FUTURE_CONST int update_extents[6] = nullptr);
115
116 // Description:
117 // Read sets that mark ghost cells/nodes and then create attribute arrays for
118 // marking the cells as such.
119 bool ReadGhostSets(
120 vtkDataSet* ds, xdmf2::XdmfGrid* xmfGrid, VTK_FUTURE_CONST int update_extents[6] = nullptr);
121
122 vtkMultiBlockDataSet* ReadSets(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid,
123 VTK_FUTURE_CONST int update_extents[6] = nullptr);
124
125 // Description:
126 // Used when reading node-sets.
127 // Creates a new dataset with points with given ids extracted from the input
128 // dataset.
129 vtkDataSet* ExtractPoints(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
130
131 // Description:
132 // Used when reading cell-sets.
133 // Creates a new dataset with cells with the given ids extracted from the
134 // input dataset.
135 vtkDataSet* ExtractCells(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
136
137 // Description:
138 // Used when reading face-sets.
139 // Creates a new dataset with faces selected by the set, extracting them from
140 // the input dataset.
141 vtkDataSet* ExtractFaces(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
142
143 // Description:
144 // Used when reading edge-sets.
145 // Creates a new dataset with edges selected by the set, extracting them from
146 // the input dataset.
147 vtkDataSet* ExtractEdges(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
148};
149
150VTK_ABI_NAMESPACE_END
151#endif
152
153// VTK-HeaderTest-Exclude: vtkXdmfHeavyData.h
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
topologically and geometrically regular array of data
Composite dataset that organizes datasets into blocks.
represent and manipulate 3D points
Definition vtkPoints.h:140
a dataset that is topologically regular with variable spacing in the three coordinate directions
topologically regular array of data
dataset represents arbitrary combinations of all possible cell types
vtkDataObject * ReadData(xdmf2::XdmfGrid *xmfGrid, int blockId=-1)
vtkDataObject * ReadData()
static int GetVTKCellType(XdmfInt32 topologyType)
vtkXdmfHeavyData(vtkXdmfDomain *domain, vtkAlgorithm *reader)
static int GetNumberOfPointsPerCell(int vtk_cell_type)
#define vtkDataArray
#define vtkAlgorithm