Salome HOME
Merge remote-tracking branch 'origin/abn/configuration'
[plugins/ghs3dplugin.git] / src / GHS3DPlugin / GHS3DPlugin_Hypothesis_i.cxx
index 0e2f6b8fd144a24607d8c4b7ed4e37f5fd40845c..dd3239f6c4f2d6ebb419d53f7e48aa3f60901e4e 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2004-2013  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,6 +44,8 @@
 // #include <SALOMEconfig.h>
 // #include CORBA_SERVER_HEADER(SALOMEDS)
 
+using namespace std;
+
 //=======================================================================
 //function : GHS3DPlugin_Hypothesis_i
 //=======================================================================
@@ -115,7 +117,7 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
 //function : SetMaximumMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
+void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Long MB)
    throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
@@ -129,7 +131,7 @@ void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
 //function : GetMaximumMemory
 //=======================================================================
 
-CORBA::Double GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
+CORBA::Long GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetMaximumMemory();
@@ -139,7 +141,7 @@ CORBA::Double GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
 //function : SetInitialMemory
 //=======================================================================
 
-void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
+void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Long MB)
   throw ( SALOME::SALOME_Exception )
 {
   if ( MB == 0 )
@@ -153,7 +155,7 @@ void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
 //function : GetInitialMemory
 //=======================================================================
 
-CORBA::Double GHS3DPlugin_Hypothesis_i::GetInitialMemory()
+CORBA::Long GHS3DPlugin_Hypothesis_i::GetInitialMemory()
 {
   ASSERT(myBaseImpl);
   return this->GetImpl()->GetInitialMemory();
@@ -358,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 << "' )";
 }
 
 //=======================================================================
@@ -369,7 +371,28 @@ 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() );
 }
 
 //=======================================================================
@@ -378,8 +401,6 @@ char* GHS3DPlugin_Hypothesis_i::GetTextOption()
 
 void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
 {
-  if (gradation <= 1)
-    THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
   ASSERT(myBaseImpl);
   if (gradation != GetGradation()) {
     this->GetImpl()->SetGradation(gradation);
@@ -748,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
@@ -999,7 +1020,7 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
 //   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");
@@ -1022,20 +1043,20 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
 
   string enfMeshName = theName;
   if (enfMeshName.empty())
-          enfMeshName = SObj->GetName();
+    enfMeshName = SObj->GetName();
 
   if (theMesh_i)
   {
     try {
-        bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
-                if (theGroupName != "") {
-                  SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
-                                                                << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
-                }
-                else {
-                  SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
-                                                                << theSource << ".GetMesh(), " << theType << " )";
-                }
+      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 {
+        SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+                              << theSource << ".GetMesh(), " << theType << " )";
+      }
 
       return res;
     }
@@ -1054,20 +1075,20 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
   else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
   {
     MESSAGE("The source is a group")
-    try {
+      try {
         bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
+        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;
-    }
-    catch (const std::invalid_argument& ex) {
-      SALOME::ExceptionStruct ExDescription;
+        return res;
+      }
+      catch (const std::invalid_argument& ex) {
+        SALOME::ExceptionStruct ExDescription;
       ExDescription.text = ex.what();
       ExDescription.type = SALOME::BAD_PARAM;
       ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
@@ -1083,7 +1104,7 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
     MESSAGE("The source is a group on geom")
     try {
         bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
-        if (theGroupName != "") {
+        if ( theGroupName && theGroupName[0] ) {
           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
         }