VTK  9.2.5
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 =========================================================================*/
51 #ifndef vtkXMLCompositeDataReader_h
52 #define vtkXMLCompositeDataReader_h
53 
54 #include "vtkIOXMLModule.h" // For export macro
55 #include "vtkXMLReader.h"
56 
60 struct vtkXMLCompositeDataReaderInternals;
61 
62 #include <set> // for std::set
63 #include <string> // for std::string
64 
65 class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
71  enum
72  {
74  Interleave
75  };
76 
89  vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
90  vtkGetMacro(PieceDistribution, int);
94 
100 
101  void SetFileName(VTK_FILEPATH const char*) override;
102 
103 protected:
106 
107  // Get the name of the data set being read.
108  const char* GetDataSetName() override;
109 
110  // Returns the primary element pass to ReadPrimaryElement().
112 
113  void ReadXMLData() override;
114  int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
115 
116  // Setup the output with no data available. Used in error cases.
117  void SetupEmptyOutput() override;
118 
120 
121  // Create a default executive.
123 
124  // Find the path to this file in case the internal files are
125  // specified as relative paths.
127 
129 
132 
134 
136  vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
137 
138  // Adds a child data object to the composite parent. childXML is the XML for
139  // the child data object need to obtain certain meta-data about the child.
141 
142  // Read the XML element for the subtree of a the composite dataset.
143  // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
144  virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
145  const char* filePath, unsigned int& dataSetIndex) = 0;
146 
147  // Read the vtkDataSet (a leaf) in the composite dataset.
148  virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
149 
150  // Read the vtkDataObject (a leaf) in the composite dataset.
151  virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
152 
165  unsigned int datasetIndex, unsigned int pieceIndex = 0, unsigned int numPieces = 0);
166 
167 #ifndef __VTK_WRAP__
172  static unsigned int CountNestedElements(vtkXMLDataElement* element, const std::string& tagName,
173  const std::set<std::string>& exclusions = std::set<std::string>());
174 #endif
175 private:
177  void operator=(const vtkXMLCompositeDataReader&) = delete;
178 
180 
185  static int GetPieceAssignmentForBlockStrategy(
186  unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
187  static int GetPieceAssignmentForInterleaveStrategy(
188  unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
190 
191  int PieceDistribution;
192 
193  vtkXMLCompositeDataReaderInternals* Internal;
194 };
195 
196 #endif
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:79
a simple class to control print indentation
Definition: vtkIndent.h:119
Key for integer values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Reader for multi-group datasets.
void AddChild(vtkCompositeDataSet *parent, vtkDataObject *child, vtkXMLDataElement *childXML)
int FillOutputPortInformation(int, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkCompositeDataSet * GetOutput(int)
Get the output data object for a port on this algorithm.
void SetupEmptyOutput() override
virtual void ReadComposite(vtkXMLDataElement *element, vtkCompositeDataSet *composite, const char *filePath, unsigned int &dataSetIndex)=0
vtkXMLReader * GetReaderForFile(const std::string &filename)
vtkXMLReader * GetReaderOfType(const char *type)
int ShouldReadDataSet(unsigned int datasetIndex, unsigned int pieceIndex=0, unsigned int numPieces=0)
Given the inorder index for a leaf node, this method tells if the current process should read the dat...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetDataSetName() override
vtkXMLDataElement * GetPrimaryElement()
static unsigned int CountNestedElements(vtkXMLDataElement *element, const std::string &tagName, const std::set< std::string > &exclusions=std::set< std::string >())
Convenience method to count all nested elements with the given tag name.
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual vtkDataSet * ReadDataset(vtkXMLDataElement *xmlElem, const char *filePath)
void ReadXMLData() override
void SyncDataArraySelections(vtkXMLReader *accum, vtkXMLDataElement *xmlElem, const std::string &filePath)
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
std::string GetFileNameFromXML(vtkXMLDataElement *xmlElem, const std::string &filePath)
virtual vtkDataObject * ReadDataObject(vtkXMLDataElement *xmlElem, const char *filePath)
vtkCompositeDataSet * GetOutput()
Get the output data object for a port on this algorithm.
~vtkXMLCompositeDataReader() override
void SetFileName(VTK_FILEPATH const char *) override
Represents an XML element and those nested inside.
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:69
@ info
Definition: vtkX3D.h:382
@ type
Definition: vtkX3D.h:522
@ string
Definition: vtkX3D.h:496
#define VTK_FILEPATH