VTK: IO/XML/vtkXMLCompositeDataReader.h Source File

| VTK 9.3.1

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
30 #ifndef vtkXMLCompositeDataReader_h
31 #define vtkXMLCompositeDataReader_h
32
33 #include "vtkIOXMLModule.h" // For export macro
34 #include "vtkXMLReader.h"
35
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkCompositeDataSet;
38 class vtkInformationIntegerKey;
39 class vtkInformationIntegerVectorKey;
40 struct vtkXMLCompositeDataReaderInternals;
41
42 VTK_ABI_NAMESPACE_END
43 #include <set> // for std::set
44 #include <string> // for std::string
45
46 VTK_ABI_NAMESPACE_BEGIN
47 class VTKIOXML_EXPORT vtkXMLCompositeDataReader : public vtkXMLReader
48 {
49 public:
50 vtkTypeMacro(vtkXMLCompositeDataReader, vtkXMLReader);
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
53 enum
54 {
55 Block,
56 Interleave
57 };
58
71 vtkSetClampMacro(PieceDistribution, int, Block, Interleave);
72 vtkGetMacro(PieceDistribution, int);
76
79 vtkCompositeDataSet* GetOutput();
80 vtkCompositeDataSet* GetOutput(int);
82
83 void SetFileName(VTK_FILEPATH const char*) override;
84
85 protected:
86 vtkXMLCompositeDataReader();
87 ~vtkXMLCompositeDataReader() override;
88
89 // Get the name of the data set being read.
90 const char* GetDataSetName() override;
91
92 // Returns the primary element pass to ReadPrimaryElement().
93 vtkXMLDataElement* GetPrimaryElement();
94
95 void ReadXMLData() override;
96 int ReadPrimaryElement(vtkXMLDataElement* ePrimary) override;
97
98 // Setup the output with no data available. Used in error cases.
99 void SetupEmptyOutput() override;
100
101 int FillOutputPortInformation(int, vtkInformation* info) override;
102
103 // Create a default executive.
104 vtkExecutive* CreateDefaultExecutive() override;
105
106 // Find the path to this file in case the internal files are
107 // specified as relative paths.
108 std::string GetFilePath();
109
110 std::string GetFileNameFromXML(vtkXMLDataElement* xmlElem, const std::string& filePath);
111
112 vtkXMLReader* GetReaderOfType(const char* type);
113 vtkXMLReader* GetReaderForFile(const std::string& filename);
114
115 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
116
117 void SyncDataArraySelections(
118 vtkXMLReader* accum, vtkXMLDataElement* xmlElem, const std::string& filePath);
119
120 // Adds a child data object to the composite parent. childXML is the XML for
121 // the child data object need to obtain certain meta-data about the child.
122 void AddChild(vtkCompositeDataSet* parent, vtkDataObject* child, vtkXMLDataElement* childXML);
123
124 // Read the XML element for the subtree of a the composite dataset.
125 // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
126 virtual void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
127 const char* filePath, unsigned int& dataSetIndex) = 0;
128
129 // Read the vtkDataSet (a leaf) in the composite dataset.
130 virtual vtkDataSet* ReadDataset(vtkXMLDataElement* xmlElem, const char* filePath);
131
132 // Read the vtkDataObject (a leaf) in the composite dataset.
133 virtual vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath);
134
146 int ShouldReadDataSet(
147 unsigned int datasetIndex, unsigned int pieceIndex = 0, unsigned int numPieces = 0);
148
149 #ifndef __VTK_WRAP__
154 static unsigned int CountNestedElements(vtkXMLDataElement* element, const std::string& tagName,
155 const std::set<std::string>& exclusions = std::set<std::string>());
156 #endif
157 private:
158 vtkXMLCompositeDataReader(const vtkXMLCompositeDataReader&) = delete;
159 void operator=(const vtkXMLCompositeDataReader&) = delete;
160
162
167 static int GetPieceAssignmentForBlockStrategy(
168 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
169 static int GetPieceAssignmentForInterleaveStrategy(
170 unsigned int datasetIndex, unsigned int numDatasets, int numPieces);
172
173 int PieceDistribution;
174
175 vtkXMLCompositeDataReaderInternals* Internal;
176 };
177
178 VTK_ABI_NAMESPACE_END
179 #endif
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:51
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:48
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:24
vtkInformationIntegerVectorKey
Key for integer vector values.
Definition: vtkInformationIntegerVectorKey.h:24
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkXMLCompositeDataReader
Reader for multi-group datasets.
Definition: vtkXMLCompositeDataReader.h:48
vtkXMLCompositeDataReader::GetFilePath
std::string GetFilePath()
vtkXMLCompositeDataReader::AddChild
void AddChild(vtkCompositeDataSet *parent, vtkDataObject *child, vtkXMLDataElement *childXML)
vtkXMLCompositeDataReader::FillOutputPortInformation
int FillOutputPortInformation(int, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkXMLCompositeDataReader::GetOutput
vtkCompositeDataSet * GetOutput(int)
Get the output data object for a port on this algorithm.
vtkXMLCompositeDataReader::SetupEmptyOutput
void SetupEmptyOutput() override
Setup the output with no data available.
vtkXMLCompositeDataReader::ReadComposite
virtual void ReadComposite(vtkXMLDataElement *element, vtkCompositeDataSet *composite, const char *filePath, unsigned int &dataSetIndex)=0
vtkXMLCompositeDataReader::GetReaderForFile
vtkXMLReader * GetReaderForFile(const std::string &filename)
vtkXMLCompositeDataReader::GetReaderOfType
vtkXMLReader * GetReaderOfType(const char *type)
vtkXMLCompositeDataReader::ShouldReadDataSet
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...
vtkXMLCompositeDataReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXMLCompositeDataReader::GetDataSetName
const char * GetDataSetName() override
Get the name of the data set being read.
vtkXMLCompositeDataReader::GetPrimaryElement
vtkXMLDataElement * GetPrimaryElement()
vtkXMLCompositeDataReader::CountNestedElements
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.
vtkXMLCompositeDataReader::CreateDefaultExecutive
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
vtkXMLCompositeDataReader::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkXMLCompositeDataReader::ReadDataset
virtual vtkDataSet * ReadDataset(vtkXMLDataElement *xmlElem, const char *filePath)
vtkXMLCompositeDataReader::ReadXMLData
void ReadXMLData() override
Pipeline execution methods to be defined by subclass.
vtkXMLCompositeDataReader::SyncDataArraySelections
void SyncDataArraySelections(vtkXMLReader *accum, vtkXMLDataElement *xmlElem, const std::string &filePath)
vtkXMLCompositeDataReader::ReadPrimaryElement
int ReadPrimaryElement(vtkXMLDataElement *ePrimary) override
Read the primary element from the file.
vtkXMLCompositeDataReader::GetFileNameFromXML
std::string GetFileNameFromXML(vtkXMLDataElement *xmlElem, const std::string &filePath)
vtkXMLCompositeDataReader::ReadDataObject
virtual vtkDataObject * ReadDataObject(vtkXMLDataElement *xmlElem, const char *filePath)
vtkXMLCompositeDataReader::Block
@ Block
Definition: vtkXMLCompositeDataReader.h:55
vtkXMLCompositeDataReader::GetOutput
vtkCompositeDataSet * GetOutput()
Get the output data object for a port on this algorithm.
vtkXMLCompositeDataReader::~vtkXMLCompositeDataReader
~vtkXMLCompositeDataReader() override
vtkXMLCompositeDataReader::SetFileName
void SetFileName(VTK_FILEPATH const char *) override
vtkXMLCompositeDataReader::vtkXMLCompositeDataReader
vtkXMLCompositeDataReader()
vtkXMLDataElement
Represents an XML element and those nested inside.
Definition: vtkXMLDataElement.h:26
vtkXMLReader
Superclass for VTK's XML format readers.
Definition: vtkXMLReader.h:48
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkX3D::string
@ string
Definition: vtkX3D.h:490
VTK_FILEPATH
#define VTK_FILEPATH
Definition: vtkWrappingHints.h:34
vtkXMLReader.h