Class for reading data from HDF5 files. More...
Definition at line 60 of file hdf5Reader.H.
Public Member Functions | |
hdf5Reader (std::string fname, std::string _outputFname, int _verb=0) | |
Construct HDF5 reader object. More... | |
virtual | ~hdf5Reader () |
int | openFile () |
Open HDF5 file. More... | |
int | closeFile () |
Close HDF5 file. More... | |
int | readTopDataSet (std::string dsetName, std::string &buffer) |
Read string data from top level HDF5 DataSet. More... | |
int | readDataSet (DataSet dset, std::string &buffer) |
Read string data from generic HDF5 DataSet. More... | |
template<class T > | |
int | readTopDataSet (std::string dsetName, std::vector< T > &buffer) |
Read numeric data from top level HDF5 DataSet. More... | |
template<class T > | |
int | readDataSet (DataSet dset, std::vector< T > &buffer) |
Read numeric data from generic HDF5 DataSet. More... | |
int | readGroup (std::string groupName, Group &group) |
Read existing HDF5 Group. More... | |
template<class T > | |
int | readGroupDataSet (std::string dsetName, Group &group, std::vector< T > &buffer) |
Read numeric data from HDF5 group. More... | |
std::string | getFileName () |
Get HDF5 filename. More... | |
template<class T > | |
void | flattenBuffer2d (std::vector< std::vector< T >> originalBuffer, std::vector< T > &flatBuffer) |
Flatten 2d data buffer. More... | |
template<class T > | |
void | unflattenBuffer2d (std::vector< T > flatBuffer, std::vector< std::vector< T >> &originalBuffer) |
Unflatten 2d data buffer. More... | |
void | exportToVTKMesh () |
Export to VTK format. More... | |
vtkSmartPointer< vtkDataSet > | getVTKMesh () |
Get VTK mesh object. More... | |
void | exportToMeshBase () |
Export HDF5 mesh to meshBase object. More... | |
meshBase * | getMeshBase () |
Get meshBase object. More... | |
void | writeVTK () |
Write mesh to VTK file. More... | |
void | setFields (meshBase *myMeshBase, std::vector< std::string > dataNames, std::vector< std::vector< double >> data, int pointOrCell) |
Set meshBase field data. More... | |
void | setNumberOfVertices (int numVertices) |
Set number of vertices in meshBase. More... | |
void | setNumberOfElements (int numElements) |
Set number of elements in meshBase. More... | |
void | setNumberOfDimensions (int numDimensions) |
Set number of spatial dimensions in meshBase. More... | |
void | setCoordinates (std::vector< double > xCrd) |
Set meshBase 1d coordinate data. More... | |
void | setCoordinates (std::vector< double > xCrd, std::vector< double > yCrd) |
Set meshBase 2d coordinate data. More... | |
void | setCoordinates (std::vector< double > xCrd, std::vector< double > yCrd, std::vector< double > zCrd) |
Set meshBase 3d coordinate data. More... | |
void | setConnectivities (std::vector< std::map< int, std::vector< int >>> elementConnectivity) |
Set meshBase element connectivity table. More... | |
void | setElementTypes (std::vector< int > vtkElementTypes) |
Set VTK element types for each element. More... | |
void | setElementTypesList (std::vector< int > vtkElementTypesList) |
Set list of each unique type of VTK element in mesh. More... | |
std::vector< int > | getElementConnectivity (int elementId) |
Get element connectivity for global element ID. More... | |
Protected Attributes | |
std::string | h5FileName |
HDF5 filename. More... | |
std::string | baseH5FileName |
base of HDF5 filename More... | |
std::string | outputFname |
VTK output filename. More... | |
int | verb |
verbosity flag More... | |
H5File | file |
HDF5 file object. More... | |
vtkSmartPointer< vtkDataSet > | vtkMesh |
VTK DataSet object. More... | |
meshBase * | myMeshBase |
meshBase object More... | |
std::vector< double > | xCrd |
std::vector< double > | yCrd |
std::vector< double > | zCrd |
vector of coordinates More... | |
std::vector< std::map< int, std::vector< int > > > | elementConnectivity |
element connectivity table More... | |
int | numVertices |
number of vertices in mesh More... | |
int | numElements |
number of elements in mesh More... | |
int | numDimensions |
number of spatial dimensions More... | |
std::vector< int > | vtkElementTypes |
vector of VTK element type for each element More... | |
std::vector< int > | vtkElementTypesList |
vector storing list of each unique VTK element type More... | |
Inherited by proteusHdf5.
|
inline |
fname | HDF5 filename |
_outputFName | Filename for VTK output file |
_verb | Boolean verbosity flag |
Definition at line 67 of file hdf5Reader.H.
|
inlinevirtual |
Definition at line 79 of file hdf5Reader.H.
int hdf5Reader::closeFile | ( | ) |
Definition at line 63 of file hdf5Reader.C.
References file, and h5FileName.
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::exportToMeshBase | ( | ) |
Definition at line 313 of file hdf5Reader.C.
References meshBase::Create(), exportToVTKMesh(), myMeshBase, and outputFname.
Referenced by proteusHdf5::proteusHdf5(), and writeVTK().
void hdf5Reader::exportToVTKMesh | ( | ) |
Definition at line 241 of file hdf5Reader.C.
References getElementConnectivity(), NEM::MSH::New(), numDimensions, numElements, numVertices, points, vtkElementTypes, xCrd, yCrd, and zCrd.
Referenced by exportToMeshBase(), getVTKMesh(), and proteusHdf5::proteusHdf5().
|
inline |
originalBuffer | Original unflattened data |
flatBuffer | Output flattened data |
Definition at line 241 of file hdf5Reader.H.
std::vector< int > hdf5Reader::getElementConnectivity | ( | int | elementId | ) |
elementId | Element ID |
Definition at line 195 of file hdf5Reader.C.
References elementConnectivity, vtkElementTypes, and vtkElementTypesList.
Referenced by exportToVTKMesh().
std::string hdf5Reader::getFileName | ( | ) |
meshBase * hdf5Reader::getMeshBase | ( | ) |
Definition at line 321 of file hdf5Reader.C.
References myMeshBase.
Referenced by proteusHdf5::proteusHdf5().
vtkSmartPointer< vtkDataSet > hdf5Reader::getVTKMesh | ( | ) |
Definition at line 304 of file hdf5Reader.C.
References exportToVTKMesh(), and vtkMesh.
int hdf5Reader::openFile | ( | ) |
Definition at line 41 of file hdf5Reader.C.
References file, and h5FileName.
Referenced by proteusHdf5::proteusHdf5().
int hdf5Reader::readDataSet | ( | DataSet | dset, |
std::string & | buffer | ||
) |
dset | HDF5 dataset |
buffer | Buffer into which data is read |
Definition at line 109 of file hdf5Reader.C.
Referenced by readTopDataSet().
|
inline |
dset | HDF5 dataset |
buffer | Buffer into which numeric data is read |
Definition at line 148 of file hdf5Reader.H.
int hdf5Reader::readGroup | ( | std::string | groupName, |
Group & | group | ||
) |
groupName | HDF5 group object name |
group | HDF5 group object |
Definition at line 135 of file hdf5Reader.C.
References file.
Referenced by proteusHdf5::getBlocks().
|
inline |
dsetName | DataSet name |
group | HDF5 group object |
buffer | Buffer into which numeric data is read |
Definition at line 190 of file hdf5Reader.H.
Referenced by proteusHdf5::getBlockElementData(), proteusHdf5::getBlockGlobalID(), proteusHdf5::getBlockInfo(), proteusHdf5::getBlockVertexData(), and proteusHdf5::getBlockXYZ().
int hdf5Reader::readTopDataSet | ( | std::string | dsetName, |
std::string & | buffer | ||
) |
dsetName | Dataset name |
buffer | Buffer into which string data is read |
Definition at line 85 of file hdf5Reader.C.
References file, and readDataSet().
Referenced by proteusHdf5::getControlInformation(), and proteusHdf5::getVectorNames().
|
inline |
dsetName | Dataset name |
buffer | Buffer into which numeric data is read |
Definition at line 115 of file hdf5Reader.H.
void hdf5Reader::setConnectivities | ( | std::vector< std::map< int, std::vector< int >>> | elementConnectivity | ) |
elementConnectivity | Element connectivity table |
Definition at line 190 of file hdf5Reader.C.
References elementConnectivity.
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::setCoordinates | ( | std::vector< double > | xCrd | ) |
xCrd | vector of x-coordinates |
Definition at line 166 of file hdf5Reader.C.
References xCrd.
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::setCoordinates | ( | std::vector< double > | xCrd, |
std::vector< double > | yCrd | ||
) |
xCrd | vector of x-coordinates |
yCrd | vector of y-coordinates |
Definition at line 168 of file hdf5Reader.C.
void hdf5Reader::setCoordinates | ( | std::vector< double > | xCrd, |
std::vector< double > | yCrd, | ||
std::vector< double > | zCrd | ||
) |
xCrd | vector of x-coordinates |
yCrd | vector of y-coordinates |
zCrd | vector of z-coordinates |
Definition at line 174 of file hdf5Reader.C.
void hdf5Reader::setElementTypes | ( | std::vector< int > | vtkElementTypes | ) |
vtkElementTypes | Vector of VTK element types for each element |
Definition at line 182 of file hdf5Reader.C.
References vtkElementTypes.
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::setElementTypesList | ( | std::vector< int > | vtkElementTypesList | ) |
vtkElementTypesList | Vector of each unique VTK element type in mesh |
Definition at line 186 of file hdf5Reader.C.
References vtkElementTypesList.
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::setFields | ( | meshBase * | myMeshBase, |
std::vector< std::string > | dataNames, | ||
std::vector< std::vector< double >> | data, | ||
int | pointOrCell | ||
) |
myMeshBase | meshBase object |
dataNames | Vector of names of data fields |
data | Vector storing data |
pointOrCell | Boolean indicating point or cell data |
Definition at line 323 of file hdf5Reader.C.
References data, meshBase::setCellDataArray(), and meshBase::setPointDataArray().
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::setNumberOfDimensions | ( | int | numDimensions | ) |
numDimensions | Number of spatial dimensions |
Definition at line 162 of file hdf5Reader.C.
References numDimensions.
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::setNumberOfElements | ( | int | numElements | ) |
numElements | Number of elements |
Definition at line 158 of file hdf5Reader.C.
References numElements.
Referenced by proteusHdf5::proteusHdf5().
void hdf5Reader::setNumberOfVertices | ( | int | numVertices | ) |
numVertices | Number of vertices |
Definition at line 154 of file hdf5Reader.C.
References numVertices.
Referenced by proteusHdf5::proteusHdf5().
|
inline |
flatBuffer | Original flattened data |
originalBuffer | Output unflattened data |
Definition at line 258 of file hdf5Reader.H.
References data.
Referenced by proteusHdf5::getBlockElementData(), and proteusHdf5::getBlockVertexData().
void hdf5Reader::writeVTK | ( | ) |
Definition at line 354 of file hdf5Reader.C.
References exportToMeshBase(), myMeshBase, and meshBase::write().
|
protected |
Definition at line 373 of file hdf5Reader.H.
|
protected |
Definition at line 383 of file hdf5Reader.H.
Referenced by getElementConnectivity(), proteusHdf5::mergeBlocks(), and setConnectivities().
|
protected |
Definition at line 376 of file hdf5Reader.H.
Referenced by closeFile(), openFile(), readGroup(), and readTopDataSet().
|
protected |
Definition at line 372 of file hdf5Reader.H.
Referenced by closeFile(), getFileName(), and openFile().
|
protected |
Definition at line 378 of file hdf5Reader.H.
Referenced by exportToMeshBase(), getMeshBase(), proteusHdf5::proteusHdf5(), and writeVTK().
|
protected |
Definition at line 386 of file hdf5Reader.H.
Referenced by exportToVTKMesh(), and setNumberOfDimensions().
|
protected |
Definition at line 385 of file hdf5Reader.H.
Referenced by exportToVTKMesh(), and setNumberOfElements().
|
protected |
Definition at line 384 of file hdf5Reader.H.
Referenced by exportToVTKMesh(), and setNumberOfVertices().
|
protected |
Definition at line 374 of file hdf5Reader.H.
Referenced by exportToMeshBase().
|
protected |
Definition at line 375 of file hdf5Reader.H.
|
protected |
Definition at line 388 of file hdf5Reader.H.
Referenced by exportToVTKMesh(), getElementConnectivity(), and setElementTypes().
|
protected |
Definition at line 389 of file hdf5Reader.H.
Referenced by getElementConnectivity(), and setElementTypesList().
|
protected |
Definition at line 377 of file hdf5Reader.H.
Referenced by getVTKMesh().
|
protected |
Definition at line 381 of file hdf5Reader.H.
Referenced by exportToVTKMesh(), and setCoordinates().
|
protected |
Definition at line 381 of file hdf5Reader.H.
Referenced by exportToVTKMesh(), and setCoordinates().
|
protected |
Definition at line 381 of file hdf5Reader.H.
Referenced by exportToVTKMesh(), and setCoordinates().