VTK  9.7.1
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 
12 VTK_ABI_NAMESPACE_BEGIN
13 class vtkAlgorithm;
14 class vtkDataArray;
15 class vtkDataObject;
16 class vtkDataSet;
17 class vtkImageData;
19 class vtkPoints;
20 class vtkRectilinearGrid;
21 class vtkStructuredGrid;
23 class vtkXdmfDomain;
24 
25 // vtkXdmfHeavyData helps in reading heavy data from Xdmf and putting that into
26 // vtkDataObject subclasses.
27 class VTKIOXDMF2_EXPORT vtkXdmfHeavyData
28 {
29  vtkXdmfDomain* Domain;
30  xdmf2::XdmfDataItem DataItem;
31  vtkAlgorithm* Reader;
32 
33 public:
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:
50  vtkDataObject* ReadData();
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 
62 private:
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 
150 VTK_ABI_NAMESPACE_END
151 #endif
152 
153 // VTK-HeaderTest-Exclude: vtkXdmfHeavyData.h
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
topologically regular array of data
Composite dataset that organizes datasets into blocks.
general representation of visualization data
Definition: vtkDataObject.h:55
represent and manipulate 3D points
Definition: vtkPoints.h:30