VTK  9.1.0
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=========================================================================*/
48#ifndef vtkXMLCompositeDataReader_h
49#define vtkXMLCompositeDataReader_h
50
51#include "vtkIOXMLModule.h" // For export macro
52#include "vtkXMLReader.h"
53
57struct vtkXMLCompositeDataReaderInternals;
58
59#include <set> // for std::set
60#include <string> // for std::string
61
62class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
63{
64public:
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
68 enum
69 {
71 Interleave
72 };
73
86 vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
87 vtkGetMacro(PieceDistribution, int);
91
97
98 void SetFileName(VTK_FILEPATH const char*) override;
99
100protected:
103
104 // Get the name of the data set being read.
105 const char* GetDataSetName() override;
106
107 // Returns the primary element pass to ReadPrimaryElement().
109
110 void ReadXMLData() override;
111 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
112
113 // Setup the output with no data available. Used in error cases.
114 void SetupEmptyOutput() override;
115
117
118 // Create a default executive.
120
121 // Find the path to this file in case the internal files are
122 // specified as relative paths.
123 std::string GetFilePath();
124
125 std::string GetFileNameFromXML(vtkXMLDataElement* xmlElem, const std::string& filePath);
126
127 vtkXMLReader* GetReaderOfType(const char* type);
128 vtkXMLReader* GetReaderForFile(const std::string& filename);
129
131
133 vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
134
135 // Adds a child data object to the composite parent. childXML is the XML for
136 // the child data object need to obtain certain meta-data about the child.
138
139 // Read the XML element for the subtree of a the composite dataset.
140 // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
141 virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
142 const char* filePath, unsigned int& dataSetIndex) = 0;
143
144 // Read the vtkDataSet (a leaf) in the composite dataset.
145 virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
146
147 // Read the vtkDataObject (a leaf) in the composite dataset.
148 virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
149
162 unsigned int datasetIndex, unsigned int pieceIndex = 0, unsigned int numPieces = 0);
163
164#ifndef __VTK_WRAP__
169 static unsigned int CountNestedElements(vtkXMLDataElement* element, const std::string& tagName,
170 const std::set<std::string>& exclusions = std::set<std::string>());
171#endif
172private:
174 void operator=(const vtkXMLCompositeDataReader&) = delete;
175
177
182 static int GetPieceAssignmentForBlockStrategy(
183 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
184 static int GetPieceAssignmentForInterleaveStrategy(
185 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
187
188 int PieceDistribution;
189
190 vtkXMLCompositeDataReaderInternals* Internal;
191};
192
193#endif
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:76
a simple class to control print indentation
Definition: vtkIndent.h:113
Key for integer values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Reader for multi-group datasets.
vtkXMLDataElement * GetPrimaryElement()
vtkCompositeDataSet * GetOutput(int)
Get the output data object for a port on this algorithm.
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()
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
virtual vtkDataObject * ReadDataObject(vtkXMLDataElement *xmlElem, const char *filePath)
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.
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.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual vtkDataSet * ReadDataset(vtkXMLDataElement *xmlElem, const char *filePath)
const char * GetDataSetName() override
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)
vtkXMLReader * GetReaderOfType(const char *type)
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
vtkXMLReader * GetReaderForFile(const std::string &filename)
~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:66
#define VTK_FILEPATH