VTK: IO/AMR/vtkAMRFlashReaderInternal.h Source File

| VTK 9.3.1

vtkAMRFlashReaderInternal.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
11 #ifndef vtkAMRFlashReaderInternal_h
12 #define vtkAMRFlashReaderInternal_h
13
14 #include <cassert>
15 #include <cstring>
16 #include <map>
17 #include <string>
18 #include <vector>
19
20 #include "vtkByteSwap.h"
21 #include "vtkCellData.h"
22 #include "vtkDataArray.h"
23 #include "vtkDataSet.h"
24 #include "vtkDoubleArray.h"
25 #include "vtkIntArray.h"
26 #include "vtkObject.h"
27 #include "vtkSetGet.h"
28
29 #define H5_USE_16_API
30 #include "vtk_hdf5.h"
31
32 //==============================================================================
33 // I N T E R N A L F L A S H R E A D E R
34 //==============================================================================
35
36 #define FLASH_READER_MAX_DIMS 3
37 #define FLASH_READER_LEAF_BLOCK 1
38 #define FLASH_READER_FLASH3_FFV8 8
39 #define FLASH_READER_FLASH3_FFV9 9
40
41 VTK_ABI_NAMESPACE_BEGIN
42 typedef struct tagFlashReaderIntegerScalar
43 {
44 char Name[20]; // name of the integer scalar
45 int Value; // value of the integer scalar
46 } FlashReaderIntegerScalar;
47
48 typedef struct tagFlashReaderDoubleScalar
49 {
50 char Name[20]; // name of the real scalar
51 double Value; // value of the real scalar
52 } FlashReaderDoubleScalar;
53
54 typedef struct tagFlashReaderSimulationParameters
55 {
56 int NumberOfBlocks; // number of all blocks
57 int NumberOfTimeSteps; // number of time steps
58 int NumberOfXDivisions; // number of divisions per block along x axis
59 int NumberOfYDivisions; // number of divisions per block along y axis
60 int NumberOfZDivisions; // number of divisions per block along z axis
61 double Time; // the time of this step
62 double TimeStep; // time interval
63 double RedShift;
64 } FlashReaderSimulationParameters;
65
66 typedef struct tagFlashReaderBlock
67 {
68 int Index; // Id of the block
69 int Level; // LOD level
70 int Type; // a leaf block?
71 int ParentId; // Id of the parent block
72 int ChildrenIds[8]; // Ids of the children blocks
73 int NeighborIds[6]; // Ids of the neighboring blocks
74 int ProcessorId; // Id of the processor
75 int MinGlobalDivisionIds[3]; // first (global) division index
76 int MaxGlobalDivisionIds[3]; // last (global) division index
77 double Center[3]; // center of the block
78 double MinBounds[3]; // lower left of the bounding box
79 double MaxBounds[3]; // upper right of the bounding box
80 } FlashReaderBlock;
81
82 typedef struct tagFlashReaderSimulationInformation
83 {
84 int FileFormatVersion;
85 char SetupCall[400];
86 char FileCreationTime[80];
87 char FlashVersion[80];
88 char BuildData[80];
89 char BuildDirectory[80];
90 char build_machine[80];
91 char CFlags[400];
92 char FFlags[400];
93 char SetupTimeStamp[80];
94 char BuildTimeStamp[80];
95 } FlashReaderSimulationInformation;
96
97 static std::string GetSeparatedParticleName(const std::string& variable)
98 {
99 std::string sepaName = variable;
100
101 if (sepaName.length() > 9 && sepaName.substr(0, 9) == "particle_")
102 {
103 sepaName = std::string("Particles/") + sepaName.substr(9);
104 }
105 else
106 {
107 sepaName = std::string("Particles/") + sepaName;
108 }
109
110 return sepaName;
111 }
112
113 // ----------------------------------------------------------------------------
114 // Class vtkFlashReaderInternal (begin)
115 // ----------------------------------------------------------------------------
116
117 class vtkFlashReaderInternal
118 {
119 public:
120 vtkFlashReaderInternal() { this->Init(); }
121 ~vtkFlashReaderInternal() { this->Init(); }
122
123 int NumberOfBlocks; // number of ALL blocks
124 int NumberOfLevels; // number of levels
125 int FileFormatVersion; // version of file format
126 int NumberOfParticles; // number of particles
127 int NumberOfLeafBlocks; // number of leaf blocks
128 int NumberOfDimensions; // number of dimensions
129 int NumberOfProcessors; // number of processors
130 int HaveProcessorsInfo; // processor Ids available?
131 int BlockGridDimensions[3]; // number of grid points
132 int BlockCellDimensions[3]; // number of divisions
133 int NumberOfChildrenPerBlock; // number of children per block
134 int NumberOfNeighborsPerBlock; // number of neighbors per block
135
136 char* FileName; // Flash data file name
137 hid_t FileIndex; // file handle
138 double MinBounds[3]; // lower left of the bounding-box
139 double MaxBounds[3]; // upper right of the bounding box
140 FlashReaderSimulationParameters SimulationParameters; // CFD simulation
141 FlashReaderSimulationInformation SimulationInformation; // CFD simulation
142
143 // blocks
144 std::vector<FlashReaderBlock> Blocks;
145 std::vector<int> LeafBlocks;
146 std::vector<std::string> AttributeNames;
147
148 // particles
149 std::string ParticleName;
150 std::vector<hid_t> ParticleAttributeTypes;
151 std::vector<std::string> ParticleAttributeNames;
152 std::map<std::string, int> ParticleAttributeNamesToIds;
153
154 int GetCycle();
155 double GetTime();
156
157 void Init();
158 void SetFileName(VTK_FILEPATH char* fileName) { this->FileName = fileName; }
159 const char* GetParticleName(char* variableName)
160 {
161 static std::string particleName;
162 particleName = GetSeparatedParticleName(std::string(variableName));
163 return particleName.c_str();
164 }
165
166 void ReadMetaData();
167 void ReadProcessorIds();
168 void ReadDoubleScalars(hid_t fileIndx);
169 void ReadIntegerScalars(hid_t fileIndx);
170 void ReadVersionInformation(hid_t fileIndx);
171 void ReadSimulationParameters(hid_t fileIndx, bool bTmCycle = false); // time and cycle only
172 void GetBlockMinMaxGlobalDivisionIds();
173
174 void ReadBlockTypes();
175 void ReadBlockBounds();
176 void ReadBlockCenters();
177 void ReadBlockStructures();
178 void ReadRefinementLevels();
179 void ReadDataAttributeNames();
180
181 void ReadParticlesComponent(hid_t dataIndx, const char* compName, double* dataBuff);
182 void ReadParticleAttributes();
183 void ReadParticleAttributesFLASH3();
184 void GetBlockAttribute(const char* attribute, int blockIdx, vtkDataSet* pDataSet);
185 };
186
187 // ----------------------------------------------------------------------------
188 // Class vtkFlashReaderInternal ( end )
189 // ----------------------------------------------------------------------------
190 VTK_ABI_NAMESPACE_END
191 #endif /* vtkAMRFlashReaderInternal_h */
192 // VTK-HeaderTest-Exclude: vtkAMRFlashReaderInternal.h
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkFlashReaderInternal
Definition: vtkAMRFlashReaderInternal.h:118
vtkFlashReaderInternal::vtkFlashReaderInternal
vtkFlashReaderInternal()
Definition: vtkAMRFlashReaderInternal.h:120
vtkFlashReaderInternal::Init
void Init()
vtkFlashReaderInternal::ReadIntegerScalars
void ReadIntegerScalars(hid_t fileIndx)
vtkFlashReaderInternal::ReadVersionInformation
void ReadVersionInformation(hid_t fileIndx)
vtkFlashReaderInternal::SimulationParameters
FlashReaderSimulationParameters SimulationParameters
Definition: vtkAMRFlashReaderInternal.h:140
vtkFlashReaderInternal::ReadBlockCenters
void ReadBlockCenters()
vtkFlashReaderInternal::ReadRefinementLevels
void ReadRefinementLevels()
vtkFlashReaderInternal::ReadBlockBounds
void ReadBlockBounds()
vtkFlashReaderInternal::~vtkFlashReaderInternal
~vtkFlashReaderInternal()
Definition: vtkAMRFlashReaderInternal.h:121
vtkFlashReaderInternal::ParticleName
std::string ParticleName
Definition: vtkAMRFlashReaderInternal.h:149
vtkFlashReaderInternal::ReadDataAttributeNames
void ReadDataAttributeNames()
vtkFlashReaderInternal::FileFormatVersion
int FileFormatVersion
Definition: vtkAMRFlashReaderInternal.h:125
vtkFlashReaderInternal::ParticleAttributeNamesToIds
std::map< std::string, int > ParticleAttributeNamesToIds
Definition: vtkAMRFlashReaderInternal.h:152
vtkFlashReaderInternal::NumberOfNeighborsPerBlock
int NumberOfNeighborsPerBlock
Definition: vtkAMRFlashReaderInternal.h:134
vtkFlashReaderInternal::NumberOfChildrenPerBlock
int NumberOfChildrenPerBlock
Definition: vtkAMRFlashReaderInternal.h:133
vtkFlashReaderInternal::ReadParticleAttributesFLASH3
void ReadParticleAttributesFLASH3()
vtkFlashReaderInternal::ReadBlockTypes
void ReadBlockTypes()
vtkFlashReaderInternal::ReadMetaData
void ReadMetaData()
vtkFlashReaderInternal::GetCycle
int GetCycle()
vtkFlashReaderInternal::MinBounds
double MinBounds[3]
Definition: vtkAMRFlashReaderInternal.h:138
vtkFlashReaderInternal::GetBlockMinMaxGlobalDivisionIds
void GetBlockMinMaxGlobalDivisionIds()
vtkFlashReaderInternal::LeafBlocks
std::vector< int > LeafBlocks
Definition: vtkAMRFlashReaderInternal.h:145
vtkFlashReaderInternal::FileName
char * FileName
Definition: vtkAMRFlashReaderInternal.h:136
vtkFlashReaderInternal::Blocks
std::vector< FlashReaderBlock > Blocks
Definition: vtkAMRFlashReaderInternal.h:144
vtkFlashReaderInternal::SimulationInformation
FlashReaderSimulationInformation SimulationInformation
Definition: vtkAMRFlashReaderInternal.h:141
vtkFlashReaderInternal::FileIndex
hid_t FileIndex
Definition: vtkAMRFlashReaderInternal.h:137
vtkFlashReaderInternal::NumberOfProcessors
int NumberOfProcessors
Definition: vtkAMRFlashReaderInternal.h:129
vtkFlashReaderInternal::GetBlockAttribute
void GetBlockAttribute(const char *attribute, int blockIdx, vtkDataSet *pDataSet)
vtkFlashReaderInternal::AttributeNames
std::vector< std::string > AttributeNames
Definition: vtkAMRFlashReaderInternal.h:146
vtkFlashReaderInternal::BlockCellDimensions
int BlockCellDimensions[3]
Definition: vtkAMRFlashReaderInternal.h:132
vtkFlashReaderInternal::ReadDoubleScalars
void ReadDoubleScalars(hid_t fileIndx)
vtkFlashReaderInternal::GetTime
double GetTime()
vtkFlashReaderInternal::NumberOfLevels
int NumberOfLevels
Definition: vtkAMRFlashReaderInternal.h:124
vtkFlashReaderInternal::NumberOfBlocks
int NumberOfBlocks
Definition: vtkAMRFlashReaderInternal.h:123
vtkFlashReaderInternal::ReadParticlesComponent
void ReadParticlesComponent(hid_t dataIndx, const char *compName, double *dataBuff)
vtkFlashReaderInternal::HaveProcessorsInfo
int HaveProcessorsInfo
Definition: vtkAMRFlashReaderInternal.h:130
vtkFlashReaderInternal::ParticleAttributeNames
std::vector< std::string > ParticleAttributeNames
Definition: vtkAMRFlashReaderInternal.h:151
vtkFlashReaderInternal::NumberOfLeafBlocks
int NumberOfLeafBlocks
Definition: vtkAMRFlashReaderInternal.h:127
vtkFlashReaderInternal::GetParticleName
const char * GetParticleName(char *variableName)
Definition: vtkAMRFlashReaderInternal.h:159
vtkFlashReaderInternal::ReadBlockStructures
void ReadBlockStructures()
vtkFlashReaderInternal::ReadSimulationParameters
void ReadSimulationParameters(hid_t fileIndx, bool bTmCycle=false)
vtkFlashReaderInternal::BlockGridDimensions
int BlockGridDimensions[3]
Definition: vtkAMRFlashReaderInternal.h:131
vtkFlashReaderInternal::NumberOfDimensions
int NumberOfDimensions
Definition: vtkAMRFlashReaderInternal.h:128
vtkFlashReaderInternal::ParticleAttributeTypes
std::vector< hid_t > ParticleAttributeTypes
Definition: vtkAMRFlashReaderInternal.h:150
vtkFlashReaderInternal::NumberOfParticles
int NumberOfParticles
Definition: vtkAMRFlashReaderInternal.h:126
vtkFlashReaderInternal::ReadParticleAttributes
void ReadParticleAttributes()
vtkFlashReaderInternal::SetFileName
void SetFileName(VTK_FILEPATH char *fileName)
Definition: vtkAMRFlashReaderInternal.h:158
vtkFlashReaderInternal::ReadProcessorIds
void ReadProcessorIds()
vtkFlashReaderInternal::MaxBounds
double MaxBounds[3]
Definition: vtkAMRFlashReaderInternal.h:139
vtkX3D::string
@ string
Definition: vtkX3D.h:490
tagFlashReaderBlock
Definition: vtkAMRFlashReaderInternal.h:67
tagFlashReaderBlock::Type
int Type
Definition: vtkAMRFlashReaderInternal.h:70
tagFlashReaderBlock::MinBounds
double MinBounds[3]
Definition: vtkAMRFlashReaderInternal.h:78
tagFlashReaderBlock::Index
int Index
Definition: vtkAMRFlashReaderInternal.h:68
tagFlashReaderBlock::ParentId
int ParentId
Definition: vtkAMRFlashReaderInternal.h:71
tagFlashReaderBlock::NeighborIds
int NeighborIds[6]
Definition: vtkAMRFlashReaderInternal.h:73
tagFlashReaderBlock::ChildrenIds
int ChildrenIds[8]
Definition: vtkAMRFlashReaderInternal.h:72
tagFlashReaderBlock::MaxGlobalDivisionIds
int MaxGlobalDivisionIds[3]
Definition: vtkAMRFlashReaderInternal.h:76
tagFlashReaderBlock::Level
int Level
Definition: vtkAMRFlashReaderInternal.h:69
tagFlashReaderBlock::ProcessorId
int ProcessorId
Definition: vtkAMRFlashReaderInternal.h:74
tagFlashReaderBlock::MaxBounds
double MaxBounds[3]
Definition: vtkAMRFlashReaderInternal.h:79
tagFlashReaderBlock::Center
double Center[3]
Definition: vtkAMRFlashReaderInternal.h:77
tagFlashReaderBlock::MinGlobalDivisionIds
int MinGlobalDivisionIds[3]
Definition: vtkAMRFlashReaderInternal.h:75
tagFlashReaderDoubleScalar
Definition: vtkAMRFlashReaderInternal.h:49
tagFlashReaderDoubleScalar::Name
char Name[20]
Definition: vtkAMRFlashReaderInternal.h:50
tagFlashReaderDoubleScalar::Value
double Value
Definition: vtkAMRFlashReaderInternal.h:51
tagFlashReaderIntegerScalar
Definition: vtkAMRFlashReaderInternal.h:43
tagFlashReaderIntegerScalar::Value
int Value
Definition: vtkAMRFlashReaderInternal.h:45
tagFlashReaderIntegerScalar::Name
char Name[20]
Definition: vtkAMRFlashReaderInternal.h:44
tagFlashReaderSimulationInformation
Definition: vtkAMRFlashReaderInternal.h:83
tagFlashReaderSimulationInformation::CFlags
char CFlags[400]
Definition: vtkAMRFlashReaderInternal.h:91
tagFlashReaderSimulationInformation::SetupCall
char SetupCall[400]
Definition: vtkAMRFlashReaderInternal.h:85
tagFlashReaderSimulationInformation::FFlags
char FFlags[400]
Definition: vtkAMRFlashReaderInternal.h:92
tagFlashReaderSimulationInformation::build_machine
char build_machine[80]
Definition: vtkAMRFlashReaderInternal.h:90
tagFlashReaderSimulationInformation::BuildData
char BuildData[80]
Definition: vtkAMRFlashReaderInternal.h:88
tagFlashReaderSimulationInformation::FlashVersion
char FlashVersion[80]
Definition: vtkAMRFlashReaderInternal.h:87
tagFlashReaderSimulationInformation::BuildTimeStamp
char BuildTimeStamp[80]
Definition: vtkAMRFlashReaderInternal.h:94
tagFlashReaderSimulationInformation::SetupTimeStamp
char SetupTimeStamp[80]
Definition: vtkAMRFlashReaderInternal.h:93
tagFlashReaderSimulationInformation::FileCreationTime
char FileCreationTime[80]
Definition: vtkAMRFlashReaderInternal.h:86
tagFlashReaderSimulationInformation::FileFormatVersion
int FileFormatVersion
Definition: vtkAMRFlashReaderInternal.h:84
tagFlashReaderSimulationInformation::BuildDirectory
char BuildDirectory[80]
Definition: vtkAMRFlashReaderInternal.h:89
tagFlashReaderSimulationParameters
Definition: vtkAMRFlashReaderInternal.h:55
tagFlashReaderSimulationParameters::NumberOfBlocks
int NumberOfBlocks
Definition: vtkAMRFlashReaderInternal.h:56
tagFlashReaderSimulationParameters::RedShift
double RedShift
Definition: vtkAMRFlashReaderInternal.h:63
tagFlashReaderSimulationParameters::NumberOfYDivisions
int NumberOfYDivisions
Definition: vtkAMRFlashReaderInternal.h:59
tagFlashReaderSimulationParameters::NumberOfXDivisions
int NumberOfXDivisions
Definition: vtkAMRFlashReaderInternal.h:58
tagFlashReaderSimulationParameters::NumberOfZDivisions
int NumberOfZDivisions
Definition: vtkAMRFlashReaderInternal.h:60
tagFlashReaderSimulationParameters::NumberOfTimeSteps
int NumberOfTimeSteps
Definition: vtkAMRFlashReaderInternal.h:57
tagFlashReaderSimulationParameters::TimeStep
double TimeStep
Definition: vtkAMRFlashReaderInternal.h:62
tagFlashReaderSimulationParameters::Time
double Time
Definition: vtkAMRFlashReaderInternal.h:61
GetSeparatedParticleName
static std::string GetSeparatedParticleName(const std::string &variable)
Definition: vtkAMRFlashReaderInternal.h:97
FlashReaderBlock
struct tagFlashReaderBlock FlashReaderBlock
FlashReaderSimulationParameters
struct tagFlashReaderSimulationParameters FlashReaderSimulationParameters
FlashReaderDoubleScalar
struct tagFlashReaderDoubleScalar FlashReaderDoubleScalar
FlashReaderIntegerScalar
struct tagFlashReaderIntegerScalar FlashReaderIntegerScalar
FlashReaderSimulationInformation
struct tagFlashReaderSimulationInformation FlashReaderSimulationInformation
vtkByteSwap.h
vtkCellData.h
vtkDataArray.h
vtkDataSet.h
vtkDoubleArray.h
vtkIntArray.h
vtkObject.h
VTK_FILEPATH
#define VTK_FILEPATH
Definition: vtkWrappingHints.h:34