Salome HOME
#23999 EDF 22760 - integration of dev in SMESH (from branch 'gni/adaptation')
[modules/smesh.git] / src / SMESH_I / MG_ADAPT_i.cxx
index ec2c9d30d53489664f7ce1a2d83246c777feaa8e..188a3523659271c089883d98bd624d1a446f84dd 100644 (file)
 //
 
 #include "MG_ADAPT_i.hxx"
-//~#include "ADAPT_Gen_i.hxx"
+
 #include "string.h"
 #include "SMESH_Gen_i.hxx"
 #include <SMESH_Gen.hxx>
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOMEDS)
-//~#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
-//~#include CORBA_CLIENT_HEADER(SMESH_Gen)
 
 
 //=============================================================================
@@ -374,34 +372,25 @@ char* MG_ADAPT_i::getCommandToRun()
   return CORBA::string_dup(myMgAdapt->getCommandToRun().c_str());
 }
 
-//~CORBA::Long MG_ADAPT_i::compute(::CORBA::String_out errStr)
-//~{
-  //~std::string err("");
-  //~CORBA::Long ret = myMgAdapt->compute(err);
-  //~errStr =  err.c_str();
-  //~return ret;
-//~}
-CORBA::Long MG_ADAPT_i::compute()
+void MG_ADAPT_i::compute()
 {
   errStr = "";
-  CORBA::Long ret;
   try
   {
-    ret = myMgAdapt->compute(errStr);
+    myMgAdapt->compute(errStr);
   }
   catch (const std::exception& e)
   {
-    std::cerr<<e.what();
-    ret = -1;
+    std::ostringstream oss; oss << "Exception thrown on MG_ADAPT_i::compute invocation with error message \"" << errStr
+                << "\" with exception message \"" << e.what() << "\"";
+               THROW_SALOME_CORBA_EXCEPTION(oss.str().c_str(),SALOME::INTERNAL_ERROR);
   }
-  if(ret!=-1 && myMgAdapt->getPublish())
+  if(myMgAdapt->getPublish())
   {
     SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
     SMESH::DriverMED_ReadStatus theStatus;
     smeshGen_i->CreateMeshesFromMED(myMgAdapt->getMedFileOut().c_str(), theStatus);
   }
-  //~errStr =  err.c_str();
-  return ret;
 }
 char* MG_ADAPT_i::getErrMsg()
 {
@@ -512,7 +501,8 @@ CORBA::Long MG_ADAPT_OBJECT_i::Compute(bool publish)
     return -1;
   }
   hypothesis->setPublish(publish);
-  return hypothesis->compute();
+  hypothesis->compute();
+  return 0;
 }
 
 bool MG_ADAPT_OBJECT_i::checkMeshFileIn()