Salome HOME
NPAL16198: EDF462: Submeshes creation duplicate algorithms and hypotheses. Refix.
authorjfa <jfa@opencascade.com>
Thu, 27 Dec 2007 09:37:46 +0000 (09:37 +0000)
committerjfa <jfa@opencascade.com>
Thu, 27 Dec 2007 09:37:46 +0000 (09:37 +0000)
15 files changed:
idl/SMESH_Gen.idl
src/SMESH/SMESH_Algo.cxx
src/SMESHDS/SMESHDS_GroupBase.cxx
src/SMESHFiltersSelection/Makefile.am
src/SMESHFiltersSelection/SMESH_TypeFilter.cxx
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_MeshOp.h
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.cxx
src/SMESHGUI/SMESHGUI_Swig.cxx
src/SMESH_I/SMESH.hxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_SWIG/smeshDC.py

index 4f81e6e513ef6dcb71998fda1b17d206ec10d103..96083e18958e35982a4c12e99cbba8321a3cbbe5 100644 (file)
@@ -15,7 +15,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 //
 //
 //
@@ -43,6 +43,35 @@ module SMESH
   interface FilterManager;
   interface SMESH_Pattern;
 
   interface FilterManager;
   interface SMESH_Pattern;
 
+  /*!
+   * Tags definition
+   */
+  // Top level
+  const long Tag_HypothesisRoot = 1; // hypotheses root
+  const long Tag_AlgorithmsRoot = 2; // algorithms root
+  const long Tag_FirstMeshRoot  = 3; // first mesh root
+  // Mesh/Submesh
+  const long Tag_RefOnShape             = 1; // references to shape
+  const long Tag_RefOnAppliedHypothesis = 2; // applied hypotheses root
+  const long Tag_RefOnAppliedAlgorithms = 3; // applied algorithms root
+  // Mesh only: sub-meshes roots by type
+  const long Tag_FirstSubMesh           =  4;
+  const long Tag_SubMeshOnVertex        =  4;
+  const long Tag_SubMeshOnEdge          =  5;
+  const long Tag_SubMeshOnWire          =  6;
+  const long Tag_SubMeshOnFace          =  7;
+  const long Tag_SubMeshOnShell         =  8;
+  const long Tag_SubMeshOnSolid         =  9;
+  const long Tag_SubMeshOnCompound      = 10;
+  const long Tag_LastSubMesh            = 10;
+  // Mesh only: group roots by type
+  const long Tag_FirstGroup             = 11;
+  const long Tag_NodeGroups             = 11;
+  const long Tag_EdgeGroups             = 12;
+  const long Tag_FaceGroups             = 13;
+  const long Tag_VolumeGroups           = 14;
+  const long Tag_LastGroup              = 14;
+
   /*!
    * Hypothesis definintion error
    */
   /*!
    * Hypothesis definintion error
    */
@@ -246,6 +275,12 @@ module SMESH
                           in double     theMergeTolerance)
       raises ( SALOME::SALOME_Exception );
 
                           in double     theMergeTolerance)
       raises ( SALOME::SALOME_Exception );
 
+    /*!
+     * \brief Return id of object, registered in current study context
+     *
+     * Can be used to check if the object was created in the same container, as this engine.
+     */
+    long GetObjectId(in Object theObject);
   };
 
 };
   };
 
 };
index db07a004f118ad0ad2bccb360eb92fa612b9e17e..47346f2da3471a0d5ec93874461d9c3ae926a1ef 100644 (file)
@@ -71,8 +71,8 @@ using namespace std;
  */
 //=============================================================================
 
  */
 //=============================================================================
 
-SMESH_Algo::SMESH_Algo(int hypId, int studyId,
-       SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
+SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
+  SMESH_Hypothesis(hypId, studyId, gen)
 {
   gen->_mapAlgo[hypId] = this;
 
 {
   gen->_mapAlgo[hypId] = this;
 
@@ -108,7 +108,7 @@ istream & SMESH_Algo::LoadFrom(istream & load) { return load; }
 
 const vector < string > &SMESH_Algo::GetCompatibleHypothesis()
 {
 
 const vector < string > &SMESH_Algo::GetCompatibleHypothesis()
 {
-       return _compatibleHypothesis;
+  return _compatibleHypothesis;
 }
 
 //=============================================================================
 }
 
 //=============================================================================
@@ -132,7 +132,7 @@ SMESH_Algo::GetUsedHypothesis(SMESH_Mesh &         aMesh,
   {
     aMesh.GetHypotheses( aShape, filter, _usedHypList, true );
     if ( ignoreAuxiliary && _usedHypList.size() > 1 )
   {
     aMesh.GetHypotheses( aShape, filter, _usedHypList, true );
     if ( ignoreAuxiliary && _usedHypList.size() > 1 )
-      _usedHypList.clear();    //only one compatible hypothesis allowed
+      _usedHypList.clear(); //only one compatible hypothesis allowed
   }
   return _usedHypList;
 }
   }
   return _usedHypList;
 }
index 0b2cad051b5a320f458ac24d518941ece05d25ba..1fc450002d7551063469835050a91c7bd45c1495 100644 (file)
@@ -149,6 +149,7 @@ bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem)
 {
   if ( elem )
     return Contains( elem->GetID() );
 {
   if ( elem )
     return Contains( elem->GetID() );
+  return false;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
index 9d5d0ba93215423c227261446952ecd517c2a28d..c2131e8f808c3703497b0037fb64fe2f245119c7 100644 (file)
@@ -17,7 +17,7 @@
 #  License along with this library; if not, write to the Free Software 
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 # 
 #  License along with this library; if not, write to the Free Software 
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 # 
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 #
 #
 #
 #
 #
@@ -48,14 +48,15 @@ dist_libSMESHFiltersSelection_la_SOURCES = \
 
 # additionnal information to compil and link file
 libSMESHFiltersSelection_la_CPPFLAGS = \
 
 # additionnal information to compil and link file
 libSMESHFiltersSelection_la_CPPFLAGS = \
-       $(KERNEL_CXXFLAGS) \
-       $(GUI_CXXFLAGS) \
-       $(GEOM_CXXFLAGS) \
        $(CAS_CPPFLAGS) \
        $(QT_INCLUDES) \
        $(PYTHON_INCLUDES) \
        $(VTK_INCLUDES) \
        $(CAS_CPPFLAGS) \
        $(QT_INCLUDES) \
        $(PYTHON_INCLUDES) \
        $(VTK_INCLUDES) \
-       ${BOOST_CPPFLAGS} \
+       $(KERNEL_CXXFLAGS) \
+       $(GUI_CXXFLAGS) \
+       $(GEOM_CXXFLAGS) \
+       $(MED_CXXFLAGS) \
+       $(BOOST_CPPFLAGS) \
        $(CORBA_CXXFLAGS) \
        $(CORBA_INCLUDES) \
        -I$(top_builddir)/idl \
        $(CORBA_CXXFLAGS) \
        $(CORBA_INCLUDES) \
        -I$(top_builddir)/idl \
index 1b2d9ee29e018a0d8a135f75c881519d28cc08ca..3770b4a850869264c122cd7c3d6a011c75a65618 100644 (file)
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 // Lesser General Public License for more details.
 //
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 // Lesser General Public License for more details.
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include "SMESH_TypeFilter.hxx"
 
 #include <SUIT_Session.h>
 #include "SMESH_TypeFilter.hxx"
 
 #include <SUIT_Session.h>
 #include <SalomeApp_Study.h>
 #include <LightApp_DataOwner.h>
 
 #include <SalomeApp_Study.h>
 #include <LightApp_DataOwner.h>
 
-SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType) 
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SMESH_Gen)
+
+SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType)
 {
   myType = theType;
 }
 
 {
   myType = theType;
 }
 
-SMESH_TypeFilter::~SMESH_TypeFilter() 
+SMESH_TypeFilter::~SMESH_TypeFilter()
 {
 }
 
 {
 }
 
@@ -80,90 +84,98 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
       return false;
 
     switch (myType)
       return false;
 
     switch (myType)
-      {
+    {
       case HYPOTHESIS:
        {
       case HYPOTHESIS:
        {
-         if ( aLevel == 2 && ( objFather->Tag() == 1 )) // hypo definition
+         if      (aLevel == 2 && (objFather->Tag() == SMESH::Tag_HypothesisRoot))
+            // hypo definition
            Ok = true;
            Ok = true;
-         else if ( aLevel == 3 && ( objFather->Tag() == 2 )) // applied global hypo
+         else if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_RefOnAppliedHypothesis))
+            // applied global hypo
            Ok = true;
            Ok = true;
-         else if ( aLevel == 5 && ( objFather->Tag() == 2 )) // applied local hypo
+         else if (aLevel == 5 && (objFather->Tag() == SMESH::Tag_RefOnAppliedHypothesis))
+            // applied local hypo
            Ok = true;
          break;
        }
       case ALGORITHM:
        {
            Ok = true;
          break;
        }
       case ALGORITHM:
        {
-         if ( aLevel == 2 && ( objFather->Tag() == 2 )) // algo definition
+         if      (aLevel == 2 && (objFather->Tag() == SMESH::Tag_AlgorithmsRoot))
+            // algo definition
            Ok = true;
            Ok = true;
-         else if ( aLevel == 3 && ( objFather->Tag() == 3 )) // applied global algo
+         else if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_RefOnAppliedAlgorithms))
+            // applied global algo
            Ok = true;
            Ok = true;
-         else if ( aLevel == 5 && ( objFather->Tag() == 3 )) // applied local algo
+         else if (aLevel == 5 && (objFather->Tag() == SMESH::Tag_RefOnAppliedAlgorithms))
+            // applied local algo
            Ok = true;
          break;
        }
       case MESH:
        {
            Ok = true;
          break;
        }
       case MESH:
        {
-         if ( aLevel == 1 && ( obj->Tag() >= 3 ))
+         if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
            Ok = true;
          break;
        }
       case SUBMESH:
        {
          // see SMESH_Gen_i.cxx for tag numbers
            Ok = true;
          break;
        }
       case SUBMESH:
        {
          // see SMESH_Gen_i.cxx for tag numbers
-         if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
+         if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstSubMesh &&
+                              objFather->Tag() <= SMESH::Tag_LastSubMesh))
            Ok = true;
          break;
        }
       case MESHorSUBMESH:
        {
            Ok = true;
          break;
        }
       case MESHorSUBMESH:
        {
-         if ( aLevel == 1 && ( obj->Tag() >= 3 ))
+         if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
            Ok = true; // mesh
            Ok = true; // mesh
-          else if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
+          else if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstSubMesh &&
+                                   objFather->Tag() <= SMESH::Tag_LastSubMesh))
            Ok = true;
          break;
        }
            Ok = true;
          break;
        }
-      case SUBMESH_VERTEX:  // Label "SubMeshes on vertexes"
+      case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
        {
        {
-         if ( aLevel == 3 && ( objFather->Tag() == 4 ))
+         if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnVertex))
            Ok = true;
          break;
        }
       case SUBMESH_EDGE:
        {
            Ok = true;
          break;
        }
       case SUBMESH_EDGE:
        {
-         if ( aLevel == 3 && ( objFather->Tag() == 5 ))
+         if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnEdge))
            Ok = true;
          break;
        }
       case SUBMESH_FACE:
        {
            Ok = true;
          break;
        }
       case SUBMESH_FACE:
        {
-         if ( aLevel == 3 && ( objFather->Tag() == 7 ))
+         if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnFace))
            Ok = true;
          break;
        }
       case SUBMESH_SOLID:
        {
            Ok = true;
          break;
        }
       case SUBMESH_SOLID:
        {
-         if ( aLevel == 3 && ( objFather->Tag() == 9 ))
+         if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnSolid))
            Ok = true;
          break;
        }
       case SUBMESH_COMPOUND:
        {
            Ok = true;
          break;
        }
       case SUBMESH_COMPOUND:
        {
-         if ( aLevel == 3 && ( objFather->Tag() == 10 ))
+         if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnCompound))
            Ok = true;
          break;
        }
       case GROUP:
        {
            Ok = true;
          break;
        }
       case GROUP:
        {
-         if ( aLevel == 3 && ( objFather->Tag() > 10 ))
+         if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstGroup))
            Ok = true;
          break;
        }
            Ok = true;
          break;
        }
-      }
+    }
   }
   return Ok;
 }
 
   }
   return Ok;
 }
 
-MeshObjectType SMESH_TypeFilter::type() const 
+MeshObjectType SMESH_TypeFilter::type() const
 {
   return myType;
 }
 {
   return myType;
 }
index 3254ad09f022df175af29ae7aef3650b5a2b6767..8b50b3c2f351ceaaab3f155486d8ce3f205aa8bb 100644 (file)
@@ -44,6 +44,8 @@
 #include "SMESH_TypeFilter.hxx"
 #include "SMESH_NumberFilter.hxx"
 
 #include "SMESH_TypeFilter.hxx"
 #include "SMESH_NumberFilter.hxx"
 
+#include CORBA_CLIENT_HEADER(SMESH_Gen)
+
 #include "GEOM_SelectionFilter.h"
 #include "GEOMBase.h"
 #include "GeometryGUI.h"
 #include "GEOM_SelectionFilter.h"
 #include "GEOMBase.h"
 #include "GeometryGUI.h"
 #include <TopoDS_Shape.hxx>
 #include <TopExp_Explorer.hxx>
 
 #include <TopoDS_Shape.hxx>
 #include <TopExp_Explorer.hxx>
 
-enum { GLOBAL_ALGO_TAG        =3,
-       GLOBAL_HYPO_TAG        =2,
-       LOCAL_ALGO_TAG         =2,
-       LOCAL_HYPO_TAG         =1,
-       SUBMESH_ON_VERTEX_TAG  =4,
-       SUBMESH_ON_EDGE_TAG    =5,
-       SUBMESH_ON_WIRE_TAG    =6,
-       SUBMESH_ON_FACE_TAG    =7,
-       SUBMESH_ON_SHELL_TAG   =8,
-       SUBMESH_ON_SOLID_TAG   =9,
-       SUBMESH_ON_COMPOUND_TAG=10 };
-
 //================================================================================
 /*!
  * \brief Constructor
 //================================================================================
 /*!
  * \brief Constructor
@@ -368,13 +358,13 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
     if ( !geom->_is_nil() ) {
       int tag = -1;
       switch ( geom->GetShapeType() ) {
     if ( !geom->_is_nil() ) {
       int tag = -1;
       switch ( geom->GetShapeType() ) {
-      case GEOM::VERTEX:   tag = SUBMESH_ON_VERTEX_TAG  ; break;
-      case GEOM::EDGE:     tag = SUBMESH_ON_EDGE_TAG    ; break;
-      case GEOM::WIRE:     tag = SUBMESH_ON_WIRE_TAG    ; break;
-      case GEOM::FACE:     tag = SUBMESH_ON_FACE_TAG    ; break;
-      case GEOM::SHELL:    tag = SUBMESH_ON_SHELL_TAG   ; break;
-      case GEOM::SOLID:    tag = SUBMESH_ON_SOLID_TAG   ; break;
-      case GEOM::COMPOUND: tag = SUBMESH_ON_COMPOUND_TAG; break;
+      case GEOM::VERTEX:   tag = SMESH::Tag_SubMeshOnVertex  ; break;
+      case GEOM::EDGE:     tag = SMESH::Tag_SubMeshOnEdge    ; break;
+      case GEOM::WIRE:     tag = SMESH::Tag_SubMeshOnWire    ; break;
+      case GEOM::FACE:     tag = SMESH::Tag_SubMeshOnFace    ; break;
+      case GEOM::SHELL:    tag = SMESH::Tag_SubMeshOnShell   ; break;
+      case GEOM::SOLID:    tag = SMESH::Tag_SubMeshOnSolid   ; break;
+      case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break;
       default:;
       }
       _PTR(GenericAttribute) anAttr;
       default:;
       }
       _PTR(GenericAttribute) anAttr;
@@ -760,9 +750,9 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
   bool isMesh = !_CAST( SComponent, theFather );
   int aPart = -1;
   if ( isMesh )
   bool isMesh = !_CAST( SComponent, theFather );
   int aPart = -1;
   if ( isMesh )
-    aPart = theHypType == Algo ? GLOBAL_ALGO_TAG : GLOBAL_HYPO_TAG;
+    aPart = theHypType == Algo ? SMESH::Tag_RefOnAppliedAlgorithms : SMESH::Tag_RefOnAppliedHypothesis;
   else
   else
-    aPart = theHypType == Algo ? LOCAL_ALGO_TAG : LOCAL_HYPO_TAG;
+    aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot;
 
   if ( theFather->FindSubObject( aPart, aHypRoot ) )
   {
 
   if ( theFather->FindSubObject( aPart, aHypRoot ) )
   {
index c8b2ed7c0f2d3132653b173cb9d6c86489f60a77..c658fb74e33568594bcfa6fd53b3784d597ab978 100644 (file)
@@ -37,8 +37,8 @@
 #include "SMESHGUI_SelectionOp.h"
 
 #include <SALOMEconfig.h>
 #include "SMESHGUI_SelectionOp.h"
 
 #include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_CLIENT_HEADER(GEOM_Gen)
+#include CORBA_CLIENT_HEADER(SMESH_Mesh)
 
 #include <qstringlist.h>
 
 
 #include <qstringlist.h>
 
index 8ffec5ae3925b9d2085eec526b52e2e31ecda135..9791ebebd05431113d4a2061abd0dfc15390613c 100644 (file)
@@ -36,8 +36,9 @@
 #include "SVTK_RenderWindowInteractor.h"
 #include "SVTK_ViewWindow.h"
 
 #include "SVTK_RenderWindowInteractor.h"
 #include "SVTK_ViewWindow.h"
 
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include CORBA_SERVER_HEADER(SMESH_Group)
+#include CORBA_CLIENT_HEADER(SMESH_Gen)
+#include CORBA_CLIENT_HEADER(SMESH_Mesh)
+#include CORBA_CLIENT_HEADER(SMESH_Group)
 
 //=======================================================================
 //function : SMESHGUI_Selection
 
 //=======================================================================
 //function : SMESHGUI_Selection
@@ -82,7 +83,7 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
 //=======================================================================
 void SMESHGUI_Selection::processOwner( const LightApp_DataOwner* ow )
 {
 //=======================================================================
 void SMESHGUI_Selection::processOwner( const LightApp_DataOwner* ow )
 {
-  const LightApp_SVTKDataOwner* owner = 
+  const LightApp_SVTKDataOwner* owner =
     dynamic_cast<const LightApp_SVTKDataOwner*> ( ow );
   if( owner )
     myActors.append( dynamic_cast<SMESH_Actor*>( owner->GetActor() ) );
     dynamic_cast<const LightApp_SVTKDataOwner*> ( ow );
   if( owner )
     myActors.append( dynamic_cast<SMESH_Actor*>( owner->GetActor() ) );
@@ -313,7 +314,7 @@ QVariant SMESHGUI_Selection::isComputable( int ind ) const
 /*    Handle(SALOME_InteractiveObject) io =
       static_cast<LightApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
     if ( !io.IsNull() ) {
 /*    Handle(SALOME_InteractiveObject) io =
       static_cast<LightApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
     if ( !io.IsNull() ) {
-      SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io) ; // m,sm,gr->m
+      SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io); // m,sm,gr->m
       if ( !mesh->_is_nil() ) {*/
         _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() );
        //FindSObject( mesh );
       if ( !mesh->_is_nil() ) {*/
         _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() );
        //FindSObject( mesh );
@@ -402,47 +403,47 @@ int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
       anOTag = obj->Tag(),
       res = -1;
 
       anOTag = obj->Tag(),
       res = -1;
 
-  switch( aLevel )
+  switch (aLevel)
   {
   case 1:
   {
   case 1:
-    if( anOTag>=3 )
+    if (anOTag >= SMESH::Tag_FirstMeshRoot)
       res = MESH;
     break;
   case 2:
       res = MESH;
     break;
   case 2:
-    switch( aFTag )
+    switch (aFTag)
     {
     {
-    case 1:
+    case SMESH::Tag_HypothesisRoot:
       res = HYPOTHESIS;
       break;
       res = HYPOTHESIS;
       break;
-    case 2:
+    case SMESH::Tag_AlgorithmsRoot:
       res = ALGORITHM;
       break;
     }
     break;
   case 3:
       res = ALGORITHM;
       break;
     }
     break;
   case 3:
-    switch( aFTag )
+    switch (aFTag)
     {
     {
-    case 4:
+    case SMESH::Tag_SubMeshOnVertex:
       res = SUBMESH_VERTEX;
       break;
       res = SUBMESH_VERTEX;
       break;
-    case 5:
+    case SMESH::Tag_SubMeshOnEdge:
       res = SUBMESH_EDGE;
       break;
       res = SUBMESH_EDGE;
       break;
-    case 7:
+    case SMESH::Tag_SubMeshOnFace:
       res = SUBMESH_FACE;
       break;
       res = SUBMESH_FACE;
       break;
-    case 9:
+    case SMESH::Tag_SubMeshOnSolid:
       res = SUBMESH_SOLID;
       break;
       res = SUBMESH_SOLID;
       break;
-    case 10:
+    case SMESH::Tag_SubMeshOnCompound:
       res = SUBMESH_COMPOUND;
       break;
       res = SUBMESH_COMPOUND;
       break;
+    default:
+      if (aFTag >= SMESH::Tag_FirstGroup)
+        res = GROUP;
+      else
+        res = SUBMESH;
     }
     }
-    if( aFTag>10 )
-      res = GROUP;
-    else
-      res = SUBMESH;
-
     break;
   }
 
     break;
   }
 
index 012294dccc20a46f0fdbef08528e145809557380..3fe48b107e74af8e78c2d137aedba5a8664a1576 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 //
 //
 //
@@ -32,7 +32,6 @@
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_MeshUtils.h"
 
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_MeshUtils.h"
 
-#include "SMESH.hxx"
 #include "SMESH_TypeFilter.hxx"
 
 #include "SALOMEDSClient_Study.hxx"
 #include "SMESH_TypeFilter.hxx"
 
 #include "SALOMEDSClient_Study.hxx"
@@ -251,7 +250,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
       bool hasGroup = false;
 
       // info about groups on nodes
       bool hasGroup = false;
 
       // info about groups on nodes
-      aMeshSO->FindSubObject(Tag_NodeGroups, anObj);
+      aMeshSO->FindSubObject(SMESH::Tag_NodeGroups, anObj);
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (it->More()) {
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (it->More()) {
@@ -284,7 +283,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
 
       // info about groups on edges
       anObj.reset();
 
       // info about groups on edges
       anObj.reset();
-      aMeshSO->FindSubObject(Tag_EdgeGroups, anObj);
+      aMeshSO->FindSubObject(SMESH::Tag_EdgeGroups, anObj);
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
         if (!hasGroup && it->More()) {
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
         if (!hasGroup && it->More()) {
@@ -317,7 +316,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
 
       // info about groups on faces
       anObj.reset();
 
       // info about groups on faces
       anObj.reset();
-      aMeshSO->FindSubObject(Tag_FaceGroups , anObj);
+      aMeshSO->FindSubObject(SMESH::Tag_FaceGroups , anObj);
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (!hasGroup && it->More()) {
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (!hasGroup && it->More()) {
@@ -350,7 +349,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
 
       // info about groups on volumes
       anObj.reset();
 
       // info about groups on volumes
       anObj.reset();
-      aMeshSO->FindSubObject(Tag_VolumeGroups, anObj);
+      aMeshSO->FindSubObject(SMESH::Tag_VolumeGroups, anObj);
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (!hasGroup && it->More())
       if (anObj) {
         _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (!hasGroup && it->More())
@@ -458,14 +457,14 @@ void SMESHGUI_StandardMeshInfosDlg::onStartSelection()
 void SMESHGUI_StandardMeshInfosDlg::onHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 void SMESHGUI_StandardMeshInfosDlg::onHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
-               QString platform;
+    QString platform;
 #ifdef WIN32
 #ifdef WIN32
-               platform = "winapplication";
+    platform = "winapplication";
 #else
 #else
-               platform = "application";
+    platform = "application";
 #endif
     SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
                           QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
 #endif
     SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
                           QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
index fec084979966469eae52d41301a8133ccc11c300..ee4705c0e5b243618d1af8ba23d46ac05de9b0d7 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 //
 //
 //
@@ -65,20 +65,6 @@ using namespace std;
 
 static CORBA::ORB_var anORB;
 
 
 static CORBA::ORB_var anORB;
 
-// Tags definition 
-static long Tag_HypothesisRoot = 1;
-static long Tag_AlgorithmsRoot = 2;
-  
-static long Tag_RefOnShape = 1;
-static long Tag_RefOnAppliedHypothesis = 2;
-static long Tag_RefOnAppliedAlgorithms = 3;
-
-static long Tag_SubMeshOnVertex = 4;
-static long Tag_SubMeshOnEdge = 5;
-static long Tag_SubMeshOnFace = 6;
-static long Tag_SubMeshOnSolid = 7;
-static long Tag_SubMeshOnCompound  = 8;
-
 namespace
 {
   //---------------------------------------------------------------
 namespace
 {
   //---------------------------------------------------------------
@@ -125,11 +111,11 @@ namespace
   {
     return GetDomainRoot(theSComponentMesh,
                         theStudyBuilder,
   {
     return GetDomainRoot(theSComponentMesh,
                         theStudyBuilder,
-                        Tag_HypothesisRoot,
+                        SMESH::Tag_HypothesisRoot,
                         QObject::tr("SMESH_MEN_HYPOTHESIS"),
                         "ICON_SMESH_TREE_HYPO");
   }
                         QObject::tr("SMESH_MEN_HYPOTHESIS"),
                         "ICON_SMESH_TREE_HYPO");
   }
-  
+
 
   //---------------------------------------------------------------
   inline
 
   //---------------------------------------------------------------
   inline
@@ -139,7 +125,7 @@ namespace
   {
     return GetDomainRoot(theSComponentMesh,
                         theStudyBuilder,
   {
     return GetDomainRoot(theSComponentMesh,
                         theStudyBuilder,
-                        Tag_AlgorithmsRoot,
+                        SMESH::Tag_AlgorithmsRoot,
                         QObject::tr("SMESH_MEN_ALGORITHMS"),
                         "ICON_SMESH_TREE_ALGO");
   }
                         QObject::tr("SMESH_MEN_ALGORITHMS"),
                         "ICON_SMESH_TREE_ALGO");
   }
@@ -157,7 +143,7 @@ namespace
   {
     SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
                                                  theStudyBuilder,
   {
     SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
                                                  theStudyBuilder,
-                                                 Tag_AlgorithmsRoot,
+                                                 SMESH::Tag_AlgorithmsRoot,
                                                  theDomainName,
                                                  theDomainPixmap);
     // Add New Hypothesis
                                                  theDomainName,
                                                  theDomainPixmap);
     // Add New Hypothesis
@@ -172,7 +158,7 @@ namespace
     anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
     SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
     anIOR->SetValue(theIOR.c_str());
     anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
     SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
     anIOR->SetValue(theIOR.c_str());
-    
+
     return aSObject;
   }
 
     return aSObject;
   }
 
@@ -186,7 +172,7 @@ namespace
     return AddToDomain(theIOR,
                       theSComponentMesh,
                       theStudyBuilder,
     return AddToDomain(theIOR,
                       theSComponentMesh,
                       theStudyBuilder,
-                      Tag_HypothesisRoot,
+                      SMESH::Tag_HypothesisRoot,
                       QObject::tr("SMESH_MEN_HYPOTHESIS"),
                       "ICON_SMESH_TREE_HYPO");
   }
                       QObject::tr("SMESH_MEN_HYPOTHESIS"),
                       "ICON_SMESH_TREE_HYPO");
   }
@@ -201,7 +187,7 @@ namespace
     return AddToDomain(theIOR,
                       theSComponentMesh,
                       theStudyBuilder,
     return AddToDomain(theIOR,
                       theSComponentMesh,
                       theStudyBuilder,
-                      Tag_AlgorithmsRoot,
+                      SMESH::Tag_AlgorithmsRoot,
                       QObject::tr("SMESH_MEN_ALGORITHMS"),
                       "ICON_SMESH_TREE_ALGO");
   }
                       QObject::tr("SMESH_MEN_ALGORITHMS"),
                       "ICON_SMESH_TREE_ALGO");
   }
@@ -209,7 +195,7 @@ namespace
 
   //---------------------------------------------------------------
   void
 
   //---------------------------------------------------------------
   void
-  SetDomain(const char* theMeshOrSubMeshEntry, 
+  SetDomain(const char* theMeshOrSubMeshEntry,
            const char* theDomainEntry,
            const SALOMEDS::Study_var& theStudy,
            const SALOMEDS::StudyBuilder_var& theStudyBuilder,
            const char* theDomainEntry,
            const SALOMEDS::Study_var& theStudy,
            const SALOMEDS::StudyBuilder_var& theStudyBuilder,
@@ -225,7 +211,7 @@ namespace
       SALOMEDS::SObject_var anAppliedDomainSO;
       if(!aMeshOrSubMeshSO->FindSubObject(theRefOnAppliedDomainTag,anAppliedDomainSO)){
        anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
       SALOMEDS::SObject_var anAppliedDomainSO;
       if(!aMeshOrSubMeshSO->FindSubObject(theRefOnAppliedDomainTag,anAppliedDomainSO)){
        anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
-       SALOMEDS::GenericAttribute_var anAttr = 
+       SALOMEDS::GenericAttribute_var anAttr =
          theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
        SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
        aName->SetValue(theAppliedDomainMEN.latin1());
          theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
        SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
        aName->SetValue(theAppliedDomainMEN.latin1());
@@ -244,7 +230,7 @@ namespace
 
   //---------------------------------------------------------------
   void
 
   //---------------------------------------------------------------
   void
-  SetHypothesis(const char* theMeshOrSubMeshEntry, 
+  SetHypothesis(const char* theMeshOrSubMeshEntry,
                const char* theDomainEntry,
                const SALOMEDS::Study_var& theStudy,
                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
                const char* theDomainEntry,
                const SALOMEDS::Study_var& theStudy,
                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
@@ -253,7 +239,7 @@ namespace
              theDomainEntry,
              theStudy,
              theStudyBuilder,
              theDomainEntry,
              theStudy,
              theStudyBuilder,
-             Tag_RefOnAppliedHypothesis,
+             SMESH::Tag_RefOnAppliedHypothesis,
              QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"),
              "ICON_SMESH_TREE_HYPO");
   }
              QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"),
              "ICON_SMESH_TREE_HYPO");
   }
@@ -261,7 +247,7 @@ namespace
 
   //---------------------------------------------------------------
   void
 
   //---------------------------------------------------------------
   void
-  SetAlgorithms(const char* theMeshOrSubMeshEntry, 
+  SetAlgorithms(const char* theMeshOrSubMeshEntry,
                const char* theDomainEntry,
                const SALOMEDS::Study_var& theStudy,
                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
                const char* theDomainEntry,
                const SALOMEDS::Study_var& theStudy,
                const SALOMEDS::StudyBuilder_var& theStudyBuilder)
@@ -270,7 +256,7 @@ namespace
              theDomainEntry,
              theStudy,
              theStudyBuilder,
              theDomainEntry,
              theStudy,
              theStudyBuilder,
-             Tag_RefOnAppliedAlgorithms,
+             SMESH::Tag_RefOnAppliedAlgorithms,
              QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"),
              "ICON_SMESH_TREE_ALGO");
   }
              QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"),
              "ICON_SMESH_TREE_ALGO");
   }
@@ -347,7 +333,7 @@ SMESH_Swig::Init(int theStudyID)
       myStudy = aStudyMgr->GetStudyByID(myStudyID);
 
       SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
       myStudy = aStudyMgr->GetStudyByID(myStudyID);
 
       SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
-      aSMESHGen->SetCurrentStudy( myStudy.in() ); 
+      aSMESHGen->SetCurrentStudy( myStudy.in() );
 
       myStudyBuilder = myStudy->NewBuilder();
 
 
       myStudyBuilder = myStudy->NewBuilder();
 
@@ -358,7 +344,7 @@ SMESH_Swig::Init(int theStudyID)
       SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH");
       if(aSComponent->_is_nil()){
        bool aLocked = myStudy->GetProperties()->IsLocked();
       SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH");
       if(aSComponent->_is_nil()){
        bool aLocked = myStudy->GetProperties()->IsLocked();
-       if (aLocked) 
+       if (aLocked)
          myStudy->GetProperties()->SetLocked(false);
        
        aSComponent = myStudyBuilder->NewComponent("SMESH");
          myStudy->GetProperties()->SetLocked(false);
        
        aSComponent = myStudyBuilder->NewComponent("SMESH");
@@ -366,18 +352,18 @@ SMESH_Swig::Init(int theStudyID)
        aName = SALOMEDS::AttributeName::_narrow(anAttr);
 
        SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
        aName = SALOMEDS::AttributeName::_narrow(anAttr);
 
        SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
-       if(!aSMESHGUI){
+       if (!aSMESHGUI){
          CAM_Module* aModule = anApp->module("Mesh");
          CAM_Module* aModule = anApp->module("Mesh");
-         if(!aModule) 
+         if(!aModule)
              aModule = anApp->loadModule("Mesh");
              aModule = anApp->loadModule("Mesh");
-         aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule); 
+         aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule);
        } //SRN: BugID IPAL9186: end of a fix
        aName->SetValue(aSMESHGUI->moduleName());
        anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
        aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
        aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
        myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
        } //SRN: BugID IPAL9186: end of a fix
        aName->SetValue(aSMESHGUI->moduleName());
        anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
        aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
        aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
        myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
-       if(aLocked) 
+       if (aLocked)
          myStudy->GetProperties()->SetLocked(true);
       }
 
          myStudy->GetProperties()->SetLocked(true);
       }
 
@@ -404,18 +390,17 @@ SMESH_Swig::~SMESH_Swig()
 
 
 //===============================================================
 
 
 //===============================================================
-const char* 
-SMESH_Swig::AddNewMesh(const char* theIOR)
+const char* SMESH_Swig::AddNewMesh(const char* theIOR)
 {
   MESSAGE("AddNewMesh");
 
   // VSR: added temporarily - to be removed - objects are published automatically by engine
   SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
 {
   MESSAGE("AddNewMesh");
 
   // VSR: added temporarily - to be removed - objects are published automatically by engine
   SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
-  if(aSObject->_is_nil()){
+  if (aSObject->_is_nil()){
     //Find or Create Hypothesis root
     GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
     GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
     //Find or Create Hypothesis root
     GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
     GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
-    
+
     // Add New Mesh
     aSObject = myStudyBuilder->NewObject(mySComponentMesh);
     SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
     // Add New Mesh
     aSObject = myStudyBuilder->NewObject(mySComponentMesh);
     SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
@@ -433,12 +418,10 @@ SMESH_Swig::AddNewMesh(const char* theIOR)
 
 
 //===============================================================
 
 
 //===============================================================
-const char* 
-SMESH_Swig::AddNewHypothesis(const char* theIOR)
+const char* SMESH_Swig::AddNewHypothesis(const char* theIOR)
 {
 {
-
   MESSAGE("AddNewHypothesis");
   MESSAGE("AddNewHypothesis");
-  
+
   SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR,
                                                   mySComponentMesh,
                                                   myStudyBuilder);
   SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR,
                                                   mySComponentMesh,
                                                   myStudyBuilder);
@@ -448,11 +431,10 @@ SMESH_Swig::AddNewHypothesis(const char* theIOR)
 
 
 //===============================================================
 
 
 //===============================================================
-const char* 
-SMESH_Swig::AddNewAlgorithms(const char* theIOR)
+const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
 {
   MESSAGE("AddNewAlgorithms");
 {
   MESSAGE("AddNewAlgorithms");
-  
+
   SALOMEDS::SObject_var aSObject = ::AddAlgorithms(theIOR,
                                                   mySComponentMesh,
                                                   myStudyBuilder);
   SALOMEDS::SObject_var aSObject = ::AddAlgorithms(theIOR,
                                                   mySComponentMesh,
                                                   myStudyBuilder);
@@ -462,24 +444,22 @@ SMESH_Swig::AddNewAlgorithms(const char* theIOR)
 
 
 //===============================================================
 
 
 //===============================================================
-void 
-SMESH_Swig::SetShape(const char* theShapeEntry, 
-                    const char* theMeshEntry)
+void SMESH_Swig::SetShape(const char* theShapeEntry,
+                          const char* theMeshEntry)
 {
   SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
   SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
 {
   SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
   SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
-  
+
   if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
   if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
-    SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO,Tag_RefOnShape);
+    SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
     myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
   }
 }
 
 
 //===============================================================
     myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
   }
 }
 
 
 //===============================================================
-void 
-SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry, 
-                         const char* theDomainEntry)
+void SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
+                               const char* theDomainEntry)
 {
   ::SetHypothesis(theMeshOrSubMeshEntry,
                  theDomainEntry,
 {
   ::SetHypothesis(theMeshOrSubMeshEntry,
                  theDomainEntry,
@@ -489,9 +469,8 @@ SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
 
 
 //===============================================================
 
 
 //===============================================================
-void 
-SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry, 
-                         const char* theDomainEntry)
+void SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry,
+                               const char* theDomainEntry)
 {
   ::SetAlgorithms(theMeshOrSubMeshEntry,
                  theDomainEntry,
 {
   ::SetAlgorithms(theMeshOrSubMeshEntry,
                  theDomainEntry,
@@ -509,10 +488,9 @@ SMESH_Swig::UnSetHypothesis(const char* theDomainEntry)
     myStudyBuilder->RemoveObject(aDomainSO);
 }
 
     myStudyBuilder->RemoveObject(aDomainSO);
 }
 
-const char* 
-SMESH_Swig::AddSubMesh(const char* theMeshEntry, 
-                      const char* theSubMeshIOR, 
-                      int theShapeType)
+const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
+                                   const char* theSubMeshIOR,
+                                   int theShapeType)
 {
   SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(theMeshEntry);
   if(!aMeshSO->_is_nil()){
 {
   SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(theMeshEntry);
   if(!aMeshSO->_is_nil()){
@@ -520,26 +498,26 @@ SMESH_Swig::AddSubMesh(const char* theMeshEntry,
     QString aSubMeshName;
     switch(theShapeType){
     case TopAbs_SOLID:
     QString aSubMeshName;
     switch(theShapeType){
     case TopAbs_SOLID:
-      aShapeTag = Tag_SubMeshOnSolid;
+      aShapeTag = SMESH::Tag_SubMeshOnSolid;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
       break;
     case TopAbs_FACE:
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
       break;
     case TopAbs_FACE:
-      aShapeTag = Tag_SubMeshOnFace;
+      aShapeTag = SMESH::Tag_SubMeshOnFace;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
       break;
     case TopAbs_EDGE:
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
       break;
     case TopAbs_EDGE:
-      aShapeTag = Tag_SubMeshOnEdge;
+      aShapeTag = SMESH::Tag_SubMeshOnEdge;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
       break;
     case TopAbs_VERTEX:
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
       break;
     case TopAbs_VERTEX:
-      aShapeTag = Tag_SubMeshOnVertex;
+      aShapeTag = SMESH::Tag_SubMeshOnVertex;
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
       break;
     default:
       aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
       break;
     default:
-      aShapeTag = Tag_SubMeshOnCompound;
-      aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");      
+      aShapeTag = SMESH::Tag_SubMeshOnCompound;
+      aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
     }
     }
-      
+
     SALOMEDS::SObject_var aSubMeshesRoot;
     SALOMEDS::GenericAttribute_var anAttr;
     if(!aMeshSO->FindSubObject(aShapeTag,aSubMeshesRoot)){
     SALOMEDS::SObject_var aSubMeshesRoot;
     SALOMEDS::GenericAttribute_var anAttr;
     if(!aMeshSO->FindSubObject(aShapeTag,aSubMeshesRoot)){
@@ -564,11 +542,10 @@ SMESH_Swig::AddSubMesh(const char* theMeshEntry,
   return "";
 }
 
   return "";
 }
 
-const char* 
-SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry, 
-                             const char* theGeomShapeEntry, 
-                             const char* theSubMeshIOR, 
-                             int ShapeType)
+const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
+                                          const char* theGeomShapeEntry,
+                                          const char* theSubMeshIOR,
+                                          int ShapeType)
 {
   SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID(theGeomShapeEntry);
   if(!aGeomShapeSO->_is_nil()){
 {
   SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID(theGeomShapeEntry);
   if(!aGeomShapeSO->_is_nil()){
@@ -605,14 +582,12 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
       aDisp->Display(_entry,1);
     }
   };
       aDisp->Display(_entry,1);
     }
   };
-  
+
   ProcessVoidEvent(new TEvent(Mesh_Entry));
   ProcessVoidEvent(new TEvent(Mesh_Entry));
-  
 }
 
 }
 
-void
-SMESH_Swig::SetName(const char* theEntry, 
-                   const char* theName)
+void SMESH_Swig::SetName(const char* theEntry,
+                         const char* theName)
 {
   SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(theEntry);
   SALOMEDS::GenericAttribute_var anAttr;
 {
   SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(theEntry);
   SALOMEDS::GenericAttribute_var anAttr;
@@ -632,7 +607,7 @@ SMESH_Swig::SetName(const char* theEntry,
  */
 //================================================================================
 
  */
 //================================================================================
 
-void SMESH_Swig::SetMeshIcon(const char* theMeshEntry, 
+void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
                             const bool theIsComputed,
                              const bool isEmpty)
 {
                             const bool theIsComputed,
                              const bool isEmpty)
 {
index 3025f693b849f914932b6415a738c6021240e576..2c6558822498f8e4a6378ee190c451eccab13216 100644 (file)
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 //  File   : SMESH.hxx
 //  Author : Michael ZORIN
 //  Module : SMESH
 //
 //
 //
 //  File   : SMESH.hxx
 //  Author : Michael ZORIN
 //  Module : SMESH
-//  $Header
+//  $Header$
 
 #ifndef _SMESH_I_SMESH_HXX_
 #define _SMESH_I_SMESH_HXX_
 
 #ifndef _SMESH_I_SMESH_HXX_
 #define _SMESH_I_SMESH_HXX_
  #define SMESH_I_EXPORT
 #endif
 
  #define SMESH_I_EXPORT
 #endif
 
-// Tags definition
-enum {
-  // Top level
-  Tag_HypothesisRoot         = 1, // hypotheses root
-  Tag_AlgorithmsRoot         = 2, // algorithms root
-  // Mesh/Submesh
-  Tag_RefOnShape             = 1, // references to shape
-  Tag_RefOnAppliedHypothesis = 2, // applied hypotheses root
-  Tag_RefOnAppliedAlgorithms = 3, // applied algorithms root
-  // Mesh only
-  Tag_SubMeshOnVertex        = 4, // sub-meshes roots by type
-  Tag_SubMeshOnEdge          = 5, // ...
-  Tag_SubMeshOnWire          = 6, // ...
-  Tag_SubMeshOnFace          = 7, // ...
-  Tag_SubMeshOnShell         = 8, // ...
-  Tag_SubMeshOnSolid         = 9, // ...
-  Tag_SubMeshOnCompound      = 10, // ...
-  Tag_NodeGroups             = 11, // Group roots by type
-  Tag_EdgeGroups             = 12, // ...
-  Tag_FaceGroups             = 13, // ...
-  Tag_VolumeGroups           = 14 // ... 
-};
-
 #endif
 #endif
-
index 92cdd2b804005fa2f47afd59d6ce30e57f211ef7..4b0f6971d6f26b22770c276ae54138b2093cfb08 100644 (file)
@@ -327,43 +327,41 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
   {
     int libNameLen = strlen(theLibName);
     //check for old format "libXXXXXXX.so"
   {
     int libNameLen = strlen(theLibName);
     //check for old format "libXXXXXXX.so"
-    iflibNameLen > 7 &&
+    if (libNameLen > 7 &&
         !strncmp( theLibName, "lib", 3 ) &&
         !strncmp( theLibName, "lib", 3 ) &&
-        !strcmp( theLibName+libNameLen-3, ".so" ) )
-      {
-       //the old format
+        !strcmp( theLibName+libNameLen-3, ".so" ))
+    {
+      //the old format
 #ifdef WNT
 #ifdef WNT
-       aPlatformLibName = new char[libNameLen - 1];
-       aPlatformLibName[0] = '\0';
-       aPlatformLibName = strncat( aPlatformLibName, theLibName+3, libNameLen-6  );
-       aPlatformLibName = strcat( aPlatformLibName, ".dll" );
-  aPlatformLibName[libNameLen - 2] = '\0';
+      aPlatformLibName = new char[libNameLen - 1];
+      aPlatformLibName[0] = '\0';
+      aPlatformLibName = strncat( aPlatformLibName, theLibName+3, libNameLen-6  );
+      aPlatformLibName = strcat( aPlatformLibName, ".dll" );
+      aPlatformLibName[libNameLen - 2] = '\0';
 #else
 #else
-       aPlatformLibName = new char[ libNameLen + 1];
-       aPlatformLibName[0] = '\0';
-       aPlatformLibName = strcat( aPlatformLibName, theLibName );
-  aPlatformLibName[libNameLen] = '\0';
+      aPlatformLibName = new char[ libNameLen + 1];
+      aPlatformLibName[0] = '\0';
+      aPlatformLibName = strcat( aPlatformLibName, theLibName );
+      aPlatformLibName[libNameLen] = '\0';
 #endif
 #endif
-
-      }
+    }
     else
     else
-      {
-       //try to use new format 
+    {
+      //try to use new format 
 #ifdef WNT
 #ifdef WNT
-       aPlatformLibName = new char[ libNameLen + 5 ];
-       aPlatformLibName[0] = '\0';
-       aPlatformLibName = strcat( aPlatformLibName, theLibName );
-       aPlatformLibName = strcat( aPlatformLibName, ".dll" );
+      aPlatformLibName = new char[ libNameLen + 5 ];
+      aPlatformLibName[0] = '\0';
+      aPlatformLibName = strcat( aPlatformLibName, theLibName );
+      aPlatformLibName = strcat( aPlatformLibName, ".dll" );
 #else
 #else
-       aPlatformLibName = new char[ libNameLen + 7 ];
-       aPlatformLibName[0] = '\0';
-       aPlatformLibName = strcat( aPlatformLibName, "lib" );
-       aPlatformLibName = strcat( aPlatformLibName, theLibName );
-       aPlatformLibName = strcat( aPlatformLibName, ".so" );
+      aPlatformLibName = new char[ libNameLen + 7 ];
+      aPlatformLibName[0] = '\0';
+      aPlatformLibName = strcat( aPlatformLibName, "lib" );
+      aPlatformLibName = strcat( aPlatformLibName, theLibName );
+      aPlatformLibName = strcat( aPlatformLibName, ".so" );
 #endif
 #endif
-      }
+    }
   }
   }
-  
 
 
   Unexpect aCatch(SALOME_SalomeException);
 
 
   Unexpect aCatch(SALOME_SalomeException);
@@ -418,7 +416,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
     // create a new hypothesis object, store its ref. in studyContext
     if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName);
     myHypothesis_i =
     // create a new hypothesis object, store its ref. in studyContext
     if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName);
     myHypothesis_i =
-      myHypCreatorMap[string(theHypName)]->Create (myPoa, GetCurrentStudyID(), &myGen);
+      myHypCreatorMap[string(theHypName)]->Create(myPoa, GetCurrentStudyID(), &myGen);
     myHypothesis_i->SetLibName(aPlatformLibName/*theLibName*/); // for persistency assurance
   }
   catch (SALOME_Exception& S_ex)
     myHypothesis_i->SetLibName(aPlatformLibName/*theLibName*/); // for persistency assurance
   }
   catch (SALOME_Exception& S_ex)
@@ -439,7 +437,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
 
   return hypothesis_i._retn();
 }
 
   return hypothesis_i._retn();
 }
-  
+
 //=============================================================================
 /*!
  *  SMESH_Gen_i::createMesh
 //=============================================================================
 /*!
  *  SMESH_Gen_i::createMesh
@@ -3708,7 +3706,7 @@ int SMESH_Gen_i::RegisterObject(CORBA::Object_ptr theObject)
  */
 //================================================================================
 
  */
 //================================================================================
 
-int SMESH_Gen_i::GetObjectId(CORBA::Object_ptr theObject)
+CORBA::Long SMESH_Gen_i::GetObjectId(CORBA::Object_ptr theObject)
 {
   StudyContext* myStudyContext = GetCurrentStudyContext();
   if ( myStudyContext && !CORBA::is_nil( theObject )) {
 {
   StudyContext* myStudyContext = GetCurrentStudyContext();
   if ( myStudyContext && !CORBA::is_nil( theObject )) {
index 419e7f3caf8accf24fa929a50e8f52bcefc2702e..d97b6fbf92ff41b3ba3671240e07f32b919e445e 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 //
 //
 //
@@ -427,7 +427,7 @@ public:
   int RegisterObject(CORBA::Object_ptr theObject);
 
   // Return id of registered object
   int RegisterObject(CORBA::Object_ptr theObject);
 
   // Return id of registered object
-  int GetObjectId(CORBA::Object_ptr theObject);
+  CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
 
   // Return an object that previously had an oldID
   template<class TInterface> 
 
   // Return an object that previously had an oldID
   template<class TInterface> 
index 2460bcc1cb82e1ca9891ffd18d3cad1e6eda8a5f..515de42180c5845bc4bfcaab57d4719c2682749e 100644 (file)
@@ -34,8 +34,6 @@
 #include "SMESH_Group_i.hxx"
 #include "SMESH_subMesh_i.hxx"
 
 #include "SMESH_Group_i.hxx"
 #include "SMESH_subMesh_i.hxx"
 
-#include "SMESH.hxx"
-
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
 
 #include "utilities.h"
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
 
 #include "utilities.h"
@@ -59,82 +57,82 @@ static int MYDEBUG = 0;
 
 long SMESH_Gen_i::GetHypothesisRootTag()
 {
 
 long SMESH_Gen_i::GetHypothesisRootTag()
 {
-  return Tag_HypothesisRoot;
+  return SMESH::Tag_HypothesisRoot;
 }
 
 long SMESH_Gen_i::GetAlgorithmsRootTag()
 {
 }
 
 long SMESH_Gen_i::GetAlgorithmsRootTag()
 {
-  return Tag_AlgorithmsRoot;
+  return SMESH::Tag_AlgorithmsRoot;
 }
 
 long SMESH_Gen_i::GetRefOnShapeTag()
 {
 }
 
 long SMESH_Gen_i::GetRefOnShapeTag()
 {
-  return Tag_RefOnShape;
+  return SMESH::Tag_RefOnShape;
 }
 
 long SMESH_Gen_i::GetRefOnAppliedHypothesisTag()
 {
 }
 
 long SMESH_Gen_i::GetRefOnAppliedHypothesisTag()
 {
-  return Tag_RefOnAppliedHypothesis;
+  return SMESH::Tag_RefOnAppliedHypothesis;
 }
 
 long SMESH_Gen_i::GetRefOnAppliedAlgorithmsTag()
 {
 }
 
 long SMESH_Gen_i::GetRefOnAppliedAlgorithmsTag()
 {
-  return Tag_RefOnAppliedAlgorithms;
+  return SMESH::Tag_RefOnAppliedAlgorithms;
 }
 
 long SMESH_Gen_i::GetSubMeshOnVertexTag()
 {
 }
 
 long SMESH_Gen_i::GetSubMeshOnVertexTag()
 {
-  return Tag_SubMeshOnVertex;
+  return SMESH::Tag_SubMeshOnVertex;
 }
 
 long SMESH_Gen_i::GetSubMeshOnEdgeTag()
 {
 }
 
 long SMESH_Gen_i::GetSubMeshOnEdgeTag()
 {
-  return Tag_SubMeshOnEdge;
+  return SMESH::Tag_SubMeshOnEdge;
 }
 
 long SMESH_Gen_i::GetSubMeshOnFaceTag()
 {
 }
 
 long SMESH_Gen_i::GetSubMeshOnFaceTag()
 {
-  return Tag_SubMeshOnFace;
+  return SMESH::Tag_SubMeshOnFace;
 }
 
 long SMESH_Gen_i::GetSubMeshOnSolidTag()
 {
 }
 
 long SMESH_Gen_i::GetSubMeshOnSolidTag()
 {
-  return Tag_SubMeshOnSolid;
+  return SMESH::Tag_SubMeshOnSolid;
 }
 
 long SMESH_Gen_i::GetSubMeshOnCompoundTag()
 {
 }
 
 long SMESH_Gen_i::GetSubMeshOnCompoundTag()
 {
-  return Tag_SubMeshOnCompound;
+  return SMESH::Tag_SubMeshOnCompound;
 }
 
 long SMESH_Gen_i::GetSubMeshOnWireTag()
 {
 }
 
 long SMESH_Gen_i::GetSubMeshOnWireTag()
 {
-  return Tag_SubMeshOnWire;
+  return SMESH::Tag_SubMeshOnWire;
 }
 
 long SMESH_Gen_i::GetSubMeshOnShellTag()
 {
 }
 
 long SMESH_Gen_i::GetSubMeshOnShellTag()
 {
-  return Tag_SubMeshOnShell;
+  return SMESH::Tag_SubMeshOnShell;
 }
 
 long SMESH_Gen_i::GetNodeGroupsTag()
 {
 }
 
 long SMESH_Gen_i::GetNodeGroupsTag()
 {
-  return Tag_NodeGroups;
+  return SMESH::Tag_NodeGroups;
 }
 
 long SMESH_Gen_i::GetEdgeGroupsTag()
 {
 }
 
 long SMESH_Gen_i::GetEdgeGroupsTag()
 {
-  return Tag_EdgeGroups;
+  return SMESH::Tag_EdgeGroups;
 }
 
 long SMESH_Gen_i::GetFaceGroupsTag()
 {
 }
 
 long SMESH_Gen_i::GetFaceGroupsTag()
 {
-  return Tag_FaceGroups;
+  return SMESH::Tag_FaceGroups;
 }
 
 long SMESH_Gen_i::GetVolumeGroupsTag()
 {
 }
 
 long SMESH_Gen_i::GetVolumeGroupsTag()
 {
-  return Tag_VolumeGroups;
+  return SMESH::Tag_VolumeGroups;
 }
 
 //=============================================================================
 }
 
 //=============================================================================
index 5c97f270eb35fca9c69805ee78d9db745634aa62..92c15303d64133cbaeb223f2a3f1c7bc51a700de 100644 (file)
@@ -78,6 +78,12 @@ Fine = 3
 VeryFine = 4
 Custom = 5
 
 VeryFine = 4
 Custom = 5
 
+PrecisionConfusion = 1e-07
+
+def IsEqual(val1, val2, tol=PrecisionConfusion):
+    if abs(val1 - val2) < tol:
+        return True
+    return False
 
 NO_NAME = "NoName"
 
 
 NO_NAME = "NoName"
 
@@ -414,7 +420,7 @@ import omniORB
 #Register the new proxy for SMESH_Gen
 omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC)
 
 #Register the new proxy for SMESH_Gen
 omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC)
 
-    
+
 ## Mother class to define algorithm, recommended to do not use directly.
 #
 #  More details.
 ## Mother class to define algorithm, recommended to do not use directly.
 #
 #  More details.
@@ -422,8 +428,6 @@ class Mesh_Algorithm:
     #  @class Mesh_Algorithm
     #  @brief Class Mesh_Algorithm
 
     #  @class Mesh_Algorithm
     #  @brief Class Mesh_Algorithm
 
-    #17908#hypos = {}
-
     #def __init__(self,smesh):
     #    self.smesh=smesh
     def __init__(self):
     #def __init__(self,smesh):
     #    self.smesh=smesh
     def __init__(self):
@@ -432,11 +436,84 @@ class Mesh_Algorithm:
         self.subm = None
         self.algo = None
 
         self.subm = None
         self.algo = None
 
-    #17908#def FindHypothesis(self,hypname, args):
-    #17908#    key = "%s %s %s" % (self.__class__.__name__, hypname, args)
-    #17908#    if Mesh_Algorithm.hypos.has_key( key ):
-    #17908#        return Mesh_Algorithm.hypos[ key ]
-    #17908#    return None
+    ## Find hypothesis in study by its type name and parameters.
+    #  Find only those hypothesis, which was created in smeshpyD engine.
+    def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD):
+        study = smeshpyD.GetCurrentStudy()
+        #to do: find component by smeshpyD object, not by its data type
+        scomp = study.FindComponent(smeshpyD.ComponentDataType())
+        if scomp is not None:
+            res,hypRoot = scomp.FindSubObject(SMESH.Tag_HypothesisRoot)
+            # is hypotheses root label exists?
+            if res and hypRoot is not None:
+                iter = study.NewChildIterator(hypRoot)
+                # check all published hypotheses
+                while iter.More():
+                    hypo_so_i = iter.Value()
+                    attr = hypo_so_i.FindAttribute("AttributeIOR")[1]
+                    if attr is not None:
+                        anIOR = attr.Value()
+                        hypo_o_i = salome.orb.string_to_object(anIOR)
+                        if hypo_o_i is not None:
+                            # is hypothesis?
+                            hypo_i = hypo_o_i._narrow(SMESH.SMESH_Hypothesis)
+                            if hypo_i is not None:
+                                # belongs to this engine?
+                                if smeshpyD.GetObjectId(hypo_i) > 0:
+                                    # is it the needed hypothesis?
+                                    if hypo_i.GetName() == hypname:
+                                        # check args
+                                        if CompareMethod(hypo_i, args):
+                                            # found!!!
+                                            return hypo_i
+                                        pass
+                                    pass
+                                pass
+                            pass
+                        pass
+                    iter.Next()
+                    pass
+                pass
+            pass
+        return None
+
+    ## Find algorithm in study by its type name.
+    #  Find only those algorithm, which was created in smeshpyD engine.
+    def FindAlgorithm (self, algoname, smeshpyD):
+        study = smeshpyD.GetCurrentStudy()
+        #to do: find component by smeshpyD object, not by its data type
+        scomp = study.FindComponent(smeshpyD.ComponentDataType())
+        if scomp is not None:
+            res,hypRoot = scomp.FindSubObject(SMESH.Tag_AlgorithmsRoot)
+            # is algorithms root label exists?
+            if res and hypRoot is not None:
+                iter = study.NewChildIterator(hypRoot)
+                # check all published algorithms
+                while iter.More():
+                    algo_so_i = iter.Value()
+                    attr = algo_so_i.FindAttribute("AttributeIOR")[1]
+                    if attr is not None:
+                        anIOR = attr.Value()
+                        algo_o_i = salome.orb.string_to_object(anIOR)
+                        if algo_o_i is not None:
+                            # is algorithm?
+                            algo_i = algo_o_i._narrow(SMESH.SMESH_Algo)
+                            if algo_i is not None:
+                                # belongs to this engine?
+                                if smeshpyD.GetObjectId(algo_i) > 0:
+                                    # is it the needed algorithm?
+                                    if algo_i.GetName() == algoname:
+                                        # found!!!
+                                        return algo_i
+                                    pass
+                                pass
+                            pass
+                        pass
+                    iter.Next()
+                    pass
+                pass
+            pass
+        return None
 
     ## If the algorithm is global, return 0; \n
     #  else return the submesh associated to this algorithm.
 
     ## If the algorithm is global, return 0; \n
     #  else return the submesh associated to this algorithm.
@@ -470,14 +547,17 @@ class Mesh_Algorithm:
     def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
         if geom is None:
             raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
     def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
         if geom is None:
             raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
-        algo = mesh.smeshpyD.CreateHypothesis(hypo, so)
+        algo = self.FindAlgorithm(hypo, mesh.smeshpyD)
+        if algo is None:
+            algo = mesh.smeshpyD.CreateHypothesis(hypo, so)
+            pass
         self.Assign(algo, mesh, geom)
         return self.algo
 
     ## Private method
     def Assign(self, algo, mesh, geom):
         if geom is None:
         self.Assign(algo, mesh, geom)
         return self.algo
 
     ## Private method
     def Assign(self, algo, mesh, geom):
         if geom is None:
-            raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
+            raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape"
         self.mesh = mesh
         piece = mesh.geom
         if not geom:
         self.mesh = mesh
         piece = mesh.geom
         if not geom:
@@ -494,17 +574,23 @@ class Mesh_Algorithm:
         status = mesh.mesh.AddHypothesis(self.geom, self.algo)
         TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True )
 
         status = mesh.mesh.AddHypothesis(self.geom, self.algo)
         TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True )
 
+    def CompareHyp (self, hyp, args):
+        print "CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName()
+        return False
+
+    def CompareEqualHyp (self, hyp, args):
+        return True
+
     ## Private method
     ## Private method
-    def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so", UseExisting=0):
-        CreateNew = 1
-        #17908#if UseExisting:
-        #17908#    hypo = self.FindHypothesis(hyp, args)
-        #17908#    if hypo: CreateNew = 0
-        #17908#    pass
-        if CreateNew:
+    def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so",
+                    UseExisting=0, CompareMethod=""):
+        hypo = None
+        if UseExisting:
+            if CompareMethod == "": CompareMethod = self.CompareHyp
+            hypo = self.FindHypothesis(hyp, args, CompareMethod, self.mesh.smeshpyD)
+            pass
+        if hypo is None:
             hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so)
             hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so)
-            key = "%s %s %s" % (self.__class__.__name__, hyp, args)
-            #17908#Mesh_Algorithm.hypos[key] = hypo
             a = ""
             s = "="
             i = 0
             a = ""
             s = "="
             i = 0
@@ -513,8 +599,7 @@ class Mesh_Algorithm:
                 a = a + s + str(args[i])
                 s = ","
                 i = i + 1
                 a = a + s + str(args[i])
                 s = ","
                 i = i + 1
-                name = GetName(self.geom)
-            #SetName(hypo, name + "/" + hyp + a) - NPAL16198
+                pass
             SetName(hypo, hyp + a)
             pass
         status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
             SetName(hypo, hyp + a)
             pass
         status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
@@ -530,17 +615,9 @@ class Mesh_Algorithm:
 #  More details.
 class Mesh_Segment(Mesh_Algorithm):
 
 #  More details.
 class Mesh_Segment(Mesh_Algorithm):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_Segments
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-
-        #17908#if not Mesh_Segment.algo:
-        #17908#    Mesh_Segment.algo = self.Create(mesh, geom, "Regular_1D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_Segment.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "Regular_1D")
 
     ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
         self.Create(mesh, geom, "Regular_1D")
 
     ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
@@ -548,10 +625,15 @@ class Mesh_Segment(Mesh_Algorithm):
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def LocalLength(self, l, UseExisting=0):
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def LocalLength(self, l, UseExisting=0):
-        hyp = self.Hypothesis("LocalLength", [l], UseExisting=UseExisting)
+        hyp = self.Hypothesis("LocalLength", [l], UseExisting=UseExisting,
+                              CompareMethod=self.CompareLocalLength)
         hyp.SetLength(l)
         return hyp
 
         hyp.SetLength(l)
         return hyp
 
+    ## Check if the given "LocalLength" hypothesis has the same parameters as given arguments
+    def CompareLocalLength(self, hyp, args):
+        return IsEqual(hyp.GetLength(), args[0])
+
     ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
     #  @param n for the number of segments that cut an edge
     #  @param s for the scale factor (optional)
     ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
     #  @param n for the number of segments that cut an edge
     #  @param s for the scale factor (optional)
@@ -559,79 +641,142 @@ class Mesh_Segment(Mesh_Algorithm):
     #                     same parameters, else (default) - create new
     def NumberOfSegments(self, n, s=[], UseExisting=0):
         if s == []:
     #                     same parameters, else (default) - create new
     def NumberOfSegments(self, n, s=[], UseExisting=0):
         if s == []:
-            hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting)
+            hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting,
+                                  CompareMethod=self.CompareNumberOfSegments)
         else:
         else:
-            hyp = self.Hypothesis("NumberOfSegments", [n,s], UseExisting=UseExisting)
+            hyp = self.Hypothesis("NumberOfSegments", [n,s], UseExisting=UseExisting,
+                                  CompareMethod=self.CompareNumberOfSegments)
             hyp.SetDistrType( 1 )
             hyp.SetScaleFactor(s)
         hyp.SetNumberOfSegments(n)
         return hyp
 
             hyp.SetDistrType( 1 )
             hyp.SetScaleFactor(s)
         hyp.SetNumberOfSegments(n)
         return hyp
 
+    ## Check if the given "NumberOfSegments" hypothesis has the same parameters as given arguments
+    def CompareNumberOfSegments(self, hyp, args):
+        if hyp.GetNumberOfSegments() == args[0]:
+            if len(args) == 1:
+                return True
+            else:
+                if hyp.GetDistrType() == 1:
+                    if IsEqual(hyp.GetScaleFactor(), args[1]):
+                        return True
+        return False
+
     ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
     #  @param start for the length of the first segment
     #  @param end   for the length of the last  segment
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def Arithmetic1D(self, start, end, UseExisting=0):
     ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
     #  @param start for the length of the first segment
     #  @param end   for the length of the last  segment
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def Arithmetic1D(self, start, end, UseExisting=0):
-        hyp = self.Hypothesis("Arithmetic1D", [start, end], UseExisting=UseExisting)
+        hyp = self.Hypothesis("Arithmetic1D", [start, end], UseExisting=UseExisting,
+                              CompareMethod=self.CompareArithmetic1D)
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
-        
+
+    ## Check if the given "Arithmetic1D" hypothesis has the same parameters as given arguments
+    def CompareArithmetic1D(self, hyp, args):
+        if IsEqual(hyp.GetLength(1), args[0]):
+            if IsEqual(hyp.GetLength(0), args[1]):
+                return True
+        return False
+
     ## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
     #  @param start for the length of the first segment
     #  @param end   for the length of the last  segment
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def StartEndLength(self, start, end, UseExisting=0):
     ## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
     #  @param start for the length of the first segment
     #  @param end   for the length of the last  segment
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def StartEndLength(self, start, end, UseExisting=0):
-        hyp = self.Hypothesis("StartEndLength", [start, end], UseExisting=UseExisting)
+        hyp = self.Hypothesis("StartEndLength", [start, end], UseExisting=UseExisting,
+                              CompareMethod=self.CompareStartEndLength)
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
-        
+
+    ## Check if the given "StartEndLength" hypothesis has the same parameters as given arguments
+    def CompareStartEndLength(self, hyp, args):
+        if IsEqual(hyp.GetLength(1), args[0]):
+            if IsEqual(hyp.GetLength(0), args[1]):
+                return True
+        return False
+
     ## Define "Deflection1D" hypothesis
     #  @param d for the deflection
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def Deflection1D(self, d, UseExisting=0):
     ## Define "Deflection1D" hypothesis
     #  @param d for the deflection
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def Deflection1D(self, d, UseExisting=0):
-        hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting)
+        hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting,
+                              CompareMethod=self.CompareDeflection1D)
         hyp.SetDeflection(d)
         return hyp
         hyp.SetDeflection(d)
         return hyp
-        
+
+    ## Check if the given "Deflection1D" hypothesis has the same parameters as given arguments
+    def CompareDeflection1D(self, hyp, args):
+        return IsEqual(hyp.GetDeflection(), args[0])
+
     ## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
     #  the opposite side in the case of quadrangular faces
     def Propagation(self):
     ## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
     #  the opposite side in the case of quadrangular faces
     def Propagation(self):
-        return self.Hypothesis("Propagation", UseExisting=1)
+        return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
 
     ## Define "AutomaticLength" hypothesis
     #  @param fineness for the fineness [0-1]
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def AutomaticLength(self, fineness=0, UseExisting=0):
 
     ## Define "AutomaticLength" hypothesis
     #  @param fineness for the fineness [0-1]
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def AutomaticLength(self, fineness=0, UseExisting=0):
-        hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting)
+        hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting,
+                              CompareMethod=self.CompareAutomaticLength)
         hyp.SetFineness( fineness )
         return hyp
 
         hyp.SetFineness( fineness )
         return hyp
 
+    ## Check if the given "AutomaticLength" hypothesis has the same parameters as given arguments
+    def CompareAutomaticLength(self, hyp, args):
+        return IsEqual(hyp.GetFineness(), args[0])
+
     ## Define "SegmentLengthAroundVertex" hypothesis
     #  @param length for the segment length
     ## Define "SegmentLengthAroundVertex" hypothesis
     #  @param length for the segment length
-    #  @param vertex for the length localization: vertex index [0,1] | verext object
+    #  @param vertex for the length localization: vertex index [0,1] | vertex object.
+    #         Any other integer value means what hypo will be set on the
+    #         whole 1D shape, where Mesh_Segment algorithm is assigned.
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def LengthNearVertex(self, length, vertex=0, UseExisting=0):
         import types
         store_geom = self.geom
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def LengthNearVertex(self, length, vertex=0, UseExisting=0):
         import types
         store_geom = self.geom
-        if vertex:
-            if type(vertex) is types.IntType:
+        if type(vertex) is types.IntType:
+            if vertex == 0 or vertex == 1:
                 vertex = self.mesh.geompyD.SubShapeAllSorted(self.geom, geompyDC.ShapeType["VERTEX"])[vertex]
                 vertex = self.mesh.geompyD.SubShapeAllSorted(self.geom, geompyDC.ShapeType["VERTEX"])[vertex]
+                self.geom = vertex
                 pass
                 pass
+            pass
+        else:
             self.geom = vertex
             pass
             self.geom = vertex
             pass
-        hyp = self.Hypothesis("SegmentAroundVertex_0D",[length],UseExisting=UseExisting)
-        hyp = self.Hypothesis("SegmentLengthAroundVertex",[length],UseExisting=UseExisting)
+        ### 0D algorithm
+        if self.geom is None:
+            raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape"
+        name = GetName(self.geom)
+        if name == NO_NAME:
+            piece = self.mesh.geom
+            name = self.mesh.geompyD.SubShapeName(self.geom, piece)
+            self.mesh.geompyD.addToStudyInFather(piece, self.geom, name)
+        algo = self.FindAlgorithm("SegmentAroundVertex_0D", self.mesh.smeshpyD)
+        if algo is None:
+            algo = self.mesh.smeshpyD.CreateHypothesis("SegmentAroundVertex_0D", "libStdMeshersEngine.so")
+            pass
+        status = self.mesh.mesh.AddHypothesis(self.geom, algo)
+        TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True)
+        ###
+        hyp = self.Hypothesis("SegmentLengthAroundVertex", [length], UseExisting=UseExisting,
+                              CompareMethod=self.CompareLengthNearVertex)
         self.geom = store_geom
         hyp.SetLength( length )
         return hyp
 
         self.geom = store_geom
         hyp.SetLength( length )
         return hyp
 
+    ## Check if the given "LengthNearVertex" hypothesis has the same parameters as given arguments
+    def CompareLengthNearVertex(self, hyp, args):
+        return IsEqual(hyp.GetLength(), args[0])
+
     ## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
     #  If the 2D mesher sees that all boundary edges are quadratic ones,
     #  it generates quadratic faces, else it generates linear faces using
     ## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
     #  If the 2D mesher sees that all boundary edges are quadratic ones,
     #  it generates quadratic faces, else it generates linear faces using
@@ -639,7 +784,7 @@ class Mesh_Segment(Mesh_Algorithm):
     #  The 3D mesher generates quadratic volumes only if all boundary faces
     #  are quadratic ones, else it fails.
     def QuadraticMesh(self):
     #  The 3D mesher generates quadratic volumes only if all boundary faces
     #  are quadratic ones, else it fails.
     def QuadraticMesh(self):
-        hyp = self.Hypothesis("QuadraticMesh", UseExisting=1)
+        hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
         return hyp
 
 # Public class: Mesh_CompositeSegment
         return hyp
 
 # Public class: Mesh_CompositeSegment
@@ -650,15 +795,8 @@ class Mesh_Segment(Mesh_Algorithm):
 #  More details.
 class Mesh_CompositeSegment(Mesh_Segment):
 
 #  More details.
 class Mesh_CompositeSegment(Mesh_Segment):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_CompositeSegments
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
     ## Private constructor.
     def __init__(self, mesh, geom=0):
-        #17908#if not Mesh_CompositeSegment.algo:
-        #17908#    Mesh_CompositeSegment.algo = self.Create(mesh, geom, "CompositeSegment_1D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_CompositeSegment.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "CompositeSegment_1D")
 
 
         self.Create(mesh, geom, "CompositeSegment_1D")
 
 
@@ -670,29 +808,30 @@ class Mesh_CompositeSegment(Mesh_Segment):
 #  More details.
 class Mesh_Segment_Python(Mesh_Segment):
 
 #  More details.
 class Mesh_Segment_Python(Mesh_Segment):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_Segment_Pythons
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         import Python1dPlugin
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         import Python1dPlugin
-        #17908#if not Mesh_Segment_Python.algo:
-        #17908#    Mesh_Segment_Python.algo = self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
-        #17908#else:
-        #17908#    self.Assign( Mesh_Segment_Python.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
         self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
-    
+
     ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
     #  @param n for the number of segments that cut an edge
     #  @param func for the python function that calculate the length of all segments
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def PythonSplit1D(self, n, func, UseExisting=0):
     ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
     #  @param n for the number of segments that cut an edge
     #  @param func for the python function that calculate the length of all segments
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def PythonSplit1D(self, n, func, UseExisting=0):
-        hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so", UseExisting=UseExisting)
+        hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so",
+                              UseExisting=UseExisting, CompareMethod=self.ComparePythonSplit1D)
         hyp.SetNumberOfSegments(n)
         hyp.SetPythonLog10RatioFunction(func)
         return hyp
         hyp.SetNumberOfSegments(n)
         hyp.SetPythonLog10RatioFunction(func)
         return hyp
-        
+
+    ## Check if the given "PythonSplit1D" hypothesis has the same parameters as given arguments
+    def ComparePythonSplit1D(self, hyp, args):
+        #if hyp.GetNumberOfSegments() == args[0]:
+        #    if hyp.GetPythonLog10RatioFunction() == args[1]:
+        #        return True
+        return False
+
 # Public class: Mesh_Triangle
 # ---------------------------
 
 # Public class: Mesh_Triangle
 # ---------------------------
 
@@ -708,22 +847,12 @@ class Mesh_Triangle(Mesh_Algorithm):
     _angleMeshS = 8
     _gradation  = 1.1
 
     _angleMeshS = 8
     _gradation  = 1.1
 
-    # algorithm objects common for all instances of Mesh_Triangle
-    #17908#algoMEF = 0
-    #17908#algoNET = 0
-    #17908#algoNET_2D = 0
-
     ## Private constructor.
     def __init__(self, mesh, algoType, geom=0):
         Mesh_Algorithm.__init__(self)
 
         self.algoType = algoType
         if algoType == MEFISTO:
     ## Private constructor.
     def __init__(self, mesh, algoType, geom=0):
         Mesh_Algorithm.__init__(self)
 
         self.algoType = algoType
         if algoType == MEFISTO:
-            #17908#if not Mesh_Triangle.algoMEF:
-            #17908#    Mesh_Triangle.algoMEF = self.Create(mesh, geom, "MEFISTO_2D")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Triangle.algoMEF, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "MEFISTO_2D")
             pass
         elif algoType == BLSURF:
             self.Create(mesh, geom, "MEFISTO_2D")
             pass
         elif algoType == BLSURF:
@@ -734,47 +863,42 @@ class Mesh_Triangle(Mesh_Algorithm):
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module unavailable"
                 pass
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module unavailable"
                 pass
-            #17908#if not Mesh_Triangle.algoNET:
-            #17908#    Mesh_Triangle.algoNET = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Triangle.algoNET, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
             pass
         elif algoType == NETGEN_2D:
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module unavailable"
                 pass
             self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
             pass
         elif algoType == NETGEN_2D:
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module unavailable"
                 pass
-            #17908#if not Mesh_Triangle.algoNET_2D:
-            #17908#    Mesh_Triangle.algoNET_2D = self.Create(mesh, geom,
-            #17908#                                          "NETGEN_2D_ONLY", "libNETGENEngine.so")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Triangle.algoNET_2D, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
             pass
 
             self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
             pass
 
-    ## Define "MaxElementArea" hypothesis to give the maximun area of each triangles
-    #  @param area for the maximum area of each triangles
+    ## Define "MaxElementArea" hypothesis to give the maximum area of each triangle
+    #  @param area for the maximum area of each triangle
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     #
     #  Only for algoType == MEFISTO || NETGEN_2D
     def MaxElementArea(self, area, UseExisting=0):
         if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     #
     #  Only for algoType == MEFISTO || NETGEN_2D
     def MaxElementArea(self, area, UseExisting=0):
         if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
-            hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting)
+            hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
+                                  CompareMethod=self.CompareMaxElementArea)
             hyp.SetMaxElementArea(area)
             return hyp
         elif self.algoType == NETGEN:
             print "Netgen 1D-2D algo doesn't support this hypothesis"
             return None
 
             hyp.SetMaxElementArea(area)
             return hyp
         elif self.algoType == NETGEN:
             print "Netgen 1D-2D algo doesn't support this hypothesis"
             return None
 
-    ## Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
+    ## Check if the given "MaxElementArea" hypothesis has the same parameters as given arguments
+    def CompareMaxElementArea(self, hyp, args):
+        return IsEqual(hyp.GetMaxElementArea(), args[0])
+
+    ## Define "LengthFromEdges" hypothesis to build triangles
+    #  based on the length of the edges taken from the wire
     #
     #  Only for algoType == MEFISTO || NETGEN_2D
     def LengthFromEdges(self):
         if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
     #
     #  Only for algoType == MEFISTO || NETGEN_2D
     def LengthFromEdges(self):
         if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
-            hyp = self.Hypothesis("LengthFromEdges", UseExisting=1)
+            hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
             return hyp
         elif self.algoType == NETGEN:
             print "Netgen 1D-2D algo doesn't support this hypothesis"
             return hyp
         elif self.algoType == NETGEN:
             print "Netgen 1D-2D algo doesn't support this hypothesis"
@@ -823,7 +947,7 @@ class Mesh_Triangle(Mesh_Algorithm):
     def SetQuadAllowed(self, toAllow=True):
         if self.algoType == NETGEN_2D:
             if toAllow: # add QuadranglePreference
     def SetQuadAllowed(self, toAllow=True):
         if self.algoType == NETGEN_2D:
             if toAllow: # add QuadranglePreference
-                self.Hypothesis("QuadranglePreference", UseExisting=1)
+                self.Hypothesis("QuadranglePreference", UseExisting=1, CompareMethod=self.CompareEqualHyp)
             else:       # remove QuadranglePreference
                 for hyp in self.mesh.GetHypothesisList( self.geom ):
                     if hyp.GetName() == "QuadranglePreference":
             else:       # remove QuadranglePreference
                 for hyp in self.mesh.GetHypothesisList( self.geom ):
                     if hyp.GetName() == "QuadranglePreference":
@@ -832,7 +956,9 @@ class Mesh_Triangle(Mesh_Algorithm):
                     pass
                 pass
             return
                     pass
                 pass
             return
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params:
             self.params.SetQuadAllowed(toAllow)
             return
 
             self.params.SetQuadAllowed(toAllow)
             return
 
@@ -852,7 +978,8 @@ class Mesh_Triangle(Mesh_Algorithm):
             print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
             return None
         elif self.algoType == BLSURF:
             print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
             return None
         elif self.algoType == BLSURF:
-            self.params = self.Hypothesis("BLSURF_Parameters", [], "libBLSURFEngine.so")
+            self.params = self.Hypothesis("BLSURF_Parameters", [],
+                                          "libBLSURFEngine.so", UseExisting=0)
             return self.params
         return None
 
             return self.params
         return None
 
@@ -938,26 +1065,19 @@ class Mesh_Triangle(Mesh_Algorithm):
 #  More details.
 class Mesh_Quadrangle(Mesh_Algorithm):
 
 #  More details.
 class Mesh_Quadrangle(Mesh_Algorithm):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_Quadrangles
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-
-        #17908#if not Mesh_Quadrangle.algo:
-        #17908#    Mesh_Quadrangle.algo = self.Create(mesh, geom, "Quadrangle_2D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_Quadrangle.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "Quadrangle_2D")
         self.Create(mesh, geom, "Quadrangle_2D")
-    
+
     ## Define "QuadranglePreference" hypothesis, forcing construction
     #  of quadrangles if the number of nodes on opposite edges is not the same
     #  in the case where the global number of nodes on edges is even
     def QuadranglePreference(self):
     ## Define "QuadranglePreference" hypothesis, forcing construction
     #  of quadrangles if the number of nodes on opposite edges is not the same
     #  in the case where the global number of nodes on edges is even
     def QuadranglePreference(self):
-        hyp = self.Hypothesis("QuadranglePreference", UseExisting=1)
+        hyp = self.Hypothesis("QuadranglePreference", UseExisting=1,
+                              CompareMethod=self.CompareEqualHyp)
         return hyp
         return hyp
-    
+
 # Public class: Mesh_Tetrahedron
 # ------------------------------
 
 # Public class: Mesh_Tetrahedron
 # ------------------------------
 
@@ -969,30 +1089,15 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
     params = 0
     algoType = 0
 
     params = 0
     algoType = 0
 
-    #17908#algoNET = 0 # algorithm object common for all Mesh_Tetrahedrons
-    #17908#algoGHS = 0 # algorithm object common for all Mesh_Tetrahedrons
-    #17908#algoFNET = 0 # algorithm object common for all Mesh_Tetrahedrons
-
     ## Private constructor.
     def __init__(self, mesh, algoType, geom=0):
         Mesh_Algorithm.__init__(self)
 
         if algoType == NETGEN:
     ## Private constructor.
     def __init__(self, mesh, algoType, geom=0):
         Mesh_Algorithm.__init__(self)
 
         if algoType == NETGEN:
-            #17908#if not Mesh_Tetrahedron.algoNET:
-            #17908#    Mesh_Tetrahedron.algoNET = self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Tetrahedron.algoNET, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
             pass
 
         elif algoType == GHS3D:
             self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
             pass
 
         elif algoType == GHS3D:
-            #17908#if not Mesh_Tetrahedron.algoGHS:
-            #17908#    import GHS3DPlugin
-            #17908#    Mesh_Tetrahedron.algoGHS = self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Tetrahedron.algoGHS, mesh, geom)
-            #17908#    pass
             import GHS3DPlugin
             self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
             pass
             import GHS3DPlugin
             self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
             pass
@@ -1000,11 +1105,6 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
         elif algoType == FULL_NETGEN:
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module has not been imported."
         elif algoType == FULL_NETGEN:
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module has not been imported."
-            #17908#if not Mesh_Tetrahedron.algoFNET:
-            #17908#    Mesh_Tetrahedron.algoFNET = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Tetrahedron.algoFNET, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
             pass
 
             self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
             pass
 
@@ -1015,10 +1115,15 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def MaxElementVolume(self, vol, UseExisting=0):
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def MaxElementVolume(self, vol, UseExisting=0):
-        hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting)
+        hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting,
+                              CompareMethod=self.CompareMaxElementVolume)
         hyp.SetMaxElementVolume(vol)
         return hyp
 
         hyp.SetMaxElementVolume(vol)
         return hyp
 
+    ## Check if the given "MaxElementVolume" hypothesis has the same parameters as given arguments
+    def CompareMaxElementVolume(self, hyp, args):
+        return IsEqual(hyp.GetMaxElementVolume(), args[0])
+
     ## Define "Netgen 3D Parameters" hypothesis
     def Parameters(self):
         if (self.algoType == FULL_NETGEN):
     ## Define "Netgen 3D Parameters" hypothesis
     def Parameters(self):
         if (self.algoType == FULL_NETGEN):
@@ -1034,7 +1139,7 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
         if self.params == 0:
             self.Parameters()
         self.params.SetMaxSize(theSize)
         if self.params == 0:
             self.Parameters()
         self.params.SetMaxSize(theSize)
-        
+
     ## Set SecondOrder flag
     def SetSecondOrder(self, theVal):
         if self.params == 0:
     ## Set SecondOrder flag
     def SetSecondOrder(self, theVal):
         if self.params == 0:
@@ -1081,61 +1186,32 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
 #  More details.
 class Mesh_Hexahedron(Mesh_Algorithm):
 
 #  More details.
 class Mesh_Hexahedron(Mesh_Algorithm):
 
-#     #17908#algo = 0 # algorithm object common for all Mesh_Hexahedrons
-# 
-#     ## Private constructor.
-#     def __init__(self, mesh, geom=0):
-#         Mesh_Algorithm.__init__(self)
-# 
-#         #17908#if not Mesh_Hexahedron.algo:
-#         #17908#    Mesh_Hexahedron.algo = self.Create(mesh, geom, "Hexa_3D")
-#         #17908#else:
-#         #17908#    self.Assign( Mesh_Hexahedron.algo, mesh, geom)
-#         #17908#    pass
-#         self.Create(mesh, geom, "Hexa_3D")
-
-    #17908#params = 0
-    #17908#algoType = 0
-
-    #17908#algoHEXA = 0 # algorithm object common for all Mesh_Hexahedron's
-    #17908#algoHEXO = 0 # algorithm object common for all Mesh_Hexahedron's
+    params = 0
+    algoType = 0
 
     ## Private constructor.
     def __init__(self, mesh, algoType=Hexa, geom=0):
         Mesh_Algorithm.__init__(self)
 
 
     ## Private constructor.
     def __init__(self, mesh, algoType=Hexa, geom=0):
         Mesh_Algorithm.__init__(self)
 
+        self.algoType = algoType
+
         if algoType == Hexa:
         if algoType == Hexa:
-            #17908#if not Mesh_Hexahedron.algoHEXA:
-            #17908#    Mesh_Hexahedron.algoHEXA = self.Create(mesh, geom, "Hexa_3D")
-            #17908#else:
-            #17908#    self.Assign(Mesh_Hexahedron.algoHEXA, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "Hexa_3D")
             pass
 
         elif algoType == Hexotic:
             self.Create(mesh, geom, "Hexa_3D")
             pass
 
         elif algoType == Hexotic:
-            #17908#if not Mesh_Hexahedron.algoHEXO:
-            #17908#    import HexoticPlugin
-            #17908#    Mesh_Hexahedron.algoHEXO = self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
-            #17908#else:
-            #17908#    self.Assign(Mesh_Hexahedron.algoHEXO, mesh, geom)
-            #17908#    pass
             import HexoticPlugin
             self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
             pass
 
     ## Define "MinMaxQuad" hypothesis to give the three hexotic parameters
     def MinMaxQuad(self, min=3, max=8, quad=True):
             import HexoticPlugin
             self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
             pass
 
     ## Define "MinMaxQuad" hypothesis to give the three hexotic parameters
     def MinMaxQuad(self, min=3, max=8, quad=True):
-        #17908#self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
-        #17908#self.params.SetHexesMinLevel(min)
-        #17908#self.params.SetHexesMaxLevel(max)
-        #17908#self.params.SetHexoticQuadrangles(quad)
-        #17908#return self.params
-        params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
-        params.SetHexesMinLevel(min)
-        params.SetHexesMaxLevel(max)
-        params.SetHexoticQuadrangles(quad)
-        return params
+        self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so",
+                                      UseExisting=0)
+        self.params.SetHexesMinLevel(min)
+        self.params.SetHexesMaxLevel(max)
+        self.params.SetHexoticQuadrangles(quad)
+        return self.params
 
 # Deprecated, only for compatibility!
 # Public class: Mesh_Netgen
 
 # Deprecated, only for compatibility!
 # Public class: Mesh_Netgen
@@ -1151,32 +1227,19 @@ class Mesh_Netgen(Mesh_Algorithm):
 
     is3D = 0
 
 
     is3D = 0
 
-    #17908#algoNET23 = 0 # algorithm object common for all Mesh_Netgens
-    #17908#algoNET2 = 0 # algorithm object common for all Mesh_Netgens
-
     ## Private constructor.
     def __init__(self, mesh, is3D, geom=0):
         Mesh_Algorithm.__init__(self)
 
         if noNETGENPlugin:
             print "Warning: NETGENPlugin module has not been imported."
     ## Private constructor.
     def __init__(self, mesh, is3D, geom=0):
         Mesh_Algorithm.__init__(self)
 
         if noNETGENPlugin:
             print "Warning: NETGENPlugin module has not been imported."
-            
+
         self.is3D = is3D
         if is3D:
         self.is3D = is3D
         if is3D:
-            #17908#if not Mesh_Netgen.algoNET23:
-            #17908#    Mesh_Netgen.algoNET23 = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Netgen.algoNET23, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
             pass
 
         else:
             self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
             pass
 
         else:
-            #17908#if not Mesh_Netgen.algoNET2:
-            #17908#    Mesh_Netgen.algoNET2 = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
-            #17908#else:
-            #17908#    self.Assign( Mesh_Netgen.algoNET2, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
             pass
 
             self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
             pass
 
@@ -1198,17 +1261,9 @@ class Mesh_Netgen(Mesh_Algorithm):
 #  More details.
 class Mesh_Projection1D(Mesh_Algorithm):
 
 #  More details.
 class Mesh_Projection1D(Mesh_Algorithm):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_Projection1Ds
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-
-        #17908#if not Mesh_Projection1D.algo:
-        #17908#    Mesh_Projection1D.algo = self.Create(mesh, geom, "Projection_1D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_Projection1D.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "Projection_1D")
 
     ## Define "Source Edge" hypothesis, specifying a meshed edge to
         self.Create(mesh, geom, "Projection_1D")
 
     ## Define "Source Edge" hypothesis, specifying a meshed edge to
@@ -1222,7 +1277,9 @@ class Mesh_Projection1D(Mesh_Algorithm):
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0):
     #  @param UseExisting if ==true - search existing hypothesis created with
     #                     same parameters, else (default) - create new
     def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0):
-        hyp = self.Hypothesis("ProjectionSource1D", [edge,mesh,srcV,tgtV], UseExisting=UseExisting)
+        hyp = self.Hypothesis("ProjectionSource1D", [edge,mesh,srcV,tgtV],
+                              UseExisting=0)
+                              #UseExisting=UseExisting, CompareMethod=self.CompareSourceEdge)
         hyp.SetSourceEdge( edge )
         if not mesh is None and isinstance(mesh, Mesh):
             mesh = mesh.GetMesh()
         hyp.SetSourceEdge( edge )
         if not mesh is None and isinstance(mesh, Mesh):
             mesh = mesh.GetMesh()
@@ -1230,6 +1287,11 @@ class Mesh_Projection1D(Mesh_Algorithm):
         hyp.SetVertexAssociation( srcV, tgtV )
         return hyp
 
         hyp.SetVertexAssociation( srcV, tgtV )
         return hyp
 
+    ## Check if the given "SourceEdge" hypothesis has the same parameters as given arguments
+    #def CompareSourceEdge(self, hyp, args):
+    #    # seems to be not really useful to reuse existing "SourceEdge" hypothesis
+    #    return False
+
 
 # Public class: Mesh_Projection2D
 # ------------------------------
 
 # Public class: Mesh_Projection2D
 # ------------------------------
@@ -1239,17 +1301,9 @@ class Mesh_Projection1D(Mesh_Algorithm):
 #  More details.
 class Mesh_Projection2D(Mesh_Algorithm):
 
 #  More details.
 class Mesh_Projection2D(Mesh_Algorithm):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_Projection2Ds
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-
-        #17908#if not Mesh_Projection2D.algo:
-        #17908#    Mesh_Projection2D.algo = self.Create(mesh, geom, "Projection_2D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_Projection2D.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "Projection_2D")
 
     ## Define "Source Face" hypothesis, specifying a meshed face to
         self.Create(mesh, geom, "Projection_2D")
 
     ## Define "Source Face" hypothesis, specifying a meshed face to
@@ -1270,7 +1324,8 @@ class Mesh_Projection2D(Mesh_Algorithm):
     def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None,
                    srcV2=None, tgtV2=None, UseExisting=0):
         hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
     def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None,
                    srcV2=None, tgtV2=None, UseExisting=0):
         hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
-                              UseExisting=UseExisting)
+                              UseExisting=0)
+                              #UseExisting=UseExisting, CompareMethod=self.CompareSourceFace)
         hyp.SetSourceFace( face )
         if not mesh is None and isinstance(mesh, Mesh):
             mesh = mesh.GetMesh()
         hyp.SetSourceFace( face )
         if not mesh is None and isinstance(mesh, Mesh):
             mesh = mesh.GetMesh()
@@ -1278,6 +1333,11 @@ class Mesh_Projection2D(Mesh_Algorithm):
         hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
         return hyp
 
         hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
         return hyp
 
+    ## Check if the given "SourceFace" hypothesis has the same parameters as given arguments
+    #def CompareSourceFace(self, hyp, args):
+    #    # seems to be not really useful to reuse existing "SourceFace" hypothesis
+    #    return False
+
 # Public class: Mesh_Projection3D
 # ------------------------------
 
 # Public class: Mesh_Projection3D
 # ------------------------------
 
@@ -1286,17 +1346,9 @@ class Mesh_Projection2D(Mesh_Algorithm):
 #  More details.
 class Mesh_Projection3D(Mesh_Algorithm):
 
 #  More details.
 class Mesh_Projection3D(Mesh_Algorithm):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_Projection3Ds
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-
-        #17908#if not Mesh_Projection3D.algo:
-        #17908#    Mesh_Projection3D.algo = self.Create(mesh, geom, "Projection_3D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_Projection3D.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "Projection_3D")
 
     ## Define "Source Shape 3D" hypothesis, specifying a meshed solid to
         self.Create(mesh, geom, "Projection_3D")
 
     ## Define "Source Shape 3D" hypothesis, specifying a meshed solid to
@@ -1318,7 +1370,8 @@ class Mesh_Projection3D(Mesh_Algorithm):
                       srcV2=0, tgtV2=0, UseExisting=0):
         hyp = self.Hypothesis("ProjectionSource3D",
                               [solid,mesh,srcV1,tgtV1,srcV2,tgtV2],
                       srcV2=0, tgtV2=0, UseExisting=0):
         hyp = self.Hypothesis("ProjectionSource3D",
                               [solid,mesh,srcV1,tgtV1,srcV2,tgtV2],
-                              UseExisting=UseExisting)
+                              UseExisting=0)
+                              #UseExisting=UseExisting, CompareMethod=self.CompareSourceShape3D)
         hyp.SetSource3DShape( solid )
         if not mesh is None and isinstance(mesh, Mesh):
             mesh = mesh.GetMesh()
         hyp.SetSource3DShape( solid )
         if not mesh is None and isinstance(mesh, Mesh):
             mesh = mesh.GetMesh()
@@ -1326,6 +1379,11 @@ class Mesh_Projection3D(Mesh_Algorithm):
         hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
         return hyp
 
         hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
         return hyp
 
+    ## Check if the given "SourceShape3D" hypothesis has the same parameters as given arguments
+    #def CompareSourceShape3D(self, hyp, args):
+    #    # seems to be not really useful to reuse existing "SourceShape3D" hypothesis
+    #    return False
+
 
 # Public class: Mesh_Prism
 # ------------------------
 
 # Public class: Mesh_Prism
 # ------------------------
@@ -1335,17 +1393,9 @@ class Mesh_Projection3D(Mesh_Algorithm):
 #  More details.
 class Mesh_Prism3D(Mesh_Algorithm):
 
 #  More details.
 class Mesh_Prism3D(Mesh_Algorithm):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_Prism3Ds
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-
-        #17908#if not Mesh_Prism3D.algo:
-        #17908#    Mesh_Prism3D.algo = self.Create(mesh, geom, "Prism_3D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_Prism3D.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "Prism_3D")
 
 # Public class: Mesh_RadialPrism
         self.Create(mesh, geom, "Prism_3D")
 
 # Public class: Mesh_RadialPrism
@@ -1356,20 +1406,12 @@ class Mesh_Prism3D(Mesh_Algorithm):
 #  More details.
 class Mesh_RadialPrism3D(Mesh_Algorithm):
 
 #  More details.
 class Mesh_RadialPrism3D(Mesh_Algorithm):
 
-    #17908#algo = 0 # algorithm object common for all Mesh_RadialPrism3Ds
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
-
-        #17908#if not Mesh_RadialPrism3D.algo:
-        #17908#    Mesh_RadialPrism3D.algo = self.Create(mesh, geom, "RadialPrism_3D")
-        #17908#else:
-        #17908#    self.Assign( Mesh_RadialPrism3D.algo, mesh, geom)
-        #17908#    pass
         self.Create(mesh, geom, "RadialPrism_3D")
 
         self.Create(mesh, geom, "RadialPrism_3D")
 
-        self.distribHyp = self.Hypothesis( "LayerDistribution", UseExisting=0)
+        self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0)
         self.nbLayers = None
 
     ## Return 3D hypothesis holding the 1D one
         self.nbLayers = None
 
     ## Return 3D hypothesis holding the 1D one
@@ -1395,32 +1437,37 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
     #                     same parameters, else (default) - create new
     def NumberOfLayers(self, n, UseExisting=0):
         self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
     #                     same parameters, else (default) - create new
     def NumberOfLayers(self, n, UseExisting=0):
         self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
-        self.nbLayers = self.Hypothesis("NumberOfLayers", [n], UseExisting=UseExisting)
+        self.nbLayers = self.Hypothesis("NumberOfLayers", [n], UseExisting=UseExisting,
+                                        CompareMethod=self.CompareNumberOfLayers)
         self.nbLayers.SetNumberOfLayers( n )
         return self.nbLayers
 
         self.nbLayers.SetNumberOfLayers( n )
         return self.nbLayers
 
+    ## Check if the given "NumberOfLayers" hypothesis has the same parameters as given arguments
+    def CompareNumberOfLayers(self, hyp, args):
+        return IsEqual(hyp.GetNumberOfLayers(), args[0])
+
     ## Define "LocalLength" hypothesis, specifying segment length
     #  to build between the inner and outer shells
     #  @param l for the length of segments
     def LocalLength(self, l):
     ## Define "LocalLength" hypothesis, specifying segment length
     #  to build between the inner and outer shells
     #  @param l for the length of segments
     def LocalLength(self, l):
-        hyp = self.OwnHypothesis("LocalLength", [l] )
+        hyp = self.OwnHypothesis("LocalLength", [l])
         hyp.SetLength(l)
         return hyp
         hyp.SetLength(l)
         return hyp
-        
+
     ## Define "NumberOfSegments" hypothesis, specifying a number of layers of
     #  prisms to build between the inner and outer shells
     #  @param n for the number of segments
     #  @param s for the scale factor (optional)
     def NumberOfSegments(self, n, s=[]):
         if s == []:
     ## Define "NumberOfSegments" hypothesis, specifying a number of layers of
     #  prisms to build between the inner and outer shells
     #  @param n for the number of segments
     #  @param s for the scale factor (optional)
     def NumberOfSegments(self, n, s=[]):
         if s == []:
-            hyp = self.OwnHypothesis("NumberOfSegments", [n] )
+            hyp = self.OwnHypothesis("NumberOfSegments", [n])
         else:
             hyp = self.OwnHypothesis("NumberOfSegments", [n,s])
             hyp.SetDistrType( 1 )
             hyp.SetScaleFactor(s)
         hyp.SetNumberOfSegments(n)
         return hyp
         else:
             hyp = self.OwnHypothesis("NumberOfSegments", [n,s])
             hyp.SetDistrType( 1 )
             hyp.SetScaleFactor(s)
         hyp.SetNumberOfSegments(n)
         return hyp
-        
+
     ## Define "Arithmetic1D" hypothesis, specifying distribution of segments
     #  to build between the inner and outer shells as arithmetic length increasing
     #  @param start for the length of the first segment
     ## Define "Arithmetic1D" hypothesis, specifying distribution of segments
     #  to build between the inner and outer shells as arithmetic length increasing
     #  @param start for the length of the first segment
@@ -1430,7 +1477,7 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
-        
+
     ## Define "StartEndLength" hypothesis, specifying distribution of segments
     #  to build between the inner and outer shells as geometric length increasing
     #  @param start for the length of the first segment
     ## Define "StartEndLength" hypothesis, specifying distribution of segments
     #  to build between the inner and outer shells as geometric length increasing
     #  @param start for the length of the first segment
@@ -1440,7 +1487,7 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
         hyp.SetLength(start, 1)
         hyp.SetLength(end  , 0)
         return hyp
-        
+
     ## Define "AutomaticLength" hypothesis, specifying number of segments
     #  to build between the inner and outer shells
     #  @param fineness for the fineness [0-1]
     ## Define "AutomaticLength" hypothesis, specifying number of segments
     #  to build between the inner and outer shells
     #  @param fineness for the fineness [0-1]
@@ -1453,23 +1500,10 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
 # -------------------------------
 class Mesh_UseExisting(Mesh_Algorithm):
 
 # -------------------------------
 class Mesh_UseExisting(Mesh_Algorithm):
 
-    #17908#algo1D = 0 # StdMeshers_UseExisting_1D object common for all Mesh_UseExisting
-    #17908#algo2D = 0 # StdMeshers_UseExisting_2D object common for all Mesh_UseExisting
-
     def __init__(self, dim, mesh, geom=0):
         if dim == 1:
     def __init__(self, dim, mesh, geom=0):
         if dim == 1:
-            #17908#if not Mesh_UseExisting.algo1D:
-            #17908#    Mesh_UseExisting.algo1D= self.Create(mesh, geom, "UseExisting_1D")
-            #17908#else:
-            #17908#    self.Assign( Mesh_UseExisting.algo1D, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "UseExisting_1D")
         else:
             self.Create(mesh, geom, "UseExisting_1D")
         else:
-            #17908#if not Mesh_UseExisting.algo2D:
-            #17908#    Mesh_UseExisting.algo2D= self.Create(mesh, geom, "UseExisting_2D")
-            #17908#else:
-            #17908#    self.Assign( Mesh_UseExisting.algo2D, mesh, geom)
-            #17908#    pass
             self.Create(mesh, geom, "UseExisting_2D")
 
 # Public class: Mesh
             self.Create(mesh, geom, "UseExisting_2D")
 
 # Public class: Mesh
@@ -1516,7 +1550,7 @@ class Mesh:
     def SetMesh(self, theMesh):
         self.mesh = theMesh
         self.geom = self.mesh.GetShapeToMesh()
     def SetMesh(self, theMesh):
         self.mesh = theMesh
         self.geom = self.mesh.GetShapeToMesh()
-            
+
     ## Method that returns the mesh
     #  @return SMESH_Mesh object
     def GetMesh(self):
     ## Method that returns the mesh
     #  @return SMESH_Mesh object
     def GetMesh(self):
@@ -1530,7 +1564,7 @@ class Mesh:
     ## Set name to mesh
     def SetName(self, name):
         SetName(self.GetMesh(), name)
     ## Set name to mesh
     def SetName(self, name):
         SetName(self.GetMesh(), name)
-    
+
     ## Get the subMesh object associated to a subShape. The subMesh object
     #  gives access to nodes and elements IDs.
     #  \n SubMesh will be used instead of SubShape in a next idl version to
     ## Get the subMesh object associated to a subShape. The subMesh object
     #  gives access to nodes and elements IDs.
     #  \n SubMesh will be used instead of SubShape in a next idl version to
@@ -1538,7 +1572,7 @@ class Mesh:
     def GetSubMesh(self, theSubObject, name):
         submesh = self.mesh.GetSubMesh(theSubObject, name)
         return submesh
     def GetSubMesh(self, theSubObject, name):
         submesh = self.mesh.GetSubMesh(theSubObject, name)
         return submesh
-        
+
     ## Method that returns the shape associated to the mesh
     #  @return GEOM_Object
     def GetShape(self):
     ## Method that returns the shape associated to the mesh
     #  @return GEOM_Object
     def GetShape(self):
@@ -1562,7 +1596,7 @@ class Mesh:
     #  @return a list of errors
     def GetAlgoState(self, theSubObject):
         return self.smeshpyD.GetAlgoState(self.mesh, theSubObject)
     #  @return a list of errors
     def GetAlgoState(self, theSubObject):
         return self.smeshpyD.GetAlgoState(self.mesh, theSubObject)
-    
+
     ## Return geometrical object the given element is built on.
     #  The returned geometrical object, if not nil, is either found in the
     #  study or is published by this method with the given name
     ## Return geometrical object the given element is built on.
     #  The returned geometrical object, if not nil, is either found in the
     #  study or is published by this method with the given name
@@ -1572,7 +1606,7 @@ class Mesh:
     #  @return GEOM::GEOM_Object instance
     def GetGeometryByMeshElement(self, theElementID, theGeomName):
         return self.smeshpyD.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName )
     #  @return GEOM::GEOM_Object instance
     def GetGeometryByMeshElement(self, theElementID, theGeomName):
         return self.smeshpyD.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName )
-        
+
     ## Returns mesh dimension depending on shape one
     def MeshDimension(self):
         shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] )
     ## Returns mesh dimension depending on shape one
     def MeshDimension(self):
         shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] )
@@ -1585,7 +1619,7 @@ class Mesh:
         else:
             return 0;
         pass
         else:
             return 0;
         pass
-        
+
     ## Creates a segment discretization 1D algorithm.
     #  If the optional \a algo parameter is not sets, this algorithm is REGULAR.
     #  If the optional \a geom parameter is not sets, this algorithm is global.
     ## Creates a segment discretization 1D algorithm.
     #  If the optional \a algo parameter is not sets, this algorithm is REGULAR.
     #  If the optional \a geom parameter is not sets, this algorithm is global.
@@ -1606,7 +1640,7 @@ class Mesh:
             return Mesh_CompositeSegment(self, geom)
         else:
             return Mesh_Segment(self, geom)
             return Mesh_CompositeSegment(self, geom)
         else:
             return Mesh_Segment(self, geom)
-        
+
     ## Enable creation of nodes and segments usable by 2D algoritms.
     #  Added nodes and segments must be bound to edges and vertices by
     #  SetNodeOnVertex(), SetNodeOnEdge() and SetMeshElementOnShape()
     ## Enable creation of nodes and segments usable by 2D algoritms.
     #  Added nodes and segments must be bound to edges and vertices by
     #  SetNodeOnVertex(), SetNodeOnEdge() and SetMeshElementOnShape()
@@ -1639,9 +1673,9 @@ class Mesh:
         if ( isinstance( algo, geompyDC.GEOM._objref_GEOM_Object)):
             geom = algo
             algo = MEFISTO
         if ( isinstance( algo, geompyDC.GEOM._objref_GEOM_Object)):
             geom = algo
             algo = MEFISTO
-        
+
         return Mesh_Triangle(self,  algo, geom)
         return Mesh_Triangle(self,  algo, geom)
-        
+
     ## Creates a quadrangle 2D algorithm for faces.
     #  If the optional \a geom parameter is not sets, this algorithm is global.
     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
     ## Creates a quadrangle 2D algorithm for faces.
     #  If the optional \a geom parameter is not sets, this algorithm is global.
     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
@@ -1662,7 +1696,7 @@ class Mesh:
             if not algo: algo = NETGEN
             pass
         return Mesh_Tetrahedron(self,  algo, geom)
             if not algo: algo = NETGEN
             pass
         return Mesh_Tetrahedron(self,  algo, geom)
-        
+
     ## Creates a hexahedron 3D algorithm for solids.
     #  If the optional \a geom parameter is not sets, this algorithm is global.
     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
     ## Creates a hexahedron 3D algorithm for solids.
     #  If the optional \a geom parameter is not sets, this algorithm is global.
     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
@@ -1795,7 +1829,7 @@ class Mesh:
             self.Tetrahedron(NETGEN)
             pass
         return self.Compute()
             self.Tetrahedron(NETGEN)
             pass
         return self.Compute()
-        
+
     ## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
     #  The parameter \a fineness [0,-1] defines mesh fineness
     def AutomaticHexahedralization(self, fineness=0):
     ## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
     #  The parameter \a fineness [0,-1] defines mesh fineness
     def AutomaticHexahedralization(self, fineness=0):
@@ -1814,7 +1848,7 @@ class Mesh:
     ## Assign hypothesis
     #  @param hyp is a hypothesis to assign
     #  @param geom is subhape of mesh geometry
     ## Assign hypothesis
     #  @param hyp is a hypothesis to assign
     #  @param geom is subhape of mesh geometry
-    def AddHypothesis(self, hyp, geom=0 ):
+    def AddHypothesis(self, hyp, geom=0):
         if isinstance( hyp, Mesh_Algorithm ):
             hyp = hyp.GetAlgorithm()
             pass
         if isinstance( hyp, Mesh_Algorithm ):
             hyp = hyp.GetAlgorithm()
             pass
@@ -1825,11 +1859,11 @@ class Mesh:
         isAlgo = hyp._narrow( SMESH_Algo )
         TreatHypoStatus( status, GetName( hyp ), GetName( geom ), isAlgo )
         return status
         isAlgo = hyp._narrow( SMESH_Algo )
         TreatHypoStatus( status, GetName( hyp ), GetName( geom ), isAlgo )
         return status
-    
+
     ## Unassign hypothesis
     #  @param hyp is a hypothesis to unassign
     #  @param geom is subhape of mesh geometry
     ## Unassign hypothesis
     #  @param hyp is a hypothesis to unassign
     #  @param geom is subhape of mesh geometry
-    def RemoveHypothesis(self, hyp, geom=0 ):
+    def RemoveHypothesis(self, hyp, geom=0):
         if isinstance( hyp, Mesh_Algorithm ):
             hyp = hyp.GetAlgorithm()
             pass
         if isinstance( hyp, Mesh_Algorithm ):
             hyp = hyp.GetAlgorithm()
             pass
@@ -1851,7 +1885,7 @@ class Mesh:
             self.mesh.RemoveHypothesis( self.geom, hyp )
             pass
         pass
             self.mesh.RemoveHypothesis( self.geom, hyp )
             pass
         pass
-        
+
     ## Create a mesh group based on geometric object \a grp
     #  and give a \a name, \n if this parameter is not defined
     #  the name is the same as the geometric group name \n
     ## Create a mesh group based on geometric object \a grp
     #  and give a \a name, \n if this parameter is not defined
     #  the name is the same as the geometric group name \n
@@ -1861,14 +1895,14 @@ class Mesh:
     #  @return SMESH_GroupOnGeom
     def Group(self, grp, name=""):
         return self.GroupOnGeom(grp, name)
     #  @return SMESH_GroupOnGeom
     def Group(self, grp, name=""):
         return self.GroupOnGeom(grp, name)
-       
+
     ## Deprecated, only for compatibility! Please, use ExportMED() method instead.
     #  Export the mesh in a file with the MED format and choice the \a version of MED format
     #  @param f is the file name
     #  @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
     def ExportToMED(self, f, version, opt=0):
         self.mesh.ExportToMED(f, opt, version)
     ## Deprecated, only for compatibility! Please, use ExportMED() method instead.
     #  Export the mesh in a file with the MED format and choice the \a version of MED format
     #  @param f is the file name
     #  @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
     def ExportToMED(self, f, version, opt=0):
         self.mesh.ExportToMED(f, opt, version)
-        
+
     ## Export the mesh in a file with the MED format
     #  @param f is the file name
     #  @param auto_groups boolean parameter for creating/not creating
     ## Export the mesh in a file with the MED format
     #  @param f is the file name
     #  @param auto_groups boolean parameter for creating/not creating
@@ -1877,17 +1911,17 @@ class Mesh:
     #  @param version MED format version(MED_V2_1 or MED_V2_2)
     def ExportMED(self, f, auto_groups=0, version=MED_V2_2):
         self.mesh.ExportToMED(f, auto_groups, version)
     #  @param version MED format version(MED_V2_1 or MED_V2_2)
     def ExportMED(self, f, auto_groups=0, version=MED_V2_2):
         self.mesh.ExportToMED(f, auto_groups, version)
-        
+
     ## Export the mesh in a file with the DAT format
     #  @param f is the file name
     def ExportDAT(self, f):
         self.mesh.ExportDAT(f)
     ## Export the mesh in a file with the DAT format
     #  @param f is the file name
     def ExportDAT(self, f):
         self.mesh.ExportDAT(f)
-        
+
     ## Export the mesh in a file with the UNV format
     #  @param f is the file name
     def ExportUNV(self, f):
         self.mesh.ExportUNV(f)
     ## Export the mesh in a file with the UNV format
     #  @param f is the file name
     def ExportUNV(self, f):
         self.mesh.ExportUNV(f)
-        
+
     ## Export the mesh in a file with the STL format
     #  @param f is the file name
     #  @param ascii defined the kind of file contents
     ## Export the mesh in a file with the STL format
     #  @param f is the file name
     #  @param ascii defined the kind of file contents
@@ -1904,7 +1938,7 @@ class Mesh:
     #  @return SMESH_Group
     def CreateEmptyGroup(self, elementType, name):
         return self.mesh.CreateGroup(elementType, name)
     #  @return SMESH_Group
     def CreateEmptyGroup(self, elementType, name):
         return self.mesh.CreateGroup(elementType, name)
-    
+
     ## Creates a mesh group based on geometric object \a grp
     #  and give a \a name, \n if this parameter is not defined
     #  the name is the same as the geometric group name
     ## Creates a mesh group based on geometric object \a grp
     #  and give a \a name, \n if this parameter is not defined
     #  the name is the same as the geometric group name
@@ -1956,7 +1990,7 @@ class Mesh:
         group = self.mesh.CreateGroup(elementType, groupName)
         group.Add(elemIDs)
         return group
         group = self.mesh.CreateGroup(elementType, groupName)
         group.Add(elemIDs)
         return group
-    
+
     ## Create a mesh group by the given conditions
     #  @param groupName is the name of the mesh group
     #  @param elementType is the type of elements in the group
     ## Create a mesh group by the given conditions
     #  @param groupName is the name of the mesh group
     #  @param elementType is the type of elements in the group
@@ -1988,7 +2022,7 @@ class Mesh:
         aFilter.SetCriteria(aCriteria)
         group = self.MakeGroupByFilter(groupName, aFilter)
         return group
         aFilter.SetCriteria(aCriteria)
         group = self.MakeGroupByFilter(groupName, aFilter)
         return group
-    
+
     ## Create a mesh group by the given criteria(list of criterions)
     #  @param groupName is the name of the mesh group
     #  @param Criteria is the list of criterions
     ## Create a mesh group by the given criteria(list of criterions)
     #  @param groupName is the name of the mesh group
     #  @param Criteria is the list of criterions
@@ -1999,7 +2033,7 @@ class Mesh:
         aFilter.SetCriteria(theCriteria)
         group = self.MakeGroupByFilter(groupName, aFilter)
         return group
         aFilter.SetCriteria(theCriteria)
         group = self.MakeGroupByFilter(groupName, aFilter)
         return group
-    
+
     ## Create a mesh group by the given filter
     #  @param groupName is the name of the mesh group
     #  @param Criterion is the instance of Filter class
     ## Create a mesh group by the given filter
     #  @param groupName is the name of the mesh group
     #  @param Criterion is the instance of Filter class
@@ -2033,7 +2067,7 @@ class Mesh:
     ## Remove group with its contents
     def RemoveGroupWithContents(self, group):
         self.mesh.RemoveGroupWithContents(group)
     ## Remove group with its contents
     def RemoveGroupWithContents(self, group):
         self.mesh.RemoveGroupWithContents(group)
-        
+
     ## Get the list of groups existing in the mesh
     def GetGroups(self):
         return self.mesh.GetGroups()
     ## Get the list of groups existing in the mesh
     def GetGroups(self):
         return self.mesh.GetGroups()
@@ -2061,7 +2095,7 @@ class Mesh:
     #  present in both initial groups are added to the new one.
     def IntersectGroups(self, group1, group2, name):
         return self.mesh.IntersectGroups(group1, group2, name)
     #  present in both initial groups are added to the new one.
     def IntersectGroups(self, group1, group2, name):
         return self.mesh.IntersectGroups(group1, group2, name)
-    
+
     ## Cut of two groups
     #  New group is created. All mesh elements that are present in
     #  main group but do not present in tool group are added to the new one
     ## Cut of two groups
     #  New group is created. All mesh elements that are present in
     #  main group but do not present in tool group are added to the new one
@@ -2106,7 +2140,7 @@ class Mesh:
     #  Consider maximum group name length stored in MED file.
     def HasDuplicatedGroupNamesMED(self):
         return self.mesh.HasDuplicatedGroupNamesMED()
     #  Consider maximum group name length stored in MED file.
     def HasDuplicatedGroupNamesMED(self):
         return self.mesh.HasDuplicatedGroupNamesMED()
-        
+
     ## Obtain instance of SMESH_MeshEditor
     def GetMeshEditor(self):
         return self.mesh.GetMeshEditor()
     ## Obtain instance of SMESH_MeshEditor
     def GetMeshEditor(self):
         return self.mesh.GetMeshEditor()
@@ -2114,8 +2148,8 @@ class Mesh:
     ## Get MED Mesh
     def GetMEDMesh(self):
         return self.mesh.GetMEDMesh()
     ## Get MED Mesh
     def GetMEDMesh(self):
         return self.mesh.GetMEDMesh()
-    
-    
+
+
     # Get informations about mesh contents:
     # ------------------------------------
 
     # Get informations about mesh contents:
     # ------------------------------------
 
@@ -2136,7 +2170,7 @@ class Mesh:
     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
     def NbEdgesOfOrder(self, elementOrder):
         return self.mesh.NbEdgesOfOrder(elementOrder)
     #  ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
     def NbEdgesOfOrder(self, elementOrder):
         return self.mesh.NbEdgesOfOrder(elementOrder)
-    
+
     ## Returns number of faces in mesh
     def NbFaces(self):
         return self.mesh.NbFaces()
     ## Returns number of faces in mesh
     def NbFaces(self):
         return self.mesh.NbFaces()
@@ -2241,10 +2275,10 @@ class Mesh:
     ## Returns list of mesh nodes ids
     def GetNodesId(self):
         return self.mesh.GetNodesId()
     ## Returns list of mesh nodes ids
     def GetNodesId(self):
         return self.mesh.GetNodesId()
-    
+
     # Get informations about mesh elements:
     # ------------------------------------
     # Get informations about mesh elements:
     # ------------------------------------
-    
+
     ## Returns type of mesh element
     def GetElementType(self, id, iselem):
         return self.mesh.GetElementType(id, iselem)
     ## Returns type of mesh element
     def GetElementType(self, id, iselem):
         return self.mesh.GetElementType(id, iselem)
@@ -2268,7 +2302,7 @@ class Mesh:
         else:
             ShapeID = Shape
         return self.mesh.GetSubMeshNodesId(ShapeID, all)
         else:
             ShapeID = Shape
         return self.mesh.GetSubMeshNodesId(ShapeID, all)
-    
+
     ## Returns list of ids of submesh elements with given type
     #  @param Shape is geom object(subshape) IOR
     #  Shape must be subshape of a ShapeToMesh()
     ## Returns list of ids of submesh elements with given type
     #  @param Shape is geom object(subshape) IOR
     #  Shape must be subshape of a ShapeToMesh()
@@ -2278,12 +2312,12 @@ class Mesh:
         else:
             ShapeID = Shape
         return self.mesh.GetSubMeshElementType(ShapeID)
         else:
             ShapeID = Shape
         return self.mesh.GetSubMeshElementType(ShapeID)
-      
+
     ## Get mesh description
     def Dump(self):
         return self.mesh.Dump()
 
     ## Get mesh description
     def Dump(self):
         return self.mesh.Dump()
 
-    
+
     # Get information about nodes and elements of mesh by its ids:
     # -----------------------------------------------------------
 
     # Get information about nodes and elements of mesh by its ids:
     # -----------------------------------------------------------
 
@@ -2312,7 +2346,7 @@ class Mesh:
     #  \n If there is not element for given ID - returns -1
     def GetShapeIDForElem(self,id):
         return self.mesh.GetShapeIDForElem(id)
     #  \n If there is not element for given ID - returns -1
     def GetShapeIDForElem(self,id):
         return self.mesh.GetShapeIDForElem(id)
-    
+
     ## Returns number of nodes for given element
     #  \n If there is not element for given ID - returns -1
     def GetElemNbNodes(self, id):
     ## Returns number of nodes for given element
     #  \n If there is not element for given ID - returns -1
     def GetElemNbNodes(self, id):
@@ -2332,7 +2366,7 @@ class Mesh:
     #  in given quadratic element
     def IsMediumNode(self, elementID, nodeID):
         return self.mesh.IsMediumNode(elementID, nodeID)
     #  in given quadratic element
     def IsMediumNode(self, elementID, nodeID):
         return self.mesh.IsMediumNode(elementID, nodeID)
-    
+
     ## Returns true if given node is medium node
     #  in one of quadratic elements
     def IsMediumNodeOfAnyElem(self, nodeID, elementType):
     ## Returns true if given node is medium node
     #  in one of quadratic elements
     def IsMediumNodeOfAnyElem(self, nodeID, elementType):
@@ -2341,7 +2375,7 @@ class Mesh:
     ## Returns number of edges for given element
     def ElemNbEdges(self, id):
         return self.mesh.ElemNbEdges(id)
     ## Returns number of edges for given element
     def ElemNbEdges(self, id):
         return self.mesh.ElemNbEdges(id)
-        
+
     ## Returns number of faces for given element
     def ElemNbFaces(self, id):
         return self.mesh.ElemNbFaces(id)
     ## Returns number of faces for given element
     def ElemNbFaces(self, id):
         return self.mesh.ElemNbFaces(id)
@@ -2359,8 +2393,8 @@ class Mesh:
     #  \n If there is not element for given ID - returns empty list
     def BaryCenter(self, id):
         return self.mesh.BaryCenter(id)
     #  \n If there is not element for given ID - returns empty list
     def BaryCenter(self, id):
         return self.mesh.BaryCenter(id)
-    
-    
+
+
     # Mesh edition (SMESH_MeshEditor functionality):
     # ---------------------------------------------
 
     # Mesh edition (SMESH_MeshEditor functionality):
     # ---------------------------------------------
 
@@ -2378,7 +2412,7 @@ class Mesh:
     def AddNode(self, x, y, z):
         return self.editor.AddNode( x, y, z)
 
     def AddNode(self, x, y, z):
         return self.editor.AddNode( x, y, z)
 
-    
+
     ## Create edge both similar and quadratic (this is determed
     #  by number of given nodes).
     #  @param IdsOfNodes List of node IDs for creation of element.
     ## Create edge both similar and quadratic (this is determed
     #  by number of given nodes).
     #  @param IdsOfNodes List of node IDs for creation of element.
@@ -2396,11 +2430,11 @@ class Mesh:
     #  http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
     def AddFace(self, IDsOfNodes):
         return self.editor.AddFace(IDsOfNodes)
     #  http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
     def AddFace(self, IDsOfNodes):
         return self.editor.AddFace(IDsOfNodes)
-    
+
     ## Add polygonal face to mesh by list of nodes ids
     def AddPolygonalFace(self, IdsOfNodes):
         return self.editor.AddPolygonalFace(IdsOfNodes)
     ## Add polygonal face to mesh by list of nodes ids
     def AddPolygonalFace(self, IdsOfNodes):
         return self.editor.AddPolygonalFace(IdsOfNodes)
-    
+
     ## Create volume both similar and quadratic (this is determed
     #  by number of given nodes).
     #  @param IdsOfNodes List of node IDs for creation of element.
     ## Create volume both similar and quadratic (this is determed
     #  by number of given nodes).
     #  @param IdsOfNodes List of node IDs for creation of element.
@@ -2424,7 +2458,7 @@ class Mesh:
     #         of the given faces, not to the faces itself.
     def AddPolyhedralVolumeByFaces (self, IdsOfFaces):
         return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces)
     #         of the given faces, not to the faces itself.
     def AddPolyhedralVolumeByFaces (self, IdsOfFaces):
         return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces)
-    
+
 
     ## @brief Bind a node to a vertex
     # @param NodeID - node ID
 
     ## @brief Bind a node to a vertex
     # @param NodeID - node ID
@@ -2762,7 +2796,7 @@ class Mesh:
         self.SplitQuadsNearTriangularFacets()
 
         return isDone
         self.SplitQuadsNearTriangularFacets()
 
         return isDone
-    
+
     ## Smooth elements
     #  @param IDsOfElements list if ids of elements to smooth
     #  @param IDsOfFixedNodes list of ids of fixed nodes.
     ## Smooth elements
     #  @param IDsOfElements list if ids of elements to smooth
     #  @param IDsOfFixedNodes list of ids of fixed nodes.
@@ -2776,7 +2810,7 @@ class Mesh:
             IDsOfElements = self.GetElementsId()
         return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes,
                                   MaxNbOfIterations, MaxAspectRatio, Method)
             IDsOfElements = self.GetElementsId()
         return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes,
                                   MaxNbOfIterations, MaxAspectRatio, Method)
-    
+
     ## Smooth elements belong to given object
     #  @param theObject object to smooth
     #  @param IDsOfFixedNodes list of ids of fixed nodes.
     ## Smooth elements belong to given object
     #  @param theObject object to smooth
     #  @param IDsOfFixedNodes list of ids of fixed nodes.
@@ -2788,7 +2822,7 @@ class Mesh:
                      MaxNbOfIterations, MaxxAspectRatio, Method):
         if ( isinstance( theObject, Mesh )):
             theObject = theObject.GetMesh()
                      MaxNbOfIterations, MaxxAspectRatio, Method):
         if ( isinstance( theObject, Mesh )):
             theObject = theObject.GetMesh()
-        return self.editor.SmoothObject(theObject, IDsOfFixedNodes, 
+        return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
                                         MaxNbOfIterations, MaxxAspectRatio, Method)
 
     ## Parametric smooth the given elements
                                         MaxNbOfIterations, MaxxAspectRatio, Method)
 
     ## Parametric smooth the given elements
@@ -2804,7 +2838,7 @@ class Mesh:
             IDsOfElements = self.GetElementsId()
         return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes,
                                             MaxNbOfIterations, MaxAspectRatio, Method)
             IDsOfElements = self.GetElementsId()
         return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes,
                                             MaxNbOfIterations, MaxAspectRatio, Method)
-    
+
     ## Parametric smooth elements belong to given object
     #  @param theObject object to smooth
     #  @param IDsOfFixedNodes list of ids of fixed nodes.
     ## Parametric smooth elements belong to given object
     #  @param theObject object to smooth
     #  @param IDsOfFixedNodes list of ids of fixed nodes.
@@ -2936,7 +2970,7 @@ class Mesh:
             return self.editor.ExtrusionSweepObject1DMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
         return []
             return self.editor.ExtrusionSweepObject1DMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
         return []
-    
+
     ## Generate new elements by extrusion of the elements belong to object
     #  @param theObject object wich elements should be processed
     #  @param StepVector vector, defining the direction and value of extrusion
     ## Generate new elements by extrusion of the elements belong to object
     #  @param theObject object wich elements should be processed
     #  @param StepVector vector, defining the direction and value of extrusion
@@ -3007,7 +3041,7 @@ class Mesh:
         return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape,
                                                     NodeStart, HasAngles, Angles, HasRefPoint,
                                                     RefPoint)
         return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape,
                                                     NodeStart, HasAngles, Angles, HasRefPoint,
                                                     RefPoint)
-    
+
     ## Symmetrical copy of mesh elements
     #  @param IDsOfElements list of elements ids
     #  @param Mirror is AxisStruct or geom object(point, line, plane)
     ## Symmetrical copy of mesh elements
     #  @param IDsOfElements list of elements ids
     #  @param Mirror is AxisStruct or geom object(point, line, plane)
@@ -3068,7 +3102,7 @@ class Mesh:
     def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""):
         if ( isinstance( theObject, Mesh )):
             theObject = theObject.GetMesh()
     def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""):
         if ( isinstance( theObject, Mesh )):
             theObject = theObject.GetMesh()
-        if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
+        if (isinstance(Mirror, geompyDC.GEOM._objref_GEOM_Object)):
             Mirror = GetAxisStruct(Mirror)
         mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType,
                                                 MakeGroups, NewMeshName)
             Mirror = GetAxisStruct(Mirror)
         mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType,
                                                 MakeGroups, NewMeshName)
@@ -3123,9 +3157,9 @@ class Mesh:
     #  @param MakeGroups to generate new groups from existing ones
     #  @param NewMeshName is a name of new mesh to create
     def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
     #  @param MakeGroups to generate new groups from existing ones
     #  @param NewMeshName is a name of new mesh to create
     def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
-        if ( isinstance( theObject, Mesh )):
+        if (isinstance(theObject, Mesh)):
             theObject = theObject.GetMesh()
             theObject = theObject.GetMesh()
-        if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
+        if (isinstance(Vector, geompyDC.GEOM._objref_GEOM_Object)):
             Vector = self.smeshpyD.GetDirStruct(Vector)
         mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
         return Mesh( self.smeshpyD, self.geompyD, mesh )
             Vector = self.smeshpyD.GetDirStruct(Vector)
         mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
         return Mesh( self.smeshpyD, self.geompyD, mesh )
@@ -3168,9 +3202,9 @@ class Mesh:
     #  @param Copy allows to copy the rotated elements
     #  @param MakeGroups to generate new groups from existing ones (if Copy)
     def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
     #  @param Copy allows to copy the rotated elements
     #  @param MakeGroups to generate new groups from existing ones (if Copy)
     def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
-        if ( isinstance( theObject, Mesh )):
+        if (isinstance(theObject, Mesh)):
             theObject = theObject.GetMesh()
             theObject = theObject.GetMesh()
-        if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
+        if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)):
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         if Copy and MakeGroups:
             return self.editor.RotateObjectMakeGroups(theObject, Axis, AngleInRadians)
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         if Copy and MakeGroups:
             return self.editor.RotateObjectMakeGroups(theObject, Axis, AngleInRadians)
@@ -3184,9 +3218,9 @@ class Mesh:
     #  @param MakeGroups to generate new groups from existing ones
     #  @param NewMeshName is a name of new mesh to create
     def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
     #  @param MakeGroups to generate new groups from existing ones
     #  @param NewMeshName is a name of new mesh to create
     def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
-        if ( isinstance( theObject, Mesh )):
+        if (isinstance( theObject, Mesh )):
             theObject = theObject.GetMesh()
             theObject = theObject.GetMesh()
-        if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
+        if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)):
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         mesh = self.editor.RotateObjectMakeMesh(theObject, Axis, AngleInRadians,
                                                        MakeGroups, NewMeshName)
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         mesh = self.editor.RotateObjectMakeMesh(theObject, Axis, AngleInRadians,
                                                        MakeGroups, NewMeshName)
@@ -3224,7 +3258,7 @@ class Mesh:
     ## Remove all but one of elements built on the same nodes.
     def MergeEqualElements(self):
         self.editor.MergeEqualElements()
     ## Remove all but one of elements built on the same nodes.
     def MergeEqualElements(self):
         self.editor.MergeEqualElements()
-        
+
     ## Sew free borders
     def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
                         FirstNodeID2, SecondNodeID2, LastNodeID2,
     ## Sew free borders
     def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
                         FirstNodeID2, SecondNodeID2, LastNodeID2,
@@ -3238,7 +3272,7 @@ class Mesh:
                                FirstNodeID2, SecondNodeID2):
         return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
                                                  FirstNodeID2, SecondNodeID2)
                                FirstNodeID2, SecondNodeID2):
         return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
                                                  FirstNodeID2, SecondNodeID2)
-    
+
     ## Sew border to side
     def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
                          FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs):
     ## Sew border to side
     def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
                          FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs):
@@ -3264,7 +3298,7 @@ class Mesh:
     #  @return If number of nodes is not corresponded to type of element - returns false
     def ChangeElemNodes(self, ide, newIDs):
         return self.editor.ChangeElemNodes(ide, newIDs)
     #  @return If number of nodes is not corresponded to type of element - returns false
     def ChangeElemNodes(self, ide, newIDs):
         return self.editor.ChangeElemNodes(ide, newIDs)
-    
+
     ## If during last operation of MeshEditor some nodes were
     #  created this method returns list of its IDs, \n
     #  if new nodes not created - returns empty list
     ## If during last operation of MeshEditor some nodes were
     #  created this method returns list of its IDs, \n
     #  if new nodes not created - returns empty list