LOG("getFieldDouble: field "<<fieldHandler->fieldname<<" loaded from file "<<filepath);
TypeOfField type = (TypeOfField)fieldHandler->type;
int meshDimRelToMax = 0;
- MEDCouplingFieldDouble * myField = ReadField(type,
+ MCAuto<MEDCouplingFieldDouble> myField = ReadField(type,
filepath,
meshName,
meshDimRelToMax,
fieldHandler->iteration,
fieldHandler->order);
myField->setMesh(myMesh);
- _fieldDoubleMap[fieldHandler->id] = myField;
+ _fieldDoubleMap[fieldHandler->id] = myField.retn();
return myField;
}
if(types.empty())
throw INTERP_KERNEL::Exception("MEDCalculatorBrowserField::MEDCalculatorBrowserField : the file is not loadable using MED File 3 API ! Problably presence of field on edges faces...");
_type=types[0];//To improve
- MEDCouplingFieldDouble *tmpf=0;
+ MCAuto<MEDCouplingFieldDouble> tmpf;
try
{
tmpf=ReadField(_type,fname,meshNames[0].c_str(),0,fieldName,dtits[0].first.first,dtits[0].first.second);
c="-noname-";
_components.push_back(c);
}
- tmpf->decrRef();
_corresponding_meshes=GetMeshNamesOnField(fname,fieldName);
}
MEDCouplingFieldDouble *MEDCalculatorDBSliceField::getField(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const
{
if(!_field)
- _field=ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order);
+ {
+ MCAuto<MEDCouplingFieldDouble> tmp(ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order));
+ _field=tmp.retn();
+ }
return _field;
}