Commit 0e4ecca0 authored by allens's avatar allens

added in cycles and times

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11495 18c085ea-50e0-402c-830e-de6fd14e8384
parent 1a459d42
......@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
hid_t
_normalize_h5_type (hid_t type)
......@@ -34,6 +35,13 @@ _normalize_h5_type (hid_t type)
{
return H5T_NATIVE_FLOAT;
}
break;
case H5T_STRING:
if( H5Tis_variable_str( type ) )
return H5T_C_S1;
else
return type;
break;
default:
; /* NOP */
}
......
......@@ -227,9 +227,11 @@ avtH5NimrodFileFormat::avtH5NimrodFileFormat (const char *filename):
H5G_GROUP,
NULL);
debug5<< "num_groups = "<<num_groups <<endl;
char name[MAXLENGTH], name1[MAXLENGTH], name2[MAXLENGTH];
char name[MAXLENGTH], name1[MAXLENGTH], name2[MAXLENGTH],
stepnumber[MAXLENGTH];
nsteps = 0;
for (int idx = 0; idx < num_groups; idx++)
{
int len_of_name = MAXLENGTH;
......@@ -240,8 +242,35 @@ avtH5NimrodFileFormat::avtH5NimrodFileFormat (const char *filename):
{
sprintf (name1, "/%s", name);
stepnames.push_back( name );
nsteps++;
group_id = H5Gopen (root_id, name1);
memset( stepnumber, 0, MAXLENGTH );
if (H5NIMROD_read_attrib (group_id, "Step number", &stepnumber) == H5NIMROD_ERR)
{
H5Gclose(group_id);
H5Fclose(file);
EXCEPTION1 (InvalidFilesException, filename);
}
cycles.push_back( atoi(stepnumber) );
debug5 << "step number: " << stepnumber << std::endl;
if (H5NIMROD_read_attrib (group_id, "time", &time) == H5NIMROD_ERR)
{
H5Gclose(group_id);
H5Fclose(file);
EXCEPTION1 (InvalidFilesException, filename);
}
times.push_back( time );
debug5 << "time: " << time << std::endl;
nvectorvars = H5NIMROD_get_num_objects_matching_pattern (group_id,
name1,
H5G_GROUP,
......@@ -373,8 +402,11 @@ avtH5NimrodFileFormat::PopulateDatabaseMetaData (avtDatabaseMetaData * md,
vectorvardims[idx]);
}
md->SetCyclesAreAccurate(true);
md->SetCycles( cycles );
md->SetTimesAreAccurate(true);
md->SetTimes( times );
}
......@@ -602,3 +634,53 @@ avtH5NimrodFileFormat::GetVectorVar (int timestate, const char *varname)
}
// ****************************************************************************
// Method: avtH5NimrodFileFormat::GetCycles
//
// Purpose:
// Returns the cycles
//
// Arguments:
// c the cycles
//
// Programmer: allen
// Creation:
//
// ****************************************************************************
void avtH5NimrodFileFormat::GetCycles(std::vector<int> &c)
{
c = cycles;
metadata->SetCyclesAreAccurate(true);
metadata->SetCycles( cycles );
metadata->SetTimesAreAccurate(true);
metadata->SetTimes( times );
}
// ****************************************************************************
// Method: avtH5NimrodFileFormat::GetTimes
//
// Purpose:
// Returns the times
//
// Arguments:
// t the times
//
// Programmer: allen
// Creation:
//
// ****************************************************************************
void avtH5NimrodFileFormat::GetTimes(std::vector<double> &t)
{
t = times;
metadata->SetCyclesAreAccurate(true);
metadata->SetCycles( cycles );
metadata->SetTimesAreAccurate(true);
metadata->SetTimes( times );
}
......@@ -87,8 +87,8 @@ class avtH5NimrodFileFormat : public avtMTSDFileFormat
// If you know the times and cycle numbers, overload this function.
// Otherwise, VisIt will make up some reasonable ones for you.
//
// virtual void GetCycles(std::vector<int> &);
// virtual void GetTimes(std::vector<double> &);
virtual void GetCycles(std::vector<int> &c);
virtual void GetTimes(std::vector<double> &t);
//
virtual int GetNTimesteps(void);
......@@ -105,6 +105,8 @@ class avtH5NimrodFileFormat : public avtMTSDFileFormat
std::string fname;
int nsteps;
std::vector<std::string > stepnames;
std::vector<int> cycles;
std::vector<double> times;
int structured;
int ndims;
hsize_t grid_dims[3];
......@@ -117,8 +119,7 @@ class avtH5NimrodFileFormat : public avtMTSDFileFormat
std::vector<std::string > vectorvarnames;
std::vector<int> vectorvardims;
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *, int);
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *, int);
};
......
......@@ -128,7 +128,7 @@ avtM3DC1FileFormat::avtM3DC1FileFormat(const char *filename,
int
avtM3DC1FileFormat::GetNTimesteps(void)
{
return m_timeSteps.size();
return m_times.size();
}
......@@ -309,6 +309,12 @@ avtM3DC1FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md,
amd->hideFromGUI = true;
md->Add(amd);
}
md->SetCyclesAreAccurate(true);
md->SetCycles( m_cycles );
md->SetTimesAreAccurate(true);
md->SetTimes( m_times );
}
......@@ -1570,7 +1576,8 @@ avtM3DC1FileFormat::LoadFile()
double time;
if ( ! ReadAttribute( groupID, "time", &time ) )
EXCEPTION2( UnexpectedValueException, "time", "Not found or wrong type" );
m_timeSteps.push_back( time );
m_times.push_back( time );
m_cycles.push_back( t );
// Read in the field information.
hid_t fieldID = H5Gopen( groupID, "fields", H5P_DEFAULT);
......@@ -1649,3 +1656,54 @@ avtM3DC1FileFormat::LoadFile()
debug1 << "SUCCESS in opening M3D C1 file " << m_filename << endl;
}
// ****************************************************************************
// Method: avtM3DC1FileFormat::GetCycles
//
// Purpose:
// Returns the cycles
//
// Arguments:
// c the cycles
//
// Programmer: allen
// Creation:
//
// ****************************************************************************
void avtM3DC1FileFormat::GetCycles(std::vector<int> &cycles)
{
cycles = m_cycles;
metadata->SetCyclesAreAccurate(true);
metadata->SetCycles( m_cycles );
metadata->SetTimesAreAccurate(true);
metadata->SetTimes( m_times );
}
// ****************************************************************************
// Method: avtM3DC1FileFormat::GetTimes
//
// Purpose:
// Returns the times
//
// Arguments:
// t the times
//
// Programmer: allen
// Creation:
//
// ****************************************************************************
void avtM3DC1FileFormat::GetTimes(std::vector<double> &times)
{
times = m_times;
metadata->SetCyclesAreAccurate(true);
metadata->SetCycles( m_cycles );
metadata->SetTimesAreAccurate(true);
metadata->SetTimes( m_times );
}
......@@ -82,8 +82,8 @@ class avtM3DC1FileFormat : public avtMTSDFileFormat
// If you know the times and cycle numbers, overload this function.
// Otherwise, VisIt will make up some reasonable ones for you.
//
// virtual void GetCycles(std::vector<int> &);
// virtual void GetTimes(std::vector<double> &);
virtual void GetCycles(std::vector<int> &);
virtual void GetTimes(std::vector<double> &);
//
virtual int GetNTimesteps(void);
......@@ -120,7 +120,8 @@ class avtM3DC1FileFormat : public avtMTSDFileFormat
avtCentering m_dataLocation;
float m_perturbationScale;
std::vector<float> m_timeSteps;
std::vector<int> m_cycles;
std::vector<double> m_times;
public:
std::vector<std::string> m_scalarVarNames;
......
......@@ -70,7 +70,7 @@ GetM3DC1ReadOptions(void)
{
DBOptionsAttributes *rv = new DBOptionsAttributes;
rv->SetInt("Number of poloidal planes", 1);
// rv->SetInt("Number of poloidal planes", 1);
rv->SetEnum("Mesh refinement", 1);
vector<string> refinement;
......
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