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=========================================================================*/
41#ifndef vtkXMLCompositeDataReader_h
42#define vtkXMLCompositeDataReader_h
43
44#include "vtkIOXMLModule.h" // For export macro
45#include "vtkXMLReader.h"
46
50struct vtkXMLCompositeDataReaderInternals;
51
52#include <set> // for std::set
53#include <string> // for std::string
54
55class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
56{
57public:
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
61 enum
62 {
64 Interleave
65 };
66
79 vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
80 vtkGetMacro(PieceDistribution, int);
84
90
91 void SetFileName(VTK_FILEPATH const char*) override;
92
93protected:
96
97 // Get the name of the data set being read.
98 const char* GetDataSetName() override;
99
100 // Returns the primary element pass to ReadPrimaryElement().
102
103 void ReadXMLData() override;
104 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
105
106 // Setup the output with no data available. Used in error cases.
107 void SetupEmptyOutput() override;
108
110
111 // Create a default executive.
113
114 // Find the path to this file in case the internal files are
115 // specified as relative paths.
116 std::string GetFilePath();
117
118 std::string GetFileNameFromXML(vtkXMLDataElement* xmlElem, const std::string& filePath);
119
120 vtkXMLReader* GetReaderOfType(const char* type);
121 vtkXMLReader* GetReaderForFile(const std::string& filename);
122
124
126 vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
127
128 // Adds a child data object to the composite parent. childXML is the XML for
129 // the child data object need to obtain certain meta-data about the child.
131
132 // Read the XML element for the subtree of a the composite dataset.
133 // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
134 virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
135 const char* filePath, unsigned int& dataSetIndex) = 0;
136
137 // Read the vtkDataSet (a leaf) in the composite dataset.
138 virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
139
140 // Read the vtkDataObject (a leaf) in the composite dataset.
141 virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
142
155 unsigned int datasetIndex, unsigned int pieceIndex = 0, unsigned int numPieces = 0);
156
157#ifndef __VTK_WRAP__
162 static unsigned int CountNestedElements(vtkXMLDataElement* element, const std::string& tagName,
163 const std::set<std::string>& exclusions = std::set<std::string>());
164#endif
165private:
167 void operator=(const vtkXMLCompositeDataReader&) = delete;
168
170
175 static int GetPieceAssignmentForBlockStrategy(
176 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
177 static int GetPieceAssignmentForInterleaveStrategy(
178 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
180
181 int PieceDistribution;
182
183 vtkXMLCompositeDataReaderInternals* Internal;
184};
185
186#endif
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:72
Superclass for all pipeline executives in VTK.
a simple class to control print indentation
Definition vtkIndent.h:49
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.
#define VTK_FILEPATH