VTK  9.1.0
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 "vtkAMRBaseReader.h"
27#include "vtkIOAMRModule.h" // For export macro
28
29#include <map> // For STL map
30#include <string> // For std::string
31
34
35class VTKIOAMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader
36{
37public:
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(VTK_FILEPATH const char* fileName) override;
65
66protected:
69
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
113 vtkEnzoReaderInternal* internal, std::vector<int>& blocksPerLevel, double min[3]);
114
118 int FillMetaData() override;
119
123 vtkUniformGrid* GetAMRGrid(const int blockIdx) override;
124
128 void GetAMRGridData(const int blockIdx, vtkUniformGrid* block, const char* field) override;
129
133 void GetAMRGridPointData(const int vtkNotUsed(blockIdx), vtkUniformGrid* vtkNotUsed(block),
134 const char* vtkNotUsed(field)) override
135 {
136 }
137
142
145
146private:
147 vtkAMREnzoReader(const vtkAMREnzoReader&) = delete;
148 void operator=(const vtkAMREnzoReader&) = delete;
149
150 vtkEnzoReaderInternal* Internal;
151
152 std::map<std::string, int> label2idx;
153 std::map<int, double> conversionFactors;
154};
155
156#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 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 ParseCFactor(const std::string &labelString, int &idx, double &factor)
Given the label string, this method parses the corresponding attribute index and conversion factor.
void GetAMRGridData(const int blockIdx, vtkUniformGrid *block, const char *field) override
See vtkAMRBaseReader::GetAMRGridData.
void ParseConversionFactors()
Parses the parameters file and extracts the conversion factors that are used to convert to CGS units.
void GetAMRGridPointData(const int vtkNotUsed(blockIdx), vtkUniformGrid *vtkNotUsed(block), const char *vtkNotUsed(field)) override
See vtkAMRBaseReader::GetAMRGridData.
vtkUniformGrid * GetAMRGrid(const int blockIdx) override
See vtkAMRBaseReader::GetAMRGrid.
int GetBlockLevel(const int blockIdx) override
See vtkAMRBaseReader::GetBlockLevel.
void SetUpDataArraySelections() override
See vtkAMRBaseReader::SetUpDataArraySelections.
void ReadMetaData() override
See vtkAMRBaseReader::ReadMetaData.
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:113
hierarchical dataset of vtkUniformGrids
image data with blanking
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_FILEPATH