VTK  9.7.1
vtkXMLUniformGridAMRReader.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
25 #ifndef vtkXMLUniformGridAMRReader_h
26 #define vtkXMLUniformGridAMRReader_h
27 
28 #include "vtkIOXMLModule.h" // For export macro
29 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
31 
32 #include <map> // std::map
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkOverlappingAMR;
36 class vtkUniformGridAMR;
37 
39 {
40 public:
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
55  vtkSetMacro(MaximumLevelsToReadByDefault, unsigned int);
56  vtkGetMacro(MaximumLevelsToReadByDefault, unsigned int);
58 
59 protected:
61  ~vtkXMLUniformGridAMRReader() override;
62 
63  // Get the name of the data set being read.
64  const char* GetDataSetName() override;
65 
72  int CanReadFileWithDataType(const char* dsname) override;
73 
80  int ReadVTKFile(vtkXMLDataElement* eVTKFile) override;
81 
82  const char* GetXMLPartitionsName() override { return "Block"; }
83 
84  const char* GetXMLPartitionIndexName() override { return "level"; }
85 
89  void CreateMetaData(vtkXMLDataElement* ePrimary) override;
90 
95  const std::string& filePath) override
96  {
97  this->Superclass::SyncCompositeDataArraySelections(composite, element, filePath);
98  }
99 
105  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
106  vtkInformationVector* outputVector) override;
107 
111  bool IsBlockSelected(unsigned int compositeIndex) override;
112 
116  bool CanReadDataObject(vtkDataObject* dataObject) override;
117 
118  // Read the vtkDataSet (a leaf) in the composite dataset.
119  vtkDataObject* ReadDataObject(vtkXMLDataElement* xmlElem, const char* filePath) override;
120 
121  // Read the XML element for the subtree of a composite dataset.
122  // dataSetIndex is used to rank the leaf nodes in an inorder traversal.
123  void ReadComposite(vtkXMLDataElement* element, vtkCompositeDataSet* composite,
124  const char* filePath, unsigned int& dataSetIndex) override;
125 
126 private:
128  void operator=(const vtkXMLUniformGridAMRReader&) = delete;
129 
130  bool HasBlockRequests = true;
131  unsigned int MaximumLevelsToReadByDefault = 0;
132  std::map<unsigned int, unsigned int> CompositeIdToLevel;
133 
134  // Hide Selection functionality since, AMR only support levels
135  vtkDataAssembly* GetAssembly() override { return nullptr; }
136  int GetAssemblyTag() VTK_FUTURE_CONST override { return 0; }
137  bool AddSelector(const char* vtkNotUsed(selector)) override { return false; }
138  void ClearSelectors() override {}
139  void SetSelector(const char* vtkNotUsed(selector)) override {}
140  int GetNumberOfSelectors() const override { return 0; }
141  const char* GetSelector(int vtkNotUsed(index)) const override { return nullptr; }
142 
143  char* OutputDataType = nullptr;
144  vtkSetStringMacro(OutputDataType);
145 };
146 
147 VTK_ABI_NAMESPACE_END
148 #endif
virtual const char * GetSelector(int index) const
API to access selectors.
void ReadComposite(vtkXMLDataElement *element, vtkCompositeDataSet *composite, const char *filePath, unsigned int &dataSetIndex) override
virtual bool AddSelector(const char *selector)
API to set selectors.
Represents an XML element and those nested inside.
Store vtkAlgorithm input/output information.
virtual void ClearSelectors()
API to set selectors.
const char * GetDataSetName() override
Get the name of the data set being read.
void SyncCompositeDataArraySelections(vtkCompositeDataSet *composite, vtkXMLDataElement *element, const std::string &filePath) override
Synchronize the data array selection of the reader for the file specified in the XML element...
virtual int GetNumberOfSelectors() const
API to access selectors.
Reader for amr datasets (vtkOverlappingAMR or vtkNonOverlappingAMR).
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...
const char * GetXMLPartitionIndexName() override
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Definition: vtkXMLReader.h:506
virtual int GetAssemblyTag()
Whenever the assembly is changed, this tag gets changed.
virtual int ReadVTKFile(vtkXMLDataElement *eVTKFile)
Read the top-level element from the file.
abstract superclass for composite (multi-block or AMR) datasets
a simple class to control print indentation
Definition: vtkIndent.h:28
const char * GetXMLPartitionsName() override
virtual bool CanReadDataObject(vtkDataObject *dataObject)
Given the data object class, return whether it is allowed.
virtual void SetSelector(const char *selector)
API to set selectors.
virtual int CanReadFileWithDataType(const char *dsname)
This method is used by CanReadFile() to check if the reader can read an XML with the primary element ...
virtual vtkDataObject * ReadDataObject(vtkXMLDataElement *xmlElem, const char *filePath)
void CreateMetaData(vtkXMLDataElement *ePrimary) override
Create the meta-data from the partitioned dataset collection from the file.
a multi-resolution dataset based on vtkCartesianGrid allowing overlaps
Store zero or more vtkInformation instances.
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
static vtkXMLPartitionedDataSetCollectionReader * New()
general representation of visualization data
Definition: vtkDataObject.h:55
Legacy, empty shell inheriting vtkAMRDataObject.
virtual bool IsBlockSelected(unsigned int compositeIndex)
Given the composite id, this method tells if the block should be read.