Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions src/databases/ALS/avtALSFileFormat.C
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,18 @@ using std::string;


/// iterate over groups.
herr_t group_info(hid_t loc_id, const char *name, void *opdata)
static herr_t
group_info(hid_t loc_id, const char *name, const H5L_info_t *, void *opdata)
{
avtALSFileFormat* format = (avtALSFileFormat*)opdata;

H5G_stat_t statbuf;

/*
* Get type of the object and display its name and type.
* The name of the object is passed to this function by
* the Library. Some magic :-)
*/
H5Gget_objinfo(loc_id, name, 0, &statbuf);
switch (statbuf.type) {
case H5G_GROUP:
format->SetGroupName(name);
break;
default:
printf(" Unable to identify an object ");
}
H5O_info_t objInfo;
if (H5Oget_info_by_name(loc_id, name, &objInfo, H5P_DEFAULT) < 0)
return -1;

if (objInfo.type == H5O_TYPE_GROUP)
format->SetGroupName(name);

return 0;
}

Expand Down Expand Up @@ -163,12 +156,12 @@ avtALSFileFormat::InitializeTomoHeader(hid_t file) {

m_groupName = fraction_data ? fraction_data_str : four_d_data_str;

hid_t dataset_id = H5Dopen(file, m_groupName.c_str(), H5P_DEFAULT);
hid_t dataset_id = H5Dopen2(file, m_groupName.c_str(), H5P_DEFAULT);

hsize_t dims[4] = {0,0,0,0};
hid_t filespace = H5Dget_space(dataset_id);
hid_t rank = H5Sget_simple_extent_ndims(filespace);
hid_t status_n = H5Sget_simple_extent_dims(filespace, dims, NULL);
int rank = H5Sget_simple_extent_ndims(filespace);
int status_n = H5Sget_simple_extent_dims(filespace, dims, NULL);

std::cout << dims[0] << " " << dims[1] << " " << dims[2] << " " << dims[3] << std::endl;

Expand Down Expand Up @@ -278,8 +271,16 @@ avtALSFileFormat::InitializeHeader() {
file = H5Fopen (m_filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);

/// main group seems to be based on filename..
hid_t rootGroup = H5Gopen2(file, "/", H5P_DEFAULT);
if (rootGroup < 0)
{
status = H5Fclose(file);
return false;
}

H5Giterate(file, "/", NULL, group_info, this);
hsize_t idx = 0;
H5Literate(rootGroup, H5_INDEX_NAME, H5_ITER_INC, &idx, group_info, this);
H5Gclose(rootGroup);

/// if group is not set..
if(m_groupName.length() == 0) {
Expand Down Expand Up @@ -307,10 +308,10 @@ avtALSFileFormat::GetTomoDataSet(hid_t file) {
std::cout << m_groupName << " " << m_width << " " << m_height << " " << m_slices << std::endl;

hsize_t dims_out[4]; /* dataset dimensions */
hid_t dataset_id = H5Dopen(file, m_groupName.c_str(), H5P_DEFAULT);
hid_t dataset_id = H5Dopen2(file, m_groupName.c_str(), H5P_DEFAULT);
hid_t dataspace = H5Dget_space(dataset_id);
hid_t rank = H5Sget_simple_extent_ndims(dataspace);
hid_t status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL);
int rank = H5Sget_simple_extent_ndims(dataspace);
int status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL);

(void) rank;
(void) status_n;
Expand Down Expand Up @@ -415,14 +416,14 @@ avtALSFileFormat::GetStandardDataSet(hid_t file) {
vtkFloatArray* array = vtkFloatArray::New();

/// default STANDARD
hid_t group_id = H5Gopen(file, m_groupName.c_str(), H5P_DEFAULT);
hid_t group_id = H5Gopen2(file, m_groupName.c_str(), H5P_DEFAULT);


if(PAR_Size() == 1) {
array->SetNumberOfTuples(m_width * m_height * m_slices);
for(size_t i = 0; i < m_datasetNames.size(); ++i)
{
hid_t dataset_id = H5Dopen(group_id, m_datasetNames[i].c_str(), H5P_DEFAULT);
hid_t dataset_id = H5Dopen2(group_id, m_datasetNames[i].c_str(), H5P_DEFAULT);

///dim1 should be 1, dim2 and dim3 is the size of the dataset
H5Dread(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,array->GetVoidPointer(i*m_width*m_height));
Expand All @@ -444,7 +445,7 @@ avtALSFileFormat::GetStandardDataSet(hid_t file) {

for(size_t i = m_start, j = 0; i < m_end; ++i, ++j)
{
hid_t dataset_id = H5Dopen(group_id, m_datasetNames[i].c_str(), H5P_DEFAULT);
hid_t dataset_id = H5Dopen2(group_id, m_datasetNames[i].c_str(), H5P_DEFAULT);

///dim1 should be 1, dim2 and dim3 is the size of the dataset
H5Dread(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,array->GetVoidPointer(j*m_width*m_height));
Expand Down
49 changes: 24 additions & 25 deletions src/databases/BATL/avtBATLFileFormat.C
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ avtBATLFileFormat::InitializeHDF5(void)
debug5 << "Initializing HDF5 Library" << endl;
H5open();
errStack = H5Ecreate_stack();
H5Eset_auto(errStack,NULL, NULL);
H5Eset_auto2(errStack, NULL, NULL);
H5Eclose_stack(errStack);

}
Expand Down Expand Up @@ -789,7 +789,7 @@ avtBATLFileFormat::GetMesh(int domain, const char *meshname)
{

debug5 << "GetMesh Marker 3" << endl;
hid_t varId = H5Dopen(fileId, "NodesX", H5P_DEFAULT);
hid_t varId = H5Dopen2(fileId, "NodesX", H5P_DEFAULT);
if (varId < 0)
{
EXCEPTION1(InvalidVariableException, "NodesX");
Expand Down Expand Up @@ -851,7 +851,7 @@ avtBATLFileFormat::GetMesh(int domain, const char *meshname)
double *y_data = NULL;
if (dimension > 1)
{
varId = H5Dopen(fileId, "NodesY", H5P_DEFAULT);
varId = H5Dopen2(fileId, "NodesY", H5P_DEFAULT);
if (varId < 0)
{
EXCEPTION1(InvalidVariableException, "NodesY");
Expand Down Expand Up @@ -893,7 +893,7 @@ avtBATLFileFormat::GetMesh(int domain, const char *meshname)
double *z_data = NULL;
if (dimension == 3)
{
varId = H5Dopen(fileId, "NodesZ", H5P_DEFAULT);
varId = H5Dopen2(fileId, "NodesZ", H5P_DEFAULT);
if (varId < 0)
{
EXCEPTION1(InvalidVariableException, "NodesZ");
Expand Down Expand Up @@ -987,7 +987,7 @@ avtBATLFileFormat::GetMesh(int domain, const char *meshname)


string varname = string(meshname).substr(7);
hid_t varId = H5Dopen(fileId, varname.c_str(),H5P_DEFAULT);
hid_t varId = H5Dopen2(fileId, varname.c_str(),H5P_DEFAULT);

H5Dread(varId, H5T_NATIVE_FLOAT, H5S_ALL,H5S_ALL,H5P_DEFAULT, vals);
H5Dclose(varId);
Expand Down Expand Up @@ -1385,7 +1385,7 @@ avtBATLFileFormat::GetVar(int visitDomain, const char *vname)
// It's a grid variable
//

hid_t varId = H5Dopen(fileId, vn_substr.c_str(), H5P_DEFAULT);
hid_t varId = H5Dopen2(fileId, vn_substr.c_str(), H5P_DEFAULT);
if (varId < 0)
{
EXCEPTION1(InvalidVariableException, vn_substr.c_str());
Expand Down Expand Up @@ -1685,7 +1685,7 @@ void avtBATLFileFormat::ReadProcessorNumbers()
//
// Read the bounding box description for the blocks
//
hid_t procnumId = H5Dopen(fileId, "Processor Number", H5P_DEFAULT);
hid_t procnumId = H5Dopen2(fileId, "Processor Number", H5P_DEFAULT);
if (procnumId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -1750,7 +1750,7 @@ void avtBATLFileFormat::ReadMortonOrdering()
//
// Read the bounding box description for the blocks
//
hid_t mortonidxId = H5Dopen(fileId, "iMortonNode_A", H5P_DEFAULT);
hid_t mortonidxId = H5Dopen2(fileId, "iMortonNode_A", H5P_DEFAULT);
if (mortonidxId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -1814,7 +1814,7 @@ void avtBATLFileFormat::ReadCoordinates()
//
// Read the coordinates description for the blocks
//
hid_t coordinatesId = H5Dopen(fileId, "coordinates",H5P_DEFAULT);
hid_t coordinatesId = H5Dopen2(fileId, "coordinates",H5P_DEFAULT);
if (coordinatesId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -1891,7 +1891,7 @@ void avtBATLFileFormat::ReadBlockExtents()
//
// Read the bounding box description for the blocks
//
hid_t bboxId = H5Dopen(fileId, "bounding box",H5P_DEFAULT);
hid_t bboxId = H5Dopen2(fileId, "bounding box",H5P_DEFAULT);
if (bboxId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -1954,12 +1954,12 @@ void avtBATLFileFormat::ReadBlockExtents()
// ****************************************************************************
void avtBATLFileFormat::ReadRefinementLevels()
{
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
debug5 << "ReadRefinementLevels Marker 1" << endl;
//
// Read the bounding box description for the blocks
//
hid_t refinementId = H5Dopen(fileId, "refine level",H5P_DEFAULT);
hid_t refinementId = H5Dopen2(fileId, "refine level",H5P_DEFAULT);
if (refinementId < 0)
{
for (int b=0; b<numBlocks; b++)
Expand Down Expand Up @@ -2009,7 +2009,7 @@ void avtBATLFileFormat::ReadRefinementLevels()
delete[] refinement_array;
debug5 << "ReadRefinementLevels Marker 9" << endl;
}
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
}

// ****************************************************************************
Expand All @@ -2034,7 +2034,7 @@ void avtBATLFileFormat::ReadSimulationParameters(hid_t fileId)
//
// Read the bounding box description for the blocks
//
hid_t integerParamsId = H5Dopen(fileId, "Integer Plot Metadata",H5P_DEFAULT);
hid_t integerParamsId = H5Dopen2(fileId, "Integer Plot Metadata",H5P_DEFAULT);
if (integerParamsId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -2196,7 +2196,7 @@ void avtBATLFileFormat::ReadSimulationParameters(hid_t fileId)

debug5 << "ReadSimulationParameters Marker 10" << endl;

hid_t realParamsId = H5Dopen(fileId, "Real Plot Metadata",H5P_DEFAULT);
hid_t realParamsId = H5Dopen2(fileId, "Real Plot Metadata",H5P_DEFAULT);
if (realParamsId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -2298,7 +2298,7 @@ avtBATLFileFormat::ReadUnknownUnits()
//
// Read the variable ("untnown") names
//
hid_t unitsId = H5Dopen(fileId, "plotVarUnits",H5P_DEFAULT);
hid_t unitsId = H5Dopen2(fileId, "plotVarUnits",H5P_DEFAULT);
if (unitsId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -2376,7 +2376,7 @@ avtBATLFileFormat::ReadUnknownNames()
//
// Read the variable ("unknown") names
//
hid_t unknownsId = H5Dopen(fileId, "plotVarNames",H5P_DEFAULT);
hid_t unknownsId = H5Dopen2(fileId, "plotVarNames",H5P_DEFAULT);
if (unknownsId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -2422,14 +2422,14 @@ avtBATLFileFormat::ReadUnknownNames()
{
string varNamesStr = varNames[v];

hid_t dataSet = H5Dopen(fileId, varNamesStr.c_str(), H5P_DEFAULT);
hid_t dataSet = H5Dopen2(fileId, varNamesStr.c_str(), H5P_DEFAULT);
hid_t attribute = H5Aopen_name(dataSet, "minimum");
H5Aread(attribute, H5T_NATIVE_DOUBLE, &minVals[v]);
H5Dclose(dataSet);
H5Aclose(attribute);


dataSet = H5Dopen(fileId, varNamesStr.c_str(), H5P_DEFAULT);
dataSet = H5Dopen2(fileId, varNamesStr.c_str(), H5P_DEFAULT);
attribute = H5Aopen_name(dataSet, "maximum");
H5Aread(attribute, H5T_NATIVE_DOUBLE, &maxVals[v]);
H5Dclose(dataSet);
Expand Down Expand Up @@ -2474,7 +2474,7 @@ avtBATLFileFormat::ReadAxisLabels()
//
// Read the variable ("lblnown") names
//
hid_t lblnownsId = H5Dopen(fileId, "Axis Labels",H5P_DEFAULT);
hid_t lblnownsId = H5Dopen2(fileId, "Axis Labels",H5P_DEFAULT);
if (lblnownsId < 0)
{
// EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -2554,7 +2554,7 @@ void avtBATLFileFormat::DetermineGlobalLogicalExtentsForAllBlocks()
//
// Read the minLogicalExtents description for the blocks
//
hid_t minLogicalExtentsId = H5Dopen(fileId, "MinLogicalExtents",H5P_DEFAULT);
hid_t minLogicalExtentsId = H5Dopen2(fileId, "MinLogicalExtents",H5P_DEFAULT);
if (minLogicalExtentsId < 0)
{
EXCEPTION1(InvalidFilesException, filename.c_str());
Expand Down Expand Up @@ -2851,7 +2851,7 @@ avtBATLFileFormat::GetAuxiliaryData(const char *var, int dom,
const char * type, void *,
DestructorFunction &df)
{
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
debug5 << "GetAuxiliaryData Marker 1" << endl;
debug5 << type << endl;
void *retval = 0;
Expand Down Expand Up @@ -2886,7 +2886,7 @@ avtBATLFileFormat::GetAuxiliaryData(const char *var, int dom,
string varstr = var;
varstr.append("_Ext");

hid_t extrId = H5Dopen(fileId, varstr.c_str(),H5P_DEFAULT);
hid_t extrId = H5Dopen2(fileId, varstr.c_str(),H5P_DEFAULT);
if (extrId < 0)
{
return 0;
Expand Down Expand Up @@ -2940,7 +2940,6 @@ avtBATLFileFormat::GetAuxiliaryData(const char *var, int dom,
retval = (void *)itree;
df = avtIntervalTree::Destruct;
}
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
return retval;
}

3 changes: 1 addition & 2 deletions src/databases/Blueprint/avtBlueprintTreeCache.C
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ avtBlueprintTreeCache::IO::ReadHDF5Slab(hid_t h5_file_id,
void *data_ptr)
{
// open the dataset
hid_t h5_dset_id = H5Dopen( h5_file_id, fetch_path.c_str(),H5P_DEFAULT);
hid_t h5_dset_id = H5Dopen2(h5_file_id, fetch_path.c_str(), H5P_DEFAULT);

CHECK_HDF5_ERROR(h5_dset_id,
"Error opening HDF5 dataset at: " << fetch_path);
Expand Down Expand Up @@ -1391,4 +1391,3 @@ avtBlueprintTreeCache::Read(const std::string &file_path,
return res;
}


Loading
Loading