VTK  9.4.20241226
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
97static 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
118{
119public:
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
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
168 void ReadDoubleScalars(hid_t fileIndx);
169 void ReadIntegerScalars(hid_t fileIndx);
171 void ReadSimulationParameters(hid_t fileIndx, bool bTmCycle = false); // time and cycle only
173
180
181 void ReadParticlesComponent(hid_t dataIndx, const char* compName, double* dataBuff);
184 void GetBlockAttribute(const char* attribute, int blockIdx, vtkDataSet* pDataSet);
185};
186
187// ----------------------------------------------------------------------------
188// Class vtkFlashReaderInternal ( end )
189// ----------------------------------------------------------------------------
190VTK_ABI_NAMESPACE_END
191#endif /* vtkAMRFlashReaderInternal_h */
192// 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()
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
void SetFileName(VTK_FILEPATH char *fileName)
static std::string GetSeparatedParticleName(const std::string &variable)
struct tagFlashReaderBlock FlashReaderBlock
struct tagFlashReaderSimulationParameters FlashReaderSimulationParameters
struct tagFlashReaderDoubleScalar FlashReaderDoubleScalar
struct tagFlashReaderIntegerScalar FlashReaderIntegerScalar
struct tagFlashReaderSimulationInformation FlashReaderSimulationInformation
int64_t hid_t
#define VTK_FILEPATH