VTK
vtkXMLUnstructuredDataReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXMLUnstructuredDataReader.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 =========================================================================*/
26 #ifndef vtkXMLUnstructuredDataReader_h
27 #define vtkXMLUnstructuredDataReader_h
28 
29 #include "vtkIOXMLModule.h" // For export macro
30 #include "vtkXMLDataReader.h"
31 
32 class vtkCellArray;
33 class vtkIdTypeArray;
34 class vtkPointSet;
36 
37 class VTKIOXML_EXPORT vtkXMLUnstructuredDataReader : public vtkXMLDataReader
38 {
39 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  vtkIdType GetNumberOfPoints() override;
47 
51  vtkIdType GetNumberOfCells() override;
52 
56  virtual vtkIdType GetNumberOfPieces();
57 
64  void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel);
65 
66  // For the specified port, copy the information this reader sets up in
67  // SetupOutputInformation to outInfo
68  void CopyOutputInformation(vtkInformation *outInfo, int port) override;
69 
70 
71 protected:
73  ~vtkXMLUnstructuredDataReader() override;
74 
75  vtkPointSet* GetOutputAsPointSet();
76  vtkXMLDataElement* FindDataArrayWithName(vtkXMLDataElement* eParent,
77  const char* name);
78  vtkIdTypeArray* ConvertToIdTypeArray(vtkDataArray* a);
79  vtkUnsignedCharArray* ConvertToUnsignedCharArray(vtkDataArray* a);
80 
81  // Pipeline execute data driver. Called by vtkXMLReader.
82  void ReadXMLData() override;
83 
84  void SetupEmptyOutput() override;
85  virtual void GetOutputUpdateExtent(int& piece, int& numberOfPieces,
86  int& ghostLevel)=0;
87  virtual void SetupOutputTotals();
88  virtual void SetupNextPiece();
89  void SetupPieces(int numPieces) override;
90  void DestroyPieces() override;
91 
92  // Setup the output's information.
93  void SetupOutputInformation(vtkInformation *outInfo) override;
94 
95  void SetupOutputData() override;
96  int ReadPiece(vtkXMLDataElement* ePiece) override;
97  int ReadPieceData() override;
98  int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells,
99  vtkXMLDataElement* eCells, vtkCellArray* outCells);
100 
101  // Read faces and faceoffsets arrays for unstructured grid with polyhedon cells
102  int ReadFaceArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells,
103  vtkIdTypeArray* outFaces, vtkIdTypeArray* outFaceOffsets);
104 
105  // Read a data array whose tuples coorrespond to points.
106  int ReadArrayForPoints(vtkXMLDataElement* da, vtkAbstractArray* outArray) override;
107 
108  // Get the number of points/cells in the given piece. Valid after
109  // UpdateInformation.
110  virtual vtkIdType GetNumberOfPointsInPiece(int piece);
111  virtual vtkIdType GetNumberOfCellsInPiece(int piece)=0;
112 
113  // The update request.
117 
118  // The range of pieces from the file that will form the UpdatePiece.
120  int EndPiece;
124 
125  // The Points element for each piece.
128 
130  unsigned long PointsOffset;
131  int PointsNeedToReadTimeStep(vtkXMLDataElement *eNested);
132  int CellsNeedToReadTimeStep(vtkXMLDataElement *eNested, int &cellstimestep,
133  unsigned long &cellsoffset);
134 
135 
136 private:
138  void operator=(const vtkXMLUnstructuredDataReader&) = delete;
139 };
140 
141 #endif
vtkXMLUnstructuredDataReader::PointElements
vtkXMLDataElement ** PointElements
Definition: vtkXMLUnstructuredDataReader.h:126
vtkXMLDataReader::GetNumberOfCells
virtual vtkIdType GetNumberOfCells()=0
Get the number of cells in the output.
vtkXMLDataReader::GetNumberOfPoints
virtual vtkIdType GetNumberOfPoints()=0
Get the number of points in the output.
vtkXMLDataReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkXMLDataReader::ReadPiece
int ReadPiece(vtkXMLDataElement *ePiece, int piece)
vtkXMLUnstructuredDataReader::NumberOfPoints
vtkIdType * NumberOfPoints
Definition: vtkXMLUnstructuredDataReader.h:127
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkXMLUnstructuredDataReader::StartPoint
vtkIdType StartPoint
Definition: vtkXMLUnstructuredDataReader.h:123
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkXMLUnstructuredDataReader::EndPiece
int EndPiece
Definition: vtkXMLUnstructuredDataReader.h:120
vtkXMLDataReader
Superclass for VTK XML file readers.
Definition: vtkXMLDataReader.h:35
vtkXMLUnstructuredDataReader::TotalNumberOfCells
vtkIdType TotalNumberOfCells
Definition: vtkXMLUnstructuredDataReader.h:122
vtkXMLUnstructuredDataReader::PointsTimeStep
int PointsTimeStep
Definition: vtkXMLUnstructuredDataReader.h:129
vtkX3D::port
Definition: vtkX3D.h:447
vtkXMLDataReader::SetupOutputInformation
void SetupOutputInformation(vtkInformation *outInfo) override
vtkXMLUnstructuredDataReader::UpdateGhostLevel
int UpdateGhostLevel
Definition: vtkXMLUnstructuredDataReader.h:116
vtkXMLDataReader::ReadPieceData
virtual int ReadPieceData()
vtkXMLReader::SetupEmptyOutput
virtual void SetupEmptyOutput()=0
vtkXMLUnstructuredDataReader
Superclass for unstructured data XML readers.
Definition: vtkXMLUnstructuredDataReader.h:37
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkXMLDataReader.h
vtkXMLUnstructuredDataReader::UpdateNumberOfPieces
int UpdateNumberOfPieces
Definition: vtkXMLUnstructuredDataReader.h:115
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:36
vtkX3D::name
Definition: vtkX3D.h:219
vtkXMLUnstructuredDataReader::TotalNumberOfPoints
vtkIdType TotalNumberOfPoints
Definition: vtkXMLUnstructuredDataReader.h:121
vtkXMLUnstructuredDataReader::PointsOffset
unsigned long PointsOffset
Definition: vtkXMLUnstructuredDataReader.h:130
vtkXMLUnstructuredDataReader::StartPiece
int StartPiece
Definition: vtkXMLUnstructuredDataReader.h:119
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:78
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:41
vtkXMLUnstructuredDataReader::UpdatePiece
int UpdatePiece
Definition: vtkXMLUnstructuredDataReader.h:114
vtkXMLDataReader::ReadXMLData
void ReadXMLData() override
vtkPointSet
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:42
vtkXMLDataReader::DestroyPieces
virtual void DestroyPieces()
vtkXMLDataReader::CopyOutputInformation
void CopyOutputInformation(vtkInformation *outInfo, int port) override
vtkXMLDataReader::SetupPieces
virtual void SetupPieces(int numPieces)
vtkXMLDataReader::ReadArrayForPoints
virtual int ReadArrayForPoints(vtkXMLDataElement *da, vtkAbstractArray *outArray)
vtkXMLDataReader::SetupOutputData
void SetupOutputData() override