File: vtkXMLUnstructuredDataReader.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-5
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 205,936 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 181; javascript: 165; objc: 153; tcl: 59
file content (140 lines) | stat: -rw-r--r-- 4,720 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class   vtkXMLUnstructuredDataReader
 * @brief   Superclass for unstructured data XML readers.
 *
 * vtkXMLUnstructuredDataReader provides functionality common to all
 * unstructured data format readers.
 *
 * @sa
 * vtkXMLPolyDataReader vtkXMLUnstructuredGridReader
 */

#ifndef vtkXMLUnstructuredDataReader_h
#define vtkXMLUnstructuredDataReader_h

#include "vtkIOXMLModule.h" // For export macro
#include "vtkXMLDataReader.h"

VTK_ABI_NAMESPACE_BEGIN
class vtkCellArray;
class vtkIdTypeArray;
class vtkPointSet;
class vtkUnsignedCharArray;

class VTKIOXML_EXPORT vtkXMLUnstructuredDataReader : public vtkXMLDataReader
{
public:
  vtkTypeMacro(vtkXMLUnstructuredDataReader, vtkXMLDataReader);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  /**
   * Get the number of points in the output.
   */
  vtkIdType GetNumberOfPoints() override;

  /**
   * Get the number of cells in the output.
   */
  vtkIdType GetNumberOfCells() override;

  /**
   * Get the number of pieces in the file
   */
  virtual vtkIdType GetNumberOfPieces();

  /**
   * Setup the reader as if the given update extent were requested by
   * its output.  This can be used after an UpdateInformation to
   * validate GetNumberOfPoints() and GetNumberOfCells() without
   * actually reading data.
   */
  void SetupUpdateExtent(int piece, int numberOfPieces, int ghostLevel);

  // For the specified port, copy the information this reader sets up in
  // SetupOutputInformation to outInfo
  void CopyOutputInformation(vtkInformation* outInfo, int port) override;

protected:
  vtkXMLUnstructuredDataReader();
  ~vtkXMLUnstructuredDataReader() override;

  vtkPointSet* GetOutputAsPointSet();
  vtkXMLDataElement* FindDataArrayWithName(vtkXMLDataElement* eParent, const char* name);

  // note that these decref the input array and return an array with a
  // new reference:
  vtkIdTypeArray* ConvertToIdTypeArray(vtkDataArray* a);
  vtkUnsignedCharArray* ConvertToUnsignedCharArray(vtkDataArray* a);

  // Pipeline execute data driver.  Called by vtkXMLReader.
  void ReadXMLData() override;

  void SetupEmptyOutput() override;
  virtual void GetOutputUpdateExtent(int& piece, int& numberOfPieces, int& ghostLevel) = 0;
  virtual void SetupOutputTotals();
  virtual void SetupNextPiece();
  void SetupPieces(int numPieces) override;
  void DestroyPieces() override;

  // Setup the output's information.
  void SetupOutputInformation(vtkInformation* outInfo) override;

  void SetupOutputData() override;
  int ReadPiece(vtkXMLDataElement* ePiece) override;
  int ReadPieceData() override;
  int ReadCellArray(vtkIdType numberOfCells, vtkIdType totalNumberOfCells,
    vtkXMLDataElement* eCells, vtkCellArray* outCells);

  // Read faces and faceoffsets arrays for unstructured grid with polyhedon cells
  int ReadPolyhedronCellArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells,
    vtkCellArray* outFaces, vtkCellArray* outFaceOffsets);
  // Backward compatibility layer to read unstructured grid with polyhedron cells.
  int ReadFaceArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells, vtkIdTypeArray* outFaces,
    vtkIdTypeArray* outFaceOffsets);
  int ReadFaceCellArray(vtkIdType numberOfCells, vtkXMLDataElement* eCells, vtkCellArray* outFaces,
    vtkCellArray* outFaceOffsets);

  // Read a data array whose tuples coorrespond to points.
  int ReadArrayForPoints(vtkXMLDataElement* da, vtkAbstractArray* outArray) override;

  // Get the number of points/cells in the given piece.  Valid after
  // UpdateInformation.
  virtual vtkIdType GetNumberOfPointsInPiece(int piece);
  virtual vtkIdType GetNumberOfCellsInPiece(int piece) = 0;

  // The update request.
  int UpdatePieceId;
  int UpdateNumberOfPieces;
  int UpdateGhostLevel;

  // The range of pieces from the file that will form the UpdatePiece.
  int StartPiece;
  int EndPiece;
  vtkIdType TotalNumberOfPoints;
  vtkIdType TotalNumberOfCells;
  vtkIdType StartPoint;

  // The Points element for each piece.
  vtkXMLDataElement** PointElements;
  vtkIdType* NumberOfPoints;

  int PointsTimeStep;
  unsigned long PointsOffset;
  int PointsNeedToReadTimeStep(vtkXMLDataElement* eNested);
  int CellsNeedToReadTimeStep(
    vtkXMLDataElement* eNested, int& cellstimestep, unsigned long& cellsoffset);

  int CellArrayTimeStepRead;
  bool CanReadCellArray;
  const char* CellArrayCachedInputString;
  const char* CellArrayCachedFileName;

private:
  vtkXMLUnstructuredDataReader(const vtkXMLUnstructuredDataReader&) = delete;
  void operator=(const vtkXMLUnstructuredDataReader&) = delete;
};

VTK_ABI_NAMESPACE_END
#endif