Salome HOME
SMESH_Gen::Adaptation() implementation for HOMARD
authorjfa <jfa@opencascade.com>
Wed, 15 Dec 2021 15:17:01 +0000 (18:17 +0300)
committerjfa <jfa@opencascade.com>
Wed, 15 Dec 2021 15:17:01 +0000 (18:17 +0300)
idl/SMESH_Gen.idl
src/SMESH_I/MG_ADAPT_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Homard_i.cxx

index 595f4eec39534c79f7d89864b1b08221711906c3..b99a8dd16674922df5a902e7e63f847ab91166ba 100644 (file)
@@ -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();
   };
 
index 02415c69e4c405759eb56d6d91467d2d0d68ee3f..9ec13d658726c6a277d164cde23928eee549da0b 100644 (file)
@@ -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();
 }
 //=============================================================================
index 64ccdf1d000f4945c2bac6be39de074a2a60414a..fd17647fa14dd7153eb01b8b18934f49fce05f49 100644 (file)
@@ -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
index f547f276246f1f0e19a78c156fd4259e95010531..d3f58085a547dba7f71fd6991ff1341038b85991 100644 (file)
@@ -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");
 }
 
 //=============================================================================