-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
std::vector<TypeOfField> types=GetTypesOfField(fname,meshNames[0].c_str(),fieldName);
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...");
+ throw INTERP_KERNEL::Exception("MEDCalculatorBrowserField::MEDCalculatorBrowserField : the file is not loadable using MED File 3 API ! Probably 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);
+ MCAuto<MEDCouplingField> tmpf2(ReadField(_type,fname,meshNames[0].c_str(),0,fieldName,dtits[0].first.first,dtits[0].first.second));
+ tmpf=DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(tmpf2);
}
catch(INTERP_KERNEL::Exception& e)
{
if(_type==ON_CELLS)
- tmpf=ReadField(_type,fname,meshNames[0].c_str(),-1,fieldName,dtits[0].first.first,dtits[0].first.second);
+ {
+ MCAuto<MEDCouplingField> tmpf2(ReadField(_type,fname,meshNames[0].c_str(),-1,fieldName,dtits[0].first.first,dtits[0].first.second));
+ tmpf=DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(tmpf2);
+ }
else
throw e;
}
c="-noname-";
_components.push_back(c);
}
- tmpf->decrRef();
_corresponding_meshes=GetMeshNamesOnField(fname,fieldName);
}