VTK  9.5.20250710
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
41VTK_ABI_NAMESPACE_BEGIN
43{
44 char Name[20]; // name of the integer scalar
45 int Value; // value of the integer scalar
47
49{
50 char Name[20]; // name of the real scalar
51 double Value; // value of the real scalar
53
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;
65
66typedef 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
81
83{
85 char SetupCall[400];
87 char FlashVersion[80];
88 char BuildData[80];
90 char build_machine[80];
91 char CFlags[400];
92 char FFlags[400];
96
97// ----------------------------------------------------------------------------
98// Class vtkFlashReaderInternal (begin)
99// ----------------------------------------------------------------------------
100
102{
103public:
106
107 int NumberOfBlocks; // number of ALL blocks
108 int NumberOfLevels; // number of levels
109 int FileFormatVersion; // version of file format
110 int NumberOfParticles; // number of particles
111 int NumberOfLeafBlocks; // number of leaf blocks
112 int NumberOfDimensions; // number of dimensions
113 int NumberOfProcessors; // number of processors
114 int HaveProcessorsInfo; // processor Ids available?
115 int BlockGridDimensions[3]; // number of grid points
116 int BlockCellDimensions[3]; // number of divisions
117 int NumberOfChildrenPerBlock; // number of children per block
118 int NumberOfNeighborsPerBlock; // number of neighbors per block
119
120 char* FileName; // Flash data file name
121 hid_t FileIndex; // file handle
122 double MinBounds[3]; // lower left of the bounding-box
123 double MaxBounds[3]; // upper right of the bounding box
126
127 // blocks
128 std::vector<FlashReaderBlock> Blocks;
129 std::vector<int> LeafBlocks;
130 std::vector<std::string> AttributeNames;
131
132 // particles
133 std::string ParticleName;
134 std::vector<hid_t> ParticleAttributeTypes;
135 std::vector<std::string> ParticleAttributeNames;
136 std::map<std::string, int> ParticleAttributeNamesToIds;
137
138 int GetCycle();
139 double GetTime();
140
141 void Init();
142 void SetFileName(VTK_FILEPATH char* fileName) { this->FileName = fileName; }
143 const char* GetParticleName(char* variableName);
144
147 void ReadDoubleScalars(hid_t fileIndx);
148 void ReadIntegerScalars(hid_t fileIndx);
150 void ReadSimulationParameters(hid_t fileIndx, bool bTmCycle = false); // time and cycle only
152
159
160 void ReadParticlesComponent(hid_t dataIndx, const char* compName, double* dataBuff);
163 void GetBlockAttribute(const char* attribute, int blockIdx, vtkDataSet* pDataSet);
164
165 static std::string GetSeparatedParticleName(const std::string& variable)
166 {
167 std::string sepaName = variable;
168
169 if (sepaName.length() > 9 && sepaName.substr(0, 9) == "particle_")
170 {
171 sepaName = std::string("Particles/") + sepaName.substr(9);
172 }
173 else
174 {
175 sepaName = std::string("Particles/") + sepaName;
176 }
177
178 return sepaName;
179 }
180};
181
182// ----------------------------------------------------------------------------
183// Class vtkFlashReaderInternal ( end )
184// ----------------------------------------------------------------------------
185VTK_ABI_NAMESPACE_END
186#endif /* vtkAMRFlashReaderInternal_h */
187// VTK-HeaderTest-Exclude: vtkAMRFlashReaderInternal.h
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
void ReadIntegerScalars(hid_t fileIndx)
void ReadVersionInformation(hid_t fileIndx)
FlashReaderSimulationParameters SimulationParameters
std::map< std::string, int > ParticleAttributeNamesToIds
void ReadParticleAttributesFLASH3()
static std::string GetSeparatedParticleName(const std::string &variable)
void GetBlockMinMaxGlobalDivisionIds()
std::vector< FlashReaderBlock > Blocks
FlashReaderSimulationInformation SimulationInformation
const char * GetParticleName(char *variableName)
void GetBlockAttribute(const char *attribute, int blockIdx, vtkDataSet *pDataSet)
std::vector< std::string > AttributeNames
void ReadDoubleScalars(hid_t fileIndx)
void ReadParticlesComponent(hid_t dataIndx, const char *compName, double *dataBuff)
std::vector< std::string > ParticleAttributeNames
void ReadSimulationParameters(hid_t fileIndx, bool bTmCycle=false)
std::vector< hid_t > ParticleAttributeTypes
struct tagFlashReaderBlock FlashReaderBlock
struct tagFlashReaderSimulationParameters FlashReaderSimulationParameters
struct tagFlashReaderDoubleScalar FlashReaderDoubleScalar
struct tagFlashReaderIntegerScalar FlashReaderIntegerScalar
struct tagFlashReaderSimulationInformation FlashReaderSimulationInformation
int64_t hid_t
#define VTK_FILEPATH