Commit 12a31827 authored by allens's avatar allens

added a second test case for determining the file/readerownership also added...

added a second test case for determining the file/readerownership also added .h5 for nimrod file type

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12875 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3dad6cb9
......@@ -161,43 +161,17 @@ avtGTCFileFormat::Initialize()
if ((fileHandle = H5Fopen(GetFilename(), H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
EXCEPTION1( InvalidFilesException, GetFilename() );
particleHandle = H5Dopen(fileHandle, "particle_data");
if (particleHandle < 0)
if ((particleHandle = H5Dopen(fileHandle, "particle_data")) < 0)
{
H5Fclose(fileHandle);
EXCEPTION1( InvalidFilesException, GetFilename() );
}
H5Dclose(particleHandle);
H5Fclose(fileHandle);
fileHandle = -1;
particleHandle = -1;
// Open as normal
debug4 << mName << "Opening " << GetFilename() << endl;
fileHandle = H5Fopen(GetFilename(), H5F_ACC_RDONLY, H5P_DEFAULT);
if (fileHandle < 0)
{
debug4 << mName << "Could not open " << GetFilename() << endl;
EXCEPTION2( NonCompliantException, "GTC File Open",
"File '" + string(GetFilename()) + "' can not be opened" );
}
particleHandle = H5Dopen(fileHandle, "particle_data");
if (particleHandle < 0)
{
debug4 << mName << "Could not open particle_data" << endl;
H5Fclose(fileHandle);
EXCEPTION2( NonCompliantException, "GTC Dataset Open",
"Dataset 'particle_data' can not be opened" );
}
// At this point consider the file to truly be a GTC file. If
// some other file NonCompliantExceptions will be thrown.
// Continue as normal reporting NonCompliantExceptions
//Check variable's size.
hid_t dataspace = H5Dget_space(particleHandle);
......
<?xml version="1.0"?>
<Plugin name="H5Nimrod" type="database" label="H5Nimrod" version="1.0" enabled="true" mdspecificcode="false" engspecificcode="false" onlyengine="false" noengine="false" dbtype="MTSD" haswriter="false" hasoptions="false">
<Plugin name="H5Nimrod" type="database" label="H5Nimrod" version="1.0" enabled="true" mdspecificcode="false" engspecificcode="false" onlyengine="false" noengine="false" dbtype="MTSD" haswriter="false" hasoptions="false" filePatternsStrict="false" opensWholeDirectory="false">
<CXXFLAGS>
${HDF5_INCLUDE_DIR}
</CXXFLAGS>
......@@ -7,11 +7,12 @@
${HDF5_LIBRARY_DIR}
</LDFLAGS>
<LIBS>
${HDF5_LIB}
${HDF5_LIB}
${ZLIB_LIB}
</LIBS>
<FilePatterns>
*.h5nimrod
*.h5
</FilePatterns>
<Files components="M">
avtH5NimrodFileFormat.C
......
......@@ -166,6 +166,7 @@ std::vector<std::string>
H5NimrodGeneralPluginInfo::GetDefaultFilePatterns() const
{
std::vector<std::string> defaultPatterns;
defaultPatterns.push_back("*.h5");
defaultPatterns.push_back("*.h5nimrod");
return defaultPatterns;
......
......@@ -128,7 +128,7 @@ avtH5NimrodFileFormat::avtH5NimrodFileFormat (const char *filename):
{
// INITIALIZE DATA MEMBERS
fname = filename;
hid_t file_id, root_id, group_id;
hid_t file_id, root_id, group_id, dataset_id;
char *string_attrib;
float time;
......@@ -139,29 +139,36 @@ avtH5NimrodFileFormat::avtH5NimrodFileFormat (const char *filename):
if ((file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
EXCEPTION1( InvalidFilesException, filename );
// Open a couple temporary groups/datasets to verify the file is
// really a H5Nimrod file.
group_id = H5Gopen(file_id, "/GRID");
if (group_id < 0)
{
H5Fclose(file_id);
EXCEPTION1( InvalidFilesException, filename );
}
else
{
H5Gclose(group_id);
group_id = -1;
}
H5Gclose(group_id);
H5Fclose(file_id);
file_id = -1;
group_id = -1;
// Open as normal
file_id = H5Fopen (filename, H5F_ACC_RDONLY, H5P_DEFAULT);
if (file_id < 0)
dataset_id = H5Dopen(file_id, "/GRID/phi");
if (dataset_id < 0)
{
EXCEPTION2( NonCompliantException, "H5NIMROD File Open",
"File '" + string(filename) + "' can not be opened" );
H5Fclose(file_id);
EXCEPTION1( InvalidFilesException, filename );
}
else
{
H5Dclose(dataset_id);
dataset_id = -1;
}
// At this point consider the file to truly be a H5Nimrod file. If
// some other file NonCompliantExceptions will be thrown.
// Continue as normal reporting NonCompliantExceptions
hsize_t i, npoints;
// Read attributes
......
......@@ -61,6 +61,7 @@
#include <InvalidFilesException.h>
#include <DebugStream.h>
#include <InvalidVariableException.h>
using namespace std;
......@@ -1467,35 +1468,39 @@ avtM3DC1FileFormat::LoadFile()
if( H5Fis_hdf5( m_filename.c_str() ) < 0 )
EXCEPTION1( InvalidFilesException, m_filename.c_str() );
if ( (m_fileID = H5Fopen( m_filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
if ( (m_fileID =
H5Fopen( m_filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
EXCEPTION1( InvalidFilesException, m_filename.c_str() );
// Open a couple temporary groups to verify the file is really an
// M3DC1 file.
hid_t tempID = H5Gopen( m_fileID, "/equilibrium/mesh", H5P_DEFAULT);
if( tempID < 0 )
{
H5Fclose(m_fileID);
EXCEPTION1( InvalidFilesException, m_filename.c_str() );
}
else
H5Gclose(tempID);
H5Gclose(tempID);
H5Fclose(m_fileID);
m_fileID = -1;
// Open as normal
m_fileID = H5Fopen( m_filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
if ( m_fileID < 0 )
tempID = H5Gopen( m_fileID, "/equilibrium/fields", H5P_DEFAULT);
if( tempID < 0 )
{
EXCEPTION2( NonCompliantException, "M3DC1 File Open",
"File '" + m_filename + "' can not be opened" );
H5Fclose(m_fileID);
EXCEPTION1( InvalidFilesException, m_filename.c_str() );
}
else
H5Gclose(tempID);
// At this point consider the file to truly be a M3DC1 file. If
// some other file NonCompliantExceptions will be thrown.
// Continue as normal reporting NonCompliantExceptions
hid_t rootID = H5Gopen( m_fileID, "/", H5P_DEFAULT);
if ( rootID < 0 )
{
H5Fclose(m_fileID);
EXCEPTION2( NonCompliantException, "M3DC1 Group Open",
EXCEPTION2( NonCompliantException, "M3dc1 Group Open",
"The root group '/' was not found" );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment