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