VTK  9.4.20241226
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
23VTK_ABI_NAMESPACE_BEGIN
26
27class VTKIOAMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader
28{
29public:
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
58protected:
61
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
105 vtkEnzoReaderInternal* internal, std::vector<int>& blocksPerLevel, double min[3]);
106
110 int FillMetaData() override;
111
115 vtkUniformGrid* GetAMRGrid(int blockIdx) override;
116
120 void GetAMRGridData(int blockIdx, vtkUniformGrid* block, const char* field) override;
121
125 void GetAMRGridPointData(int vtkNotUsed(blockIdx), vtkUniformGrid* vtkNotUsed(block),
126 const char* vtkNotUsed(field)) override
127 {
128 }
129
134
137
138private:
139 vtkAMREnzoReader(const vtkAMREnzoReader&) = delete;
140 void operator=(const vtkAMREnzoReader&) = delete;
141
142 vtkEnzoReaderInternal* Internal;
143
144 std::map<std::string, int> label2idx;
145 std::map<int, double> conversionFactors;
146};
147
148VTK_ABI_NAMESPACE_END
149#endif /* vtkAMREnzoReader_h */
An abstract class that encapsulates common functionality for all AMR readers.
A concrete instance of vtkAMRBaseReader that implements functionality for reading Enzo AMR datasets.
void ParseLabel(const std::string &labelString, int &idx, std::string &label)
Given the label string, this method parses the attribute label and the string index.
int GetNumberOfBlocks() override
See vtkAMRBaseReader::GetNumberOfBlocks.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetFileName(VTK_FILEPATH const char *fileName) override
See vtkAMRBaseReader::SetFileName.
int GetBlockLevel(int blockIdx) override
See vtkAMRBaseReader::GetBlockLevel.
int FillMetaData() override
See vtkAMRBaseReader::FillMetaData.
int GetNumberOfLevels() override
See vtkAMRBaseReader::GetNumberOfLevels.
vtkTypeBool ConvertToCGS
void ComputeStats(vtkEnzoReaderInternal *internal, std::vector< int > &blocksPerLevel, double min[3])
~vtkAMREnzoReader() override
void GetAMRGridData(int blockIdx, vtkUniformGrid *block, const char *field) override
See vtkAMRBaseReader::GetAMRGridData.
void ParseCFactor(const std::string &labelString, int &idx, double &factor)
Given the label string, this method parses the corresponding attribute index and conversion factor.
void ParseConversionFactors()
Parses the parameters file and extracts the conversion factors that are used to convert to CGS units.
vtkUniformGrid * GetAMRGrid(int blockIdx) override
See vtkAMRBaseReader::GetAMRGrid.
void SetUpDataArraySelections() override
See vtkAMRBaseReader::SetUpDataArraySelections.
void ReadMetaData() override
See vtkAMRBaseReader::ReadMetaData.
void GetAMRGridPointData(int vtkNotUsed(blockIdx), vtkUniformGrid *vtkNotUsed(block), const char *vtkNotUsed(field)) override
See vtkAMRBaseReader::GetAMRGridData.
double GetConversionFactor(const std::string &name)
Given the variable name, return the conversion factor used to convert the data to CGS.
static vtkAMREnzoReader * New()
int GetIndexFromArrayName(std::string arrayName)
Given an array name of the form "array[idx]" this method extracts and returns the corresponding index...
a simple class to control print indentation
Definition vtkIndent.h:108
hierarchical dataset of vtkUniformGrids
image data with blanking
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_FILEPATH