VTK  9.2.6
vtkAMREnzoReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAMREnzoReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14  =========================================================================*/
26 #ifndef vtkAMREnzoReader_h
27 #define vtkAMREnzoReader_h
28 
29 #include "vtkAMRBaseReader.h"
30 #include "vtkIOAMRModule.h" // For export macro
31 
32 #include <map> // For STL map
33 #include <string> // For std::string
34 
35 class vtkOverlappingAMR;
37 
38 class VTKIOAMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader
39 {
40 public:
41  static vtkAMREnzoReader* New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
49  vtkSetMacro(ConvertToCGS, vtkTypeBool);
50  vtkGetMacro(ConvertToCGS, vtkTypeBool);
51  vtkBooleanMacro(ConvertToCGS, vtkTypeBool);
53 
57  int GetNumberOfBlocks() override;
58 
62  int GetNumberOfLevels() override;
63 
67  void SetFileName(VTK_FILEPATH const char* fileName) override;
68 
69 protected:
71  ~vtkAMREnzoReader() override;
72 
78  void ParseConversionFactors();
79 
84  int GetIndexFromArrayName(std::string arrayName);
85 
90  void ParseLabel(const std::string& labelString, int& idx, std::string& label);
91 
96  void ParseCFactor(const std::string& labelString, int& idx, double& factor);
97 
103  double GetConversionFactor(const std::string& name);
104 
108  void ReadMetaData() override;
109 
113  int GetBlockLevel(const int blockIdx) override;
114 
115  void ComputeStats(
116  vtkEnzoReaderInternal* internal, std::vector<int>& blocksPerLevel, double min[3]);
117 
121  int FillMetaData() override;
122 
126  vtkUniformGrid* GetAMRGrid(const int blockIdx) override;
127 
131  void GetAMRGridData(const int blockIdx, vtkUniformGrid* block, const char* field) override;
132 
136  void GetAMRGridPointData(const int vtkNotUsed(blockIdx), vtkUniformGrid* vtkNotUsed(block),
137  const char* vtkNotUsed(field)) override
138  {
139  }
140 
144  void SetUpDataArraySelections() override;
145 
147  bool IsReady;
148 
149 private:
150  vtkAMREnzoReader(const vtkAMREnzoReader&) = delete;
151  void operator=(const vtkAMREnzoReader&) = delete;
152 
153  vtkEnzoReaderInternal* Internal;
154 
155  std::map<std::string, int> label2idx;
156  std::map<int, double> conversionFactors;
157 };
158 
159 #endif /* vtkAMREnzoReader_h */
virtual vtkUniformGrid * GetAMRGrid(const int blockIdx)=0
Loads the block according to the index w.r.t.
virtual int GetNumberOfBlocks()=0
Returns the total number of blocks.
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.
int vtkTypeBool
Definition: vtkABI.h:69
virtual void SetFileName(VTK_FILEPATH const char *fileName)=0
Set/Get the filename.
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:39
virtual void GetAMRGridData(const int blockIdx, vtkUniformGrid *block, const char *field)=0
Loads the block data.
virtual int GetBlockLevel(const int blockIdx)=0
Returns the block level for the given block.
vtkTypeBool ConvertToCGS
image data with blanking
#define VTK_FILEPATH
void GetAMRGridPointData(const int vtkNotUsed(blockIdx), vtkUniformGrid *vtkNotUsed(block), const char *vtkNotUsed(field)) override
See vtkAMRBaseReader::GetAMRGridData.
hierarchical dataset of vtkUniformGrids
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.