]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Update C++ code consecutive to API modification of ReadField SHAPER_2.7.0 V8_3_0a2 V8_3_0b1
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 9 Mar 2017 09:31:43 +0000 (10:31 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 9 Mar 2017 09:31:43 +0000 (10:31 +0100)
src/MEDCalc/cmp/MEDDataManager_i.cxx
src/MEDCalculator/MEDCalculatorBrowserField.cxx
src/MEDCalculator/MEDCalculatorDBSliceField.cxx

index a3f9371751e156ff7a7987818b1e03b97267daca..b3ef305456c7eea54dcafc6cf574d4c4abdae4b9 100644 (file)
@@ -641,7 +641,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDCALC::FieldHa
   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,
@@ -649,7 +649,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDCALC::FieldHa
                 fieldHandler->iteration,
                 fieldHandler->order);
   myField->setMesh(myMesh);
-  _fieldDoubleMap[fieldHandler->id] = myField;
+  _fieldDoubleMap[fieldHandler->id] = myField.retn();
   return myField;
 }
 
index 6609186a4e46f5c35ded3f0b0be437bfa054976c..ff8a351d05a18d5ef12ffa4f974ab9d249c8f643 100644 (file)
@@ -60,7 +60,7 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch
   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);
@@ -80,7 +80,6 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch
         c="-noname-";
       _components.push_back(c);
     }
-  tmpf->decrRef();
   _corresponding_meshes=GetMeshNamesOnField(fname,fieldName);
 }
 
index 0a0327a7633caf52f0d3ec4c4231ec46b3ec8daf..e2d6e663186db78a59cc50e04d4eda11f791e961 100644 (file)
@@ -95,7 +95,10 @@ MEDCalculatorDBSliceField::~MEDCalculatorDBSliceField()
 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;
 }