From: jfa Date: Wed, 15 Dec 2021 15:17:01 +0000 (+0300) Subject: SMESH_Gen::Adaptation() implementation for HOMARD X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a60c339d7740e777b7b7bfeaaad86e32dc423693;p=modules%2Fsmesh.git SMESH_Gen::Adaptation() implementation for HOMARD --- diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index 595f4eec3..b99a8dd16 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -587,7 +587,8 @@ module SMESH MG_ADAPT CreateMG_ADAPT(); SMESHHOMARD::HOMARD_Gen CreateHOMARD_ADAPT(); - MG_ADAPT_OBJECT Adaptation(in string adaptType); + //MG_ADAPT_OBJECT Adaptation(in string adaptType); + SALOME::GenericObj Adaptation(in string adaptType); MG_ADAPT CreateAdaptationHypothesis(); }; diff --git a/src/SMESH_I/MG_ADAPT_i.cxx b/src/SMESH_I/MG_ADAPT_i.cxx index 02415c69e..9ec13d658 100644 --- a/src/SMESH_I/MG_ADAPT_i.cxx +++ b/src/SMESH_I/MG_ADAPT_i.cxx @@ -18,6 +18,7 @@ // #include "MG_ADAPT_i.hxx" +#include "SMESH_Homard_i.hxx" #include "MG_ADAPT.hxx" #include "SMESH_File.hxx" @@ -114,7 +115,8 @@ SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateAdaptationHypothesis() return SMESH::MG_ADAPT_ptr(); #endif } -SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) +//SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) +SALOME::GenericObj_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) { #ifndef DISABLE_MG_ADAPT if (!strcmp(adaptationType, "MG_Adapt")) @@ -124,6 +126,12 @@ SMESH::MG_ADAPT_OBJECT_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(); + } return SMESH::MG_ADAPT_OBJECT_ptr(); } //============================================================================= diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 64ccdf1d0..fd17647fa 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -479,7 +479,8 @@ public: SMESH::MG_ADAPT_ptr CreateMG_ADAPT(); SMESHHOMARD::HOMARD_Gen_ptr CreateHOMARD_ADAPT(); SMESH::MG_ADAPT_ptr CreateAdaptationHypothesis(); - SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType); + //SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType); + SALOME::GenericObj_ptr Adaptation( const char* adaptationType); // ***************************************** // Internal methods diff --git a/src/SMESH_I/SMESH_Homard_i.cxx b/src/SMESH_I/SMESH_Homard_i.cxx index f547f2762..d3f58085a 100644 --- a/src/SMESH_I/SMESH_Homard_i.cxx +++ b/src/SMESH_I/SMESH_Homard_i.cxx @@ -1905,7 +1905,7 @@ CORBA::Long HOMARD_Gen_i::ComputeAdap(SMESHHOMARD::HOMARD_Cas_var myCase, fclose(file); // CleanOption = 0 : report an error if output mesh file exists // CleanOption = 1 : destruction du répertoire d'execution - int CleanOption = 0; + int CleanOption = 1; if (CleanOption == 0) { SALOME::ExceptionStruct es; es.type = SALOME::BAD_PARAM; @@ -2541,13 +2541,22 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) // //SMESH::SMESH_Gen_var aSmeshEngine = this->retrieveSMESHInst(); SMESH_Gen_i* aSmeshEngine = SMESH_Gen_i::GetSMESHGen(); + MESSAGE(" *** aaajfa *** !!! 1"); // //ASSERT(!CORBA::is_nil(aSmeshEngine)); aSmeshEngine->UpdateStudy(); SMESH::DriverMED_ReadStatus theStatus; // On met a jour les attributs AttributeExternalFileDef et AttributePixMap + MESSAGE(" *** aaajfa *** !!! 2"); SMESH::mesh_array* mesMaillages = aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); + MESSAGE(" *** aaajfa *** !!! 3"); + if (CORBA::is_nil(aSmeshSO)) { + aSmeshSO = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindComponent("SMESH"); + if (CORBA::is_nil(aSmeshSO)) return; + } + MESSAGE(" *** aaajfa *** !!! 4"); + for (int i = 0; i < (int)mesMaillages->length(); i++) { MESSAGE(". Mise a jour des attributs du maillage"); SMESH::SMESH_Mesh_var monMaillage = (*mesMaillages)[i]; @@ -2569,6 +2578,7 @@ void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich, CORBA::Long Option) else { icone = "mesh_tree_mesh.png"; } anAttr2->SetPixMap(icone); } + MESSAGE(" *** aaajfa *** !!! 5"); } //=============================================================================