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 
20 #include "XdmfDataItem.h"
21 #include "XdmfGrid.h" //won't compile without it
22 #include "vtkIOXdmf2Module.h" // For export macro
23 
24 class vtkAlgorithm;
25 class vtkDataArray;
26 class vtkDataObject;
27 class vtkDataSet;
28 class vtkImageData;
30 class vtkPoints;
31 class vtkRectilinearGrid;
32 class vtkStructuredGrid;
34 class vtkXdmfDomain;
35 
36 // vtkXdmfHeavyData helps in reading heavy data from Xdmf and putting that into
37 // vtkDataObject subclasses.
38 class VTKIOXDMF2_EXPORT vtkXdmfHeavyData
39 {
40  vtkXdmfDomain* Domain;
41  xdmf2::XdmfDataItem DataItem;
42  vtkAlgorithm* Reader;
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 
74 private:
75  // Description:
76  // Read a temporal collection.
77  vtkDataObject* ReadTemporalCollection(xdmf2::XdmfGrid* xmfTemporalCollection, int blockId);
78 
79  // Description:
80  // Read a spatial-collection or a tree.
81  vtkDataObject* ReadComposite(xdmf2::XdmfGrid* xmfColOrTree);
82 
83  // Description:
84  // Read a non-composite grid. Note here uniform has nothing to do with
85  // vtkUniformGrid but to what Xdmf's GridType="Uniform".
86  vtkDataObject* ReadUniformData(xdmf2::XdmfGrid* xmfGrid, int blockId);
87 
88  // Description:
89  // Reads the topology and geometry for an unstructured grid. Does not read any
90  // data attributes or geometry.
91  vtkDataObject* ReadUnstructuredGrid(xdmf2::XdmfGrid* xmfGrid);
92 
93  // Description:
94  // Read the image data. Simply initializes the extents and origin and spacing
95  // for the image, doesn't really read any attributes including the active
96  // point attributes.
97  vtkImageData* RequestImageData(xdmf2::XdmfGrid* xmfGrid, bool use_uniform_grid);
98 
99  // Description:
100  // Reads the geometry and topology for a vtkStructuredGrid.
101  vtkStructuredGrid* RequestStructuredGrid(xdmf2::XdmfGrid* xmfGrid);
102 
103  // Description:
104  // Reads the geometry and topology for a vtkRectilinearGrid.
105  vtkRectilinearGrid* RequestRectilinearGrid(xdmf2::XdmfGrid* xmfGrid);
106 
107  // Description:
108  // Reads geometry for vtkUnstructuredGrid or vtkStructuredGrid i.e. of
109  // vtkPointSet subclasses. The extents only make sense when reading
110  // vtkStructuredGrid. If non-null, then the only the points for the sub-grid
111  // are read.
112  vtkPoints* ReadPoints(xdmf2::XdmfGeometry* xmfGeometry,
113  int *update_extents=NULL,
114  int *whole_extents=NULL);
115 
116  // Description:
117  // Read attributes.
118  bool ReadAttributes(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid,
119  int* update_extents=0);
120 
121  // Description:
122  // Reads an attribute.
123  // If update_extents are non-null, then we are reading structured attributes
124  // and we read only the sub-set specified by update_extents.
125  vtkDataArray* ReadAttribute(xdmf2::XdmfAttribute* xmfAttribute,
126  int data_dimensionality, int* update_extents=0);
127 
128  // Description:
129  // Read sets that mark ghost cells/nodes and then create attribute arrays for
130  // marking the cells as such.
131  bool ReadGhostSets(vtkDataSet* ds, xdmf2::XdmfGrid* xmfGrid,
132  int* update_extents=0);
133 
134  vtkMultiBlockDataSet* ReadSets(vtkDataSet* dataSet, xdmf2::XdmfGrid* xmfGrid,
135  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 egdes selected by the set, extracting them from
158  // the input dataset.
159  vtkDataSet* ExtractEdges(xdmf2::XdmfSet* xmfSet, vtkDataSet* dataSet);
160 };
161 
162 #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