VTK  9.0.1
PIOAdaptor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile PIOAdaptor.h,v $
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 
18 #include "vtkDataArraySelection.h"
20 #include "vtkMultiBlockDataSet.h"
21 
22 #include "PIOData.h"
23 
24 #include <vector>
25 
27 {
28 public:
29  PIOAdaptor(int rank, int totalRank);
30  ~PIOAdaptor();
31 
32  int initializeGlobal(const char* DumpDescFile);
33  int initializeDump(int timeStep);
34 
35  // Time step change requires new geometry and data
38 
39  int GetNumberOfTimeSteps() { return this->numberOfTimeSteps; }
40  double GetTimeStep(int step) { return this->timeSteps[step]; }
41 
42  int GetNumberOfVariables() { return (int)this->variableName.size(); }
43  const char* GetVariableName(int indx) { return this->variableName[indx].c_str(); }
44  int GetNumberOfDefaultVariables() { return (int)this->variableDefault.size(); }
45  const char* GetVariableDefault(int indx) { return this->variableDefault[indx].c_str(); }
46 
47  // Read pio dump file AMR as hypertree grid rather than unstructured grid
48  bool GetHyperTreeGrid() { return this->useHTG; }
49  void SetHyperTreeGrid(bool val) { this->useHTG = val; }
50 
51  // Read pio dump file tracer information
52  bool GetTracers() { return this->useTracer; }
53  void SetTracers(bool val) { this->useTracer = val; }
54 
55  // Read pio dump file variable data as 64 bit float
56  bool GetFloat64() { return this->useFloat64; }
57  void SetFloat64(bool val) { this->useFloat64 = val; }
58 
59 protected:
60  // Create the unstructured grid for tracers
62 
63  // Create the unstructured grid for AMR
64  void create_amr_UG(vtkMultiBlockDataSet* grid, int numProc, int* global_numcell,
65  int* cell_level, // Level within AMR
66  int64_t* cell_daughter, // Daughter ID, 0 indicates no daughter
67  double** cell_center); // Cell center
68 
70  int startCellIndx, // Number of cells all levels
71  int endCellIndx, // Number of cells all levels
72  int* cell_level, // Level within AMR
73  int64_t* cell_daughter, // Daughter ID, 0 indicates no daughter
74  double* cell_center[1]); // Cell center
75 
77  int startCellIndx, // Number of cells all levels
78  int endCellIndx, // Number of cells all levels
79  int* cell_level, // Level within AMR
80  int64_t* cell_daughter, // Daughter ID, 0 indicates no daughter
81  double* cell_center[2]); // Cell center
82 
84  int startCellIndx, // Number of cells all levels
85  int endCellIndx, // Number of cells all levels
86  int* cell_level, // Level within AMR
87  int64_t* cell_daughter, // Daughter ID, 0 indicates no daughter
88  double* cell_center[3]); // Cell center
89 
90  // Create the hypertree grid
92  int numberOfCells, // Number of cells all levels
93  int* cell_level, // Level within AMR
94  int64_t* cell_daughter, // Daughter
95  double* cell_center[3]); // Cell center
96 
97  int count_hypertree(int64_t curIndex, int64_t* daughter);
98 
99  void build_hypertree(
100  vtkHyperTreeGridNonOrientedCursor* treeCursor, int64_t curIndex, int64_t* daughter);
101 
102  // Add variable data to the unstructured grid
104  int64_t* daughter, // Indicates top level cell or not
105  double* data[], // Data for all cells
106  int numberOfComponents); // Number of components in data
107 
108  // Add variable data to the hypertree grid
110  double* data[], // Data for all cells
111  int numberOfComponents); // Number of components in data
112 
113  // Used in parallel reader and load balancing
114  int Rank;
116 
117  // Structure to access the dump file data
119 
120  // Fields of interest in dump file
121  std::list<std::string> fieldsToRead;
122 
123  // Time series of dumps
125  std::string dumpDirectory; // directory holding dumps
126  std::string dumpBaseName; // base name to use for dumps
127 
128  std::vector<std::string> dumpFileName;
130  double* timeSteps;
131 
132  // Type of block structures to create within multiblock dataset
133  bool useHTG;
134  bool useTracer;
137 
138  // Cell variable data and initially enabled variables
139  std::vector<std::string> variableName;
140  std::vector<std::string> variableDefault;
141 
142  // Record the ordering of the cells when building the hypertree grid
143  // Needed so that the data will line up correctly
144  std::vector<int> indexNodeLeaf;
145 };
146 
147 #endif
const char * GetVariableName(int indx)
Definition: PIOAdaptor.h:43
std::string dumpDirectory
Definition: PIOAdaptor.h:125
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
const char * GetVariableDefault(int indx)
Definition: PIOAdaptor.h:45
void load_variable_data(vtkMultiBlockDataSet *grid, vtkDataArraySelection *cellSelection)
bool GetFloat64()
Definition: PIOAdaptor.h:56
std::vector< std::string > variableDefault
Definition: PIOAdaptor.h:140
bool GetTracers()
Definition: PIOAdaptor.h:52
int initializeGlobal(const char *DumpDescFile)
void SetFloat64(bool val)
Definition: PIOAdaptor.h:57
PIOAdaptor(int rank, int totalRank)
std::list< std::string > fieldsToRead
Definition: PIOAdaptor.h:121
std::string descFileName
Definition: PIOAdaptor.h:124
bool useHTG
Definition: PIOAdaptor.h:133
std::vector< int > indexNodeLeaf
Definition: PIOAdaptor.h:144
void create_amr_UG_1D(vtkMultiBlockDataSet *grid, int startCellIndx, int endCellIndx, int *cell_level, int64_t *cell_daughter, double *cell_center[1])
bool useTracer
Definition: PIOAdaptor.h:134
double * timeSteps
Definition: PIOAdaptor.h:130
Objects for traversal a HyperTreeGrid.
int GetNumberOfVariables()
Definition: PIOAdaptor.h:42
PIO_DATA * pioData
Definition: PIOAdaptor.h:118
void create_amr_UG_3D(vtkMultiBlockDataSet *grid, int startCellIndx, int endCellIndx, int *cell_level, int64_t *cell_daughter, double *cell_center[3])
void create_tracer_UG(vtkMultiBlockDataSet *grid)
void create_geometry(vtkMultiBlockDataSet *grid)
int GetNumberOfDefaultVariables()
Definition: PIOAdaptor.h:44
int TotalRank
Definition: PIOAdaptor.h:115
int numberOfTimeSteps
Definition: PIOAdaptor.h:129
Store on/off settings for data arrays for a vtkSource.
void add_amr_UG_scalar(vtkMultiBlockDataSet *grid, vtkStdString varName, int64_t *daughter, double *data[], int numberOfComponents)
bool hasTracers
Definition: PIOAdaptor.h:136
int count_hypertree(int64_t curIndex, int64_t *daughter)
void create_amr_HTG(vtkMultiBlockDataSet *grid, int numberOfCells, int *cell_level, int64_t *cell_daughter, double *cell_center[3])
void SetTracers(bool val)
Definition: PIOAdaptor.h:53
int initializeDump(int timeStep)
std::vector< std::string > dumpFileName
Definition: PIOAdaptor.h:128
std::string dumpBaseName
Definition: PIOAdaptor.h:126
void SetHyperTreeGrid(bool val)
Definition: PIOAdaptor.h:49
bool useFloat64
Definition: PIOAdaptor.h:135
void build_hypertree(vtkHyperTreeGridNonOrientedCursor *treeCursor, int64_t curIndex, int64_t *daughter)
Composite dataset that organizes datasets into blocks.
int GetNumberOfTimeSteps()
Definition: PIOAdaptor.h:39
std::vector< std::string > variableName
Definition: PIOAdaptor.h:139
double GetTimeStep(int step)
Definition: PIOAdaptor.h:40
void create_amr_UG_2D(vtkMultiBlockDataSet *grid, int startCellIndx, int endCellIndx, int *cell_level, int64_t *cell_daughter, double *cell_center[2])
void add_amr_HTG_scalar(vtkMultiBlockDataSet *grid, vtkStdString varName, double *data[], int numberOfComponents)
void create_amr_UG(vtkMultiBlockDataSet *grid, int numProc, int *global_numcell, int *cell_level, int64_t *cell_daughter, double **cell_center)
bool GetHyperTreeGrid()
Definition: PIOAdaptor.h:48