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