Salome HOME
Merge remote-tracking branch 'origin/abn/configuration'
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis_i.cxx
index 5b8466b1175364004879b62262305f2eabb3e99c..dd3239f6c4f2d6ebb419d53f7e48aa3f60901e4e 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2004-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2004-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -44,9 +44,8 @@
 // #include <SALOMEconfig.h>
 // #include CORBA_SERVER_HEADER(SALOMEDS)
 
-#ifndef GHS3D_VERSION
-#define GHS3D_VERSION 41
-#endif
+using namespace std;
+
 //=======================================================================
 //function : GHS3DPlugin_Hypothesis_i
 //=======================================================================
@@ -93,11 +92,32 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
   return this->GetImpl()->GetToMeshHoles();
 }
 
+//=======================================================================
+//function : SetToMakeGroupsOfDomains
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
+  SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
+}
+
+//=======================================================================
+//function : GetToMakeGroupsOfDomains
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetToMakeGroupsOfDomains();
+}
+
 //=======================================================================
 //function : SetMaximumMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Short MB)
+void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB)
    throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
@@ -111,7 +131,7 @@ void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Short MB)
 //function : GetMaximumMemory
 //=======================================================================
 
-CORBA::Short GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
+CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetMaximumMemory();
@@ -121,7 +141,7 @@ CORBA::Short GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 //function : SetInitialMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Short MB)
+void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB)
   throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
@@ -135,7 +155,7 @@ void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Short MB)
 //function : GetInitialMemory
 //=======================================================================
 
-CORBA::Short GHS3DPlugin_Hypothesis_i::GetInitialMemory()
+CORBA::Long GHS3DPlugin_Hypothesis_i::GetInitialMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetInitialMemory();
@@ -340,8 +360,8 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
 void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
 {
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetTextOption(option);
-  SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
+  this->GetImpl()->SetAdvancedOption(option);
+  SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
 }
 
 //=======================================================================
@@ -351,7 +371,93 @@ void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
 char* GHS3DPlugin_Hypothesis_i::GetTextOption()
 {
   ASSERT(myBaseImpl);
-  return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
+  return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
+}
+
+//=======================================================================
+//function : SetAdvancedOption
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetAdvancedOption(const char* option)
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetAdvancedOption(option);
+  SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
+}
+
+//=======================================================================
+//function : GetAdvancedOption
+//=======================================================================
+
+char* GHS3DPlugin_Hypothesis_i::GetAdvancedOption()
+{
+  ASSERT(myBaseImpl);
+  return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
+}
+
+//=======================================================================
+//function : SetToRemoveCentralPoint
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
+{
+  ASSERT(myBaseImpl);
+  if (gradation != GetGradation()) {
+    this->GetImpl()->SetGradation(gradation);
+    SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
+  }
+}
+
+//=======================================================================
+//function : GetToRemoveCentralPoint
+//=======================================================================
+
+CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetGradation();
+}
+
+//=======================================================================
+//function : SetStandardOutputLog
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
+  SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
+}
+
+//=======================================================================
+//function : GetStandardOutputLog
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetStandardOutputLog()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetStandardOutputLog();
+}
+
+//=======================================================================
+//function : SetRemoveLogOnSuccess
+//=======================================================================
+
+void GHS3DPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
+  SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
+}
+
+//=======================================================================
+//function : GetRemoveLogOnSuccess
+//=======================================================================
+
+CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
+{
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetRemoveLogOnSuccess();
 }
 
 //=======================================================================
@@ -663,7 +769,7 @@ GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVerti
     // Coords
     GHS3DPlugin::TCoords_var coords = new GHS3DPlugin::TCoords();
     coords->length(currentVertex->coords.size());
-    for (int ind = 0; ind < currentVertex->coords.size(); ind++)
+    for ( size_t ind = 0; ind < currentVertex->coords.size(); ind++)
       coords[ind] = currentVertex->coords[ind];
     enfVertex->coords = coords;
     // Group Name
@@ -799,8 +905,6 @@ GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes(
     enfMesh->elementType = currentMesh->elementType;
     // Group Name
     enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
-    // Size
-    enfMesh->size = currentMesh->size;
     
     result[i]=enfMesh;
     }
@@ -816,31 +920,16 @@ GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes(
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
-#if GHS3D_VERSION >= 42
-  return p_SetEnforcedMesh(theSource, theType, -1.0, theGroupName);
-//   bool res = p_SetEnforcedMesh(theSource, theType, -1.0, theGroupName);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
-//                           << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
-//                           << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
-//   }
-//   return res;
-#else
-  SALOME::ExceptionStruct ExDescription;
-  ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-  ExDescription.type = SALOME::BAD_PARAM;
-  ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-  ExDescription.lineNumber = 719;
-  throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #if GHS3D_VERSION >= 42
+  return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
+// #else
+//   SALOME::ExceptionStruct ExDescription;
+//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+//   ExDescription.type = SALOME::BAD_PARAM;
+//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+//   ExDescription.lineNumber = 719;
+//   throw SALOME::SALOME_Exception(ExDescription);
+// #endif
 }
 
 /*!
@@ -850,117 +939,55 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSour
   throw (SALOME::SALOME_Exception)
 {
 //   MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
-#if GHS3D_VERSION >= 42
+// #if GHS3D_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType);
-//   bool res = p_SetEnforcedMesh(theSource, theType);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
-//                           << theSource << ", " << theType << " )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
-//                           << theSource << ".GetMesh(), " << theType << " )";
-//   }
-//   return res;
-#else
-  SALOME::ExceptionStruct ExDescription;
-  ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-  ExDescription.type = SALOME::BAD_PARAM;
-  ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-  ExDescription.lineNumber = 750;
-  throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #else
+//   SALOME::ExceptionStruct ExDescription;
+//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+//   ExDescription.type = SALOME::BAD_PARAM;
+//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+//   ExDescription.lineNumber = 750;
+//   throw SALOME::SALOME_Exception(ExDescription);
+// #endif
 }
 
 /*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
  */
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
-#if GHS3D_VERSION >= 42
-  if (theSize < 0) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = "Size cannot be negative";
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 781;
-    throw SALOME::SALOME_Exception(ExDescription);
-  }
-  
-  return p_SetEnforcedMesh(theSource, theType, theSize, theGroupName);
-//   bool res = p_SetEnforcedMesh(theSource, theType, theSize, theGroupName);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-//                           << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-//                           << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-//   }
-//   return res;
-#else
-  SALOME::ExceptionStruct ExDescription;
-  ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-  ExDescription.type = SALOME::BAD_PARAM;
-  ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-  ExDescription.lineNumber = 750;
-  throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #if GHS3D_VERSION >= 42
+  return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
+// #else
+//   SALOME::ExceptionStruct ExDescription;
+//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+//   ExDescription.type = SALOME::BAD_PARAM;
+//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+//   ExDescription.lineNumber = 750;
+//   throw SALOME::SALOME_Exception(ExDescription);
+// #endif
 }
 
 /*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
  */
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
   throw (SALOME::SALOME_Exception)
 {
-#if GHS3D_VERSION >= 42
-  if (theSize < 0) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = "Size cannot be negative";
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 781;
-    throw SALOME::SALOME_Exception(ExDescription);
-  }
-  return p_SetEnforcedMesh(theSource, theType, theSize);
-//   bool res = p_SetEnforcedMesh(theSource, theType, theSize);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-//                           << theSource << ", " << theType << ", " << theSize << " )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-//                           << theSource << ".GetMesh(), " << theType << ", " << theSize << " )";
-//   }
-//   return res;
-#else
-  SALOME::ExceptionStruct ExDescription;
-  ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
-  ExDescription.type = SALOME::BAD_PARAM;
-  ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-  ExDescription.lineNumber = 750;
-  throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #if GHS3D_VERSION >= 42
+  return p_SetEnforcedMesh(theSource, theType);
+// #else
+//   SALOME::ExceptionStruct ExDescription;
+//   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+//   ExDescription.type = SALOME::BAD_PARAM;
+//   ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+//   ExDescription.lineNumber = 750;
+//   throw SALOME::SALOME_Exception(ExDescription);
+// #endif
 }
 
-bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
+bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
   MESSAGE("GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh");
@@ -976,18 +1003,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
     throw SALOME::SALOME_Exception(ExDescription);
   }
   
-  if ((theType != SMESH::NODE) && (theType != SMESH::EDGE) && (theType != SMESH::FACE))
-  {
-    return false;
-//     SALOME::ExceptionStruct ExDescription;
-//     ExDescription.text = "Bad elementType";
-//     ExDescription.type = SALOME::BAD_PARAM;
-//     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-//     ExDescription.lineNumber = 840;
-//     throw SALOME::SALOME_Exception(ExDescription);
-  }
-  
-  SMESH::array_of_ElementType_var types = theSource->GetTypes();
   switch (theType) {
     case SMESH::NODE:
       MESSAGE("Required type is NODE");
@@ -999,13 +1014,16 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
       MESSAGE("Required type is FACE");
       break;
     default:
-      break;
+        MESSAGE("Incompatible required type: " << theType);
+        return false;
   }
 //   MESSAGE("Required type is "<<theType);
+  SMESH::array_of_ElementType_var types = theSource->GetTypes();
   MESSAGE("Available types:");
-  for (int i=0;i<types->length();i++){MESSAGE(types[i]);}
+  for ( CORBA::ULong i=0;i<types->length();i++){MESSAGE(types[i]);}
   if ( types->length() >= 1 && types[types->length()-1] <  theType)
   {
+    MESSAGE("Required type not available");
     return false;
 //     SALOME::ExceptionStruct ExDescription;
 //     ExDescription.text = "The source mesh has bad type";
@@ -1015,36 +1033,31 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
 //     throw SALOME::SALOME_Exception(ExDescription);
   }
   
+
+  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+  SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+
   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-  TIDSortedElemSet theElemSet;
-  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
-  SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+
+  string enfMeshName = theName;
+  if (enfMeshName.empty())
+    enfMeshName = SObj->GetName();
+
   if (theMesh_i)
   {
     try {
-      bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
-      if (theSize > 0) {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-                                << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-                                << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
+      bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
+      if (theGroupName && theGroupName[0] ) {
+        SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+                              << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
       }
       else {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
-                                << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
-                                << theSource << ".GetMesh(), " << theType << " )";
-        }
+        SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+                              << theSource << ".GetMesh(), " << theType << " )";
       }
+
       return res;
     }
     catch (const std::invalid_argument& ex) {
@@ -1059,35 +1072,23 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
     }
   }
-  else if (theGroup_i && types->length() == 1 && types[0] == theType)
+  else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
   {
     MESSAGE("The source is a group")
-    try {
-      bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
-      if (theSize > 0) {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-      }
-      else {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
+      try {
+        bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
+        if ( theGroupName && theGroupName[0] ) {
+          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
         }
         else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
+          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
                                 << theSource << ", " << theType << " )";
         }
+        return res;
       }
-      return res;
-    }
-    catch (const std::invalid_argument& ex) {
-      SALOME::ExceptionStruct ExDescription;
+      catch (const std::invalid_argument& ex) {
+        SALOME::ExceptionStruct ExDescription;
       ExDescription.text = ex.what();
       ExDescription.type = SALOME::BAD_PARAM;
       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
@@ -1098,23 +1099,12 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
     }
   }
-  else if (theGroupOnGeom_i && types->length() == 1 && types[0] == theType)
+  else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
   {
     MESSAGE("The source is a group on geom")
     try {
-      bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
-      if (theSize > 0) {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-      }
-      else {
-        if (theGroupName != "") {
+        bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
+        if ( theGroupName && theGroupName[0] ) {
           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
         }
@@ -1122,7 +1112,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
                                 << theSource << ", " << theType << " )";
         }
-      }
       return res;
     }
     catch (const std::invalid_argument& ex) {