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