VTK  9.2.6
vtkXMLCompositeDataReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkXMLCompositeDataReader.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
32 #ifndef vtkXMLCompositeDataReader_h
33 #define vtkXMLCompositeDataReader_h
34 
35 #include "vtkIOXMLModule.h" // For export macro
36 #include "vtkXMLReader.h"
37 
41 struct vtkXMLCompositeDataReaderInternals;
42 
43 #include <set> // for std::set
44 #include <string> // for std::string
45 
46 class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
47 {
48 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
52  enum
53  {
55  Interleave
56  };
57 
70  vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
71  vtkGetMacro(PieceDistribution, int);
74 
78  vtkCompositeDataSet* GetOutput();
79  vtkCompositeDataSet* GetOutput(int);
81 
82  void SetFileName(VTK_FILEPATH const char*) override;
83 
84 protected:
86  ~vtkXMLCompositeDataReader() override;
87 
88  // Get the name of the data set being read.
89  const char* GetDataSetName() override;
90 
91  // Returns the primary element pass to ReadPrimaryElement().
92  vtkXMLDataElement* GetPrimaryElement();
93 
94  void ReadXMLData() override;
95  int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
96 
97  // Setup the output with no data available. Used in error cases.
98  void SetupEmptyOutput() override;
99 
100  int FillOutputPortInformation(int, vtkInformation* info) override;
101 
102  // Create a default executive.
104 
105  // Find the path to this file in case the internal files are
106  // specified as relative paths.
107  std::string GetFilePath();
108 
109  std::string GetFileNameFromXML(vtkXMLDataElement* xmlElem, const std::string& filePath);
110 
111  vtkXMLReader* GetReaderOfType(const char* type);
112  vtkXMLReader* GetReaderForFile(const std::string& filename);
113 
115 
116  void SyncDataArraySelections(
117  vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
118 
119  // Adds a child data object to the composite parent. childXML is the XML for
120  // the child data object need to obtain certain meta-data about the child.
121  void AddChild(vtkCompositeDataSet* parent, vtkDataObject* child, vtkXMLDataElement* childXML);
122 
123  // Read the XML element for the subtree of a the composite dataset.
124  // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
125  virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
126  const char* filePath, unsigned int& dataSetIndex) = 0;
127 
128  // Read the vtkDataSet (a leaf) in the composite dataset.
129  virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
130 
131  // Read the vtkDataObject (a leaf) in the composite dataset.
132  virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
133 
145  int ShouldReadDataSet(
146  unsigned int datasetIndex, unsigned int pieceIndex = 0, unsigned int numPieces = 0);
147 
148 #ifndef __VTK_WRAP__
149 
153  static unsigned int CountNestedElements(vtkXMLDataElement* element, const std::string& tagName,
154  const std::set<std::string>& exclusions = std::set<std::string>());
155 #endif
156 private:
158  void operator=(const vtkXMLCompositeDataReader&) = delete;
159 
161 
166  static int GetPieceAssignmentForBlockStrategy(
167  unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
168  static int GetPieceAssignmentForInterleaveStrategy(
169  unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
171 
172  int PieceDistribution;
173 
174  vtkXMLCompositeDataReaderInternals* Internal;
175 };
176 
177 #endif
virtual const char * GetDataSetName()=0
virtual void SetupEmptyOutput()=0
Represents an XML element and those nested inside.
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Reader for multi-group datasets.
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual void ReadXMLData()
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
abstract superclass for composite (multi-block or AMR) datasets
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
a simple class to control print indentation
Definition: vtkIndent.h:39
Key for integer values in vtkInformation.
virtual int ReadPrimaryElement(vtkXMLDataElement *ePrimary)
#define VTK_FILEPATH
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:65
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:49