VTK  9.2.6
PIOAdaptor.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ParaView
4 Module: PIOAdaptor.h
5
6 Copyright (c) Kitware, Inc.
7 All rights reserved.
8 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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=========================================================================*/
15#ifndef PIOAdaptor_h
16#define PIOAdaptor_h
17
21
22#include "PIOData.h"
23
24#include <vector>
25
27
28// class to hold information about chunk/material variables
30{
31public:
32 std::string prefix;
33 std::string var;
34 std::string material_name; // full name of the material
36
37 // whether the variable should be scaled. scaled means the variable
38 // needs to be divided by volume (vcell)
39 bool scale;
40};
41
43{
44public:
47
48 int initializeGlobal(const char* DumpDescFile);
49 int initializeDump(int timeStep);
50
51 // Time step change requires new geometry and data
54
55 int GetNumberOfTimeSteps() { return static_cast<int>(this->CycleIndex.size()); }
56 double GetSimulationTime(int step) { return this->SimulationTime[step]; }
57 double GetCycleIndex(int step) { return this->CycleIndex[step]; }
58 double GetPIOFileIndex(int step) { return this->PIOFileIndex[step]; }
59
60 int GetNumberOfVariables() { return (int)this->variableName.size(); }
61 const char* GetVariableName(int indx) { return this->variableName[indx].c_str(); }
62 int GetNumberOfDefaultVariables() { return (int)this->variableDefault.size(); }
63 const char* GetVariableDefault(int indx) { return this->variableDefault[indx].c_str(); }
64
65 // Read pio dump file AMR as hypertree grid rather than unstructured grid
66 bool GetHyperTreeGrid() { return this->useHTG; }
67 void SetHyperTreeGrid(bool val) { this->useHTG = val; }
68
69 // Read pio dump file tracer information
70 bool GetTracers() { return this->useTracer; }
71 void SetTracers(bool val) { this->useTracer = val; }
72
73 // Read pio dump file variable data as 64 bit float
74 bool GetFloat64() { return this->useFloat64; }
75 void SetFloat64(bool val) { this->useFloat64 = val; }
76
77protected:
78 // Collect the metadata
79 int parsePIOFile(const char* DumpDescFile);
80 int collectMetaData(const char* DumpDescFile);
83 void addMaterialVariable(vtkStdString& pioFieldName, std::vector<std::string> matident);
84 std::string trimString(const std::string& str);
85
86 // Create the unstructured grid for tracers
88
89 // Create the unstructured grid for AMR
91
93 int numberOfCells, // Number of cells all levels
94 int* cell_level, // Level within AMR
95 int64_t* cell_daughter, // Daughter ID, 0 indicates no daughter
96 double* cell_center[1]); // Cell center
97
99 int numberOfCells, // Number of cells all levels
100 int* cell_level, // Level within AMR
101 int64_t* cell_daughter, // Daughter ID, 0 indicates no daughter
102 double* cell_center[2]); // Cell center
103
105 int numberOfCells, // Number of cells all levels
106 int* cell_level, // Level within AMR
107 int64_t* cell_daughter, // Daughter ID, 0 indicates no daughter
108 double* cell_center[3]); // Cell center
109
110 // Create the hypertree grid
112
113 int count_hypertree(int64_t curIndex, int64_t* daughter);
114
116 vtkHyperTreeGridNonOrientedCursor* treeCursor, int64_t curIndex, int64_t* daughter);
117
118 // Add variable data to the unstructured grid
121 int64_t* daughter, // Indicates top level cell or not
122 double* data[], // Data for all cells
123 int numberOfCells,
124 int numberOfComponents); // Number of components in data
125
126 // Add variable data to the hypertree grid
129 double* data[], // Data for all cells
130 int numberOfComponents); // Number of components in data
131
132 // Used in parallel reader and load balancing
134 int Rank;
136
137 // Structure to access the dump file data
139
140 // Time series of dumps
141 std::string descFileName; // name.pio
142 std::string dumpBaseName; // base name to use for dumps
143 std::vector<std::string> dumpDirectory; // directories holding dumps
144 std::vector<std::string> dumpFileName; // all dump files
145
146 // Time step information
147 std::vector<double> CycleIndex; // Times as cycle index
148 std::vector<double> SimulationTime; // Times as simulation time
149 std::vector<double> PIOFileIndex; // Index into dump files
150
151 // Type of block structures to create within multiblock dataset
152 bool useHTG;
156
157 // Cell variable data and initially enabled variables
158 std::vector<std::string> variableName;
159 std::vector<std::string> variableDefault;
160
161 // total number of cells in the mesh. needed when loading material variables.
162 // obtained by summing all values in pio field global_numcells
163 int64_t numCells;
164
165 // Record the ordering of the cells when building the hypertree grid
166 // Needed so that the data will line up correctly
167 std::vector<int> indexNodeLeaf;
168
169 // list of material variables
170 std::map<std::string, PIOMaterialVariable*> matVariables;
172
173 struct AdaptorImpl;
174 AdaptorImpl* Impl;
175};
176
177#endif
std::vector< double > SimulationTime
Definition: PIOAdaptor.h:148
void create_amr_UG_3D(vtkMultiBlockDataSet *grid, int numberOfCells, int *cell_level, int64_t *cell_daughter, double *cell_center[3])
void build_hypertree(vtkHyperTreeGridNonOrientedCursor *treeCursor, int64_t curIndex, int64_t *daughter)
int GetNumberOfVariables()
Definition: PIOAdaptor.h:60
int numMaterials
Definition: PIOAdaptor.h:171
void create_amr_UG_1D(vtkMultiBlockDataSet *grid, int numberOfCells, int *cell_level, int64_t *cell_daughter, double *cell_center[1])
void create_amr_UG(vtkMultiBlockDataSet *grid)
bool useTracer
Definition: PIOAdaptor.h:153
int count_hypertree(int64_t curIndex, int64_t *daughter)
double GetSimulationTime(int step)
Definition: PIOAdaptor.h:56
void add_amr_UG_scalar(vtkMultiBlockDataSet *grid, vtkStdString varName, int64_t *daughter, double *data[], int numberOfCells, int numberOfComponents)
vtkMultiProcessController * Controller
Definition: PIOAdaptor.h:133
PIO_DATA * pioData
Definition: PIOAdaptor.h:138
bool GetHyperTreeGrid()
Definition: PIOAdaptor.h:66
void create_geometry(vtkMultiBlockDataSet *grid)
void SetTracers(bool val)
Definition: PIOAdaptor.h:71
std::string descFileName
Definition: PIOAdaptor.h:141
std::map< std::string, PIOMaterialVariable * > matVariables
Definition: PIOAdaptor.h:170
int parsePIOFile(const char *DumpDescFile)
double GetCycleIndex(int step)
Definition: PIOAdaptor.h:57
void addMaterialVariable(vtkStdString &pioFieldName, std::vector< std::string > matident)
bool hasTracers
Definition: PIOAdaptor.h:155
int initializeDump(int timeStep)
void load_variable_data_HTG(vtkMultiBlockDataSet *grid, vtkDataArraySelection *cellSelection)
void create_tracer_UG(vtkMultiBlockDataSet *grid)
bool GetTracers()
Definition: PIOAdaptor.h:70
std::vector< int > indexNodeLeaf
Definition: PIOAdaptor.h:167
std::vector< std::string > dumpFileName
Definition: PIOAdaptor.h:144
std::vector< std::string > variableDefault
Definition: PIOAdaptor.h:159
std::string trimString(const std::string &str)
void add_amr_HTG_scalar(vtkMultiBlockDataSet *grid, vtkStdString varName, double *data[], int numberOfComponents)
bool GetFloat64()
Definition: PIOAdaptor.h:74
void load_variable_data(vtkMultiBlockDataSet *grid, vtkDataArraySelection *cellSelection)
std::vector< double > PIOFileIndex
Definition: PIOAdaptor.h:149
int GetNumberOfTimeSteps()
Definition: PIOAdaptor.h:55
bool useHTG
Definition: PIOAdaptor.h:152
void create_amr_UG_2D(vtkMultiBlockDataSet *grid, int numberOfCells, int *cell_level, int64_t *cell_daughter, double *cell_center[2])
int GetNumberOfDefaultVariables()
Definition: PIOAdaptor.h:62
std::vector< std::string > dumpDirectory
Definition: PIOAdaptor.h:143
double GetPIOFileIndex(int step)
Definition: PIOAdaptor.h:58
void collectVariableMetaData()
int initializeGlobal(const char *DumpDescFile)
AdaptorImpl * Impl
Definition: PIOAdaptor.h:174
const char * GetVariableDefault(int indx)
Definition: PIOAdaptor.h:63
int64_t numCells
Definition: PIOAdaptor.h:163
void SetFloat64(bool val)
Definition: PIOAdaptor.h:75
PIOAdaptor(vtkMultiProcessController *ctrl)
std::vector< double > CycleIndex
Definition: PIOAdaptor.h:147
void collectMaterialVariableMetaData()
bool useFloat64
Definition: PIOAdaptor.h:154
int collectMetaData(const char *DumpDescFile)
int TotalRank
Definition: PIOAdaptor.h:135
void SetHyperTreeGrid(bool val)
Definition: PIOAdaptor.h:67
const char * GetVariableName(int indx)
Definition: PIOAdaptor.h:61
std::string dumpBaseName
Definition: PIOAdaptor.h:142
std::vector< std::string > variableName
Definition: PIOAdaptor.h:158
void load_variable_data_UG(vtkMultiBlockDataSet *grid, vtkDataArraySelection *cellSelection)
void create_amr_HTG(vtkMultiBlockDataSet *grid)
std::string material_name
Definition: PIOAdaptor.h:34
std::string var
Definition: PIOAdaptor.h:33
std::string prefix
Definition: PIOAdaptor.h:32
uint32_t material_number
Definition: PIOAdaptor.h:35
Store on/off settings for data arrays, etc.
Objects for traversal a HyperTreeGrid.
Composite dataset that organizes datasets into blocks.
Multiprocessing communication superclass.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:39