Commit 4f5f0e43 authored by Jerry Clarke's avatar Jerry Clarke
Browse files

re-working time. Also modify XdmfElement::SetElement() to allow Element

to not be associated with XML node (problem with automatic vars)
parent 98cd1e98
......@@ -871,6 +871,8 @@ class XdmfGrid(XdmfElement):
def GetGeometry(*args): return _Xdmf.XdmfGrid_GetGeometry(*args)
def SetTopology(*args): return _Xdmf.XdmfGrid_SetTopology(*args)
def GetTopology(*args): return _Xdmf.XdmfGrid_GetTopology(*args)
def SetTime(*args): return _Xdmf.XdmfGrid_SetTime(*args)
def GetTime(*args): return _Xdmf.XdmfGrid_GetTime(*args)
def GetGridTypeAsString(*args): return _Xdmf.XdmfGrid_GetGridTypeAsString(*args)
def SetGridTypeFromString(*args): return _Xdmf.XdmfGrid_SetGridTypeFromString(*args)
def Build(*args): return _Xdmf.XdmfGrid_Build(*args)
......@@ -879,6 +881,8 @@ class XdmfGrid(XdmfElement):
def Insert(*args): return _Xdmf.XdmfGrid_Insert(*args)
def GetGridType(*args): return _Xdmf.XdmfGrid_GetGridType(*args)
def SetGridType(*args): return _Xdmf.XdmfGrid_SetGridType(*args)
def GetBuildTime(*args): return _Xdmf.XdmfGrid_GetBuildTime(*args)
def SetBuildTime(*args): return _Xdmf.XdmfGrid_SetBuildTime(*args)
def Copy(*args): return _Xdmf.XdmfGrid_Copy(*args)
def GetNumberOfChildren(*args): return _Xdmf.XdmfGrid_GetNumberOfChildren(*args)
def SetNumberOfChildren(*args): return _Xdmf.XdmfGrid_SetNumberOfChildren(*args)
......@@ -897,6 +901,12 @@ XdmfGrid_swigregister = _Xdmf.XdmfGrid_swigregister
XdmfGrid_swigregister(XdmfGrid)
HandleToXdmfGrid = _Xdmf.HandleToXdmfGrid
XDMF_TIME_SINGLE = _Xdmf.XDMF_TIME_SINGLE
XDMF_TIME_LIST = _Xdmf.XDMF_TIME_LIST
XDMF_TIME_HYPERSLAB = _Xdmf.XDMF_TIME_HYPERSLAB
XDMF_TIME_RANGE = _Xdmf.XDMF_TIME_RANGE
XDMF_TIME_FUNCTION = _Xdmf.XDMF_TIME_FUNCTION
XDMF_TIME_UNSET = _Xdmf.XDMF_TIME_UNSET
class XdmfTime(XdmfElement):
__swig_setmethods__ = {}
for _s in [XdmfElement]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
......@@ -921,6 +931,12 @@ class XdmfTime(XdmfElement):
def SetArray(*args): return _Xdmf.XdmfTime_SetArray(*args)
def GetDataItem(*args): return _Xdmf.XdmfTime_GetDataItem(*args)
def SetDataItem(*args): return _Xdmf.XdmfTime_SetDataItem(*args)
def GetTimeType(*args): return _Xdmf.XdmfTime_GetTimeType(*args)
def GetTimeTypeAsString(*args): return _Xdmf.XdmfTime_GetTimeTypeAsString(*args)
def SetTimeType(*args): return _Xdmf.XdmfTime_SetTimeType(*args)
def GetFunction(*args): return _Xdmf.XdmfTime_GetFunction(*args)
def SetFunction(*args): return _Xdmf.XdmfTime_SetFunction(*args)
def SetTimeFromParent(*args): return _Xdmf.XdmfTime_SetTimeFromParent(*args)
XdmfTime_swigregister = _Xdmf.XdmfTime_swigregister
XdmfTime_swigregister(XdmfTime)
......
......@@ -148,7 +148,7 @@ XdmfElement::GetCurrentXdmfElement(XdmfXmlNode anElement){
return(PrivateData->GetCurrentXdmfElement());
}
XdmfInt32 XdmfElement::SetElement(XdmfXmlNode anElement){
XdmfInt32 XdmfElement::SetElement(XdmfXmlNode anElement, XdmfInt32 AssociateElement){
if(!anElement) {
XdmfErrorMessage("Element is NULL");
return(XDMF_FAIL);
......@@ -156,7 +156,7 @@ XdmfInt32 XdmfElement::SetElement(XdmfXmlNode anElement){
// Clear the ReferenceObject underlying node. This will also create PrivateData if necessary
XdmfDebug("Clearing ReferenceObject of XML node");
this->SetReferenceObject(anElement, XDMF_EMPTY_REFERENCE);
this->SetCurrentXdmfElement(anElement, this);
if(AssociateElement) this->SetCurrentXdmfElement(anElement, this);
this->Element = anElement;
return(XDMF_SUCCESS);
}
......@@ -430,6 +430,7 @@ XdmfInt32 XdmfElement::Build(){
childnode = this->DOM->GetChild(i, myelement);
childelement = (XdmfElement *)this->GetCurrentXdmfElement(childnode);
if(childelement){
// cout << "Child Element Type of " << childelement << " = " << childelement->GetElementType() << endl;
childelement->Build();
}
}
......
......@@ -112,8 +112,9 @@ public:
//! Set the XML Node from which to parse
/*!
\param Element is the low level node returned from XdmfDOM->FindElement() etc.
\param AssociateElement Should the node in the DOM be associated with the XdmfElement (1)
*/
XdmfInt32 SetElement(XdmfXmlNode Element);
XdmfInt32 SetElement(XdmfXmlNode Element, XdmfInt32 AssociateElement=1);
//! Get the XML Node
XdmfGetValueMacro(Element, XdmfXmlNode);
......
......@@ -300,7 +300,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
if( PointsElement ){
XdmfDataItem PointsItem;
if(PointsItem.SetDOM( this->DOM ) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.Update() == XDMF_FAIL) return(XDMF_FAIL);
TmpArray = PointsItem.GetArray();
......@@ -373,7 +373,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
XdmfDebug("Reading Origin and Dx, Dy, Dz" );
PointsElement = this->DOM->FindDataElement(0, this->Element );
if( PointsElement ){
if(PointsItem.SetElement(PointsElement) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.Update() == XDMF_FAIL) return(XDMF_FAIL);
TmpArray = PointsItem.GetArray();
......@@ -382,7 +382,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
}
PointsElement = this->DOM->FindDataElement(1, this->Element );
if( PointsElement ){
if(PointsItem.SetElement(PointsElement) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.Update() == XDMF_FAIL) return(XDMF_FAIL);
TmpArray = PointsItem.GetArray();
......@@ -403,7 +403,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
if( PointsElement ){
XdmfDataItem PointsItem;
PointsItem.SetDOM(this->DOM);
if(PointsItem.SetElement(PointsElement) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.Update() == XDMF_FAIL) return(XDMF_FAIL);
TmpArray = PointsItem.GetArray();
......@@ -421,7 +421,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
if( PointsElement ){
XdmfDataItem PointsItem;
PointsItem.SetDOM(this->DOM);
if(PointsItem.SetElement(PointsElement) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.Update() == XDMF_FAIL) return(XDMF_FAIL);
TmpArray = PointsItem.GetArray();
......@@ -439,7 +439,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
if( PointsElement ){
XdmfDataItem PointsItem;
PointsItem.SetDOM(this->DOM);
if(PointsItem.SetElement(PointsElement) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.Update() == XDMF_FAIL) return(XDMF_FAIL);
TmpArray = PointsItem.GetArray();
......
......@@ -30,6 +30,7 @@
#include "XdmfTopology.h"
#include "XdmfGeometry.h"
#include "XdmfAttribute.h"
#include "XdmfTime.h"
XdmfGrid *HandleToXdmfGrid( XdmfString Source ){
XdmfObject *TempObj;
......@@ -50,6 +51,8 @@ XdmfGrid::XdmfGrid() {
this->GeometryIsMine = 1;
this->Topology = new XdmfTopology;
this->TopologyIsMine = 1;
this->Time = new XdmfTime;
this->TimeIsMine = 1;
this->Attribute = (XdmfAttribute **)calloc(1, sizeof( XdmfAttribute * ));
this->Children = (XdmfGrid **)calloc(1, sizeof( XdmfGrid * ));
this->AssignedAttribute = NULL;
......@@ -63,6 +66,7 @@ XdmfGrid::~XdmfGrid() {
XdmfInt32 Index;
if( this->GeometryIsMine && this->Geometry ) delete this->Geometry;
if( this->TopologyIsMine && this->Topology ) delete this->Topology;
if( this->TimeIsMine && this->Time ) delete this->Time;
for ( Index = 0; Index < this->NumberOfAttributes; Index ++ )
{
delete this->Attribute[Index];
......@@ -101,6 +105,7 @@ XdmfGrid::Insert( XdmfElement *Child){
XDMF_WORD_CMP(Child->GetElementName(), "Topology") ||
XDMF_WORD_CMP(Child->GetElementName(), "Attribute") ||
XDMF_WORD_CMP(Child->GetElementName(), "DataItem") ||
XDMF_WORD_CMP(Child->GetElementName(), "Time") ||
XDMF_WORD_CMP(Child->GetElementName(), "Information")
)){
XdmfInt32 status = XdmfElement::Insert(Child);
......@@ -133,6 +138,9 @@ XdmfGrid::Build(){
this->Geometry->Build();
}else{
}
if(this->BuildTime && this->Time){
if(this->Time->Build() != XDMF_SUCCESS) return(XDMF_FAIL);
}
return(XDMF_SUCCESS);
}
......@@ -294,6 +302,17 @@ if( this->GridType & XDMF_GRID_MASK){
nchild = this->DOM->FindNumberOfElements("Grid", this->Element);
this->NumberOfChildren = nchild;
this->Children = (XdmfGrid **)realloc(this->Children, nchild * sizeof(XdmfGrid *));
anElement = this->DOM->FindElement("Time", 0, this->Element);
if(anElement){
if(this->Time->SetDOM( this->DOM ) == XDMF_FAIL) return(XDMF_FAIL);
if(this->Time->SetElement(anElement) == XDMF_FAIL) return(XDMF_FAIL);
Status = this->Time->UpdateInformation();
if( Status == XDMF_FAIL ){
XdmfErrorMessage("Error Reading Time");
return( XDMF_FAIL );
}
}
anElement = this->DOM->FindElement("Geometry", 0, this->Element);
for(i=0 ; i < nchild ; i++){
node = this->DOM->FindElement("Grid", i, this->Element);
if(!node) {
......@@ -304,6 +323,9 @@ if( this->GridType & XDMF_GRID_MASK){
if(this->Children[i]->SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
if(this->Children[i]->SetElement(node) == XDMF_FAIL) return(XDMF_FAIL);
if(this->Children[i]->UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
if(this->Time->GetTimeType() != XDMF_TIME_UNSET){
if(this->Children[i]->GetTime()->SetTimeFromParent(this->Time, i) != XDMF_SUCCESS) return(XDMF_FAIL);
}
}
if((this->GridType & XDMF_GRID_MASK) == XDMF_GRID_SUBSET){
// Selection is the First Element Under Grid
......
......@@ -31,6 +31,7 @@
class XdmfGeometry;
class XdmfTopology;
class XdmfAttribute;
class XdmfTime;
#define XDMF_GRID_UNIFORM 0x00000 // Type xor XDMF_GRID_MASK = XdmfTopology Type
#define XDMF_GRID_COLLECTION 0x10000
......@@ -146,6 +147,10 @@ public:
XdmfSetValueMacro( Topology, XdmfTopology *);
//! Get the XdmfTopology for an XdmfGrid
XdmfGetValueMacro( Topology, XdmfTopology *);
//! Explicitly set the XdmfTime for an XdmfGrid
XdmfSetValueMacro( Time, XdmfTime *);
//! Get the XdmfTime for an XdmfGrid
XdmfGetValueMacro( Time, XdmfTime *);
//! Get the Grid Type as a string
XdmfConstString GetGridTypeAsString();
......@@ -165,6 +170,10 @@ public:
XdmfGetValueMacro( GridType, XdmfInt32);
//! Set the Grid Type
XdmfSetValueMacro( GridType, XdmfInt32);
//! Get Build Time Flag
XdmfGetValueMacro( BuildTime, XdmfInt32);
//! Set the Build Time Flag
XdmfSetValueMacro( BuildTime, XdmfInt32);
//! Copy Information from Another DataItem
XdmfInt32 Copy(XdmfElement *Source);
......@@ -260,11 +269,14 @@ protected:
XdmfGeometry *Geometry;
XdmfTopology *Topology;
XdmfTime *Time;
XdmfInt32 GeometryIsMine;
XdmfInt32 TopologyIsMine;
XdmfInt32 TimeIsMine;
XdmfInt32 NumberOfAttributes;
XdmfInt32 GridType;
XdmfInt32 NumberOfChildren;
XdmfInt32 BuildTime;
XdmfGrid **Children;
XdmfAttribute **Attribute;
XdmfAttribute *AssignedAttribute;
......
......@@ -21751,6 +21751,59 @@ fail:
}
 
 
SWIGINTERN PyObject *_wrap_XdmfGrid_SetTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfGrid *arg1 = (XdmfGrid *) 0 ;
XdmfTime *arg2 = (XdmfTime *) 0 ;
XdmfInt32 result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:XdmfGrid_SetTime",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfGrid, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfGrid_SetTime" "', argument " "1"" of type '" "XdmfGrid *""'");
}
arg1 = reinterpret_cast< XdmfGrid * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XdmfGrid_SetTime" "', argument " "2"" of type '" "XdmfTime *""'");
}
arg2 = reinterpret_cast< XdmfTime * >(argp2);
result = (XdmfInt32)(arg1)->SetTime(arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfGrid_GetTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfGrid *arg1 = (XdmfGrid *) 0 ;
XdmfTime *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:XdmfGrid_GetTime",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfGrid, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfGrid_GetTime" "', argument " "1"" of type '" "XdmfGrid *""'");
}
arg1 = reinterpret_cast< XdmfGrid * >(argp1);
result = (XdmfTime *)(arg1)->GetTime();
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XdmfTime, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfGrid_GetGridTypeAsString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfGrid *arg1 = (XdmfGrid *) 0 ;
......@@ -21957,6 +22010,59 @@ fail:
}
 
 
SWIGINTERN PyObject *_wrap_XdmfGrid_GetBuildTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfGrid *arg1 = (XdmfGrid *) 0 ;
XdmfInt32 result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:XdmfGrid_GetBuildTime",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfGrid, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfGrid_GetBuildTime" "', argument " "1"" of type '" "XdmfGrid *""'");
}
arg1 = reinterpret_cast< XdmfGrid * >(argp1);
result = (XdmfInt32)(arg1)->GetBuildTime();
resultobj = SWIG_From_int(static_cast< int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfGrid_SetBuildTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfGrid *arg1 = (XdmfGrid *) 0 ;
XdmfInt32 arg2 ;
XdmfInt32 result;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:XdmfGrid_SetBuildTime",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfGrid, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfGrid_SetBuildTime" "', argument " "1"" of type '" "XdmfGrid *""'");
}
arg1 = reinterpret_cast< XdmfGrid * >(argp1);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "XdmfGrid_SetBuildTime" "', argument " "2"" of type '" "XdmfInt32""'");
}
arg2 = static_cast< XdmfInt32 >(val2);
result = (XdmfInt32)(arg1)->SetBuildTime(arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfGrid_Copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfGrid *arg1 = (XdmfGrid *) 0 ;
......@@ -22654,6 +22760,177 @@ fail:
}
 
 
SWIGINTERN PyObject *_wrap_XdmfTime_GetTimeType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfTime *arg1 = (XdmfTime *) 0 ;
XdmfInt32 result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:XdmfTime_GetTimeType",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfTime_GetTimeType" "', argument " "1"" of type '" "XdmfTime *""'");
}
arg1 = reinterpret_cast< XdmfTime * >(argp1);
result = (XdmfInt32)(arg1)->GetTimeType();
resultobj = SWIG_From_int(static_cast< int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfTime_GetTimeTypeAsString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfTime *arg1 = (XdmfTime *) 0 ;
XdmfConstString result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:XdmfTime_GetTimeTypeAsString",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfTime_GetTimeTypeAsString" "', argument " "1"" of type '" "XdmfTime *""'");
}
arg1 = reinterpret_cast< XdmfTime * >(argp1);
result = (XdmfConstString)(arg1)->GetTimeTypeAsString();
resultobj = SWIG_FromCharPtr((const char *)result);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfTime_SetTimeType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfTime *arg1 = (XdmfTime *) 0 ;
XdmfInt32 arg2 ;
XdmfInt32 result;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:XdmfTime_SetTimeType",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfTime_SetTimeType" "', argument " "1"" of type '" "XdmfTime *""'");
}
arg1 = reinterpret_cast< XdmfTime * >(argp1);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "XdmfTime_SetTimeType" "', argument " "2"" of type '" "XdmfInt32""'");
}
arg2 = static_cast< XdmfInt32 >(val2);
result = (XdmfInt32)(arg1)->SetTimeType(arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfTime_GetFunction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfTime *arg1 = (XdmfTime *) 0 ;
XdmfConstString result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:XdmfTime_GetFunction",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfTime_GetFunction" "', argument " "1"" of type '" "XdmfTime *""'");
}
arg1 = reinterpret_cast< XdmfTime * >(argp1);
result = (XdmfConstString)(arg1)->GetFunction();
resultobj = SWIG_FromCharPtr((const char *)result);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfTime_SetFunction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfTime *arg1 = (XdmfTime *) 0 ;
XdmfConstString arg2 = (XdmfConstString) 0 ;
XdmfInt32 result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:XdmfTime_SetFunction",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfTime_SetFunction" "', argument " "1"" of type '" "XdmfTime *""'");
}
arg1 = reinterpret_cast< XdmfTime * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XdmfTime_SetFunction" "', argument " "2"" of type '" "XdmfConstString""'");
}
arg2 = reinterpret_cast< XdmfConstString >(buf2);
result = (XdmfInt32)(arg1)->SetFunction(arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfTime_SetTimeFromParent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
XdmfTime *arg1 = (XdmfTime *) 0 ;
XdmfTime *arg2 = (XdmfTime *) 0 ;
XdmfInt64 arg3 ;
XdmfInt32 result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
long long val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:XdmfTime_SetTimeFromParent",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfTime_SetTimeFromParent" "', argument " "1"" of type '" "XdmfTime *""'");
}
arg1 = reinterpret_cast< XdmfTime * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_XdmfTime, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XdmfTime_SetTimeFromParent" "', argument " "2"" of type '" "XdmfTime *""'");
}
arg2 = reinterpret_cast< XdmfTime * >(argp2);
ecode3 = SWIG_AsVal_long_SS_long(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "XdmfTime_SetTimeFromParent" "', argument " "3"" of type '" "XdmfInt64""'");
}
arg3 = static_cast< XdmfInt64 >(val3);
result = (XdmfInt32)(arg1)->SetTimeFromParent(arg2,arg3);
resultobj = SWIG_From_int(static_cast< int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *XdmfTime_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
......@@ -23101,6 +23378,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"XdmfGrid_GetGeometry", _wrap_XdmfGrid_GetGeometry, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_SetTopology", _wrap_XdmfGrid_SetTopology, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_GetTopology", _wrap_XdmfGrid_GetTopology, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_SetTime", _wrap_XdmfGrid_SetTime, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_GetTime", _wrap_XdmfGrid_GetTime, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_GetGridTypeAsString", _wrap_XdmfGrid_GetGridTypeAsString, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_SetGridTypeFromString", _wrap_XdmfGrid_SetGridTypeFromString, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_Build", _wrap_XdmfGrid_Build, METH_VARARGS, NULL},
......@@ -23109,6 +23388,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"XdmfGrid_Insert", _wrap_XdmfGrid_Insert, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_GetGridType", _wrap_XdmfGrid_GetGridType, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_SetGridType", _wrap_XdmfGrid_SetGridType, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_GetBuildTime", _wrap_XdmfGrid_GetBuildTime, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_SetBuildTime", _wrap_XdmfGrid_SetBuildTime, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_Copy", _wrap_XdmfGrid_Copy, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_GetNumberOfChildren", _wrap_XdmfGrid_GetNumberOfChildren, METH_VARARGS, NULL},
{ (char *)"XdmfGrid_SetNumberOfChildren", _wrap_XdmfGrid_SetNumberOfChildren, METH_VARARGS, NULL},
......@@ -23137,6 +23418,12 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"XdmfTime_SetArray", _wrap_XdmfTime_SetArray, METH_VARARGS, NULL},
{ (char *)"XdmfTime_GetDataItem", _wrap_XdmfTime_GetDataItem, METH_VARARGS, NULL},
{ (char *)"XdmfTime_SetDataItem", _wrap_XdmfTime_SetDataItem, METH_VARARGS, NULL},
{ (char *)"XdmfTime_GetTimeType", _wrap_XdmfTime_GetTimeType, METH_VARARGS, NULL},
{ (char *)"XdmfTime_GetTimeTypeAsString", _wrap_XdmfTime_GetTimeTypeAsString, METH_VARARGS, NULL},
{ (char *)"XdmfTime_SetTimeType", _wrap_XdmfTime_SetTimeType, METH_VARARGS, NULL},
{ (char *)"XdmfTime_GetFunction", _wrap_XdmfTime_GetFunction, METH_VARARGS, NULL},
{ (char *)"XdmfTime_SetFunction", _wrap_XdmfTime_SetFunction, METH_VARARGS, NULL},
{ (char *)"XdmfTime_SetTimeFromParent", _wrap_XdmfTime_SetTimeFromParent, METH_VARARGS, NULL},
{ (char *)"XdmfTime_swigregister", XdmfTime_swigregister, METH_VARARGS, NULL},
{ NULL, NULL, 0, NULL }
};
......@@ -24089,5 +24376,11 @@ SWIGEXPORT void SWIG_init(void) {
SWIG_Python_SetConstant(d, "XDMF_GRID_SECTION_ALL",SWIG_From_int(static_cast< int >(0x100000)));
SWIG_Python_SetConstant(d, "XDMF_GRID_SECTION_DATA_ITEM",SWIG_From_int(static_cast< int >(0x200000)));
SWIG_Python_SetConstant(d, "XDMF_GRID_SECTION_MASK",SWIG_From_int(static_cast< int >(0xF00000)));
SWIG_Python_SetConstant(d, "XDMF_TIME_SINGLE",SWIG_From_int(static_cast< int >(0x00)));
SWIG_Python_SetConstant(d, "XDMF_TIME_LIST",SWIG_From_int(static_cast< int >(0x01)));
SWIG_Python_SetConstant(d, "XDMF_TIME_HYPERSLAB",SWIG_From_int(static_cast< int >(0x02)));
SWIG_Python_SetConstant(d, "XDMF_TIME_RANGE",SWIG_From_int(static_cast< int >(0x03)));
SWIG_Python_SetConstant(d, "XDMF_TIME_FUNCTION",SWIG_From_int(static_cast< int >(0x04)));
SWIG_Python_SetConstant(d, "XDMF_TIME_UNSET",SWIG_From_int(static_cast< int >(0x0FF)));
}
 
......@@ -33,7 +33,7 @@ XdmfTime::XdmfTime() {
this->Value = 0.0;
this->Array = NULL;
this->DataItem = new XdmfDataItem;
this->TimeType = XDMF_TIME_SINGLE;
this->TimeType = XDMF_TIME_UNSET;
this->Function = NULL;
}
......@@ -60,8 +60,10 @@ XdmfInt32 XdmfTime::UpdateInformation(){
if(!attribute) attribute = this->Get("Type");
if( XDMF_WORD_CMP(attribute, "Single") ){
this->TimeType = XDMF_TIME_SINGLE;
}else if( XDMF_WORD_CMP(attribute, "Uniform") ){
this->TimeType = XDMF_TIME_UNIFORM;
}else if( XDMF_WORD_CMP(attribute, "List") ){
this->TimeType = XDMF_TIME_LIST;
}else if( XDMF_WORD_CMP(attribute, "Range") ){
this->TimeType = XDMF_TIME_RANGE;
}else if( XDMF_WORD_CMP(attribute, "HyperSlab") ){
this->TimeType = XDMF_TIME_HYPERSLAB;
}else if( XDMF_WORD_CMP(attribute, "Function") ){
......@@ -108,6 +110,7 @@ XdmfInt32 XdmfTime::UpdateInformation(){
}
XdmfInt32 XdmfTime::Build(){
if(this->TimeType == XDMF_TIME_UNSET) return(XDMF_SUCCESS);
if(XdmfElement::Build() != XDMF_SUCCESS) return(XDMF_FAIL);
this->Set("TimeType", this->GetTimeTypeAsString());
if(this->TimeType == XDMF_TIME_FUNCTION){
......@@ -146,11 +149,55 @@ XdmfInt32 XdmfTime::Build(){
return(XDMF_SUCCESS);
}
XdmfInt32
XdmfTime::SetTimeFromParent(XdmfTime *ParentTime, XdmfInt64 Index){
XdmfArray *TimeArray;
if(!ParentTime || (Index < 0)) return(XDMF_FAIL);
// this->DebugOn();
XdmfDebug("Setting Time from Type " << ParentTime->GetTimeTypeAsString() << " Index = " << Index);
switch(ParentTime->GetTimeType()){
case XDMF_TIME_SINGLE:
this->TimeType = XDMF_TIME_SINGLE;
this->Value = ParentTime->GetValue();
XdmfDebug("Setting Time Value to " << this->Value);