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