Commit 536414b8 authored by hrchilds's avatar hrchilds
Browse files

Update from April 17, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@223 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4425d054
......@@ -217,6 +217,36 @@ avtExodusFileFormat::GetCycles(vector<int> &cycles)
}
// ****************************************************************************
// Method: avtExodusFileFormat::GetTimes
//
// Purpose:
// Get the times for each timestep.
//
// Arguments:
// times A place to put the times numbers.
//
// Programmer: Hank Childs
// Creation: April 17, 2004
//
// ****************************************************************************
void
avtExodusFileFormat::GetTimes(vector<double> &times)
{
int nTimesteps = GetNTimesteps();
times.clear();
for (int i = 0 ; i < nTimesteps ; i++)
{
if (reader != NULL)
times.push_back(reader->GetTime(i));
else
times.push_back(0.);
}
}
// ****************************************************************************
// Method: avtExodusFileFormat::GetNTimesteps
//
......
......@@ -27,6 +27,9 @@ class avtVariableCache;
// vtkScalars and vtkVectors have been deprecated in VTK 4.0,
// use vtkDataArray instead.
//
// Hank Childs, Sat Apr 17 07:42:40 PDT 2004
// Added support for times.
//
// ****************************************************************************
class avtExodusFileFormat : public avtMTSDFileFormat
......@@ -39,6 +42,7 @@ class avtExodusFileFormat : public avtMTSDFileFormat
const char *GetType(void) { return "Exodus File Format"; };
virtual void GetCycles(std::vector<int> &);
virtual void GetTimes(std::vector<double> &);
virtual int GetNTimesteps(void);
virtual vtkDataSet *GetMesh(int, const char *);
......
......@@ -86,6 +86,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vtkStandardNewMacro(vtkExodusReader);
//----------------------------------------------------------------------------
// Modifications:
// Hank Childs, Sat Apr 17 07:44:05 PDT 2004
// Initialize times.
//----------------------------------------------------------------------------
// Description:
// Instantiate object with NULL filename.
......@@ -121,9 +125,15 @@ vtkExodusReader::vtkExodusReader()
this->StartBlock = this->EndBlock = -1;
this->PointMapOutIn = vtkIdList::New();
this->Times = NULL;
}
//----------------------------------------------------------------------------
// Modifications:
// Hank Childs, Sat Apr 17 07:44:05 PDT 2004
// Destruct times.
//----------------------------------------------------------------------------
vtkExodusReader::~vtkExodusReader()
{
......@@ -143,7 +153,12 @@ vtkExodusReader::~vtkExodusReader()
delete [] this->Title;
this->Title = NULL;
}
if (this->Times)
{
delete [] this->Times;
this->Times = NULL;
}
this->SetGeometryFileName(NULL);
this->GeometryCache->Delete();
this->GeometryCache = NULL;
......@@ -337,6 +352,13 @@ void vtkExodusReader::SetNumberOfCellDataArrays(int num)
//----------------------------------------------------------------------------
// Modifications:
//
// Hank Childs, Sat Apr 17 07:29:22 PDT 2004
// Read in the times as well.
//
//----------------------------------------------------------------------------
void vtkExodusReader::ExecuteInformation()
{
int exoid;
......@@ -473,6 +495,8 @@ void vtkExodusReader::ExecuteInformation()
vtkErrorMacro("Error: " << error << " while reading number of time steps from file "
<< this->FileName);
}
this->Times = new float[this->NumberOfTimeSteps];
ex_get_all_times(exoid, this->Times);
error = ex_close(exoid);
if (error < 0)
......
......@@ -58,6 +58,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// by loading only a range of the possible blocks. Unused points
// are filtered out internally.
// Modifications:
//
// Hank Childs, Sat Apr 17 07:29:22 PDT 2004
// Added support for reading times.
//
#ifndef __vtkExodusReader_h
#define __vtkExodusReader_h
......@@ -145,6 +150,10 @@ public:
void SetCellDataArrayLoadFlag(int index, int flag);
int GetCellDataArrayLoadFlag(int index);
float GetTime(int ts) { return (this->Times != NULL && ts >= 0 &&
ts < this->NumberOfTimeSteps
? Times[ts]
: 0.); };
protected:
vtkExodusReader();
~vtkExodusReader();
......@@ -203,6 +212,7 @@ protected:
int NumberOfNodes;
int NumberOfElements;
int NumberOfTimeSteps;
float *Times;
vtkIntArray *NumberOfBlockElements;
vtkIntArray *BlockIds;
vtkIntArray *CellVarTruthTable;
......
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