Implementation of Rocing for creation of Roccom window(s) from HDF files. More...
#include <algorithm>
#include <set>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <strings.h>
#include <errno.h>
#include <vector>
#include <list>
#include <glob.h>
#include <fnmatch.h>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include "Directory.H"
#include "Rocin.h"
Go to the source code of this file.
Classes | |
class | AutoCloser< T1, T2 > |
Automatically close open files, datasets, etc. More... | |
Macros | |
#define | DEBUG_MSG(x) |
#define | HDF4_CHECK_RET(routine, args, retval) |
Perform HDF4 error-checking. More... | |
#define | HDF4_CHECK(routine, args) HDF4_CHECK_RET(routine, args, ) |
Functions | |
static int | glob_error (const char *epath, int gerrno) |
Error callback for glob. More... | |
template<class T > | |
T | cast_err_func (int(*glob)(const char *, int, T, glob_t *), int(*errfunc)(const char *, int)) |
Cast glob_error for portability (IBMSP has a different prototype) More... | |
static int32 | FindFirstGeometryDataset (int32 sd_id, const std::string &geomFile, const std::string &matName, const std::string &label, int32 hIndex, int32 *index) |
Find the first geometry dataset for the given block. More... | |
static void | scan_files_HDF4 (int pathc, char *pathv[], BlockMM_HDF4 &blocks, std::string &time, std::map< int32, COM_Type > &HDF2COM) |
Extract metadata from the list of files. More... | |
static void | load_data_HDF4 (BlockMM_HDF4::iterator p, const BlockMM_HDF4::iterator &end, const std::string &window, const MPI_Comm *comm, int rank, int nprocs) |
static void | new_attributes (BlockMM_HDF4::iterator hdf4, const BlockMM_HDF4::iterator &hdf4End, const std::string &window, const MPI_Comm *comm, int rank, int nprocs) |
static void | broadcast_win_attributes (bool isEmpty, const std::string &window, const MPI_Comm *comm, int rank, int nprocs) |
template<class BLOCK > | |
void | free_blocks (BLOCK &blocks) |
std::string | CWD () |
void | Rocin_load_module (const char *name) |
Load the module Rocin into Roccom using the given module name. More... | |
void | Rocin_unload_module (const char *name) |
Unload the module Rocin from Roccom. More... | |
void | COM_F_FUNC2 (rocin_load_module, ROCIN_LOAD_MODULE) const |
void | COM_F_FUNC2 (rocin_unload_module, ROCIN_UNLOAD_MODULE) const |
Implementation of Rocing for creation of Roccom window(s) from HDF files.
Definition in file Rocin.C.
#define DEBUG_MSG | ( | x | ) |
Definition at line 77 of file Rocin.C.
Referenced by Rocin::init(), load_data_HDF4(), new_attributes(), Rocin::read_windows(), Rocin::register_panes(), and scan_files_HDF4().
#define HDF4_CHECK | ( | routine, | |
args | |||
) | HDF4_CHECK_RET(routine, args, ) |
Definition at line 170 of file Rocin.C.
Referenced by FindFirstGeometryDataset(), load_data_HDF4(), and scan_files_HDF4().
#define HDF4_CHECK_RET | ( | routine, | |
args, | |||
retval | |||
) |
Perform HDF4 error-checking.
Check the return value of the HDF4 function and print an error message if it is FAIL
routine | The HDF4 function to call. (Input) |
args | The argument list, in parentheses. (Input) |
val | The return value. (Input) |
Definition at line 144 of file Rocin.C.
Referenced by FindFirstGeometryDataset(), load_data_HDF4(), and scan_files_HDF4().
|
static |
Definition at line 2153 of file Rocin.C.
References COM_free_buffer(), COM_get_array(), COM_get_attribute(), COM_get_attributes(), COM_get_sizeof(), empty(), and i.
Referenced by Rocin::read_windows().
|
inline |
Cast glob_error for portability (IBMSP has a different prototype)
Definition at line 130 of file Rocin.C.
Referenced by Rocin::read_windows().
void COM_F_FUNC2 | ( | rocin_load_module | , |
ROCIN_LOAD_MODULE | |||
) | const |
Definition at line 3072 of file Rocin.C.
References Mesquite::length(), and Rocin_load_module().
void COM_F_FUNC2 | ( | rocin_unload_module | , |
ROCIN_UNLOAD_MODULE | |||
) | const |
Definition at line 3074 of file Rocin.C.
References Mesquite::length(), and Rocin_unload_module().
std::string CWD | ( | ) |
Definition at line 2762 of file Rocin.C.
Referenced by Rocin::read_windows().
|
static |
Find the first geometry dataset for the given block.
The dataset may be right after the block header or in an external file. The caller is responsible for closing the sd_id.
Definition at line 285 of file Rocin.C.
References HDF4_CHECK, HDF4_CHECK_RET, MAX_NC_NAME, MAX_NC_VARS, rank, HDF4::SDend(), HDF4::SDendaccess(), HDF4::SDfileinfo(), HDF4::SDgetdatastrs(), HDF4::SDstart(), HDF4::Select(), and cimg_library::cimg::strcasecmp().
Referenced by scan_files_HDF4().
void free_blocks | ( | BLOCK & | blocks | ) |
Definition at line 2342 of file Rocin.C.
Referenced by Rocin::read_windows().
|
static |
Error callback for glob.
Definition at line 119 of file Rocin.C.
References COMMPI_Initialized().
Referenced by Rocin::read_windows().
|
static |
Definition at line 882 of file Rocin.C.
References COM_DOUBLE, COM_get_array(), COM_get_status(), COM_INT, COM_resize_array(), DEBUG_MSG, HDF4_CHECK, HDF4_CHECK_RET, i, Block_HDF4::m_file, Block_HDF4::m_geomFile, Block_HDF4::m_gridInfo, Block_HDF4::m_indices, Block_HDF4::m_numNodes, Block_HDF4::m_paneId, Block_HDF4::m_variables, max(), q, s, HDF4::SDend(), HDF4::SDendaccess(), HDF4::SDreaddata(), HDF4::SDselect(), HDF4::SDstart(), sin, and Block_HDF4::time_level.
Referenced by Rocin::read_windows().
|
static |
Definition at line 2032 of file Rocin.C.
References COM_new_attribute(), COM_resize_array(), COM_set_size(), DEBUG_MSG, i, q, and sin.
Referenced by Rocin::read_windows().
void Rocin_load_module | ( | const char * | name | ) |
Load the module Rocin into Roccom using the given module name.
This module provides three subroutines: "read_windows", "read_by_control_file", and "obtain_attribute".
Definition at line 3063 of file Rocin.C.
References Rocin::init().
Referenced by COM_F_FUNC2(), main(), read_pane_sp(), and RFC_Window_base::read_sdv().
void Rocin_unload_module | ( | const char * | name | ) |
Unload the module Rocin from Roccom.
Definition at line 3066 of file Rocin.C.
References Rocin::finalize().
Referenced by COM_F_FUNC2(), read_pane_sp(), and RFC_Window_base::read_sdv().
|
static |
Extract metadata from the list of files.
Open each file, scan the datasets, identify the windows, panes, and attributes.
istringstream is apparently fragile, so we'll use atoi instead. std::istringstream sin2(ghost); sin2 >> gc;
Check if there are more data. if (!sin2.eof()) { if (sin2.get() == ',') { ghostPoints = gc; sin2 >> gc; } } if (gc < 0) std::cerr << "Rocstar: Error: Bad num ghosts " << gc << " from string: " << ghost << std::endl; ghostCells.push_back(gc); Check if there are more data. while (!sin2.eof()) { if (sin2.get() == ',') { sin2 >> gc; if (gc < 0) std::cerr << "Rocstar: Error: Bad ghosts " << gc << std::endl; ghostCells.push_back(gc); } }
Definition at line 340 of file Rocin.C.
References COM_assertion_msg, DEBUG_MSG, FindFirstGeometryDataset(), HDF4_CHECK, HDF4_CHECK_RET, i, Block_HDF4::m_gridInfo, VarInfo_HDF4::m_indices, VarInfo_HDF4::m_is_null, VarInfo_HDF4::m_name, Block_HDF4::m_numGhostNodes, Block_HDF4::m_numNodes, Block_HDF4::m_variables, MAX_NC_NAME, offset(), rank, HDF4::SDend(), HDF4::SDendaccess(), HDF4::SDfileinfo(), HDF4::SDgetdatastrs(), HDF4::SDreaddata(), HDF4::SDstart(), HDF4::Select(), sin, cimg_library::cimg::strcasecmp(), and cimg_library::cimg::strncasecmp().
Referenced by Rocin::read_windows().