VTK  9.7.1
vtkXMLMultiBlockDataReader.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
24 #ifndef vtkXMLMultiBlockDataReader_h
25 #define vtkXMLMultiBlockDataReader_h
26 
27 #include "vtkIOXMLModule.h" // For export macro
29 
30 #include <set> // For std::set
31 #include <vector> // For std::vector
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkDataAssembly;
35 
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  vtkGetNewMacro(Assembly, vtkDataAssembly);
47 
55  vtkGetMacro(AssemblyTag, int);
56 
58 
70  bool AddSelector(const char* selector);
71  void ClearSelectors();
72  void SetSelector(const char* selector);
74 
76 
79  int GetNumberOfSelectors() const;
80  const char* GetSelector(int index) const;
82 
83 protected:
85  ~vtkXMLMultiBlockDataReader() override;
86 
87  // Get the name of the data set being read.
88  const char* GetDataSetName() override;
89 
90  int FillOutputPortInformation(int, vtkInformation* info) override;
91 
92  // Read the XML element for the subtree of a composite dataset.
93  // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
94  void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
95  const char* filePath, unsigned int& dataSetIndex) override;
96 
97  // Reads file version < 1.0.
98  virtual void ReadVersion0(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
99  const char* filePath, unsigned int& dataSetIndex);
100 
101  void PrepareToCreateMetaData(vtkXMLDataElement* ePrimary) override;
102 
106  void CreateMetaData(vtkXMLDataElement* ePrimary) override;
107 
113  const std::string& filePath) override;
114 
115 private:
117  void operator=(const vtkXMLMultiBlockDataReader&) = delete;
118 
119  virtual int FillMetaData(vtkCompositeDataSet* composite, vtkXMLDataElement* element);
120 
121  void ReadCompositeInternal(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
122  const char* filePath, unsigned int& dataSetIndex, unsigned int& compositeIndex);
123 
124  bool IsBlockSelected(unsigned int compositeIndex);
125 
126  int AssemblyTag = 0;
127  vtkNew<vtkDataAssembly> Assembly;
128  std::set<std::string> Selectors;
129  std::vector<unsigned int> SelectedCompositeIds;
130  bool DistributePiecesInMultiPieces;
131 };
132 
133 VTK_ABI_NAMESPACE_END
134 #endif
Represents an XML element and those nested inside.
Store vtkAlgorithm input/output information.
Reader for multi-group datasets.
virtual void PrepareToCreateMetaData(vtkXMLDataElement *ePrimary)
Prepare to create the meta-data from the composite dataset from the file.
virtual void SyncCompositeDataArraySelections(vtkCompositeDataSet *composite, vtkXMLDataElement *element, const std::string &filePath)=0
Recursively synchronize the data array selection of the reader for the file specified in the XML elem...
abstract superclass for composite (multi-block or AMR) datasets
const char * GetDataSetName() override
Get the name of the data set being read.
a simple class to control print indentation
Definition: vtkIndent.h:28
Reader for multi-block datasets.
int FillOutputPortInformation(int, vtkInformation *info) override
Fill the output port information objects for this algorithm.
virtual void ReadComposite(vtkXMLDataElement *element, vtkCompositeDataSet *composite, const char *filePath, unsigned int &dataSetIndex)=0
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
hierarchical representation to use with vtkPartitionedDataSetCollection
virtual void CreateMetaData(vtkXMLDataElement *ePrimary)=0
Create the meta-data from the composite dataset from the file.