Commit e5c497b7 authored by miller86's avatar miller86

adding parsing of <Time Value="xxx" /> and GetTime() method

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@7964 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3c078f25
......@@ -1518,6 +1518,45 @@ avtXDMFFileFormat::ParseGridInformation(string &baseIndex,
}
}
// ****************************************************************************
// Method: avtXDMFFileFormat::ParseTime
//
// Purpose:
// Parse a Time node in the DOM tree.
//
// Programmer: Mark C. Miller
// Creation: Wed Jul 29 18:08:15 PDT 2009
//
// ****************************************************************************
void
avtXDMFFileFormat::ParseTime(string &time)
{
while (xdmfParser.GetNextAttribute())
{
if (strcmp(xdmfParser.GetAttributeName(), "VALUE") == 0)
{
time = string(xdmfParser.GetAttributeValueAsUpper());
}
}
//
// Process the rest of the information.
//
XDMFParser::ElementType elementType = xdmfParser.GetNextElement();
while (elementType != XDMFParser::TYPE_EOF)
{
if (elementType == XDMFParser::TYPE_START_TAG)
{
xdmfParser.SkipToEndTag();
}
else if (elementType == XDMFParser::TYPE_END_TAG)
{
break;
}
elementType = xdmfParser.GetNextElement();
}
}
// ****************************************************************************
// Method: avtXDMFFileFormat::ParseUniformGrid
......@@ -1550,6 +1589,8 @@ avtXDMFFileFormat::ParseGridInformation(string &baseIndex,
// I enhanced the routine to be insensitive to the case for element names,
// attribute names, and attribute values that were not names.
//
// Mark C. Miller, Thu Jul 30 11:12:17 PDT 2009
// Added parsing of <Time Value="xxx" /> element.
// ****************************************************************************
void
......@@ -1570,6 +1611,7 @@ avtXDMFFileFormat::ParseUniformGrid(vector<MeshInfo*> &meshList,
vector<VarInfo*> varList;
string baseIndex;
string ghostOffsets;
string time;
//
// Process the elements of the grid.
......@@ -1597,6 +1639,10 @@ avtXDMFFileFormat::ParseUniformGrid(vector<MeshInfo*> &meshList,
{
ParseGridInformation(baseIndex, ghostOffsets);
}
else if (strcmp(xdmfParser.GetElementName(), "TIME") == 0)
{
ParseTime(time);
}
else
{
xdmfParser.SkipToEndTag();
......@@ -1869,6 +1915,11 @@ avtXDMFFileFormat::ParseUniformGrid(vector<MeshInfo*> &meshList,
}
}
if (time != "")
{
sscanf(time.c_str(), "%lf", &meshInfo->time);
}
for (int i = 0; i < nMeshData; i++)
meshInfo->meshData[i] = meshData[i];
......@@ -3609,3 +3660,19 @@ avtXDMFFileFormat::GetVectorVar(int domain, const char *varname)
return rv;
}
// ****************************************************************************
// Method: avtXDMFFileFormat::GetTime
//
// Programmer: Mark C. Miller
// Created: Thu Jul 30 11:12:53 PDT 2009
//
// ****************************************************************************
double avtXDMFFileFormat::GetTime()
{
if (fileMeshList.size())
return fileMeshList[0]->time;
else
return avtFileFormat::INVALID_TIME;
}
......@@ -147,6 +147,7 @@ class MeshInfo
int *ghostOffsets;
DataItem *topologyData;
DataItem *meshData[3];
double time;
};
class VarInfo
......@@ -262,6 +263,8 @@ class avtXDMFFileFormat : public avtSTMDFileFormat
virtual const char *GetType(void) { return "XDMF"; };
virtual void FreeUpResources(void);
double GetTime();
virtual vtkDataSet *GetMesh(int, const char *);
virtual vtkDataArray *GetVar(int, const char *);
virtual vtkDataArray *GetVectorVar(int, const char *);
......@@ -294,6 +297,7 @@ class avtXDMFFileFormat : public avtSTMDFileFormat
DataItem *ParseDataItem();
void ParseTopology(string &, string &, string &,
string &, string &, DataItem **);
void ParseTime(string &);
void ParseGeometry(string &, int &, DataItem **);
VarInfo *ParseAttribute(int, int, const string &);
void ParseGridInformation(string &, string &);
......
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