From a16cda24fdf7cdee6c6e8c6291a76ac3066a827f Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 20 Dec 2021 17:08:59 +0300 Subject: [PATCH] Debug --- idl/SMESH_Gen.idl | 4 ++-- src/SMESHGUI/CMakeLists.txt | 6 +++--- src/SMESHGUI/SMESHGUI.cxx | 17 +++++++++++++---- ...RD_msg_en.ts => SMESHGUI_Homard_msg_en.ts} | 2 +- ...RD_msg_fr.ts => SMESHGUI_Homard_msg_fr.ts} | 0 ...RD_msg_ja.ts => SMESHGUI_Homard_msg_ja.ts} | 0 src/SMESH_I/MG_ADAPT_i.cxx | 10 ++++------ src/SMESH_I/SMESH_Homard_i.cxx | 19 +++++++++++++++---- 8 files changed, 38 insertions(+), 20 deletions(-) rename src/SMESHGUI/{HOMARD_msg_en.ts => SMESHGUI_Homard_msg_en.ts} (99%) rename src/SMESHGUI/{HOMARD_msg_fr.ts => SMESHGUI_Homard_msg_fr.ts} (100%) rename src/SMESHGUI/{HOMARD_msg_ja.ts => SMESHGUI_Homard_msg_ja.ts} (100%) diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index b99a8dd16..532c86122 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -586,9 +586,9 @@ module SMESH in double theTolerance ); MG_ADAPT CreateMG_ADAPT(); - SMESHHOMARD::HOMARD_Gen CreateHOMARD_ADAPT(); + SMESHHOMARD::HOMARD_Gen CreateHOMARD_ADAPT() raises ( SALOME::SALOME_Exception ); //MG_ADAPT_OBJECT Adaptation(in string adaptType); - SALOME::GenericObj Adaptation(in string adaptType); + SALOME::GenericObj Adaptation(in string adaptType) raises ( SALOME::SALOME_Exception ); MG_ADAPT CreateAdaptationHypothesis(); }; diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index 267188814..30179b73a 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -288,9 +288,9 @@ SET(_ts_RESOURCES SMESH_msg_en.ts SMESH_msg_fr.ts SMESH_msg_ja.ts - HOMARD_msg_en.ts - HOMARD_msg_fr.ts - HOMARD_msg_ja.ts + SMESHGUI_Homard_msg_en.ts + SMESHGUI_Homard_msg_fr.ts + SMESHGUI_Homard_msg_ja.ts ) # --- rules --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index d07a85fd4..b4d8a6385 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -3023,10 +3023,19 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) break; EmitSignalDeactivateDialog(); - SALOME::GenericObj_wrap< SMESHHOMARD::HOMARD_Gen > homardGen = - GetSMESHGen()->CreateHOMARD_ADAPT(); - SMESHGUI_HomardAdaptDlg *aDlg = new SMESHGUI_HomardAdaptDlg(homardGen); - aDlg->show(); + SALOME::GenericObj_wrap< SMESHHOMARD::HOMARD_Gen > homardGen; + try { + homardGen = GetSMESHGen()->CreateHOMARD_ADAPT(); + } + catch ( const SALOME::SALOME_Exception& S_ex ) { + SUIT_MessageBox::critical(SMESHGUI::desktop(), + QObject::tr("SMESH_ERROR"), + QObject::tr(S_ex.details.text.in())); + } + if (!homardGen->_is_nil()) { + SMESHGUI_HomardAdaptDlg *aDlg = new SMESHGUI_HomardAdaptDlg(homardGen); + aDlg->show(); + } break; } // Adaptation - end diff --git a/src/SMESHGUI/HOMARD_msg_en.ts b/src/SMESHGUI/SMESHGUI_Homard_msg_en.ts similarity index 99% rename from src/SMESHGUI/HOMARD_msg_en.ts rename to src/SMESHGUI/SMESHGUI_Homard_msg_en.ts index d3352b29a..e1ebe2ec9 100644 --- a/src/SMESHGUI/HOMARD_msg_en.ts +++ b/src/SMESHGUI/SMESHGUI_Homard_msg_en.ts @@ -1,6 +1,6 @@ - + @default diff --git a/src/SMESHGUI/HOMARD_msg_fr.ts b/src/SMESHGUI/SMESHGUI_Homard_msg_fr.ts similarity index 100% rename from src/SMESHGUI/HOMARD_msg_fr.ts rename to src/SMESHGUI/SMESHGUI_Homard_msg_fr.ts diff --git a/src/SMESHGUI/HOMARD_msg_ja.ts b/src/SMESHGUI/SMESHGUI_Homard_msg_ja.ts similarity index 100% rename from src/SMESHGUI/HOMARD_msg_ja.ts rename to src/SMESHGUI/SMESHGUI_Homard_msg_ja.ts diff --git a/src/SMESH_I/MG_ADAPT_i.cxx b/src/SMESH_I/MG_ADAPT_i.cxx index 9ec13d658..7950f58dd 100644 --- a/src/SMESH_I/MG_ADAPT_i.cxx +++ b/src/SMESH_I/MG_ADAPT_i.cxx @@ -18,7 +18,8 @@ // #include "MG_ADAPT_i.hxx" -#include "SMESH_Homard_i.hxx" + +#include CORBA_SERVER_HEADER(SMESH_Homard) #include "MG_ADAPT.hxx" #include "SMESH_File.hxx" @@ -126,11 +127,8 @@ SALOME::GenericObj_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) return anObj._retn(); } #endif - if (!strcmp(adaptationType, "Uniform")) - { - SMESHHOMARD_I::HOMARD_Gen_i* homard_adapt = new SMESHHOMARD_I::HOMARD_Gen_i(); - SMESHHOMARD::HOMARD_Gen_var anObj = homard_adapt->_this(); - return anObj._retn(); + if (!strcmp(adaptationType, "Uniform")) { + return CreateHOMARD_ADAPT(); } return SMESH::MG_ADAPT_OBJECT_ptr(); } diff --git a/src/SMESH_I/SMESH_Homard_i.cxx b/src/SMESH_I/SMESH_Homard_i.cxx index 556869c34..0c80e0f0f 100644 --- a/src/SMESH_I/SMESH_Homard_i.cxx +++ b/src/SMESH_I/SMESH_Homard_i.cxx @@ -65,6 +65,15 @@ using namespace std; SMESHHOMARD::HOMARD_Gen_ptr SMESH_Gen_i::CreateHOMARD_ADAPT() { + if (getenv("HOMARD_ROOT_DIR") == NULL) { + THROW_SALOME_CORBA_EXCEPTION("HOMARD_ROOT_DIR is not defined", SALOME::INTERNAL_ERROR); + } + else { + std::string homard_exec = getenv("HOMARD_ROOT_DIR"); + homard_exec += "/bin/salome/homard"; + if (!SMESH_File(homard_exec).exists()) + THROW_SALOME_CORBA_EXCEPTION("HOMARD module is not built", SALOME::INTERNAL_ERROR); + } SMESHHOMARD_I::HOMARD_Gen_i* aHomardGen = new SMESHHOMARD_I::HOMARD_Gen_i(); SMESHHOMARD::HOMARD_Gen_var anObj = aHomardGen->_this(); return anObj._retn(); @@ -1841,10 +1850,12 @@ CORBA::Long HOMARD_Gen_i::Compute() void HOMARD_Gen_i::CleanCase() { // Delete log file, if required - MESSAGE("myIteration1->GetLogFile() = " << myIteration1->GetLogFile()); - if (_LogInFile && _RemoveLogOnSuccess) { - // Remove log file on success - SMESH_File(myIteration1->GetLogFile(), false).remove(); + if (!myIteration1->_is_nil()) { + MESSAGE("myIteration1->GetLogFile() = " << myIteration1->GetLogFile()); + if (_LogInFile && _RemoveLogOnSuccess) { + // Remove log file on success + SMESH_File(myIteration1->GetLogFile(), false).remove(); + } } // Delete all boundaries -- 2.39.2