VTK  9.7.1
vtkAMREnzoReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
14 #ifndef vtkAMREnzoReader_h
15 #define vtkAMREnzoReader_h
16 
17 #include "vtkAMRBaseReader.h"
18 #include "vtkIOAMRModule.h" // For export macro
19 
20 #include <map> // For STL map
21 #include <string> // For std::string
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkOverlappingAMR;
26 
27 class VTKIOAMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader
28 {
29 public:
30  static vtkAMREnzoReader* New();
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
35 
38  vtkSetMacro(ConvertToCGS, vtkTypeBool);
39  vtkGetMacro(ConvertToCGS, vtkTypeBool);
40  vtkBooleanMacro(ConvertToCGS, vtkTypeBool);
42 
46  int GetNumberOfBlocks() override;
47 
51  int GetNumberOfLevels() override;
52 
56  void SetFileName(VTK_FILEPATH const char* fileName) override;
57 
58 protected:
60  ~vtkAMREnzoReader() override;
61 
67  void ParseConversionFactors();
68 
73  int GetIndexFromArrayName(std::string arrayName);
74 
79  void ParseLabel(const std::string& labelString, int& idx, std::string& label);
80 
85  void ParseCFactor(const std::string& labelString, int& idx, double& factor);
86 
92  double GetConversionFactor(const std::string& name);
93 
97  void ReadMetaData() override;
98 
102  int GetBlockLevel(int blockIdx) override;
103 
107  int FillMetaData() override;
108 
112  vtkUniformGrid* GetAMRGrid(int blockIdx) override;
113 
117  void GetAMRGridData(int blockIdx, vtkUniformGrid* block, const char* field) override;
118 
122  void GetAMRGridPointData(int vtkNotUsed(blockIdx), vtkUniformGrid* vtkNotUsed(block),
123  const char* vtkNotUsed(field)) override
124  {
125  }
126 
130  void SetUpDataArraySelections() override;
131 
133  bool IsReady;
134 
135 private:
136  vtkAMREnzoReader(const vtkAMREnzoReader&) = delete;
137  void operator=(const vtkAMREnzoReader&) = delete;
138 
139  void ComputeStats(
140  vtkEnzoReaderInternal* internal, std::vector<unsigned int>& blocksPerLevel, double min[3]);
141 
142  vtkEnzoReaderInternal* Internal;
143 
144  std::map<std::string, int> label2idx;
145  std::map<int, double> conversionFactors;
146 };
147 
148 VTK_ABI_NAMESPACE_END
149 #endif /* vtkAMREnzoReader_h */
virtual int GetNumberOfBlocks()=0
Returns the total number of blocks.
virtual vtkUniformGrid * GetAMRGrid(int blockIdx)=0
Loads the block according to the index w.r.t.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ReadMetaData()=0
Reads all the metadata from the file.
virtual int GetBlockLevel(int blockIdx)=0
Returns the block level for the given block.
int vtkTypeBool
Definition: vtkABI.h:64
A concrete instance of vtkAMRBaseReader that implements functionality for reading Enzo AMR datasets...
virtual int GetNumberOfLevels()=0
Returns the total number of levels.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void GetAMRGridData(int blockIdx, vtkUniformGrid *block, const char *field)=0
Loads the block data.
vtkTypeBool ConvertToCGS
Deprecated vtkImageData.
#define VTK_FILEPATH
a multi-resolution dataset based on vtkCartesianGrid allowing overlaps
void GetAMRGridPointData(int blockIdx, vtkUniformGrid *block, const char *field) override
See vtkAMRBaseReader::GetAMRGridData.
An abstract class that encapsulates common functionality for all AMR readers.
static vtkOverlappingAMRAlgorithm * New()
virtual int FillMetaData()=0
Loads all the AMR metadata & constructs the LevelIdxPair12InternalIdx datastructure which maps (level...
virtual void SetUpDataArraySelections()=0
Initializes the PointDataArraySelection & CellDataArraySelection.
virtual void SetFileName(const char *fileName)=0
Set/Get the filename.