Salome HOME
Merge from V6_main 01/04/2013
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.cxx
index b53448c3f399299ad43ee3fcf447e2b448d69861..6916ea344e7db7d910cf9dbea35bc74cb58e9a10 100644 (file)
@@ -1,65 +1,64 @@
-//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_Filter_i.cxx
 //  Author : Alexey Petrov, OCC
 //  Module : SMESH
 
-
 #include "SMESH_Filter_i.hxx"
 
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_PythonDump.hxx"
-
+#include "SMDS_ElemIterator.hxx"
 #include "SMDS_Mesh.hxx"
-#include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshElement.hxx"
-
+#include "SMDS_MeshNode.hxx"
 #include "SMESHDS_Mesh.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_PythonDump.hxx"
 
+#include <SALOMEDS_wrap.hxx>
+
+#include <BRep_Tool.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_Plane.hxx>
+#include <LDOMParser.hxx>
+#include <LDOMString.hxx>
 #include <LDOM_Document.hxx>
 #include <LDOM_Element.hxx>
 #include <LDOM_Node.hxx>
-#include <LDOMString.hxx>
-#include <LDOMParser.hxx>
 #include <LDOM_XmlWriter.hxx>
-#include <TCollection_HAsciiString.hxx>
+#include <Precision.hxx>
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
 #include <TColStd_ListOfInteger.hxx>
 #include <TColStd_ListOfReal.hxx>
-#include <TColStd_MapOfInteger.hxx>
 #include <TColStd_SequenceOfHAsciiString.hxx>
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-#include <Precision.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS_Shape.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <TopExp_Explorer.hxx>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
 
 using namespace SMESH;
 using namespace SMESH::Controls;
@@ -77,23 +76,73 @@ namespace SMESH
 
 /*
   Class       : BelongToGeom
-  Description : Predicate for verifying whether entiy belong to
+  Description : Predicate for verifying whether entity belongs to
                 specified geometrical support
 */
 
 Controls::BelongToGeom::BelongToGeom()
-: myMeshDS(NULL),
-  myType(SMDSAbs_All)
+  : myMeshDS(NULL),
+    myType(SMDSAbs_All),
+    myIsSubshape(false),
+    myTolerance(Precision::Confusion())
 {}
 
 void Controls::BelongToGeom::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMeshDS = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
+  init();
 }
 
 void Controls::BelongToGeom::SetGeom( const TopoDS_Shape& theShape )
 {
   myShape = theShape;
+  init();
+}
+
+static bool IsSubShape (const TopTools_IndexedMapOfShape& theMap,
+                        const TopoDS_Shape& theShape)
+{
+  if (theMap.Contains(theShape)) return true;
+
+  if (theShape.ShapeType() == TopAbs_COMPOUND ||
+      theShape.ShapeType() == TopAbs_COMPSOLID)
+  {
+    TopoDS_Iterator anIt (theShape, Standard_True, Standard_True);
+    for (; anIt.More(); anIt.Next())
+    {
+      if (!IsSubShape(theMap, anIt.Value())) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  return false;
+}
+
+void Controls::BelongToGeom::init()
+{
+  if (!myMeshDS || myShape.IsNull()) return;
+
+  // is sub-shape of main shape?
+  TopoDS_Shape aMainShape = myMeshDS->ShapeToMesh();
+  if (aMainShape.IsNull()) {
+    myIsSubshape = false;
+  }
+  else {
+    TopTools_IndexedMapOfShape aMap;
+    TopExp::MapShapes(aMainShape, aMap);
+    myIsSubshape = IsSubShape(aMap, myShape);
+  }
+
+  if (!myIsSubshape)
+  {
+    myElementsOnShapePtr.reset(new Controls::ElementsOnShape());
+    myElementsOnShapePtr->SetTolerance(myTolerance);
+    myElementsOnShapePtr->SetAllNodes(true); // belong, while false means "lays on"
+    myElementsOnShapePtr->SetMesh(myMeshDS);
+    myElementsOnShapePtr->SetShape(myShape, myType);
+  }
 }
 
 static bool IsContains( const SMESHDS_Mesh*     theMeshDS,
@@ -116,12 +165,18 @@ static bool IsContains( const SMESHDS_Mesh*     theMeshDS,
   return false;
 }
 
-bool Controls::BelongToGeom::IsSatisfy( long theId )
+bool Controls::BelongToGeom::IsSatisfy (long theId)
 {
-  if ( myMeshDS == 0 || myShape.IsNull() )
+  if (myMeshDS == 0 || myShape.IsNull())
     return false;
 
-  if( myType == SMDSAbs_Node )
+  if (!myIsSubshape)
+  {
+    return myElementsOnShapePtr->IsSatisfy(theId);
+  }
+
+  // Case of submesh
+  if (myType == SMDSAbs_Node)
   {
     if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
     {
@@ -163,9 +218,10 @@ bool Controls::BelongToGeom::IsSatisfy( long theId )
   return false;
 }
 
-void Controls::BelongToGeom::SetType( SMDSAbs_ElementType theType )
+void Controls::BelongToGeom::SetType (SMDSAbs_ElementType theType)
 {
   myType = theType;
+  init();
 }
 
 SMDSAbs_ElementType Controls::BelongToGeom::GetType() const
@@ -178,13 +234,23 @@ TopoDS_Shape Controls::BelongToGeom::GetShape()
   return myShape;
 }
 
-const SMESHDS_Mesh*
-Controls::BelongToGeom::
-GetMeshDS() const
+const SMESHDS_Mesh* Controls::BelongToGeom::GetMeshDS() const
 {
   return myMeshDS;
 }
 
+void Controls::BelongToGeom::SetTolerance (double theTolerance)
+{
+  myTolerance = theTolerance;
+  if (!myIsSubshape)
+    init();
+}
+
+double Controls::BelongToGeom::GetTolerance()
+{
+  return myTolerance;
+}
+
 /*
   Class       : LyingOnGeom
   Description : Predicate for verifying whether entiy lying or partially lying on
@@ -192,18 +258,47 @@ GetMeshDS() const
 */
 
 Controls::LyingOnGeom::LyingOnGeom()
-: myMeshDS(NULL),
-  myType(SMDSAbs_All)
+  : myMeshDS(NULL),
+    myType(SMDSAbs_All),
+    myIsSubshape(false),
+    myTolerance(Precision::Confusion())
 {}
 
 void Controls::LyingOnGeom::SetMesh( const SMDS_Mesh* theMesh )
 {
   myMeshDS = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
+  init();
 }
 
 void Controls::LyingOnGeom::SetGeom( const TopoDS_Shape& theShape )
 {
   myShape = theShape;
+  init();
+}
+
+void Controls::LyingOnGeom::init()
+{
+  if (!myMeshDS || myShape.IsNull()) return;
+
+  // is sub-shape of main shape?
+  TopoDS_Shape aMainShape = myMeshDS->ShapeToMesh();
+  if (aMainShape.IsNull()) {
+    myIsSubshape = false;
+  }
+  else {
+    TopTools_IndexedMapOfShape aMap;
+    TopExp::MapShapes(aMainShape, aMap);
+    myIsSubshape = IsSubShape(aMap, myShape);
+  }
+
+  if (!myIsSubshape)
+  {
+    myElementsOnShapePtr.reset(new Controls::ElementsOnShape());
+    myElementsOnShapePtr->SetTolerance(myTolerance);
+    myElementsOnShapePtr->SetAllNodes(false); // lays on, while true means "belong"
+    myElementsOnShapePtr->SetMesh(myMeshDS);
+    myElementsOnShapePtr->SetShape(myShape, myType);
+  }
 }
 
 bool Controls::LyingOnGeom::IsSatisfy( long theId )
@@ -211,6 +306,12 @@ bool Controls::LyingOnGeom::IsSatisfy( long theId )
   if ( myMeshDS == 0 || myShape.IsNull() )
     return false;
 
+  if (!myIsSubshape)
+  {
+    return myElementsOnShapePtr->IsSatisfy(theId);
+  }
+
+  // Case of submesh
   if( myType == SMDSAbs_Node )
   {
     if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
@@ -256,6 +357,7 @@ bool Controls::LyingOnGeom::IsSatisfy( long theId )
 void Controls::LyingOnGeom::SetType( SMDSAbs_ElementType theType )
 {
   myType = theType;
+  init();
 }
 
 SMDSAbs_ElementType Controls::LyingOnGeom::GetType() const
@@ -268,13 +370,23 @@ TopoDS_Shape Controls::LyingOnGeom::GetShape()
   return myShape;
 }
 
-const SMESHDS_Mesh*
-Controls::LyingOnGeom::
-GetMeshDS() const
+const SMESHDS_Mesh* Controls::LyingOnGeom::GetMeshDS() const
 {
   return myMeshDS;
 }
 
+void Controls::LyingOnGeom::SetTolerance (double theTolerance)
+{
+  myTolerance = theTolerance;
+  if (!myIsSubshape)
+    init();
+}
+
+double Controls::LyingOnGeom::GetTolerance()
+{
+  return myTolerance;
+}
+
 bool Controls::LyingOnGeom::Contains( const SMESHDS_Mesh*     theMeshDS,
                                       const TopoDS_Shape&     theShape,
                                       const SMDS_MeshElement* theElem,
@@ -363,6 +475,7 @@ static SMESH::Filter::Criterion createCriterion()
   aCriterion.UnaryOp       = FT_Undefined;
   aCriterion.BinaryOp      = FT_Undefined;
   aCriterion.ThresholdStr  = "";
+  aCriterion.ThresholdID   = "";
   aCriterion.Tolerance     = Precision::Confusion();
   aCriterion.TypeOfElement = SMESH::ALL;
   aCriterion.Precision     = -1;
@@ -374,28 +487,56 @@ static TopoDS_Shape getShapeByName( const char* theName )
 {
   if ( theName != 0 )
   {
-    SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
-    SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
-    if (!CORBA::is_nil(aStudy))
+    SMESH_Gen_i* aSMESHGen     = SMESH_Gen_i::GetSMESHGen();
+    SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+    if ( !aStudy->_is_nil() )
     {
-      SALOMEDS::Study::ListOfSObject_var aList =
-        aStudy->FindObjectByName( theName, "GEOM" );
+      SALOMEDS::Study::ListOfSObject_var aList = aStudy->FindObjectByName( theName, "GEOM" );
       if ( aList->length() > 0 )
       {
-        GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( aList[ 0 ]->GetObject() );
-        if ( !aGeomObj->_is_nil() )
-        {
-          GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
-          TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, aGeomObj );
-          return aLocShape;
-        }
+        CORBA::Object_var        anObj = aList[ 0 ]->GetObject();
+        GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( anObj );
+        TopoDS_Shape             shape = aSMESHGen->GeomObjectToShape( aGeomObj );
+        SALOME::UnRegister( aList ); // UnRegister() objects in aList
+        return shape;
       }
     }
   }
   return TopoDS_Shape();
 }
 
+static TopoDS_Shape getShapeByID (const char* theID)
+{
+  if ( theID && strlen( theID ) > 0 ) {
+    SMESH_Gen_i*     aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+    SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+    if ( !aStudy->_is_nil() ) {
+      SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
+      if ( !aSObj->_is_nil() ) {
+        CORBA::Object_var          obj = aSObj->GetObject();
+        GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(obj);
+        return aSMESHGen->GeomObjectToShape( aGeomObj );
+      }
+    }
+  }
+  return TopoDS_Shape();
+}
 
+static std::string getShapeNameByID (const char* theID)
+{
+  if ( theID && strlen( theID ) > 0 ) {
+    SMESH_Gen_i*     aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+    SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+    if ( !aStudy->_is_nil() ) {
+      SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
+      if ( !aSObj->_is_nil() ) {
+        CORBA::String_var name = aSObj->GetName();
+        return name.in();
+      }
+    }
+  }
+  return "";
+}
 
 /*
                                 FUNCTORS
@@ -408,13 +549,14 @@ static TopoDS_Shape getShapeByName( const char* theName )
 Functor_i::Functor_i():
   SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
 {
-  PortableServer::ObjectId_var anObjectId =
-    SMESH_Gen_i::GetPOA()->activate_object( this );
+  //Base class Salome_GenericObject do it inmplicitly by overriding PortableServer::POA_ptr _default_POA() method  
+  //PortableServer::ObjectId_var anObjectId =
+  //  SMESH_Gen_i::GetPOA()->activate_object( this );
 }
 
 Functor_i::~Functor_i()
 {
-  TPythonDump()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".UnRegister()";
 }
 
 void Functor_i::SetMesh( SMESH_Mesh_ptr theMesh )
@@ -438,6 +580,33 @@ CORBA::Double NumericalFunctor_i::GetValue( CORBA::Long theId )
   return myNumericalFunctorPtr->GetValue( theId );
 }
 
+SMESH::Histogram* NumericalFunctor_i::GetHistogram(CORBA::Short nbIntervals, CORBA::Boolean isLogarithmic)
+{
+  std::vector<int> nbEvents;
+  std::vector<double> funValues;
+  std::vector<int> elements;
+  myNumericalFunctorPtr->GetHistogram(nbIntervals,nbEvents,funValues,elements,0,isLogarithmic);
+
+#ifdef WIN32
+  nbIntervals = CORBA::Short( min( nbEvents.size(), funValues.size() - 1));
+#else
+  nbIntervals = CORBA::Short( std::min( nbEvents.size(), funValues.size() - 1));
+#endif
+  SMESH::Histogram_var histogram = new SMESH::Histogram;
+  if ( nbIntervals > 0 )
+  {
+    histogram->length( nbIntervals );
+    for ( int i = 0; i < nbIntervals; ++i )
+    {
+      HistogramRectangle& rect = histogram[i];
+      rect.nbEvents = nbEvents[i];
+      rect.min = funValues[i];
+      rect.max = funValues[i+1];
+    }
+  }
+  return histogram._retn();
+}
+
 void NumericalFunctor_i::SetPrecision( CORBA::Long thePrecision )
 {
   myNumericalFunctorPtr->SetPrecision( thePrecision );
@@ -534,7 +703,6 @@ FunctorType Taper_i::GetFunctorType()
   return SMESH::FT_Taper;
 }
 
-
 /*
   Class       : Skew_i
   Description : Functor for calculating skew in degrees
@@ -565,6 +733,51 @@ FunctorType Area_i::GetFunctorType()
   return SMESH::FT_Area;
 }
 
+/*
+  Class       : Volume3D_i
+  Description : Functor for calculating volume of 3D element
+*/
+Volume3D_i::Volume3D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::Volume() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType Volume3D_i::GetFunctorType()
+{
+  return SMESH::FT_Volume3D;
+}
+
+/*
+  Class       : MaxElementLength2D_i
+  Description : Functor for calculating maximum length of 2D element
+*/
+MaxElementLength2D_i::MaxElementLength2D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::MaxElementLength2D() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType MaxElementLength2D_i::GetFunctorType()
+{
+  return SMESH::FT_MaxElementLength2D;
+}
+
+/*
+  Class       : MaxElementLength3D_i
+  Description : Functor for calculating maximum length of 3D element
+*/
+MaxElementLength3D_i::MaxElementLength3D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::MaxElementLength3D() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType MaxElementLength3D_i::GetFunctorType()
+{
+  return SMESH::FT_MaxElementLength3D;
+}
+
 /*
   Class       : Length_i
   Description : Functor for calculating length off edge
@@ -599,11 +812,12 @@ SMESH::Length2D::Values* Length2D_i::GetValues()
 {
   INFOS("Length2D_i::GetValues");
   SMESH::Controls::Length2D::TValues aValues;
-  myLength2DPtr->GetValues( aValues );
+  (dynamic_cast<SMESH::Controls::Length2D*>(myFunctorPtr.get()))->GetValues( aValues );
 
   long i = 0, iEnd = aValues.size();
 
   SMESH::Length2D::Values_var aResult = new SMESH::Length2D::Values(iEnd);
+  aResult->length(iEnd);
 
   SMESH::Controls::Length2D::TValues::const_iterator anIter;
   for ( anIter = aValues.begin() ; anIter != aValues.end(); anIter++, i++ )
@@ -635,6 +849,21 @@ FunctorType MultiConnection_i::GetFunctorType()
   return SMESH::FT_MultiConnection;
 }
 
+/*
+  Class       : BallDiameter_i
+  Description : Functor returning diameter of a ball element
+*/
+BallDiameter_i::BallDiameter_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::BallDiameter() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType BallDiameter_i::GetFunctorType()
+{
+  return SMESH::FT_BallDiameter;
+}
+
 /*
   Class       : MultiConnection2D_i
   Description : Functor for calculating number of faces conneted to the edge
@@ -654,11 +883,12 @@ SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues()
 {
   INFOS("MultiConnection2D_i::GetValues");
   SMESH::Controls::MultiConnection2D::MValues aValues;
-  myMulticonnection2DPtr->GetValues( aValues );
-
+  (dynamic_cast<SMESH::Controls::MultiConnection2D*>(myFunctorPtr.get()))->GetValues( aValues );
+  
   long i = 0, iEnd = aValues.size();
 
   SMESH::MultiConnection2D::Values_var aResult = new SMESH::MultiConnection2D::Values(iEnd);
+  aResult->length(iEnd);
 
   SMESH::Controls::MultiConnection2D::MValues::const_iterator anIter;
   for ( anIter = aValues.begin() ; anIter != aValues.end(); anIter++, i++ )
@@ -710,6 +940,66 @@ FunctorType BadOrientedVolume_i::GetFunctorType()
   return SMESH::FT_BadOrientedVolume;
 }
 
+/*
+  Class       : BareBorderVolume_i
+  Description : Verify whether a mesh volume has a free facet without a face on it
+*/
+BareBorderVolume_i::BareBorderVolume_i()
+{
+  Controls::PredicatePtr control( new Controls::BareBorderVolume() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType BareBorderVolume_i::GetFunctorType()
+{
+  return SMESH::FT_BareBorderVolume;
+}
+
+/*
+  Class       : BareBorderFace_i
+  Description : Verify whether a mesh face has a free border without an edge on it
+*/
+BareBorderFace_i::BareBorderFace_i()
+{
+  Controls::PredicatePtr control( new Controls::BareBorderFace() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType BareBorderFace_i::GetFunctorType()
+{
+  return SMESH::FT_BareBorderFace;
+}
+
+/*
+  Class       : OverConstrainedVolume_i
+  Description : Verify whether a mesh volume has only one facet shared with other volumes
+*/
+OverConstrainedVolume_i::OverConstrainedVolume_i()
+{
+  Controls::PredicatePtr control( new Controls::OverConstrainedVolume() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType OverConstrainedVolume_i::GetFunctorType()
+{
+  return SMESH::FT_OverConstrainedVolume;
+}
+
+/*
+  Class       : OverConstrainedFace_i
+  Description : Verify whether a mesh face has only one border shared with other faces
+*/
+OverConstrainedFace_i::OverConstrainedFace_i()
+{
+  Controls::PredicatePtr control( new Controls::OverConstrainedFace() );
+  myFunctorPtr = myPredicatePtr = control;
+};
+
+FunctorType OverConstrainedFace_i::GetFunctorType()
+{
+  return SMESH::FT_OverConstrainedFace;
+}
+
 /*
   Class       : BelongToGeom_i
   Description : Predicate for selection on geometrical support
@@ -719,11 +1009,13 @@ BelongToGeom_i::BelongToGeom_i()
   myBelongToGeomPtr.reset( new Controls::BelongToGeom() );
   myFunctorPtr = myPredicatePtr = myBelongToGeomPtr;
   myShapeName = 0;
+  myShapeID   = 0;
 }
 
 BelongToGeom_i::~BelongToGeom_i()
 {
   delete myShapeName;
+  delete myShapeID;
 }
 
 void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
@@ -731,7 +1023,7 @@ void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
   if ( theGeom->_is_nil() )
     return;
   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
-  GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+  GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
   TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
   myBelongToGeomPtr->SetGeom( aLocShape );
   TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
@@ -760,11 +1052,43 @@ void BelongToGeom_i::SetShapeName( const char* theName )
   TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
 }
 
+void BelongToGeom_i::SetShape( const char* theID, const char* theName )
+{
+  delete myShapeName;
+  myShapeName = strdup( theName );
+  delete myShapeID;
+  if ( theID )
+    myShapeID = strdup( theID );
+  else
+    myShapeID = 0;
+
+  if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
+    myBelongToGeomPtr->SetGeom( getShapeByID(myShapeID) );
+  else
+    myBelongToGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+}
+
 char* BelongToGeom_i::GetShapeName()
 {
   return CORBA::string_dup( myShapeName );
 }
 
+char* BelongToGeom_i::GetShapeID()
+{
+  return CORBA::string_dup( myShapeID );
+}
+
+void BelongToGeom_i::SetTolerance( CORBA::Double theToler )
+{
+  myBelongToGeomPtr->SetTolerance( theToler );
+  TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
+}
+
+CORBA::Double BelongToGeom_i::GetTolerance()
+{
+  return myBelongToGeomPtr->GetTolerance();
+}
+
 /*
   Class       : BelongToSurface_i
   Description : Predicate for selection on geometrical support
@@ -774,12 +1098,14 @@ BelongToSurface_i::BelongToSurface_i( const Handle(Standard_Type)& theSurfaceTyp
   myElementsOnSurfacePtr.reset( new Controls::ElementsOnSurface() );
   myFunctorPtr = myPredicatePtr = myElementsOnSurfacePtr;
   myShapeName = 0;
+  myShapeID   = 0;
   mySurfaceType = theSurfaceType;
 }
 
 BelongToSurface_i::~BelongToSurface_i()
 {
   delete myShapeName;
+  delete myShapeID;
 }
 
 void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
@@ -787,7 +1113,7 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
   if ( theGeom->_is_nil() )
     return;
   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
-  GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+  GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
   TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
 
   if ( aLocShape.ShapeType() == TopAbs_FACE )
@@ -801,7 +1127,6 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
   }
 
   myElementsOnSurfacePtr->SetSurface( TopoDS_Shape(), (SMDSAbs_ElementType)theType );
-  TPythonDump()<<this<<".SetSurface("<<theGeom<<",'"<<theType<<"')";
 }
 
 void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
@@ -812,11 +1137,32 @@ void BelongToSurface_i::SetShapeName( const char* theName, ElementType theType )
   TPythonDump()<<this<<".SetShapeName('"<<theName<<"',"<<theType<<")";
 }
 
+void BelongToSurface_i::SetShape( const char* theID,  const char* theName, ElementType theType )
+{
+  delete myShapeName;
+  myShapeName = strdup( theName );
+  delete myShapeID;
+  if ( theID )
+    myShapeID = strdup( theID );
+  else
+    myShapeID = 0;
+  
+  if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
+    myElementsOnSurfacePtr->SetSurface( getShapeByID(myShapeID), (SMDSAbs_ElementType)theType );
+  else
+    myElementsOnSurfacePtr->SetSurface( getShapeByName( myShapeName ), (SMDSAbs_ElementType)theType );
+}
+
 char* BelongToSurface_i::GetShapeName()
 {
   return CORBA::string_dup( myShapeName );
 }
 
+char* BelongToSurface_i::GetShapeID()
+{
+  return CORBA::string_dup( myShapeID );
+}
+
 void BelongToSurface_i::SetTolerance( CORBA::Double theToler )
 {
   myElementsOnSurfacePtr->SetTolerance( theToler );
@@ -828,6 +1174,18 @@ CORBA::Double BelongToSurface_i::GetTolerance()
   return myElementsOnSurfacePtr->GetTolerance();
 }
 
+void BelongToSurface_i::SetUseBoundaries( CORBA::Boolean theUseBndRestrictions )
+{
+  myElementsOnSurfacePtr->SetUseBoundaries( theUseBndRestrictions );
+  TPythonDump()<<this<<".SetUseBoundaries( " << theUseBndRestrictions << " )";
+}
+
+CORBA::Boolean BelongToSurface_i::GetUseBoundaries()
+{
+  return myElementsOnSurfacePtr->GetUseBoundaries();
+}
+
+
 /*
   Class       : BelongToPlane_i
   Description : Verify whether mesh element lie in pointed Geom planar object
@@ -870,6 +1228,33 @@ FunctorType BelongToCylinder_i::GetFunctorType()
   return FT_BelongToCylinder;
 }
 
+/*
+  Class       : BelongToGenSurface_i
+  Description : Verify whether mesh element lie in pointed Geom planar object
+*/
+
+BelongToGenSurface_i::BelongToGenSurface_i()
+: BelongToSurface_i( STANDARD_TYPE( Geom_CylindricalSurface ) )
+{
+}
+
+void BelongToGenSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType theType )
+{
+  if ( theGeom->_is_nil() )
+    return;
+  TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
+  if ( !aLocShape.IsNull() && aLocShape.ShapeType() != TopAbs_FACE )
+    aLocShape.Nullify();
+  
+  BelongToSurface_i::myElementsOnSurfacePtr->SetSurface( aLocShape, (SMDSAbs_ElementType)theType );
+  TPythonDump()<<this<<".SetGenSurface("<<theGeom<<","<<theType<<")";
+}
+
+FunctorType BelongToGenSurface_i::GetFunctorType()
+{
+  return FT_BelongToGenSurface;
+}
+
 /*
   Class       : LyingOnGeom_i
   Description : Predicate for selection on geometrical support
@@ -879,11 +1264,13 @@ LyingOnGeom_i::LyingOnGeom_i()
   myLyingOnGeomPtr.reset( new Controls::LyingOnGeom() );
   myFunctorPtr = myPredicatePtr = myLyingOnGeomPtr;
   myShapeName = 0;
+  myShapeID = 0;
 }
 
 LyingOnGeom_i::~LyingOnGeom_i()
 {
   delete myShapeName;
+  delete myShapeID;
 }
 
 void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
@@ -891,7 +1278,7 @@ void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
   if ( theGeom->_is_nil() )
     return;
   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
-  GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+  GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
   TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
   myLyingOnGeomPtr->SetGeom( aLocShape );
   TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
@@ -920,11 +1307,43 @@ void LyingOnGeom_i::SetShapeName( const char* theName )
   TPythonDump()<<this<<".SetShapeName('"<<theName<<"')";
 }
 
+void LyingOnGeom_i::SetShape( const char* theID, const char* theName )
+{
+  delete myShapeName;
+  myShapeName = strdup( theName );
+  delete myShapeID;
+  if ( theID )
+    myShapeID = strdup( theID );
+  else
+    myShapeID = 0;
+  
+  if ( myShapeID && myShapeName == getShapeNameByID(myShapeID))
+    myLyingOnGeomPtr->SetGeom( getShapeByID(myShapeID) );
+  else
+    myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+}
+
 char* LyingOnGeom_i::GetShapeName()
 {
   return CORBA::string_dup( myShapeName );
 }
 
+char* LyingOnGeom_i::GetShapeID()
+{
+  return CORBA::string_dup( myShapeID );
+}
+
+void LyingOnGeom_i::SetTolerance( CORBA::Double theToler )
+{
+  myLyingOnGeomPtr->SetTolerance( theToler );
+  TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
+}
+
+CORBA::Double LyingOnGeom_i::GetTolerance()
+{
+  return myLyingOnGeomPtr->GetTolerance();
+}
+
 /*
   Class       : FreeBorders_i
   Description : Predicate for free borders
@@ -958,7 +1377,8 @@ SMESH::FreeEdges::Borders* FreeEdges_i::GetBorders()
 
   long i = 0, iEnd = aBorders.size();
 
-  SMESH::FreeEdges::Borders_var aResult = new SMESH::FreeEdges::Borders(iEnd);
+  SMESH::FreeEdges::Borders_var aResult = new SMESH::FreeEdges::Borders;
+  aResult->length(iEnd);
 
   SMESH::Controls::FreeEdges::TBorders::const_iterator anIter;
   for ( anIter = aBorders.begin() ; anIter != aBorders.end(); anIter++, i++ )
@@ -980,6 +1400,107 @@ FunctorType FreeEdges_i::GetFunctorType()
   return SMESH::FT_FreeEdges;
 }
 
+/*
+  Class       : FreeFaces_i
+  Description : Predicate for free faces
+*/
+FreeFaces_i::FreeFaces_i()
+{
+  myPredicatePtr.reset(new Controls::FreeFaces());
+  myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType FreeFaces_i::GetFunctorType()
+{
+  return SMESH::FT_FreeFaces;
+}
+
+/*
+  Class       : FreeNodes_i
+  Description : Predicate for free nodes
+*/
+FreeNodes_i::FreeNodes_i()
+{
+  myPredicatePtr.reset(new Controls::FreeNodes());
+  myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType FreeNodes_i::GetFunctorType()
+{
+  return SMESH::FT_FreeNodes;
+}
+
+/*
+  Class       : EqualNodes_i
+  Description : Predicate for Equal nodes
+*/
+EqualNodes_i::EqualNodes_i()
+{
+  myCoincidentNodesPtr.reset(new Controls::CoincidentNodes());
+  myFunctorPtr = myPredicatePtr = myCoincidentNodesPtr;
+}
+
+FunctorType EqualNodes_i::GetFunctorType()
+{
+  return SMESH::FT_EqualNodes;
+}
+
+void EqualNodes_i::SetTolerance( double tol )
+{
+  myCoincidentNodesPtr->SetTolerance( tol );
+}
+
+double EqualNodes_i::GetTolerance()
+{
+  return myCoincidentNodesPtr->GetTolerance();
+}
+
+/*
+  Class       : EqualEdges_i
+  Description : Predicate for Equal Edges
+*/
+EqualEdges_i::EqualEdges_i()
+{
+  myPredicatePtr.reset(new Controls::CoincidentElements1D());
+  myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType EqualEdges_i::GetFunctorType()
+{
+  return SMESH::FT_EqualEdges;
+}
+
+/*
+  Class       : EqualFaces_i
+  Description : Predicate for Equal Faces
+*/
+EqualFaces_i::EqualFaces_i()
+{
+  myPredicatePtr.reset(new Controls::CoincidentElements2D());
+  myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType EqualFaces_i::GetFunctorType()
+{
+  return SMESH::FT_EqualFaces;
+}
+
+/*
+  Class       : EqualVolumes_i
+  Description : Predicate for Equal Volumes
+*/
+EqualVolumes_i::EqualVolumes_i()
+{
+  myPredicatePtr.reset(new Controls::CoincidentElements3D());
+  myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType EqualVolumes_i::GetFunctorType()
+{
+  return SMESH::FT_EqualVolumes;
+}
+
+
 /*
   Class       : RangeOfIds_i
   Description : Predicate for Range of Ids.
@@ -1028,6 +1549,168 @@ FunctorType RangeOfIds_i::GetFunctorType()
   return SMESH::FT_RangeOfIds;
 }
 
+/*
+  Class       : LinearOrQuadratic_i
+  Description : Predicate to verify whether a mesh element is linear
+*/
+LinearOrQuadratic_i::LinearOrQuadratic_i()
+{
+  myLinearOrQuadraticPtr.reset(new Controls::LinearOrQuadratic());
+  myFunctorPtr = myPredicatePtr = myLinearOrQuadraticPtr;
+}
+
+void LinearOrQuadratic_i::SetElementType(ElementType theType)
+{
+  myLinearOrQuadraticPtr->SetType(SMDSAbs_ElementType(theType));
+  TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+FunctorType LinearOrQuadratic_i::GetFunctorType()
+{
+  return SMESH::FT_LinearOrQuadratic;
+}
+
+/*
+  Class       : GroupColor_i
+  Description : Functor for check color of group to whic mesh element belongs to
+*/
+GroupColor_i::GroupColor_i()
+{
+  myGroupColorPtr.reset(new Controls::GroupColor());
+  myFunctorPtr = myPredicatePtr = myGroupColorPtr;
+}
+
+FunctorType GroupColor_i::GetFunctorType()
+{
+  return SMESH::FT_GroupColor;
+}
+
+void GroupColor_i::SetColorStr( const char* theColor )
+{
+  myGroupColorPtr->SetColorStr(
+    TCollection_AsciiString( (Standard_CString)theColor ) );
+  TPythonDump()<<this<<".SetColorStr('"<<theColor<<"')";
+}
+
+char* GroupColor_i::GetColorStr()
+{
+  TCollection_AsciiString aStr;
+  myGroupColorPtr->GetColorStr( aStr );
+  return CORBA::string_dup( aStr.ToCString() );
+}
+
+void GroupColor_i::SetElementType(ElementType theType)
+{
+  myGroupColorPtr->SetType(SMDSAbs_ElementType(theType));
+  TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+/*
+  Class       : ElemGeomType_i
+  Description : Predicate check is element has indicated geometry type
+*/
+ElemGeomType_i::ElemGeomType_i()
+{
+  myElemGeomTypePtr.reset(new Controls::ElemGeomType());
+  myFunctorPtr = myPredicatePtr = myElemGeomTypePtr;
+}
+
+void ElemGeomType_i::SetElementType(ElementType theType)
+{
+  myElemGeomTypePtr->SetType(SMDSAbs_ElementType(theType));
+  TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+void ElemGeomType_i::SetGeometryType(GeometryType theType)
+{
+  myElemGeomTypePtr->SetGeomType(SMDSAbs_GeometryType(theType));
+  TPythonDump()<<this<<".SetGeometryType("<<theType<<")";
+}
+
+GeometryType ElemGeomType_i::GetGeometryType() const
+{
+  return (GeometryType)myElemGeomTypePtr->GetGeomType();
+}
+
+FunctorType ElemGeomType_i::GetFunctorType()
+{
+  return SMESH::FT_ElemGeomType;
+}
+
+/*
+  Class       : ElemEntityType_i
+  Description : Predicate check is element has indicated entity type
+*/
+ElemEntityType_i::ElemEntityType_i()
+{
+  myElemEntityTypePtr.reset(new Controls::ElemEntityType());
+  myFunctorPtr = myPredicatePtr = myElemEntityTypePtr;
+}
+
+void ElemEntityType_i::SetElementType(ElementType theType)
+{
+  myElemEntityTypePtr->SetType(SMDSAbs_ElementType(theType));
+  TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+void ElemEntityType_i::SetEntityType(EntityType theEntityType)
+{
+  myElemEntityTypePtr->SetElemEntityType(SMDSAbs_EntityType (theEntityType));
+  TPythonDump()<<this<<".SetEntityType("<<theEntityType<<")";
+}
+EntityType ElemEntityType_i::GetEntityType() const
+{
+ return (EntityType) myElemEntityTypePtr->GetElemEntityType();
+}
+
+FunctorType ElemEntityType_i::GetFunctorType()
+{
+  return SMESH::FT_EntityType;
+}
+
+/*
+  Class       : CoplanarFaces_i
+  Description : Returns true if a mesh face is a coplanar neighbour to a given one
+*/
+CoplanarFaces_i::CoplanarFaces_i()
+{
+  myCoplanarFacesPtr.reset(new Controls::CoplanarFaces());
+  myFunctorPtr = myPredicatePtr = myCoplanarFacesPtr;
+}
+
+void CoplanarFaces_i::SetFace ( CORBA::Long theFaceID )
+{
+  myCoplanarFacesPtr->SetFace(theFaceID);
+  TPythonDump()<<this<<".SetFace("<<theFaceID<<")";
+}
+
+void CoplanarFaces_i::SetTolerance( CORBA::Double theToler )
+{
+  myCoplanarFacesPtr->SetTolerance(theToler);
+  TPythonDump()<<this<<".SetTolerance("<<theToler<<")";
+}
+
+CORBA::Long CoplanarFaces_i::GetFace () const
+{
+  return myCoplanarFacesPtr->GetFace();
+}
+
+char* CoplanarFaces_i::GetFaceAsString () const
+{
+  TCollection_AsciiString str(Standard_Integer(myCoplanarFacesPtr->GetFace()));
+  return CORBA::string_dup( str.ToCString() );
+}
+
+CORBA::Double CoplanarFaces_i::GetTolerance() const
+{
+  return myCoplanarFacesPtr->GetTolerance();
+}
+
+FunctorType CoplanarFaces_i::GetFunctorType()
+{
+  return SMESH::FT_CoplanarFaces;
+}
+
 /*
   Class       : Comparator_i
   Description : Base class for comparators
@@ -1039,7 +1722,7 @@ Comparator_i::Comparator_i():
 Comparator_i::~Comparator_i()
 {
   if ( myNumericalFunctor )
-    myNumericalFunctor->Destroy();
+    myNumericalFunctor->UnRegister();
 }
 
 void Comparator_i::SetMargin( CORBA::Double theValue )
@@ -1056,7 +1739,7 @@ CORBA::Double Comparator_i::GetMargin()
 void Comparator_i::SetNumFunctor( NumericalFunctor_ptr theFunct )
 {
   if ( myNumericalFunctor )
-    myNumericalFunctor->Destroy();
+    myNumericalFunctor->UnRegister();
 
   myNumericalFunctor = DownCast<NumericalFunctor_i*>(theFunct);
 
@@ -1151,13 +1834,13 @@ LogicalNOT_i::LogicalNOT_i()
 LogicalNOT_i::~LogicalNOT_i()
 {
   if ( myPredicate )
-    myPredicate->Destroy();
+    myPredicate->UnRegister();
 }
 
 void LogicalNOT_i::SetPredicate( Predicate_ptr thePredicate )
 {
   if ( myPredicate )
-    myPredicate->Destroy();
+    myPredicate->UnRegister();
 
   myPredicate = SMESH::GetPredicate(thePredicate);
 
@@ -1191,10 +1874,10 @@ LogicalBinary_i::LogicalBinary_i()
 LogicalBinary_i::~LogicalBinary_i()
 {
   if ( myPredicate1 )
-    myPredicate1->Destroy();
+    myPredicate1->UnRegister();
 
   if ( myPredicate2 )
-    myPredicate2->Destroy();
+    myPredicate2->UnRegister();
 }
 
 void LogicalBinary_i::SetMesh( SMESH_Mesh_ptr theMesh )
@@ -1209,7 +1892,7 @@ void LogicalBinary_i::SetMesh( SMESH_Mesh_ptr theMesh )
 void LogicalBinary_i::SetPredicate1( Predicate_ptr thePredicate )
 {
   if ( myPredicate1 )
-    myPredicate1->Destroy();
+    myPredicate1->UnRegister();
 
   myPredicate1 = SMESH::GetPredicate(thePredicate);
 
@@ -1223,7 +1906,7 @@ void LogicalBinary_i::SetPredicate1( Predicate_ptr thePredicate )
 void LogicalBinary_i::SetPredicate2( Predicate_ptr thePredicate )
 {
   if ( myPredicate2 )
-    myPredicate2->Destroy();
+    myPredicate2->UnRegister();
 
   myPredicate2 = SMESH::GetPredicate(thePredicate);
 
@@ -1288,14 +1971,15 @@ FunctorType LogicalOR_i::GetFunctorType()
 FilterManager_i::FilterManager_i()
 : SALOME::GenericObj_i( SMESH_Gen_i::GetPOA() )
 {
-  PortableServer::ObjectId_var anObjectId =
-    SMESH_Gen_i::GetPOA()->activate_object( this );
+  //Base class Salome_GenericObject do it inmplicitly by overriding PortableServer::POA_ptr _default_POA() method
+  //PortableServer::ObjectId_var anObjectId =
+  //  SMESH_Gen_i::GetPOA()->activate_object( this );
 }
 
 
 FilterManager_i::~FilterManager_i()
 {
-  TPythonDump()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".UnRegister()";
 }
 
 
@@ -1335,29 +2019,56 @@ Warping_ptr FilterManager_i::CreateWarping()
 }
 
 
-Taper_ptr FilterManager_i::CreateTaper()
+Taper_ptr FilterManager_i::CreateTaper()
+{
+  SMESH::Taper_i* aServant = new SMESH::Taper_i();
+  SMESH::Taper_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateTaper()";
+  return anObj._retn();
+}
+
+
+Skew_ptr FilterManager_i::CreateSkew()
+{
+  SMESH::Skew_i* aServant = new SMESH::Skew_i();
+  SMESH::Skew_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateSkew()";
+  return anObj._retn();
+}
+
+
+Area_ptr FilterManager_i::CreateArea()
+{
+  SMESH::Area_i* aServant = new SMESH::Area_i();
+  SMESH::Area_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateArea()";
+  return anObj._retn();
+}
+
+
+Volume3D_ptr FilterManager_i::CreateVolume3D()
 {
-  SMESH::Taper_i* aServant = new SMESH::Taper_i();
-  SMESH::Taper_var anObj = aServant->_this();
-  TPythonDump()<<aServant<<" = "<<this<<".CreateTaper()";
+  SMESH::Volume3D_i* aServant = new SMESH::Volume3D_i();
+  SMESH::Volume3D_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateVolume3D()";
   return anObj._retn();
 }
 
 
-Skew_ptr FilterManager_i::CreateSkew()
+MaxElementLength2D_ptr FilterManager_i::CreateMaxElementLength2D()
 {
-  SMESH::Skew_i* aServant = new SMESH::Skew_i();
-  SMESH::Skew_var anObj = aServant->_this();
-  TPythonDump()<<aServant<<" = "<<this<<".CreateSkew()";
+  SMESH::MaxElementLength2D_i* aServant = new SMESH::MaxElementLength2D_i();
+  SMESH::MaxElementLength2D_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateMaxElementLength2D()";
   return anObj._retn();
 }
 
 
-Area_ptr FilterManager_i::CreateArea()
+MaxElementLength3D_ptr FilterManager_i::CreateMaxElementLength3D()
 {
-  SMESH::Area_i* aServant = new SMESH::Area_i();
-  SMESH::Area_var anObj = aServant->_this();
-  TPythonDump()<<aServant<<" = "<<this<<".CreateArea()";
+  SMESH::MaxElementLength3D_i* aServant = new SMESH::MaxElementLength3D_i();
+  SMESH::MaxElementLength3D_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateMaxElementLength3D()";
   return anObj._retn();
 }
 
@@ -1394,6 +2105,14 @@ MultiConnection2D_ptr FilterManager_i::CreateMultiConnection2D()
   return anObj._retn();
 }
 
+BallDiameter_ptr FilterManager_i::CreateBallDiameter()
+{
+  SMESH::BallDiameter_i* aServant = new SMESH::BallDiameter_i();
+  SMESH::BallDiameter_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBallDiameter()";
+  return anObj._retn();
+}
+
 BelongToGeom_ptr FilterManager_i::CreateBelongToGeom()
 {
   SMESH::BelongToGeom_i* aServant = new SMESH::BelongToGeom_i();
@@ -1418,6 +2137,14 @@ BelongToCylinder_ptr FilterManager_i::CreateBelongToCylinder()
   return anObj._retn();
 }
 
+BelongToGenSurface_ptr FilterManager_i::CreateBelongToGenSurface()
+{
+  SMESH::BelongToGenSurface_i* aServant = new SMESH::BelongToGenSurface_i();
+  SMESH::BelongToGenSurface_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBelongToGenSurface()";
+  return anObj._retn();
+}
+
 LyingOnGeom_ptr FilterManager_i::CreateLyingOnGeom()
 {
   SMESH::LyingOnGeom_i* aServant = new SMESH::LyingOnGeom_i();
@@ -1426,6 +2153,14 @@ LyingOnGeom_ptr FilterManager_i::CreateLyingOnGeom()
   return anObj._retn();
 }
 
+CoplanarFaces_ptr FilterManager_i::CreateCoplanarFaces()
+{
+  SMESH::CoplanarFaces_i* aServant = new SMESH::CoplanarFaces_i();
+  SMESH::CoplanarFaces_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateCoplanarFaces()";
+  return anObj._retn();
+}
+
 FreeBorders_ptr FilterManager_i::CreateFreeBorders()
 {
   SMESH::FreeBorders_i* aServant = new SMESH::FreeBorders_i();
@@ -1442,6 +2177,52 @@ FreeEdges_ptr FilterManager_i::CreateFreeEdges()
   return anObj._retn();
 }
 
+FreeFaces_ptr FilterManager_i::CreateFreeFaces()
+{
+  SMESH::FreeFaces_i* aServant = new SMESH::FreeFaces_i();
+  SMESH::FreeFaces_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateFreeFaces()";
+  return anObj._retn();
+}
+
+FreeNodes_ptr FilterManager_i::CreateFreeNodes()
+{
+  SMESH::FreeNodes_i* aServant = new SMESH::FreeNodes_i();
+  SMESH::FreeNodes_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateFreeNodes()";
+  return anObj._retn();
+}
+
+EqualNodes_ptr FilterManager_i::CreateEqualNodes()
+{
+  SMESH::EqualNodes_i* aServant = new SMESH::EqualNodes_i();
+  SMESH::EqualNodes_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateEqualNodes()";
+  return anObj._retn();
+}
+
+EqualEdges_ptr FilterManager_i::CreateEqualEdges()
+{
+  SMESH::EqualEdges_i* aServant = new SMESH::EqualEdges_i();
+  SMESH::EqualEdges_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateEqualEdges()";
+  return anObj._retn();
+}
+EqualFaces_ptr FilterManager_i::CreateEqualFaces()
+{
+  SMESH::EqualFaces_i* aServant = new SMESH::EqualFaces_i();
+  SMESH::EqualFaces_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateEqualFaces()";
+  return anObj._retn();
+}
+EqualVolumes_ptr FilterManager_i::CreateEqualVolumes()
+{
+  SMESH::EqualVolumes_i* aServant = new SMESH::EqualVolumes_i();
+  SMESH::EqualVolumes_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateEqualVolumes()";
+  return anObj._retn();
+}
+
 RangeOfIds_ptr FilterManager_i::CreateRangeOfIds()
 {
   SMESH::RangeOfIds_i* aServant = new SMESH::RangeOfIds_i();
@@ -1458,6 +2239,38 @@ BadOrientedVolume_ptr FilterManager_i::CreateBadOrientedVolume()
   return anObj._retn();
 }
 
+BareBorderVolume_ptr FilterManager_i::CreateBareBorderVolume()
+{
+  SMESH::BareBorderVolume_i* aServant = new SMESH::BareBorderVolume_i();
+  SMESH::BareBorderVolume_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBareBorderVolume()";
+  return anObj._retn();
+}
+
+BareBorderFace_ptr FilterManager_i::CreateBareBorderFace()
+{
+  SMESH::BareBorderFace_i* aServant = new SMESH::BareBorderFace_i();
+  SMESH::BareBorderFace_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateBareBorderFace()";
+  return anObj._retn();
+}
+
+OverConstrainedVolume_ptr FilterManager_i::CreateOverConstrainedVolume()
+{
+  SMESH::OverConstrainedVolume_i* aServant = new SMESH::OverConstrainedVolume_i();
+  SMESH::OverConstrainedVolume_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateOverConstrainedVolume()";
+  return anObj._retn();
+}
+
+OverConstrainedFace_ptr FilterManager_i::CreateOverConstrainedFace()
+{
+  SMESH::OverConstrainedFace_i* aServant = new SMESH::OverConstrainedFace_i();
+  SMESH::OverConstrainedFace_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateOverConstrainedFace()";
+  return anObj._retn();
+}
+
 LessThan_ptr FilterManager_i::CreateLessThan()
 {
   SMESH::LessThan_i* aServant = new SMESH::LessThan_i();
@@ -1466,7 +2279,6 @@ LessThan_ptr FilterManager_i::CreateLessThan()
   return anObj._retn();
 }
 
-
 MoreThan_ptr FilterManager_i::CreateMoreThan()
 {
   SMESH::MoreThan_i* aServant = new SMESH::MoreThan_i();
@@ -1483,7 +2295,6 @@ EqualTo_ptr FilterManager_i::CreateEqualTo()
   return anObj._retn();
 }
 
-
 LogicalNOT_ptr FilterManager_i::CreateLogicalNOT()
 {
   SMESH::LogicalNOT_i* aServant = new SMESH::LogicalNOT_i();
@@ -1492,7 +2303,6 @@ LogicalNOT_ptr FilterManager_i::CreateLogicalNOT()
   return anObj._retn();
 }
 
-
 LogicalAND_ptr FilterManager_i::CreateLogicalAND()
 {
   SMESH::LogicalAND_i* aServant = new SMESH::LogicalAND_i();
@@ -1501,7 +2311,6 @@ LogicalAND_ptr FilterManager_i::CreateLogicalAND()
   return anObj._retn();
 }
 
-
 LogicalOR_ptr FilterManager_i::CreateLogicalOR()
 {
   SMESH::LogicalOR_i* aServant = new SMESH::LogicalOR_i();
@@ -1510,6 +2319,38 @@ LogicalOR_ptr FilterManager_i::CreateLogicalOR()
   return anObj._retn();
 }
 
+LinearOrQuadratic_ptr FilterManager_i::CreateLinearOrQuadratic()
+{
+  SMESH::LinearOrQuadratic_i* aServant = new SMESH::LinearOrQuadratic_i();
+  SMESH::LinearOrQuadratic_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateLinearOrQuadratic()";
+  return anObj._retn();
+}
+
+GroupColor_ptr FilterManager_i::CreateGroupColor()
+{
+  SMESH::GroupColor_i* aServant = new SMESH::GroupColor_i();
+  SMESH::GroupColor_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateGroupColor()";
+  return anObj._retn();
+}
+
+ElemGeomType_ptr FilterManager_i::CreateElemGeomType()
+{
+  SMESH::ElemGeomType_i* aServant = new SMESH::ElemGeomType_i();
+  SMESH::ElemGeomType_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateElemGeomType()";
+  return anObj._retn();
+}
+
+ElemEntityType_ptr FilterManager_i::CreateElemEntityType()
+{
+  SMESH::ElemEntityType_i* aServant = new SMESH::ElemEntityType_i();
+  SMESH::ElemEntityType_var anObj = aServant->_this();
+  TPythonDump()<<aServant<<" = "<<this<<".CreateElemEntityType()";
+  return anObj._retn();
+}
+
 Filter_ptr FilterManager_i::CreateFilter()
 {
   SMESH::Filter_i* aServant = new SMESH::Filter_i();
@@ -1522,7 +2363,7 @@ FilterLibrary_ptr FilterManager_i::LoadLibrary( const char* aFileName )
 {
   SMESH::FilterLibrary_i* aServant = new SMESH::FilterLibrary_i( aFileName );
   SMESH::FilterLibrary_var anObj = aServant->_this();
-  TPythonDump()<<aServant<<" = "<<this<<".LoadLibrary("<<aFileName<<")";
+  TPythonDump()<<aServant<<" = "<<this<<".LoadLibrary('"<<aFileName<<"')";
   return anObj._retn();
 }
 
@@ -1575,12 +2416,12 @@ Filter_i::Filter_i()
 Filter_i::~Filter_i()
 {
   if ( myPredicate )
-    myPredicate->Destroy();
+    myPredicate->UnRegister();
 
   if(!CORBA::is_nil(myMesh))
-    myMesh->Destroy();
+    myMesh->UnRegister();
 
-  TPythonDump()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".UnRegister()";
 }
 
 //=======================================================================
@@ -1590,7 +2431,7 @@ Filter_i::~Filter_i()
 void Filter_i::SetPredicate( Predicate_ptr thePredicate )
 {
   if ( myPredicate )
-    myPredicate->Destroy();
+    myPredicate->UnRegister();
 
   myPredicate = SMESH::GetPredicate(thePredicate);
 
@@ -1598,8 +2439,13 @@ void Filter_i::SetPredicate( Predicate_ptr thePredicate )
   {
     myFilter.SetPredicate( myPredicate->GetPredicate() );
     myPredicate->Register();
+    if ( const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(myMesh))
+      myPredicate->GetPredicate()->SetMesh( aMesh );
     TPythonDump()<<this<<".SetPredicate("<<myPredicate<<")";
   }
+  std::list<TPredicateChangeWaiter*>::iterator i = myWaiters.begin();
+  for ( ; i != myWaiters.end(); ++i )
+    (*i)->PredicateChanged();
 }
 
 //=======================================================================
@@ -1623,10 +2469,14 @@ SetMesh( SMESH_Mesh_ptr theMesh )
     theMesh->Register();
 
   if(!CORBA::is_nil(myMesh))
-    myMesh->Destroy();
+    myMesh->UnRegister();
 
-  myMesh = theMesh;
+  myMesh = SMESH_Mesh::_duplicate( theMesh );
   TPythonDump()<<this<<".SetMesh("<<theMesh<<")";
+
+  if ( myPredicate )
+    if ( const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
+      myPredicate->GetPredicate()->SetMesh( aMesh );
 }
 
 SMESH::long_array*
@@ -1646,7 +2496,8 @@ GetElementsId( Predicate_i* thePredicate,
                const SMDS_Mesh* theMesh,
                Controls::Filter::TIdSequence& theSequence )
 {
-  Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
+  if (thePredicate)
+    Controls::Filter::GetElementsId(theMesh,thePredicate->GetPredicate(),theSequence);
 }
 
 void
@@ -1655,8 +2506,9 @@ GetElementsId( Predicate_i* thePredicate,
                SMESH_Mesh_ptr theMesh,
                Controls::Filter::TIdSequence& theSequence )
 {
-  if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
-    Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
+  if (thePredicate) 
+    if(const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(theMesh))
+      Controls::Filter::GetElementsId(aMesh,thePredicate->GetPredicate(),theSequence);
 }
 
 SMESH::long_array*
@@ -1664,7 +2516,7 @@ Filter_i::
 GetElementsId( SMESH_Mesh_ptr theMesh )
 {
   SMESH::long_array_var anArray = new SMESH::long_array;
-  if(!CORBA::is_nil(theMesh)){
+  if(!CORBA::is_nil(theMesh) && myPredicate){
     Controls::Filter::TIdSequence aSequence;
     GetElementsId(myPredicate,theMesh,aSequence);
     long i = 0, iEnd = aSequence.size();
@@ -1675,6 +2527,119 @@ GetElementsId( SMESH_Mesh_ptr theMesh )
   return anArray._retn();
 }
 
+template<class TElement, class TIterator, class TPredicate>
+static void collectMeshInfo(const TIterator& theItr,
+                            TPredicate& thePred,
+                            SMESH::long_array& theRes)
+{         
+  if (!theItr)
+    return;
+  while (theItr->more()) {
+    const SMDS_MeshElement* anElem = theItr->next();
+    if ( thePred->IsSatisfy( anElem->GetID() ) )
+      theRes[ anElem->GetEntityType() ]++;
+  }
+}
+
+//=============================================================================
+/*!
+ * \brief Returns statistic of mesh elements
+ */
+//=============================================================================
+SMESH::long_array* ::Filter_i::GetMeshInfo()
+{
+  SMESH::long_array_var aRes = new SMESH::long_array();
+  aRes->length(SMESH::Entity_Last);
+  for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
+    aRes[i] = 0;
+
+  if(!CORBA::is_nil(myMesh) && myPredicate) {
+    const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(myMesh);
+    SMDS_ElemIteratorPtr it;
+    switch( GetElementType() )
+    {
+    case SMDSAbs_Node:
+      collectMeshInfo<const SMDS_MeshNode*>(aMesh->nodesIterator(),myPredicate,aRes);
+      break;
+    case SMDSAbs_Edge:
+      collectMeshInfo<const SMDS_MeshElement*>(aMesh->edgesIterator(),myPredicate,aRes);
+      break;
+    case SMDSAbs_Face:
+      collectMeshInfo<const SMDS_MeshElement*>(aMesh->facesIterator(),myPredicate,aRes);
+      break;
+    case SMDSAbs_Volume:
+      collectMeshInfo<const SMDS_MeshElement*>(aMesh->volumesIterator(),myPredicate,aRes);
+      break;
+    case SMDSAbs_All:
+    default:
+      collectMeshInfo<const SMDS_MeshElement*>(aMesh->elementsIterator(),myPredicate,aRes);
+      break;
+    }
+  }
+
+  return aRes._retn();  
+}
+
+//================================================================================
+/*!
+ * \brief Return GetElementType() within an array
+ * Implement SMESH_IDSource interface
+ */
+//================================================================================
+
+SMESH::array_of_ElementType* Filter_i::GetTypes()
+{
+  SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
+
+  // check if any element passes through the filter
+  if ( !CORBA::is_nil(myMesh) && myPredicate )
+  {
+    const SMDS_Mesh* aMesh = MeshPtr2SMDSMesh(myMesh);
+    SMDS_ElemIteratorPtr it = aMesh->elementsIterator( SMDSAbs_ElementType( GetElementType() ));
+    bool satisfies = false;
+    while ( !satisfies && it->more() )
+      satisfies = myPredicate->IsSatisfy( it->next()->GetID() );
+    if ( satisfies ) {
+      types->length( 1 );
+      types[0] = GetElementType();
+    }
+  }
+  return types._retn();
+}
+
+//=======================================================================
+//function : GetMesh
+//purpose  : Returns mesh
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr Filter_i::GetMesh()
+{
+  return SMESH_Mesh::_duplicate( myMesh );
+}
+
+//================================================================================
+/*!
+ * \brief Stores an object to be notified on change of predicate
+ */
+//================================================================================
+
+void Filter_i::AddWaiter( TPredicateChangeWaiter* waiter )
+{
+  if ( waiter )
+    myWaiters.push_back( waiter );
+}
+
+//================================================================================
+/*!
+ * \brief Removes an object to be notified on change of predicate
+ */
+//================================================================================
+
+void Filter_i::RemoveWaiter( TPredicateChangeWaiter* waiter )
+{
+  myWaiters.remove( waiter );
+}
+
 //=======================================================================
 // name    : getCriteria
 // Purpose : Retrieve criterions from predicate
@@ -1688,6 +2653,17 @@ static inline bool getCriteria( Predicate_i*                thePred,
   {
   case FT_FreeBorders:
   case FT_FreeEdges:
+  case FT_FreeFaces:
+  case FT_LinearOrQuadratic:
+  case FT_FreeNodes:
+  case FT_EqualEdges:
+  case FT_EqualFaces:
+  case FT_EqualVolumes:
+  case FT_BadOrientedVolume:
+  case FT_BareBorderVolume:
+  case FT_BareBorderFace:
+  case FT_OverConstrainedVolume:
+  case FT_OverConstrainedFace:
     {
       CORBA::ULong i = theCriteria->length();
       theCriteria->length( i + 1 );
@@ -1709,12 +2685,15 @@ static inline bool getCriteria( Predicate_i*                thePred,
 
       theCriteria[ i ].Type          = FT_BelongToGeom;
       theCriteria[ i ].ThresholdStr  = aPred->GetShapeName();
+      theCriteria[ i ].ThresholdID   = aPred->GetShapeID();
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+      theCriteria[ i ].Tolerance     = aPred->GetTolerance();
 
       return true;
     }
   case FT_BelongToPlane:
   case FT_BelongToCylinder:
+  case FT_BelongToGenSurface:
     {
       BelongToSurface_i* aPred = dynamic_cast<BelongToSurface_i*>( thePred );
 
@@ -1725,6 +2704,7 @@ static inline bool getCriteria( Predicate_i*                thePred,
 
       theCriteria[ i ].Type          = aFType;
       theCriteria[ i ].ThresholdStr  = aPred->GetShapeName();
+      theCriteria[ i ].ThresholdID   = aPred->GetShapeID();
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
       theCriteria[ i ].Tolerance     = aPred->GetTolerance();
 
@@ -1741,35 +2721,53 @@ static inline bool getCriteria( Predicate_i*                thePred,
 
       theCriteria[ i ].Type          = FT_LyingOnGeom;
       theCriteria[ i ].ThresholdStr  = aPred->GetShapeName();
+      theCriteria[ i ].ThresholdID   = aPred->GetShapeID();
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+      theCriteria[ i ].Tolerance     = aPred->GetTolerance();
 
       return true;
     }
-  case FT_RangeOfIds:
+   case FT_CoplanarFaces:
     {
-      RangeOfIds_i* aPred = dynamic_cast<RangeOfIds_i*>( thePred );
+      CoplanarFaces_i* aPred = dynamic_cast<CoplanarFaces_i*>( thePred );
 
       CORBA::ULong i = theCriteria->length();
       theCriteria->length( i + 1 );
 
       theCriteria[ i ] = createCriterion();
+      CORBA::String_var faceId = aPred->GetFaceAsString();
 
-      theCriteria[ i ].Type          = FT_RangeOfIds;
-      theCriteria[ i ].ThresholdStr  = aPred->GetRangeStr();
-      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+      theCriteria[ i ].Type          = FT_CoplanarFaces;
+      theCriteria[ i ].ThresholdID   = faceId;
+      theCriteria[ i ].Tolerance     = aPred->GetTolerance();
 
       return true;
     }
-  case FT_BadOrientedVolume:
+  case FT_EqualNodes:
     {
-      BadOrientedVolume_i* aPred = dynamic_cast<BadOrientedVolume_i*>( thePred );
+      EqualNodes_i* aPred = dynamic_cast<EqualNodes_i*>( thePred );
 
       CORBA::ULong i = theCriteria->length();
       theCriteria->length( i + 1 );
 
       theCriteria[ i ] = createCriterion();
 
-      theCriteria[ i ].Type          = FT_BadOrientedVolume;
+      theCriteria[ i ].Type          = FT_EqualNodes;
+      theCriteria[ i ].Tolerance     = aPred->GetTolerance();
+
+      return true;
+    }
+  case FT_RangeOfIds:
+    {
+      RangeOfIds_i* aPred = dynamic_cast<RangeOfIds_i*>( thePred );
+
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      theCriteria[ i ].Type          = FT_RangeOfIds;
+      theCriteria[ i ].ThresholdStr  = aPred->GetRangeStr();
       theCriteria[ i ].TypeOfElement = aPred->GetElementType();
 
       return true;
@@ -1816,6 +2814,45 @@ static inline bool getCriteria( Predicate_i*                thePred,
       theCriteria[ theCriteria->length() - 1 ].BinaryOp = aFType;
       return getCriteria( aPred2, theCriteria );
     }
+  case FT_GroupColor:
+    {
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      GroupColor_i* aPred = dynamic_cast<GroupColor_i*>( thePred );
+      theCriteria[ i ].Type          = aFType;
+      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+      theCriteria[ i ].ThresholdStr  = aPred->GetColorStr();
+
+      return true;
+    }
+  case FT_ElemGeomType:
+    {
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      ElemGeomType_i* aPred = dynamic_cast<ElemGeomType_i*>( thePred );
+      theCriteria[ i ].Type          = aFType;
+      theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+      theCriteria[ i ].Threshold     = (double)aPred->GetGeometryType();
+      return true;
+    }
+  case FT_EntityType:
+    {
+      CORBA::ULong i = theCriteria->length();
+      theCriteria->length( i + 1 );
+
+      theCriteria[ i ] = createCriterion();
+
+      ElemEntityType_i* aPred = dynamic_cast<ElemEntityType_i*>( thePred );
+      theCriteria[ i ].Type          = aFType;
+      theCriteria[ i ].Threshold     = (double)aPred->GetEntityType();
+      return true;
+    }
 
   case FT_Undefined:
     return false;
@@ -1841,7 +2878,7 @@ CORBA::Boolean Filter_i::GetCriteria( SMESH::Filter::Criteria_out theCriteria )
 CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria )
 {
   if ( myPredicate != 0 )
-    myPredicate->Destroy();
+    myPredicate->UnRegister();
 
   SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
   FilterManager_ptr aFilterMgr = aFilter->_this();
@@ -1857,16 +2894,30 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
     int         aCriterion    = theCriteria[ i ].Type;
     int         aCompare      = theCriteria[ i ].Compare;
     double      aThreshold    = theCriteria[ i ].Threshold;
+    const char* aThresholdStr = theCriteria[ i ].ThresholdStr;
+    const char* aThresholdID  = theCriteria[ i ].ThresholdID;
     int         aUnary        = theCriteria[ i ].UnaryOp;
     int         aBinary       = theCriteria[ i ].BinaryOp;
     double      aTolerance    = theCriteria[ i ].Tolerance;
-    const char* aThresholdStr = theCriteria[ i ].ThresholdStr;
     ElementType aTypeOfElem   = theCriteria[ i ].TypeOfElement;
     long        aPrecision    = theCriteria[ i ].Precision;
 
-    TPythonDump()<<"aCriteria.append(SMESH.Filter.Criterion("<<
-      aCriterion<<","<<aCompare<<","<<aThreshold<<",'"<<aThresholdStr<<"',"<<
-      aUnary<<","<<aBinary<<","<<aTolerance<<","<<aTypeOfElem<<","<<aPrecision<<"))";
+    {
+      TPythonDump pd;
+      pd << "aCriterion = SMESH.Filter.Criterion("
+         << aCriterion    << ", "
+         << aCompare      << ", "
+         << aThreshold    << ", '"
+         << aThresholdStr << "', '";
+      if (aThresholdID) pd << aThresholdID;
+      pd                  << "', "
+         << aUnary        << ", "
+         << aBinary       << ", "
+         << aTolerance    << ", "
+         << aTypeOfElem   << ", "
+         << aPrecision    << ")";
+    }
+    TPythonDump pd;
 
     SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
     SMESH::NumericalFunctor_ptr aFunctor = SMESH::NumericalFunctor::_nil();
@@ -1908,6 +2959,18 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
       case SMESH::FT_Area:
         aFunctor = aFilterMgr->CreateArea();
         break;
+      case SMESH::FT_Volume3D:
+        aFunctor = aFilterMgr->CreateVolume3D();
+        break;
+      case SMESH::FT_MaxElementLength2D:
+        aFunctor = aFilterMgr->CreateMaxElementLength2D();
+        break;
+      case SMESH::FT_MaxElementLength3D:
+        aFunctor = aFilterMgr->CreateMaxElementLength3D();
+        break;
+      case SMESH::FT_BallDiameter:
+        aFunctor = aFilterMgr->CreateBallDiameter();
+        break;
 
       // Predicates
 
@@ -1917,23 +2980,51 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
       case SMESH::FT_FreeEdges:
         aPredicate = aFilterMgr->CreateFreeEdges();
         break;
+      case SMESH::FT_FreeFaces:
+        aPredicate = aFilterMgr->CreateFreeFaces();
+        break;
+      case SMESH::FT_FreeNodes:
+        aPredicate = aFilterMgr->CreateFreeNodes();
+        break;
+      case SMESH::FT_EqualNodes:
+        {
+          SMESH::EqualNodes_ptr pred = aFilterMgr->CreateEqualNodes();
+          pred->SetTolerance( aTolerance );
+          aPredicate = pred;
+          break;
+        }
+      case SMESH::FT_EqualEdges:
+        aPredicate = aFilterMgr->CreateEqualEdges();
+        break;
+      case SMESH::FT_EqualFaces:
+        aPredicate = aFilterMgr->CreateEqualFaces();
+        break;
+      case SMESH::FT_EqualVolumes:
+        aPredicate = aFilterMgr->CreateEqualVolumes();
+        break;
       case SMESH::FT_BelongToGeom:
         {
           SMESH::BelongToGeom_ptr tmpPred = aFilterMgr->CreateBelongToGeom();
           tmpPred->SetElementType( aTypeOfElem );
-          tmpPred->SetShapeName( aThresholdStr );
+          tmpPred->SetShape( aThresholdID, aThresholdStr );
+          tmpPred->SetTolerance( aTolerance );
           aPredicate = tmpPred;
         }
         break;
       case SMESH::FT_BelongToPlane:
       case SMESH::FT_BelongToCylinder:
+      case SMESH::FT_BelongToGenSurface:
         {
           SMESH::BelongToSurface_ptr tmpPred;
-          if ( aCriterion == SMESH::FT_BelongToPlane )
-            tmpPred = aFilterMgr->CreateBelongToPlane();
-          else
-            tmpPred = aFilterMgr->CreateBelongToCylinder();
-          tmpPred->SetShapeName( aThresholdStr, aTypeOfElem );
+          switch ( aCriterion ) {
+          case SMESH::FT_BelongToPlane:
+            tmpPred = aFilterMgr->CreateBelongToPlane(); break;
+          case SMESH::FT_BelongToCylinder:
+            tmpPred = aFilterMgr->CreateBelongToCylinder(); break;
+          default:
+            tmpPred = aFilterMgr->CreateBelongToGenSurface();
+          }
+          tmpPred->SetShape( aThresholdID, aThresholdStr, aTypeOfElem );
           tmpPred->SetTolerance( aTolerance );
           aPredicate = tmpPred;
         }
@@ -1942,7 +3033,8 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
         {
           SMESH::LyingOnGeom_ptr tmpPred = aFilterMgr->CreateLyingOnGeom();
           tmpPred->SetElementType( aTypeOfElem );
-          tmpPred->SetShapeName( aThresholdStr );
+          tmpPred->SetShape( aThresholdID, aThresholdStr );
+          tmpPred->SetTolerance( aTolerance );
           aPredicate = tmpPred;
         }
         break;
@@ -1959,6 +3051,65 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
           aPredicate = aFilterMgr->CreateBadOrientedVolume();
         }
         break;
+      case SMESH::FT_BareBorderVolume:
+        {
+          aPredicate = aFilterMgr->CreateBareBorderVolume();
+        }
+        break;
+      case SMESH::FT_BareBorderFace:
+        {
+          aPredicate = aFilterMgr->CreateBareBorderFace();
+        }
+        break;
+      case SMESH::FT_OverConstrainedVolume:
+        {
+          aPredicate = aFilterMgr->CreateOverConstrainedVolume();
+        }
+        break;
+      case SMESH::FT_OverConstrainedFace:
+        {
+          aPredicate = aFilterMgr->CreateOverConstrainedFace();
+        }
+        break;
+      case SMESH::FT_LinearOrQuadratic:
+        {
+          SMESH::LinearOrQuadratic_ptr tmpPred = aFilterMgr->CreateLinearOrQuadratic();
+          tmpPred->SetElementType( aTypeOfElem );
+          aPredicate = tmpPred;
+          break;
+        }
+      case SMESH::FT_GroupColor:
+        {
+          SMESH::GroupColor_ptr tmpPred = aFilterMgr->CreateGroupColor();
+          tmpPred->SetElementType( aTypeOfElem );
+          tmpPred->SetColorStr( aThresholdStr );
+          aPredicate = tmpPred;
+          break;
+        }
+      case SMESH::FT_ElemGeomType:
+        {
+          SMESH::ElemGeomType_ptr tmpPred = aFilterMgr->CreateElemGeomType();
+          tmpPred->SetElementType( aTypeOfElem );
+          tmpPred->SetGeometryType( (GeometryType)(int)(aThreshold + 0.5) );
+          aPredicate = tmpPred;
+          break;
+        }
+      case SMESH::FT_EntityType:
+        {
+          SMESH::ElemEntityType_ptr tmpPred = aFilterMgr->CreateElemEntityType();
+          tmpPred->SetElementType( aTypeOfElem );
+          tmpPred->SetEntityType( EntityType( (int (aThreshold + 0.5))));
+          aPredicate = tmpPred;
+          break;
+        }
+      case SMESH::FT_CoplanarFaces:
+        {
+          SMESH::CoplanarFaces_ptr tmpPred = aFilterMgr->CreateCoplanarFaces();
+          tmpPred->SetFace( atol (aThresholdID ));
+          tmpPred->SetTolerance( aTolerance );
+          aPredicate = tmpPred;
+          break;
+        }
 
       default:
         continue;
@@ -2003,9 +3154,10 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
     // logical op
     aPredicates.push_back( aPredicate );
     aBinaries.push_back( aBinary );
+    pd <<"aCriteria.append(aCriterion)";
 
   } // end of for
-  TPythonDump()<<this<<".SetCriteria(aCriteria)";
+  TPythonDump pd; pd<<this<<".SetCriteria(aCriteria)";
 
   // CREATE ONE PREDICATE FROM PREVIOUSLY CREATED MAP
 
@@ -2090,6 +3242,8 @@ Predicate_ptr Filter_i::GetPredicate()
   else
   {
     SMESH::Predicate_var anObj = myPredicate->_this();
+    // if ( SMESH::Functor_i* fun = SMESH::DownCast<SMESH::Functor_i*>( anObj ))
+    //   TPythonDump() << fun << " = " << this << ".GetPredicate()";
     return anObj._retn();
   }
 }
@@ -2111,7 +3265,7 @@ Predicate_ptr Filter_i::GetPredicate()
 // name    : toString
 // Purpose : Convert bool to LDOMString
 //=======================================================================
-static inline LDOMString toString( const bool val )
+static inline LDOMString toString( CORBA::Boolean val )
 {
   return val ? "logical not" : "";
 }
@@ -2129,7 +3283,7 @@ static inline bool toBool( const LDOMString& theStr )
 // name    : toString
 // Purpose : Convert double to LDOMString
 //=======================================================================
-static inline LDOMString toString( const double val )
+static inline LDOMString toString( CORBA::Double val )
 {
   char a[ 255 ];
   sprintf( a, "%e", val );
@@ -2149,7 +3303,7 @@ static inline double toDouble( const LDOMString& theStr )
 // name    : toString
 // Purpose : Convert functor type to LDOMString
 //=======================================================================
-static inline LDOMString toString( const long theType )
+static inline LDOMString toString( CORBA::Long theType )
 {
   switch ( theType )
   {
@@ -2159,24 +3313,42 @@ static inline LDOMString toString( const long theType )
     case FT_Taper           : return "Taper";
     case FT_Skew            : return "Skew";
     case FT_Area            : return "Area";
+    case FT_Volume3D        : return "Volume3D";
+    case FT_MaxElementLength2D: return "Max element length 2D";
+    case FT_MaxElementLength3D: return "Max element length 3D";
     case FT_BelongToGeom    : return "Belong to Geom";
     case FT_BelongToPlane   : return "Belong to Plane";
     case FT_BelongToCylinder: return "Belong to Cylinder";
+    case FT_BelongToGenSurface: return "Belong to Generic Surface";
     case FT_LyingOnGeom     : return "Lying on Geom";
-    case FT_BadOrientedVolume: return "Bad Oriented Volume";
+    case FT_BadOrientedVolume:return "Bad Oriented Volume";
+    case FT_BareBorderVolume: return "Volumes with bare border";
+    case FT_BareBorderFace  : return "Faces with bare border";
+    case FT_OverConstrainedVolume: return "Over-constrained Volumes";
+    case FT_OverConstrainedFace  : return "Over-constrained Faces";
     case FT_RangeOfIds      : return "Range of IDs";
     case FT_FreeBorders     : return "Free borders";
     case FT_FreeEdges       : return "Free edges";
+    case FT_FreeFaces       : return "Free faces";
+    case FT_FreeNodes       : return "Free nodes";
+    case FT_EqualNodes      : return "Equal nodes";
+    case FT_EqualEdges      : return "Equal edges";
+    case FT_EqualFaces      : return "Equal faces";
+    case FT_EqualVolumes    : return "Equal volumes";
     case FT_MultiConnection : return "Borders at multi-connections";
-    case FT_MultiConnection2D: return "Borders at multi-connections 2D";
+    case FT_MultiConnection2D:return "Borders at multi-connections 2D";
     case FT_Length          : return "Length";
-    case FT_Length2D        : return "Length2D";
+    case FT_Length2D        : return "Length 2D";
     case FT_LessThan        : return "Less than";
     case FT_MoreThan        : return "More than";
     case FT_EqualTo         : return "Equal to";
     case FT_LogicalNOT      : return "Not";
     case FT_LogicalAND      : return "And";
     case FT_LogicalOR       : return "Or";
+    case FT_GroupColor      : return "Color of Group";
+    case FT_LinearOrQuadratic : return "Linear or Quadratic";
+    case FT_ElemGeomType    : return "Element geomtry type";
+    case FT_EntityType      : return "Entity type";
     case FT_Undefined       : return "";
     default                 : return "";
   }
@@ -2194,24 +3366,42 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
   else if ( theStr.equals( "Taper"                        ) ) return FT_Taper;
   else if ( theStr.equals( "Skew"                         ) ) return FT_Skew;
   else if ( theStr.equals( "Area"                         ) ) return FT_Area;
+  else if ( theStr.equals( "Volume3D"                     ) ) return FT_Volume3D;
+  else if ( theStr.equals( "Max element length 2D"        ) ) return FT_MaxElementLength2D;
+  else if ( theStr.equals( "Max element length 3D"        ) ) return FT_MaxElementLength3D;
   else if ( theStr.equals( "Belong to Geom"               ) ) return FT_BelongToGeom;
   else if ( theStr.equals( "Belong to Plane"              ) ) return FT_BelongToPlane;
   else if ( theStr.equals( "Belong to Cylinder"           ) ) return FT_BelongToCylinder;
+  else if ( theStr.equals( "Belong to Generic Surface"    ) ) return FT_BelongToGenSurface;
   else if ( theStr.equals( "Lying on Geom"                ) ) return FT_LyingOnGeom;
   else if ( theStr.equals( "Free borders"                 ) ) return FT_FreeBorders;
   else if ( theStr.equals( "Free edges"                   ) ) return FT_FreeEdges;
+  else if ( theStr.equals( "Free faces"                   ) ) return FT_FreeFaces;
+  else if ( theStr.equals( "Free nodes"                   ) ) return FT_FreeNodes;
+  else if ( theStr.equals( "Equal nodes"                  ) ) return FT_EqualNodes;
+  else if ( theStr.equals( "Equal edges"                  ) ) return FT_EqualEdges;
+  else if ( theStr.equals( "Equal faces"                  ) ) return FT_EqualFaces;
+  else if ( theStr.equals( "Equal volumes"                ) ) return FT_EqualVolumes;
   else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
   //  else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
   else if ( theStr.equals( "Length"                       ) ) return FT_Length;
   //  else if ( theStr.equals( "Length2D"                     ) ) return FT_Length2D;
   else if ( theStr.equals( "Range of IDs"                 ) ) return FT_RangeOfIds;
   else if ( theStr.equals( "Bad Oriented Volume"          ) ) return FT_BadOrientedVolume;
+  else if ( theStr.equals( "Volumes with bare border"     ) ) return FT_BareBorderVolume;
+  else if ( theStr.equals( "Faces with bare border"       ) ) return FT_BareBorderFace;
+  else if ( theStr.equals( "Over-constrained Volumes"     ) ) return FT_OverConstrainedVolume;
+  else if ( theStr.equals( "Over-constrained Faces"       ) ) return FT_OverConstrainedFace;
   else if ( theStr.equals( "Less than"                    ) ) return FT_LessThan;
   else if ( theStr.equals( "More than"                    ) ) return FT_MoreThan;
   else if ( theStr.equals( "Equal to"                     ) ) return FT_EqualTo;
   else if ( theStr.equals( "Not"                          ) ) return FT_LogicalNOT;
   else if ( theStr.equals( "And"                          ) ) return FT_LogicalAND;
   else if ( theStr.equals( "Or"                           ) ) return FT_LogicalOR;
+  else if ( theStr.equals( "Color of Group"               ) ) return FT_GroupColor;
+  else if ( theStr.equals( "Linear or Quadratic"          ) ) return FT_LinearOrQuadratic;
+  else if ( theStr.equals( "Element geomtry type"         ) ) return FT_ElemGeomType;
+  else if ( theStr.equals( "Entity type"                  ) ) return FT_EntityType;
   else if ( theStr.equals( ""                             ) ) return FT_Undefined;
   else  return FT_Undefined;
 }
@@ -2363,12 +3553,12 @@ static LDOM_Element createFilterItem( const char*       theName,
   for ( CORBA::ULong i = 0, n = aCriteria->length(); i < n; i++ )
   {
     LDOM_Element aCriterionItem = theDoc.createElement( "criterion" );
-
-    aCriterionItem.setAttribute( ATTR_TYPE         , toString( aCriteria[ i ].Type      ) );
-    aCriterionItem.setAttribute( ATTR_COMPARE      , toString( aCriteria[ i ].Compare   ) );
-    aCriterionItem.setAttribute( ATTR_THRESHOLD    , toString( aCriteria[ i ].Threshold ) );
-    aCriterionItem.setAttribute( ATTR_UNARY        , toString( aCriteria[ i ].UnaryOp   ) );
-    aCriterionItem.setAttribute( ATTR_BINARY       , toString( aCriteria[ i ].BinaryOp  ) );
+    
+    aCriterionItem.setAttribute( ATTR_TYPE         , toString(  aCriteria[ i ].Type) );
+    aCriterionItem.setAttribute( ATTR_COMPARE      , toString(  aCriteria[ i ].Compare ) );
+    aCriterionItem.setAttribute( ATTR_THRESHOLD    , toString(  aCriteria[ i ].Threshold ) );
+    aCriterionItem.setAttribute( ATTR_UNARY        , toString(  aCriteria[ i ].UnaryOp ) );
+    aCriterionItem.setAttribute( ATTR_BINARY       , toString(  aCriteria[ i ].BinaryOp ) );
 
     aCriterionItem.setAttribute( ATTR_THRESHOLD_STR, (const char*)aCriteria[ i ].ThresholdStr );
     aCriterionItem.setAttribute( ATTR_TOLERANCE    , toString( aCriteria[ i ].Tolerance ) );
@@ -2429,7 +3619,7 @@ FilterLibrary_i::FilterLibrary_i()
 FilterLibrary_i::~FilterLibrary_i()
 {
   delete myFileName;
-  TPythonDump()<<this<<".Destroy()";
+  //TPythonDump()<<this<<".UnRegister()";
 }
 
 //=======================================================================
@@ -2621,7 +3811,7 @@ CORBA::Boolean FilterLibrary_i::Replace( const char* theFilterName,
   {
     aFilterItem.ReplaceElement( aNewItem );
     if(Filter_i* aFilter = DownCast<Filter_i*>(theFilter))
-      TPythonDump()<<this<<".Replace('"<<theFilterName<<"',"<<theNewName<<"',"<<aFilter<<")";
+      TPythonDump()<<this<<".Replace('"<<theFilterName<<"','"<<theNewName<<"',"<<aFilter<<")";
     return true;
   }
 }
@@ -2726,3 +3916,96 @@ string_array* FilterLibrary_i::GetAllNames()
 
   return aResArray._retn();
 }
+
+//================================================================================
+/*!
+ * \brief Return an array of strings corresponding to items of enum FunctorType
+ */
+//================================================================================
+
+static const char** getFunctNames()
+{
+  static const char* functName[ SMESH::FT_Undefined + 1 ] = {
+    // IT's necessary to update this array according to enum FunctorType (SMESH_Filter.idl)
+    // The order is IMPORTANT !!!
+    "FT_AspectRatio",
+    "FT_AspectRatio3D",
+    "FT_Warping",
+    "FT_MinimumAngle",
+    "FT_Taper",
+    "FT_Skew",
+    "FT_Area",
+    "FT_Volume3D",
+    "FT_MaxElementLength2D",
+    "FT_MaxElementLength3D",
+    "FT_FreeBorders",
+    "FT_FreeEdges",
+    "FT_FreeNodes",
+    "FT_FreeFaces",
+    "FT_EqualNodes",
+    "FT_EqualEdges",
+    "FT_EqualFaces",
+    "FT_EqualVolumes",
+    "FT_MultiConnection",
+    "FT_MultiConnection2D",
+    "FT_Length",
+    "FT_Length2D",
+    "FT_BelongToGeom",
+    "FT_BelongToPlane",
+    "FT_BelongToCylinder",
+    "FT_BelongToGenSurface",
+    "FT_LyingOnGeom",
+    "FT_RangeOfIds",
+    "FT_BadOrientedVolume",
+    "FT_BareBorderVolume",
+    "FT_BareBorderFace",
+    "FT_OverConstrainedVolume",
+    "FT_OverConstrainedFace",
+    "FT_LinearOrQuadratic",
+    "FT_GroupColor",
+    "FT_ElemGeomType",
+    "FT_EntityType", 
+    "FT_CoplanarFaces",
+    "FT_BallDiameter",
+    "FT_LessThan",
+    "FT_MoreThan",
+    "FT_EqualTo",
+    "FT_LogicalNOT",
+    "FT_LogicalAND",
+    "FT_LogicalOR",
+    "FT_Undefined"};
+  return functName;
+}
+
+//================================================================================
+/*!
+ * \brief Return a string corresponding to an item of enum FunctorType
+ */
+//================================================================================
+
+const char* SMESH::FunctorTypeToString(SMESH::FunctorType ft)
+{
+  if ( ft < 0 || ft > SMESH::FT_Undefined )
+    return "FT_Undefined";
+  return getFunctNames()[ ft ];
+}
+
+//================================================================================
+/*!
+ * \brief Converts a string to FunctorType. This is reverse of FunctorTypeToString()
+ */
+//================================================================================
+
+SMESH::FunctorType SMESH::StringToFunctorType(const char* str)
+{
+  std::string name( str + 3 ); // skip "FT_"
+  const char** functNames = getFunctNames();
+  int ft = 0;
+  for ( ; ft < SMESH::FT_Undefined; ++ft )
+    if ( name == ( functNames[ft] + 3 ))
+      break;
+
+  //ASSERT( strcmp( str, FunctorTypeToString( SMESH::FunctorType( ft ))) == 0 );
+
+  return SMESH::FunctorType( ft );
+}