Salome HOME
Fix compilation error due API modification (returned type) of ReadField
[modules/med.git] / src / MEDCalculator / MEDCalculatorBrowserField.cxx
index ff8a351d05a18d5ef12ffa4f974ab9d249c8f643..e26b1d35909e3a5094cf2116abf3e3634f8b949e 100644 (file)
@@ -58,17 +58,21 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch
     }
   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
   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;
     }