VTK  9.0.1
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 
39 struct vtkXMLCompositeDataReaderInternals;
40 
41 class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
42 {
43 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
47  enum
48  {
50  Interleave
51  };
52 
65  vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
66  vtkGetMacro(PieceDistribution, int);
76 
77 protected:
80 
81  // Get the name of the data set being read.
82  const char* GetDataSetName() override;
83 
84  // Returns the primary element pass to ReadPrimaryElement().
86 
87  void ReadXMLData() override;
88  int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
89 
90  // Setup the output with no data available. Used in error cases.
91  void SetupEmptyOutput() override;
92 
94 
95  // Create a default executive.
97 
98  // Find the path to this file in case the internal files are
99  // specified as relative paths.
101 
103 
106 
108 
110  vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
111 
112  // Adds a child data object to the composite parent. childXML is the XML for
113  // the child data object need to obtain certain meta-data about the child.
115 
116  // Read the XML element for the subtree of a the composite dataset.
117  // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
118  virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
119  const char* filePath, unsigned int& dataSetIndex) = 0;
120 
121  // Read the vtkDataSet (a leaf) in the composite dataset.
122  virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
123 
124  // Read the vtkDataObject (a leaf) in the composite dataset.
125  virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
126 
127  // Counts "DataSet" elements in the subtree.
128  unsigned int CountLeaves(vtkXMLDataElement* elem);
129 
134  int ShouldReadDataSet(unsigned int datasetIndex);
135 
136  bool DataSetIsValidForBlockStrategy(unsigned int datasetIndex);
137  bool DataSetIsValidForInterleaveStrategy(unsigned int datasetIndex);
138 
139 private:
141  void operator=(const vtkXMLCompositeDataReader&) = delete;
142 
143  int PieceDistribution;
144 
145  vtkXMLCompositeDataReaderInternals* Internal;
146 };
147 
148 #endif
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
Definition: vtkDataObject.h:60
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:47
a simple class to control print indentation
Definition: vtkIndent.h:34
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)
bool DataSetIsValidForInterleaveStrategy(unsigned int datasetIndex)
int FillOutputPortInformation(int, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkCompositeDataSet * GetOutput(int)
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)
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()
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual vtkDataSet * ReadDataset(vtkXMLDataElement *xmlElem, const char *filePath)
unsigned int CountLeaves(vtkXMLDataElement *elem)
bool DataSetIsValidForBlockStrategy(unsigned int datasetIndex)
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
int ShouldReadDataSet(unsigned int datasetIndex)
Given the inorder index for a leaf node, this method tells if the current process should read the dat...
Represents an XML element and those nested inside.
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:44
@ info
Definition: vtkX3D.h:382
@ type
Definition: vtkX3D.h:522
@ string
Definition: vtkX3D.h:496