VTK  9.0.20200806
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 =========================================================================*/
29 #ifndef vtkXMLCompositeDataReader_h
30 #define vtkXMLCompositeDataReader_h
31 
32 #include "vtkIOXMLModule.h" // For export macro
33 #include "vtkXMLReader.h"
34 
38 struct vtkXMLCompositeDataReaderInternals;
39 
40 #include <set> // for std::set
41 #include <string> // for std::string
42 
43 class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
44 {
45 public:
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
49  enum
50  {
52  Interleave
53  };
54 
67  vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
68  vtkGetMacro(PieceDistribution, int);
75  vtkCompositeDataSet* GetOutput();
76  vtkCompositeDataSet* GetOutput(int);
78 
79 protected:
81  ~vtkXMLCompositeDataReader() override;
82 
83  // Get the name of the data set being read.
84  const char* GetDataSetName() override;
85 
86  // Returns the primary element pass to ReadPrimaryElement().
87  vtkXMLDataElement* GetPrimaryElement();
88 
89  void ReadXMLData() override;
90  int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
91 
92  // Setup the output with no data available. Used in error cases.
93  void SetupEmptyOutput() override;
94 
95  int FillOutputPortInformation(int, vtkInformation* info) override;
96 
97  // Create a default executive.
99 
100  // Find the path to this file in case the internal files are
101  // specified as relative paths.
102  std::string GetFilePath();
103 
104  std::string GetFileNameFromXML(vtkXMLDataElement* xmlElem, const std::string& filePath);
105 
106  vtkXMLReader* GetReaderOfType(const char* type);
107  vtkXMLReader* GetReaderForFile(const std::string& filename);
108 
110 
111  void SyncDataArraySelections(
112  vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
113 
114  // Adds a child data object to the composite parent. childXML is the XML for
115  // the child data object need to obtain certain meta-data about the child.
116  void AddChild(vtkCompositeDataSet* parent, vtkDataObject* child, vtkXMLDataElement* childXML);
117 
118  // Read the XML element for the subtree of a the composite dataset.
119  // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
120  virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
121  const char* filePath, unsigned int& dataSetIndex) = 0;
122 
123  // Read the vtkDataSet (a leaf) in the composite dataset.
124  virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
125 
126  // Read the vtkDataObject (a leaf) in the composite dataset.
127  virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
128 
140  int ShouldReadDataSet(
141  unsigned int datasetIndex, unsigned int pieceIndex = 0, unsigned int numPieces = 0);
142 
143 #ifndef __VTK_WRAP__
144 
148  static unsigned int CountNestedElements(vtkXMLDataElement* element, const std::string& tagName,
149  const std::set<std::string>& exclusions = std::set<std::string>());
150 #endif
151 private:
153  void operator=(const vtkXMLCompositeDataReader&) = delete;
154 
156 
161  static int GetPieceAssignmentForBlockStrategy(
162  unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
163  static int GetPieceAssignmentForInterleaveStrategy(
164  unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
166 
167  int PieceDistribution;
168 
169  vtkXMLCompositeDataReaderInternals* Internal;
170 };
171 
172 #endif
vtkAlgorithm::CreateDefaultExecutive
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
vtkXMLReader::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkXMLReader.h
vtkXMLReader::ReadPrimaryElement
virtual int ReadPrimaryElement(vtkXMLDataElement *ePrimary)
vtkX3D::type
Definition: vtkX3D.h:522
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
tagBlock
Definition: vtkAMRFlashReaderInternal.h:77
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:45
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
vtkXMLCompositeDataReader
Reader for multi-group datasets.
Definition: vtkXMLCompositeDataReader.h:43
vtkXMLReader::ReadXMLData
virtual void ReadXMLData()
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:31
vtkXMLReader::SetupEmptyOutput
virtual void SetupEmptyOutput()=0
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkXMLReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXMLReader::GetDataSetName
virtual const char * GetDataSetName()=0
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:36
vtkXMLCompositeDataReader::Block
Definition: vtkXMLCompositeDataReader.h:51
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkX3D::info
Definition: vtkX3D.h:382
vtkX3D::string
Definition: vtkX3D.h:496
vtkInformationIntegerVectorKey
Key for integer vector values.
Definition: vtkInformationIntegerVectorKey.h:31
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkXMLReader
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:45
vtkAlgorithm::FillOutputPortInformation
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.