VTK
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  =========================================================================*/
23 #ifndef vtkAMREnzoReader_h
24 #define vtkAMREnzoReader_h
25 
26 #include "vtkIOAMRModule.h" // For export macro
27 #include "vtkAMRBaseReader.h"
28 
29 #include <map> // For STL map
30 #include <string> // For std::string
31 
32 class vtkOverlappingAMR;
34 
35 class VTKIOAMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader
36 {
37 public:
38  static vtkAMREnzoReader* New();
40  void PrintSelf(ostream &os, vtkIndent indent ) override;
41 
43 
46  vtkSetMacro( ConvertToCGS, vtkTypeBool );
47  vtkGetMacro( ConvertToCGS, vtkTypeBool );
48  vtkBooleanMacro( ConvertToCGS, vtkTypeBool );
50 
54  int GetNumberOfBlocks() override;
55 
59  int GetNumberOfLevels() override;
60 
64  void SetFileName( const char* fileName ) override;
65 
66 protected:
68  ~vtkAMREnzoReader() override;
69 
75  void ParseConversionFactors();
76 
81  int GetIndexFromArrayName( std::string arrayName );
82 
87  void ParseLabel(const std::string &labelString, int &idx, std::string &label);
88 
93  void ParseCFactor(const std::string &labelString, int &idx, double &factor );
94 
100  double GetConversionFactor( const std::string& name );
101 
105  void ReadMetaData() override;
106 
110  int GetBlockLevel( const int blockIdx ) override;
111 
112  void ComputeStats(vtkEnzoReaderInternal* internal, std::vector<int>& blocksPerLevel, double min[3]);
113 
117  int FillMetaData( ) override;
118 
122  vtkUniformGrid* GetAMRGrid( const int blockIdx ) override;
123 
127  void GetAMRGridData(
128  const int blockIdx, vtkUniformGrid *block, const char *field) override;
129 
134  const int vtkNotUsed(blockIdx), vtkUniformGrid *vtkNotUsed(block), const char *vtkNotUsed(field)) override {;};
135 
139  void SetUpDataArraySelections() override;
140 
142  bool IsReady;
143 
144 private:
145  vtkAMREnzoReader( const vtkAMREnzoReader& ) = delete;
146  void operator=(const vtkAMREnzoReader& ) = delete;
147 
148  vtkEnzoReaderInternal *Internal;
149 
150  std::map< std::string, int > label2idx;
151  std::map< int, double > conversionFactors;
152 };
153 
154 #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
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:33
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
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.
virtual void SetFileName(const char *fileName)=0
Set/Get the filename.