VTK  9.3.0
vtkXMLCompositeDataReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright (c) Kitware, Inc.
3// SPDX-License-Identifier: BSD-3-Clause
21#ifndef vtkXMLCompositeDataReader_h
22#define vtkXMLCompositeDataReader_h
23
24#include "vtkIOXMLModule.h" // For export macro
25#include "vtkXMLReader.h"
26
27VTK_ABI_NAMESPACE_BEGIN
31struct vtkXMLCompositeDataReaderInternals;
32
33VTK_ABI_NAMESPACE_END
34#include <set> // for std::set
35#include <string> // for std::string
36
37VTK_ABI_NAMESPACE_BEGIN
38class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
39{
40public:
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
44 enum
45 {
47 Interleave
48 };
49
62 vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
63 vtkGetMacro(PieceDistribution, int);
67
73
74 void SetFileName(VTK_FILEPATH const char*) override;
75
76protected:
79
80 // Get the name of the data set being read.
81 const char* GetDataSetName() override;
82
83 // Returns the primary element pass to ReadPrimaryElement().
85
86 void ReadXMLData() override;
87 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
88
89 // Setup the output with no data available. Used in error cases.
90 void SetupEmptyOutput() override;
91
92 int FillOutputPortInformation(int, vtkInformation* info) override;
93
94 // Create a default executive.
96
97 // Find the path to this file in case the internal files are
98 // specified as relative paths.
99 std::string GetFilePath();
100
101 std::string GetFileNameFromXML(vtkXMLDataElement* xmlElem, const std::string& filePath);
102
103 vtkXMLReader* GetReaderOfType(const char* type);
104 vtkXMLReader* GetReaderForFile(const std::string& filename);
105
107
109 vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
110
111 // Adds a child data object to the composite parent. childXML is the XML for
112 // the child data object need to obtain certain meta-data about the child.
114
115 // Read the XML element for the subtree of a the composite dataset.
116 // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
117 virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
118 const char* filePath, unsigned int& dataSetIndex) = 0;
119
120 // Read the vtkDataSet (a leaf) in the composite dataset.
121 virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
122
123 // Read the vtkDataObject (a leaf) in the composite dataset.
124 virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
125
138 unsigned int datasetIndex, unsigned int pieceIndex = 0, unsigned int numPieces = 0);
139
140#ifndef __VTK_WRAP__
145 static unsigned int CountNestedElements(vtkXMLDataElement* element, const std::string& tagName,
146 const std::set<std::string>& exclusions = std::set<std::string>());
147#endif
148private:
150 void operator=(const vtkXMLCompositeDataReader&) = delete;
151
153
158 static int GetPieceAssignmentForBlockStrategy(
159 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
160 static int GetPieceAssignmentForInterleaveStrategy(
161 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
163
164 int PieceDistribution;
165
166 vtkXMLCompositeDataReaderInternals* Internal;
167};
168
169VTK_ABI_NAMESPACE_END
170#endif
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:53
Superclass for all pipeline executives in VTK.
a simple class to control print indentation
Definition vtkIndent.h:29
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
Setup the output with no data available.
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
Get the name of the data set being read.
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
void SyncDataArraySelections(vtkXMLReader *accum, vtkXMLDataElement *xmlElem, const std::string &filePath)
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
Read the primary element from the file.
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