Commit fc6af9df authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

BUG: Fix memory management problems as detected with valgrind and totalview.

parent 20e5de77
......@@ -222,6 +222,27 @@ class XdmfElement(XdmfLightData):
XdmfElement_swigregister = _Xdmf.XdmfElement_swigregister
XdmfElement_swigregister(XdmfElement)
class XdmfElementData(XdmfObject):
__swig_setmethods__ = {}
for _s in [XdmfObject]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfElementData, name, value)
__swig_getmethods__ = {}
for _s in [XdmfObject]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, XdmfElementData, name)
__repr__ = _swig_repr
def __init__(self):
this = _Xdmf.new_XdmfElementData()
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _Xdmf.delete_XdmfElementData
__del__ = lambda self : None;
def SetReferenceElement(self, *args): return _Xdmf.XdmfElementData_SetReferenceElement(self, *args)
def GetReferenceElement(self): return _Xdmf.XdmfElementData_GetReferenceElement(self)
def SetCurrentXdmfElement(self, *args): return _Xdmf.XdmfElementData_SetCurrentXdmfElement(self, *args)
def GetCurrentXdmfElement(self): return _Xdmf.XdmfElementData_GetCurrentXdmfElement(self)
XdmfElementData_swigregister = _Xdmf.XdmfElementData_swigregister
XdmfElementData_swigregister(XdmfElementData)
XDMF_ATTRIBUTE_TYPE_NONE = _Xdmf.XDMF_ATTRIBUTE_TYPE_NONE
XDMF_ATTRIBUTE_TYPE_SCALAR = _Xdmf.XDMF_ATTRIBUTE_TYPE_SCALAR
XDMF_ATTRIBUTE_TYPE_VECTOR = _Xdmf.XDMF_ATTRIBUTE_TYPE_VECTOR
......
......@@ -238,7 +238,7 @@ if( Attribute ){
} else {
this->AttributeType = XDMF_ATTRIBUTE_TYPE_SCALAR;
}
delete [] Attribute;
free((void*)Attribute);
// PATCH September 09, Ian Curinton HR Wallingford Ltd.
Attribute = this->Get( "Units" );
......@@ -249,7 +249,7 @@ if( Attribute ){
this->Units = NULL;
}
// end patch
delete [] Attribute;
free((void*)Attribute);
Attribute = this->Get( "Active" );
this->Active = 0;
......@@ -258,7 +258,7 @@ if ( Attribute ){
this->Active = 1;
}
}
delete [] Attribute;
free((void*)Attribute);
Attribute = this->Get( "Center" );
if( Attribute ){
......@@ -266,7 +266,7 @@ if( Attribute ){
} else {
this->AttributeCenter = XDMF_ATTRIBUTE_CENTER_NODE;
}
delete [] Attribute;
free((void*)Attribute);
Attribute = this->Get( "Dimensions" );
if( Attribute ){
......@@ -280,14 +280,14 @@ if( Attribute ){
Attribute = this->DOM->Get( ValuesNode, "Dimensions" );
if(!Attribute){
XdmfErrorMessage("Dimensions of Attribute not set in XML or DataItem");
delete [] Attribute;
free((void*)Attribute);
return(XDMF_FAIL);
}else{
this->ShapeDesc->SetShapeFromString( Attribute );
}
}
if(!this->Name) this->SetName(GetUnique("Attribute_"));
delete [] Attribute;
free((void*)Attribute);
return( XDMF_SUCCESS );
}
......
......@@ -23,6 +23,7 @@
/* */
/*******************************************************************/
#include "XdmfDOM.h"
#include "XdmfElement.h"
#include <libxml/globals.h>
#include <libxml/parser.h>
......@@ -31,7 +32,6 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
XdmfDOM *HandleToXdmfDOM( XdmfConstString Source ){
XdmfObject *TempObj;
XdmfDOM *DOM;
......@@ -89,7 +89,27 @@ XdmfDOM::~XdmfDOM(){
if ( this->OutputFileName ) {
delete [] this->OutputFileName;
}
if(this->Doc) xmlFreeDoc((xmlDoc *)this->Doc);
if(this->Doc) this->FreeDoc(this->Doc);
}
void XdmfDOM::FreePrivateData(XdmfXmlNode node)
{
for(XdmfXmlNode currNode = node; currNode != NULL; currNode = currNode->next)
{
if(currNode->type == XML_ELEMENT_NODE)
{
delete (XdmfElementData*)currNode->_private;
}
FreePrivateData(currNode->children);
}
}
void XdmfDOM::FreeDoc(XdmfXmlDoc doc)
{
xmlNode* rootElement = xmlDocGetRootElement(doc);
this->FreePrivateData(rootElement);
xmlFreeDoc(doc);
xmlCleanupParser();
}
XdmfInt32
......@@ -273,7 +293,7 @@ if(inxml) {
if(pDoc){
if(parserOptions & XML_PARSE_XINCLUDE){
if (xmlXIncludeProcess(pDoc) < 0) {
xmlFreeDoc(pDoc);
this->FreeDoc(pDoc);
pDoc = NULL;
}
}
......@@ -291,7 +311,7 @@ XdmfXmlNode Node;
XdmfConstString Attribute;
// Remove Previous Data
if(this->Doc) xmlFreeDoc((xmlDoc *)this->Doc);
if(this->Doc) this->FreeDoc(this->Doc);
this->Tree = NULL;
Root = this->__Parse(inxml, &this->Doc);
......@@ -322,6 +342,7 @@ XdmfInt32
XdmfDOM::DeleteNode(XdmfXmlNode Node) {
if(!Node) return(XDMF_FAIL);
xmlUnlinkNode(Node);
this->FreePrivateData(Node);
xmlFreeNode(Node);
return(XDMF_SUCCESS);
}
......@@ -361,7 +382,7 @@ if(doc){
if(NewNode){
XdmfXmlNode Child;
Child = this->Insert(Parent, NewNode);
xmlFreeDoc(doc);
this->FreeDoc(doc);
return(Child);
}
return(NULL);
......@@ -400,6 +421,7 @@ if(Parent){
if(RealChild){
return(RealChild);
}
this->FreePrivateData(Child);
xmlFreeNode(Child);
}
}
......@@ -752,6 +774,7 @@ if( STRNCASECMP( Attribute, "CDATA", 5 ) == 0 ){
(child->type == XML_CDATA_SECTION_NODE)) {
// cout << "Deleting Node" << endl;
xmlUnlinkNode(child);
this->FreePrivateData(child);
xmlFreeNode(child);
}
child = next;
......
......@@ -262,6 +262,10 @@ XdmfXmlDoc Doc;
XdmfXmlNode Tree;
XdmfInt32 ParserOptions;
XdmfInt32 DTD;
void FreePrivateData(XdmfXmlNode node);
void FreeDoc(XdmfXmlDoc doc);
};
extern XDMF_EXPORT XdmfDOM *HandleToXdmfDOM( XdmfConstString Source );
......
......@@ -156,8 +156,8 @@ XdmfInt32 XdmfDataItem::UpdateInformationFunction(){
case XDMF_ITEM_COORDINATES :
break;
}
delete [] Value;
return(XDMF_SUCCESS);
delete Value;
return(XDMF_SUCCESS);
}
XdmfInt32 XdmfDataItem::UpdateInformationCollection(){
......@@ -174,7 +174,7 @@ XdmfInt32 XdmfDataItem::UpdateInformationUniform(){
Value = this->Get("Precision");
if(Value) Precision = atoi(Value);
delete [] Value;
free((void*)Value);
Value = this->Get("NumberType");
// Try DataType
if(!Value) Value = this->Get("DataType");
......@@ -204,7 +204,7 @@ XdmfInt32 XdmfDataItem::UpdateInformationUniform(){
this->DataDesc->SetNumberType(XDMF_FLOAT32_TYPE);
}
}
delete [] Value;
free((void*)Value);;
Value = this->Get("Format");
// Currently XML or HDF5
if(XDMF_WORD_CMP(Value, "HDF")){
......@@ -221,10 +221,10 @@ XdmfInt32 XdmfDataItem::UpdateInformationUniform(){
this->SetFormat(XDMF_FORMAT_BINARY);
}else if(Value){
XdmfErrorMessage("Unsupported DataItem Format :" << Value);
delete [] Value;
free((void*)Value);
return(XDMF_FAIL);
}
delete [] Value;
free((void*)Value);
return(XDMF_SUCCESS);
}
......@@ -241,10 +241,11 @@ XdmfInt32 XdmfDataItem::UpdateInformation(){
else
{
XdmfErrorMessage("invalid major");
delete [] Value;
free((void*)Value);
return(XDMF_FAIL);
}
}
free((void*)Value);
XdmfDebug("Major = " << this->ColumnMajor);
XdmfDebug("XdmfDataItem::UpdateInformation()");
......@@ -255,7 +256,6 @@ XdmfInt32 XdmfDataItem::UpdateInformation(){
// XdmfDebug("r = " << this->ReferenceElement << " e = " << this->Element);
// XdmfDebug(this->DOM->Serialize(this->ReferenceElement));
// Dtetermine type : Uniform, Collection, or Tree
delete [] Value;
Value = this->Get("ItemType");
if(!Value){
// Try Old "Type=XX" Style from Xdmf Version 1.0
......@@ -291,16 +291,17 @@ XdmfInt32 XdmfDataItem::UpdateInformation(){
break;
}
XdmfErrorMessage("Unknown DataItem Type = " << Value);
free((void*)Value);
return(XDMF_FAIL);
} while(0);
}
free((void*)Value);
if(this->GetIsReference() &&
(this->ReferenceElement != this->Element) &&
(this->GetReferenceObject(this->Element) != this)){
XdmfDebug("Reference DataItem Copied Info from another ReferenceObject");
return(XDMF_SUCCESS);
}
delete [] Value;
Value = this->Get("Dimensions");
if(!Value) {
XdmfErrorMessage("Dimensions are not set in XML Element");
......@@ -309,7 +310,7 @@ XdmfInt32 XdmfDataItem::UpdateInformation(){
}
if(!this->DataDesc) this->DataDesc = new XdmfDataDesc();
this->DataDesc->SetShapeFromString(Value);
delete [] Value;
free((void*)Value);;
switch(this->ItemType){
case XDMF_ITEM_UNIFORM :
return(this->UpdateInformationUniform());
......@@ -465,6 +466,7 @@ XdmfInt32 XdmfDataItem::UpdateFunction(){
if(Value && ReturnArray){
ReturnArray->ReformFromString(Value);
}
free((void*)Value);;
// If only a portion of the DataItem was requested
// the XdmfValues did not reflect this selection since
// DataDesc was used to select HyperSlad | Coordinates | Function
......
......@@ -32,20 +32,6 @@
#define XDMF_XML_PRIVATE_DATA(e) e->_private
class XDMF_EXPORT XdmfElementData : public XdmfObject {
public :
XdmfElementData();
~XdmfElementData();
XdmfSetValueMacro(ReferenceElement, XdmfElement *);
XdmfGetValueMacro(ReferenceElement, XdmfElement *);
XdmfSetValueMacro(CurrentXdmfElement, XdmfElement *);
XdmfGetValueMacro(CurrentXdmfElement, XdmfElement *);
protected :
XdmfElement *ReferenceElement;
XdmfElement *CurrentXdmfElement;
};
XdmfElementData::XdmfElementData(){
this->ReferenceElement = NULL;
this->CurrentXdmfElement = NULL;
......@@ -67,7 +53,6 @@ XdmfElement::XdmfElement() {
this->DataXml = 0;
this->InsertedDataXml = 0;
this->DeleteOnGridDelete = 0;
this->PrivateData = NULL;
}
XdmfElement::~XdmfElement() {
......@@ -84,29 +69,26 @@ XdmfElement::~XdmfElement() {
}
}
}
//if(this->PrivateData) delete (XdmfElementData*)this->PrivateData;
//this->PrivateData = NULL;
this->Element = NULL;
if(this->ElementName) delete [] this->ElementName;
if(this->DataXml) delete [] this->DataXml;
}
void XdmfElement::SetReferenceObject(XdmfXmlNode anElement, void *p){
XdmfElementData *ElementPrivateData;
XdmfElementData *PrivateData;
if(!anElement){
XdmfErrorMessage("Element is NULL");
return;
}
if(XDMF_XML_PRIVATE_DATA(anElement)){
ElementPrivateData = (XdmfElementData *)XDMF_XML_PRIVATE_DATA(anElement);
PrivateData = (XdmfElementData *)XDMF_XML_PRIVATE_DATA(anElement);
}else{
ElementPrivateData = new XdmfElementData;
XDMF_XML_PRIVATE_DATA(anElement) = (void *)ElementPrivateData;
this->PrivateData = ElementPrivateData;
PrivateData = new XdmfElementData;
XDMF_XML_PRIVATE_DATA(anElement) = (void *)PrivateData;
}
// XdmfDebug("Old Ref = " << ElementPrivateData->GetReferenceElement());
// XdmfDebug("New Ref = " << p);
ElementPrivateData->SetReferenceElement((XdmfElement *)p);
PrivateData->SetReferenceElement((XdmfElement *)p);
}
void *
......@@ -129,19 +111,18 @@ XdmfElement::GetReferenceObject(XdmfXmlNode anElement){
}
void XdmfElement::SetCurrentXdmfElement(XdmfXmlNode anElement, void *p){
XdmfElementData *ElementPrivateData;
XdmfElementData *PrivateData;
if(!anElement){
XdmfErrorMessage("Element is NULL");
return;
}
if(XDMF_XML_PRIVATE_DATA(anElement)){
ElementPrivateData = (XdmfElementData *)XDMF_XML_PRIVATE_DATA(anElement);
PrivateData = (XdmfElementData *)XDMF_XML_PRIVATE_DATA(anElement);
}else{
ElementPrivateData = new XdmfElementData;
XDMF_XML_PRIVATE_DATA(anElement) = (void *)ElementPrivateData;
this->PrivateData = ElementPrivateData;
PrivateData = new XdmfElementData;
XDMF_XML_PRIVATE_DATA(anElement) = (void *)PrivateData;
}
ElementPrivateData->SetCurrentXdmfElement((XdmfElement *)p);
PrivateData->SetCurrentXdmfElement((XdmfElement *)p);
}
void *
......@@ -252,7 +233,7 @@ XdmfInt32 XdmfElement::UpdateInformation(){
ref = this->CheckForReference(this->Element);
if(ref == (XdmfXmlNode)XDMF_ERROR_REFERENCE){
XdmfErrorMessage("Error Checking Reference");
delete [] Value;
free((void*)Value);
return(XDMF_FAIL);
}
if(ref){
......@@ -275,7 +256,7 @@ XdmfInt32 XdmfElement::UpdateInformation(){
// Copy out appropriate information and return
XdmfDebug("Copying Information from Reference Object");
this->Element = e->Element;
delete [] Value;
free((void*)Value);
return(this->Copy(e));
}
// No ReferenceObject Set. Is this a Reference as well?
......@@ -301,7 +282,7 @@ XdmfInt32 XdmfElement::UpdateInformation(){
XdmfDebug("Setting Reference Object");
this->SetReferenceObject(this->Element, this);
}
delete [] Value;
free((void*)Value);
this->State = XDMF_ELEMENT_STATE_LIGHT_PARSED;
return(XDMF_SUCCESS);
}
......
......@@ -208,6 +208,20 @@ protected:
XdmfDsmBuffer *DsmBuffer;
XdmfXmlNode RootWhenParsed;
XdmfInt32 DeleteOnGridDelete;
void *PrivateData;
};
class XDMF_EXPORT XdmfElementData : public XdmfObject {
public :
XdmfElementData();
~XdmfElementData();
XdmfSetValueMacro(ReferenceElement, XdmfElement *);
XdmfGetValueMacro(ReferenceElement, XdmfElement *);
XdmfSetValueMacro(CurrentXdmfElement, XdmfElement *);
XdmfGetValueMacro(CurrentXdmfElement, XdmfElement *);
protected :
XdmfElement *ReferenceElement;
XdmfElement *CurrentXdmfElement;
};
#endif // __XdmfElement_h
......@@ -47,12 +47,18 @@ XdmfGeometry::XdmfGeometry() {
this->SetDxDyDz( 0, 0, 0 );
this->LightDataLimit = 100;
this->Units = NULL; // Ian Curington, HR Wallingford Ltd.
this->VectorXIsMine = 0;
this->VectorYIsMine = 0;
this->VectorZIsMine = 0;
}
XdmfGeometry::~XdmfGeometry()
{
if( this->PointsAreMine && this->Points ) delete this->Points;
if(this->Units) delete [] this->Units; // Ian Curington, HR Wallingford Ltd.
if(this->VectorX && this->VectorXIsMine) delete this->VectorX;
if(this->VectorY && this->VectorYIsMine) delete this->VectorY;
if(this->VectorZ && this->VectorZIsMine) delete this->VectorZ;
}
XdmfInt32
......@@ -114,16 +120,19 @@ XdmfGeometry::Build(){
di->SetArray(this->VectorX);
if(this->VectorX->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
delete di;
// Vy
di = this->GetDataItem(1, this->GetElement());
di->SetArray(this->VectorY);
if(this->VectorY->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
delete di;
// Vx
di = this->GetDataItem(2, this->GetElement());
di->SetArray(this->VectorZ);
if(this->VectorZ->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
delete di;
break;
case XDMF_GEOMETRY_VXVY:
if(!this->VectorX || !this->VectorY){
......@@ -135,11 +144,13 @@ XdmfGeometry::Build(){
di->SetArray(this->VectorX);
if(this->VectorX->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
delete di;
// Vy
di = this->GetDataItem(1, this->GetElement());
di->SetArray(this->VectorY);
if(this->VectorY->GetNumberOfElements() > this->LightDataLimit) di->SetFormat(XDMF_FORMAT_HDF);
di->Build();
delete di;
break;
case XDMF_GEOMETRY_ORIGIN_DXDYDZ:
// Origin
......@@ -150,6 +161,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(3);
array->SetValues(0, this->Origin, 3);
di->Build();
delete di;
// DxDyDz
di = this->GetDataItem(1, this->GetElement());
di->SetFormat(XDMF_FORMAT_XML);
......@@ -158,6 +170,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(3);
array->SetValues(0, this->DxDyDz, 3);
di->Build();
delete di;
break;
case XDMF_GEOMETRY_ORIGIN_DXDY:
// Origin
......@@ -168,6 +181,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(2);
array->SetValues(0, this->Origin, 2);
di->Build();
delete di;
// DxDy
di = this->GetDataItem(1, this->GetElement());
di->SetFormat(XDMF_FORMAT_XML);
......@@ -176,6 +190,7 @@ XdmfGeometry::Build(){
array->SetNumberOfElements(2);
array->SetValues(0, this->DxDyDz, 2);
di->Build();
delete di;
break;
case XDMF_GEOMETRY_NONE:
break;
......@@ -361,7 +376,7 @@ XdmfGeometry::UpdateInformation() {
this->Units = NULL;
}
// end patch
delete [] Attribute;
free((void*)Attribute);
Attribute = this->Get( "GeometryType" );
if(!Attribute){
Attribute = this->Get( "Type" );
......@@ -369,14 +384,14 @@ XdmfGeometry::UpdateInformation() {
if( Attribute ){
if(this->SetGeometryTypeFromString( Attribute ) != XDMF_SUCCESS){
XdmfErrorMessage("No such Geometry Type : " << Attribute);
delete [] Attribute;
free((void*)Attribute);
return(XDMF_FAIL);
}
} else {
this->GeometryType = XDMF_GEOMETRY_XYZ;
}
if(!this->Name) this->SetName(GetUnique("Geometry_"));
delete[] Attribute;
free((void*)Attribute);
return( XDMF_SUCCESS );
}
......@@ -565,6 +580,7 @@ XdmfGeometry::Update() {
return(XDMF_FAIL);
}
this->VectorX = TmpArray;
this->VectorXIsMine = 1;
PointsItem.SetArrayIsMine(0);
} else {
XdmfErrorMessage("No VectorX Specified");
......@@ -583,6 +599,7 @@ XdmfGeometry::Update() {
return(XDMF_FAIL);
}
this->VectorY = TmpArray;
this->VectorYIsMine = 1;
PointsItem.SetArrayIsMine(0);
} else {
XdmfErrorMessage("No VectorY Specified");
......@@ -601,6 +618,7 @@ XdmfGeometry::Update() {
return(XDMF_FAIL);
}
this->VectorZ = TmpArray;
this->VectorZIsMine = 1;
PointsItem.SetArrayIsMine(0);
} else {
XdmfErrorMessage("No VectorZ Specified");
......@@ -621,6 +639,7 @@ XdmfGeometry::Update() {
return(XDMF_FAIL);
}
this->VectorX = TmpArray;
this->VectorXIsMine = 1;
PointsItem.SetArrayIsMine(0);
} else {
XdmfErrorMessage("No VectorX Specified");
......@@ -639,6 +658,7 @@ XdmfGeometry::Update() {
return(XDMF_FAIL);
}
this->VectorY = TmpArray;
this->VectorYIsMine = 1;
PointsItem.SetArrayIsMine(0);
} else {
XdmfErrorMessage("No VectorY Specified");
......
......@@ -145,9 +145,9 @@ XDMF_GEOMETRY_ORIGIN_DXDYDZ : Xorigin, Yorigin, Zorigin, Dx, Dy, Dz
XdmfArray *GetVectorX( void ) { return( this->VectorX ); };
XdmfArray *GetVectorY( void ) { return( this->VectorY ); };
XdmfArray *GetVectorZ( void ) { return( this->VectorZ ); };
void SetVectorX( XdmfArray *Array ) { this->VectorX = Array; };
void SetVectorY( XdmfArray *Array ) { this->VectorY = Array; };
void SetVectorZ( XdmfArray *Array ) { this->VectorZ = Array; };
void SetVectorX( XdmfArray *Array, XdmfBoolean isMine = 0) { this->VectorX = Array; this->VectorXIsMine = isMine;};
void SetVectorY( XdmfArray *Array, XdmfBoolean isMine = 0 ) { this->VectorY = Array; this->VectorYIsMine = isMine;};
void SetVectorZ( XdmfArray *Array, XdmfBoolean isMine = 0 ) { this->VectorZ = Array; this->VectorZIsMine = isMine;};
XdmfInt32 HasData( void ) {
if ( this->Points || ( this->VectorX && this->VectorY && this->VectorZ )){
......@@ -170,6 +170,9 @@ protected:
XdmfArray *VectorY;
XdmfArray *VectorZ;
XdmfString Units; // Ian Curington, HR Wallingford Ltd.
XdmfBoolean VectorXIsMine;
XdmfBoolean VectorYIsMine;
XdmfBoolean VectorZIsMine;
};
extern XDMF_EXPORT XdmfGeometry *GetXdmfGeometryHandle( void *Pointer );
......
......@@ -383,6 +383,7 @@ if( XDMF_WORD_CMP(this->GetElementType(), "Grid") == 0){
attribute = this->Get("GridType");
if(!attribute) attribute = this->Get("Type");
if( XDMF_WORD_CMP(attribute, "Collection") ){
free((void*)attribute);
this->GridType = XDMF_GRID_COLLECTION;
attribute = this->Get("CollectionType");
if(attribute){
......@@ -401,13 +402,13 @@ if( XDMF_WORD_CMP(attribute, "Collection") ){
}else{
if(attribute){
XdmfErrorMessage("Unknown Grid Type " << attribute);
delete [] attribute;
free((void*)attribute);
return(XDMF_FAIL);
}
// If Type is NULL use default
this->GridType = XDMF_GRID_UNIFORM;
}
delete [] attribute;
free((void*)attribute);
if( this->GridType & XDMF_GRID_MASK){
// SubSet Tree or Collection
XdmfInt32 i, nchild;
......@@ -445,12 +446,25 @@ if( this->GridType & XDMF_GRID_MASK){
return(XDMF_FAIL);
}
this->Children[i] = new XdmfGrid;
if(this->Children[i]->SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
if(this->Children[i]->SetElement(node) == XDMF_FAIL) return(XDMF_FAIL);
this->Children[i]->SetDeleteOnGridDelete(true);
if(this->Children[i]->SetDOM(this->DOM) == XDMF_FAIL) {
delete this->Children[i];
return(XDMF_FAIL);
}
if(this->Children[i]->SetElement(node) == XDMF_FAIL) {
delete this->Children[i];
return(XDMF_FAIL);