diff --git a/idl/MG_ADAPT.idl b/idl/MG_ADAPT.idl index 6a4c7c983..7608ab67a 100644 --- a/idl/MG_ADAPT.idl +++ b/idl/MG_ADAPT.idl @@ -122,8 +122,7 @@ module SMESH{ void setSizeMapType(in string f); boolean setAll(); string getCommandToRun() ; - //long compute(out string errStr); - long compute(); + void compute() raises(SALOME::SALOME_Exception); string getErrMsg(); string getFileName() ; string getExeName(); diff --git a/src/SMESH/MG_ADAPT.cxx b/src/SMESH/MG_ADAPT.cxx index c3e95da76..f0accd50d 100644 --- a/src/SMESH/MG_ADAPT.cxx +++ b/src/SMESH/MG_ADAPT.cxx @@ -1244,9 +1244,7 @@ void MgAdapt::checkTimeStepRank(std::string fileIn) { bool ret = false ; MEDCoupling::MCAuto mfd = MEDCoupling::MEDFileData::New(fileIn); - MEDCoupling::MCAuto fts = dynamic_cast( mfd->getFields()->getFieldWithName(fieldName) ); -// std::cout << "--- timeStep " << timeStep << std::endl; -// std::cout << "--- rank " << rank << std::endl; + MEDCoupling::MCAuto fts( mfd->getFields()->getFieldWithName(fieldName) ); std::vector timevalue; std::vector< std::pair > timesteprank = fts->getTimeSteps(timevalue); std::size_t jaux(timesteprank.size()); @@ -1299,7 +1297,7 @@ void MgAdapt::convertMedFile(std::string& meshFormatMeshFileName, std::string& s { checkFieldName(medFileIn) ; checkTimeStepRank(medFileIn) ; - MEDCoupling::MCAuto fts = dynamic_cast( mfd->getFields()->getFieldWithName(fieldName) ); + MEDCoupling::MCAuto fts( mfd->getFields()->getFieldWithName(fieldName) ); MEDCoupling::MCAuto f = fts->getTimeStep(timeStep, rank); MEDCoupling::MCAuto tmFts = MEDCoupling::MEDFileFieldMultiTS::New(); tmFts->pushBackTimeStep(f); @@ -1438,8 +1436,8 @@ void MgAdapt::buildBackGroundMeshAndSolFiles(const std::vector& fie { MEDCoupling::MCAuto tmpMfd = MEDCoupling::MEDFileData::New(sizeMapFile); MEDCoupling::MEDFileFields* tmpFields = tmpMfd->getFields(); - MEDCoupling::MEDFileAnyTypeFieldMultiTS* fts = tmpFields->getFieldWithName(fieldName); - MEDCoupling::MCAuto fts1 = dynamic_cast(fts); + MEDCoupling::MCAuto fts( tmpFields->getFieldWithName(fieldName) ); + MEDCoupling::MCAuto fts1 = MEDCoupling::DynamicCastSafe(fts); MEDCoupling::MCAuto f = fts1->getTimeStep(timeStep, rank); MEDCoupling::MCAuto tmFts = MEDCoupling::MEDFileFieldMultiTS::New(); tmFts->pushBackTimeStep(f); diff --git a/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx b/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx index fc1496380..d3bed87fd 100644 --- a/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx +++ b/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.cxx @@ -385,12 +385,12 @@ bool SMESHGUI_MG_ADAPTDRIVER::PushOnApply() bool SMESHGUI_MG_ADAPTDRIVER::execute() { - int err; - //~std::string errStr; + int err = 1; char* errStr; try { - err = getModel()->compute(); + getModel()->compute(); + err = 0; errStr = getModel()->getErrMsg(); std::string msg = err == 0 ? " ok" : std::string("Not ok \n")+CORBA::string_dup(errStr) ; } @@ -398,7 +398,7 @@ bool SMESHGUI_MG_ADAPTDRIVER::execute() { std::cerr<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<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() { @@ -510,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() diff --git a/src/SMESH_I/MG_ADAPT_i.hxx b/src/SMESH_I/MG_ADAPT_i.hxx index b25953175..edc398d07 100644 --- a/src/SMESH_I/MG_ADAPT_i.hxx +++ b/src/SMESH_I/MG_ADAPT_i.hxx @@ -109,8 +109,7 @@ public: bool setAll(); char* getCommandToRun() ; - //~CORBA::Long compute(::CORBA::String_out errStr); - CORBA::Long compute(); + void compute(); char* getFileName(); char* getExeName(); void copyMgAdaptHypothesisData( const SMESH::MgAdaptHypothesisData& data ) ;