VTK
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 "XdmfDataItem.h"
23 #include "XdmfGrid.h" //won't compile without it
24 #include "vtkIOXdmf2Module.h" // For export macro
25 
26 class vtkAlgorithm;
27 class vtkDataArray;
28 class vtkDataObject;
29 class vtkDataSet;
30 class vtkImageData;
32 class vtkPoints;
33 class vtkRectilinearGrid;
34 class vtkStructuredGrid;
36 class vtkXdmfDomain;
37 
38 // vtkXdmfHeavyData helps in reading heavy data from Xdmf and putting that into
39 // vtkDataObject subclasses.
40 class VTKIOXDMF2_EXPORT vtkXdmfHeavyData
41 {
42  vtkXdmfDomain* Domain;
43  xdmf2::XdmfDataItem DataItem;
44  vtkAlgorithm* Reader;
45 public:
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 
55 public:
58 
59  // Description:
60  vtkDataObject* ReadData(xdmf2::XdmfGrid* xmfGrid, int blockId = -1);
61 
62  // Description:
63  vtkDataObject* ReadData();
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 
75 
76 private:
77  // Description:
78  // Read a temporal collection.
79  vtkDataObject* ReadTemporalCollection(xdmf2::XdmfGrid* xmfTemporalCollection, int blockId);
80 
81  // Description:
82  // Read a spatial-collection or a tree.
83  vtkDataObject* ReadComposite(xdmf2::XdmfGrid* xmfColOrTree);
84 
85  // Description:
86  // Read a non-composite grid. Note here uniform has nothing to do with
87  // vtkUniformGrid but to what Xdmf's GridType="Uniform".
88  vtkDataObject* ReadUniformData(xdmf2::XdmfGrid* xmfGrid, int blockId);
89 
90  // Description:
91  // Reads the topology and geometry for an unstructured grid. Does not read any
92  // data attributes or geometry.
93  vtkDataObject* ReadUnstructuredGrid(xdmf2::XdmfGrid* xmfGrid);
94 
95  // Description:
96  // Read the image data. Simply initializes the extents and origin and spacing
97  // for the image, doesn't really read any attributes including the active
98  // point attributes.
99  vtkImageData* RequestImageData(xdmf2::XdmfGrid* xmfGrid, bool use_uniform_grid);
100 
101  // Description:
102  // Reads the geometry and topology for a vtkStructuredGrid.
103  vtkStructuredGrid* RequestStructuredGrid(xdmf2::XdmfGrid* xmfGrid);
104 
105  // Description:
106  // Reads the geometry and topology for a vtkRectilinearGrid.
107  vtkRectilinearGrid* RequestRectilinearGrid(xdmf2::XdmfGrid* xmfGrid);
108 
109  // Description:
110  // Reads geometry for vtkUnstructuredGrid or vtkStructuredGrid i.e. of
111  // vtkPointSet subclasses. The extents only make sense when reading
112  // vtkStructuredGrid. If non-null, then the only the points for the sub-grid
113  // are read.
114  vtkPoints* ReadPoints(xdmf2::XdmfGeometry* xmfGeometry,
115  int *update_extents=nullptr,
116  int *whole_extents=nullptr);
117 
118  // Description:
119  // Read attributes.
120  bool ReadAttributes(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid,
121  int* update_extents=0);
122 
123  // Description:
124  // Reads an attribute.
125  // If update_extents are non-null, then we are reading structured attributes
126  // and we read only the sub-set specified by update_extents.
127  vtkDataArray* ReadAttribute(xdmf2::XdmfAttribute* xmfAttribute,
128  int data_dimensionality, int* update_extents=0);
129 
130  // Description:
131  // Read sets that mark ghost cells/nodes and then create attribute arrays for
132  // marking the cells as such.
133  bool ReadGhostSets(vtkDataSet* ds, xdmf2::XdmfGrid* xmfGrid,
134  int* update_extents=0);
135 
136  vtkMultiBlockDataSet* ReadSets(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid,
137  int *update_extents=0);
138 
139  // Description:
140  // Used when reading node-sets.
141  // Creates a new dataset with points with given ids extracted from the input
142  // dataset.
143  vtkDataSet* ExtractPoints(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
144 
145  // Description:
146  // Used when reading cell-sets.
147  // Creates a new dataset with cells with the given ids extracted from the
148  // input dataset.
149  vtkDataSet* ExtractCells(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
150 
151  // Description:
152  // Used when reading face-sets.
153  // Creates a new dataset with faces selected by the set, extracting them from
154  // the input dataset.
155  vtkDataSet* ExtractFaces(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
156 
157  // Description:
158  // Used when reading edge-sets.
159  // Creates a new dataset with edges selected by the set, extracting them from
160  // the input dataset.
161  vtkDataSet* ExtractEdges(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
162 };
163 
164 #endif
165 #endif
166 #endif
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:59
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:54
topologically regular array of data
Composite dataset that organizes datasets into blocks.
general representation of visualization data
Definition: vtkDataObject.h:64
represent and manipulate 3D points
Definition: vtkPoints.h:39