This utility converts a set of HDF files to a single multi-zone TECPLOT file to visualize within tecplot. More...
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include "TAIL.H"
#include "PrimitiveTypes.H"
#include "roccom.h"
#include "PaneConnectivity.hpp"
#include "MeshPointIdToGlobalIdMap.hpp"
Go to the source code of this file.
Enumerations | |
enum | DataItemType { NODEDATA, CELLDATA } |
The data item type. More... | |
Functions | |
COM_EXTERN_MODULE (Rocin) | |
COM_EXTERN_MODULE (Rocmap) | |
void | showUsage () |
Displays usage information to Standard-out about the different switches and command line arguments that can be used with this program. More... | |
void | parseArguments (int argc, char **argv) |
Parses the command line arguments. More... | |
std::string | getWindow () |
Loads the set of HDF files into a single window. More... | |
void | writePlotFile () |
Generates a single zone plot file from the stitched mesh. More... | |
void | printWindow (const std::string &windowName) |
Prints the window with the given name. More... | |
std::string | convertWindow (const std::string &wname) |
Converts the window from block-structured format to unstructured format. More... | |
void | writeVtkFiles (std::vector< Mesh::UnstructuredMesh > &m) |
Writes the set of meshes into separate VTK files that can be visualized with Paraview. More... | |
void | getPaneConnnectivity (const std::string &wname) |
This method calls Rocmap to query the pane connectivity information for the given window. More... | |
void | maskPoints () |
This method is called from getPaneConnectivity() to mask the flag the mesh points that are shared on each grid. More... | |
void | stitchGrids () |
This method will stitch the grids into a single, global grid. More... | |
void | stitchSolutionData (MeshPointIdToGlobalIdMap *hash) |
This method will stitch the partitioned solution for the single grid. More... | |
int | addToGlobalNodeList (const double x, const double y, const double z, std::vector< double > &nodelist) |
This method adds the vertex with the given x,y,z coordinates to the global node list and returns the assigned global id (index). More... | |
void | updateHash (const int meshPaneId, const int pointId, const int globalId, MeshPointIdToGlobalIdMap *hash) |
This method updates a MeshPointIdToGlobalIdMap hash with the mesh panes and point IDs mapping to the global ID. More... | |
void | writeVtkData () |
Writes the merged grid and its data in VTK UNSTRUCTURED_GRID file format. More... | |
void | printVtk (std::vector< double > &vlist, std::vector< std::vector< int > > &elist) |
This method prints the global grid in VTK file format. More... | |
int | main (int argc, char **argv) |
Program main. More... | |
void | stitchSolutionData (MeshPointIdToGlobalIdMap *hash, MeshPointIdToGlobalIdMap *ehash) |
This method will stitch the partitioned solution for the single grid. More... | |
void | getPaneConnectivity (const std::string &wName) |
Computes the pane connectivity using Rocmap. More... | |
Variables | |
struct { | |
bool readControlFile | |
Data is read from the control file. More... | |
bool withGhost | |
Ghost nodes will be used. More... | |
bool blocks | |
Input data is block-structured grid. More... | |
bool vtk | |
Writes vtk files. More... | |
std::string cntrlfile | |
Control file string. More... | |
std::string fileregx | |
File regular expression. More... | |
std::string outputfile | |
Output file to write the file. More... | |
std::string prgmname | |
The program name. More... | |
int numberOfPanes | |
The number of panes, aka number of sub-domains. More... | |
std::vector< int > paneIds | |
Array of paneIds. More... | |
std::vector < Mesh::UnstructuredMesh > meshes | |
The list of grids to write. More... | |
std::vector< std::vector< bool > > mask | |
Masks the points that are shared (true) share (false) not shared. More... | |
std::vector< SolnMetaData > smdv | |
The solution Metadata. More... | |
std::vector< std::vector < std::vector< double > > > solution | |
The solution data. More... | |
std::vector< PaneConnectivity > pconns | |
Inter-zone (pane) connectivity information. More... | |
std::map< int, int > paneIds2index | |
Maps the pane ids to the index in the corresponding vectors. More... | |
std::vector< std::vector < double > > globalSolution | |
Contains the global solution. More... | |
std::vector< bool > solutionignore | |
Masks the data to be ignored. More... | |
std::vector< double > globalNodeList | |
The global node list. More... | |
std::vector< std::vector< int > > globalElementList | |
The global element list. More... | |
} | Program |
This utility converts a set of HDF files to a single multi-zone TECPLOT file to visualize within tecplot.
Definition in file hdf2pltV2.C.
enum DataItemType |
int addToGlobalNodeList | ( | const double | x, |
const double | y, | ||
const double | z, | ||
std::vector< double > & | nodelist | ||
) |
This method adds the vertex with the given x,y,z coordinates to the global node list and returns the assigned global id (index).
x | the x–coordinate of the vector being added. |
y | the y–coordinate of the vector being added. |
z | the z–coordinate of the vector being added. |
nodelist | the global node list where the new node will be inserted. |
Definition at line 951 of file hdf2pltV2.C.
Referenced by stitchGrids().
COM_EXTERN_MODULE | ( | Rocin | ) |
COM_EXTERN_MODULE | ( | Rocmap | ) |
std::string convertWindow | ( | const std::string & | wName | ) |
Converts the window from block-structured format to unstructured format.
Utilizes Roctail to convert the panes to an unstructured grid format.
This function is called iff -block-structured is supplied to the command line.
wname | the name of the window. |
wName | the window name. |
Definition at line 1422 of file hdf2pltV2.C.
References COM_new_window(), COM_window_init_done(), i, and Program.
Referenced by printWindow().
void getPaneConnectivity | ( | const std::string & | wName | ) |
Computes the pane connectivity using Rocmap.
wname | the window name. |
Definition at line 1302 of file hdf2pltV2.C.
References COM_call_function(), COM_get_array(), COM_get_attribute_handle(), COM_get_function_handle(), COM_get_size(), i, maskPoints(), and Program.
Referenced by printWindow().
void getPaneConnnectivity | ( | const std::string & | wname | ) |
This method calls Rocmap to query the pane connectivity information for the given window.
A PaneConnectivity object is constructed for each mesh and the shared nodes are flaged for each mesh.
wname | the window name. |
std::string getWindow | ( | ) |
Loads the set of HDF files into a single window.
Returns a window consisting of the HDF input files.
Each sub-domain, or block, or zone is stored on a separate pane of the window. Moreover, the data layout is changed to contiguous from the default stacked layout of HDF files.
Definition at line 1540 of file hdf2pltV2.C.
References globarg::cntrlfile, COM_call_function(), COM_clone_attribute(), COM_delete_attribute(), COM_delete_window(), COM_get_function_handle(), COM_get_panes(), COM_new_window(), COM_window_init_done(), globarg::fileregx, i, Program, and globarg::readControlFile.
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Program main.
argc | the argument counter. |
argv | the argument vector. |
Definition at line 412 of file hdf2pltV2.C.
References COM_finalize(), COM_init(), getWindow(), parseArguments(), globarg::printInfo(), printWindow(), and Program.
void maskPoints | ( | ) |
This method is called from getPaneConnectivity() to mask the flag the mesh points that are shared on each grid.
Masks the points that are shared based on the pane connectivity.
Definition at line 1234 of file hdf2pltV2.C.
References PaneConnectivity::getNodesSharedWithRemotePane(), PaneConnectivity::getNumberOfNodesSharedWithRemotePane(), PaneConnectivity::getRemotePaneIds(), i, and Program.
Referenced by getPaneConnectivity().
void parseArguments | ( | int | argc, |
char ** | argv | ||
) |
Parses the command line arguments.
Parses the user-supplied command line arguments.
argc | the argument counter. |
argv | the argument vector. |
argc | the argument counter |
argv | the argument vector |
void printVtk | ( | std::vector< double > & | vlist, |
std::vector< std::vector< int > > & | elist | ||
) |
This method prints the global grid in VTK file format.
vlist | the global vertex list. |
elist | the element list. |
Definition at line 822 of file hdf2pltV2.C.
Referenced by stitchGrids().
void printWindow | ( | const std::string & | wName | ) |
Prints the window with the given name.
This function prints the panes/grids in the window a into a Tecplot file.
windowName | the name of the window. |
wname | The name of the window. |
Definition at line 1483 of file hdf2pltV2.C.
References convertWindow(), getPaneConnectivity(), Program, stitchGrids(), writePlotFile(), writeVtkData(), and writeVtkFiles().
Referenced by main().
void showUsage | ( | ) |
Displays usage information to Standard-out about the different switches and command line arguments that can be used with this program.
Prints usage and examples to STDOUT.
void stitchGrids | ( | ) |
This method will stitch the grids into a single, global grid.
Definition at line 1131 of file hdf2pltV2.C.
References addToGlobalNodeList(), Mesh::UnstructuredMesh::con, Mesh::Connectivity::Esize(), i, MeshPointIdToGlobalIdMap::insert(), Mesh::UnstructuredMesh::nc, Mesh::Connectivity::Nelem(), Mesh::Connectivity::Node(), printVtk(), Program, Mesh::NodalCoordinates::Size(), stitchSolutionData(), updateHash(), Mesh::NodalCoordinates::y(), and Mesh::NodalCoordinates::z().
Referenced by printWindow().
void stitchSolutionData | ( | MeshPointIdToGlobalIdMap * | hash | ) |
This method will stitch the partitioned solution for the single grid.
hash | a hash of the local mesh points to the corresponding global Id. |
Referenced by stitchGrids().
void stitchSolutionData | ( | MeshPointIdToGlobalIdMap * | hash, |
MeshPointIdToGlobalIdMap * | ehash | ||
) |
This method will stitch the partitioned solution for the single grid.
hash | a hash of the local mesh points to the corresponding global Id. |
ehash | a hash of the lobal element ids to the corresponding global element Id. |
Definition at line 971 of file hdf2pltV2.C.
References CELLDATA, MeshPointIdToGlobalIdMap::getGlobalId(), i, NODEDATA, and Program.
void updateHash | ( | const int | meshPaneId, |
const int | pointId, | ||
const int | globalId, | ||
MeshPointIdToGlobalIdMap * | hash | ||
) |
This method updates a MeshPointIdToGlobalIdMap hash with the mesh panes and point IDs mapping to the global ID.
meshPaneId | the pane id of the mesh that the local point id belongs to. |
pointId | the point id of the point assigned a new global ID. |
globalId | the global Id to be assigned to the given point. |
hash | pointer to the has data-structure to be updated. |
Definition at line 894 of file hdf2pltV2.C.
References i, MeshPointIdToGlobalIdMap::insert(), key, and Program.
Referenced by stitchGrids().
void writePlotFile | ( | ) |
Generates a single zone plot file from the stitched mesh.
Generates a single zone plot file from the merged mesh.
Definition at line 459 of file hdf2pltV2.C.
References CELLDATA, i, j, globarg::outputfile, and Program.
Referenced by printWindow().
void writeVtkData | ( | ) |
Writes the merged grid and its data in VTK UNSTRUCTURED_GRID file format.
Definition at line 645 of file hdf2pltV2.C.
References CELLDATA, i, j, NODEDATA, globarg::outputfile, and Program.
Referenced by printWindow().
void writeVtkFiles | ( | std::vector< Mesh::UnstructuredMesh > & | meshes | ) |
Writes the set of meshes into separate VTK files that can be visualized with Paraview.
Writes VTK files for the corresponding meshes.
The format of the files is {outputFile}.paneId.vtk.
m | the set of meshes. |
meshes | List of meshes in the current window. |
Definition at line 1354 of file hdf2pltV2.C.
References i, j, globarg::outputfile, and Program.
Referenced by printWindow().
bool blocks |
Input data is block-structured grid.
Definition at line 51 of file hdf2pltV2.C.
Referenced by __scalegrd.f90__(), COM_print_window(), main(), and readBlock().
std::string cntrlfile |
Control file string.
Definition at line 53 of file hdf2pltV2.C.
std::string fileregx |
File regular expression.
Definition at line 54 of file hdf2pltV2.C.
std::vector< std::vector< int > > globalElementList |
The global element list.
Definition at line 73 of file hdf2pltV2.C.
std::vector< double > globalNodeList |
The global node list.
Definition at line 72 of file hdf2pltV2.C.
std::vector< std::vector< double > > globalSolution |
Contains the global solution.
Definition at line 70 of file hdf2pltV2.C.
std::vector< std::vector< bool > > mask |
Masks the points that are shared (true) share (false) not shared.
Definition at line 62 of file hdf2pltV2.C.
Referenced by CImg< uintT >::_draw_text(), CImgList< uintT >::_font(), CImg< uintT >::_load_bmp(), CImg< uintT >::get_correlate(), CImg< uintT >::get_dilate(), CImg< uintT >::get_erode(), and CImg< uintT >::get_resize_halfXY().
std::vector< Mesh::UnstructuredMesh > meshes |
The list of grids to write.
Definition at line 61 of file hdf2pltV2.C.
int numberOfPanes |
The number of panes, aka number of sub-domains.
Definition at line 59 of file hdf2pltV2.C.
std::string outputfile |
Output file to write the file.
Definition at line 55 of file hdf2pltV2.C.
Referenced by main(), parseCmdParameters(), and searchTopFile().
std::vector< int > paneIds |
Array of paneIds.
Definition at line 60 of file hdf2pltV2.C.
Referenced by COM_print_window(), project_window(), Rocout::write_attr_internal(), and Rocout::write_rocin_control_file().
std::map< int, int > paneIds2index |
Maps the pane ids to the index in the corresponding vectors.
Definition at line 66 of file hdf2pltV2.C.
std::vector< PaneConnectivity > pconns |
Inter-zone (pane) connectivity information.
Definition at line 65 of file hdf2pltV2.C.
std::string prgmname |
The program name.
Definition at line 58 of file hdf2pltV2.C.
struct { ... } Program |
bool readControlFile |
Data is read from the control file.
Definition at line 49 of file hdf2pltV2.C.
std::vector< SolnMetaData > smdv |
The solution Metadata.
Definition at line 63 of file hdf2pltV2.C.
std::vector< std::vector< std::vector< double > > > solution |
The solution data.
Definition at line 64 of file hdf2pltV2.C.
std::vector< bool > solutionignore |
Masks the data to be ignored.
Definition at line 71 of file hdf2pltV2.C.
bool vtk |
Writes vtk files.
Definition at line 52 of file hdf2pltV2.C.
bool withGhost |
Ghost nodes will be used.
Definition at line 50 of file hdf2pltV2.C.