[smesh] Add patch for freecad specific tweaks.

Richard Shaw hobbes1069 at fedoraproject.org
Mon Jul 28 18:11:20 UTC 2014


commit 100b82889b79c9358f32be7d6a693e5245d61995
Author: Richard M. Shaw <hobbes1069 at gmail.com>
Date:   Mon Jul 28 13:11:14 2014 -0500

    Add patch for freecad specific tweaks.

 smesh-5.1.2.2-pi_to_m_pi.patch |  102 -
 smesh-OCE_0.13_port.patch      |   29 -
 smesh-freecad-full.patch       |25119 ++++++++++++++++++++++++++++++++++++++++
 smesh.patch                    |  117 -
 smesh.spec                     |   20 +-
 5 files changed, 25130 insertions(+), 257 deletions(-)
---
diff --git a/smesh-freecad-full.patch b/smesh-freecad-full.patch
new file mode 100644
index 0000000..34bacf1
--- /dev/null
+++ b/smesh-freecad-full.patch
@@ -0,0 +1,25119 @@
+diff -Naur smesh-5.1.2.2.svn55/src/Controls/SMESH_Controls.cpp salomesmesh/src/Controls/SMESH_Controls.cpp
+--- smesh-5.1.2.2.svn55/src/Controls/SMESH_Controls.cpp	2012-05-04 05:32:54.000000000 -0500
++++ salomesmesh/src/Controls/SMESH_Controls.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -19,6 +19,11 @@
+ //
+ //  See http://www.salome-platform.org/ or email : webmaster.salome at opencascade.com
+ //
++#ifdef _MSC_VER
++#define _USE_MATH_DEFINES
++#endif // _MSC_VER
++#include <cmath>
++
+ #include "SMESH_ControlsDef.hxx"
+ 
+ #include <set>
+@@ -64,6 +69,10 @@
+ #include "SMESHDS_Mesh.hxx"
+ #include "SMESHDS_GroupBase.hxx"
+ 
++#ifndef PI
++#define PI M_PI
++#endif
++
+ /*
+                             AUXILIARY METHODS
+ */
+@@ -149,21 +158,21 @@
+ //     SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
+ //     if ( anIter != 0 ) {
+ //       while( anIter->more() ) {
+-//      const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+-//      if ( aNode == 0 )
+-//        return 0;
+-//      SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+-//      while( anElemIter->more() ) {
+-//        const SMDS_MeshElement* anElem = anElemIter->next();
+-//        if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
+-//          int anId = anElem->GetID();
+-
+-//          if ( anIter->more() )              // i.e. first node
+-//            aMap.Add( anId );
+-//          else if ( aMap.Contains( anId ) )
+-//            aResult++;
+-//        }
+-//      }
++// 	const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
++// 	if ( aNode == 0 )
++// 	  return 0;
++// 	SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
++// 	while( anElemIter->more() ) {
++// 	  const SMDS_MeshElement* anElem = anElemIter->next();
++// 	  if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
++// 	    int anId = anElem->GetID();
++
++// 	    if ( anIter->more() )              // i.e. first node
++// 	      aMap.Add( anId );
++// 	    else if ( aMap.Contains( anId ) )
++// 	      aResult++;
++// 	  }
++// 	}
+ //       }
+ //     }
+ 
+@@ -332,7 +341,7 @@
+     aMin = Min(aMin,A0);
+   }
+ 
+-  return aMin * 180.0 / M_PI;
++  return aMin * 180.0 / PI;
+ }
+ 
+ double MinimumAngle::GetBadRate( double Value, int nbNodes ) const
+@@ -476,9 +485,9 @@
+ 
+   inline double getArea(double theHalfPerim, double theTria[3]){
+     return sqrt(theHalfPerim*
+-                (theHalfPerim-theTria[0])*
+-                (theHalfPerim-theTria[1])*
+-                (theHalfPerim-theTria[2]));
++		(theHalfPerim-theTria[0])*
++		(theHalfPerim-theTria[1])*
++		(theHalfPerim-theTria[2]));
+   }
+ 
+   inline double getVolume(double theLen[6]){
+@@ -831,12 +840,12 @@
+   gp_XYZ N  = GI.Crossed( GJ );
+ 
+   if ( N.Modulus() < gp::Resolution() )
+-    return M_PI / 2;
++    return PI / 2;
+ 
+   N.Normalize();
+ 
+   double H = ( thePnt2 - theG ).Dot( N );
+-  return asin( fabs( H / L ) ) * 180. / M_PI;
++  return asin( fabs( H / L ) ) * 180. / PI;
+ }
+ 
+ double Warping::GetBadRate( double Value, int /*nbNodes*/ ) const
+@@ -915,14 +924,14 @@
+     return 0.;
+ 
+   // Compute skew
+-  static double PI2 = M_PI / 2.;
++  static double PI2 = PI / 2.;
+   if ( P.size() == 3 )
+   {
+     double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
+     double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
+     double A2 = fabs( PI2 - skewAngle( P( 2 ), P( 3 ), P( 1 ) ) );
+ 
+-    return Max( A0, Max( A1, A2 ) ) * 180. / M_PI;
++    return Max( A0, Max( A1, A2 ) ) * 180. / PI;
+   }
+   else
+   {
+@@ -939,7 +948,7 @@
+     if ( A < Precision::Angular() )
+       return 0.;
+ 
+-    return A * 180. / M_PI;
++    return A * 180. / PI;
+   }
+ }
+ 
+@@ -1036,160 +1045,160 @@
+     case SMDSAbs_Node:
+     case SMDSAbs_Edge:
+       if (len == 2){
+-        aVal = getDistance( P( 1 ), P( 2 ) );
++	aVal = getDistance( P( 1 ), P( 2 ) );
+         break;
+       }
+       else if (len == 3){ // quadratic edge
+-        aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
++	aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
+         break;
+       }
+     case SMDSAbs_Face:
+       if (len == 3){ // triangles
+-        double L1 = getDistance(P( 1 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 1 ));
+-        aVal = Max(L1,Max(L2,L3));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 1 ));
++	aVal = Max(L1,Max(L2,L3));
++	break;
+       }
+       else if (len == 4){ // quadrangles
+-        double L1 = getDistance(P( 1 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 4 ));
+-        double L4 = getDistance(P( 4 ),P( 1 ));
+-        aVal = Max(Max(L1,L2),Max(L3,L4));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 4 ));
++	double L4 = getDistance(P( 4 ),P( 1 ));
++	aVal = Max(Max(L1,L2),Max(L3,L4));
++	break;
+       }
+       if (len == 6){ // quadratic triangles
+-        double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
+-        double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
+-        double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
+-        aVal = Max(L1,Max(L2,L3));
++	double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
++	double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
++	double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
++	aVal = Max(L1,Max(L2,L3));
+         //cout<<"L1="<<L1<<" L2="<<L2<<"L3="<<L3<<" aVal="<<aVal<<endl;
+-        break;
++	break;
+       }
+       else if (len == 8){ // quadratic quadrangles
+-        double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
+-        double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
+-        double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
+-        double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
+-        aVal = Max(Max(L1,L2),Max(L3,L4));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
++	double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
++	double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
++	double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
++	aVal = Max(Max(L1,L2),Max(L3,L4));
++	break;
+       }
+     case SMDSAbs_Volume:
+       if (len == 4){ // tetraidrs
+-        double L1 = getDistance(P( 1 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 1 ));
+-        double L4 = getDistance(P( 1 ),P( 4 ));
+-        double L5 = getDistance(P( 2 ),P( 4 ));
+-        double L6 = getDistance(P( 3 ),P( 4 ));
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 1 ));
++	double L4 = getDistance(P( 1 ),P( 4 ));
++	double L5 = getDistance(P( 2 ),P( 4 ));
++	double L6 = getDistance(P( 3 ),P( 4 ));
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	break;
+       }
+       else if (len == 5){ // piramids
+-        double L1 = getDistance(P( 1 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 1 ));
+-        double L4 = getDistance(P( 4 ),P( 1 ));
+-        double L5 = getDistance(P( 1 ),P( 5 ));
+-        double L6 = getDistance(P( 2 ),P( 5 ));
+-        double L7 = getDistance(P( 3 ),P( 5 ));
+-        double L8 = getDistance(P( 4 ),P( 5 ));
+-
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        aVal = Max(aVal,Max(L7,L8));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 1 ));
++	double L4 = getDistance(P( 4 ),P( 1 ));
++	double L5 = getDistance(P( 1 ),P( 5 ));
++	double L6 = getDistance(P( 2 ),P( 5 ));
++	double L7 = getDistance(P( 3 ),P( 5 ));
++	double L8 = getDistance(P( 4 ),P( 5 ));
++
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	aVal = Max(aVal,Max(L7,L8));
++	break;
+       }
+       else if (len == 6){ // pentaidres
+-        double L1 = getDistance(P( 1 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 1 ));
+-        double L4 = getDistance(P( 4 ),P( 5 ));
+-        double L5 = getDistance(P( 5 ),P( 6 ));
+-        double L6 = getDistance(P( 6 ),P( 4 ));
+-        double L7 = getDistance(P( 1 ),P( 4 ));
+-        double L8 = getDistance(P( 2 ),P( 5 ));
+-        double L9 = getDistance(P( 3 ),P( 6 ));
+-
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        aVal = Max(aVal,Max(Max(L7,L8),L9));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 1 ));
++	double L4 = getDistance(P( 4 ),P( 5 ));
++	double L5 = getDistance(P( 5 ),P( 6 ));
++	double L6 = getDistance(P( 6 ),P( 4 ));
++	double L7 = getDistance(P( 1 ),P( 4 ));
++	double L8 = getDistance(P( 2 ),P( 5 ));
++	double L9 = getDistance(P( 3 ),P( 6 ));
++
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	aVal = Max(aVal,Max(Max(L7,L8),L9));
++	break;
+       }
+       else if (len == 8){ // hexaider
+-        double L1 = getDistance(P( 1 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 4 ));
+-        double L4 = getDistance(P( 4 ),P( 1 ));
+-        double L5 = getDistance(P( 5 ),P( 6 ));
+-        double L6 = getDistance(P( 6 ),P( 7 ));
+-        double L7 = getDistance(P( 7 ),P( 8 ));
+-        double L8 = getDistance(P( 8 ),P( 5 ));
+-        double L9 = getDistance(P( 1 ),P( 5 ));
+-        double L10= getDistance(P( 2 ),P( 6 ));
+-        double L11= getDistance(P( 3 ),P( 7 ));
+-        double L12= getDistance(P( 4 ),P( 8 ));
+-
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
+-        aVal = Max(aVal,Max(L11,L12));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 4 ));
++	double L4 = getDistance(P( 4 ),P( 1 ));
++	double L5 = getDistance(P( 5 ),P( 6 ));
++	double L6 = getDistance(P( 6 ),P( 7 ));
++	double L7 = getDistance(P( 7 ),P( 8 ));
++	double L8 = getDistance(P( 8 ),P( 5 ));
++	double L9 = getDistance(P( 1 ),P( 5 ));
++	double L10= getDistance(P( 2 ),P( 6 ));
++	double L11= getDistance(P( 3 ),P( 7 ));
++	double L12= getDistance(P( 4 ),P( 8 ));
++
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
++	aVal = Max(aVal,Max(L11,L12));
++	break;
+ 
+       }
+ 
+       if (len == 10){ // quadratic tetraidrs
+-        double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
+-        double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
+-        double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
+-        double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
++	double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
++	double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
++	double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	break;
+       }
+       else if (len == 13){ // quadratic piramids
+-        double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
+-        double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+-        double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+-        double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
+-        double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
+-        double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        aVal = Max(aVal,Max(L7,L8));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
++	double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
++	double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
++	double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
++	double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
++	double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	aVal = Max(aVal,Max(L7,L8));
++	break;
+       }
+       else if (len == 15){ // quadratic pentaidres
+-        double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+-        double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+-        double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
+-        double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
+-        double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
+-        double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
+-        double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        aVal = Max(aVal,Max(Max(L7,L8),L9));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
++	double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
++	double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
++	double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
++	double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
++	double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
++	double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	aVal = Max(aVal,Max(Max(L7,L8),L9));
++	break;
+       }
+       else if (len == 20){ // quadratic hexaider
+-        double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
+-        double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
+-        double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
+-        double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
+-        double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
+-        double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
+-        double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
+-        double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
+-        double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
+-        double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
+-        double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
+-        double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
+-        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+-        aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
+-        aVal = Max(aVal,Max(L11,L12));
+-        break;
++	double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
++	double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
++	double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
++	double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
++	double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
++	double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
++	double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
++	double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
++	double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
++	double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
++	double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
++	double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
++	aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
++	aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
++	aVal = Max(aVal,Max(L11,L12));
++	break;
+ 
+       }
+ 
+@@ -1467,12 +1476,12 @@
+       Value aValue(aNodeId[1],aNodeId[2]);
+       MValues::iterator aItr = theValues.find(aValue);
+       if (aItr != theValues.end()){
+-        aItr->second += 1;
+-        //aNbConnects = nb;
++	aItr->second += 1;
++	//aNbConnects = nb;
+       }
+       else {
+-        theValues[aValue] = 1;
+-        //aNbConnects = 1;
++	theValues[aValue] = 1;
++	//aNbConnects = 1;
+       }
+       //cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
+       aNodeId[1] = aNodeId[2];
+@@ -1651,8 +1660,8 @@
+ }
+ 
+ inline void UpdateBorders(const FreeEdges::Border& theBorder,
+-                          FreeEdges::TBorders& theRegistry,
+-                          FreeEdges::TBorders& theContainer)
++			  FreeEdges::TBorders& theRegistry,
++			  FreeEdges::TBorders& theContainer)
+ {
+   if(theRegistry.find(theBorder) == theRegistry.end()){
+     theRegistry.insert(theBorder);
+@@ -1938,10 +1947,8 @@
+ {
+   if (!myMesh) return false;
+   const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
+-  if ( !anElem )
+-    return false;
+   const SMDSAbs_ElementType anElemType = anElem->GetType();
+-  if ( myType != SMDSAbs_All && anElemType != myType )
++  if ( !anElem || (myType != SMDSAbs_All && anElemType != myType) )
+     return false;
+   const int aNbNode = anElem->NbNodes();
+   bool isOk = false;
+@@ -1954,7 +1961,7 @@
+   case SMDSAbs_Edge:
+     isOk = (myGeomType == SMDSGeom_EDGE);
+     break;
+-
++	
+   case SMDSAbs_Face:
+     if ( myGeomType == SMDSGeom_TRIANGLE )
+       isOk = (!anElem->IsPoly() && (anElem->IsQuadratic() ? aNbNode == 6 : aNbNode == 3));
+@@ -1976,6 +1983,7 @@
+      else if ( myGeomType == SMDSGeom_POLYHEDRA )
+       isOk = anElem->IsPoly();
+     break;
++	
+     default: break;
+   }
+   return isOk;
+@@ -2259,7 +2267,7 @@
+ */
+ bool LessThan::IsSatisfy( long theId )
+ {
+-  return myFunctor != NULL && myFunctor->GetValue( theId ) < myMargin;
++  return (myFunctor!=NULL) && myFunctor->GetValue( theId ) < myMargin;
+ }
+ 
+ 
+@@ -2269,7 +2277,7 @@
+ */
+ bool MoreThan::IsSatisfy( long theId )
+ {
+-  return myFunctor != NULL && myFunctor->GetValue( theId ) > myMargin;
++  return (myFunctor!=NULL) && myFunctor->GetValue( theId ) > myMargin;
+ }
+ 
+ 
+@@ -2283,7 +2291,7 @@
+ 
+ bool EqualTo::IsSatisfy( long theId )
+ {
+-  return myFunctor != NULL && fabs( myFunctor->GetValue( theId ) - myMargin ) < myToler;
++  return (myFunctor!=NULL) && fabs( myFunctor->GetValue( theId ) - myMargin ) < myToler;
+ }
+ 
+ void EqualTo::SetTolerance( double theToler )
+@@ -2308,7 +2316,7 @@
+ 
+ bool LogicalNOT::IsSatisfy( long theId )
+ {
+-  return myPredicate != NULL && !myPredicate->IsSatisfy( theId );
++  return (myPredicate!=NULL) && !myPredicate->IsSatisfy( theId );
+ }
+ 
+ void LogicalNOT::SetMesh( const SMDS_Mesh* theMesh )
+@@ -2376,8 +2384,8 @@
+ bool LogicalAND::IsSatisfy( long theId )
+ {
+   return
+-    myPredicate1 != NULL &&
+-    myPredicate2 != NULL &&
++    (myPredicate1!=NULL) &&
++    (myPredicate2!=NULL) &&
+     myPredicate1->IsSatisfy( theId ) &&
+     myPredicate2->IsSatisfy( theId );
+ }
+@@ -2390,8 +2398,8 @@
+ bool LogicalOR::IsSatisfy( long theId )
+ {
+   return
+-    myPredicate1 != NULL &&
+-    myPredicate2 != NULL &&
++    (myPredicate1!=NULL) &&
++    (myPredicate2!=NULL) &&
+     myPredicate1->IsSatisfy( theId ) ||
+     myPredicate2->IsSatisfy( theId );
+ }
+@@ -2414,15 +2422,15 @@
+ 
+ template<class TElement, class TIterator, class TPredicate>
+ inline void FillSequence(const TIterator& theIterator,
+-                         TPredicate& thePredicate,
+-                         Filter::TIdSequence& theSequence)
++			 TPredicate& thePredicate,
++			 Filter::TIdSequence& theSequence)
+ {
+   if ( theIterator ) {
+     while( theIterator->more() ) {
+       TElement anElem = theIterator->next();
+       long anId = anElem->GetID();
+       if ( thePredicate->IsSatisfy( anId ) )
+-        theSequence.push_back( anId );
++	theSequence.push_back( anId );
+     }
+   }
+ }
+@@ -2430,8 +2438,8 @@
+ void
+ Filter::
+ GetElementsId( const SMDS_Mesh* theMesh,
+-               PredicatePtr thePredicate,
+-               TIdSequence& theSequence )
++	       PredicatePtr thePredicate,
++	       TIdSequence& theSequence )
+ {
+   theSequence.clear();
+ 
+@@ -2464,7 +2472,7 @@
+ 
+ void
+ Filter::GetElementsId( const SMDS_Mesh* theMesh,
+-                       Filter::TIdSequence& theSequence )
++		       Filter::TIdSequence& theSequence )
+ {
+   GetElementsId(theMesh,myPredicate,theSequence);
+ }
+@@ -3256,54 +3264,31 @@
+ TSequenceOfXYZ::TSequenceOfXYZ()
+ {}
+ 
+-TSequenceOfXYZ::TSequenceOfXYZ(size_type n) : myArray(n)
++TSequenceOfXYZ::TSequenceOfXYZ(size_type n) : std::vector<gp_XYZ>(n)
+ {}
+ 
+-TSequenceOfXYZ::TSequenceOfXYZ(size_type n, const gp_XYZ& t) : myArray(n,t)
++TSequenceOfXYZ::TSequenceOfXYZ(size_type n, const value_type& t) : std::vector<gp_XYZ>(n,t)
+ {}
+ 
+-TSequenceOfXYZ::TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ) : myArray(theSequenceOfXYZ.myArray)
++TSequenceOfXYZ::TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ) : std::vector<gp_XYZ>(theSequenceOfXYZ)
+ {}
+ 
+ template <class InputIterator>
+-TSequenceOfXYZ::TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd): myArray(theBegin,theEnd)
+-{}
+-
+-TSequenceOfXYZ::~TSequenceOfXYZ()
++TSequenceOfXYZ::TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd): std::vector<gp_XYZ>(theBegin,theEnd)
+ {}
+ 
+ TSequenceOfXYZ& TSequenceOfXYZ::operator=(const TSequenceOfXYZ& theSequenceOfXYZ)
+ {
+-  myArray = theSequenceOfXYZ.myArray;
++  std::vector<gp_XYZ>::operator=(theSequenceOfXYZ);
+   return *this;
+ }
+ 
+-gp_XYZ& TSequenceOfXYZ::operator()(size_type n)
+-{
+-  return myArray[n-1];
+-}
+-
+-const gp_XYZ& TSequenceOfXYZ::operator()(size_type n) const
+-{
+-  return myArray[n-1];
+-}
+-
+-void TSequenceOfXYZ::clear()
+-{
+-  myArray.clear();
+-}
+-
+-void TSequenceOfXYZ::reserve(size_type n)
++std::vector<gp_XYZ>::reference TSequenceOfXYZ::operator()(size_type n)
+ {
+-  myArray.reserve(n);
++  return std::vector<gp_XYZ>::operator[](n-1);
+ }
+ 
+-void TSequenceOfXYZ::push_back(const gp_XYZ& v)
++std::vector<gp_XYZ>::const_reference TSequenceOfXYZ::operator()(size_type n) const
+ {
+-  myArray.push_back(v);
+-}
+-
+-TSequenceOfXYZ::size_type TSequenceOfXYZ::size() const
+-{
+-  return myArray.size();
+-}
++  return std::vector<gp_XYZ>::operator[](n-1);
++}
+\ No newline at end of file
+diff -Naur smesh-5.1.2.2.svn55/src/MEFISTO2/aptrte.cpp salomesmesh/src/MEFISTO2/aptrte.cpp
+--- smesh-5.1.2.2.svn55/src/MEFISTO2/aptrte.cpp	2009-12-17 02:32:26.000000000 -0600
++++ salomesmesh/src/MEFISTO2/aptrte.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -28,11 +28,6 @@
+ #include "aptrte.h"
+ #include "utilities.h"
+ 
+-#ifndef MEFISTO_VERBOSE
+-#undef MESSAGE
+-#define MESSAGE(msg)
+-#endif
+-
+ using namespace std;
+ 
+ extern "C"
+diff -Naur smesh-5.1.2.2.svn55/src/MEFISTO2/MEFISTO2F.def salomesmesh/src/MEFISTO2/MEFISTO2F.def
+--- smesh-5.1.2.2.svn55/src/MEFISTO2/MEFISTO2F.def	1969-12-31 18:00:00.000000000 -0600
++++ salomesmesh/src/MEFISTO2/MEFISTO2F.def	2014-07-13 10:33:02.000000000 -0500
+@@ -0,0 +1,15 @@
++EXPORTS
++	insoar
++	azeroi
++	fasoar
++	teajte
++	tehote
++	tetrte
++	aisoar
++	tedela
++	terefr
++	tesuex
++	teamqt
++	qutr2d
++	surtd2
++	nusotr
+\ No newline at end of file
+diff -Naur smesh-5.1.2.2.svn55/src/MEFISTO2/trte.for salomesmesh/src/MEFISTO2/trte.for
+--- smesh-5.1.2.2.svn55/src/MEFISTO2/trte.for	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/MEFISTO2/trte.for	2014-07-13 10:33:02.000000000 -0500
+@@ -1277,7 +1277,7 @@
+ c2345x7..............................................................012
+       common / unites / lecteu, imprim, nunite(30)
+ c
+-c      double precision  areteideale
++      double precision  areteideale
+       double precision  dx, dy, longai
+       double precision  xyz(3), xyzd(3), d0
+ c
+diff -Naur smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cpp salomesmesh/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cpp
+--- smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,10 +24,10 @@
+ // Author    : Michael Sazonov (OCN)
+ // Date      : 28/03/2006
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cxx,v 1.4.2.1 2008/11/27 14:29:44 abd Exp $
+ //=============================================================================
+ //
+-#include "NETGENPlugin_Hypothesis_2D.hxx"
++#include <NETGENPlugin_Hypothesis_2D.hxx>
+ #include <utilities.h>
+ 
+ using namespace std;
+diff -Naur smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_Mesher.cpp salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp
+--- smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_Mesher.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -41,7 +41,6 @@
+ #include <utilities.h>
+ 
+ #include <vector>
+-#include <limits>
+ 
+ #include <BRep_Tool.hxx>
+ #include <TopExp.hxx>
+@@ -52,9 +51,7 @@
+ #include <OSD_File.hxx>
+ #include <TCollection_AsciiString.hxx>
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+-#include <TopTools_DataMapOfShapeInteger.hxx>
+ #include <Standard_ErrorHandler.hxx>
+-#include <Standard_ProgramError.hxx>
+ 
+ // Netgen include files
+ namespace nglib {
+@@ -65,22 +62,16 @@
+ #include <meshing.hpp>
+ //#include <ngexception.hpp>
+ namespace netgen {
+-  extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
+-  extern MeshingParameters mparam;
++#ifdef NETGEN_V5
++  DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
++  DLL_HEADER extern MeshingParameters mparam;
++#else
++  DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
++#endif
+ }
+ 
+ using namespace std;
+ 
+-static void removeFile( const TCollection_AsciiString& fileName )
+-{
+-  try {
+-    OSD_File( fileName ).Remove();
+-  }
+-  catch ( Standard_ProgramError ) {
+-    MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied");
+-  }
+-}
+-
+ //=============================================================================
+ /*!
+  *
+@@ -107,11 +98,11 @@
+ 
+ void NETGENPlugin_Mesher::defaultParameters()
+ {
+-#ifdef WNT
+-  netgen::MeshingParameters& mparams = netgen::GlobalMeshingParameters();
+-#else
++//#ifdef WNT
++//  netgen::MeshingParameters& mparams = netgen::GlobalMeshingParameters();
++//#else
+   netgen::MeshingParameters& mparams = netgen::mparam;
+-#endif
++//#endif
+   // maximal mesh edge size
+   mparams.maxh = NETGENPlugin_Hypothesis::GetDefaultMaxSize();
+   // minimal number of segments per edge
+@@ -138,11 +129,11 @@
+ {
+   if (hyp)
+   {
+-#ifdef WNT
+-    netgen::MeshingParameters& mparams = netgen::GlobalMeshingParameters();
+-#else
++//#ifdef WNT
++//    netgen::MeshingParameters& mparams = netgen::GlobalMeshingParameters();
++//#else
+     netgen::MeshingParameters& mparams = netgen::mparam;
+-#endif
++//#endif
+     // Initialize global NETGEN parameters:
+     // maximal mesh segment size
+     mparams.maxh = hyp->GetMaxSize();
+@@ -216,7 +207,7 @@
+ #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+     OCC_CATCH_SIGNALS;
+ #endif
+-    BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, 0.01, true);
++    BRepMesh_IncrementalMesh e(shape, 0.01, true);
+   } catch (Standard_Failure) {
+   }
+   Bnd_Box bb;
+@@ -257,7 +248,7 @@
+     TopExp::MapShapes(root->GetSubShape(), subShapes);
+     while ( smIt->more() ) {
+       SMESH_subMesh* sm = smIt->next();
+-      if ( !meshedSM || sm->IsEmpty() ) {
++      if ( sm->IsEmpty() ) {
+         TopoDS_Shape shape = sm->GetSubShape();
+         if ( shape.ShapeType() != TopAbs_VERTEX )
+           shape = subShapes( subShapes.FindIndex( shape ));// - shape->index->oriented shape
+@@ -278,6 +269,11 @@
+   occgeo.facemeshstatus.SetSize (occgeo.fmap.Extent());
+   occgeo.facemeshstatus = 0;
+ 
++  occgeo.face_maxh.DeleteAll();
++  occgeo.face_maxh.SetSize (occgeo.fmap.Extent());
++  occgeo.face_maxh = netgen::mparam.maxh;
++
++
+ }
+ 
+ //================================================================================
+@@ -385,8 +381,8 @@
+ 
+           netgen::Segment seg;
+           // ng node ids
+-          seg.p1 = prevNgId;
+-          seg.p2 = prevNgId = ngNodeId( p2.node, ngMesh, nodeNgIdMap );
++          seg.pnums[0] = prevNgId;
++          seg.pnums[1] = prevNgId = ngNodeId( p2.node, ngMesh, nodeNgIdMap );
+           // node param on curve
+           seg.epgeominfo[ 0 ].dist = p1.param;
+           seg.epgeominfo[ 1 ].dist = p2.param;
+@@ -412,7 +408,7 @@
+               seg.epgeominfo[ 1 ].v = otherSeamParam;
+               swap (seg.epgeominfo[0].u, seg.epgeominfo[1].u);
+             }
+-            swap (seg.p1, seg.p2);
++            swap (seg.pnums[0], seg.pnums[1]);
+             swap (seg.epgeominfo[0].dist, seg.epgeominfo[1].dist);
+             seg.edgenr = ngMesh.GetNSeg() + 1; // segment id
+             ngMesh.AddSegment (seg);
+@@ -530,11 +526,11 @@
+ //=============================================================================
+ bool NETGENPlugin_Mesher::Compute()
+ {
+-#ifdef WNT
+-  netgen::MeshingParameters& mparams = netgen::GlobalMeshingParameters();
+-#else
++//#ifdef WNT
++//  netgen::MeshingParameters& mparams = netgen::GlobalMeshingParameters();
++//#else
+   netgen::MeshingParameters& mparams = netgen::mparam;
+-#endif  
++//#endif  
+   MESSAGE("Compute with:\n"
+           " max size = " << mparams.maxh << "\n"
+           " segments per edge = " << mparams.segmentsperedge);
+@@ -588,10 +584,16 @@
+       }
+     }
+     // let netgen create ngMesh and calculate element size on not meshed shapes
++#ifndef NETGEN_V5
+     char *optstr = 0;
++#endif
+     int startWith = netgen::MESHCONST_ANALYSE;
+     int endWith   = netgen::MESHCONST_ANALYSE;
++#ifdef NETGEN_V5
++    err = netgen::OCCGenerateMesh(occgeo, ngMesh,mparams, startWith, endWith);
++#else
+     err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
++#endif
+     if (err) comment << "Error in netgen::OCCGenerateMesh() at MESHCONST_ANALYSE step";
+ 
+     // fill ngMesh with nodes and elements of computed submeshes
+@@ -604,7 +606,11 @@
+     if (!err)
+     {
+       startWith = endWith = netgen::MESHCONST_MESHEDGES;
++#ifdef NETGEN_V5
++      err = netgen::OCCGenerateMesh(occgeo, ngMesh,mparams, startWith, endWith);
++#else
+       err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
++#endif
+       if (err) comment << "Error in netgen::OCCGenerateMesh() at 1D mesh generation";
+     }
+     // ---------------------
+@@ -622,31 +628,28 @@
+         else {
+           // length from edges
+           double length = 0;
+-          TopTools_MapOfShape tmpMap;
+           for ( TopExp_Explorer exp( _shape, TopAbs_EDGE ); exp.More(); exp.Next() )
+-            if( tmpMap.Add(exp.Current()) )
+-              length += SMESH_Algo::EdgeLength( TopoDS::Edge( exp.Current() ));
+-
+-          if ( ngMesh->GetNSeg() ) {
+-            // we have to multiply length by 2 since for each TopoDS_Edge there
+-            // are double set of NETGEN edges or, in other words, we have to
+-            // divide ngMesh->GetNSeg() on 2.
+-            mparams.maxh = 2*length / ngMesh->GetNSeg();
+-          }
++            length += SMESH_Algo::EdgeLength( TopoDS::Edge( exp.Current() ));
++          if ( ngMesh->GetNSeg() )
++            mparams.maxh = length / ngMesh->GetNSeg();
+           else
+             mparams.maxh = 1000;
+           mparams.grading = 0.2; // slow size growth
+         }
+         mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
+         ngMesh->SetGlobalH (mparams.maxh);
+-        netgen::Box<3> bb = occgeo.GetBoundingBox();
+-        bb.Increase (bb.Diam()/20);
++	netgen::Box<3> bb = occgeo.GetBoundingBox();
++	bb.Increase (bb.Diam()/20);
+         ngMesh->SetLocalH (bb.PMin(), bb.PMax(), mparams.grading);
+       }
+       // let netgen compute 2D mesh
+       startWith = netgen::MESHCONST_MESHSURFACE;
+       endWith = _optimize ? netgen::MESHCONST_OPTSURFACE : netgen::MESHCONST_MESHSURFACE;
++#ifdef NETGEN_V5
++      err = netgen::OCCGenerateMesh(occgeo, ngMesh,mparams, startWith, endWith);
++#else
+       err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
++#endif
+       if (err) comment << "Error in netgen::OCCGenerateMesh() at surface mesh generation";
+     }
+     // ---------------------
+@@ -675,18 +678,26 @@
+           // length from faces
+           mparams.maxh = ngMesh->AverageH();
+         }
+-//      netgen::ARRAY<double> maxhdom;
+-//      maxhdom.SetSize (occgeo.NrSolids());
+-//      maxhdom = mparams.maxh;
+-//      ngMesh->SetMaxHDomain (maxhdom);
++// 	netgen::ARRAY<double> maxhdom;
++// 	maxhdom.SetSize (occgeo.NrSolids());
++// 	maxhdom = mparams.maxh;
++// 	ngMesh->SetMaxHDomain (maxhdom);
+         ngMesh->SetGlobalH (mparams.maxh);
+         mparams.grading = 0.4;
++#ifdef NETGEN_V5
++        ngMesh->CalcLocalH(mparams.grading);
++#else
+         ngMesh->CalcLocalH();
++#endif
+       }
+       // let netgen compute 3D mesh
+       startWith = netgen::MESHCONST_MESHVOLUME;
+       endWith = _optimize ? netgen::MESHCONST_OPTVOLUME : netgen::MESHCONST_MESHVOLUME;
++#ifdef NETGEN_V5
++      err = netgen::OCCGenerateMesh(occgeo, ngMesh,mparams, startWith, endWith);
++#else
+       err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
++#endif
+       if (err) comment << "Error in netgen::OCCGenerateMesh()";
+     }
+     if (!err && mparams.secondorder > 0)
+@@ -749,7 +760,7 @@
+           newNodeOnVertex = true;
+       }
+       if (!node)
+-        node = meshDS->AddNode(ngPoint.X(), ngPoint.Y(), ngPoint.Z());
++        node = meshDS->AddNode(ngPoint(0), ngPoint(1), ngPoint(2));
+       if (!node)
+       {
+         MESSAGE("Cannot create a mesh node");
+@@ -771,12 +782,12 @@
+     for (i = nbInitSeg+1; i <= nbSeg/* && isOK*/; ++i )
+     {
+       const netgen::Segment& seg = ngMesh->LineSegment(i);
+-      Link link(seg.p1, seg.p2);
++      Link link(seg.pnums[0], seg.pnums[1]);
+       if (linkMap.Contains(link))
+         continue;
+       linkMap.Add(link);
+       TopoDS_Edge aEdge;
+-      int pinds[3] = { seg.p1, seg.p2, seg.pmid };
++      int pinds[3] = { seg.pnums[0], seg.pnums[1], seg.pnums[2] };
+       int nbp = 0;
+       double param2 = 0;
+       for (int j=0; j < 3; ++j)
+@@ -952,7 +963,7 @@
+   nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)ngMesh);
+   nglib::Ng_Exit();
+ 
+-  RemoveTmpFiles();
++  //RemoveTmpFiles();
+ 
+   return error->IsOK();
+ }
+@@ -965,182 +976,12 @@
+ 
+ void NETGENPlugin_Mesher::RemoveTmpFiles()
+ {
+-  removeFile("test.out");
+-  removeFile("problemfaces");
+-}
+-
+-
+-//=============================================================================
+-/*!
+- * Evaluate
+- */
+-//=============================================================================
+-bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
+-{
+-#ifdef WNT
+-  netgen::MeshingParameters& mparams = netgen::GlobalMeshingParameters();
+-#else
+-  netgen::MeshingParameters& mparams = netgen::mparam;
+-#endif  
+-
+-
+-  // -------------------------
+-  // Prepare OCC geometry
+-  // -------------------------
+-  netgen::OCCGeometry occgeo;
+-  list< SMESH_subMesh* > meshedSM;
+-  PrepareOCCgeometry( occgeo, _shape, *_mesh, &meshedSM );
+-
+-  bool tooManyElems = false;
+-  const int hugeNb = std::numeric_limits<int>::max() / 100;
+-
+-  // ----------------
+-  // evaluate 1D 
+-  // ----------------
+-  // pass 1D simple parameters to NETGEN
+-  int nbs = 0;
+-  if ( _simpleHyp ) {
+-    if ( int nbSeg = _simpleHyp->GetNumberOfSegments() ) {
+-      nbs = nbSeg;
+-      // nb of segments
+-      mparams.segmentsperedge = nbSeg + 0.1;
+-      mparams.maxh = occgeo.boundingbox.Diam();
+-      mparams.grading = 0.01;
+-    }
+-    else {
+-      // segment length
+-      mparams.segmentsperedge = 1;
+-      mparams.maxh = _simpleHyp->GetLocalLength();
+-    }
+-  }
+-  TopTools_DataMapOfShapeInteger EdgesMap;
+-  double fullLen = 0.0;
+-  double fullNbSeg = 0;
+-  for (TopExp_Explorer exp(_shape, TopAbs_EDGE); exp.More(); exp.Next()) {
+-    TopoDS_Edge E = TopoDS::Edge( exp.Current() );
+-    if( EdgesMap.IsBound(E) )
+-      continue;
+-    SMESH_subMesh *sm = _mesh->GetSubMesh(E);
+-    std::vector<int> aVec(SMDSEntity_Last, 0);
+-    double aLen = SMESH_Algo::EdgeLength(E);
+-    fullLen += aLen;
+-    int nb1d = nbs;
+-    tooManyElems = ( aLen/hugeNb > mparams.maxh );
+-    if(nb1d==0 && !tooManyElems) {
+-      nb1d = (int)( aLen/mparams.maxh + 1 );
+-    }
+-    if ( tooManyElems ) // avoid FPE
+-    {
+-      aVec[SMDSEntity_Node] = hugeNb;
+-      aVec[ mparams.secondorder > 0 ? SMDSEntity_Quad_Edge : SMDSEntity_Edge] = hugeNb;
+-    }
+-    else
+-    {
+-      fullNbSeg += nb1d;
+-      if( mparams.secondorder > 0 ) {
+-        aVec[SMDSEntity_Node] = 2*nb1d - 1;
+-        aVec[SMDSEntity_Quad_Edge] = nb1d;
+-      }
+-      else {
+-        aVec[SMDSEntity_Node] = nb1d - 1;
+-        aVec[SMDSEntity_Edge] = nb1d;
+-      }
+-    }
+-    aResMap.insert(std::make_pair(sm,aVec));
+-    EdgesMap.Bind(E,nb1d);
+-  }
+-
+-  // ----------------
+-  // evaluate 2D 
+-  // ----------------
+-  if ( _simpleHyp ) {
+-    if ( double area = _simpleHyp->GetMaxElementArea() ) {
+-      // face area
+-      mparams.maxh = sqrt(2. * area/sqrt(3.0));
+-      mparams.grading = 0.4; // moderate size growth
+-    }
+-    else {
+-      // length from edges
+-      mparams.maxh = fullLen/fullNbSeg;
+-      mparams.grading = 0.2; // slow size growth
+-    }
+-    mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
+-  }
+-
+-  for (TopExp_Explorer exp(_shape, TopAbs_FACE); exp.More(); exp.Next())
+-  {
+-    TopoDS_Face F = TopoDS::Face( exp.Current() );
+-    SMESH_subMesh *sm = _mesh->GetSubMesh(F);
+-    GProp_GProps G;
+-    BRepGProp::SurfaceProperties(F,G);
+-    double anArea = G.Mass();
+-    tooManyElems = tooManyElems || ( anArea/hugeNb > mparams.maxh*mparams.maxh );
+-    int nb1d = 0;
+-    if ( !tooManyElems )
+-      for (TopExp_Explorer exp1(F,TopAbs_EDGE); exp1.More(); exp1.Next())
+-        nb1d += EdgesMap.Find(exp1.Current());
+-
+-    int nbFaces = tooManyElems ? hugeNb : int( 4*anArea / mparams.maxh*mparams.maxh*sqrt(3.));
+-    int nbNodes = tooManyElems ? hugeNb : (( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
+-
+-    std::vector<int> aVec(SMDSEntity_Last, 0);
+-    if( mparams.secondorder > 0 ) {
+-      int nb1d_in = (nbFaces*3 - nb1d) / 2;
+-      aVec[SMDSEntity_Node] = nbNodes + nb1d_in;
+-      aVec[SMDSEntity_Quad_Triangle] = nbFaces;
+-    }
+-    else {
+-      aVec[SMDSEntity_Node] = nbNodes;
+-      aVec[SMDSEntity_Triangle] = nbFaces;
+-    }
+-    aResMap.insert(std::make_pair(sm,aVec));
+-  }
+-
+-  // ----------------
+-  // evaluate 3D
+-  // ----------------
+-  if(_isVolume) {
+-    // pass 3D simple parameters to NETGEN
+-    const NETGENPlugin_SimpleHypothesis_3D* simple3d =
+-      dynamic_cast< const NETGENPlugin_SimpleHypothesis_3D* > ( _simpleHyp );
+-    if ( simple3d ) {
+-      if ( double vol = simple3d->GetMaxElementVolume() ) {
+-        // max volume
+-        mparams.maxh = pow( 72, 1/6. ) * pow( vol, 1/3. );
+-        mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
+-      }
+-      else {
+-        // using previous length from faces
+-      }
+-      mparams.grading = 0.4;
+-    }
+-    GProp_GProps G;
+-    BRepGProp::VolumeProperties(_shape,G);
+-    double aVolume = G.Mass();
+-    double tetrVol = 0.1179*mparams.maxh*mparams.maxh*mparams.maxh;
+-    tooManyElems = tooManyElems || ( aVolume/hugeNb > tetrVol );
+-    int nbVols = tooManyElems ? hugeNb : int(aVolume/tetrVol);
+-    int nb1d_in = int(( nbVols*6 - fullNbSeg ) / 6 );
+-    std::vector<int> aVec(SMDSEntity_Last, 0 );
+-    if ( tooManyElems ) // avoid FPE
+-    {
+-      aVec[SMDSEntity_Node] = hugeNb;
+-      aVec[ mparams.secondorder > 0 ? SMDSEntity_Quad_Tetra : SMDSEntity_Tetra] = hugeNb;
+-    }
+-    else
+-    {
+-      if( mparams.secondorder > 0 ) {
+-        aVec[SMDSEntity_Node] = nb1d_in/3 + 1 + nb1d_in;
+-        aVec[SMDSEntity_Quad_Tetra] = nbVols;
+-      }
+-      else {
+-        aVec[SMDSEntity_Node] = nb1d_in/3 + 1;
+-        aVec[SMDSEntity_Tetra] = nbVols;
+-      }
+-    }
+-    SMESH_subMesh *sm = _mesh->GetSubMesh(_shape);
+-    aResMap.insert(std::make_pair(sm,aVec));
+-  }
+-
+-  return true;
++  TCollection_AsciiString str("test.out");
++  OSD_Path path1( str );
++  OSD_File file1( path1 );
++  file1.Remove();
++  str = "problemfaces";
++  OSD_Path path2( str );
++  OSD_File file2( path2 );
++  file2.Remove();
+ }
+diff -Naur smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cpp salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cpp
+--- smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ // Author : Michael Sazonov (OCN)
+ // Date   : 20/03/2006
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cxx,v 1.4.2.2 2008/11/27 14:29:44 abd Exp $
+ //=============================================================================
+ //
+ #include "NETGENPlugin_NETGEN_2D3D.hxx"
+@@ -132,20 +132,3 @@
+   mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_2D*>(_hypothesis));
+   return mesher.Compute();
+ }
+-
+-
+-//=============================================================================
+-/*!
+- *
+- */
+-//=============================================================================
+-
+-bool NETGENPlugin_NETGEN_2D3D::Evaluate(SMESH_Mesh&         aMesh,
+-					const TopoDS_Shape& aShape,
+-					MapShapeNbElems& aResMap)
+-{
+-  NETGENPlugin_Mesher mesher(&aMesh, aShape, true);
+-  mesher.SetParameters(dynamic_cast<const NETGENPlugin_Hypothesis*>(_hypothesis));
+-  mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_2D*>(_hypothesis));
+-  return mesher.Evaluate(aResMap);
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cpp salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cpp
+--- smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ // Author : Michael Sazonov (OCN)
+ // Date   : 20/03/2006
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx,v 1.4.2.2 2008/11/27 14:29:44 abd Exp $
+ //=============================================================================
+ //
+ #include "NETGENPlugin_NETGEN_2D.hxx"
+@@ -129,21 +129,3 @@
+   mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_2D*>(_hypothesis));
+   return mesher.Compute();
+ }
+-
+-
+-//=============================================================================
+-/*!
+- *
+- */
+-//=============================================================================
+-
+-bool NETGENPlugin_NETGEN_2D::Evaluate(SMESH_Mesh&         aMesh,
+-                                      const TopoDS_Shape& aShape,
+-                                      MapShapeNbElems& aResMap)
+-{
+-
+-  NETGENPlugin_Mesher mesher(&aMesh, aShape, false);
+-  mesher.SetParameters(dynamic_cast<const NETGENPlugin_Hypothesis*>(_hypothesis));
+-  mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_2D*>(_hypothesis));
+-  return mesher.Evaluate(aResMap);
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp
+--- smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -39,7 +39,6 @@
+ #include "StdMeshers_LengthFromEdges.hxx"
+ #include "StdMeshers_QuadranglePreference.hxx"
+ 
+-#include <Precision.hxx>
+ #include <Standard_ErrorHandler.hxx>
+ #include <Standard_Failure.hxx>
+ 
+@@ -47,7 +46,6 @@
+ 
+ #include <list>
+ #include <vector>
+-#include <limits>
+ 
+ /*
+   Netgen include files
+@@ -60,8 +58,12 @@
+ #include <meshing.hpp>
+ //#include <meshtype.hpp>
+ namespace netgen {
+-  extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
+-  /*extern*/ MeshingParameters mparam;
++#ifdef NETGEN_V5
++  DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
++#else
++  DLL_HEADER extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
++#endif
++  DLL_HEADER extern MeshingParameters mparam;
+ }
+ 
+ using namespace std;
+@@ -80,7 +82,7 @@
+ {
+   MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY");
+   _name = "NETGEN_2D_ONLY";
+-  
++
+   _shapeType = (1 << TopAbs_FACE);// 1 bit /shape type
+ 
+   _compatibleHypothesis.push_back("MaxElementArea");
+@@ -228,8 +230,8 @@
+       // Add the segment
+       Segment seg;
+ 
+-      seg.p1 = ngMesh.GetNP();          // ng node id
+-      seg.p2 = seg.p1 + 1;              // ng node id
++      seg.pnums[0] = ngMesh.GetNP();          // ng node id
++      seg.pnums[1] = seg.pnums[0] + 1;              // ng node id
+       seg.edgenr = ngMesh.GetNSeg() + 1;// segment id
+       seg.si = faceID;                  // = geom.fmap.FindIndex (face);
+ 
+@@ -271,7 +273,7 @@
+ //            << "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl;
+     }
+     Segment& seg = ngMesh.LineSegment( ngMesh.GetNSeg() );
+-    seg.p2 = firstPointID;
++    seg.pnums[1] = firstPointID;
+   }
+ 
+   ngMesh.CalcSurfacesOfNode();  
+@@ -366,7 +368,7 @@
+   // Generate surface mesh
+   // -------------------------
+ 
+-  char *optstr = 0;
++  char *optstr;
+   int startWith = MESHCONST_MESHSURFACE;
+   int endWith   = MESHCONST_OPTSURFACE;
+   int err = 1;
+@@ -375,7 +377,11 @@
+ #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+     OCC_CATCH_SIGNALS;
+ #endif
++#ifdef NETGEN_V5
++    err = netgen::OCCGenerateMesh(occgeo, ngMesh,netgen::mparam, startWith, endWith);
++#else
+     err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
++#endif
+   }
+   catch (Standard_Failure& ex) {
+     string comment = ex.DynamicType()->Name();
+@@ -406,7 +412,7 @@
+   for ( int i = nbInputNodes + 1; i <= nbNodes; ++i )
+   {
+     const MeshPoint& ngPoint = ngMesh->Point(i);
+-    SMDS_MeshNode * node = meshDS->AddNode(ngPoint.X(), ngPoint.Y(), ngPoint.Z());
++    SMDS_MeshNode * node = meshDS->AddNode(ngPoint(0), ngPoint(1), ngPoint(2));
+     nodeVec[ i-1 ] = node;
+   }
+ 
+@@ -444,89 +450,3 @@
+ 
+   return !err;
+ }
+-
+-
+-//=============================================================================
+-/*!
+- *
+- */
+-//=============================================================================
+-
+-bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
+-                                           const TopoDS_Shape& aShape,
+-                                           MapShapeNbElems& aResMap)
+-{
+-  TopoDS_Face F = TopoDS::Face(aShape);
+-  if(F.IsNull())
+-    return false;
+-
+-  // collect info from edges
+-  int nb0d = 0, nb1d = 0;
+-  bool IsQuadratic = false;
+-  bool IsFirst = true;
+-  double fullLen = 0.0;
+-  TopTools_MapOfShape tmpMap;
+-  for (TopExp_Explorer exp(F, TopAbs_EDGE); exp.More(); exp.Next()) {
+-    TopoDS_Edge E = TopoDS::Edge(exp.Current());
+-    if( tmpMap.Contains(E) )
+-      continue;
+-    tmpMap.Add(E);
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+-    MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
+-    if( anIt==aResMap.end() ) {
+-      SMESH_subMesh *sm = aMesh.GetSubMesh(F);
+-      SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-      return false;
+-    }
+-    std::vector<int> aVec = (*anIt).second;
+-    nb0d += aVec[SMDSEntity_Node];
+-    nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-    double aLen = SMESH_Algo::EdgeLength(E);
+-    fullLen += aLen;
+-    if(IsFirst) {
+-      IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
+-      IsFirst = false;
+-    }
+-  }
+-  tmpMap.Clear();
+-
+-  // compute edge length
+-  double ELen = 0;
+-  if (_hypLengthFromEdges || !_hypLengthFromEdges && !_hypMaxElementArea) {
+-    if ( nb1d > 0 )
+-      ELen = fullLen / nb1d;
+-  }
+-  if ( _hypMaxElementArea ) {
+-    double maxArea = _hypMaxElementArea->GetMaxArea();
+-    ELen = sqrt(2. * maxArea/sqrt(3.0));
+-  }
+-  GProp_GProps G;
+-  BRepGProp::SurfaceProperties(F,G);
+-  double anArea = G.Mass();
+-
+-  const int hugeNb = numeric_limits<int>::max()/10;
+-  if ( anArea / hugeNb > ELen*ELen )
+-  {
+-    SMESH_subMesh *sm = aMesh.GetSubMesh(F);
+-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this));
+-    return false;
+-  }
+-  int nbFaces = (int) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
+-  int nbNodes = (int) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
+-  if( IsQuadratic ) {
+-    aVec[SMDSEntity_Node] = nbNodes;
+-    aVec[SMDSEntity_Quad_Triangle] = nbFaces;
+-  }
+-  else {
+-    aVec[SMDSEntity_Node] = nbNodes;
+-    aVec[SMDSEntity_Triangle] = nbFaces;
+-  }
+-  SMESH_subMesh *sm = aMesh.GetSubMesh(F);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp
+--- smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -43,8 +43,6 @@
+ #include "StdMeshers_QuadToTriaAdaptor.hxx"
+ 
+ #include <BRep_Tool.hxx>
+-#include <GProp_GProps.hxx>
+-#include <BRepGProp.hxx>
+ #include <TopExp.hxx>
+ #include <TopExp_Explorer.hxx>
+ #include <TopoDS.hxx>
+@@ -353,7 +351,9 @@
+ 
+   Ng_Meshing_Parameters Netgen_param;
+ 
+-  Netgen_param.secondorder = Netgen_param2ndOrder;
++#ifdef NETGEN_V5
++  Netgen_param.second_order = Netgen_param2ndOrder;
++#endif
+   Netgen_param.fineness = Netgen_paramFine;
+   Netgen_param.maxh = Netgen_paramSize;
+ 
+@@ -564,7 +564,9 @@
+ 
+   Ng_Meshing_Parameters Netgen_param;
+ 
+-  Netgen_param.secondorder = Netgen_param2ndOrder;
++#ifdef NETGEN_V5
++  Netgen_param.second_order = Netgen_param2ndOrder;
++#endif
+   Netgen_param.fineness = Netgen_paramFine;
+   Netgen_param.maxh = Netgen_paramSize;
+ 
+@@ -639,92 +641,3 @@
+   
+   return (status == NG_OK);
+ }
+-
+-
+-//=============================================================================
+-/*!
+- *
+- */
+-//=============================================================================
+-
+-bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
+-				      const TopoDS_Shape& aShape,
+-				      MapShapeNbElems& aResMap)
+-{
+-  int nbtri = 0, nbqua = 0;
+-  double fullArea = 0.0;
+-  for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
+-    TopoDS_Face F = TopoDS::Face( exp.Current() );
+-    SMESH_subMesh *sm = aMesh.GetSubMesh(F);
+-    MapShapeNbElemsItr anIt = aResMap.find(sm);
+-    if( anIt==aResMap.end() ) {
+-      SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-      return false;
+-    }
+-    std::vector<int> aVec = (*anIt).second;
+-    nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+-    nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-    GProp_GProps G;
+-    BRepGProp::SurfaceProperties(F,G);
+-    double anArea = G.Mass();
+-    fullArea += anArea;
+-  }
+-
+-  // collect info from edges
+-  int nb0d_e = 0, nb1d_e = 0;
+-  bool IsQuadratic = false;
+-  bool IsFirst = true;
+-  TopTools_MapOfShape tmpMap;
+-  for (TopExp_Explorer exp(aShape, TopAbs_EDGE); exp.More(); exp.Next()) {
+-    TopoDS_Edge E = TopoDS::Edge(exp.Current());
+-    if( tmpMap.Contains(E) )
+-      continue;
+-    tmpMap.Add(E);
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+-    MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
+-    if( anIt==aResMap.end() ) {
+-      SMESH_ComputeErrorPtr& smError = aSubMesh->GetComputeError();
+-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
+-					    "Submesh can not be evaluated",this));
+-      return false;
+-    }
+-    std::vector<int> aVec = (*anIt).second;
+-    nb0d_e += aVec[SMDSEntity_Node];
+-    nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-    if(IsFirst) {
+-      IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
+-      IsFirst = false;
+-    }
+-  }
+-  tmpMap.Clear();
+-
+-  double ELen_face = sqrt(2.* ( fullArea/(nbtri+nbqua*2) ) / sqrt(3.0) );
+-  double ELen_vol = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. );
+-  double ELen = Min(ELen_vol,ELen_face*2);
+-
+-  GProp_GProps G;
+-  BRepGProp::VolumeProperties(aShape,G);
+-  double aVolume = G.Mass();
+-  double tetrVol = 0.1179*ELen*ELen*ELen;
+-  double CoeffQuality = 0.9;
+-  int nbVols = (int)aVolume/tetrVol/CoeffQuality;
+-  int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
+-  int nb1d_in = (int) ( nbVols*6 - nb1d_e - nb1d_f ) / 5;
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
+-  if( IsQuadratic ) {
+-    aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;
+-    aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2;
+-    aVec[SMDSEntity_Quad_Pyramid] = nbqua;
+-  }
+-  else {
+-    aVec[SMDSEntity_Node] = nb1d_in/6 + 1;
+-    aVec[SMDSEntity_Tetra] = nbVols - nbqua*2;
+-    aVec[SMDSEntity_Pyramid] = nbqua;
+-  }
+-  SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-  
+-  return true;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cpp salomesmesh/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cpp
+--- smesh-5.1.2.2.svn55/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -60,10 +60,10 @@
+  *  
+  */
+ //=============================================================================
+-void NETGENPlugin_SimpleHypothesis_2D::SetNumberOfSegments(int nb) throw (SALOME_Exception)
++void NETGENPlugin_SimpleHypothesis_2D::SetNumberOfSegments(int nb) throw (SMESH_Exception)
+ {
+   if ( nb < 1 )
+-    throw SALOME_Exception("Number of segments must be positive");
++    throw SMESH_Exception("Number of segments must be positive");
+   if (nb != _nbSegments)
+   {
+     _nbSegments = nb;
+@@ -78,10 +78,10 @@
+  */
+ //=============================================================================
+ void NETGENPlugin_SimpleHypothesis_2D::SetLocalLength(double segmentLength)
+-  throw (SALOME_Exception)
++  throw (SMESH_Exception)
+ {
+   if ( segmentLength < DBL_MIN )
+-    throw SALOME_Exception("segment length must be more than zero");
++    throw SMESH_Exception("segment length must be more than zero");
+   if (segmentLength != _segmentLength)
+   {
+     _segmentLength = segmentLength;
+@@ -221,4 +221,3 @@
+   _segmentLength = dflts._elemLength;
+   return _nbSegments && _segmentLength > 0;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_EdgePosition.cpp salomesmesh/src/SMDS/SMDS_EdgePosition.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_EdgePosition.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_EdgePosition.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -36,7 +36,7 @@
+ //=======================================================================
+ 
+ SMDS_EdgePosition::SMDS_EdgePosition(const int aEdgeId,
+-        const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
++	const double aUParam):SMDS_Position(aEdgeId), myUParameter(aUParam)
+ {
+ }
+ 
+@@ -47,21 +47,21 @@
+ 
+ const double *SMDS_EdgePosition::Coords() const
+ {
+-        static double origin[]={0,0,0};
+-        MESSAGE("SMDS_EdgePosition::Coords not implemented");
+-        return origin;
++	static double origin[]={0,0,0};
++	MESSAGE("SMDS_EdgePosition::Coords not implemented");
++	return origin;
+ }
+ 
+ /**
+ */
+ SMDS_TypeOfPosition SMDS_EdgePosition::GetTypeOfPosition() const
+ {
+-        return SMDS_TOP_EDGE;
++	return SMDS_TOP_EDGE;
+ }
+ 
+ void SMDS_EdgePosition::SetUParameter(double aUparam)
+ {
+-        myUParameter = aUparam;
++	myUParameter = aUparam;
+ }
+ 
+ //=======================================================================
+@@ -71,5 +71,5 @@
+ 
+ double SMDS_EdgePosition::GetUParameter() const 
+ {
+-        return myUParameter;
++	return myUParameter;
+ }
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_FaceOfEdges.cpp salomesmesh/src/SMDS/SMDS_FaceOfEdges.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_FaceOfEdges.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_FaceOfEdges.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -181,7 +181,3 @@
+   return 0;
+ }
+ 
+-SMDSAbs_EntityType SMDS_FaceOfEdges::GetEntityType() const
+-{
+-  return myNbEdges == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_FaceOfNodes.cpp salomesmesh/src/SMDS/SMDS_FaceOfNodes.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_FaceOfNodes.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_FaceOfNodes.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -174,8 +174,3 @@
+ {
+   return myNodes[ ind ];
+ }
+-
+-SMDSAbs_EntityType SMDS_FaceOfNodes::GetEntityType() const
+-{
+-  return myNbNodes == 3 ? SMDSEntity_Triangle : SMDSEntity_Quadrangle;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_Mesh0DElement.cpp salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_Mesh0DElement.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp	1969-12-31 18:00:00.000000000 -0600
+@@ -1,155 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMDS : implementaion of Salome mesh data structure
+-//  File   : SMDS_Mesh0DElement.cxx
+-//  Author : Jean-Michel BOULCOURT
+-//  Module : SMESH
+-
+-#ifdef _MSC_VER
+-#pragma warning(disable:4786)
+-#endif
+-
+-#include "SMDS_Mesh0DElement.hxx"
+-#include "SMDS_IteratorOfElements.hxx"
+-#include "SMDS_MeshNode.hxx"
+-
+-using namespace std;
+-
+-//=======================================================================
+-//function : SMDS_Mesh0DElement
+-//purpose  :
+-//=======================================================================
+-SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node)
+-{	
+-  myNode = node;
+-}
+-
+-//=======================================================================
+-//function : Print
+-//purpose  :
+-//=======================================================================
+-void SMDS_Mesh0DElement::Print (ostream & OS) const
+-{
+-  OS << "0D Element <" << GetID() << "> : (" << myNode << ") " << endl;
+-}
+-
+-//=======================================================================
+-//function : NbNodes
+-//purpose  :
+-//=======================================================================
+-int SMDS_Mesh0DElement::NbNodes() const
+-{
+-  return 1;
+-}
+-
+-//=======================================================================
+-//function : NbEdges
+-//purpose  :
+-//=======================================================================
+-int SMDS_Mesh0DElement::NbEdges() const
+-{
+-  return 0;
+-}
+-
+-//=======================================================================
+-//function : GetType
+-//purpose  :
+-//=======================================================================
+-SMDSAbs_ElementType SMDS_Mesh0DElement::GetType() const
+-{
+-  return SMDSAbs_0DElement;
+-}
+-
+-//=======================================================================
+-//function : elementsIterator
+-//purpose  :
+-//=======================================================================
+-class SMDS_Mesh0DElement_MyNodeIterator: public SMDS_ElemIterator
+-{
+-  const SMDS_MeshNode * myNode;
+-  int myIndex;
+- public:
+-  SMDS_Mesh0DElement_MyNodeIterator(const SMDS_MeshNode * node):
+-    myNode(node),myIndex(0) {}
+-
+-  bool more()
+-  {
+-    return myIndex < 1;
+-  }
+-
+-  const SMDS_MeshElement* next()
+-  {
+-    myIndex++;
+-    if (myIndex == 1)
+-      return myNode;
+-    return NULL;
+-  }
+-};
+-
+-SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType type) const
+-{
+-  switch(type)
+-  {
+-  case SMDSAbs_0DElement:
+-    return SMDS_MeshElement::elementsIterator(SMDSAbs_0DElement);
+-  case SMDSAbs_Node:
+-    return SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode));
+-  default:
+-    return SMDS_ElemIteratorPtr
+-      (new SMDS_IteratorOfElements
+-       (this,type, SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode))));
+-  }
+-}
+-
+-//=======================================================================
+-//function : operator<
+-//purpose  :
+-//=======================================================================
+-bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
+-{
+-  int id1 = e1.myNode->GetID();
+-  int id2 = e2.myNode->GetID();
+-
+-  return (id1 < id2);
+-}
+-
+-/*!
+- * \brief Return node by its index
+- * \param ind - node index
+- * \retval const SMDS_MeshNode* - the node
+- */
+-const SMDS_MeshNode* SMDS_Mesh0DElement::GetNode(const int ind) const
+-{
+-  if (ind == 0)
+-    return myNode;
+-  return NULL;
+-}
+-
+-//=======================================================================
+-//function : ChangeNode
+-//purpose  :
+-//=======================================================================
+-bool SMDS_Mesh0DElement::ChangeNode (const SMDS_MeshNode * node)
+-{
+-  myNode = node;
+-  return true;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_Mesh.cpp salomesmesh/src/SMDS/SMDS_Mesh.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_Mesh.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_Mesh.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -20,7 +20,7 @@
+ //  See http://www.salome-platform.org/ or email : webmaster.salome at opencascade.com
+ //
+ //  SMESH SMDS : implementaion of Salome mesh data structure
+-
++//
+ #ifdef _MSC_VER
+ #pragma warning(disable:4786)
+ #endif
+@@ -62,8 +62,8 @@
+ int SMDS_Mesh::CheckMemory(const bool doNotRaise) throw (std::bad_alloc)
+ {
+ #if (defined(__MACH__) && defined(__APPLE__))
+-  return 1000;
+-#else
++	return 1000;
++#else	
+ #ifndef WIN32
+   struct sysinfo si;
+   int err = sysinfo( &si );
+@@ -110,11 +110,11 @@
+ /// Create a new mesh object
+ ///////////////////////////////////////////////////////////////////////////////
+ SMDS_Mesh::SMDS_Mesh()
+-        :myParent(NULL),
++	:myParent(NULL),
+         myNodeIDFactory(new SMDS_MeshElementIDFactory()),
+-        myElementIDFactory(new SMDS_MeshElementIDFactory()),
+-        myHasConstructionEdges(false), myHasConstructionFaces(false),
+-        myHasInverseElements(true)
++	myElementIDFactory(new SMDS_MeshElementIDFactory()),
++	myHasConstructionEdges(false), myHasConstructionFaces(false),
++	myHasInverseElements(true)
+ {
+ }
+ 
+@@ -124,10 +124,10 @@
+ /// (2003-09-08) of SMESH
+ ///////////////////////////////////////////////////////////////////////////////
+ SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent)
+-        :myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
+-        myElementIDFactory(parent->myElementIDFactory),
+-        myHasConstructionEdges(false), myHasConstructionFaces(false),
+-        myHasInverseElements(true)
++	:myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
++	myElementIDFactory(parent->myElementIDFactory),
++	myHasConstructionEdges(false), myHasConstructionFaces(false),
++	myHasInverseElements(true)
+ {
+ }
+ 
+@@ -137,9 +137,9 @@
+ 
+ SMDS_Mesh *SMDS_Mesh::AddSubMesh()
+ {
+-        SMDS_Mesh *submesh = new SMDS_Mesh(this);
+-        myChildren.insert(myChildren.end(), submesh);
+-        return submesh;
++	SMDS_Mesh *submesh = new SMDS_Mesh(this);
++	myChildren.insert(myChildren.end(), submesh);
++	return submesh;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -174,57 +174,11 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-/// create a Mesh0DElement and add it to the current Mesh
+-/// @return : The created Mesh0DElement
+-///////////////////////////////////////////////////////////////////////////////
+-SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(int idnode, int ID)
+-{
+-  SMDS_MeshNode * node = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode);
+-  if (!node) return NULL;
+-  return SMDS_Mesh::Add0DElementWithID(node, ID);
+-}
+-
+-///////////////////////////////////////////////////////////////////////////////
+-/// create a Mesh0DElement and add it to the current Mesh
+-/// @return : The created Mesh0DElement
+-///////////////////////////////////////////////////////////////////////////////
+-SMDS_Mesh0DElement* SMDS_Mesh::Add0DElement(const SMDS_MeshNode * node)
+-{
+-  return SMDS_Mesh::Add0DElementWithID(node, myElementIDFactory->GetFreeID());
+-}
+-
+-///////////////////////////////////////////////////////////////////////////////
+-/// Create a new Mesh0DElement and at it to the mesh
+-/// @param idnode ID of the node
+-/// @param ID ID of the 0D element to create
+-/// @return The created 0D element or NULL if an element with this
+-///         ID already exists or if input node is not found.
+-///////////////////////////////////////////////////////////////////////////////
+-SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(const SMDS_MeshNode * n, int ID)
+-{
+-  if (!n) return 0;
+-
+-  if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory();
+-
+-  SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n);
+-  if (myElementIDFactory->BindID(ID, el0d)) {
+-    SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
+-    node->AddInverseElement(el0d);
+-    my0DElements.Add(el0d);
+-    myInfo.myNb0DElements++;
+-    return el0d;
+-  }
+-
+-  delete el0d;
+-  return NULL;
+-}
+-
+-///////////////////////////////////////////////////////////////////////////////
+ /// create a MeshEdge and add it to the current Mesh
+ /// @return : The created MeshEdge
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID)
++SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID) 
+ {
+   SMDS_MeshNode * node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
+   SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
+@@ -238,7 +192,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode * node1,
+-                                  const SMDS_MeshNode * node2)
++				  const SMDS_MeshNode * node2)
+ {
+   return SMDS_Mesh::AddEdgeWithID(node1, node2, myElementIDFactory->GetFreeID());
+ }
+@@ -253,8 +207,8 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
+-                                        const SMDS_MeshNode * n2,
+-                                        int ID)
++					const SMDS_MeshNode * n2, 
++					int ID)
+ {
+   if ( !n1 || !n2 ) return 0;
+ 
+@@ -266,11 +220,11 @@
+     node1=const_cast<SMDS_MeshNode*>(n1);
+     node2=const_cast<SMDS_MeshNode*>(n2);
+     node1->AddInverseElement(edge);
+-    node2->AddInverseElement(edge);
++    node2->AddInverseElement(edge);		
+     myEdges.Add(edge);
+     myInfo.myNbEdges++;
+     return edge;
+-  }
++  } 
+   else {
+     delete edge;
+     return NULL;
+@@ -283,8 +237,8 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
+-                                  const SMDS_MeshNode * n2,
+-                                  const SMDS_MeshNode * n3)
++				  const SMDS_MeshNode * n2,
++				  const SMDS_MeshNode * n3)
+ {
+   return SMDS_Mesh::AddFaceWithID(n1,n2,n3, myElementIDFactory->GetFreeID());
+ }
+@@ -299,7 +253,7 @@
+   SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
+   SMDS_MeshNode * node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
+   if(!node1 || !node2 || !node3) return NULL;
+-  return SMDS_Mesh::AddFaceWithID(node1, node2, node3, ID);
++  return SMDS_Mesh::AddFaceWithID(node1, node2, node3, ID);	
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -326,9 +280,9 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
+-                                  const SMDS_MeshNode * n2,
+-                                  const SMDS_MeshNode * n3,
+-                                  const SMDS_MeshNode * n4)
++				  const SMDS_MeshNode * n2,
++				  const SMDS_MeshNode * n3,
++				  const SMDS_MeshNode * n4)
+ {
+   return SMDS_Mesh::AddFaceWithID(n1,n2,n3, n4, myElementIDFactory->GetFreeID());
+ }
+@@ -337,11 +291,11 @@
+ /// Add a quadrangle defined by its nodes IDs
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1,
+-                                        int idnode2,
+-                                        int idnode3,
+-                                        int idnode4,
+-                                        int ID)
++SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1, 
++					int idnode2, 
++					int idnode3,
++					int idnode4, 
++					int ID)
+ {
+   SMDS_MeshNode *node1, *node2, *node3, *node4;
+   node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
+@@ -349,7 +303,7 @@
+   node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
+   node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
+   if(!node1 || !node2 || !node3 || !node4) return NULL;
+-  return SMDS_Mesh::AddFaceWithID(node1, node2, node3, node4, ID);
++  return SMDS_Mesh::AddFaceWithID(node1, node2, node3, node4, ID);	
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -453,14 +407,14 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new tetrahedron and add it to the mesh.
+-///@return The created tetrahedron
++///Create a new tetrahedron and add it to the mesh. 
++///@return The created tetrahedron 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4)
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4)
+ {
+   int ID = myElementIDFactory->GetFreeID();
+   SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, ID);
+@@ -469,17 +423,17 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new tetrahedron and add it to the mesh.
++///Create a new tetrahedron and add it to the mesh. 
+ ///@param ID The ID of the new volume
+ ///@return The created tetrahedron or NULL if an element with this ID already exists
+ ///or if input nodes are not found.
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+-                                             int idnode2,
+-                                             int idnode3,
+-                                             int idnode4,
+-                                             int ID)
++SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, 
++					     int idnode2,
++					     int idnode3, 
++					     int idnode4, 
++					     int ID)
+ {
+   SMDS_MeshNode *node1, *node2, *node3, *node4;
+   node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
+@@ -489,11 +443,11 @@
+   if(!node1 || !node2 || !node3 || !node4) return NULL;
+   return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, ID);
+ }
+-
++	
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new tetrahedron and add it to the mesh.
++///Create a new tetrahedron and add it to the mesh. 
+ ///@param ID The ID of the new volume
+-///@return The created tetrahedron
++///@return The created tetrahedron 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+@@ -532,16 +486,16 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new pyramid and add it to the mesh.
++///Create a new pyramid and add it to the mesh. 
+ ///Nodes 1,2,3 and 4 define the base of the pyramid
+-///@return The created pyramid
++///@return The created pyramid 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4,
+-                                      const SMDS_MeshNode * n5)
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4, 
++				      const SMDS_MeshNode * n5)
+ {
+   int ID = myElementIDFactory->GetFreeID();
+   SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, ID);
+@@ -550,19 +504,19 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new pyramid and add it to the mesh.
++///Create a new pyramid and add it to the mesh. 
+ ///Nodes 1,2,3 and 4 define the base of the pyramid
+ ///@param ID The ID of the new volume
+ ///@return The created pyramid or NULL if an element with this ID already exists
+ ///or if input nodes are not found.
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+-                                             int idnode2,
+-                                             int idnode3,
+-                                             int idnode4,
+-                                             int idnode5,
+-                                             int ID)
++SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, 
++					     int idnode2,
++					     int idnode3, 
++					     int idnode4, 
++					     int idnode5, 
++					     int ID)
+ {
+   SMDS_MeshNode *node1, *node2, *node3, *node4, *node5;
+   node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
+@@ -573,7 +527,7 @@
+   if(!node1 || !node2 || !node3 || !node4 || !node5) return NULL;
+   return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, ID);
+ }
+-
++	
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Create a new pyramid and add it to the mesh.
+ ///Nodes 1,2,3 and 4 define the base of the pyramid
+@@ -618,17 +572,17 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new prism and add it to the mesh.
++///Create a new prism and add it to the mesh. 
+ ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.
+-///@return The created prism
++///@return The created prism 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4,
+-                                      const SMDS_MeshNode * n5,
+-                                      const SMDS_MeshNode * n6)
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4, 
++				      const SMDS_MeshNode * n5,
++				      const SMDS_MeshNode * n6)
+ {
+   int ID = myElementIDFactory->GetFreeID();
+   SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID);
+@@ -637,20 +591,20 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new prism and add it to the mesh.
++///Create a new prism and add it to the mesh. 
+ ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.
+ ///@param ID The ID of the new volume
+ ///@return The created prism or NULL if an element with this ID already exists
+ ///or if input nodes are not found.
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+-                                             int idnode2,
+-                                             int idnode3,
+-                                             int idnode4,
+-                                             int idnode5,
+-                                             int idnode6,
+-                                             int ID)
++SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, 
++					     int idnode2,
++					     int idnode3, 
++					     int idnode4, 
++					     int idnode5, 
++					     int idnode6, 
++					     int ID)
+ {
+   SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6;
+   node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
+@@ -662,7 +616,7 @@
+   if(!node1 || !node2 || !node3 || !node4 || !node5 || !node6) return NULL;
+   return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6, ID);
+ }
+-
++	
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Create a new prism and add it to the mesh.
+ ///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.
+@@ -709,19 +663,19 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new hexahedron and add it to the mesh.
++///Create a new hexahedron and add it to the mesh. 
+ ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
+-///@return The created hexahedron
++///@return The created hexahedron 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4,
+-                                      const SMDS_MeshNode * n5,
+-                                      const SMDS_MeshNode * n6,
+-                                      const SMDS_MeshNode * n7,
+-                                      const SMDS_MeshNode * n8)
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4, 
++				      const SMDS_MeshNode * n5,
++				      const SMDS_MeshNode * n6, 
++				      const SMDS_MeshNode * n7,
++				      const SMDS_MeshNode * n8)
+ {
+   int ID = myElementIDFactory->GetFreeID();
+   SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
+@@ -730,22 +684,22 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Create a new hexahedron and add it to the mesh.
++///Create a new hexahedron and add it to the mesh. 
+ ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
+ ///@param ID The ID of the new volume
+ ///@return The created hexahedron or NULL if an element with this ID already
+ ///exists or if input nodes are not found.
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+-                                             int idnode2,
+-                                             int idnode3,
+-                                             int idnode4,
+-                                             int idnode5,
+-                                             int idnode6,
+-                                             int idnode7,
+-                                             int idnode8,
+-                                             int ID)
++SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1, 
++					     int idnode2,
++					     int idnode3, 
++					     int idnode4, 
++					     int idnode5, 
++					     int idnode6, 
++					     int idnode7,
++					     int idnode8, 
++					     int ID)
+ {
+   SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6, *node7, *node8;
+   node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
+@@ -761,7 +715,7 @@
+   return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6,
+                                     node7, node8, ID);
+ }
+-
++	
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Create a new hexahedron and add it to the mesh.
+ ///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
+@@ -830,7 +784,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Create a new tetrahedron defined by its faces and add it to the mesh.
+ ///@param ID The ID of the new volume
+-///@return The created tetrahedron
++///@return The created tetrahedron 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
+@@ -873,7 +827,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Create a new pyramid defined by its faces and add it to the mesh.
+ ///@param ID The ID of the new volume
+-///@return The created pyramid
++///@return The created pyramid 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
+@@ -918,7 +872,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Create a new prism defined by its faces and add it to the mesh.
+ ///@param ID The ID of the new volume
+-///@return The created prism
++///@return The created prism 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
+@@ -957,7 +911,7 @@
+     nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
+     if (!nodes[i]) return NULL;
+   }
+-  return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
++  return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);	
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1003,7 +957,7 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-/// Create a new polyhedral volume and add it to the mesh.
++/// Create a new polyhedral volume and add it to the mesh. 
+ /// @param ID The ID of the new volume
+ /// @return The created volume or NULL if an element with this ID already exists
+ /// or if input nodes are not found.
+@@ -1024,7 +978,7 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-/// Create a new polyhedral volume and add it to the mesh.
++/// Create a new polyhedral volume and add it to the mesh. 
+ /// @param ID The ID of the new volume
+ /// @return The created  volume
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1058,7 +1012,7 @@
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-/// Create a new polyhedral volume and add it to the mesh.
++/// Create a new polyhedral volume and add it to the mesh. 
+ /// @return The created  volume
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+@@ -1133,9 +1087,9 @@
+ ///a ID to the create triangle.
+ ///////////////////////////////////////////////////////////////////////////////
+ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1,
+-                                            const SMDS_MeshNode * node2,
+-                                            const SMDS_MeshNode * node3,
+-                                            const SMDS_MeshNode * node4)
++					    const SMDS_MeshNode * node2,
++					    const SMDS_MeshNode * node3,
++					    const SMDS_MeshNode * node4)
+ {
+   if ( !node1 || !node2 || !node3 || !node4 ) return 0;
+   if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+@@ -1167,16 +1121,7 @@
+ 
+ void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node)
+ {
+-        RemoveElement(node, true);
+-}
+-
+-///////////////////////////////////////////////////////////////////////////////
+-/// Remove an edge and all the elements which own this edge
+-///////////////////////////////////////////////////////////////////////////////
+-
+-void SMDS_Mesh::Remove0DElement(const SMDS_Mesh0DElement * elem0d)
+-{
+-  RemoveElement(elem0d,true);
++	RemoveElement(node, true);
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1185,7 +1130,7 @@
+ 
+ void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
+ {
+-        RemoveElement(edge,true);
++	RemoveElement(edge,true);
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1194,7 +1139,7 @@
+ 
+ void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face)
+ {
+-        RemoveElement(face, true);
++	RemoveElement(face, true);
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1203,7 +1148,7 @@
+ 
+ void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume)
+ {
+-        RemoveElement(volume, true);
++	RemoveElement(volume, true);
+ }
+ 
+ //=======================================================================
+@@ -1213,8 +1158,8 @@
+ 
+ bool SMDS_Mesh::RemoveFromParent()
+ {
+-        if (myParent==NULL) return false;
+-        else return (myParent->RemoveSubMesh(this));
++	if (myParent==NULL) return false;
++	else return (myParent->RemoveSubMesh(this));
+ }
+ 
+ //=======================================================================
+@@ -1224,25 +1169,25 @@
+ 
+ bool SMDS_Mesh::RemoveSubMesh(const SMDS_Mesh * aMesh)
+ {
+-        bool found = false;
++	bool found = false;
+ 
+-        list<SMDS_Mesh *>::iterator itmsh=myChildren.begin();
+-        for (; itmsh!=myChildren.end() && !found; itmsh++)
+-        {
+-                SMDS_Mesh * submesh = *itmsh;
+-                if (submesh == aMesh)
+-                {
+-                        found = true;
+-                        myChildren.erase(itmsh);
+-                }
+-        }
++	list<SMDS_Mesh *>::iterator itmsh=myChildren.begin();
++	for (; itmsh!=myChildren.end() && !found; itmsh++)
++	{
++		SMDS_Mesh * submesh = *itmsh;
++		if (submesh == aMesh)
++		{
++			found = true;
++			myChildren.erase(itmsh);
++		}
++	}
+ 
+-        return found;
++	return found;
+ }
+ 
+ //=======================================================================
+ //function : ChangeElementNodes
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element,
+@@ -1263,11 +1208,6 @@
+   SMDS_MeshElement* elem = const_cast<SMDS_MeshElement*>(element);
+   switch ( elem->GetType() )
+   {
+-  case SMDSAbs_0DElement: {
+-    if ( SMDS_Mesh0DElement* elem0d = dynamic_cast<SMDS_Mesh0DElement*>( elem ))
+-      Ok = elem0d->ChangeNode( nodes[0] );
+-    break;
+-  }
+   case SMDSAbs_Edge: {
+     if ( nbnodes == 2 ) {
+       if ( SMDS_MeshEdge* edge = dynamic_cast<SMDS_MeshEdge*>( elem ))
+@@ -1293,7 +1233,7 @@
+   case SMDSAbs_Volume: {
+     if ( SMDS_VolumeOfNodes* vol = dynamic_cast<SMDS_VolumeOfNodes*>( elem ))
+       Ok = vol->ChangeNodes( nodes, nbnodes );
+-    else
++    else 
+       if ( SMDS_QuadraticVolumeOfNodes* QV = dynamic_cast<SMDS_QuadraticVolumeOfNodes*>( elem ))
+         Ok = QV->ChangeNodes( nodes, nbnodes );
+     break;
+@@ -1390,50 +1330,6 @@
+ 
+ 
+ //=======================================================================
+-//function : Find0DElement
+-//purpose  :
+-//=======================================================================
+-const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(int idnode) const
+-{
+-  const SMDS_MeshNode * node = FindNode(idnode);
+-  if(node == NULL) return NULL;
+-  return Find0DElement(node);
+-}
+-
+-const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(const SMDS_MeshNode * node)
+-{
+-  if (!node) return 0;
+-  const SMDS_Mesh0DElement* toReturn = NULL;
+-  SMDS_ElemIteratorPtr it1 = node->GetInverseElementIterator(SMDSAbs_0DElement);
+-  while (it1->more() && (toReturn == NULL)) {
+-    const SMDS_MeshElement* e = it1->next();
+-    if (e->NbNodes() == 1) {
+-      toReturn = static_cast<const SMDS_Mesh0DElement*>(e);
+-    }
+-  }
+-  return toReturn;
+-}
+-
+-//=======================================================================
+-//function : Find0DElementOrCreate
+-//purpose  :
+-//=======================================================================
+-SMDS_Mesh0DElement* SMDS_Mesh::Find0DElementOrCreate(const SMDS_MeshNode * node)
+-{
+-  if (!node) return 0;
+-  SMDS_Mesh0DElement * toReturn = NULL;
+-  toReturn = const_cast<SMDS_Mesh0DElement*>(Find0DElement(node));
+-  if (toReturn == NULL) {
+-    if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory();
+-    toReturn = new SMDS_Mesh0DElement(node);
+-    my0DElements.Add(toReturn);
+-    myInfo.myNb0DElements++;
+-  }
+-  return toReturn;
+-}
+-
+-
+-//=======================================================================
+ //function : FindEdge
+ //purpose  :
+ //=======================================================================
+@@ -1475,7 +1371,7 @@
+ //=======================================================================
+ 
+ SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1,
+-                                           const SMDS_MeshNode * node2)
++                                           const SMDS_MeshNode * node2) 
+ {
+   if ( !node1 || !node2) return 0;
+   SMDS_MeshEdge * toReturn=NULL;
+@@ -1538,7 +1434,7 @@
+ //=======================================================================
+ 
+ const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2,
+-        int idnode3) const
++	int idnode3) const
+ {
+   const SMDS_MeshNode * node1=FindNode(idnode1);
+   const SMDS_MeshNode * node2=FindNode(idnode2);
+@@ -1777,7 +1673,6 @@
+   for (int inode = 0; inode < nbnodes; inode++) {
+     const SMDS_MeshNode * node = FindNode(nodes_ids[inode]);
+     if (node == NULL) return NULL;
+-    poly_nodes[inode] = node;
+   }
+   return FindFace(poly_nodes);
+ }
+@@ -1806,111 +1701,100 @@
+ 
+ //=======================================================================
+ //function : DumpNodes
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ void SMDS_Mesh::DumpNodes() const
+ {
+-        MESSAGE("dump nodes of mesh : ");
+-        SMDS_NodeIteratorPtr itnode=nodesIterator();
+-        while(itnode->more()) MESSAGE(itnode->next());
+-}
+-
+-//=======================================================================
+-//function : Dump0DElements
+-//purpose  :
+-//=======================================================================
+-void SMDS_Mesh::Dump0DElements() const
+-{
+-  MESSAGE("dump 0D elements of mesh : ");
+-  SMDS_0DElementIteratorPtr it0d = elements0dIterator();
+-  while(it0d->more()) MESSAGE(it0d->next());
++	MESSAGE("dump nodes of mesh : ");
++	SMDS_NodeIteratorPtr itnode=nodesIterator();
++	while(itnode->more()) MESSAGE(itnode->next());
+ }
+ 
+ //=======================================================================
+ //function : DumpEdges
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ void SMDS_Mesh::DumpEdges() const
+ {
+-        MESSAGE("dump edges of mesh : ");
+-        SMDS_EdgeIteratorPtr itedge=edgesIterator();
+-        while(itedge->more()) MESSAGE(itedge->next());
++	MESSAGE("dump edges of mesh : ");
++	SMDS_EdgeIteratorPtr itedge=edgesIterator();
++	while(itedge->more()) MESSAGE(itedge->next());
+ }
+ 
+ //=======================================================================
+ //function : DumpFaces
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ void SMDS_Mesh::DumpFaces() const
+ {
+-        MESSAGE("dump faces of mesh : ");
+-        SMDS_FaceIteratorPtr itface=facesIterator();
+-        while(itface->more()) MESSAGE(itface->next());
++	MESSAGE("dump faces of mesh : ");
++	SMDS_FaceIteratorPtr itface=facesIterator();
++	while(itface->more()) MESSAGE(itface->next());
+ }
+ 
+ //=======================================================================
+ //function : DumpVolumes
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ void SMDS_Mesh::DumpVolumes() const
+ {
+-        MESSAGE("dump volumes of mesh : ");
+-        SMDS_VolumeIteratorPtr itvol=volumesIterator();
+-        while(itvol->more()) MESSAGE(itvol->next());
++	MESSAGE("dump volumes of mesh : ");
++	SMDS_VolumeIteratorPtr itvol=volumesIterator();
++	while(itvol->more()) MESSAGE(itvol->next());
+ }
+ 
+ //=======================================================================
+ //function : DebugStats
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ void SMDS_Mesh::DebugStats() const
+ {
+-  MESSAGE("Debug stats of mesh : ");
++	MESSAGE("Debug stats of mesh : ");
+ 
+-  MESSAGE("===== NODES ====="<<NbNodes());
+-  MESSAGE("===== 0DELEMS ====="<<Nb0DElements());
+-  MESSAGE("===== EDGES ====="<<NbEdges());
+-  MESSAGE("===== FACES ====="<<NbFaces());
+-  MESSAGE("===== VOLUMES ====="<<NbVolumes());
++	MESSAGE("===== NODES ====="<<NbNodes());
++	MESSAGE("===== EDGES ====="<<NbEdges());
++	MESSAGE("===== FACES ====="<<NbFaces());
++	MESSAGE("===== VOLUMES ====="<<NbVolumes());
++
++	MESSAGE("End Debug stats of mesh ");
++
++	//#ifdef DEB
++	
++	SMDS_NodeIteratorPtr itnode=nodesIterator();
++	int sizeofnodes = 0;
++	int sizeoffaces = 0;
++
++	while(itnode->more())
++	{
++		const SMDS_MeshNode *node = itnode->next();
++
++		sizeofnodes += sizeof(*node);
++		
++		SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
++		while(it->more())
++		{
++			const SMDS_MeshElement *me = it->next();
++			sizeofnodes += sizeof(me);
++		}
++
++	}
++
++	SMDS_FaceIteratorPtr itface=facesIterator();
++	while(itface->more())
++	{
++		const SMDS_MeshElement *face = itface->next();		
++		sizeoffaces += sizeof(*face);
++
++	}
++	MESSAGE("total size of node elements = " << sizeofnodes);;
++	MESSAGE("total size of face elements = " << sizeoffaces);;
+ 
+-  MESSAGE("End Debug stats of mesh ");
+-
+-  //#ifdef DEB
+-
+-  SMDS_NodeIteratorPtr itnode=nodesIterator();
+-  int sizeofnodes = 0;
+-  int sizeoffaces = 0;
+-
+-  while(itnode->more())
+-  {
+-    const SMDS_MeshNode *node = itnode->next();
+-
+-    sizeofnodes += sizeof(*node);
+-
+-    SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
+-    while(it->more())
+-    {
+-      const SMDS_MeshElement *me = it->next();
+-      sizeofnodes += sizeof(me);
+-    }
+-  }
+-
+-  SMDS_FaceIteratorPtr itface=facesIterator();
+-  while(itface->more())
+-  {
+-    const SMDS_MeshElement *face = itface->next();
+-    sizeoffaces += sizeof(*face);
+-  }
+-
+-  MESSAGE("total size of node elements = " << sizeofnodes);;
+-  MESSAGE("total size of face elements = " << sizeoffaces);;
+-
+-  //#endif
++	//#endif
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1918,15 +1802,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ int SMDS_Mesh::NbNodes() const
+ {
+-        return myNodes.Size();
+-}
+-
+-///////////////////////////////////////////////////////////////////////////////
+-/// Return the number of 0D elements
+-///////////////////////////////////////////////////////////////////////////////
+-int SMDS_Mesh::Nb0DElements() const
+-{
+-  return my0DElements.Size();
++	return myNodes.Size();
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1934,7 +1810,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ int SMDS_Mesh::NbEdges() const
+ {
+-        return myEdges.Size();
++	return myEdges.Size();
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1942,7 +1818,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ int SMDS_Mesh::NbFaces() const
+ {
+-        return myFaces.Size();
++	return myFaces.Size();
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1950,7 +1826,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ int SMDS_Mesh::NbVolumes() const
+ {
+-        return myVolumes.Size();
++	return myVolumes.Size();
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1960,7 +1836,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ int SMDS_Mesh::NbSubMesh() const
+ {
+-        return myChildren.size();
++	return myChildren.size();
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -1990,18 +1866,10 @@
+     while (itn->more())
+       myNodeIDFactory->ReleaseID(itn->next()->GetID());
+   }
+-
+   SetOfNodes::Iterator itn(myNodes);
+   for (; itn.More(); itn.Next())
+     delete itn.Value();
+ 
+-  SetOf0DElements::Iterator it0d (my0DElements);
+-  for (; it0d.More(); it0d.Next())
+-  {
+-    SMDS_MeshElement* elem = it0d.Value();
+-    delete elem;
+-  }
+-
+   SetOfEdges::Iterator ite(myEdges);
+   for (; ite.More(); ite.Next())
+   {
+@@ -2022,6 +1890,7 @@
+     SMDS_MeshElement* elem = itv.Value();
+     delete elem;
+   }
++
+ }
+ 
+ //================================================================================
+@@ -2044,7 +1913,6 @@
+     myNodeIDFactory->Clear();
+     myElementIDFactory->Clear();
+   }
+-
+   SMDS_VolumeIteratorPtr itv = volumesIterator();
+   while (itv->more())
+     delete itv->next();
+@@ -2054,17 +1922,12 @@
+   while (itf->more())
+     delete itf->next();
+   myFaces.Clear();
+-
++      
+   SMDS_EdgeIteratorPtr ite = edgesIterator();
+   while (ite->more())
+     delete ite->next();
+   myEdges.Clear();
+ 
+-  SMDS_0DElementIteratorPtr it0d = elements0dIterator();
+-  while (it0d->more())
+-    delete it0d->next();
+-  my0DElements.Clear();
+-
+   SMDS_NodeIteratorPtr itn = nodesIterator();
+   while (itn->more())
+     delete itn->next();
+@@ -2084,7 +1947,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ bool SMDS_Mesh::hasConstructionEdges()
+ {
+-        return myHasConstructionEdges;
++	return myHasConstructionEdges;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2096,7 +1959,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ bool SMDS_Mesh::hasConstructionFaces()
+ {
+-        return myHasConstructionFaces;
++	return myHasConstructionFaces;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2105,7 +1968,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ bool SMDS_Mesh::hasInverseElements()
+ {
+-        return myHasInverseElements;
++	return myHasInverseElements;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2114,7 +1977,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ void SMDS_Mesh::setConstructionEdges(bool b)
+ {
+-        myHasConstructionEdges=b;
++	myHasConstructionEdges=b;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2123,7 +1986,7 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ void SMDS_Mesh::setConstructionFaces(bool b)
+ {
+-         myHasConstructionFaces=b;
++	 myHasConstructionFaces=b;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2132,139 +1995,164 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ void SMDS_Mesh::setInverseElements(bool b)
+ {
+-        if(!b) MESSAGE("Error : inverseElement=false not implemented");
+-        myHasInverseElements=b;
++	if(!b) MESSAGE("Error : inverseElement=false not implemented");
++	myHasInverseElements=b;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Iterator on NCollection_Map
++/// Return an iterator on nodes of the current mesh factory
+ ///////////////////////////////////////////////////////////////////////////////
+-template <class MAP, typename ELEM=const SMDS_MeshElement*, class FATHER=SMDS_ElemIterator>
+-struct MYNCollection_Map_Iterator: public FATHER
++class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator
+ {
+-  typename MAP::Iterator myIterator;
+-
+-  MYNCollection_Map_Iterator(const MAP& map):myIterator(map){}
++  SMDS_ElemIteratorPtr myIterator;
++ public:
++  SMDS_Mesh_MyNodeIterator(const SMDS_ElemIteratorPtr& it):myIterator(it)
++  {}
+ 
+   bool more()
+   {
+-    while(myIterator.More())
+-    {
+-      if(myIterator.Value()->GetID()!=-1)
+-        return true;
+-      myIterator.Next();
+-    }
+-    return false;
++    return myIterator->more();
+   }
+ 
+-  ELEM next()
++  const SMDS_MeshNode* next()
+   {
+-    ELEM current = (ELEM) myIterator.Value();
+-    myIterator.Next();
+-    return current;
++    return static_cast<const SMDS_MeshNode*>(myIterator->next());
+   }
+ };
+ 
+-///////////////////////////////////////////////////////////////////////////////
+-/// Return an iterator on nodes of the current mesh factory
+-///////////////////////////////////////////////////////////////////////////////
+-
+ SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const
+ {
+-  //return SMDS_NodeIteratorPtr
+-  //  (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator()));
+-  typedef MYNCollection_Map_Iterator
+-    < SetOfNodes, const SMDS_MeshNode*, SMDS_NodeIterator > TIterator;
+-  return SMDS_NodeIteratorPtr(new TIterator(myNodes));
++  return SMDS_NodeIteratorPtr
++    (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator()));
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Return an iterator on 0D elements of the current mesh.
++/// Return an iterator on elements of the current mesh factory
+ ///////////////////////////////////////////////////////////////////////////////
+-
+-SMDS_0DElementIteratorPtr SMDS_Mesh::elements0dIterator() const
++SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator() const
+ {
+-  typedef MYNCollection_Map_Iterator
+-    < SetOf0DElements, const SMDS_Mesh0DElement*, SMDS_0DElementIterator > TIterator;
+-  return SMDS_0DElementIteratorPtr(new TIterator(my0DElements));
++  return myElementIDFactory->elementsIterator();
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Return an iterator on edges of the current mesh.
+ ///////////////////////////////////////////////////////////////////////////////
++class SMDS_Mesh_MyEdgeIterator:public SMDS_EdgeIterator
++{
++  typedef SMDS_Mesh::SetOfEdges SetOfEdges;
++  SetOfEdges::Iterator myIterator;
++ public:
++  SMDS_Mesh_MyEdgeIterator(const SetOfEdges& s):myIterator(s)
++  {}
++
++  bool more()
++  {
++    while(myIterator.More())
++    {
++      if(myIterator.Value()->GetID()!=-1)
++        return true;
++      myIterator.Next();
++    }
++    return false;
++  }
++
++  const SMDS_MeshEdge* next()
++  {
++    const SMDS_MeshEdge* current = myIterator.Value();
++    myIterator.Next();
++    return current;
++  }
++};
+ 
+ SMDS_EdgeIteratorPtr SMDS_Mesh::edgesIterator() const
+ {
+-  typedef MYNCollection_Map_Iterator
+-    < SetOfEdges, const SMDS_MeshEdge*, SMDS_EdgeIterator > TIterator;
+-  return SMDS_EdgeIteratorPtr(new TIterator(myEdges));
++  return SMDS_EdgeIteratorPtr(new SMDS_Mesh_MyEdgeIterator(myEdges));
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Return an iterator on faces of the current mesh.
+ ///////////////////////////////////////////////////////////////////////////////
++class SMDS_Mesh_MyFaceIterator:public SMDS_FaceIterator
++{
++  typedef SMDS_Mesh::SetOfFaces SetOfFaces;
++  SetOfFaces::Iterator myIterator;
++ public:
++  SMDS_Mesh_MyFaceIterator(const SetOfFaces& s):myIterator(s)
++  {}
++
++  bool more()
++  {
++    while(myIterator.More())
++    {
++      if(myIterator.Value()->GetID()!=-1)
++        return true;
++      myIterator.Next();
++    }
++    return false;
++  }
++
++  const SMDS_MeshFace* next()
++  {
++    const SMDS_MeshFace* current = myIterator.Value();
++    myIterator.Next();
++    return current;
++  }
++};
+ 
+ SMDS_FaceIteratorPtr SMDS_Mesh::facesIterator() const
+ {
+-  typedef MYNCollection_Map_Iterator
+-    < SetOfFaces, const SMDS_MeshFace*, SMDS_FaceIterator > TIterator;
+-  return SMDS_FaceIteratorPtr(new TIterator(myFaces));
++  return SMDS_FaceIteratorPtr(new SMDS_Mesh_MyFaceIterator(myFaces));
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ ///Return an iterator on volumes of the current mesh.
+ ///////////////////////////////////////////////////////////////////////////////
+-
+-SMDS_VolumeIteratorPtr SMDS_Mesh::volumesIterator() const
++class SMDS_Mesh_MyVolumeIterator:public SMDS_VolumeIterator
+ {
+-  typedef MYNCollection_Map_Iterator
+-    < SetOfVolumes, const SMDS_MeshVolume*, SMDS_VolumeIterator > TIterator;
+-  return SMDS_VolumeIteratorPtr(new TIterator(myVolumes));
+-}
++  typedef SMDS_Mesh::SetOfVolumes SetOfVolumes;
++  SetOfVolumes::Iterator myIterator;
++ public:
++  SMDS_Mesh_MyVolumeIterator(const SetOfVolumes& s):myIterator(s)
++  {}
+ 
+-///////////////////////////////////////////////////////////////////////////////
+-/// Return an iterator on elements of the current mesh factory
+-///////////////////////////////////////////////////////////////////////////////
+-SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator(SMDSAbs_ElementType type) const
+-{
+-  switch (type) {
+-  case SMDSAbs_All:
+-    break;
+-  case SMDSAbs_Volume:
+-    return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfVolumes >(myVolumes));
+-  case SMDSAbs_Face:
+-    return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfFaces >(myFaces));
+-  case SMDSAbs_Edge:
+-    return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfEdges >(myEdges));
+-  case SMDSAbs_0DElement:
+-    return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOf0DElements >(my0DElements));
+-  case SMDSAbs_Node:
+-    return myNodeIDFactory->elementsIterator();
+-  default:;
++  bool more()
++  {
++    return myIterator.More() != Standard_False;
+   }
+-  return myElementIDFactory->elementsIterator();
++
++  const SMDS_MeshVolume* next()
++  {
++    const SMDS_MeshVolume* current = myIterator.Value();
++    myIterator.Next();
++    return current;
++  }
++};
++
++SMDS_VolumeIteratorPtr SMDS_Mesh::volumesIterator() const
++{
++  return SMDS_VolumeIteratorPtr(new SMDS_Mesh_MyVolumeIterator(myVolumes));
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Do intersection of sets (more than 2)
+ ///////////////////////////////////////////////////////////////////////////////
+ static set<const SMDS_MeshElement*> * intersectionOfSets(
+-        set<const SMDS_MeshElement*> vs[], int numberOfSets)
++	set<const SMDS_MeshElement*> vs[], int numberOfSets)
+ {
+-        set<const SMDS_MeshElement*>* rsetA=new set<const SMDS_MeshElement*>(vs[0]);
+-        set<const SMDS_MeshElement*>* rsetB;
++	set<const SMDS_MeshElement*>* rsetA=new set<const SMDS_MeshElement*>(vs[0]);
++	set<const SMDS_MeshElement*>* rsetB;
+ 
+-        for(int i=0; i<numberOfSets-1; i++)
+-        {
+-                rsetB=new set<const SMDS_MeshElement*>();
+-                set_intersection(
+-                        rsetA->begin(), rsetA->end(),
+-                        vs[i+1].begin(), vs[i+1].end(),
+-                        inserter(*rsetB, rsetB->begin()));
+-                delete rsetA;
+-                rsetA=rsetB;
+-        }
+-        return rsetA;
++	for(int i=0; i<numberOfSets-1; i++)
++	{
++		rsetB=new set<const SMDS_MeshElement*>();
++		set_intersection(
++			rsetA->begin(), rsetA->end(),
++			vs[i+1].begin(), vs[i+1].end(),
++			std::inserter(*rsetB, rsetB->begin()));
++		delete rsetA;
++		rsetA=rsetB;
++	}
++	return rsetA;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2272,122 +2160,118 @@
+ ///////////////////////////////////////////////////////////////////////////////
+ static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
+ {
+-        int numberOfSets=element->NbNodes();
+-        set<const SMDS_MeshElement*> *initSet = new set<const SMDS_MeshElement*>[numberOfSets];
++	int numberOfSets=element->NbNodes();
++ 	set<const SMDS_MeshElement*> *initSet = new set<const SMDS_MeshElement*>[numberOfSets];
+ 
+-        SMDS_ElemIteratorPtr itNodes=element->nodesIterator();
++	SMDS_ElemIteratorPtr itNodes=element->nodesIterator();
+ 
+-        int i=0;
+-        while(itNodes->more())
+-        {
+-                const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
+-                SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
++	int i=0;
++	while(itNodes->more())
++	{
++		const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
++		SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
+ 
+-                //initSet[i]=set<const SMDS_MeshElement*>();
+-                while(itFe->more())
++		//initSet[i]=set<const SMDS_MeshElement*>();
++		while(itFe->more())
+                   initSet[i].insert(itFe->next());
+ 
+-                i++;
+-        }
+-        set<const SMDS_MeshElement*> *retSet=intersectionOfSets(initSet, numberOfSets);
++		i++;
++	}
++	set<const SMDS_MeshElement*> *retSet=intersectionOfSets(initSet, numberOfSets);
+         delete [] initSet;
+-        return retSet;
++	return retSet;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ /// Return the list of nodes used only by the given elements
+ ///////////////////////////////////////////////////////////////////////////////
+ static set<const SMDS_MeshElement*> * getExclusiveNodes(
+-        set<const SMDS_MeshElement*>& elements)
++	set<const SMDS_MeshElement*>& elements)
+ {
+-        set<const SMDS_MeshElement*> * toReturn=new set<const SMDS_MeshElement*>();
+-        set<const SMDS_MeshElement*>::iterator itElements=elements.begin();
+-
+-        while(itElements!=elements.end())
+-        {
+-                SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator();
+-                itElements++;
++	set<const SMDS_MeshElement*> * toReturn=new set<const SMDS_MeshElement*>();
++	set<const SMDS_MeshElement*>::iterator itElements=elements.begin();
+ 
+-                while(itNodes->more())
+-                {
+-                        const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
+-                        SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
+-                        set<const SMDS_MeshElement*> s;
+-                        while(itFe->more())
++	while(itElements!=elements.end())
++	{
++		SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator();
++		itElements++;
++	
++		while(itNodes->more())
++		{
++			const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
++			SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
++			set<const SMDS_MeshElement*> s;
++			while(itFe->more())
+                           s.insert(itFe->next());
+-                        if(s==elements) toReturn->insert(n);
+-                }
+-        }
+-        return toReturn;
++			if(s==elements) toReturn->insert(n);
++		}
++	}
++	return toReturn;	
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+-///Find the children of an element that are made of given nodes
++///Find the children of an element that are made of given nodes 
+ ///@param setOfChildren The set in which matching children will be inserted
+ ///@param element The element were to search matching children
+ ///@param nodes The nodes that the children must have to be selected
+ ///////////////////////////////////////////////////////////////////////////////
+-void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
+-                                     const SMDS_MeshElement *      element,
+-                                     set<const SMDS_MeshElement*>& nodes)
++void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>&	setOfChildren, 
++	const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes)
+ {
+-  switch(element->GetType())
+-    {
+-    case SMDSAbs_Node:
+-      MESSAGE("Internal Error: This should not happend");
+-      break;
+-    case SMDSAbs_0DElement:
+-      {
+-      }
+-      break;
+-    case SMDSAbs_Edge:
+-        {
+-                SMDS_ElemIteratorPtr itn=element->nodesIterator();
+-                while(itn->more())
+-                {
+-                        const SMDS_MeshElement * e=itn->next();
+-                        if(nodes.find(e)!=nodes.end())
++	
++	switch(element->GetType())
++	{
++	case SMDSAbs_Node:
++		MESSAGE("Internal Error: This should not append");
++		break;
++	case SMDSAbs_Edge:
++	{
++		SMDS_ElemIteratorPtr itn=element->nodesIterator();
++		while(itn->more())
++		{
++			const SMDS_MeshElement * e=itn->next();
++			if(nodes.find(e)!=nodes.end())
+                         {
+                           setOfChildren.insert(element);
+                           break;
+                         }
+-                }
+-        } break;
+-    case SMDSAbs_Face:
+-        {
+-                SMDS_ElemIteratorPtr itn=element->nodesIterator();
+-                while(itn->more())
+-                {
+-                        const SMDS_MeshElement * e=itn->next();
+-                        if(nodes.find(e)!=nodes.end())
++		}
++	} break;
++	case SMDSAbs_Face:
++	{
++		SMDS_ElemIteratorPtr itn=element->nodesIterator();
++		while(itn->more())
++		{
++			const SMDS_MeshElement * e=itn->next();
++			if(nodes.find(e)!=nodes.end())
+                         {
+                           setOfChildren.insert(element);
+                           break;
+                         }
+-                }
+-                if(hasConstructionEdges())
+-                {
+-                        SMDS_ElemIteratorPtr ite=element->edgesIterator();
+-                        while(ite->more())
+-                                addChildrenWithNodes(setOfChildren, ite->next(), nodes);
+-                }
+-        } break;
+-    case SMDSAbs_Volume:
+-        {
+-                if(hasConstructionFaces())
+-                {
+-                        SMDS_ElemIteratorPtr ite=element->facesIterator();
+-                        while(ite->more())
+-                                addChildrenWithNodes(setOfChildren, ite->next(), nodes);
+-                }
+-                else if(hasConstructionEdges())
+-                {
+-                        SMDS_ElemIteratorPtr ite=element->edgesIterator();
+-                        while(ite->more())
+-                                addChildrenWithNodes(setOfChildren, ite->next(), nodes);
+-                }
+-        }
+-    }
++		}
++		if(hasConstructionEdges())
++		{
++			SMDS_ElemIteratorPtr ite=element->edgesIterator();
++			while(ite->more())
++				addChildrenWithNodes(setOfChildren, ite->next(), nodes);
++		}
++	} break;	
++	case SMDSAbs_Volume:
++	{
++		if(hasConstructionFaces())
++		{
++			SMDS_ElemIteratorPtr ite=element->facesIterator();
++			while(ite->more())
++				addChildrenWithNodes(setOfChildren, ite->next(), nodes);
++		}
++		else if(hasConstructionEdges())
++		{
++			SMDS_ElemIteratorPtr ite=element->edgesIterator();
++			while(ite->more())
++				addChildrenWithNodes(setOfChildren, ite->next(), nodes);
++		}
++	}
++	}
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2395,13 +2279,13 @@
+ ///@param removenodes if true remaining nodes will be removed
+ ///////////////////////////////////////////////////////////////////////////////
+ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
+-                              const bool removenodes)
++	const bool removenodes)
+ {
+   list<const SMDS_MeshElement *> removedElems;
+   list<const SMDS_MeshElement *> removedNodes;
+   RemoveElement( elem, removedElems, removedNodes, removenodes );
+ }
+-
++  
+ ///////////////////////////////////////////////////////////////////////////////
+ ///@param elem The element to delete
+ ///@param removedElems contains all removed elements
+@@ -2415,9 +2299,8 @@
+ {
+   // get finite elements built on elem
+   set<const SMDS_MeshElement*> * s1;
+-  if (elem->GetType() == SMDSAbs_0DElement ||
+-      elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges() ||
+-      elem->GetType() == SMDSAbs_Face && !hasConstructionFaces() ||
++  if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge ||
++      !hasConstructionFaces() && elem->GetType() == SMDSAbs_Face ||
+       elem->GetType() == SMDSAbs_Volume)
+   {
+     s1 = new set<const SMDS_MeshElement*>();
+@@ -2433,7 +2316,7 @@
+     // do not remove nodes except elem
+     s2 = new set<const SMDS_MeshElement*>();
+     s2->insert(elem);
+-    removenodes = true;
++	removenodes = true;
+   }
+   else
+     s2 = getExclusiveNodes(*s1);
+@@ -2467,12 +2350,6 @@
+     case SMDSAbs_Node:
+       MESSAGE("Internal Error: This should not happen");
+       break;
+-    case SMDSAbs_0DElement:
+-      my0DElements.Remove(static_cast<SMDS_Mesh0DElement*>
+-                          (const_cast<SMDS_MeshElement*>(*it)));
+-      //myInfo.Remove0DElement(*it);
+-      myInfo.remove(*it);
+-      break;
+     case SMDSAbs_Edge:
+       myEdges.Remove(static_cast<SMDS_MeshEdge*>
+                     (const_cast<SMDS_MeshElement*>(*it)));
+@@ -2517,7 +2394,7 @@
+   delete s1;
+ }
+ 
+-
++  
+ ///////////////////////////////////////////////////////////////////////////////
+ ///@param elem The element to delete
+ ///////////////////////////////////////////////////////////////////////////////
+@@ -2549,12 +2426,6 @@
+ 
+     // in meshes without descendants elements are always free
+     switch (aType) {
+-    case SMDSAbs_0DElement:
+-      my0DElements.Remove(static_cast<SMDS_Mesh0DElement*>
+-                          (const_cast<SMDS_MeshElement*>(elem)));
+-      //myInfo.Remove0DElement(elem);
+-      myInfo.remove(elem);
+-      break;
+     case SMDSAbs_Edge:
+       myEdges.Remove(static_cast<SMDS_MeshEdge*>
+                      (const_cast<SMDS_MeshElement*>(elem)));
+@@ -2590,10 +2461,6 @@
+   while (itn->more())
+     if (elem == itn->next())
+       return true;
+-  SMDS_0DElementIteratorPtr it0d = elements0dIterator();
+-  while (it0d->more())
+-    if (elem == it0d->next())
+-      return true;
+   SMDS_EdgeIteratorPtr ite = edgesIterator();
+   while (ite->more())
+     if (elem == ite->next())
+@@ -2611,7 +2478,7 @@
+ 
+ //=======================================================================
+ //function : MaxNodeID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ int SMDS_Mesh::MaxNodeID() const
+@@ -2621,7 +2488,7 @@
+ 
+ //=======================================================================
+ //function : MinNodeID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ int SMDS_Mesh::MinNodeID() const
+@@ -2631,7 +2498,7 @@
+ 
+ //=======================================================================
+ //function : MaxElementID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ int SMDS_Mesh::MaxElementID() const
+@@ -2641,7 +2508,7 @@
+ 
+ //=======================================================================
+ //function : MinElementID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ 
+ int SMDS_Mesh::MinElementID() const
+@@ -2703,7 +2570,7 @@
+ 
+   if( !elem )
+   {
+-    //throw SALOME_Exception(LOCALIZED ("this element isn't exist"));
++    //throw SMESH_Exception(LOCALIZED ("this element isn't exist"));
+     return SMDSAbs_All;
+   }
+   else
+@@ -2722,9 +2589,9 @@
+ 
+ //=======================================================================
+ //function : AddEdgeWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+-SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID)
++SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID) 
+ {
+   return SMDS_Mesh::AddEdgeWithID
+     ((SMDS_MeshNode*) myNodeIDFactory->MeshElement(n1),
+@@ -2735,10 +2602,10 @@
+ 
+ //=======================================================================
+ //function : AddEdge
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode* n1,
+-                                  const SMDS_MeshNode* n2,
++				  const SMDS_MeshNode* n2,
+                                   const SMDS_MeshNode* n12)
+ {
+   return SMDS_Mesh::AddEdgeWithID(n1, n2, n12, myElementIDFactory->GetFreeID());
+@@ -2746,12 +2613,12 @@
+ 
+ //=======================================================================
+ //function : AddEdgeWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
+-                                        const SMDS_MeshNode * n2,
+-                                        const SMDS_MeshNode * n12,
+-                                        int ID)
++					const SMDS_MeshNode * n2, 
++					const SMDS_MeshNode * n12, 
++					int ID)
+ {
+   if ( !n1 || !n2 || !n12 ) return 0;
+   SMDS_QuadraticEdge* edge = new SMDS_QuadraticEdge(n1,n2,n12);
+@@ -2766,7 +2633,7 @@
+     myEdges.Add(edge);
+     myInfo.myNbQuadEdges++;
+     return edge;
+-  }
++  } 
+   else {
+     delete edge;
+     return NULL;
+@@ -2776,11 +2643,11 @@
+ 
+ //=======================================================================
+ //function : AddFace
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
+-                                  const SMDS_MeshNode * n2,
+-                                  const SMDS_MeshNode * n3,
++				  const SMDS_MeshNode * n2,
++				  const SMDS_MeshNode * n3,
+                                   const SMDS_MeshNode * n12,
+                                   const SMDS_MeshNode * n23,
+                                   const SMDS_MeshNode * n31)
+@@ -2791,7 +2658,7 @@
+ 
+ //=======================================================================
+ //function : AddFaceWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3,
+                                         int n12,int n23,int n31, int ID)
+@@ -2808,14 +2675,14 @@
+ 
+ //=======================================================================
+ //function : AddFaceWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+                                         const SMDS_MeshNode * n2,
+                                         const SMDS_MeshNode * n3,
+                                         const SMDS_MeshNode * n12,
+                                         const SMDS_MeshNode * n23,
+-                                        const SMDS_MeshNode * n31,
++                                        const SMDS_MeshNode * n31, 
+                                         int ID)
+ {
+   if ( !n1 || !n2 || !n3 || !n12 || !n23 || !n31) return 0;
+@@ -2838,12 +2705,12 @@
+ 
+ //=======================================================================
+ //function : AddFace
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
+-                                  const SMDS_MeshNode * n2,
+-                                  const SMDS_MeshNode * n3,
+-                                  const SMDS_MeshNode * n4,
++				  const SMDS_MeshNode * n2,
++				  const SMDS_MeshNode * n3,
++				  const SMDS_MeshNode * n4,
+                                   const SMDS_MeshNode * n12,
+                                   const SMDS_MeshNode * n23,
+                                   const SMDS_MeshNode * n34,
+@@ -2855,7 +2722,7 @@
+ 
+ //=======================================================================
+ //function : AddFaceWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4,
+                                         int n12,int n23,int n34,int n41, int ID)
+@@ -2874,7 +2741,7 @@
+ 
+ //=======================================================================
+ //function : AddFaceWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+                                         const SMDS_MeshNode * n2,
+@@ -2882,8 +2749,8 @@
+                                         const SMDS_MeshNode * n4,
+                                         const SMDS_MeshNode * n12,
+                                         const SMDS_MeshNode * n23,
+-                                        const SMDS_MeshNode * n34,
+-                                        const SMDS_MeshNode * n41,
++                                        const SMDS_MeshNode * n34, 
++                                        const SMDS_MeshNode * n41, 
+                                         int ID)
+ {
+   if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n34 || !n41) return 0;
+@@ -2905,16 +2772,16 @@
+ 
+ //=======================================================================
+ //function : AddVolume
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4,
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4,
+                                       const SMDS_MeshNode * n12,
+                                       const SMDS_MeshNode * n23,
+                                       const SMDS_MeshNode * n31,
+-                                      const SMDS_MeshNode * n14,
++                                      const SMDS_MeshNode * n14, 
+                                       const SMDS_MeshNode * n24,
+                                       const SMDS_MeshNode * n34)
+ {
+@@ -2927,7 +2794,7 @@
+ 
+ //=======================================================================
+ //function : AddVolumeWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
+                                             int n12,int n23,int n31,
+@@ -2958,7 +2825,7 @@
+                                             const SMDS_MeshNode * n12,
+                                             const SMDS_MeshNode * n23,
+                                             const SMDS_MeshNode * n31,
+-                                            const SMDS_MeshNode * n14,
++                                            const SMDS_MeshNode * n14, 
+                                             const SMDS_MeshNode * n24,
+                                             const SMDS_MeshNode * n34,
+                                             int ID)
+@@ -2984,18 +2851,18 @@
+ 
+ //=======================================================================
+ //function : AddVolume
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4,
+-                                      const SMDS_MeshNode * n5,
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4,
++                                      const SMDS_MeshNode * n5, 
+                                       const SMDS_MeshNode * n12,
+                                       const SMDS_MeshNode * n23,
+                                       const SMDS_MeshNode * n34,
+                                       const SMDS_MeshNode * n41,
+-                                      const SMDS_MeshNode * n15,
++                                      const SMDS_MeshNode * n15, 
+                                       const SMDS_MeshNode * n25,
+                                       const SMDS_MeshNode * n35,
+                                       const SMDS_MeshNode * n45)
+@@ -3010,7 +2877,7 @@
+ 
+ //=======================================================================
+ //function : AddVolumeWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
+                                             int n12,int n23,int n34,int n41,
+@@ -3041,12 +2908,12 @@
+                                             const SMDS_MeshNode * n2,
+                                             const SMDS_MeshNode * n3,
+                                             const SMDS_MeshNode * n4,
+-                                            const SMDS_MeshNode * n5,
++                                            const SMDS_MeshNode * n5, 
+                                             const SMDS_MeshNode * n12,
+                                             const SMDS_MeshNode * n23,
+                                             const SMDS_MeshNode * n34,
+                                             const SMDS_MeshNode * n41,
+-                                            const SMDS_MeshNode * n15,
++                                            const SMDS_MeshNode * n15, 
+                                             const SMDS_MeshNode * n25,
+                                             const SMDS_MeshNode * n35,
+                                             const SMDS_MeshNode * n45,
+@@ -3075,20 +2942,20 @@
+ 
+ //=======================================================================
+ //function : AddVolume
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4,
+-                                      const SMDS_MeshNode * n5,
+-                                      const SMDS_MeshNode * n6,
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4,
++                                      const SMDS_MeshNode * n5, 
++                                      const SMDS_MeshNode * n6, 
+                                       const SMDS_MeshNode * n12,
+                                       const SMDS_MeshNode * n23,
+-                                      const SMDS_MeshNode * n31,
++                                      const SMDS_MeshNode * n31, 
+                                       const SMDS_MeshNode * n45,
+                                       const SMDS_MeshNode * n56,
+-                                      const SMDS_MeshNode * n64,
++                                      const SMDS_MeshNode * n64, 
+                                       const SMDS_MeshNode * n14,
+                                       const SMDS_MeshNode * n25,
+                                       const SMDS_MeshNode * n36)
+@@ -3103,7 +2970,7 @@
+ 
+ //=======================================================================
+ //function : AddVolumeWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3,
+                                             int n4, int n5, int n6,
+@@ -3138,14 +3005,14 @@
+                                             const SMDS_MeshNode * n2,
+                                             const SMDS_MeshNode * n3,
+                                             const SMDS_MeshNode * n4,
+-                                            const SMDS_MeshNode * n5,
+-                                            const SMDS_MeshNode * n6,
++                                            const SMDS_MeshNode * n5, 
++                                            const SMDS_MeshNode * n6, 
+                                             const SMDS_MeshNode * n12,
+                                             const SMDS_MeshNode * n23,
+-                                            const SMDS_MeshNode * n31,
++                                            const SMDS_MeshNode * n31, 
+                                             const SMDS_MeshNode * n45,
+                                             const SMDS_MeshNode * n56,
+-                                            const SMDS_MeshNode * n64,
++                                            const SMDS_MeshNode * n64, 
+                                             const SMDS_MeshNode * n14,
+                                             const SMDS_MeshNode * n25,
+                                             const SMDS_MeshNode * n36,
+@@ -3174,24 +3041,24 @@
+ 
+ //=======================================================================
+ //function : AddVolume
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3,
+-                                      const SMDS_MeshNode * n4,
+-                                      const SMDS_MeshNode * n5,
+-                                      const SMDS_MeshNode * n6,
++				      const SMDS_MeshNode * n2, 
++				      const SMDS_MeshNode * n3,
++				      const SMDS_MeshNode * n4,
++                                      const SMDS_MeshNode * n5, 
++                                      const SMDS_MeshNode * n6, 
+                                       const SMDS_MeshNode * n7,
+-                                      const SMDS_MeshNode * n8,
++                                      const SMDS_MeshNode * n8, 
+                                       const SMDS_MeshNode * n12,
+                                       const SMDS_MeshNode * n23,
+                                       const SMDS_MeshNode * n34,
+-                                      const SMDS_MeshNode * n41,
++                                      const SMDS_MeshNode * n41, 
+                                       const SMDS_MeshNode * n56,
+                                       const SMDS_MeshNode * n67,
+                                       const SMDS_MeshNode * n78,
+-                                      const SMDS_MeshNode * n85,
++                                      const SMDS_MeshNode * n85, 
+                                       const SMDS_MeshNode * n15,
+                                       const SMDS_MeshNode * n26,
+                                       const SMDS_MeshNode * n37,
+@@ -3207,7 +3074,7 @@
+ 
+ //=======================================================================
+ //function : AddVolumeWithID
+-//purpose  :
++//purpose  : 
+ //=======================================================================
+ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
+                                             int n5, int n6, int n7, int n8,
+@@ -3247,18 +3114,18 @@
+                                             const SMDS_MeshNode * n2,
+                                             const SMDS_MeshNode * n3,
+                                             const SMDS_MeshNode * n4,
+-                                            const SMDS_MeshNode * n5,
+-                                            const SMDS_MeshNode * n6,
++                                            const SMDS_MeshNode * n5, 
++                                            const SMDS_MeshNode * n6, 
+                                             const SMDS_MeshNode * n7,
+-                                            const SMDS_MeshNode * n8,
++                                            const SMDS_MeshNode * n8, 
+                                             const SMDS_MeshNode * n12,
+                                             const SMDS_MeshNode * n23,
+                                             const SMDS_MeshNode * n34,
+-                                            const SMDS_MeshNode * n41,
++                                            const SMDS_MeshNode * n41, 
+                                             const SMDS_MeshNode * n56,
+                                             const SMDS_MeshNode * n67,
+                                             const SMDS_MeshNode * n78,
+-                                            const SMDS_MeshNode * n85,
++                                            const SMDS_MeshNode * n85, 
+                                             const SMDS_MeshNode * n15,
+                                             const SMDS_MeshNode * n26,
+                                             const SMDS_MeshNode * n37,
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_MeshEdge.cpp salomesmesh/src/SMDS/SMDS_MeshEdge.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_MeshEdge.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_MeshEdge.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -156,3 +156,4 @@
+   myNodes[1]=node2;
+   return true;
+ }
++
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp salomesmesh/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_PolygonalFaceOfNodes.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -196,3 +196,4 @@
+ {
+   return myNodes[ WrappedIndex( ind )];
+ }
++
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_QuadraticEdge.cpp salomesmesh/src/SMDS/SMDS_QuadraticEdge.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_QuadraticEdge.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_QuadraticEdge.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -182,3 +182,4 @@
+        (this,type, SMDS_ElemIteratorPtr(new _MyNodeIterator(myNodes))));
+   }
+ }
++
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp salomesmesh/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_QuadraticFaceOfNodes.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -306,7 +306,3 @@
+   return myNodes[ ind ];
+ }
+ 
+-SMDSAbs_EntityType SMDS_QuadraticFaceOfNodes::GetEntityType() const
+-{
+-  return NbNodes() == 6 ? SMDSEntity_Quad_Triangle : SMDSEntity_Quad_Quadrangle;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp salomesmesh/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_QuadraticVolumeOfNodes.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -368,16 +368,3 @@
+   return myNodes[ ind ];
+ }
+ 
+-SMDSAbs_EntityType SMDS_QuadraticVolumeOfNodes::GetEntityType() const
+-{
+-  SMDSAbs_EntityType aType = SMDSEntity_Quad_Tetra;
+-  switch(NbNodes())
+-  {
+-  case 10: aType = SMDSEntity_Quad_Tetra;   break;
+-  case 13: aType = SMDSEntity_Quad_Pyramid; break;
+-  case 15: aType = SMDSEntity_Quad_Penta;   break;
+-  case 20:
+-  default: aType = SMDSEntity_Quad_Hexa;    break;
+-  }
+-  return aType;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_VolumeOfFaces.cpp salomesmesh/src/SMDS/SMDS_VolumeOfFaces.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_VolumeOfFaces.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_VolumeOfFaces.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -135,16 +135,3 @@
+ 	myFaces[5]=face6;
+ }
+ 
+-SMDSAbs_EntityType SMDS_VolumeOfFaces::GetEntityType() const
+-{
+-  SMDSAbs_EntityType aType = SMDSEntity_Tetra;
+-  switch(myNbFaces)
+-  {
+-  case 4: aType = SMDSEntity_Tetra;   break;
+-  case 5: aType = SMDSEntity_Pyramid; break;
+-  case 6: aType = SMDSEntity_Penta;   break;
+-  case 8:
+-  default: aType = SMDSEntity_Hexa;    break;
+-  }
+-  return aType;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_VolumeOfNodes.cpp salomesmesh/src/SMDS/SMDS_VolumeOfNodes.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_VolumeOfNodes.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_VolumeOfNodes.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -40,73 +40,73 @@
+ /// 5,1 and 7,3 are an edges.
+ ///////////////////////////////////////////////////////////////////////////////
+ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
+-                const SMDS_MeshNode * node1,
+-                const SMDS_MeshNode * node2,
+-                const SMDS_MeshNode * node3,
+-                const SMDS_MeshNode * node4,
+-                const SMDS_MeshNode * node5,
+-                const SMDS_MeshNode * node6,
+-                const SMDS_MeshNode * node7,
+-                const SMDS_MeshNode * node8)
+-{
+-        myNbNodes = 8;
+-        myNodes = new const SMDS_MeshNode* [myNbNodes];
+-        myNodes[0]=node1;
+-        myNodes[1]=node2;
+-        myNodes[2]=node3;
+-        myNodes[3]=node4;
+-        myNodes[4]=node5;
+-        myNodes[5]=node6;
+-        myNodes[6]=node7;
+-        myNodes[7]=node8;
++		const SMDS_MeshNode * node1,
++		const SMDS_MeshNode * node2,
++		const SMDS_MeshNode * node3,
++		const SMDS_MeshNode * node4,
++		const SMDS_MeshNode * node5,
++		const SMDS_MeshNode * node6,
++		const SMDS_MeshNode * node7,
++		const SMDS_MeshNode * node8)
++{
++	myNbNodes = 8;
++	myNodes = new const SMDS_MeshNode* [myNbNodes];
++	myNodes[0]=node1;
++	myNodes[1]=node2;
++	myNodes[2]=node3;
++	myNodes[3]=node4;
++	myNodes[4]=node5;
++	myNodes[5]=node6;
++	myNodes[6]=node7;
++	myNodes[7]=node8;
+ }
+ 
+ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
+-                const SMDS_MeshNode * node1,
+-                const SMDS_MeshNode * node2,
+-                const SMDS_MeshNode * node3,
+-                const SMDS_MeshNode * node4)
+-{
+-        myNbNodes = 4;
+-        myNodes = new const SMDS_MeshNode* [myNbNodes];
+-        myNodes[0]=node1;
+-        myNodes[1]=node2;
+-        myNodes[2]=node3;
+-        myNodes[3]=node4;
++		const SMDS_MeshNode * node1,
++		const SMDS_MeshNode * node2,
++		const SMDS_MeshNode * node3,
++		const SMDS_MeshNode * node4)
++{
++	myNbNodes = 4;
++	myNodes = new const SMDS_MeshNode* [myNbNodes];
++	myNodes[0]=node1;
++	myNodes[1]=node2;
++	myNodes[2]=node3;
++	myNodes[3]=node4;
+ }
+ 
+ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
+-                const SMDS_MeshNode * node1,
+-                const SMDS_MeshNode * node2,
+-                const SMDS_MeshNode * node3,
+-                const SMDS_MeshNode * node4,
+-                const SMDS_MeshNode * node5)
+-{
+-        myNbNodes = 5;
+-        myNodes = new const SMDS_MeshNode* [myNbNodes];
+-        myNodes[0]=node1;
+-        myNodes[1]=node2;
+-        myNodes[2]=node3;
+-        myNodes[3]=node4;
+-        myNodes[4]=node5;
++		const SMDS_MeshNode * node1,
++		const SMDS_MeshNode * node2,
++		const SMDS_MeshNode * node3,
++		const SMDS_MeshNode * node4,
++		const SMDS_MeshNode * node5)
++{
++	myNbNodes = 5;
++	myNodes = new const SMDS_MeshNode* [myNbNodes];
++	myNodes[0]=node1;
++	myNodes[1]=node2;
++	myNodes[2]=node3;
++	myNodes[3]=node4;
++	myNodes[4]=node5;
+ }
+ 
+ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
+-                const SMDS_MeshNode * node1,
+-                const SMDS_MeshNode * node2,
+-                const SMDS_MeshNode * node3,
+-                const SMDS_MeshNode * node4,
+-                const SMDS_MeshNode * node5,
+-                const SMDS_MeshNode * node6)
+-{
+-        myNbNodes = 6;
+-        myNodes = new const SMDS_MeshNode* [myNbNodes];
+-        myNodes[0]=node1;
+-        myNodes[1]=node2;
+-        myNodes[2]=node3;
+-        myNodes[3]=node4;
+-        myNodes[4]=node5;
+-        myNodes[5]=node6;
++		const SMDS_MeshNode * node1,
++		const SMDS_MeshNode * node2,
++		const SMDS_MeshNode * node3,
++		const SMDS_MeshNode * node4,
++		const SMDS_MeshNode * node5,
++		const SMDS_MeshNode * node6)
++{
++	myNbNodes = 6;
++	myNodes = new const SMDS_MeshNode* [myNbNodes];
++	myNodes[0]=node1;
++	myNodes[1]=node2;
++	myNodes[2]=node3;
++	myNodes[3]=node4;
++	myNodes[4]=node5;
++	myNodes[5]=node6;
+ }
+ 
+ bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
+@@ -139,40 +139,40 @@
+ 
+ void SMDS_VolumeOfNodes::Print(ostream & OS) const
+ {
+-        OS << "volume <" << GetID() << "> : ";
+-        int i;
+-        for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ",";
+-        OS << myNodes[NbNodes()-1]<< ") " << endl;
++	OS << "volume <" << GetID() << "> : ";
++	int i;
++	for (i = 0; i < NbNodes()-1; ++i) OS << myNodes[i] << ",";
++	OS << myNodes[NbNodes()-1]<< ") " << endl;
+ }
+ 
+ int SMDS_VolumeOfNodes::NbFaces() const
+ {
+-        switch(NbNodes())
+-        {
+-        case 4: return 4;
+-        case 5: return 5;
+-        case 6: return 5;
+-        case 8: return 6;
+-        default: MESSAGE("invalid number of nodes");
+-        }
++	switch(NbNodes())
++	{
++	case 4: return 4;
++	case 5: return 5;
++	case 6: return 5;
++	case 8: return 6;
++	default: MESSAGE("invalid number of nodes");
++	}
+         return 0;
+ }
+ 
+ int SMDS_VolumeOfNodes::NbNodes() const
+ {
+-        return myNbNodes;
++	return myNbNodes;
+ }
+ 
+ int SMDS_VolumeOfNodes::NbEdges() const
+ {
+-        switch(NbNodes())
+-        {
+-        case 4: return 6;
+-        case 5: return 8;
+-        case 6: return 9;
+-        case 8: return 12;
+-        default: MESSAGE("invalid number of nodes");
+-        }
++	switch(NbNodes())
++	{
++	case 4: return 6;
++	case 5: return 8;
++	case 6: return 9;
++	case 8: return 12;
++	default: MESSAGE("invalid number of nodes");
++	}
+         return 0;
+ }
+ 
+@@ -234,7 +234,7 @@
+ 
+ SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
+ {
+-        return SMDSAbs_Volume;
++	return SMDSAbs_Volume;
+ }
+ 
+ /*!
+@@ -246,17 +246,3 @@
+ {
+   return myNodes[ ind ];
+ }
+-
+-SMDSAbs_EntityType SMDS_VolumeOfNodes::GetEntityType() const
+-{
+-  SMDSAbs_EntityType aType = SMDSEntity_Tetra;
+-  switch(myNbNodes)
+-  {
+-  case 4: aType = SMDSEntity_Tetra;   break;
+-  case 5: aType = SMDSEntity_Pyramid; break;
+-  case 6: aType = SMDSEntity_Penta;   break;
+-  case 8:
+-  default: aType = SMDSEntity_Hexa;    break;
+-  }
+-  return aType;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMDS/SMDS_VolumeTool.cpp salomesmesh/src/SMDS/SMDS_VolumeTool.cpp
+--- smesh-5.1.2.2.svn55/src/SMDS/SMDS_VolumeTool.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMDS/SMDS_VolumeTool.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -368,8 +368,6 @@
+ // ========================================================
+ // to perform some calculations without linkage to CASCADE
+ // ========================================================
+-namespace
+-{
+ struct XYZ {
+   double x;
+   double y;
+@@ -378,26 +376,25 @@
+   XYZ( double X, double Y, double Z ) { x = X; y = Y; z = Z; }
+   XYZ( const XYZ& other )             { x = other.x; y = other.y; z = other.z; }
+   XYZ( const SMDS_MeshNode* n )       { x = n->X(); y = n->Y(); z = n->Z(); }
+-  inline XYZ operator-( const XYZ& other );
+-  inline XYZ Crossed( const XYZ& other );
+-  inline double Dot( const XYZ& other );
+-  inline double Magnitude();
++  XYZ operator-( const XYZ& other );
++  XYZ Crossed( const XYZ& other );
++  double Dot( const XYZ& other );
++  double Magnitude();
+ };
+-inline XYZ XYZ::operator-( const XYZ& Right ) {
++XYZ XYZ::operator-( const XYZ& Right ) {
+   return XYZ(x - Right.x, y - Right.y, z - Right.z);
+ }
+-inline XYZ XYZ::Crossed( const XYZ& Right ) {
++XYZ XYZ::Crossed( const XYZ& Right ) {
+   return XYZ (y * Right.z - z * Right.y,
+               z * Right.x - x * Right.z,
+               x * Right.y - y * Right.x);
+ }
+-inline double XYZ::Dot( const XYZ& Other ) {
++double XYZ::Dot( const XYZ& Other ) {
+   return(x * Other.x + y * Other.y + z * Other.z);
+ }
+-inline double XYZ::Magnitude() {
++double XYZ::Magnitude() {
+   return sqrt (x * x + y * y + z * z);
+ }
+-}
+ 
+ //=======================================================================
+ //function : SMDS_VolumeTool
+@@ -840,32 +837,6 @@
+   return true;
+ }
+ 
+-//================================================================================
+-/*!
+- * \brief Classify a point
+- *  \param tol - thickness of faces
+- */
+-//================================================================================
+-
+-bool SMDS_VolumeTool::IsOut(double X, double Y, double Z, double tol)
+-{
+-  // LIMITATION: for convex volumes only
+-  XYZ p( X,Y,Z );
+-  for ( int iF = 0; iF < myNbFaces; ++iF )
+-  {
+-    XYZ faceNormal;
+-    if ( !GetFaceNormal( iF, faceNormal.x, faceNormal.y, faceNormal.z ))
+-      continue;
+-    if ( !IsFaceExternal( iF ))
+-      faceNormal = XYZ() - faceNormal; // reverse
+-
+-    XYZ face2p( p - XYZ( myFaceNodes[0] ));
+-    if ( face2p.Dot( faceNormal ) > tol )
+-      return true;
+-  }
+-  return false;
+-}
+-
+ //=======================================================================
+ //function : SetExternalNormal
+ //purpose  : Node order will be so that faces normals are external
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_0D_Algo.cpp salomesmesh/src/SMESH/SMESH_0D_Algo.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_0D_Algo.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_0D_Algo.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESH : implementaion of SMESH idl descriptions
+ //  File   : SMESH_0D_Algo.cxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_0D_Algo.cxx,v 1.2.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #include "SMESH_0D_Algo.hxx"
+ #include "SMESH_Gen.hxx"
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_1D_Algo.cpp salomesmesh/src/SMESH/SMESH_1D_Algo.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_1D_Algo.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_1D_Algo.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_1D_Algo.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_1D_Algo.cxx,v 1.8.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #include "SMESH_1D_Algo.hxx"
+ #include "SMESH_Gen.hxx"
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_2D_Algo.cpp salomesmesh/src/SMESH/SMESH_2D_Algo.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_2D_Algo.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_2D_Algo.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_2D_Algo.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_2D_Algo.cxx,v 1.9.2.2 2008/11/27 12:25:15 abd Exp $
+ //
+ #include "SMESH_2D_Algo.hxx"
+ #include "SMESH_Gen.hxx"
+@@ -34,8 +34,6 @@
+ #include <TopExp.hxx>
+ #include <TopoDS.hxx>
+ 
+-using namespace std;
+-
+ //=============================================================================
+ /*!
+  *  
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_3D_Algo.cpp salomesmesh/src/SMESH/SMESH_3D_Algo.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_3D_Algo.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_3D_Algo.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_3D_Algo.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_3D_Algo.cxx,v 1.9.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #include "SMESH_3D_Algo.hxx"
+ #include "SMESH_Gen.hxx"
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Algo.cpp salomesmesh/src/SMESH/SMESH_Algo.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Algo.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_Algo.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -321,7 +321,7 @@
+   if ( !eSubMesh || !eSubMesh->GetElements()->more() )
+     return false; // edge is not meshed
+ 
+-  //int nbEdgeNodes = 0;
++  int nbEdgeNodes = 0;
+   set < double > paramSet;
+   if ( eSubMesh )
+   {
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Block.cpp salomesmesh/src/SMESH/SMESH_Block.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Block.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_Block.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -952,39 +952,26 @@
+   return id + 1; // shape ids start at 1
+ }
+ 
+-//================================================================================
+-/*!
+- * \brief Return number of wires and a list of oredered edges.
+- *  \param theFace - the face to process
+- *  \param theFirstVertex - the vertex of the outer wire to set first in the returned
+- *         list ( theFirstVertex may be NULL )
+- *  \param theEdges - all ordered edges of theFace (outer edges goes first).
+- *  \param theNbVertexInWires - nb of vertices (== nb of edges) in each wire
+- *  \param theShapeAnalysisAlgo - if true, ShapeAnalysis::OuterWire() is used to find
+- *         the outer wire else BRepTools::OuterWire() is used.
+- *  \retval int - nb of wires
+- * 
+- * Always try to set a seam edge first.
+- * BRepTools::OuterWire() fails e.g. in the case of issue 0020184,
+- * ShapeAnalysis::OuterWire() fails in the case of issue 0020452
+- */
+-//================================================================================
++//=======================================================================
++//function : GetOrderedEdges
++//purpose  : return nb wires and a list of oredered edges
++//=======================================================================
+ 
+ int SMESH_Block::GetOrderedEdges (const TopoDS_Face&   theFace,
+                                   TopoDS_Vertex        theFirstVertex,
+                                   list< TopoDS_Edge >& theEdges,
+-                                  list< int >  &       theNbVertexInWires,
+-                                  const bool           theShapeAnalysisAlgo)
++                                  list< int >  &       theNbVertexInWires)
+ {
+   // put wires in a list, so that an outer wire comes first
+   list<TopoDS_Wire> aWireList;
+-  TopoDS_Wire anOuterWire =
+-    theShapeAnalysisAlgo ? ShapeAnalysis::OuterWire( theFace ) : BRepTools::OuterWire( theFace );
++  //TopoDS_Wire anOuterWire = BRepTools::OuterWire( theFace ); ### issue 0020184
++  TopoDS_Wire anOuterWire = ShapeAnalysis::OuterWire( theFace );
++  //aWireList.push_back( anOuterWire ); ### issue 0020184
+   for ( TopoDS_Iterator wIt (theFace); wIt.More(); wIt.Next() )
+     if ( !anOuterWire.IsSame( wIt.Value() ))
+       aWireList.push_back( TopoDS::Wire( wIt.Value() ));
+     else
+-      aWireList.push_front( TopoDS::Wire( wIt.Value() ));
++      aWireList.push_front( TopoDS::Wire( wIt.Value() ));// ### issue 0020184
+ 
+   // loop on edges of wires
+   theNbVertexInWires.clear();
+@@ -996,8 +983,7 @@
+     for ( iE = 0; wExp.More(); wExp.Next(), iE++ )
+     {
+       TopoDS_Edge edge = wExp.Current();
+-      // commented for issue 0020557, other related ones: 0020526, PAL19080
+-      // edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
++      edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
+       theEdges.push_back( edge );
+     }
+     theNbVertexInWires.push_back( iE );
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Gen.cpp salomesmesh/src/SMESH/SMESH_Gen.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Gen.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_Gen.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -32,8 +32,8 @@
+ #include "SMDS_MeshNode.hxx"
+ 
+ #include "utilities.h"
+-#include "OpUtil.hxx"
+-#include "Utils_ExceptHandlers.hxx"
++//#include "OpUtil.hxx"
++#include "SMESH_ExceptHandlers.hxx"
+ 
+ #include <gp_Pnt.hxx>
+ #include <BRep_Tool.hxx>
+@@ -50,9 +50,9 @@
+ 
+ SMESH_Gen::SMESH_Gen()
+ {
+-        MESSAGE("SMESH_Gen::SMESH_Gen");
+-        _localId = 0;
+-        _hypId = 0;
++	//MESSAGE("SMESH_Gen::SMESH_Gen");
++	_localId = 0;
++	_hypId = 0;
+         _segmentation = 10;
+ }
+ 
+@@ -64,7 +64,7 @@
+ 
+ SMESH_Gen::~SMESH_Gen()
+ {
+-        MESSAGE("SMESH_Gen::~SMESH_Gen");
++	//MESSAGE("SMESH_Gen::~SMESH_Gen");
+ }
+ 
+ //=============================================================================
+@@ -74,26 +74,26 @@
+ //=============================================================================
+ 
+ /*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
+-        throw(SALOME_Exception)
++	throw(SALOME_Exception)
+ {
+ 
+-        MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
+-        // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
++	MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")");
++	// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
+ 
+-        StudyContextStruct *myStudyContext = GetStudyContext(studyId);
++	StudyContextStruct *myStudyContext = GetStudyContext(studyId);
+ 
+-        // create a new hypothesis object, store its ref. in studyContext
++	// create a new hypothesis object, store its ref. in studyContext
+ 
+-        SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
+-        int hypId = myHypothesis->GetID();
+-        myStudyContext->mapHypothesis[hypId] = myHypothesis;
+-        SCRUTE(studyId);
+-        SCRUTE(hypId);
++	SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
++	int hypId = myHypothesis->GetID();
++	myStudyContext->mapHypothesis[hypId] = myHypothesis;
++	SCRUTE(studyId);
++	SCRUTE(hypId);
+ 
+-        // store hypothesis in SMESHDS document
++	// store hypothesis in SMESHDS document
+ 
+-        myStudyContext->myDocument->AddHypothesis(myHypothesis);
+-        return myHypothesis;
++	myStudyContext->myDocument->AddHypothesis(myHypothesis);
++	return myHypothesis;
+ }*/
+ 
+ //=============================================================================
+@@ -103,9 +103,9 @@
+ //=============================================================================
+ 
+ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   MESSAGE("SMESH_Gen::CreateMesh");
+ 
+   // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
+@@ -113,10 +113,10 @@
+ 
+   // create a new SMESH_mesh object
+   SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
+-                                     theStudyId,
+-                                     this,
+-                                     theIsEmbeddedMode,
+-                                     aStudyContext->myDocument);
++				     theStudyId,
++				     this,
++				     theIsEmbeddedMode,
++				     aStudyContext->myDocument);
+   aStudyContext->mapMesh[_localId] = aMesh;
+ 
+   return aMesh;
+@@ -131,8 +131,8 @@
+ bool SMESH_Gen::Compute(SMESH_Mesh &          aMesh,
+                         const TopoDS_Shape &  aShape,
+                         const bool            anUpward,
+-                        const ::MeshDimension aDim,
+-                        TSetOfInt*            aShapesId)
++			const ::MeshDimension aDim,
++			TSetOfInt*            aShapesId)
+ {
+   MESSAGE("SMESH_Gen::Compute");
+ 
+@@ -166,7 +166,7 @@
+         // clear compute state to not show previous compute errors
+         //  if preview invoked less dimension less than previous
+         smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+-        continue;
++	continue;
+       }
+ 
+       if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
+@@ -176,7 +176,7 @@
+       if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
+         ret = false;
+       else if ( aShapesId )
+-        aShapesId->insert( smToCompute->GetId() );
++	aShapesId->insert( smToCompute->GetId() );
+     }
+     return ret;
+   }
+@@ -201,7 +201,7 @@
+       
+       // check for preview dimension limitations
+       if ( aShapesId && aShapeDim > (int)aDim )
+-        continue;
++	continue;
+ 
+       SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
+       if ( algo && !algo->NeedDescretBoundary() )
+@@ -209,11 +209,11 @@
+         if ( algo->SupportSubmeshes() )
+           smWithAlgoSupportingSubmeshes.push_back( smToCompute );
+         else
+-        {
++	{
+           smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+-          if ( aShapesId )
+-            aShapesId->insert( smToCompute->GetId() );
+-        }
++	  if ( aShapesId )
++	    aShapesId->insert( smToCompute->GetId() );
++	}
+       }
+     }
+     // ------------------------------------------------------------
+@@ -240,14 +240,14 @@
+         SMESH_subMesh* smToCompute = smIt->next();
+ 
+         const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
+-        const int aShapeDim = GetShapeDim( aSubShape );
++	const int aShapeDim = GetShapeDim( aSubShape );
+         //if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
+-        if ( aShapeDim < 1 ) continue;
++	if ( aShapeDim < 1 ) continue;
+ 
+-        // check for preview dimension limitations
+-        if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
+-          continue;
+-        
++	// check for preview dimension limitations
++	if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
++	  continue;
++	
+         SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
+         filter
+           .And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
+@@ -265,20 +265,18 @@
+     // apply the algos that do not require descretized boundaries
+     // ----------------------------------------------------------
+     for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
+-    {
+-      sm = *subIt;
+       if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
+       {
+-        const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
+-        // check for preview dimension limitations
+-        if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
+-          continue;
++	const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
++	// check for preview dimension limitations
++	if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
++	  continue;
+ 
+         sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+-        if ( aShapesId )
+-          aShapesId->insert( sm->GetId() );
++	if ( aShapesId )
++	  aShapesId->insert( sm->GetId() );
+       }
+-    }
++
+     // -----------------------------------------------
+     // mesh the rest subshapes starting from vertices
+     // -----------------------------------------------
+@@ -289,141 +287,6 @@
+   return ret;
+ }
+ 
+-
+-//=============================================================================
+-/*!
+- * Evaluate a mesh
+- */
+-//=============================================================================
+-
+-bool SMESH_Gen::Evaluate(SMESH_Mesh &          aMesh,
+-                         const TopoDS_Shape &  aShape,
+-                         MapShapeNbElems&      aResMap,
+-                         const bool            anUpward,
+-                         TSetOfInt*            aShapesId)
+-{
+-  MESSAGE("SMESH_Gen::Evaluate");
+-
+-  bool ret = true;
+-
+-  SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
+-
+-  const bool includeSelf = true;
+-  const bool complexShapeFirst = true;
+-  SMESH_subMeshIteratorPtr smIt;
+-
+-  if ( anUpward ) { // is called from below code here
+-    // -----------------------------------------------
+-    // mesh all the subshapes starting from vertices
+-    // -----------------------------------------------
+-    smIt = sm->getDependsOnIterator(includeSelf, !complexShapeFirst);
+-    while ( smIt->more() ) {
+-      SMESH_subMesh* smToCompute = smIt->next();
+-
+-      // do not mesh vertices of a pseudo shape
+-      const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
+-      //if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX )
+-      //  continue;
+-      if ( !aMesh.HasShapeToMesh() ) {
+-        if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE ||
+-            aShType == TopAbs_SHELL )
+-          continue;
+-      }
+-
+-      smToCompute->Evaluate(aResMap);
+-      if( aShapesId )
+-        aShapesId->insert( smToCompute->GetId() );
+-    }
+-    return ret;
+-  }
+-  else {
+-    // -----------------------------------------------------------------
+-    // apply algos that DO NOT require descretized boundaries and DO NOT
+-    // support submeshes, starting from the most complex shapes
+-    // and collect submeshes with algos that DO support submeshes
+-    // -----------------------------------------------------------------
+-    list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes;
+-    smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst);
+-    while ( smIt->more() ) {
+-      SMESH_subMesh* smToCompute = smIt->next();
+-      const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
+-      const int aShapeDim = GetShapeDim( aSubShape );
+-      if ( aShapeDim < 1 ) break;
+-      
+-      SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
+-      if ( algo && !algo->NeedDescretBoundary() ) {
+-        if ( algo->SupportSubmeshes() ) {
+-          smWithAlgoSupportingSubmeshes.push_back( smToCompute );
+-        }
+-        else {
+-          smToCompute->Evaluate(aResMap);
+-          if ( aShapesId )
+-            aShapesId->insert( smToCompute->GetId() );
+-        }
+-      }
+-    }
+-    // ------------------------------------------------------------
+-    // compute submeshes under shapes with algos that DO NOT require
+-    // descretized boundaries and DO support submeshes
+-    // ------------------------------------------------------------
+-    list< SMESH_subMesh* >::reverse_iterator subIt, subEnd;
+-    subIt  = smWithAlgoSupportingSubmeshes.rbegin();
+-    subEnd = smWithAlgoSupportingSubmeshes.rend();
+-    // start from lower shapes
+-    for ( ; subIt != subEnd; ++subIt ) {
+-      sm = *subIt;
+-
+-      // get a shape the algo is assigned to
+-      TopoDS_Shape algoShape;
+-      if ( !GetAlgo( aMesh, sm->GetSubShape(), & algoShape ))
+-        continue; // strange...
+-
+-      // look for more local algos
+-      smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst);
+-      while ( smIt->more() ) {
+-        SMESH_subMesh* smToCompute = smIt->next();
+-
+-        const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
+-        const int aShapeDim = GetShapeDim( aSubShape );
+-        if ( aShapeDim < 1 ) continue;
+-
+-        //const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
+-
+-        SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
+-        filter
+-          .And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
+-          .And( SMESH_HypoFilter::IsMoreLocalThan( algoShape ));
+-
+-        if ( SMESH_Algo* subAlgo = (SMESH_Algo*) aMesh.GetHypothesis( aSubShape, filter, true )) {
+-          SMESH_Hypothesis::Hypothesis_Status status;
+-          if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
+-            // mesh a lower smToCompute starting from vertices
+-            Evaluate( aMesh, aSubShape, aResMap, /*anUpward=*/true, aShapesId );
+-        }
+-      }
+-    }
+-    // ----------------------------------------------------------
+-    // apply the algos that do not require descretized boundaries
+-    // ----------------------------------------------------------
+-    for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
+-    {
+-      sm = *subIt;
+-      sm->Evaluate(aResMap);
+-      if ( aShapesId )
+-        aShapesId->insert( sm->GetId() );
+-    }
+-
+-    // -----------------------------------------------
+-    // mesh the rest subshapes starting from vertices
+-    // -----------------------------------------------
+-    ret = Evaluate( aMesh, aShape, aResMap, /*anUpward=*/true, aShapesId );
+-  }
+-
+-  MESSAGE( "VSR - SMESH_Gen::Evaluate() finished, OK = " << ret);
+-  return ret;
+-}
+-
+-
+ //=======================================================================
+ //function : checkConformIgnoredAlgos
+ //purpose  :
+@@ -434,7 +297,7 @@
+                                      const SMESH_Algo*         aGlobIgnoAlgo,
+                                      const SMESH_Algo*         aLocIgnoAlgo,
+                                      bool &                    checkConform,
+-                                     set<SMESH_subMesh*>&      aCheckedMap,
++                                     map<int, SMESH_subMesh*>& aCheckedMap,
+                                      list< SMESH_Gen::TAlgoStateError > & theErrors)
+ {
+   ASSERT( aSubMesh );
+@@ -489,15 +352,19 @@
+         }
+ 
+         // sub-algos will be hidden by a local <algo>
+-        SMESH_subMeshIteratorPtr revItSub =
+-          aSubMesh->getDependsOnIterator( /*includeSelf=*/false, /*complexShapeFirst=*/true);
++        const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn();
++        map<int, SMESH_subMesh*>::const_reverse_iterator revItSub;
+         bool checkConform2 = false;
+-        while ( revItSub->more() )
++        for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++)
+         {
+-          SMESH_subMesh* sm = revItSub->next();
+-          checkConformIgnoredAlgos (aMesh, sm, aGlobIgnoAlgo,
++          checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
+                                     algo, checkConform2, aCheckedMap, theErrors);
+-          aCheckedMap.insert( sm );
++          int key = (*revItSub).first;
++	  SMESH_subMesh* sm = (*revItSub).second;
++          if ( aCheckedMap.find( key ) == aCheckedMap.end() )
++          {
++            aCheckedMap[ key ] = sm;
++          }
+         }
+       }
+     }
+@@ -518,7 +385,7 @@
+                          const int                 aTopAlgoDim,
+                          bool*                     globalChecked,
+                          const bool                checkNoAlgo,
+-                         set<SMESH_subMesh*>&      aCheckedMap,
++                         map<int, SMESH_subMesh*>& aCheckedMap,
+                          list< SMESH_Gen::TAlgoStateError > & theErrors)
+ {
+   if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
+@@ -591,13 +458,15 @@
+   if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
+   {
+     bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
+-    SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
+-                                                                     /*complexShapeFirst=*/false);
+-    while ( itsub->more() )
++    const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn();
++    map<int, SMESH_subMesh*>::const_iterator itsub;
++    for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+     {
+       // sub-meshes should not be checked further more
+-      SMESH_subMesh* sm = itsub->next();
+-      aCheckedMap.insert( sm );
++      int key = (*itsub).first;
++      SMESH_subMesh* sm = (*itsub).second;
++      if ( aCheckedMap.find( key ) == aCheckedMap.end() )
++        aCheckedMap[ key ] = sm;
+ 
+       if (isTopLocalAlgo)
+       {
+@@ -691,25 +560,39 @@
+     }
+   }
+ 
+-  set<SMESH_subMesh*> aCheckedSubs;
++  const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
++  map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
++  map<int, SMESH_subMesh*> aCheckedMap;
+   bool checkConform = ( !theMesh.IsNotConformAllowed() );
++  int aKey = 1;
++  SMESH_subMesh* smToCheck = sm;
+ 
+   // loop on theShape and its sub-shapes
+-  SMESH_subMeshIteratorPtr revItSub = sm->getDependsOnIterator( /*includeSelf=*/true,
+-                                                                /*complexShapeFirst=*/true);
+-  while ( revItSub->more() )
++  while ( smToCheck )
+   {
+-    SMESH_subMesh* smToCheck = revItSub->next();
+     if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
+       break;
+ 
+-    if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
++    if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
+       if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
+-                                     0, checkConform, aCheckedSubs, theErrors))
++                                     0, checkConform, aCheckedMap, theErrors))
+         ret = false;
+ 
+     if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
+       hasAlgo = true;
++
++    // next subMesh
++    if (revItSub != smMap.rend())
++    {
++      aKey = (*revItSub).first;
++      smToCheck = (*revItSub).second;
++      revItSub++;
++    }
++    else
++    {
++      smToCheck = 0;
++    }
++
+   }
+ 
+   // ----------------------------------------------------------------
+@@ -729,26 +612,36 @@
+       break;
+     }
+   }
++  aCheckedMap.clear();
++  smToCheck = sm;
++  revItSub = smMap.rbegin();
+   bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
+   bool globalChecked[] = { false, false, false, false };
+ 
+   // loop on theShape and its sub-shapes
+-  aCheckedSubs.clear();
+-  revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, /*complexShapeFirst=*/true);
+-  while ( revItSub->more() )
++  while ( smToCheck )
+   {
+-    SMESH_subMesh* smToCheck = revItSub->next();
+     if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
+       break;
+ 
+-    if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
++    if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
+       if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
+-                         globalChecked, checkNoAlgo, aCheckedSubs, theErrors))
++                         globalChecked, checkNoAlgo, aCheckedMap, theErrors))
+       {
+         ret = false;
+         if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
+           checkNoAlgo = false;
+       }
++
++    // next subMesh
++    if (revItSub != smMap.rend())
++    {
++      aKey = (*revItSub).first;
++      smToCheck = (*revItSub).second;
++      revItSub++;
++    }
++    else
++      smToCheck = 0;
+   }
+ 
+   if ( !hasAlgo ) {
+@@ -797,16 +690,16 @@
+ 
+ StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId)
+ {
+-        // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
++	// Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
+ 
+-        if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
+-        {
+-                _mapStudyContext[studyId] = new StudyContextStruct;
+-                _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
+-        }
+-        StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
++	if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
++	{
++		_mapStudyContext[studyId] = new StudyContextStruct;
++		_mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
++	}
++	StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
+ //   ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end());
+-        return myStudyContext;
++	return myStudyContext;
+ }
+ 
+ // //=============================================================================
+@@ -871,6 +764,6 @@
+ 
+ int SMESH_Gen::GetANewId()
+ {
+-        //MESSAGE("SMESH_Gen::GetANewId");
+-        return _hypId++;
++	//MESSAGE("SMESH_Gen::GetANewId");
++	return _hypId++;
+ }
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Group.cpp salomesmesh/src/SMESH/SMESH_Group.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Group.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_Group.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_Group.cxx
+ //  Author : Michael Sazonov (OCC)
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Group.cxx,v 1.7.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #include "SMESH_Group.hxx"
+ #include "SMESH_Mesh.hxx"
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_HypoFilter.cpp salomesmesh/src/SMESH/SMESH_HypoFilter.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_HypoFilter.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_HypoFilter.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESH : implementaion of SMESH idl descriptions
+ //  File   : SMESH_HypoFilter.cxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_HypoFilter.cxx,v 1.6.2.2 2008/11/27 12:25:15 abd Exp $
+ //
+ #include "SMESH_HypoFilter.hxx"
+ 
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Hypothesis.cpp salomesmesh/src/SMESH/SMESH_Hypothesis.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Hypothesis.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_Hypothesis.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : SMESH_Hypothesis.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Hypothesis.cxx,v 1.10 2009/02/17 05:27:39 vsr Exp $
+ //
+ #include "SMESH_Hypothesis.hxx"
+ #include "SMESH_Gen.hxx"
+@@ -38,8 +39,8 @@
+ //=============================================================================
+ 
+ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
+-                                   int studyId,
+-                                   SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
++				   int studyId,
++				   SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId)
+ {
+   //MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis");
+   _gen = gen;
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Mesh.cpp salomesmesh/src/SMESH/SMESH_Mesh.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Mesh.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_Mesh.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : SMESH_Mesh.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Mesh.cxx,v 1.24.2.7 2008/11/27 12:25:15 abd Exp $
+ //
+ #include "SMESH_Mesh.hxx"
+ #include "SMESH_subMesh.hxx"
+@@ -58,7 +59,7 @@
+ #include <TopTools_MapOfShape.hxx>
+ #include <TopoDS_Iterator.hxx>
+ 
+-#include "Utils_ExceptHandlers.hxx"
++#include "SMESH_ExceptHandlers.hxx"
+ 
+ #ifdef _DEBUG_
+ static int MYDEBUG = 0;
+@@ -66,6 +67,8 @@
+ static int MYDEBUG = 0;
+ #endif
+ 
++using namespace std;
++
+ #define cSMESH_Hyp(h) static_cast<const SMESH_Hypothesis*>(h)
+ 
+ typedef SMESH_HypoFilter THypType;
+@@ -77,13 +80,13 @@
+ //=============================================================================
+ 
+ SMESH_Mesh::SMESH_Mesh(int               theLocalId, 
+-                       int               theStudyId, 
+-                       SMESH_Gen*        theGen,
+-                       bool              theIsEmbeddedMode,
+-                       SMESHDS_Document* theDocument):
++		       int               theStudyId, 
++		       SMESH_Gen*        theGen,
++		       bool              theIsEmbeddedMode,
++		       SMESHDS_Document* theDocument):
+   _groupId( 0 ), _nbSubShapes( 0 )
+ {
+-  MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
++  //MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
+   _id            = theLocalId;
+   _studyId       = theStudyId;
+   _gen           = theGen;
+@@ -104,7 +107,7 @@
+ 
+ SMESH_Mesh::~SMESH_Mesh()
+ {
+-  INFOS("SMESH_Mesh::~SMESH_Mesh");
++  //INFOS("SMESH_Mesh::~SMESH_Mesh");
+ 
+   // issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study
+   //   Notify event listeners at least that something happens
+@@ -133,8 +136,9 @@
+   if ( !aShape.IsNull() && _isShapeToMesh ) {
+     if ( aShape.ShapeType() != TopAbs_COMPOUND && // group contents is allowed to change
+          _myMeshDS->ShapeToMesh().ShapeType() != TopAbs_COMPOUND )
+-      throw SALOME_Exception(LOCALIZED ("a shape to mesh has already been defined"));
++      throw SMESH_Exception(LOCALIZED ("a shape to mesh has already been defined"));
+   }
++  
+   // clear current data
+   if ( !_myMeshDS->ShapeToMesh().IsNull() )
+   {
+@@ -160,7 +164,6 @@
+     // clear SMESHDS
+     TopoDS_Shape aNullShape;
+     _myMeshDS->ShapeToMesh( aNullShape );
+-
+     _shapeDiagonal = 0.0;
+   }
+ 
+@@ -321,14 +324,14 @@
+   if ( SMESH_subMesh *sm = GetSubMeshContaining( theShapeId ) )
+   {
+     SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
+-                                                             /*complexShapeFirst=*/false);
++							     /*complexShapeFirst=*/false);
+     while ( smIt->more() )
+     {
+       sm = smIt->next();
+       TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();      
+       if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID )
+-        // all other shapes depends on vertices so they are already cleaned
+-        sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
++	// all other shapes depends on vertices so they are already cleaned
++	sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
+       // to recompute even if failed
+       sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+     }
+@@ -344,7 +347,7 @@
+ {
+   if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
+   if(_isShapeToMesh)
+-    throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
++    throw SMESH_Exception(LOCALIZED("a shape to mesh has already been defined"));
+   _isShapeToMesh = false;
+   DriverUNV_R_SMDS_Mesh myReader;
+   myReader.SetMesh(_myMeshDS);
+@@ -369,21 +372,21 @@
+ 
+       SMESH_Group* aSMESHGroup = AddGroup( aSubGroup->GetType(), aName.c_str(), aId );
+       if ( aSMESHGroup ) {
+-        if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<<aName);      
+-        SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
+-        if ( aGroupDS ) {
+-          aGroupDS->SetStoreName(aName.c_str());
+-          aSubGroup->InitIterator();
+-          const SMDS_MeshElement* aElement = 0;
+-          while (aSubGroup->More()) {
+-            aElement = aSubGroup->Next();
+-            if (aElement) {
+-              aGroupDS->SMDSGroup().Add(aElement);
+-            }
+-          }
+-          if (aElement)
+-            aGroupDS->SetType(aElement->GetType());
+-        }
++	if(MYDEBUG) MESSAGE("UNVToMesh - group added: "<<aName);      
++	SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
++	if ( aGroupDS ) {
++	  aGroupDS->SetStoreName(aName.c_str());
++	  aSubGroup->InitIterator();
++	  const SMDS_MeshElement* aElement = 0;
++	  while (aSubGroup->More()) {
++	    aElement = aSubGroup->Next();
++	    if (aElement) {
++	      aGroupDS->SMDSGroup().Add(aElement);
++	    }
++	  }
++	  if (aElement)
++	    aGroupDS->SetType(aElement->GetType());
++	}
+       }
+     }
+   }
+@@ -397,7 +400,7 @@
+ 
+ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
+ {
+-  throw SALOME_Exception(LOCALIZED ("Not implemented ..."));
++  throw SMESH_Exception(LOCALIZED ("Not implemented ..."));
+   return 0;
+ }
+ 
+@@ -410,7 +413,7 @@
+ {
+   if(MYDEBUG) MESSAGE("STLToMesh - theFileName = "<<theFileName);
+   if(_isShapeToMesh)
+-    throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
++    throw SMESH_Exception(LOCALIZED("a shape to mesh has already been defined"));
+   _isShapeToMesh = false;
+   DriverSTL_R_SMDS_Mesh myReader;
+   myReader.SetMesh(_myMeshDS);
+@@ -435,7 +438,7 @@
+ {
+   if(MYDEBUG) MESSAGE("DATToMesh - theFileName = "<<theFileName);
+   if(_isShapeToMesh)
+-	throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
++	throw SMESH_Exception(LOCALIZED("a shape to mesh has already been defined"));
+   _isShapeToMesh = true;
+   DriverDAT_R_SMDS_Mesh myReader;
+   myReader.SetMesh(_myMeshDS);
+@@ -459,9 +462,9 @@
+ 
+ SMESH_Hypothesis::Hypothesis_Status
+   SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
+-                            int                  anHypId  ) throw(SALOME_Exception)
++                            int                  anHypId  ) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   if(MYDEBUG) MESSAGE("SMESH_Mesh::AddHypothesis");
+ 
+   SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
+@@ -503,7 +506,7 @@
+       SCRUTE(_studyId);
+       SCRUTE(anHypId);
+     }
+-    throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
++    throw SMESH_Exception(LOCALIZED("hypothesis does not exist"));
+   }
+ 
+   SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
+@@ -570,9 +573,9 @@
+ 
+ SMESH_Hypothesis::Hypothesis_Status
+   SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape,
+-                               int anHypId)throw(SALOME_Exception)
++                               int anHypId)throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   if(MYDEBUG) MESSAGE("SMESH_Mesh::RemoveHypothesis");
+   
+   SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
+@@ -603,7 +606,7 @@
+ 
+   StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
+   if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end())
+-    throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
++    throw SMESH_Exception(LOCALIZED("hypothesis does not exist"));
+   
+   SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId];
+   int hypType = anHyp->GetType();
+@@ -663,9 +666,9 @@
+ 
+ const std::list<const SMESHDS_Hypothesis*>&
+ SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetHypothesis(aSubShape);
+ }
+ 
+@@ -792,9 +795,9 @@
+  */
+ //=============================================================================
+ 
+-const std::list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SALOME_Exception)
++const std::list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   if(MYDEBUG) MESSAGE("SMESH_Mesh::GetLog");
+   return _myMeshDS->GetScript()->GetCommands();
+ }
+@@ -804,9 +807,9 @@
+  * 
+  */
+ //=============================================================================
+-void SMESH_Mesh::ClearLog() throw(SALOME_Exception)
++void SMESH_Mesh::ClearLog() throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   if(MYDEBUG) MESSAGE("SMESH_Mesh::ClearLog");
+   _myMeshDS->GetScript()->Clear();
+ }
+@@ -818,9 +821,9 @@
+ //=============================================================================
+ 
+ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   SMESH_subMesh *aSubMesh;
+   int index = _myMeshDS->ShapeToIndex(aSubShape);
+ 
+@@ -828,10 +831,7 @@
+   if (( !index || index > _nbSubShapes ) && aSubShape.ShapeType() == TopAbs_COMPOUND ) {
+     TopoDS_Iterator it( aSubShape );
+     if ( it.More() )
+-    {
+       index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );
+-      if ( index > _nbSubShapes ) _nbSubShapes = index; // not to create sm for this group again
+-    }
+   }
+ //   if ( !index )
+ //     return NULL; // neither sub-shape nor a group
+@@ -857,9 +857,9 @@
+ //=============================================================================
+ 
+ SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) const
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   SMESH_subMesh *aSubMesh = NULL;
+   
+   int index = _myMeshDS->ShapeToIndex(aSubShape);
+@@ -878,9 +878,9 @@
+ //=============================================================================
+ 
+ SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const int aShapeID) const
+-throw(SALOME_Exception)
++throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   
+   map <int, SMESH_subMesh *>::const_iterator i_sm = _mapSubMesh.find(aShapeID);
+   if (i_sm == _mapSubMesh.end())
+@@ -895,9 +895,9 @@
+ 
+ std::list<SMESH_subMesh*>
+ SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   std::list<SMESH_subMesh*> found;
+ 
+   SMESH_subMesh * subMesh = GetSubMeshContaining(aSubShape);
+@@ -969,9 +969,9 @@
+ 
+ const list < SMESH_subMesh * >&
+ SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
+   map < int, SMESH_subMesh * >::iterator itsm;
+   _subMeshesUsingHypothesisList.clear();
+@@ -991,7 +991,7 @@
+ 
+ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* hyp)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+ 
+   const SMESH_Algo *foundAlgo = 0;
+   SMESH_HypoFilter algoKind, compatibleHypoKind;
+@@ -1042,15 +1042,15 @@
+  *  Auto color functionality
+  */
+ //=============================================================================
+-void SMESH_Mesh::SetAutoColor(bool theAutoColor) throw(SALOME_Exception)
++void SMESH_Mesh::SetAutoColor(bool theAutoColor) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   _isAutoColor = theAutoColor;
+ }
+ 
+-bool SMESH_Mesh::GetAutoColor() throw(SALOME_Exception)
++bool SMESH_Mesh::GetAutoColor() throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _isAutoColor;
+ }
+ 
+@@ -1062,22 +1062,22 @@
+ 
+ bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
+ {
+-  throw SALOME_Exception(LOCALIZED ("Not implemented ..."));
+-  return false;
++  throw SMESH_Exception(LOCALIZED ("Not implemented ..."));
++  return 0;
+ }
+ 
+ void SMESH_Mesh::ExportMED(const char *file,
+-                           const char* theMeshName,
+-                           bool theAutoGroups,
+-                           int theVersion)
+-  throw(SALOME_Exception)
++			   const char* theMeshName, 
++			   bool theAutoGroups,
++			   int theVersion)
++  throw(SMESH_Exception)
+ {
+-  throw SALOME_Exception(LOCALIZED ("Not implemented ..."));
++  throw SMESH_Exception(LOCALIZED ("Not implemented ..."));
+ }
+ 
+-void SMESH_Mesh::ExportDAT(const char *file) throw(SALOME_Exception)
++void SMESH_Mesh::ExportDAT(const char *file) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   DriverDAT_W_SMDS_Mesh myWriter;
+   myWriter.SetFile(string(file));
+   myWriter.SetMesh(_myMeshDS);
+@@ -1085,9 +1085,9 @@
+   myWriter.Perform();
+ }
+ 
+-void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception)
++void SMESH_Mesh::ExportUNV(const char *file) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   DriverUNV_W_SMDS_Mesh myWriter;
+   myWriter.SetFile(string(file));
+   myWriter.SetMesh(_myMeshDS);
+@@ -1106,9 +1106,9 @@
+   myWriter.Perform();
+ }
+ 
+-void SMESH_Mesh::ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception)
++void SMESH_Mesh::ExportSTL(const char *file, const bool isascii) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   DriverSTL_W_SMDS_Mesh myWriter;
+   myWriter.SetFile(string(file));
+   myWriter.SetIsAscii( isascii );
+@@ -1123,9 +1123,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbNodes() throw(SALOME_Exception)
++int SMESH_Mesh::NbNodes() throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->NbNodes();
+ }
+ 
+@@ -1135,21 +1135,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::Nb0DElements() throw(SALOME_Exception)
+-{
+-  Unexpect aCatch(SalomeException);
+-  return _myMeshDS->GetMeshInfo().Nb0DElements();
+-}
+-
+-//================================================================================
+-/*!
+- * \brief  Return number of edges of given order in the mesh
+- */
+-//================================================================================
+-
+-int SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbEdges(order);
+ }
+ 
+@@ -1159,9 +1147,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbFaces(order);
+ }
+ 
+@@ -1171,9 +1159,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbTriangles(order);
+ }
+ 
+@@ -1183,9 +1171,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbQuadrangles(order);
+ }
+ 
+@@ -1195,9 +1183,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbPolygons() throw(SALOME_Exception)
++int SMESH_Mesh::NbPolygons() throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbPolygons();
+ }
+ 
+@@ -1207,9 +1195,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbVolumes(order);
+ }
+ 
+@@ -1219,9 +1207,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbTetras(order);
+ }
+ 
+@@ -1231,9 +1219,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbHexas(order);
+ }
+ 
+@@ -1243,9 +1231,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbPyramids(order);
+ }
+ 
+@@ -1255,9 +1243,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
++int SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbPrisms(order);
+ }
+ 
+@@ -1267,9 +1255,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbPolyhedrons() throw(SALOME_Exception)
++int SMESH_Mesh::NbPolyhedrons() throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->GetMeshInfo().NbPolyhedrons();
+ }
+ 
+@@ -1279,9 +1267,9 @@
+  */
+ //================================================================================
+ 
+-int SMESH_Mesh::NbSubMesh() throw(SALOME_Exception)
++int SMESH_Mesh::NbSubMesh() throw(SMESH_Exception)
+ {
+-  Unexpect aCatch(SalomeException);
++  Unexpect aCatch(SmeshException);
+   return _myMeshDS->NbSubMesh();
+ }
+ 
+@@ -1316,7 +1304,7 @@
+ 
+ SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
+                                    const char*               theName,
+-                                   int&                      theId,
++				   int&                      theId,
+                                    const TopoDS_Shape&       theShape)
+ {
+   if (_mapGroup.find(_groupId) != _mapGroup.end())
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_MeshEditor.cpp salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_MeshEditor.cpp	2012-05-04 05:32:54.000000000 -0500
++++ salomesmesh/src/SMESH/SMESH_MeshEditor.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,11 @@
+ // Created   : Mon Apr 12 16:10:22 2004
+ // Author    : Edward AGAPOV (eap)
+ //
++#ifdef _MSC_VER
++#define _USE_MATH_DEFINES
++#endif // _MSC_VER
++#include <cmath>
++
+ #include "SMESH_MeshEditor.hxx"
+ 
+ #include "SMDS_FaceOfNodes.hxx"
+@@ -47,7 +52,6 @@
+ #include "utilities.h"
+ 
+ #include <BRep_Tool.hxx>
+-#include <BRepClass3d_SolidClassifier.hxx>
+ #include <ElCLib.hxx>
+ #include <Extrema_GenExtPS.hxx>
+ #include <Extrema_POnSurf.hxx>
+@@ -55,14 +59,12 @@
+ #include <GeomAdaptor_Surface.hxx>
+ #include <Geom_Curve.hxx>
+ #include <Geom_Surface.hxx>
+-#include <Precision.hxx>
++#include <Standard_Version.hxx>
+ #include <TColStd_ListOfInteger.hxx>
+-#include <TopAbs_State.hxx>
+ #include <TopExp.hxx>
+ #include <TopExp_Explorer.hxx>
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+ #include <TopTools_ListOfShape.hxx>
+-#include <TopTools_SequenceOfShape.hxx>
+ #include <TopoDS.hxx>
+ #include <TopoDS_Face.hxx>
+ #include <gp.hxx>
+@@ -78,8 +80,10 @@
+ 
+ #include <map>
+ #include <set>
+-#include <numeric>
+-#include <limits>
++
++#ifndef PI
++#define PI M_PI
++#endif
+ 
+ #define cast2Node(elem) static_cast<const SMDS_MeshNode*>( elem )
+ 
+@@ -92,23 +96,8 @@
+ //typedef TNodeOfNodeVecMap::iterator                                  TNodeOfNodeVecMapItr;
+ //typedef map<const SMDS_MeshElement*, vector<TNodeOfNodeVecMapItr> >  TElemOfVecOfMapNodesMap;
+ 
+-//=======================================================================
+-/*!
+- * \brief SMDS_MeshNode -> gp_XYZ convertor
+- */
+-//=======================================================================
+-
+-struct TNodeXYZ : public gp_XYZ
+-{
++struct TNodeXYZ : public gp_XYZ {
+   TNodeXYZ( const SMDS_MeshNode* n ):gp_XYZ( n->X(), n->Y(), n->Z() ) {}
+-  double Distance( const SMDS_MeshNode* n )
+-  {
+-    return gp_Vec( *this, TNodeXYZ( n )).Magnitude();
+-  }
+-  double SquareDistance( const SMDS_MeshNode* n )
+-  {
+-    return gp_Vec( *this, TNodeXYZ( n )).SquareMagnitude();
+-  }
+ };
+ 
+ //=======================================================================
+@@ -286,17 +275,17 @@
+             smmap.insert( sm );
+     }
+     // Find sub-meshes to notify about modification
+-    //     SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+-    //     while ( nodeIt->more() ) {
+-    //       const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+-    //       const SMDS_PositionPtr& aPosition = node->GetPosition();
+-    //       if ( aPosition.get() ) {
+-    //         if ( int aShapeID = aPosition->GetShapeId() ) {
+-    //           if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( aShapeID ) )
+-    //             smmap.insert( sm );
+-    //         }
+-    //       }
+-    //     }
++//     SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
++//     while ( nodeIt->more() ) {
++//       const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
++//       const SMDS_PositionPtr& aPosition = node->GetPosition();
++//       if ( aPosition.get() ) {
++//         if ( int aShapeID = aPosition->GetShapeId() ) {
++//           if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( aShapeID ) )
++//             smmap.insert( sm );
++//         }
++//       }
++//     }
+ 
+     // Do remove
+     if ( isNodes )
+@@ -312,9 +301,9 @@
+       (*smIt)->ComputeStateEngine( SMESH_subMesh::MESH_ENTITY_REMOVED );
+   }
+ 
+-  //   // Check if the whole mesh becomes empty
+-  //   if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( 1 ) )
+-  //     sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
++//   // Check if the whole mesh becomes empty
++//   if ( SMESH_subMesh * sm = GetMesh()->GetSubMeshContaining( 1 ) )
++//     sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+ 
+   return true;
+ }
+@@ -1373,7 +1362,7 @@
+                 const SMDS_MeshNode *    n1,
+                 const SMDS_MeshNode *    n2)
+ {
+-  double angle = 2*M_PI; // bad angle
++  double angle = 2*PI; // bad angle
+ 
+   // get normals
+   SMESH::Controls::TSequenceOfXYZ P1, P2;
+@@ -1428,7 +1417,7 @@
+ // and able to return nodes by that ID
+ // =================================================
+ class LinkID_Gen {
+-public:
++ public:
+ 
+   LinkID_Gen( const SMESHDS_Mesh* theMesh )
+     :myMesh( theMesh ), myMaxID( theMesh->MaxNodeID() + 1)
+@@ -1451,7 +1440,7 @@
+     return true;
+   }
+ 
+-private:
++ private:
+   LinkID_Gen();
+   const SMESHDS_Mesh* myMesh;
+   long                myMaxID;
+@@ -1760,15 +1749,15 @@
+ //=============================================================================
+ static void swap( int i1, int i2, int idNodes[], gp_Pnt P[] )
+ {
+-if ( i1 == i2 )
+-return;
+-int tmp = idNodes[ i1 ];
+-idNodes[ i1 ] = idNodes[ i2 ];
+-idNodes[ i2 ] = tmp;
+-gp_Pnt Ptmp = P[ i1 ];
+-P[ i1 ] = P[ i2 ];
+-P[ i2 ] = Ptmp;
+-DUMPSO( i1 << "(" << idNodes[ i2 ] << ") <-> " << i2 << "(" << idNodes[ i1 ] << ")");
++  if ( i1 == i2 )
++    return;
++  int tmp = idNodes[ i1 ];
++  idNodes[ i1 ] = idNodes[ i2 ];
++  idNodes[ i2 ] = tmp;
++  gp_Pnt Ptmp = P[ i1 ];
++  P[ i1 ] = P[ i2 ];
++  P[ i2 ] = Ptmp;
++  DUMPSO( i1 << "(" << idNodes[ i2 ] << ") <-> " << i2 << "(" << idNodes[ i1 ] << ")");
+ }
+ 
+ //=======================================================================
+@@ -1779,7 +1768,7 @@
+ //=======================================================================
+ 
+ int SMESH_MeshEditor::SortQuadNodes (const SMDS_Mesh * theMesh,
+-int               idNodes[] )
++                                     int               idNodes[] )
+ {
+   gp_Pnt P[4];
+   int i;
+@@ -1808,10 +1797,10 @@
+       i = 1;
+     swap ( i, i + 1, idNodes, P );
+ 
+-    //     for ( int ii = 0; ii < 4; ii++ ) {
+-    //       const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] );
+-    //       DUMPSO( ii << "(" << idNodes[ii] <<") : "<<n->X()<<" "<<n->Y()<<" "<<n->Z());
+-    //     }
++//     for ( int ii = 0; ii < 4; ii++ ) {
++//       const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] );
++//       DUMPSO( ii << "(" << idNodes[ii] <<") : "<<n->X()<<" "<<n->Y()<<" "<<n->Z());
++//     }
+   }
+   return i;
+ }
+@@ -1927,7 +1916,7 @@
+           faceNodes.insert( idNodes[ 2 ] );
+           faceNodes.insert( idNodes[ iMin ] );
+           DUMPSO( "loop " << iLoop2 << " id2 " << idNodes[ 1 ] << " id3 " << idNodes[ 2 ]
+-                  << " leastDist = " << leastDist);
++            << " leastDist = " << leastDist);
+           if ( leastDist <= DBL_MIN )
+             break;
+         }
+@@ -1965,11 +1954,11 @@
+     P[ i ] = P[ i+1 ];
+     P[ i+1 ] = Ptmp;
+   }
+-  //   else
+-  //     for ( int ii = 0; ii < 4; ii++ ) {
+-  //       const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] );
+-  //       DUMPSO( ii << "(" << idNodes[ii] <<") : "<<n->X()<<" "<<n->Y()<<" "<<n->Z());
+-  //    }
++//   else
++//     for ( int ii = 0; ii < 4; ii++ ) {
++//       const SMDS_MeshNode *n = theMesh->FindNode( idNodes[ii] );
++//       DUMPSO( ii << "(" << idNodes[ii] <<") : "<<n->X()<<" "<<n->Y()<<" "<<n->Z());
++//    }
+ 
+   // Gravity center of the top and bottom faces
+   gp_Pnt aGCb = ( P[0].XYZ() + P[1].XYZ() + P[2].XYZ() + P[3].XYZ() ) / 4.;
+@@ -2021,11 +2010,11 @@
+     swap( 5, 7, idNodes, P );
+   }
+ 
+-  //   DUMPSO( "OUTPUT: ========================================");
+-  //   for ( i = 0; i < 8; i++ ) {
+-  //     float *p = ugrid->GetPoint(idNodes[i]);
+-  //     DUMPSO( i << "(" << idNodes[i] << ") : " << p[0] << " " << p[1] << " " << p[2]);
+-  //   }
++//   DUMPSO( "OUTPUT: ========================================");
++//   for ( i = 0; i < 8; i++ ) {
++//     float *p = ugrid->GetPoint(idNodes[i]);
++//     DUMPSO( i << "(" << idNodes[i] << ") : " << p[0] << " " << p[1] << " " << p[2]);
++//   }
+ 
+   return true;
+ }*/
+@@ -2033,11 +2022,11 @@
+ //================================================================================
+ /*!
+  * \brief Return nodes linked to the given one
+- * \param theNode - the node
+- * \param linkedNodes - the found nodes
+- * \param type - the type of elements to check
+- *
+- * Medium nodes are ignored
++  * \param theNode - the node
++  * \param linkedNodes - the found nodes
++  * \param type - the type of elements to check
++  *
++  * Medium nodes are ignored
+  */
+ //================================================================================
+ 
+@@ -2205,8 +2194,13 @@
+   if ( projector.IsDone() ) {
+     double u, v, minVal = DBL_MAX;
+     for ( int i = projector.NbExt(); i > 0; i-- )
++#if OCC_VERSION_HEX >= 0x060500
+       if ( projector.SquareDistance( i ) < minVal ) {
+         minVal = projector.SquareDistance( i );
++#else
++      if ( projector.Value( i ) < minVal ) {
++        minVal = projector.Value( i );
++#endif
+         projector.Point( i ).Parameter( u, v );
+       }
+     result.SetCoord( u, v );
+@@ -2317,14 +2311,14 @@
+     }
+     int nbElemOnFace = 0;
+     itElem = theElems.begin();
+-    // loop on not yet smoothed elements: look for elems on a face
++     // loop on not yet smoothed elements: look for elems on a face
+     while ( itElem != theElems.end() ) {
+       if ( faceSubMesh && nbElemOnFace == faceSubMesh->NbElements() )
+         break; // all elements found
+ 
+       const SMDS_MeshElement* elem = *itElem;
+       if ( !elem || elem->GetType() != SMDSAbs_Face || elem->NbNodes() < 3 ||
+-           ( faceSubMesh && !faceSubMesh->Contains( elem ))) {
++          ( faceSubMesh && !faceSubMesh->Contains( elem ))) {
+         ++itElem;
+         continue;
+       }
+@@ -2383,19 +2377,19 @@
+         if ( uvMap.find( node ) == uvMap.end() )
+           uvCheckNodes.push_back( node );
+         // add nodes of elems sharing node
+-        //         SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator(SMDSAbs_Face);
+-        //         while ( eIt->more() ) {
+-        //           const SMDS_MeshElement* e = eIt->next();
+-        //           if ( e != elem ) {
+-        //             SMDS_ElemIteratorPtr nIt = e->nodesIterator();
+-        //             while ( nIt->more() ) {
+-        //               const SMDS_MeshNode* n =
+-        //                 static_cast<const SMDS_MeshNode*>( nIt->next() );
+-        //               if ( uvMap.find( n ) == uvMap.end() )
+-        //                 uvCheckNodes.push_back( n );
+-        //             }
+-        //           }
+-        //         }
++//         SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator(SMDSAbs_Face);
++//         while ( eIt->more() ) {
++//           const SMDS_MeshElement* e = eIt->next();
++//           if ( e != elem ) {
++//             SMDS_ElemIteratorPtr nIt = e->nodesIterator();
++//             while ( nIt->more() ) {
++//               const SMDS_MeshNode* n =
++//                 static_cast<const SMDS_MeshNode*>( nIt->next() );
++//               if ( uvMap.find( n ) == uvMap.end() )
++//                 uvCheckNodes.push_back( n );
++//             }
++//           }
++//         }
+       }
+       // check UV on face
+       list< const SMDS_MeshNode* >::iterator n = uvCheckNodes.begin();
+@@ -2801,51 +2795,47 @@
+     TNodeOfNodeListMapItr nnIt = newNodesItVec[ iNode ];
+     const SMDS_MeshNode*                 node         = nnIt->first;
+     const list< const SMDS_MeshNode* > & listNewNodes = nnIt->second;
+-    if ( listNewNodes.empty() ) {
++    if ( listNewNodes.empty() )
+       return;
+-    }
+ 
+-    issimple[iNode] = (listNewNodes.size()==nbSteps); // is node medium
++    issimple[iNode] = (listNewNodes.size()==nbSteps);
+ 
+     itNN[ iNode ] = listNewNodes.begin();
+     prevNod[ iNode ] = node;
+     nextNod[ iNode ] = listNewNodes.front();
+-    if( !elem->IsQuadratic() || !issimple[iNode] ) {
+-      if ( prevNod[ iNode ] != nextNod [ iNode ])
+-        iNotSameNode = iNode;
+-      else {
+-        iSameNode = iNode;
+-        //nbSame++;
+-        sames[nbSame++] = iNode;
+-      }
++//cout<<"iNode="<<iNode<<endl;
++//cout<<" prevNod[iNode]="<< prevNod[iNode]<<" nextNod[iNode]="<< nextNod[iNode]<<endl;
++    if ( prevNod[ iNode ] != nextNod [ iNode ])
++      iNotSameNode = iNode;
++    else {
++      iSameNode = iNode;
++      //nbSame++;
++      sames[nbSame++] = iNode;
+     }
+   }
+-
+-  //cout<<"  nbSame = "<<nbSame<<endl;
++//cout<<"1 nbSame="<<nbSame<<endl;
+   if ( nbSame == nbNodes || nbSame > 2) {
+     MESSAGE( " Too many same nodes of element " << elem->GetID() );
+-    //INFOS( " Too many same nodes of element " << elem->GetID() );
+     return;
+   }
+ 
+-  //  if( elem->IsQuadratic() && nbSame>0 ) {
+-  //    MESSAGE( "Can not rotate quadratic element " << elem->GetID() );
+-  //    return;
+-  //  }
++//  if( elem->IsQuadratic() && nbSame>0 ) {
++//    MESSAGE( "Can not rotate quadratic element " << elem->GetID() );
++//    return;
++//  }
+ 
+   int iBeforeSame = 0, iAfterSame = 0, iOpposSame = 0;
+-  int nbBaseNodes = ( elem->IsQuadratic() ? nbNodes/2 : nbNodes );
+   if ( nbSame > 0 ) {
+-    iBeforeSame = ( iSameNode == 0 ? nbBaseNodes - 1 : iSameNode - 1 );
+-    iAfterSame  = ( iSameNode + 1 == nbBaseNodes ? 0 : iSameNode + 1 );
++    iBeforeSame = ( iSameNode == 0 ? nbNodes - 1 : iSameNode - 1 );
++    iAfterSame  = ( iSameNode + 1 == nbNodes ? 0 : iSameNode + 1 );
+     iOpposSame  = ( iSameNode - 2 < 0  ? iSameNode + 2 : iSameNode - 2 );
+   }
+ 
+-  //if(nbNodes==8)
+-  //cout<<" prevNod[0]="<< prevNod[0]<<" prevNod[1]="<< prevNod[1]
+-  //    <<" prevNod[2]="<< prevNod[2]<<" prevNod[3]="<< prevNod[4]
+-  //    <<" prevNod[4]="<< prevNod[4]<<" prevNod[5]="<< prevNod[5]
+-  //    <<" prevNod[6]="<< prevNod[6]<<" prevNod[7]="<< prevNod[7]<<endl;
++//if(nbNodes==8)
++//cout<<" prevNod[0]="<< prevNod[0]<<" prevNod[1]="<< prevNod[1]
++//    <<" prevNod[2]="<< prevNod[2]<<" prevNod[3]="<< prevNod[4]
++//    <<" prevNod[4]="<< prevNod[4]<<" prevNod[5]="<< prevNod[5]
++//    <<" prevNod[6]="<< prevNod[6]<<" prevNod[7]="<< prevNod[7]<<endl;
+ 
+   // check element orientation
+   int i0 = 0, i2 = 2;
+@@ -2875,7 +2865,7 @@
+         }
+         else if(!elem->IsQuadratic() || elem->IsMediumNode(prevNod[iNode]) ) {
+           // we have to use each second node
+-          //itNN[ iNode ]++;
++          itNN[ iNode ]++;
+           nextNod[ iNode ] = *itNN[ iNode ];
+           itNN[ iNode ]++;
+         }
+@@ -2934,9 +2924,8 @@
+                                       midlNod[0], nextNod[2], midlNod[1], prevNod[2]);
+           }
+           else if(nbSame==1) { // quadratic triangle
+-            if(sames[0]==2) {
++            if(sames[0]==2)
+               return; // medium node on axis
+-            }
+             else if(sames[0]==0) {
+               aNewElem = aMesh->AddFace(prevNod[0], nextNod[1], prevNod[1],
+                                         nextNod[2], midlNod[1], prevNod[2]);
+@@ -2946,9 +2935,8 @@
+                                         midlNod[0], nextNod[2], prevNod[2]);
+             }
+           }
+-          else {
++          else
+             return;
+-          }
+         }
+         break;
+       }
+@@ -2983,139 +2971,37 @@
+       }
+       case 6: { // quadratic triangle
+         // create pentahedron with 15 nodes
+-        if(nbSame==0) {
+-          if(i0>0) { // reversed case
+-            aNewElem = aMesh->AddVolume (prevNod[0], prevNod[2], prevNod[1],
+-                                         nextNod[0], nextNod[2], nextNod[1],
+-                                         prevNod[5], prevNod[4], prevNod[3],
+-                                         nextNod[5], nextNod[4], nextNod[3],
+-                                         midlNod[0], midlNod[2], midlNod[1]);
+-          }
+-          else { // not reversed case
+-            aNewElem = aMesh->AddVolume (prevNod[0], prevNod[1], prevNod[2],
+-                                         nextNod[0], nextNod[1], nextNod[2],
+-                                         prevNod[3], prevNod[4], prevNod[5],
+-                                         nextNod[3], nextNod[4], nextNod[5],
+-                                         midlNod[0], midlNod[1], midlNod[2]);
+-          }
+-        }
+-        else if(nbSame==1) {
+-          // 2d order pyramid of 13 nodes
+-          //SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
+-          //                                 int n12,int n23,int n34,int n41,
+-          //                                 int n15,int n25,int n35,int n45, int ID);
+-          int n5 = iSameNode;
+-          int n1,n4,n41,n15,n45;
+-          if(i0>0) { // reversed case
+-            n1 = ( n5 + 1 == nbBaseNodes ? 0 : n5 + 1 );
+-            n4 = ( n5 == 0 ? nbBaseNodes - 1 : n5 - 1 );
+-            n41 = n1 + 3;
+-            n15 = n5 + 3;
+-            n45 = n4 + 3;
+-          }
+-          else {
+-            n1 = ( n5 == 0 ? nbBaseNodes - 1 : n5 - 1 );
+-            n4 = ( n5 + 1 == nbBaseNodes ? 0 : n5 + 1 );
+-            n41 = n4 + 3;
+-            n15 = n1 + 3;
+-            n45 = n5 + 3;
+-          }
+-          aNewElem = aMesh->AddVolume(prevNod[n1], nextNod[n1],
+-                                      nextNod[n4], prevNod[n4], prevNod[n5],
+-                                      midlNod[n1], nextNod[n41],
+-                                      midlNod[n4], prevNod[n41],
+-                                      prevNod[n15], nextNod[n15],
+-                                      nextNod[n45], prevNod[n45]);
+-        }
+-        else if(nbSame==2) {
+-          // 2d order tetrahedron of 10 nodes
+-          //SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
+-          //                                 int n12,int n23,int n31,
+-          //                                 int n14,int n24,int n34, int ID);
+-          int n1 = iNotSameNode;
+-          int n2,n3,n12,n23,n31;
+-          if(i0>0) { // reversed case
+-            n2 = ( n1 == 0 ? nbBaseNodes - 1 : n1 - 1 );
+-            n3 = ( n1 + 1 == nbBaseNodes ? 0 : n1 + 1 );
+-            n12 = n2 + 3;
+-            n23 = n3 + 3;
+-            n31 = n1 + 3;
+-          }
+-          else {
+-            n2 = ( n1 + 1 == nbBaseNodes ? 0 : n1 + 1 );
+-            n3 = ( n1 == 0 ? nbBaseNodes - 1 : n1 - 1 );
+-            n12 = n1 + 3;
+-            n23 = n2 + 3;
+-            n31 = n3 + 3;
+-          }
+-          aNewElem = aMesh->AddVolume (prevNod[n1], prevNod[n2], prevNod[n3], nextNod[n1],
+-                                       prevNod[n12], prevNod[n23], prevNod[n31],
+-                                       midlNod[n1], nextNod[n12], nextNod[n31]);
++        if(i0>0) { // reversed case
++          aNewElem = aMesh->AddVolume (prevNod[0], prevNod[2], prevNod[1],
++                                       nextNod[0], nextNod[2], nextNod[1],
++                                       prevNod[5], prevNod[4], prevNod[3],
++                                       nextNod[5], nextNod[4], nextNod[3],
++                                       midlNod[0], midlNod[2], midlNod[1]);
++        }
++        else { // not reversed case
++          aNewElem = aMesh->AddVolume (prevNod[0], prevNod[1], prevNod[2],
++                                       nextNod[0], nextNod[1], nextNod[2],
++                                       prevNod[3], prevNod[4], prevNod[5],
++                                       nextNod[3], nextNod[4], nextNod[5],
++                                       midlNod[0], midlNod[1], midlNod[2]);
+         }
+         break;
+       }
+       case 8: { // quadratic quadrangle
+-        if(nbSame==0) {
+-          // create hexahedron with 20 nodes
+-          if(i0>0) { // reversed case
+-            aNewElem = aMesh->AddVolume (prevNod[0], prevNod[3], prevNod[2], prevNod[1],
+-                                         nextNod[0], nextNod[3], nextNod[2], nextNod[1],
+-                                         prevNod[7], prevNod[6], prevNod[5], prevNod[4],
+-                                         nextNod[7], nextNod[6], nextNod[5], nextNod[4],
+-                                         midlNod[0], midlNod[3], midlNod[2], midlNod[1]);
+-          }
+-          else { // not reversed case
+-            aNewElem = aMesh->AddVolume (prevNod[0], prevNod[1], prevNod[2], prevNod[3],
+-                                         nextNod[0], nextNod[1], nextNod[2], nextNod[3],
+-                                         prevNod[4], prevNod[5], prevNod[6], prevNod[7],
+-                                         nextNod[4], nextNod[5], nextNod[6], nextNod[7],
+-                                         midlNod[0], midlNod[1], midlNod[2], midlNod[3]);
+-          }
+-        }
+-        else if(nbSame==1) { 
+-          // --- pyramid + pentahedron - can not be created since it is needed 
+-          // additional middle node ot the center of face
+-          INFOS( " Sweep for face " << elem->GetID() << " can not be created" );
+-          return;
+-        }
+-        else if(nbSame==2) {
+-          // 2d order Pentahedron with 15 nodes
+-          //SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6,
+-          //                                 int n12,int n23,int n31,int n45,int n56,int n64,
+-          //                                 int n14,int n25,int n36, int ID);
+-          int n1,n2,n4,n5;
+-          if ( prevNod[ iBeforeSame ] == nextNod[ iBeforeSame ] ) {
+-            // iBeforeSame is same too
+-            n1 = iBeforeSame;
+-            n2 = iOpposSame;
+-            n4 = iSameNode;
+-            n5 = iAfterSame;
+-          }
+-          else {
+-            // iAfterSame is same too
+-            n1 = iSameNode;
+-            n2 = iBeforeSame;
+-            n4 = iAfterSame;
+-            n5 = iOpposSame;
+-          }
+-          int n12,n45,n14,n25;
+-          if(i0>0) { //reversed case
+-            n12 = n1 + 4;
+-            n45 = n5 + 4;
+-            n14 = n4 + 4;
+-            n25 = n2 + 4;
+-          }
+-          else {
+-            n12 = n2 + 4;
+-            n45 = n4 + 4;
+-            n14 = n1 + 4;
+-            n25 = n5 + 4;
+-          }
+-          aNewElem = aMesh->AddVolume (prevNod[n1], prevNod[n2], nextNod[n2],
+-                                       prevNod[n4], prevNod[n5], nextNod[n5],
+-                                       prevNod[n12], midlNod[n2], nextNod[n12],
+-                                       prevNod[n45], midlNod[n5], nextNod[n45],
+-                                       prevNod[n14], prevNod[n25], nextNod[n25]);
++        // create hexahedron with 20 nodes
++        if(i0>0) { // reversed case
++          aNewElem = aMesh->AddVolume (prevNod[0], prevNod[3], prevNod[2], prevNod[1],
++                                       nextNod[0], nextNod[3], nextNod[2], nextNod[1],
++                                       prevNod[7], prevNod[6], prevNod[5], prevNod[4],
++                                       nextNod[7], nextNod[6], nextNod[5], nextNod[4],
++                                       midlNod[0], midlNod[3], midlNod[2], midlNod[1]);
++        }
++        else { // not reversed case
++          aNewElem = aMesh->AddVolume (prevNod[0], prevNod[1], prevNod[2], prevNod[3],
++                                       nextNod[0], nextNod[1], nextNod[2], nextNod[3],
++                                       prevNod[4], prevNod[5], prevNod[6], prevNod[7],
++                                       nextNod[4], nextNod[5], nextNod[6], nextNod[7],
++                                       midlNod[0], midlNod[1], midlNod[2], midlNod[3]);
+         }
+         break;
+       }
+@@ -3422,40 +3308,20 @@
+                 if(nbn==6) { /////// quadratic triangle
+                   const SMDS_MeshFace * f = aMesh->FindFace( nodes[0], nodes[2], nodes[4],
+                                                              nodes[1], nodes[3], nodes[5] );
+-                  if ( !f ) {
++                  if ( !f )
+                     myLastCreatedElems.Append(aMesh->AddFace(nodes[0], nodes[2], nodes[4],
+                                                              nodes[1], nodes[3], nodes[5]));
+-                  }
+-                  else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) {
+-                    const SMDS_MeshNode** tmpnodes = new const SMDS_MeshNode*[6];
+-                    tmpnodes[0] = nodes[0];
+-                    tmpnodes[1] = nodes[2];
+-                    tmpnodes[2] = nodes[4];
+-                    tmpnodes[3] = nodes[1];
+-                    tmpnodes[4] = nodes[3];
+-                    tmpnodes[5] = nodes[5];
+-                    aMesh->ChangeElementNodes( f, tmpnodes, nbn );
+-                  }
++                  else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 ))
++                    aMesh->ChangeElementNodes( f, nodes, nbn );
+                 }
+                 else {       /////// quadratic quadrangle
+                   const SMDS_MeshFace * f = aMesh->FindFace( nodes[0], nodes[2], nodes[4], nodes[6],
+                                                              nodes[1], nodes[3], nodes[5], nodes[7] );
+-                  if ( !f ) {
++                  if ( !f )
+                     myLastCreatedElems.Append(aMesh->AddFace(nodes[0], nodes[2], nodes[4], nodes[6],
+                                                              nodes[1], nodes[3], nodes[5], nodes[7]));
+-                  }
+-                  else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 )) {
+-                    const SMDS_MeshNode** tmpnodes = new const SMDS_MeshNode*[8];
+-                    tmpnodes[0] = nodes[0];
+-                    tmpnodes[1] = nodes[2];
+-                    tmpnodes[2] = nodes[4];
+-                    tmpnodes[3] = nodes[6];
+-                    tmpnodes[4] = nodes[1];
+-                    tmpnodes[5] = nodes[3];
+-                    tmpnodes[6] = nodes[5];
+-                    tmpnodes[7] = nodes[7];
+-                    aMesh->ChangeElementNodes( f, tmpnodes, nbn );
+-                  }
++                  else if ( nodes[ 2 ] != f->GetNodeWrap( f->GetNodeIndex( nodes[ 0 ] ) + 1 ))
++                    aMesh->ChangeElementNodes( f, nodes, nbn );
+                 }
+               }
+               else { //////// polygon
+@@ -3576,25 +3442,20 @@
+ 
+     // loop on elem nodes
+     SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+-    while ( itN->more() ) {
++    while ( itN->more() )
++    {
+       // check if a node has been already sweeped
+       const SMDS_MeshNode* node = cast2Node( itN->next() );
+-
+-      gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
+-      double coord[3];
+-      aXYZ.Coord( coord[0], coord[1], coord[2] );
+-      bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
+-
+       TNodeOfNodeListMapItr nIt = mapNewNodes.find( node );
+       if ( nIt == mapNewNodes.end() ) {
+         nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
+         list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
+ 
+         // make new nodes
+-        //gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
+-        //double coord[3];
+-        //aXYZ.Coord( coord[0], coord[1], coord[2] );
+-        //bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
++        gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
++        double coord[3];
++        aXYZ.Coord( coord[0], coord[1], coord[2] );
++        bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
+         const SMDS_MeshNode * newNode = node;
+         for ( int i = 0; i < theNbSteps; i++ ) {
+           if ( !isOnAxis ) {
+@@ -3615,52 +3476,37 @@
+             newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+             myLastCreatedNodes.Append(newNode);
+             srcNodes.Append( node );
+-            listNewNodes.push_back( newNode );
+-          }
+-          else {
+-            listNewNodes.push_back( newNode );
+-            if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
+-              listNewNodes.push_back( newNode );
+-            }
+           }
++          listNewNodes.push_back( newNode );
+         }
+       }
+-      /*
+-        else {
++      else {
+         // if current elem is quadratic and current node is not medium
+         // we have to check - may be it is needed to insert additional nodes
+         if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
+-        list< const SMDS_MeshNode* > & listNewNodes = nIt->second;
+-        if(listNewNodes.size()==theNbSteps) {
+-        listNewNodes.clear();
+-        // make new nodes
+-        //gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
+-        //double coord[3];
+-        //aXYZ.Coord( coord[0], coord[1], coord[2] );
+-        const SMDS_MeshNode * newNode = node;
+-        if ( !isOnAxis ) {
+-        for(int i = 0; i<theNbSteps; i++) {
+-        aTrsf2.Transforms( coord[0], coord[1], coord[2] );
+-        newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+-        cout<<"    3 AddNode:  "<<newNode;
+-        myLastCreatedNodes.Append(newNode);
+-        listNewNodes.push_back( newNode );
+-        srcNodes.Append( node );
+-        aTrsf2.Transforms( coord[0], coord[1], coord[2] );
+-        newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
+-        cout<<"    4 AddNode:  "<<newNode;
+-        myLastCreatedNodes.Append(newNode);
+-        srcNodes.Append( node );
+-        listNewNodes.push_back( newNode );
+-        }
+-        }
+-        else {
+-        listNewNodes.push_back( newNode );
+-        }
+-        }
+-        }
++          list< const SMDS_MeshNode* > & listNewNodes = nIt->second;
++          if(listNewNodes.size()==theNbSteps) {
++            listNewNodes.clear();
++            // make new nodes
++            gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
++            double coord[3];
++            aXYZ.Coord( coord[0], coord[1], coord[2] );
++            const SMDS_MeshNode * newNode = node;
++            for(int i = 0; i<theNbSteps; i++) {
++              aTrsf2.Transforms( coord[0], coord[1], coord[2] );
++              newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
++              myLastCreatedNodes.Append(newNode);
++              listNewNodes.push_back( newNode );
++              srcNodes.Append( node );
++              aTrsf2.Transforms( coord[0], coord[1], coord[2] );
++              newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
++              myLastCreatedNodes.Append(newNode);
++              srcNodes.Append( node );
++              listNewNodes.push_back( newNode );
++            }
++          }
+         }
+-      */
++      }
+       newNodesItVec.push_back( nIt );
+     }
+     // make new elements
+@@ -3669,7 +3515,7 @@
+ 
+   if ( theMakeWalls )
+     makeWalls( mapNewNodes, newElemsMap, mapElemNewNodes, theElems, theNbSteps, srcElems );
+-
++  
+   PGroupIDs newGroupIDs;
+   if ( theMakeGroups )
+     newGroupIDs = generateGroups( srcNodes, srcElems, "rotated");
+@@ -3901,75 +3747,82 @@
+   return newGroupIDs;
+ }
+ 
+-/*
++
+ //=======================================================================
+ //class    : SMESH_MeshEditor_PathPoint
+ //purpose  : auxiliary class
+ //=======================================================================
+ class SMESH_MeshEditor_PathPoint {
+ public:
+-SMESH_MeshEditor_PathPoint() {
+-myPnt.SetCoord(99., 99., 99.);
+-myTgt.SetCoord(1.,0.,0.);
+-myAngle=0.;
+-myPrm=0.;
+-}
+-void SetPnt(const gp_Pnt& aP3D){
+-myPnt=aP3D;
+-}
+-void SetTangent(const gp_Dir& aTgt){
+-myTgt=aTgt;
+-}
+-void SetAngle(const double& aBeta){
+-myAngle=aBeta;
+-}
+-void SetParameter(const double& aPrm){
+-myPrm=aPrm;
+-}
+-const gp_Pnt& Pnt()const{
+-return myPnt;
+-}
+-const gp_Dir& Tangent()const{
+-return myTgt;
+-}
+-double Angle()const{
+-return myAngle;
+-}
+-double Parameter()const{
+-return myPrm;
+-}
++  SMESH_MeshEditor_PathPoint() {
++    myPnt.SetCoord(99., 99., 99.);
++    myTgt.SetCoord(1.,0.,0.);
++    myAngle=0.;
++    myPrm=0.;
++  }
++  void SetPnt(const gp_Pnt& aP3D){
++    myPnt=aP3D;
++  }
++  void SetTangent(const gp_Dir& aTgt){
++    myTgt=aTgt;
++  }
++  void SetAngle(const double& aBeta){
++    myAngle=aBeta;
++  }
++  void SetParameter(const double& aPrm){
++    myPrm=aPrm;
++  }
++  const gp_Pnt& Pnt()const{
++    return myPnt;
++  }
++  const gp_Dir& Tangent()const{
++    return myTgt;
++  }
++  double Angle()const{
++    return myAngle;
++  }
++  double Parameter()const{
++    return myPrm;
++  }
+ 
+ protected:
+-gp_Pnt myPnt;
+-gp_Dir myTgt;
+-double myAngle;
+-double myPrm;
++  gp_Pnt myPnt;
++  gp_Dir myTgt;
++  double myAngle;
++  double myPrm;
+ };
+-*/
+ 
+ //=======================================================================
+ //function : ExtrusionAlongTrack
+ //purpose  :
+ //=======================================================================
+ SMESH_MeshEditor::Extrusion_Error
+-SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet &   theElements,
+-                                       SMESH_subMesh*       theTrack,
+-                                       const SMDS_MeshNode* theN1,
+-                                       const bool           theHasAngles,
+-                                       list<double>&        theAngles,
+-                                       const bool           theLinearVariation,
+-                                       const bool           theHasRefPoint,
+-                                       const gp_Pnt&        theRefPoint,
+-                                       const bool           theMakeGroups)
++  SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet &   theElements,
++					 SMESH_subMesh*       theTrack,
++					 const SMDS_MeshNode* theN1,
++					 const bool           theHasAngles,
++					 list<double>&        theAngles,
++					 const bool           theHasRefPoint,
++					 const gp_Pnt&        theRefPoint,
++                                         const bool           theMakeGroups)
+ {
+   myLastCreatedElems.Clear();
+   myLastCreatedNodes.Clear();
+ 
+-  int aNbE;
++  // source elements for each generated one
++  SMESH_SequenceOfElemPtr srcElems, srcNodes;
++
++  int j, aNbTP, aNbE, aNb;
++  double aT1, aT2, aT, aAngle, aX, aY, aZ;
+   std::list<double> aPrms;
++  std::list<double>::iterator aItD;
+   TIDSortedElemSet::iterator itElem;
+ 
++  Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2;
++  gp_Pnt aP3D, aV0;
++  gp_Vec aVec;
+   gp_XYZ aGC;
++  Handle(Geom_Curve) aC3D;
+   TopoDS_Edge aTrackEdge;
+   TopoDS_Vertex aV1, aV2;
+ 
+@@ -3978,6 +3831,11 @@
+   SMDSAbs_ElementType aTypeE;
+ 
+   TNodeOfNodeListMap mapNewNodes;
++  TElemOfVecOfNnlmiMap mapElemNewNodes;
++  TElemOfElemListMap newElemsMap;
++
++  aTolVec=1.e-7;
++  aTolVec2=aTolVec*aTolVec;
+ 
+   // 1. Check data
+   aNbE = theElements.size();
+@@ -3988,7 +3846,7 @@
+   // 1.1 Track Pattern
+   ASSERT( theTrack );
+ 
+-  SMESHDS_SubMesh* pSubMeshDS = theTrack->GetSubMeshDS();
++  SMESHDS_SubMesh* pSubMeshDS=theTrack->GetSubMeshDS();
+ 
+   aItE = pSubMeshDS->GetElements();
+   while ( aItE->more() ) {
+@@ -3999,327 +3857,63 @@
+       return EXTR_PATH_NOT_EDGE;
+   }
+ 
+-  list<SMESH_MeshEditor_PathPoint> fullList;
+-
+   const TopoDS_Shape& aS = theTrack->GetSubShape();
+-  // Sub shape for the Pattern must be an Edge or Wire
+-  if( aS.ShapeType() == TopAbs_EDGE ) {
+-    aTrackEdge = TopoDS::Edge( aS );
+-    // the Edge must not be degenerated
+-    if ( BRep_Tool::Degenerated( aTrackEdge ) )
+-      return EXTR_BAD_PATH_SHAPE;
+-    TopExp::Vertices( aTrackEdge, aV1, aV2 );
+-    aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
+-    const SMDS_MeshNode* aN1 = aItN->next();
+-    aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
+-    const SMDS_MeshNode* aN2 = aItN->next();
+-    // starting node must be aN1 or aN2
+-    if ( !( aN1 == theN1 || aN2 == theN1 ) )
+-      return EXTR_BAD_STARTING_NODE;
+-    aItN = pSubMeshDS->GetNodes();
+-    while ( aItN->more() ) {
+-      const SMDS_MeshNode* pNode = aItN->next();
+-      const SMDS_EdgePosition* pEPos =
+-        static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
+-      double aT = pEPos->GetUParameter();
+-      aPrms.push_back( aT );
+-    }
+-    //Extrusion_Error err =
+-    MakeEdgePathPoints(aPrms, aTrackEdge, (aN1==theN1), fullList);
+-  }
+-  else if( aS.ShapeType() == TopAbs_WIRE ) {
+-    list< SMESH_subMesh* > LSM;
+-    TopTools_SequenceOfShape Edges;
+-    SMESH_subMeshIteratorPtr itSM = theTrack->getDependsOnIterator(false,true);
+-    while(itSM->more()) {
+-      SMESH_subMesh* SM = itSM->next();
+-      LSM.push_back(SM);
+-      const TopoDS_Shape& aS = SM->GetSubShape();
+-      Edges.Append(aS);
+-    }
+-    list< list<SMESH_MeshEditor_PathPoint> > LLPPs;
+-    int startNid = theN1->GetID();
+-    TColStd_MapOfInteger UsedNums;
+-    int NbEdges = Edges.Length();
+-    int i = 1;
+-    for(; i<=NbEdges; i++) {
+-      int k = 0;
+-      list< SMESH_subMesh* >::iterator itLSM = LSM.begin();
+-      for(; itLSM!=LSM.end(); itLSM++) {
+-        k++;
+-        if(UsedNums.Contains(k)) continue;
+-        aTrackEdge = TopoDS::Edge( Edges.Value(k) );
+-        SMESH_subMesh* locTrack = *itLSM;
+-        SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS();
+-        TopExp::Vertices( aTrackEdge, aV1, aV2 );
+-        aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes();
+-        const SMDS_MeshNode* aN1 = aItN->next();
+-        aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes();
+-        const SMDS_MeshNode* aN2 = aItN->next();
+-        // starting node must be aN1 or aN2
+-        if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue;
+-        // 2. Collect parameters on the track edge
+-        aPrms.clear();
+-        aItN = locMeshDS->GetNodes();
+-        while ( aItN->more() ) {
+-          const SMDS_MeshNode* pNode = aItN->next();
+-          const SMDS_EdgePosition* pEPos =
+-            static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
+-          double aT = pEPos->GetUParameter();
+-          aPrms.push_back( aT );
+-        }
+-        list<SMESH_MeshEditor_PathPoint> LPP;
+-        //Extrusion_Error err =
+-        MakeEdgePathPoints(aPrms, aTrackEdge,(aN1->GetID()==startNid), LPP);
+-        LLPPs.push_back(LPP);
+-        UsedNums.Add(k);
+-        // update startN for search following egde
+-        if( aN1->GetID() == startNid ) startNid = aN2->GetID();
+-        else startNid = aN1->GetID();
+-        break;
+-      }
+-    }
+-    list< list<SMESH_MeshEditor_PathPoint> >::iterator itLLPP = LLPPs.begin();
+-    list<SMESH_MeshEditor_PathPoint> firstList = *itLLPP;
+-    list<SMESH_MeshEditor_PathPoint>::iterator itPP = firstList.begin();
+-    for(; itPP!=firstList.end(); itPP++) {
+-      fullList.push_back( *itPP );
+-    }
+-    SMESH_MeshEditor_PathPoint PP1 = fullList.back();
+-    fullList.pop_back();
+-    itLLPP++;
+-    for(; itLLPP!=LLPPs.end(); itLLPP++) {
+-      list<SMESH_MeshEditor_PathPoint> currList = *itLLPP;
+-      itPP = currList.begin();
+-      SMESH_MeshEditor_PathPoint PP2 = currList.front();
+-      gp_Dir D1 = PP1.Tangent();
+-      gp_Dir D2 = PP2.Tangent();
+-      gp_Dir Dnew( gp_Vec( (D1.X()+D2.X())/2, (D1.Y()+D2.Y())/2,
+-                           (D1.Z()+D2.Z())/2 ) );
+-      PP1.SetTangent(Dnew);
+-      fullList.push_back(PP1);
+-      itPP++;
+-      for(; itPP!=firstList.end(); itPP++) {
+-        fullList.push_back( *itPP );
+-      }
+-      PP1 = fullList.back();
+-      fullList.pop_back();
+-    }
+-    // if wire not closed
+-    fullList.push_back(PP1);
+-    // else ???
+-  }
+-  else {
++  // Sub shape for the Pattern must be an Edge
++  if ( aS.ShapeType() != TopAbs_EDGE )
+     return EXTR_BAD_PATH_SHAPE;
+-  }
+-
+-  return MakeExtrElements(theElements, fullList, theHasAngles, theAngles, theLinearVariation,
+-                          theHasRefPoint, theRefPoint, theMakeGroups);
+-}
+-
+-
+-//=======================================================================
+-//function : ExtrusionAlongTrack
+-//purpose  :
+-//=======================================================================
+-SMESH_MeshEditor::Extrusion_Error
+-SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet &   theElements,
+-                                       SMESH_Mesh*          theTrack,
+-                                       const SMDS_MeshNode* theN1,
+-                                       const bool           theHasAngles,
+-                                       list<double>&        theAngles,
+-                                       const bool           theLinearVariation,
+-                                       const bool           theHasRefPoint,
+-                                       const gp_Pnt&        theRefPoint,
+-                                       const bool           theMakeGroups)
+-{
+-  myLastCreatedElems.Clear();
+-  myLastCreatedNodes.Clear();
+ 
+-  int aNbE;
+-  std::list<double> aPrms;
+-  TIDSortedElemSet::iterator itElem;
++  aTrackEdge = TopoDS::Edge( aS );
++  // the Edge must not be degenerated
++  if ( BRep_Tool::Degenerated( aTrackEdge ) )
++    return EXTR_BAD_PATH_SHAPE;
+ 
+-  gp_XYZ aGC;
+-  TopoDS_Edge aTrackEdge;
+-  TopoDS_Vertex aV1, aV2;
++  TopExp::Vertices( aTrackEdge, aV1, aV2 );
++  aT1=BRep_Tool::Parameter( aV1, aTrackEdge );
++  aT2=BRep_Tool::Parameter( aV2, aTrackEdge );
+ 
+-  SMDS_ElemIteratorPtr aItE;
+-  SMDS_NodeIteratorPtr aItN;
+-  SMDSAbs_ElementType aTypeE;
++  aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
++  const SMDS_MeshNode* aN1 = aItN->next();
+ 
+-  TNodeOfNodeListMap mapNewNodes;
++  aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
++  const SMDS_MeshNode* aN2 = aItN->next();
+ 
+-  // 1. Check data
+-  aNbE = theElements.size();
+-  // nothing to do
+-  if ( !aNbE )
+-    return EXTR_NO_ELEMENTS;
++  // starting node must be aN1 or aN2
++  if ( !( aN1 == theN1 || aN2 == theN1 ) )
++    return EXTR_BAD_STARTING_NODE;
+ 
+-  // 1.1 Track Pattern
+-  ASSERT( theTrack );
++  aNbTP = pSubMeshDS->NbNodes() + 2;
+ 
+-  SMESHDS_Mesh* pMeshDS = theTrack->GetMeshDS();
++  // 1.2. Angles
++  vector<double> aAngles( aNbTP );
+ 
+-  aItE = pMeshDS->elementsIterator();
+-  while ( aItE->more() ) {
+-    const SMDS_MeshElement* pE = aItE->next();
+-    aTypeE = pE->GetType();
+-    // Pattern must contain links only
+-    if ( aTypeE != SMDSAbs_Edge )
+-      return EXTR_PATH_NOT_EDGE;
++  for ( j=0; j < aNbTP; ++j ) {
++    aAngles[j] = 0.;
+   }
+ 
+-  list<SMESH_MeshEditor_PathPoint> fullList;
+-
+-  const TopoDS_Shape& aS = theTrack->GetShapeToMesh();
+-  // Sub shape for the Pattern must be an Edge or Wire
+-  if( aS.ShapeType() == TopAbs_EDGE ) {
+-    aTrackEdge = TopoDS::Edge( aS );
+-    // the Edge must not be degenerated
+-    if ( BRep_Tool::Degenerated( aTrackEdge ) )
+-      return EXTR_BAD_PATH_SHAPE;
+-    TopExp::Vertices( aTrackEdge, aV1, aV2 );
+-    aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
+-    const SMDS_MeshNode* aN1 = aItN->next();
+-    aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
+-    const SMDS_MeshNode* aN2 = aItN->next();
+-    // starting node must be aN1 or aN2
+-    if ( !( aN1 == theN1 || aN2 == theN1 ) )
+-      return EXTR_BAD_STARTING_NODE;
+-    aItN = pMeshDS->nodesIterator();
+-    while ( aItN->more() ) {
+-      const SMDS_MeshNode* pNode = aItN->next();
+-      if( pNode==aN1 || pNode==aN2 ) continue;
+-      const SMDS_EdgePosition* pEPos =
+-        static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
+-      double aT = pEPos->GetUParameter();
+-      aPrms.push_back( aT );
+-    }
+-    //Extrusion_Error err =
+-    MakeEdgePathPoints(aPrms, aTrackEdge, (aN1==theN1), fullList);
+-  }
+-  else if( aS.ShapeType() == TopAbs_WIRE ) {
+-    list< SMESH_subMesh* > LSM;
+-    TopTools_SequenceOfShape Edges;
+-    TopExp_Explorer eExp(aS, TopAbs_EDGE);
+-    for(; eExp.More(); eExp.Next()) {
+-      TopoDS_Edge E = TopoDS::Edge( eExp.Current() );
+-      if( BRep_Tool::Degenerated(E) ) continue;
+-      SMESH_subMesh* SM = theTrack->GetSubMesh(E);
+-      if(SM) {
+-        LSM.push_back(SM);
+-        Edges.Append(E);
+-      }
+-    }
+-    list< list<SMESH_MeshEditor_PathPoint> > LLPPs;
+-    int startNid = theN1->GetID();
+-    TColStd_MapOfInteger UsedNums;
+-    int NbEdges = Edges.Length();
+-    int i = 1;
+-    for(; i<=NbEdges; i++) {
+-      int k = 0;
+-      list< SMESH_subMesh* >::iterator itLSM = LSM.begin();
+-      for(; itLSM!=LSM.end(); itLSM++) {
+-        k++;
+-        if(UsedNums.Contains(k)) continue;
+-        aTrackEdge = TopoDS::Edge( Edges.Value(k) );
+-        SMESH_subMesh* locTrack = *itLSM;
+-        SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS();
+-        TopExp::Vertices( aTrackEdge, aV1, aV2 );
+-        aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes();
+-        const SMDS_MeshNode* aN1 = aItN->next();
+-        aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes();
+-        const SMDS_MeshNode* aN2 = aItN->next();
+-        // starting node must be aN1 or aN2
+-        if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue;
+-        // 2. Collect parameters on the track edge
+-        aPrms.clear();
+-        aItN = locMeshDS->GetNodes();
+-        while ( aItN->more() ) {
+-          const SMDS_MeshNode* pNode = aItN->next();
+-          const SMDS_EdgePosition* pEPos =
+-            static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
+-          double aT = pEPos->GetUParameter();
+-          aPrms.push_back( aT );
+-        }
+-        list<SMESH_MeshEditor_PathPoint> LPP;
+-        //Extrusion_Error err =
+-        MakeEdgePathPoints(aPrms, aTrackEdge,(aN1->GetID()==startNid), LPP);
+-        LLPPs.push_back(LPP);
+-        UsedNums.Add(k);
+-        // update startN for search following egde
+-        if( aN1->GetID() == startNid ) startNid = aN2->GetID();
+-        else startNid = aN1->GetID();
+-        break;
+-      }
++  if ( theHasAngles ) {
++    aItD = theAngles.begin();
++    for ( j=1; (aItD != theAngles.end()) && (j<aNbTP); ++aItD, ++j ) {
++      aAngle = *aItD;
++      aAngles[j] = aAngle;
+     }
+-    list< list<SMESH_MeshEditor_PathPoint> >::iterator itLLPP = LLPPs.begin();
+-    list<SMESH_MeshEditor_PathPoint> firstList = *itLLPP;
+-    list<SMESH_MeshEditor_PathPoint>::iterator itPP = firstList.begin();
+-    for(; itPP!=firstList.end(); itPP++) {
+-      fullList.push_back( *itPP );
+-    }
+-    SMESH_MeshEditor_PathPoint PP1 = fullList.back();
+-    fullList.pop_back();
+-    itLLPP++;
+-    for(; itLLPP!=LLPPs.end(); itLLPP++) {
+-      list<SMESH_MeshEditor_PathPoint> currList = *itLLPP;
+-      itPP = currList.begin();
+-      SMESH_MeshEditor_PathPoint PP2 = currList.front();
+-      gp_Pnt P1 = PP1.Pnt();
+-      //cout<<"    PP1: Pnt("<<P1.X()<<","<<P1.Y()<<","<<P1.Z()<<")"<<endl;
+-      gp_Pnt P2 = PP2.Pnt();
+-      gp_Dir D1 = PP1.Tangent();
+-      gp_Dir D2 = PP2.Tangent();
+-      gp_Dir Dnew( gp_Vec( (D1.X()+D2.X())/2, (D1.Y()+D2.Y())/2,
+-                           (D1.Z()+D2.Z())/2 ) );
+-      PP1.SetTangent(Dnew);
+-      fullList.push_back(PP1);
+-      itPP++;
+-      for(; itPP!=currList.end(); itPP++) {
+-        fullList.push_back( *itPP );
+-      }
+-      PP1 = fullList.back();
+-      fullList.pop_back();
+-    }
+-    // if wire not closed
+-    fullList.push_back(PP1);
+-    // else ???
+-  }
+-  else {
+-    return EXTR_BAD_PATH_SHAPE;
+   }
+ 
+-  return MakeExtrElements(theElements, fullList, theHasAngles, theAngles, theLinearVariation,
+-                          theHasRefPoint, theRefPoint, theMakeGroups);
+-}
+-
+-
+-//=======================================================================
+-//function : MakeEdgePathPoints
+-//purpose  : auxilary for ExtrusionAlongTrack
+-//=======================================================================
+-SMESH_MeshEditor::Extrusion_Error
+-SMESH_MeshEditor::MakeEdgePathPoints(std::list<double>& aPrms,
+-                                     const TopoDS_Edge& aTrackEdge,
+-                                     bool FirstIsStart,
+-                                     list<SMESH_MeshEditor_PathPoint>& LPP)
+-{
+-  Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2;
+-  aTolVec=1.e-7;
+-  aTolVec2=aTolVec*aTolVec;
+-  double aT1, aT2;
+-  TopoDS_Vertex aV1, aV2;
+-  TopExp::Vertices( aTrackEdge, aV1, aV2 );
+-  aT1=BRep_Tool::Parameter( aV1, aTrackEdge );
+-  aT2=BRep_Tool::Parameter( aV2, aTrackEdge );
+   // 2. Collect parameters on the track edge
+-  aPrms.push_front( aT1 );
++  aPrms.push_back( aT1 );
+   aPrms.push_back( aT2 );
++
++  aItN = pSubMeshDS->GetNodes();
++  while ( aItN->more() ) {
++    const SMDS_MeshNode* pNode = aItN->next();
++    const SMDS_EdgePosition* pEPos =
++      static_cast<const SMDS_EdgePosition*>( pNode->GetPosition().get() );
++    aT = pEPos->GetUParameter();
++    aPrms.push_back( aT );
++  }
++
+   // sort parameters
+   aPrms.sort();
+-  if( FirstIsStart ) {
++  if ( aN1 == theN1 ) {
+     if ( aT1 > aT2 ) {
+       aPrms.reverse();
+     }
+@@ -4329,86 +3923,33 @@
+       aPrms.reverse();
+     }
+   }
++
+   // 3. Path Points
+   SMESH_MeshEditor_PathPoint aPP;
+-  Handle(Geom_Curve) aC3D = BRep_Tool::Curve( aTrackEdge, aTx1, aTx2 );
+-  std::list<double>::iterator aItD = aPrms.begin();
+-  for(; aItD != aPrms.end(); ++aItD) {
+-    double aT = *aItD;
+-    gp_Pnt aP3D;
+-    gp_Vec aVec;
++  vector<SMESH_MeshEditor_PathPoint> aPPs( aNbTP );
++  //
++  aC3D = BRep_Tool::Curve( aTrackEdge, aTx1, aTx2 );
++  //
++  aItD = aPrms.begin();
++  for ( j=0; aItD != aPrms.end(); ++aItD, ++j ) {
++    aT = *aItD;
+     aC3D->D1( aT, aP3D, aVec );
+     aL2 = aVec.SquareMagnitude();
+     if ( aL2 < aTolVec2 )
+       return EXTR_CANT_GET_TANGENT;
++
+     gp_Dir aTgt( aVec );
++    aAngle = aAngles[j];
++
+     aPP.SetPnt( aP3D );
+     aPP.SetTangent( aTgt );
++    aPP.SetAngle( aAngle );
+     aPP.SetParameter( aT );
+-    LPP.push_back(aPP);
+-  }
+-  return EXTR_OK;
+-}
+-
+-
+-//=======================================================================
+-//function : MakeExtrElements
+-//purpose  : auxilary for ExtrusionAlongTrack
+-//=======================================================================
+-SMESH_MeshEditor::Extrusion_Error
+-SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet&  theElements,
+-                                   list<SMESH_MeshEditor_PathPoint>& fullList,
+-                                   const bool theHasAngles,
+-                                   list<double>& theAngles,
+-                                   const bool theLinearVariation,
+-                                   const bool theHasRefPoint,
+-                                   const gp_Pnt& theRefPoint,
+-                                   const bool theMakeGroups)
+-{
+-  //cout<<"MakeExtrElements  fullList.size() = "<<fullList.size()<<endl;
+-  int aNbTP = fullList.size();
+-  vector<SMESH_MeshEditor_PathPoint> aPPs(aNbTP);
+-  // Angles
+-  if( theHasAngles && theAngles.size()>0 && theLinearVariation ) {
+-    LinearAngleVariation(aNbTP-1, theAngles);
+-  }
+-  vector<double> aAngles( aNbTP );
+-  int j = 0;
+-  for(; j<aNbTP; ++j) {
+-    aAngles[j] = 0.;
+-  }
+-  if ( theHasAngles ) {
+-    double anAngle;;
+-    std::list<double>::iterator aItD = theAngles.begin();
+-    for ( j=1; (aItD != theAngles.end()) && (j<aNbTP); ++aItD, ++j ) {
+-      anAngle = *aItD;
+-      aAngles[j] = anAngle;
+-    }
++    aPPs[j]=aPP;
+   }
+-  // fill vector of path points with angles
+-  //aPPs.resize(fullList.size());
+-  j = -1;
+-  list<SMESH_MeshEditor_PathPoint>::iterator itPP = fullList.begin();
+-  for(; itPP!=fullList.end(); itPP++) {
+-    j++;
+-    SMESH_MeshEditor_PathPoint PP = *itPP;
+-    PP.SetAngle(aAngles[j]);
+-    aPPs[j] = PP;
+-  }
+-
+-  TNodeOfNodeListMap mapNewNodes;
+-  TElemOfVecOfNnlmiMap mapElemNewNodes;
+-  TElemOfElemListMap newElemsMap;
+-  TIDSortedElemSet::iterator itElem;
+-  double aX, aY, aZ;
+-  int aNb;
+-  SMDSAbs_ElementType aTypeE;
+-  // source elements for each generated one
+-  SMESH_SequenceOfElemPtr srcElems, srcNodes;
+ 
+   // 3. Center of rotation aV0
+-  gp_Pnt aV0 = theRefPoint;
+-  gp_XYZ aGC;
++  aV0 = theRefPoint;
+   if ( !theHasRefPoint ) {
+     aNb = 0;
+     aGC.SetCoord( 0.,0.,0. );
+@@ -4419,19 +3960,19 @@
+ 
+       SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+       while ( itN->more() ) {
+-        const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( itN->next() );
+-        aX = node->X();
+-        aY = node->Y();
+-        aZ = node->Z();
+-
+-        if ( mapNewNodes.find( node ) == mapNewNodes.end() ) {
+-          list<const SMDS_MeshNode*> aLNx;
+-          mapNewNodes[node] = aLNx;
+-          //
+-          gp_XYZ aXYZ( aX, aY, aZ );
+-          aGC += aXYZ;
+-          ++aNb;
+-        }
++	const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( itN->next() );
++	aX = node->X();
++	aY = node->Y();
++	aZ = node->Z();
++
++	if ( mapNewNodes.find( node ) == mapNewNodes.end() ) {
++	  list<const SMDS_MeshNode*> aLNx;
++	  mapNewNodes[node] = aLNx;
++	  //
++	  gp_XYZ aXYZ( aX, aY, aZ );
++	  aGC += aXYZ;
++	  ++aNb;
++	}
+       }
+     }
+     aGC /= aNb;
+@@ -4460,66 +4001,65 @@
+       ++nodeIndex;
+       // check if a node has been already processed
+       const SMDS_MeshNode* node =
+-        static_cast<const SMDS_MeshNode*>( itN->next() );
++	static_cast<const SMDS_MeshNode*>( itN->next() );
+       TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node );
+       if ( nIt == mapNewNodes.end() ) {
+         nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
+         list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
+ 
+-        // make new nodes
+-        aX = node->X();  aY = node->Y(); aZ = node->Z();
+-
+-        Standard_Real aAngle1x, aAngleT1T0, aTolAng;
+-        gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
+-        gp_Ax1 anAx1, anAxT1T0;
+-        gp_Dir aDT1x, aDT0x, aDT1T0;
+-
+-        aTolAng=1.e-4;
+-
+-        aV0x = aV0;
+-        aPN0.SetCoord(aX, aY, aZ);
+-
+-        const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
+-        aP0x = aPP0.Pnt();
+-        aDT0x= aPP0.Tangent();
+-        //cout<<"j = 0   PP: Pnt("<<aP0x.X()<<","<<aP0x.Y()<<","<<aP0x.Z()<<")"<<endl;
+-
+-        for ( j = 1; j < aNbTP; ++j ) {
+-          const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
+-          aP1x = aPP1.Pnt();
+-          aDT1x = aPP1.Tangent();
+-          aAngle1x = aPP1.Angle();
++	// make new nodes
++	aX = node->X();  aY = node->Y(); aZ = node->Z();
+ 
+-          gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0;
+-          // Translation
+-          gp_Vec aV01x( aP0x, aP1x );
+-          aTrsf.SetTranslation( aV01x );
++	Standard_Real aAngle1x, aAngleT1T0, aTolAng;
++	gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
++	gp_Ax1 anAx1, anAxT1T0;
++	gp_Dir aDT1x, aDT0x, aDT1T0;
++
++	aTolAng=1.e-4;
++
++	aV0x = aV0;
++	aPN0.SetCoord(aX, aY, aZ);
++
++	const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
++	aP0x = aPP0.Pnt();
++	aDT0x= aPP0.Tangent();
++
++	for ( j = 1; j < aNbTP; ++j ) {
++	  const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
++	  aP1x = aPP1.Pnt();
++	  aDT1x = aPP1.Tangent();
++	  aAngle1x = aPP1.Angle();
++
++	  gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0;
++	  // Translation
++	  gp_Vec aV01x( aP0x, aP1x );
++	  aTrsf.SetTranslation( aV01x );
++
++	  // traslated point
++	  aV1x = aV0x.Transformed( aTrsf );
++	  aPN1 = aPN0.Transformed( aTrsf );
++
++	  // rotation 1 [ T1,T0 ]
++	  aAngleT1T0=-aDT1x.Angle( aDT0x );
++	  if (fabs(aAngleT1T0) > aTolAng) {
++	    aDT1T0=aDT1x^aDT0x;
++	    anAxT1T0.SetLocation( aV1x );
++	    anAxT1T0.SetDirection( aDT1T0 );
++	    aTrsfRotT1T0.SetRotation( anAxT1T0, aAngleT1T0 );
++
++	    aPN1 = aPN1.Transformed( aTrsfRotT1T0 );
++	  }
++
++	  // rotation 2
++	  if ( theHasAngles ) {
++	    anAx1.SetLocation( aV1x );
++	    anAx1.SetDirection( aDT1x );
++	    aTrsfRot.SetRotation( anAx1, aAngle1x );
+ 
+-          // traslated point
+-          aV1x = aV0x.Transformed( aTrsf );
+-          aPN1 = aPN0.Transformed( aTrsf );
++	    aPN1 = aPN1.Transformed( aTrsfRot );
++	  }
+ 
+-          // rotation 1 [ T1,T0 ]
+-          aAngleT1T0=-aDT1x.Angle( aDT0x );
+-          if (fabs(aAngleT1T0) > aTolAng) {
+-            aDT1T0=aDT1x^aDT0x;
+-            anAxT1T0.SetLocation( aV1x );
+-            anAxT1T0.SetDirection( aDT1T0 );
+-            aTrsfRotT1T0.SetRotation( anAxT1T0, aAngleT1T0 );
+-
+-            aPN1 = aPN1.Transformed( aTrsfRotT1T0 );
+-          }
+-
+-          // rotation 2
+-          if ( theHasAngles ) {
+-            anAx1.SetLocation( aV1x );
+-            anAx1.SetDirection( aDT1x );
+-            aTrsfRot.SetRotation( anAx1, aAngle1x );
+-
+-            aPN1 = aPN1.Transformed( aTrsfRot );
+-          }
+-
+-          // make new node
++	  // make new node
+           if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
+             // create additional node
+             double x = ( aPN1.X() + aPN0.X() )/2.;
+@@ -4530,19 +4070,19 @@
+             srcNodes.Append( node );
+             listNewNodes.push_back( newNode );
+           }
+-          aX = aPN1.X();
+-          aY = aPN1.Y();
+-          aZ = aPN1.Z();
+-          const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
++	  aX = aPN1.X();
++	  aY = aPN1.Y();
++	  aZ = aPN1.Z();
++	  const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
+           myLastCreatedNodes.Append(newNode);
+           srcNodes.Append( node );
+-          listNewNodes.push_back( newNode );
++	  listNewNodes.push_back( newNode );
+ 
+-          aPN0 = aPN1;
+-          aP0x = aP1x;
+-          aV0x = aV1x;
+-          aDT0x = aDT1x;
+-        }
++	  aPN0 = aPN1;
++	  aP0x = aP1x;
++	  aV0x = aV1x;
++	  aDT0x = aDT1x;
++	}
+       }
+ 
+       else {
+@@ -4591,56 +4131,6 @@
+   return EXTR_OK;
+ }
+ 
+-
+-//=======================================================================
+-//function : LinearAngleVariation
+-//purpose  : auxilary for ExtrusionAlongTrack
+-//=======================================================================
+-void SMESH_MeshEditor::LinearAngleVariation(const int nbSteps,
+-                                            list<double>& Angles)
+-{
+-  int nbAngles = Angles.size();
+-  if( nbSteps > nbAngles ) {
+-    vector<double> theAngles(nbAngles);
+-    list<double>::iterator it = Angles.begin();
+-    int i = -1;
+-    for(; it!=Angles.end(); it++) {
+-      i++;
+-      theAngles[i] = (*it);
+-    }
+-    list<double> res;
+-    double rAn2St = double( nbAngles ) / double( nbSteps );
+-    double angPrev = 0, angle;
+-    for ( int iSt = 0; iSt < nbSteps; ++iSt ) {
+-      double angCur = rAn2St * ( iSt+1 );
+-      double angCurFloor  = floor( angCur );
+-      double angPrevFloor = floor( angPrev );
+-      if ( angPrevFloor == angCurFloor )
+-        angle = rAn2St * theAngles[ int( angCurFloor ) ];
+-      else {
+-        int iP = int( angPrevFloor );
+-        double angPrevCeil = ceil(angPrev);
+-        angle = ( angPrevCeil - angPrev ) * theAngles[ iP ];
+-
+-        int iC = int( angCurFloor );
+-        if ( iC < nbAngles )
+-          angle += ( angCur - angCurFloor ) * theAngles[ iC ];
+-
+-        iP = int( angPrevCeil );
+-        while ( iC-- > iP )
+-          angle += theAngles[ iC ];
+-      }
+-      res.push_back(angle);
+-      angPrev = angCur;
+-    }
+-    Angles.clear();
+-    it = res.begin();
+-    for(; it!=res.end(); it++)
+-      Angles.push_back( *it );
+-  }
+-}
+-
+-
+ //=======================================================================
+ //function : Transform
+ //purpose  :
+@@ -4682,7 +4172,7 @@
+   SMESH_MeshEditor targetMeshEditor( theTargetMesh );
+   SMESHDS_Mesh* aTgtMesh = theTargetMesh ? theTargetMesh->GetMeshDS() : 0;
+   SMESHDS_Mesh* aMesh    = GetMeshDS();
+-
++  
+ 
+   // map old node to new one
+   TNodeNodeMap nodeMap;
+@@ -4764,7 +4254,7 @@
+     REV_FACE    = 3,
+     REV_HEXA    = 4,  //  = nbNodes - 4
+     FORWARD     = 5
+-  };
++    };
+   int index[][8] = {
+     { 2, 1, 0, 3, 4, 0, 0, 0 },  // REV_TETRA
+     { 2, 1, 0, 3, 4, 0, 0, 0 },  // REV_PYRAMID
+@@ -4865,18 +4355,18 @@
+           }
+         }
+         break;
+-      default:;
+-      }
+-      continue;
++    default:;
+     }
++    continue;
++  }
+ 
+-    // Regular elements
+-    int* i = index[ FORWARD ];
+-    if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes
+-      if ( elemType == SMDSAbs_Face )
+-        i = index[ REV_FACE ];
+-      else
+-        i = index[ nbNodes - 4 ];
++  // Regular elements
++  int* i = index[ FORWARD ];
++  if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes
++    if ( elemType == SMDSAbs_Face )
++      i = index[ REV_FACE ];
++    else
++      i = index[ nbNodes - 4 ];
+ 
+     if(elem->IsQuadratic()) {
+       static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+@@ -5003,7 +4493,7 @@
+     const SMESH_SequenceOfElemPtr& gens  = isNodes ? nodeGens : elemGens;
+     const SMESH_SequenceOfElemPtr& elems = isNodes ? myLastCreatedNodes : myLastCreatedElems;
+     if ( gens.Length() != elems.Length() )
+-      throw SALOME_Exception(LOCALIZED("invalid args"));
++      throw SMESH_Exception(LOCALIZED("invalid args"));
+ 
+     // loop on created elements
+     for (int iElem = 1; iElem <= elems.Length(); ++iElem )
+@@ -5083,14 +4573,13 @@
+   return newGroupIDs;
+ }
+ 
+-//================================================================================
+-/*!
+- * \brief Return list of group of nodes close to each other within theTolerance
+- *        Search among theNodes or in the whole mesh if theNodes is empty using
+- *        an Octree algorithm
+- */
+-//================================================================================
+-
++//=======================================================================
++//function : FindCoincidentNodes
++//purpose  : Return list of group of nodes close to each other within theTolerance
++//           Search among theNodes or in the whole mesh if theNodes is empty using
++//           an Octree algorithm
++//=======================================================================
++
+ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes,
+                                             const double                theTolerance,
+                                             TListOfListOfNodes &        theGroupsOfNodes)
+@@ -5107,10 +4596,9 @@
+   }
+   else
+     nodes=theNodes;
+-
+   SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance);
+-}
+ 
++}
+ 
+ //=======================================================================
+ /*!
+@@ -5120,14 +4608,11 @@
+ 
+ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
+ {
+-  //---------------------------------------------------------------------
+   /*!
+    * \brief Constructor
+    */
+   SMESH_NodeSearcherImpl( const SMESHDS_Mesh* theMesh )
+   {
+-    myMesh = ( SMESHDS_Mesh* ) theMesh;
+-
+     set<const SMDS_MeshNode*> nodes;
+     if ( theMesh ) {
+       SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator();
+@@ -5135,43 +4620,19 @@
+         nodes.insert( nodes.end(), nIt->next() );
+     }
+     myOctreeNode = new SMESH_OctreeNode(nodes) ;
+-
+-    // get max size of a leaf box
+-    SMESH_OctreeNode* tree = myOctreeNode;
+-    while ( !tree->isLeaf() )
+-    {
+-      SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
+-      if ( cIt->more() )
+-        tree = cIt->next();
+-    }
+-    myHalfLeafSize = tree->maxSize() / 2.;
+   }
+-
+-  //---------------------------------------------------------------------
+-  /*!
+-   * \brief Move node and update myOctreeNode accordingly
+-   */
+-  void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt )
+-  {
+-    myOctreeNode->UpdateByMoveNode( node, toPnt );
+-    myMesh->MoveNode( node, toPnt.X(), toPnt.Y(), toPnt.Z() );
+-  }
+-
+-  //---------------------------------------------------------------------
+   /*!
+    * \brief Do it's job
+    */
+   const SMDS_MeshNode* FindClosestTo( const gp_Pnt& thePnt )
+   {
+     SMDS_MeshNode tgtNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
+-    map<double, const SMDS_MeshNode*> dist2Nodes;
+-    myOctreeNode->NodesAround( &tgtNode, dist2Nodes, myHalfLeafSize );
+-    if ( !dist2Nodes.empty() )
+-      return dist2Nodes.begin()->second;
+     list<const SMDS_MeshNode*> nodes;
+-    //myOctreeNode->NodesAround( &tgtNode, &nodes, myHalfLeafSize );
++    const double precision = 1e-6;
++    //myOctreeNode->NodesAround( &tgtNode, &nodes, precision );
+ 
+     double minSqDist = DBL_MAX;
++    Bnd_B3d box;
+     if ( nodes.empty() )  // get all nodes of OctreeNode's closest to thePnt
+     {
+       // sort leafs by their distance from thePnt
+@@ -5180,25 +4641,20 @@
+       list< SMESH_OctreeNode* > treeList;
+       list< SMESH_OctreeNode* >::iterator trIt;
+       treeList.push_back( myOctreeNode );
+-
+-      SMDS_MeshNode pointNode( thePnt.X(), thePnt.Y(), thePnt.Z() );
+       for ( trIt = treeList.begin(); trIt != treeList.end(); ++trIt)
+       {
+         SMESH_OctreeNode* tree = *trIt;
+-        if ( !tree->isLeaf() ) // put children to the queue
+-        {
+-          if ( !tree->isInside( &pointNode, myHalfLeafSize )) continue;
++        if ( !tree->isLeaf() ) { // put children to the queue
+           SMESH_OctreeNodeIteratorPtr cIt = tree->GetChildrenIterator();
+           while ( cIt->more() )
+             treeList.push_back( cIt->next() );
+         }
+-        else if ( tree->NbNodes() ) // put a tree to the treeMap
+-        {
+-          const Bnd_B3d& box = tree->getBox();
++        else if ( tree->NbNodes() ) { // put tree to treeMap
++          tree->getBox( box );
+           double sqDist = thePnt.SquareDistance( 0.5 * ( box.CornerMin() + box.CornerMax() ));
+           pair<TDistTreeMap::iterator,bool> it_in = treeMap.insert( make_pair( sqDist, tree ));
+           if ( !it_in.second ) // not unique distance to box center
+-            treeMap.insert( it_in.first, make_pair( sqDist + 1e-13*treeMap.size(), tree ));
++            treeMap.insert( it_in.first, make_pair( sqDist - 1e-13*treeMap.size(), tree ));
+         }
+       }
+       // find distance after which there is no sense to check tree's
+@@ -5206,7 +4662,7 @@
+       TDistTreeMap::iterator sqDist_tree = treeMap.begin();
+       if ( treeMap.size() > 5 ) {
+         SMESH_OctreeNode* closestTree = sqDist_tree->second;
+-        const Bnd_B3d& box = closestTree->getBox();
++        closestTree->getBox( box );
+         double limit = sqrt( sqDist_tree->first ) + sqrt ( box.SquareExtent() );
+         sqLimit = limit * limit;
+       }
+@@ -5231,23 +4687,12 @@
+     }
+     return closestNode;
+   }
+-
+-  //---------------------------------------------------------------------
+   /*!
+    * \brief Destructor
+    */
+   ~SMESH_NodeSearcherImpl() { delete myOctreeNode; }
+-
+-  //---------------------------------------------------------------------
+-  /*!
+-   * \brief Return the node tree
+-   */
+-  const SMESH_OctreeNode* getTree() const { return myOctreeNode; }
+-
+ private:
+   SMESH_OctreeNode* myOctreeNode;
+-  SMESHDS_Mesh*     myMesh;
+-  double            myHalfLeafSize; // max size of a leaf box
+ };
+ 
+ //=======================================================================
+@@ -5261,404 +4706,6 @@
+   return new SMESH_NodeSearcherImpl( GetMeshDS() );
+ }
+ 
+-// ========================================================================
+-namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
+-{
+-  const int MaxNbElemsInLeaf = 10; // maximal number of elements in a leaf of tree
+-  const int MaxLevel         = 7;  // maximal tree height -> nb terminal boxes: 8^7 = 2097152
+-  const double NodeRadius = 1e-9;  // to enlarge bnd box of element
+-
+-  //=======================================================================
+-  /*!
+-   * \brief Octal tree of bounding boxes of elements
+-   */
+-  //=======================================================================
+-
+-  class ElementBndBoxTree : public SMESH_Octree
+-  {
+-  public:
+-
+-    ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType);
+-    void getElementsNearPoint( const gp_Pnt& point, TIDSortedElemSet& foundElems);
+-    ~ElementBndBoxTree();
+-
+-  protected:
+-    ElementBndBoxTree() {}
+-    SMESH_Octree* allocateOctreeChild() const { return new ElementBndBoxTree; }
+-    void buildChildrenData();
+-    Bnd_B3d* buildRootBox();
+-  private:
+-    //!< Bounding box of element
+-    struct ElementBox : public Bnd_B3d
+-    {
+-      const SMDS_MeshElement* _element;
+-      int                     _refCount; // an ElementBox can be included in several tree branches
+-      ElementBox(const SMDS_MeshElement* elem);
+-    };
+-    vector< ElementBox* > _elements;
+-  };
+-
+-  //================================================================================
+-  /*!
+-   * \brief ElementBndBoxTree creation
+-   */
+-  //================================================================================
+-
+-  ElementBndBoxTree::ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType)
+-    :SMESH_Octree( new SMESH_Octree::Limit( MaxLevel, /*minSize=*/0. ))
+-  {
+-    int nbElems = mesh.GetMeshInfo().NbElements( elemType );
+-    _elements.reserve( nbElems );
+-
+-    SMDS_ElemIteratorPtr elemIt = mesh.elementsIterator( elemType );
+-    while ( elemIt->more() )
+-      _elements.push_back( new ElementBox( elemIt->next() ));
+-
+-    if ( _elements.size() > MaxNbElemsInLeaf )
+-      compute();
+-    else
+-      myIsLeaf = true;
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Destructor
+-   */
+-  //================================================================================
+-
+-  ElementBndBoxTree::~ElementBndBoxTree()
+-  {
+-    for ( int i = 0; i < _elements.size(); ++i )
+-      if ( --_elements[i]->_refCount <= 0 )
+-        delete _elements[i];
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Return the maximal box
+-   */
+-  //================================================================================
+-
+-  Bnd_B3d* ElementBndBoxTree::buildRootBox()
+-  {
+-    Bnd_B3d* box = new Bnd_B3d;
+-    for ( int i = 0; i < _elements.size(); ++i )
+-      box->Add( *_elements[i] );
+-    return box;
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Redistrubute element boxes among children
+-   */
+-  //================================================================================
+-
+-  void ElementBndBoxTree::buildChildrenData()
+-  {
+-    for ( int i = 0; i < _elements.size(); ++i )
+-    {
+-      for (int j = 0; j < 8; j++)
+-      {
+-        if ( !_elements[i]->IsOut( myChildren[j]->getBox() ))
+-        {
+-          _elements[i]->_refCount++;
+-          ((ElementBndBoxTree*)myChildren[j])->_elements.push_back( _elements[i]);
+-        }
+-      }
+-      _elements[i]->_refCount--;
+-    }
+-    _elements.clear();
+-
+-    for (int j = 0; j < 8; j++)
+-    {
+-      ElementBndBoxTree* child = static_cast<ElementBndBoxTree*>( myChildren[j]);
+-      if ( child->_elements.size() <= MaxNbElemsInLeaf )
+-        child->myIsLeaf = true;
+-
+-      if ( child->_elements.capacity() - child->_elements.size() > 1000 )
+-        child->_elements.resize( child->_elements.size() ); // compact
+-    }
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Return elements which can include the point
+-   */
+-  //================================================================================
+-
+-  void ElementBndBoxTree::getElementsNearPoint( const gp_Pnt&     point,
+-                                                TIDSortedElemSet& foundElems)
+-  {
+-    if ( level() && getBox().IsOut( point.XYZ() ))
+-      return;
+-
+-    if ( isLeaf() )
+-    {
+-      for ( int i = 0; i < _elements.size(); ++i )
+-        if ( !_elements[i]->IsOut( point.XYZ() ))
+-          foundElems.insert( _elements[i]->_element );
+-    }
+-    else
+-    {
+-      for (int i = 0; i < 8; i++)
+-        ((ElementBndBoxTree*) myChildren[i])->getElementsNearPoint( point, foundElems );
+-    }
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Construct the element box
+-   */
+-  //================================================================================
+-
+-  ElementBndBoxTree::ElementBox::ElementBox(const SMDS_MeshElement* elem)
+-  {
+-    _element  = elem;
+-    _refCount = 1;
+-    SMDS_ElemIteratorPtr nIt = elem->nodesIterator();
+-    while ( nIt->more() )
+-      Add( TNodeXYZ( cast2Node( nIt->next() )));
+-    Enlarge( NodeRadius );
+-  }
+-
+-} // namespace
+-
+-//=======================================================================
+-/*!
+- * \brief Implementation of search for the elements by point
+- */
+-//=======================================================================
+-
+-struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
+-{
+-  SMESHDS_Mesh*           _mesh;
+-  ElementBndBoxTree*      _ebbTree;
+-  SMESH_NodeSearcherImpl* _nodeSearcher;
+-  SMDSAbs_ElementType     _elementType;
+-
+-  SMESH_ElementSearcherImpl( SMESHDS_Mesh& mesh ): _mesh(&mesh),_ebbTree(0),_nodeSearcher(0) {}
+-  ~SMESH_ElementSearcherImpl()
+-  {
+-    if ( _ebbTree )      delete _ebbTree;      _ebbTree      = 0;
+-    if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0;
+-  }
+-
+-  /*!
+-   * \brief Return elements of given type where the given point is IN or ON.
+-   *
+-   * 'ALL' type means elements of any type excluding nodes and 0D elements
+-   */
+-  void FindElementsByPoint(const gp_Pnt&                      point,
+-                           SMDSAbs_ElementType                type,
+-                           vector< const SMDS_MeshElement* >& foundElements)
+-  {
+-    foundElements.clear();
+-
+-    const SMDS_MeshInfo& meshInfo = _mesh->GetMeshInfo();
+-
+-    // -----------------
+-    // define tolerance
+-    // -----------------
+-    double tolerance = 0;
+-    if ( _nodeSearcher && meshInfo.NbNodes() > 1 )
+-    {
+-      double boxSize = _nodeSearcher->getTree()->maxSize();
+-      tolerance = 1e-8 * boxSize/* / meshInfo.NbNodes()*/;
+-    }
+-    else if ( _ebbTree && meshInfo.NbElements() > 0 )
+-    {
+-      double boxSize = _ebbTree->maxSize();
+-      tolerance = 1e-8 * boxSize/* / meshInfo.NbElements()*/;
+-    }
+-    if ( tolerance == 0 )
+-    {
+-      // define tolerance by size of a most complex element
+-      int complexType = SMDSAbs_Volume;
+-      while ( complexType > SMDSAbs_All &&
+-              meshInfo.NbElements( SMDSAbs_ElementType( complexType )) < 1 )
+-        --complexType;
+-      if ( complexType == SMDSAbs_All ) return; // empty mesh
+-
+-      double elemSize;
+-      if ( complexType == int( SMDSAbs_Node ))
+-      {
+-        SMDS_NodeIteratorPtr nodeIt = _mesh->nodesIterator();
+-        elemSize = 1;
+-        if ( meshInfo.NbNodes() > 2 )
+-          elemSize = TNodeXYZ( nodeIt->next() ).Distance( nodeIt->next() );
+-      }
+-      else
+-      {
+-        const SMDS_MeshElement* elem =
+-          _mesh->elementsIterator( SMDSAbs_ElementType( complexType ))->next();
+-        SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+-        TNodeXYZ n1( cast2Node( nodeIt->next() ));
+-        while ( nodeIt->more() )
+-        {
+-          double dist = n1.Distance( cast2Node( nodeIt->next() ));
+-          elemSize = max( dist, elemSize );
+-        }
+-      }
+-      tolerance = 1e-6 * elemSize;
+-    }
+-
+-    // =================================================================================
+-    if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement )
+-    {
+-      if ( !_nodeSearcher )
+-        _nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
+-
+-      const SMDS_MeshNode* closeNode = _nodeSearcher->FindClosestTo( point );
+-      if ( !closeNode ) return;
+-
+-      if ( point.Distance( TNodeXYZ( closeNode )) > tolerance )
+-        return; // to far from any node
+-
+-      if ( type == SMDSAbs_Node )
+-      {
+-        foundElements.push_back( closeNode );
+-      }
+-      else
+-      {
+-        SMDS_ElemIteratorPtr elemIt = closeNode->GetInverseElementIterator( SMDSAbs_0DElement );
+-        while ( elemIt->more() )
+-          foundElements.push_back( elemIt->next() );
+-      }
+-    }
+-    // =================================================================================
+-    else // elements more complex than 0D
+-    {
+-      if ( !_ebbTree || _elementType != type )
+-      {
+-        if ( _ebbTree ) delete _ebbTree;
+-        _ebbTree = new ElementBndBoxTree( *_mesh, _elementType = type );
+-      }
+-      TIDSortedElemSet suspectElems;
+-      _ebbTree->getElementsNearPoint( point, suspectElems );
+-      TIDSortedElemSet::iterator elem = suspectElems.begin();
+-      for ( ; elem != suspectElems.end(); ++elem )
+-        if ( !SMESH_MeshEditor::isOut( *elem, point, tolerance ))
+-          foundElements.push_back( *elem );
+-    }
+-  }
+-}; // struct SMESH_ElementSearcherImpl
+-
+-//=======================================================================
+-/*!
+- * \brief Return SMESH_ElementSearcher
+- */
+-//=======================================================================
+-
+-SMESH_ElementSearcher* SMESH_MeshEditor::GetElementSearcher()
+-{
+-  return new SMESH_ElementSearcherImpl( *GetMeshDS() );
+-}
+-
+-//=======================================================================
+-/*!
+- * \brief Return true if the point is IN or ON of the element
+- */
+-//=======================================================================
+-
+-bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol )
+-{
+-  if ( element->GetType() == SMDSAbs_Volume)
+-  {
+-    return SMDS_VolumeTool( element ).IsOut( point.X(), point.Y(), point.Z(), tol );
+-  }
+-
+-  // get ordered nodes
+-
+-  vector< gp_XYZ > xyz;
+-
+-  SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
+-  if ( element->IsQuadratic() )
+-    if (const SMDS_QuadraticFaceOfNodes* f=dynamic_cast<const SMDS_QuadraticFaceOfNodes*>(element))
+-      nodeIt = f->interlacedNodesElemIterator();
+-    else if (const SMDS_QuadraticEdge*  e =dynamic_cast<const SMDS_QuadraticEdge*>(element))
+-      nodeIt = e->interlacedNodesElemIterator();
+-
+-  while ( nodeIt->more() )
+-    xyz.push_back( TNodeXYZ( cast2Node( nodeIt->next() )));
+-
+-  if ( element->GetType() == SMDSAbs_Face ) // --------------------------------------------------
+-  {
+-    // gravity center
+-    gp_XYZ gc(0,0,0);
+-    gc = accumulate( xyz.begin(), xyz.end(), gc );
+-    gc /= element->NbNodes();
+-
+-    // compute face normal using gc
+-    gp_Vec normal(0,0,0);
+-    xyz.push_back( xyz.front() );
+-    for ( int i = 0; i < element->NbNodes(); ++i )
+-    {
+-      gp_Vec edge( xyz[i], xyz[i+1]);
+-      gp_Vec n2gc( xyz[i], gc );
+-      normal += edge ^ n2gc;
+-    }
+-    double faceDoubleArea = normal.Magnitude();
+-    if ( faceDoubleArea <= numeric_limits<double>::min() )
+-      return true; // invalid face
+-    normal /= faceDoubleArea;
+-
+-    // check if the point lays on face plane
+-    gp_Vec n2p( xyz[0], point );
+-    if ( fabs( n2p * normal ) > tol )
+-      return true; // not on face plane
+-
+-    // check if point is out of face boundary
+-    int i, out = false;
+-    for ( i = 0; !out && i < element->NbNodes(); ++i )
+-    {
+-      gp_Vec edge( xyz[i], xyz[i+1]);
+-      gp_Vec n2p ( xyz[i], point );
+-      gp_Vec cross = edge ^ n2p;
+-      out = ( cross * normal < -tol );
+-    }
+-    if ( out && element->IsPoly() )
+-    {
+-      // define point position by the closest edge
+-      double minDist = numeric_limits<double>::max();
+-      int iMinDist;
+-      for ( i = 0; i < element->NbNodes(); ++i )
+-      {
+-        gp_Vec edge( xyz[i], xyz[i+1]);
+-        gp_Vec n1p ( xyz[i], point);
+-        double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude();
+-        if ( dist < minDist )
+-          iMinDist = i;
+-      }
+-      gp_Vec edge( xyz[iMinDist], xyz[iMinDist+1]);
+-      gp_Vec n2p ( xyz[iMinDist], point );
+-      gp_Vec cross = edge ^ n2p;
+-      out = ( cross * normal < -tol );
+-    }
+-    return out;
+-  }
+-  if ( element->GetType() == SMDSAbs_Edge ) // --------------------------------------------------
+-  {
+-    for ( int i = 1; i < element->NbNodes(); ++i )
+-    {
+-      gp_Vec edge( xyz[i-1], xyz[i]);
+-      gp_Vec n1p ( xyz[i-1], point);
+-      double dist = ( edge ^ n1p ).Magnitude() / edge.Magnitude();
+-      if ( dist > tol )
+-        return true;
+-      gp_Vec n2p( xyz[i], point );
+-      if ( fabs( edge.Magnitude() - n1p.Magnitude() - n2p.Magnitude()) > tol )
+-        return true;
+-    }
+-    return false;
+-  }
+-  // Node or 0D element -------------------------------------------------------------------------
+-  {
+-    gp_Vec n2p ( xyz[0], point );
+-    return n2p.Magnitude() <= tol;
+-  }
+-  return true;
+-}
+-
+ //=======================================================================
+ //function : SimplifyFace
+ //purpose  :
+@@ -5777,7 +4824,7 @@
+       SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator();
+       while ( invElemIt->more() ) {
+         const SMDS_MeshElement* elem = invElemIt->next();
+-        elems.insert(elem);
++          elems.insert(elem);
+       }
+     }
+   }
+@@ -6311,24 +5358,24 @@
+ // ========================================================
+ class SortableElement : public set <const SMDS_MeshElement*>
+ {
+-public:
++ public:
+ 
+   SortableElement( const SMDS_MeshElement* theElem )
+-  {
+-    myElem = theElem;
+-    SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator();
+-    while ( nodeIt->more() )
+-      this->insert( nodeIt->next() );
+-  }
++    {
++      myElem = theElem;
++      SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator();
++      while ( nodeIt->more() )
++        this->insert( nodeIt->next() );
++    }
+ 
+   const SMDS_MeshElement* Get() const
+-  { return myElem; }
++    { return myElem; }
+ 
+   void Set(const SMDS_MeshElement* e) const
+-  { myElem = e; }
++    { myElem = e; }
+ 
+ 
+-private:
++ private:
+   mutable const SMDS_MeshElement* myElem;
+ };
+ 
+@@ -6338,7 +5385,7 @@
+ //           Search among theElements or in the whole mesh if theElements is empty
+ //=======================================================================
+ void SMESH_MeshEditor::FindEqualElements(set<const SMDS_MeshElement*> & theElements,
+-                                         TListOfListOfElementsID &      theGroupsOfElementsID)
++					 TListOfListOfElementsID &      theGroupsOfElementsID)
+ {
+   myLastCreatedElems.Clear();
+   myLastCreatedNodes.Clear();
+@@ -6436,7 +5483,7 @@
+ void SMESH_MeshEditor::MergeEqualElements()
+ {
+   set<const SMDS_MeshElement*> aMeshElements; /* empty input -
+-                                                 to merge equal elements in the whole mesh */
++						 to merge equal elements in the whole mesh */
+   TListOfListOfElementsID aGroupsOfElementsID;
+   FindEqualElements(aMeshElements, aGroupsOfElementsID);
+   MergeElements(aGroupsOfElementsID);
+@@ -6450,10 +5497,10 @@
+ //=======================================================================
+ 
+ const SMDS_MeshElement*
+-SMESH_MeshEditor::FindFaceInSet(const SMDS_MeshNode*    n1,
+-                                const SMDS_MeshNode*    n2,
+-                                const TIDSortedElemSet& elemSet,
+-                                const TIDSortedElemSet& avoidSet)
++  SMESH_MeshEditor::FindFaceInSet(const SMDS_MeshNode*    n1,
++                                  const SMDS_MeshNode*    n2,
++                                  const TIDSortedElemSet& elemSet,
++                                  const TIDSortedElemSet& avoidSet)
+ 
+ {
+   SMDS_ElemIteratorPtr invElemIt = n1->GetInverseElementIterator(SMDSAbs_Face);
+@@ -6567,7 +5614,7 @@
+ 
+   //vector<const SMDS_MeshNode*> nodes;
+   const SMDS_MeshNode *nIgnore = theFirstNode, *nStart = theSecondNode;
+-  TIDSortedElemSet foundElems;
++  set < const SMDS_MeshElement* > foundElems;
+   bool needTheLast = ( theLastNode != 0 );
+ 
+   while ( nStart != theLastNode ) {
+@@ -6586,7 +5633,7 @@
+         int iNode = 0, nbNodes = e->NbNodes();
+         //const SMDS_MeshNode* nodes[nbNodes+1];
+         vector<const SMDS_MeshNode*> nodes(nbNodes+1);
+-
++        
+         if(e->IsQuadratic()) {
+           const SMDS_QuadraticFaceOfNodes* F =
+             static_cast<const SMDS_QuadraticFaceOfNodes*>(e);
+@@ -6706,15 +5753,15 @@
+ //=======================================================================
+ 
+ SMESH_MeshEditor::Sew_Error
+-SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode,
+-                                 const SMDS_MeshNode* theBordSecondNode,
+-                                 const SMDS_MeshNode* theBordLastNode,
+-                                 const SMDS_MeshNode* theSideFirstNode,
+-                                 const SMDS_MeshNode* theSideSecondNode,
+-                                 const SMDS_MeshNode* theSideThirdNode,
+-                                 const bool           theSideIsFreeBorder,
+-                                 const bool           toCreatePolygons,
+-                                 const bool           toCreatePolyedrs)
++  SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode,
++                                   const SMDS_MeshNode* theBordSecondNode,
++                                   const SMDS_MeshNode* theBordLastNode,
++                                   const SMDS_MeshNode* theSideFirstNode,
++                                   const SMDS_MeshNode* theSideSecondNode,
++                                   const SMDS_MeshNode* theSideThirdNode,
++                                   const bool           theSideIsFreeBorder,
++                                   const bool           toCreatePolygons,
++                                   const bool           toCreatePolyedrs)
+ {
+   myLastCreatedElems.Clear();
+   myLastCreatedNodes.Clear();
+@@ -6968,7 +6015,7 @@
+ 
+   TListOfListOfNodes nodeGroupsToMerge;
+   if ( nbNodes[0] == nbNodes[1] ||
+-       ( theSideIsFreeBorder && !theSideThirdNode)) {
++      ( theSideIsFreeBorder && !theSideThirdNode)) {
+ 
+     // all nodes are to be merged
+ 
+@@ -7619,47 +6666,44 @@
+     switch( aType )
+     {
+     case SMDSAbs_Edge :
+-      {
+-        NewElem = theHelper.AddEdge(aNds[0], aNds[1], id, theForce3d);
+-        break;
+-      }
++    {
++      NewElem = theHelper.AddEdge(aNds[0], aNds[1], id, theForce3d);
++      break;
++    }
+     case SMDSAbs_Face :
++    {
++      switch(nbNodes)
+       {
+-        switch(nbNodes)
+-        {
+-        case 3:
+-          NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d);
+-          break;
+-        case 4:
+-          NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
+-          break;
+-        default:
+-          continue;
+-        }
+-        break;
++      case 3:
++	NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d);
++	break;
++      case 4:
++	NewElem = theHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
++	break;
++      default:
++	continue;
+       }
++      break;
++    }
+     case SMDSAbs_Volume :
++    {
++      switch(nbNodes)
+       {
+-        switch(nbNodes)
+-        {
+-        case 4:
+-          NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
+-          break;
+-        case 5:
+-          NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], id, theForce3d);
+-          break;
+-        case 6:
+-          NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d);
+-          break;
+-        case 8:
+-          NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3],
+-                                        aNds[4], aNds[5], aNds[6], aNds[7], id, theForce3d);
+-          break;
+-        default:
+-          continue;
+-        }
+-        break;
++      case 4:
++	NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
++	break;
++      case 6:
++	NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d);
++	break;
++      case 8:
++	NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3],
++                                      aNds[4], aNds[5], aNds[6], aNds[7], id, theForce3d);
++	break;
++      default:
++	continue;
+       }
++      break;
++    }
+     default :
+       continue;
+     }
+@@ -7707,11 +6751,11 @@
+       const SMDS_MeshEdge* edge = aEdgeItr->next();
+       if(edge && !edge->IsQuadratic())
+       {
+-        int id = edge->GetID();
+-        const SMDS_MeshNode* n1 = edge->GetNode(0);
+-        const SMDS_MeshNode* n2 = edge->GetNode(1);
++	int id = edge->GetID();
++	const SMDS_MeshNode* n1 = edge->GetNode(0);
++	const SMDS_MeshNode* n2 = edge->GetNode(1);
+ 
+-        meshDS->RemoveFreeElement(edge, smDS, notFromGroups);
++	meshDS->RemoveFreeElement(edge, smDS, notFromGroups);
+ 
+         const SMDS_MeshEdge* NewEdge = aHelper.AddEdge(n1, n2, id, theForce3d);
+         ReplaceElemInGroups( edge, NewEdge, GetMeshDS());
+@@ -7729,7 +6773,7 @@
+ 
+       for(int i = 0; i < nbNodes; i++)
+       {
+-        aNds[i] = face->GetNode(i);
++	aNds[i] = face->GetNode(i);
+       }
+ 
+       meshDS->RemoveFreeElement(face, smDS, notFromGroups);
+@@ -7738,13 +6782,13 @@
+       switch(nbNodes)
+       {
+       case 3:
+-        NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d);
+-        break;
++	NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], id, theForce3d);
++	break;
+       case 4:
+-        NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
+-        break;
++	NewFace = aHelper.AddFace(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d);
++	break;
+       default:
+-        continue;
++	continue;
+       }
+       ReplaceElemInGroups( face, NewFace, GetMeshDS());
+     }
+@@ -7760,7 +6804,7 @@
+ 
+       for(int i = 0; i < nbNodes; i++)
+       {
+-        aNds[i] = volume->GetNode(i);
++	aNds[i] = volume->GetNode(i);
+       }
+ 
+       meshDS->RemoveFreeElement(volume, smDS, notFromGroups);
+@@ -7769,31 +6813,23 @@
+       switch(nbNodes)
+       {
+       case 4:
+-        NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
++	NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
+                                       aNds[3], id, theForce3d );
+-        break;
+-      case 5:
+-        NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
+-                                      aNds[3], aNds[4], id, theForce3d);
+-        break;
++	break;
+       case 6:
+-        NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
++	NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2],
+                                       aNds[3], aNds[4], aNds[5], id, theForce3d);
+-        break;
++	break;
+       case 8:
+-        NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3],
++	NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3],
+                                       aNds[4], aNds[5], aNds[6], aNds[7], id, theForce3d);
+-        break;
++	break;
+       default:
+-        continue;
++	continue;
+       }
+       ReplaceElemInGroups(volume, NewVolume, meshDS);
+     }
+   }
+-  if ( !theForce3d ) {
+-    aHelper.SetSubShape(0); // apply to the whole mesh
+-    aHelper.FixQuadraticElements();
+-  }
+ }
+ 
+ //=======================================================================
+@@ -7825,12 +6861,12 @@
+ 
+       for(int i = 0; i < nbNodes; i++)
+       {
+-        const SMDS_MeshNode* n = elem->GetNode(i);
++	const SMDS_MeshNode* n = elem->GetNode(i);
+ 
+-        if( elem->IsMediumNode( n ) )
++	if( elem->IsMediumNode( n ) )
+           mediumNodes.push_back( n );
+-        else
+-          aNds.push_back( n );
++	else
++	  aNds.push_back( n );
+       }
+       if( aNds.empty() ) continue;
+       SMDSAbs_ElementType aType = elem->GetType();
+@@ -7841,7 +6877,7 @@
+       SMDS_MeshElement * NewElem = AddElement( aNds, aType, false, id );
+       ReplaceElemInGroups(elem, NewElem, meshDS);
+       if( theSm && NewElem )
+-        theSm->AddElement( NewElem );
++	theSm->AddElement( NewElem );
+ 
+       // remove medium nodes
+       vector<const SMDS_MeshNode*>::iterator nIt = mediumNodes.begin();
+@@ -7853,7 +6889,7 @@
+                                     ( n->GetPosition()->GetShapeId() ));
+           else
+             meshDS->RemoveFreeNode( n, theSm );
+-        }
++	}
+       }
+     }
+   }
+@@ -7879,7 +6915,7 @@
+       }
+     }
+   }
+-
++  
+   int totalNbElems =
+     GetMeshDS()->NbEdges() + GetMeshDS()->NbFaces() + GetMeshDS()->NbVolumes();
+   if ( nbCheckedElems < totalNbElems ) // not all elements are in submeshes
+@@ -7897,12 +6933,12 @@
+ //=======================================================================
+ 
+ SMESH_MeshEditor::Sew_Error
+-SMESH_MeshEditor::SewSideElements (TIDSortedElemSet&    theSide1,
+-                                   TIDSortedElemSet&    theSide2,
+-                                   const SMDS_MeshNode* theFirstNode1,
+-                                   const SMDS_MeshNode* theFirstNode2,
+-                                   const SMDS_MeshNode* theSecondNode1,
+-                                   const SMDS_MeshNode* theSecondNode2)
++  SMESH_MeshEditor::SewSideElements (TIDSortedElemSet&    theSide1,
++                                     TIDSortedElemSet&    theSide2,
++                                     const SMDS_MeshNode* theFirstNode1,
++                                     const SMDS_MeshNode* theFirstNode2,
++                                     const SMDS_MeshNode* theSecondNode1,
++                                     const SMDS_MeshNode* theSecondNode2)
+ {
+   myLastCreatedElems.Clear();
+   myLastCreatedNodes.Clear();
+@@ -8141,40 +7177,40 @@
+           const SMDS_MeshElement* aFreeFace = freeFaceList.front();
+           faceSet->insert( aFreeFace );
+           // complete a node set with nodes of a found free face
+-          //           for ( iNode = 0; iNode < ; iNode++ )
+-          //             nodeSet->insert( fNodes[ iNode ] );
++//           for ( iNode = 0; iNode < ; iNode++ )
++//             nodeSet->insert( fNodes[ iNode ] );
+         }
+ 
+       } // loop on volumes of a side
+ 
+-      //       // complete a set of faces if new nodes in a nodeSet appeared
+-      //       // ----------------------------------------------------------
+-      //       if ( nodeSetSize != nodeSet->size() ) {
+-      //         for ( ; nIt != nodeSet->end(); nIt++ ) { // loop on nodes of iSide
+-      //           SMDS_ElemIteratorPtr fIt = (*nIt)->GetInverseElementIterator(SMDSAbs_Face);
+-      //           while ( fIt->more() ) { // loop on faces sharing a node
+-      //             const SMDS_MeshElement* f = fIt->next();
+-      //             if ( faceSet->find( f ) == faceSet->end() ) {
+-      //               // check if all nodes are in nodeSet and
+-      //               // complete setOfFaceNodeSet if they are
+-      //               set <const SMDS_MeshNode*> faceNodeSet;
+-      //               SMDS_ElemIteratorPtr nodeIt = f->nodesIterator();
+-      //               bool allInSet = true;
+-      //               while ( nodeIt->more() && allInSet ) { // loop on nodes of a face
+-      //                 const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+-      //                 if ( nodeSet->find( n ) == nodeSet->end() )
+-      //                   allInSet = false;
+-      //                 else
+-      //                   faceNodeSet.insert( n );
+-      //               }
+-      //               if ( allInSet ) {
+-      //                 faceSet->insert( f );
+-      //                 setOfFaceNodeSet.insert( faceNodeSet );
+-      //               }
+-      //             }
+-      //           }
+-      //         }
+-      //       }
++//       // complete a set of faces if new nodes in a nodeSet appeared
++//       // ----------------------------------------------------------
++//       if ( nodeSetSize != nodeSet->size() ) {
++//         for ( ; nIt != nodeSet->end(); nIt++ ) { // loop on nodes of iSide
++//           SMDS_ElemIteratorPtr fIt = (*nIt)->GetInverseElementIterator(SMDSAbs_Face);
++//           while ( fIt->more() ) { // loop on faces sharing a node
++//             const SMDS_MeshElement* f = fIt->next();
++//             if ( faceSet->find( f ) == faceSet->end() ) {
++//               // check if all nodes are in nodeSet and
++//               // complete setOfFaceNodeSet if they are
++//               set <const SMDS_MeshNode*> faceNodeSet;
++//               SMDS_ElemIteratorPtr nodeIt = f->nodesIterator();
++//               bool allInSet = true;
++//               while ( nodeIt->more() && allInSet ) { // loop on nodes of a face
++//                 const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
++//                 if ( nodeSet->find( n ) == nodeSet->end() )
++//                   allInSet = false;
++//                 else
++//                   faceNodeSet.insert( n );
++//               }
++//               if ( allInSet ) {
++//                 faceSet->insert( f );
++//                 setOfFaceNodeSet.insert( faceNodeSet );
++//               }
++//             }
++//           }
++//         }
++//       }
+     } // Create temporary faces, if there are volumes given
+   } // loop on sides
+ 
+@@ -8280,10 +7316,10 @@
+                   nbl++;
+                   if(iSide==0)
+                     notLinkNodes1[nbl] = n;
+-                  //notLinkNodes1.push_back(n);
++                    //notLinkNodes1.push_back(n);
+                   else
+                     notLinkNodes2[nbl] = n;
+-                  //notLinkNodes2.push_back(n);
++                    //notLinkNodes2.push_back(n);
+                 }
+                 //faceNodes[ iSide ][ iNode++ ] = n;
+                 if(iSide==0) {
+@@ -8364,7 +7400,7 @@
+         //nReplaceMap.insert( TNodeNodeMap::value_type
+         //                   ( notLinkNodes[0][0], notLinkNodes[1][0] ));
+         nReplaceMap.insert( TNodeNodeMap::value_type
+-                            ( notLinkNodes1[0], notLinkNodes2[0] ));
++                           ( notLinkNodes1[0], notLinkNodes2[0] ));
+       }
+       else {
+         for ( iSide = 0; iSide < 2; iSide++ ) { // loop on 2 sides
+@@ -8385,7 +7421,7 @@
+           //                   ( notLinkNodes[0][1], notLinkNodes[1][1] ));
+           for(int nn=0; nn<nbNodes-2; nn++) {
+             nReplaceMap.insert( TNodeNodeMap::value_type
+-                                ( notLinkNodes1[nn], notLinkNodes2[nn] ));
++                             ( notLinkNodes1[nn], notLinkNodes2[nn] ));
+           }
+         }
+         else {
+@@ -8395,7 +7431,7 @@
+           //                   ( notLinkNodes[0][1], notLinkNodes[1][0] ));
+           for(int nn=0; nn<nbNodes-2; nn++) {
+             nReplaceMap.insert( TNodeNodeMap::value_type
+-                                ( notLinkNodes1[nn], notLinkNodes2[nbNodes-3-nn] ));
++                             ( notLinkNodes1[nn], notLinkNodes2[nbNodes-3-nn] ));
+           }
+         }
+       }
+@@ -8425,10 +7461,10 @@
+   } // loop on link lists
+ 
+   if ( aResult == SEW_OK &&
+-       ( linkIt[0] != linkList[0].end() ||
+-         !faceSetPtr[0]->empty() || !faceSetPtr[1]->empty() )) {
++      ( linkIt[0] != linkList[0].end() ||
++       !faceSetPtr[0]->empty() || !faceSetPtr[1]->empty() )) {
+     MESSAGE( (linkIt[0] != linkList[0].end()) <<" "<< (faceSetPtr[0]->empty()) <<
+-             " " << (faceSetPtr[1]->empty()));
++            " " << (faceSetPtr[1]->empty()));
+     aResult = SEW_TOPO_DIFF_SETS_OF_ELEMENTS;
+   }
+ 
+@@ -8483,17 +7519,17 @@
+ }
+ 
+ //================================================================================
+-/*!
+- * \brief Find corresponding nodes in two sets of faces
+- * \param theSide1 - first face set
+- * \param theSide2 - second first face
+- * \param theFirstNode1 - a boundary node of set 1
+- * \param theFirstNode2 - a node of set 2 corresponding to theFirstNode1
+- * \param theSecondNode1 - a boundary node of set 1 linked with theFirstNode1
+- * \param theSecondNode2 - a node of set 2 corresponding to theSecondNode1
+- * \param nReplaceMap - output map of corresponding nodes
+- * \retval bool  - is a success or not
+- */
++  /*!
++   * \brief Find corresponding nodes in two sets of faces
++    * \param theSide1 - first face set
++    * \param theSide2 - second first face
++    * \param theFirstNode1 - a boundary node of set 1
++    * \param theFirstNode2 - a node of set 2 corresponding to theFirstNode1
++    * \param theSecondNode1 - a boundary node of set 1 linked with theFirstNode1
++    * \param theSecondNode2 - a node of set 2 corresponding to theSecondNode1
++    * \param nReplaceMap - output map of corresponding nodes
++    * \retval bool  - is a success or not
++   */
+ //================================================================================
+ 
+ #ifdef _DEBUG_
+@@ -8610,8 +7646,8 @@
+       }
+ #ifdef DEBUG_MATCHING_NODES
+       MESSAGE ( " Link 1: " << link[0].first->GetID() <<" "<< link[0].second->GetID()
+-                << " F 1: " << face[0] << "| Link 2: " << link[1].first->GetID() <<" "
+-                << link[1].second->GetID() << " F 2: " << face[1] << " | Bind: " ) ;
++             << " F 1: " << face[0] << "| Link 2: " << link[1].first->GetID() <<" "
++	     << link[1].second->GetID() << " F 2: " << face[1] << " | Bind: " ) ;
+ #endif
+       int nbN = nbNodes[0];
+       {
+@@ -8642,7 +7678,7 @@
+         {
+ #ifdef DEBUG_MATCHING_NODES
+           MESSAGE ( "Add link 1: " << n1->GetID() << " " << n2->GetID() << " "
+-                    << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " );
++	  << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " );
+ #endif
+           linkList[0].push_back ( NLink( n1, n2 ));
+           linkList[1].push_back ( NLink( nReplaceMap[n1], nReplaceMap[n2] ));
+@@ -8657,120 +7693,6 @@
+ 
+ /*!
+   \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+-  \param theElems - the list of elements (edges or faces) to be replicated
+-  The nodes for duplication could be found from these elements
+-  \param theNodesNot - list of nodes to NOT replicate
+-  \param theAffectedElems - the list of elements (cells and edges) to which the 
+-  replicated nodes should be associated to.
+-  \return TRUE if operation has been completed successfully, FALSE otherwise
+-*/
+-bool SMESH_MeshEditor::DoubleNodes( const TIDSortedElemSet& theElems,
+-                                    const TIDSortedElemSet& theNodesNot,
+-                                    const TIDSortedElemSet& theAffectedElems )
+-{
+-  myLastCreatedElems.Clear();
+-  myLastCreatedNodes.Clear();
+-
+-  if ( theElems.size() == 0 )
+-    return false;
+-
+-  SMESHDS_Mesh* aMeshDS = GetMeshDS();
+-  if ( !aMeshDS )
+-    return false;
+-
+-  bool res = false;
+-  std::map< const SMDS_MeshNode*, const SMDS_MeshNode* > anOldNodeToNewNode;
+-  // duplicate elements and nodes
+-  res = doubleNodes( aMeshDS, theElems, theNodesNot, anOldNodeToNewNode, true );
+-  // replce nodes by duplications
+-  res = doubleNodes( aMeshDS, theAffectedElems, theNodesNot, anOldNodeToNewNode, false );
+-  return res;
+-}
+-
+-/*!
+-  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+-  \param theMeshDS - mesh instance
+-  \param theElems - the elements replicated or modified (nodes should be changed)
+-  \param theNodesNot - nodes to NOT replicate
+-  \param theNodeNodeMap - relation of old node to new created node
+-  \param theIsDoubleElem - flag os to replicate element or modify
+-  \return TRUE if operation has been completed successfully, FALSE otherwise
+-*/
+-bool SMESH_MeshEditor::doubleNodes( SMESHDS_Mesh*     theMeshDS,
+-                                    const TIDSortedElemSet& theElems,
+-                                    const TIDSortedElemSet& theNodesNot,
+-                                    std::map< const SMDS_MeshNode*,
+-                                    const SMDS_MeshNode* >& theNodeNodeMap,
+-                                    const bool theIsDoubleElem )
+-{
+-  // iterate on through element and duplicate them (by nodes duplication)
+-  bool res = false;
+-  TIDSortedElemSet::const_iterator elemItr = theElems.begin();
+-  for ( ;  elemItr != theElems.end(); ++elemItr )
+-  {
+-    const SMDS_MeshElement* anElem = *elemItr;
+-    if (!anElem)
+-      continue;
+-
+-    bool isDuplicate = false;
+-    // duplicate nodes to duplicate element
+-    std::vector<const SMDS_MeshNode*> newNodes( anElem->NbNodes() );
+-    SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+-    int ind = 0;
+-    while ( anIter->more() ) 
+-    { 
+-
+-      SMDS_MeshNode* aCurrNode = (SMDS_MeshNode*)anIter->next();
+-      SMDS_MeshNode* aNewNode = aCurrNode;
+-      if ( theNodeNodeMap.find( aCurrNode ) != theNodeNodeMap.end() )
+-        aNewNode = (SMDS_MeshNode*)theNodeNodeMap[ aCurrNode ];
+-      else if ( theIsDoubleElem && theNodesNot.find( aCurrNode ) == theNodesNot.end() )
+-      {
+-        // duplicate node
+-        aNewNode = theMeshDS->AddNode( aCurrNode->X(), aCurrNode->Y(), aCurrNode->Z() );
+-        theNodeNodeMap[ aCurrNode ] = aNewNode;
+-        myLastCreatedNodes.Append( aNewNode );
+-      }
+-      isDuplicate |= (aCurrNode != aNewNode);
+-      newNodes[ ind++ ] = aNewNode;
+-    }
+-    if ( !isDuplicate )
+-      continue;
+-
+-    if ( theIsDoubleElem )
+-      myLastCreatedElems.Append( AddElement(newNodes, anElem->GetType(), anElem->IsPoly()) );
+-    else
+-      theMeshDS->ChangeElementNodes( anElem, &newNodes[ 0 ], anElem->NbNodes() );
+-
+-    res = true;
+-  }
+-  return res;
+-}
+-
+-/*!
+-  \brief Check if element located inside shape
+-  \return TRUE if IN or ON shape, FALSE otherwise
+-*/
+-
+-static bool isInside(const SMDS_MeshElement* theElem,
+-                     BRepClass3d_SolidClassifier& theBsc3d,
+-                     const double theTol)
+-{
+-  gp_XYZ centerXYZ (0, 0, 0);
+-  SMDS_ElemIteratorPtr aNodeItr = theElem->nodesIterator();
+-  while (aNodeItr->more())
+-  {
+-    SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next();
+-    centerXYZ += gp_XYZ(aNode->X(), aNode->Y(), aNode->Z());
+-  }
+-  gp_Pnt aPnt(centerXYZ);
+-  theBsc3d.Perform(aPnt, theTol);
+-  TopAbs_State aState = theBsc3d.State();
+-  return (aState == TopAbs_IN || aState == TopAbs_ON );
+-}
+-
+-/*!
+-  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+   \param theNodes - identifiers of nodes to be doubled
+   \param theModifiedElems - identifiers of elements to be updated by the new (doubled) 
+          nodes. If list of element identifiers is empty then nodes are doubled but 
+@@ -8857,108 +7779,3 @@
+ 
+   return true;
+ }
+-
+-/*!
+-  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+-  \param theElems - group of of elements (edges or faces) to be replicated
+-  \param theNodesNot - group of nodes not to replicated
+-  \param theShape - shape to detect affected elements (element which geometric center
+-  located on or inside shape).
+-  The replicated nodes should be associated to affected elements.
+-  \return TRUE if operation has been completed successfully, FALSE otherwise
+-*/
+-
+-bool SMESH_MeshEditor::DoubleNodesInRegion( const TIDSortedElemSet& theElems,
+-                                            const TIDSortedElemSet& theNodesNot,
+-                                            const TopoDS_Shape&     theShape )
+-{
+-  if ( theShape.IsNull() )
+-    return false;
+-
+-  const double aTol = Precision::Confusion();
+-  BRepClass3d_SolidClassifier bsc3d(theShape);
+-  bsc3d.PerformInfinitePoint(aTol);
+-
+-  // iterates on indicated elements and get elements by back references from their nodes
+-  TIDSortedElemSet anAffected;
+-  TIDSortedElemSet::const_iterator elemItr = theElems.begin();
+-  for ( ;  elemItr != theElems.end(); ++elemItr )
+-  {
+-    SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
+-    if (!anElem)
+-      continue;
+-
+-    SMDS_ElemIteratorPtr nodeItr = anElem->nodesIterator();
+-    while ( nodeItr->more() )
+-    {
+-      const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(nodeItr->next());
+-      if ( !aNode || theNodesNot.find(aNode) != theNodesNot.end() )
+-        continue;
+-      SMDS_ElemIteratorPtr backElemItr = aNode->GetInverseElementIterator();
+-      while ( backElemItr->more() )
+-      {
+-        SMDS_MeshElement* curElem = (SMDS_MeshElement*)backElemItr->next();
+-        if ( curElem && theElems.find(curElem) == theElems.end() &&
+-             isInside( curElem, bsc3d, aTol ) )
+-          anAffected.insert( curElem );
+-      }
+-    }
+-  }
+-  return DoubleNodes( theElems, theNodesNot, anAffected );
+-}
+-
+-/*!
+- * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+- * The created 2D mesh elements based on nodes of free faces of boundary volumes
+- * \return TRUE if operation has been completed successfully, FALSE otherwise
+- */
+-
+-bool SMESH_MeshEditor::Make2DMeshFrom3D()
+-{
+-  // iterates on volume elements and detect all free faces on them
+-  SMESHDS_Mesh* aMesh = GetMeshDS();
+-  if (!aMesh)
+-    return false;
+-  bool res = false;
+-  SMDS_VolumeIteratorPtr vIt = aMesh->volumesIterator();
+-  while(vIt->more())
+-  {
+-    const SMDS_MeshVolume* volume = vIt->next();
+-    SMDS_VolumeTool vTool( volume );
+-    const bool isPoly = volume->IsPoly();
+-    const bool isQuad = volume->IsQuadratic();
+-    for ( int iface = 0, n = vTool.NbFaces(); iface < n; iface++ )
+-    {
+-      if (!vTool.IsFreeFace(iface))
+-        continue;
+-      vector<const SMDS_MeshNode *> nodes;
+-      int nbFaceNodes = vTool.NbFaceNodes(iface);
+-      const SMDS_MeshNode** faceNodes = vTool.GetFaceNodes(iface);
+-      if (vTool.IsFaceExternal(iface)) 
+-      {
+-        int inode = 0;
+-        for ( ; inode < nbFaceNodes; inode += isQuad ? 2 : 1)
+-          nodes.push_back(faceNodes[inode]);
+-        if (isQuad)
+-          for ( inode = 1; inode < nbFaceNodes; inode += 2)
+-            nodes.push_back(faceNodes[inode]);
+-      }
+-      else
+-      {
+-        int inode = nbFaceNodes-1;
+-        for ( ; inode >=0; inode -= isQuad ? 2 : 1)
+-          nodes.push_back(faceNodes[inode]);
+-        if (isQuad)
+-          for ( inode = nbFaceNodes-2; inode >=0; inode -= 2)
+-            nodes.push_back(faceNodes[inode]);
+-      }
+-
+-      // add new face based on volume nodes
+-      if (aMesh->FindFace( nodes ) )
+-        continue; // face already exsist
+-      myLastCreatedElems.Append( AddElement(nodes, SMDSAbs_Face, isPoly && iface == 1) );
+-      res = true;
+-    }
+-  }
+-  return res;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_MesherHelper.cpp salomesmesh/src/SMESH/SMESH_MesherHelper.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_MesherHelper.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_MesherHelper.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -27,43 +27,29 @@
+ 
+ #include "SMDS_FacePosition.hxx" 
+ #include "SMDS_EdgePosition.hxx"
+-#include "SMDS_VolumeTool.hxx"
+-#include "SMESH_subMesh.hxx"
+ 
+ #include <BRepAdaptor_Surface.hxx>
+ #include <BRepTools.hxx>
+-#include <BRepTools_WireExplorer.hxx>
+ #include <BRep_Tool.hxx>
++#include <BRepTools_WireExplorer.hxx>
+ #include <Geom2d_Curve.hxx>
+-#include <GeomAPI_ProjectPointOnSurf.hxx>
+ #include <Geom_Curve.hxx>
+ #include <Geom_Surface.hxx>
+ #include <ShapeAnalysis.hxx>
+ #include <TopExp.hxx>
+ #include <TopExp_Explorer.hxx>
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+-#include <TopTools_MapIteratorOfMapOfShape.hxx>
+ #include <TopTools_MapOfShape.hxx>
+ #include <TopoDS.hxx>
+-#include <gp_Ax3.hxx>
+ #include <gp_Pnt2d.hxx>
+-#include <gp_Trsf.hxx>
+ 
+ #include <Standard_Failure.hxx>
+ #include <Standard_ErrorHandler.hxx>
+ 
+ #include <utilities.h>
+ 
+-#include <limits>
+-
+ #define RETURN_BAD_RESULT(msg) { MESSAGE(msg); return false; }
+ 
+-namespace {
+-
+-  gp_XYZ XYZ(const SMDS_MeshNode* n) { return gp_XYZ(n->X(), n->Y(), n->Z()); }
+-
+-}
+-
+ //================================================================================
+ /*!
+  * \brief Constructor
+@@ -71,7 +57,7 @@
+ //================================================================================
+ 
+ SMESH_MesherHelper::SMESH_MesherHelper(SMESH_Mesh& theMesh)
+-  : myMesh(&theMesh), myShapeID(0), myCreateQuadratic(false)
++  : myMesh(&theMesh), myShapeID(-1), myCreateQuadratic(false)
+ {
+   mySetElemOnShape = ( ! myMesh->HasShapeToMesh() );
+ }
+@@ -86,14 +72,14 @@
+   SMESHDS_Mesh* meshDS = GetMeshDS();
+   // we can create quadratic elements only if all elements
+   // created on subshapes of given shape are quadratic
+-  // also we have to fill myTLinkNodeMap
++  // also we have to fill myNLinkNodeMap
+   myCreateQuadratic = true;
+   mySeamShapeIds.clear();
+   myDegenShapeIds.clear();
+   TopAbs_ShapeEnum subType( aSh.ShapeType()==TopAbs_FACE ? TopAbs_EDGE : TopAbs_FACE );
+   SMDSAbs_ElementType elemType( subType==TopAbs_FACE ? SMDSAbs_Face : SMDSAbs_Edge );
+ 
+-  int nbOldLinks = myTLinkNodeMap.size();
++  int nbOldLinks = myNLinkNodeMap.size();
+ 
+   TopExp_Explorer exp( aSh, subType );
+   for (; exp.More() && myCreateQuadratic; exp.Next()) {
+@@ -106,19 +92,19 @@
+             break;
+           }
+           else {
+-            // fill TLinkNodeMap
++            // fill NLinkNodeMap
+             switch ( e->NbNodes() ) {
+             case 3:
+-              AddTLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(2)); break;
++              AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(2)); break;
+             case 6:
+-              AddTLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(3));
+-              AddTLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(4));
+-              AddTLinkNode(e->GetNode(2),e->GetNode(0),e->GetNode(5)); break;
++              AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(3));
++              AddNLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(4));
++              AddNLinkNode(e->GetNode(2),e->GetNode(0),e->GetNode(5)); break;
+             case 8:
+-              AddTLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(4));
+-              AddTLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(5));
+-              AddTLinkNode(e->GetNode(2),e->GetNode(3),e->GetNode(6));
+-              AddTLinkNode(e->GetNode(3),e->GetNode(0),e->GetNode(7));
++              AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(4));
++              AddNLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(5));
++              AddNLinkNode(e->GetNode(2),e->GetNode(3),e->GetNode(6));
++              AddNLinkNode(e->GetNode(3),e->GetNode(0),e->GetNode(7));
+               break;
+             default:
+               myCreateQuadratic = false;
+@@ -130,11 +116,11 @@
+     }
+   }
+ 
+-  if ( nbOldLinks == myTLinkNodeMap.size() )
++  if ( nbOldLinks == myNLinkNodeMap.size() )
+     myCreateQuadratic = false;
+ 
+   if(!myCreateQuadratic) {
+-    myTLinkNodeMap.clear();
++    myNLinkNodeMap.clear();
+   }
+   SetSubShape( aSh );
+ 
+@@ -175,7 +161,7 @@
+   myDegenShapeIds.clear();
+ 
+   if ( myShape.IsNull() ) {
+-    myShapeID  = 0;
++    myShapeID  = -1;
+     return;
+   }
+   SMESHDS_Mesh* meshDS = GetMeshDS();
+@@ -244,8 +230,7 @@
+   if ( !F.IsNull() && !myShape.IsNull() && myShape.IsSame( F ))
+     return !mySeamShapeIds.empty();
+ 
+-  TopLoc_Location loc;
+-  Handle(Geom_Surface) aSurface = BRep_Tool::Surface( F,loc );
++  Handle(Geom_Surface) aSurface = BRep_Tool::Surface( F );
+   if ( !aSurface.IsNull() )
+     return ( aSurface->IsUPeriodic() || aSurface->IsVPeriodic() );
+ 
+@@ -258,45 +243,26 @@
+ //=======================================================================
+ 
+ bool SMESH_MesherHelper::IsMedium(const SMDS_MeshNode*      node,
+-                                  const SMDSAbs_ElementType typeToCheck)
++                                 const SMDSAbs_ElementType typeToCheck)
+ {
+   return SMESH_MeshEditor::IsMedium( node, typeToCheck );
+ }
+ 
+ //=======================================================================
+-/*!
+- * \brief Return support shape of a node
+- * \param node - the node
+- * \param meshDS - mesh DS
+- * \retval TopoDS_Shape - found support shape
+- */
+-//=======================================================================
+-
+-TopoDS_Shape SMESH_MesherHelper::GetSubShapeByNode(const SMDS_MeshNode* node,
+-                                                   SMESHDS_Mesh*        meshDS)
+-{
+-  int shapeID = node->GetPosition()->GetShapeId();
+-  if ( 0 < shapeID && shapeID <= meshDS->MaxShapeIndex() )
+-    return meshDS->IndexToShape( shapeID );
+-  else
+-    return TopoDS_Shape();
+-}
+-
+-
+-//=======================================================================
+-//function : AddTLinkNode
++//function : AddNLinkNode
+ //purpose  : 
+ //=======================================================================
+ /*!
+- * Auxilary function for filling myTLinkNodeMap
++ * Auxilary function for filling myNLinkNodeMap
+  */
+-void SMESH_MesherHelper::AddTLinkNode(const SMDS_MeshNode* n1,
+-                                      const SMDS_MeshNode* n2,
+-                                      const SMDS_MeshNode* n12)
++void SMESH_MesherHelper::AddNLinkNode(const SMDS_MeshNode* n1,
++                                     const SMDS_MeshNode* n2,
++                                     const SMDS_MeshNode* n12)
+ {
++  NLink link( n1, n2 );
++  if ( n1 > n2 ) link = NLink( n2, n1 );
+   // add new record to map
+-  SMESH_TLink link( n1, n2 );
+-  myTLinkNodeMap.insert( make_pair(link,n12));
++  myNLinkNodeMap.insert( make_pair(link,n12));
+ }
+ 
+ //=======================================================================
+@@ -326,94 +292,72 @@
+  * \param F - the face
+  * \param n - the node
+  * \param n2 - a node of element being created located inside a face
+- * \param check - optional flag returing false if found UV are invalid
+  * \retval gp_XY - resulting UV
++ * 
++ * Auxilary function called form GetMediumNode()
+  */
+ //=======================================================================
+ 
+ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face&   F,
+                                     const SMDS_MeshNode* n,
+-                                    const SMDS_MeshNode* n2,
+-                                    bool*                check) const
++                                    const SMDS_MeshNode* n2) const
+ {
+   gp_Pnt2d uv( 1e100, 1e100 );
+   const SMDS_PositionPtr Pos = n->GetPosition();
+-  bool uvOK = false;
+   if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE)
+   {
+     // node has position on face
+     const SMDS_FacePosition* fpos =
+       static_cast<const SMDS_FacePosition*>(n->GetPosition().get());
+-    uv.SetCoord(fpos->GetUParameter(),fpos->GetVParameter());
+-    uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( F ));
++    uv = gp_Pnt2d(fpos->GetUParameter(),fpos->GetVParameter());
+   }
+   else if(Pos->GetTypeOfPosition()==SMDS_TOP_EDGE)
+   {
+     // node has position on edge => it is needed to find
+     // corresponding edge from face, get pcurve for this
+-    // edge and retrieve value from this pcurve
++    // edge and recieve value from this pcurve
+     const SMDS_EdgePosition* epos =
+       static_cast<const SMDS_EdgePosition*>(n->GetPosition().get());
++    SMESHDS_Mesh* meshDS = GetMeshDS();
+     int edgeID = Pos->GetShapeId();
+-    TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID));
+-    double f, l, u = epos->GetUParameter();
++    TopoDS_Edge E = TopoDS::Edge(meshDS->IndexToShape(edgeID));
++    double f, l;
+     Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+-    if ( f < u && u < l )
+-      uv = C2d->Value( u );
+-    else
+-      uv.SetCoord(0.,0.);
+-    uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( E ));
+-
++    uv = C2d->Value( epos->GetUParameter() );
+     // for a node on a seam edge select one of UVs on 2 pcurves
+     if ( n2 && IsSeamShape( edgeID ) )
+-    {
+       uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 ));
+-    }
+-    else
+-    { // adjust uv to period
+-      TopLoc_Location loc;
+-      Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
+-      Standard_Boolean isUPeriodic = S->IsUPeriodic();
+-      Standard_Boolean isVPeriodic = S->IsVPeriodic();
+-      if ( isUPeriodic || isVPeriodic ) {
+-        Standard_Real UF,UL,VF,VL;
+-        S->Bounds(UF,UL,VF,VL);
+-        if(isUPeriodic)
+-          uv.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL));
+-        if(isVPeriodic)
+-          uv.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL));
+-      }
+-    }
+   }
+   else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX)
+   {
+     if ( int vertexID = n->GetPosition()->GetShapeId() ) {
++      bool ok = true;
+       const TopoDS_Vertex& V = TopoDS::Vertex(GetMeshDS()->IndexToShape(vertexID));
+       try {
+         uv = BRep_Tool::Parameters( V, F );
+-        uvOK = true;
+       }
+       catch (Standard_Failure& exc) {
++        ok = false;
+       }
+-      if ( !uvOK ) {
+-        for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() )
+-          uvOK = ( V == vert.Current() );
+-        if ( !uvOK ) {
++      if ( !ok ) {
++        for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() )
++          ok = ( V == vert.Current() );
++        if ( !ok ) {
+ #ifdef _DEBUG_
+           MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
+                << " not in face " << GetMeshDS()->ShapeToIndex( F ) );
+ #endif
+           // get UV of a vertex closest to the node
+           double dist = 1e100;
+-          gp_Pnt pn = XYZ( n );
+-          for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() ) {
++          gp_Pnt pn ( n->X(),n->Y(),n->Z() );
++          for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !ok && vert.More(); vert.Next() ) {
+             TopoDS_Vertex curV = TopoDS::Vertex( vert.Current() );
+             gp_Pnt p = BRep_Tool::Pnt( curV );
+             double curDist = p.SquareDistance( pn );
+             if ( curDist < dist ) {
+               dist = curDist;
+               uv = BRep_Tool::Parameters( curV, F );
+-              uvOK = ( dist < DBL_MIN );
++              if ( dist < DBL_MIN ) break;
+             }
+           }
+         }
+@@ -437,100 +381,11 @@
+         uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 ));
+     }
+   }
+-
+-  if ( check )
+-    *check = uvOK;
+-
+   return uv.XY();
+ }
+ 
+ //=======================================================================
+ /*!
+- * \brief Check and fix node UV on a face
+- *  \retval bool - false if UV is bad and could not be fixed
+- */
+-//=======================================================================
+-
+-bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face&   F,
+-                                     const SMDS_MeshNode* n,
+-                                     gp_XY&               uv,
+-                                     const double         tol) const
+-{
+-  if ( !myOkNodePosShapes.count( n->GetPosition()->GetShapeId() ))
+-  {
+-    // check that uv is correct
+-    TopLoc_Location loc;
+-    Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc );
+-    gp_Pnt nodePnt = XYZ( n );
+-    if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
+-    if ( nodePnt.Distance( surface->Value( uv.X(), uv.Y() )) > tol )
+-    {
+-      // uv incorrect, project the node to surface
+-      GeomAPI_ProjectPointOnSurf projector( nodePnt, surface, tol );
+-      if ( !projector.IsDone() || projector.NbPoints() < 1 )
+-      {
+-        MESSAGE( "SMESH_MesherHelper::CheckNodeUV() failed to project" );
+-        return false;
+-      }
+-      Quantity_Parameter U,V;
+-      projector.LowerDistanceParameters(U,V);
+-      if ( nodePnt.Distance( surface->Value( U, V )) > tol )
+-      {
+-        MESSAGE( "SMESH_MesherHelper::CheckNodeUV(), invalid projection" );
+-        return false;
+-      }
+-      uv.SetCoord( U,V );
+-    }
+-    else if ( uv.Modulus() > numeric_limits<double>::min() )
+-    {
+-      ((SMESH_MesherHelper*) this)->myOkNodePosShapes.insert( n->GetPosition()->GetShapeId() );
+-    }
+-  }
+-  return true;
+-}
+-
+-//=======================================================================
+-/*!
+- * \brief Return middle UV taking in account surface period
+- */
+-//=======================================================================
+-
+-gp_XY SMESH_MesherHelper::GetMiddleUV(const Handle(Geom_Surface)& surface,
+-                                      const gp_XY&                p1,
+-                                      const gp_XY&                p2)
+-{
+-  if ( surface.IsNull() )
+-    return 0.5 * ( p1 + p2 );
+-  //checking if surface is periodic
+-  Standard_Real UF,UL,VF,VL;
+-  surface->Bounds(UF,UL,VF,VL);
+-
+-  Standard_Real u,v;
+-  Standard_Boolean isUPeriodic = surface->IsUPeriodic();
+-  if(isUPeriodic) {
+-    Standard_Real UPeriod = surface->UPeriod();
+-    Standard_Real p2x = p2.X()+ShapeAnalysis::AdjustByPeriod(p2.X(),p1.X(),UPeriod);
+-    Standard_Real pmid = (p1.X()+p2x)/2.;
+-    u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,UF,UL);
+-  }
+-  else {
+-    u= (p1.X()+p2.X())/2.;
+-  }
+-  Standard_Boolean isVPeriodic = surface->IsVPeriodic();
+-  if(isVPeriodic) {
+-    Standard_Real VPeriod = surface->VPeriod();
+-    Standard_Real p2y = p2.Y()+ShapeAnalysis::AdjustByPeriod(p2.Y(),p1.Y(),VPeriod);
+-    Standard_Real pmid = (p1.Y()+p2y)/2.;
+-    v = pmid+ShapeAnalysis::AdjustToPeriod(pmid,VF,VL);
+-  }
+-  else {
+-    v = (p1.Y()+p2.Y())/2.;
+-  }
+-  return gp_XY( u,v );
+-}
+-
+-//=======================================================================
+-/*!
+  * \brief Return node U on edge
+  * \param E - the Edge
+  * \param n - the node
+@@ -541,8 +396,7 @@
+ //=======================================================================
+ 
+ double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge&   E,
+-                                    const SMDS_MeshNode* n,
+-                                    bool*                check)
++                                    const SMDS_MeshNode* n)
+ {
+   double param = 0;
+   const SMDS_PositionPtr Pos = n->GetPosition();
+@@ -560,131 +414,152 @@
+   return param;
+ }
+ 
+-//================================================================================
++//=======================================================================
++//function : GetMediumNode
++//purpose  : 
++//=======================================================================
+ /*!
+- * \brief Return existing or create new medium nodes between given ones
+- *  \param force3d - if true, new node is the middle of n1 and n2,
+- *                   else is located on geom face or geom edge
++ * Special function for search or creation medium node
+  */
+-//================================================================================
+-
+ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
+                                                        const SMDS_MeshNode* n2,
+                                                        bool force3d)
+ {
+-  SMESH_TLink link(n1,n2);
+-  ItTLinkNode itLN = myTLinkNodeMap.find( link );
+-  if ( itLN != myTLinkNodeMap.end() ) {
+-    return (*itLN).second;
+-  }
+-  // create medium node
+-  SMDS_MeshNode* n12;
+-  SMESHDS_Mesh* meshDS = GetMeshDS();
+-  int faceID = -1, edgeID = -1;
+-  const SMDS_PositionPtr Pos1 = n1->GetPosition();
+-  const SMDS_PositionPtr Pos2 = n2->GetPosition();
++  TopAbs_ShapeEnum shapeType = myShape.IsNull() ? TopAbs_SHAPE : myShape.ShapeType();
+ 
+-  if( myShape.IsNull() )
+-  {
+-    if( Pos1->GetTypeOfPosition()==SMDS_TOP_FACE ) {
+-      faceID = Pos1->GetShapeId();
+-    }
+-    else if( Pos2->GetTypeOfPosition()==SMDS_TOP_FACE ) {
+-      faceID = Pos2->GetShapeId();
+-    }
+-
+-    if( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE ) {
+-      edgeID = Pos1->GetShapeId();
+-    }
+-    if( Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE ) {
+-      edgeID = Pos2->GetShapeId();
+-    }
++  NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
++  ItNLinkNode itLN = myNLinkNodeMap.find( link );
++  if ( itLN != myNLinkNodeMap.end() ) {
++    return (*itLN).second;
+   }
+-  if(!force3d)
+-  {
+-    // we try to create medium node using UV parameters of
+-    // nodes, else - medium between corresponding 3d points
+-
+-    TopAbs_ShapeEnum shapeType = myShape.IsNull() ? TopAbs_SHAPE : myShape.ShapeType();
+-    if(faceID>0 || shapeType == TopAbs_FACE) {
+-      // obtaining a face and 2d points for nodes
+-      TopoDS_Face F;
+-      if( myShape.IsNull() )
+-        F = TopoDS::Face(meshDS->IndexToShape(faceID));
+-      else {
+-        F = TopoDS::Face(myShape);
+-        faceID = myShapeID;
++  else {
++    // create medium node
++    SMDS_MeshNode* n12;
++    SMESHDS_Mesh* meshDS = GetMeshDS();
++    int faceID = -1, edgeID = -1;
++    const SMDS_PositionPtr Pos1 = n1->GetPosition();
++    const SMDS_PositionPtr Pos2 = n2->GetPosition();
++  
++    if( myShape.IsNull() )
++    {
++      if( Pos1->GetTypeOfPosition()==SMDS_TOP_FACE ) {
++        faceID = Pos1->GetShapeId();
+       }
+-      bool uvOK1, uvOK2;
+-      gp_XY p1 = GetNodeUV(F,n1,n2, &uvOK1);
+-      gp_XY p2 = GetNodeUV(F,n2,n1, &uvOK2);
+-
+-      if ( uvOK1 && uvOK2 )
+-      {
+-        if ( IsDegenShape( Pos1->GetShapeId() ))
+-          p1.SetCoord( myParIndex, p2.Coord( myParIndex ));
+-        else if ( IsDegenShape( Pos2->GetShapeId() ))
+-          p2.SetCoord( myParIndex, p1.Coord( myParIndex ));
+-
+-        TopLoc_Location loc;
+-        Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
+-        gp_XY uv = GetMiddleUV( S, p1, p2 );
+-        gp_Pnt P = S->Value( uv.X(), uv.Y() ).Transformed(loc);
+-        n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
+-        meshDS->SetNodeOnFace(n12, faceID, uv.X(), uv.Y());
+-        myTLinkNodeMap.insert(make_pair(link,n12));
+-        return n12;
++      else if( Pos2->GetTypeOfPosition()==SMDS_TOP_FACE ) {
++        faceID = Pos2->GetShapeId();
+       }
+-    }
+-    if (edgeID>0 || shapeType == TopAbs_EDGE) {
+ 
+-      TopoDS_Edge E;
+-      if( myShape.IsNull() )
+-        E = TopoDS::Edge(meshDS->IndexToShape(edgeID));
+-      else {
+-        E = TopoDS::Edge(myShape);
+-        edgeID = myShapeID;
++      if( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE ) {
++        edgeID = Pos1->GetShapeId();
++      }
++      if( Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE ) {
++        edgeID = Pos2->GetShapeId();
+       }
++    }
+ 
+-      double p1 = GetNodeU(E,n1);
+-      double p2 = GetNodeU(E,n2);
+-
+-      double f,l;
+-      Handle(Geom_Curve) C = BRep_Tool::Curve(E, f, l);
+-      if(!C.IsNull()) {
+-
+-        Standard_Boolean isPeriodic = C->IsPeriodic();
+-        double u;
+-        if(isPeriodic) {
+-          Standard_Real Period = C->Period();
+-          Standard_Real p = p2+ShapeAnalysis::AdjustByPeriod(p2,p1,Period);
+-          Standard_Real pmid = (p1+p)/2.;
+-          u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,C->FirstParameter(),C->LastParameter());
+-        }
+-        else
+-          u = (p1+p2)/2.;
++    if(!force3d) {
++      // we try to create medium node using UV parameters of
++      // nodes, else - medium between corresponding 3d points
++      if(faceID>-1 || shapeType == TopAbs_FACE) {
++	// obtaining a face and 2d points for nodes
++	TopoDS_Face F;
++	if( myShape.IsNull() )
++          F = TopoDS::Face(meshDS->IndexToShape(faceID));
++	else {
++          F = TopoDS::Face(myShape);
++          faceID = myShapeID;
++        }
++
++	gp_XY p1 = GetNodeUV(F,n1,n2);
++        gp_XY p2 = GetNodeUV(F,n2,n1);
++
++	if ( IsDegenShape( Pos1->GetShapeId() ))
++	  p1.SetCoord( myParIndex, p2.Coord( myParIndex ));
++	else if ( IsDegenShape( Pos2->GetShapeId() ))
++	  p2.SetCoord( myParIndex, p1.Coord( myParIndex ));
++
++	//checking if surface is periodic
++	Handle(Geom_Surface) S = BRep_Tool::Surface(F);
++	Standard_Real UF,UL,VF,VL;
++	S->Bounds(UF,UL,VF,VL);
++
++	Standard_Real u,v;
++	Standard_Boolean isUPeriodic = S->IsUPeriodic();
++	if(isUPeriodic) {
++	  Standard_Real UPeriod = S->UPeriod();
++	  Standard_Real p2x = p2.X()+ShapeAnalysis::AdjustByPeriod(p2.X(),p1.X(),UPeriod);
++	  Standard_Real pmid = (p1.X()+p2x)/2.;
++	  u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,UF,UL);
++	}
++	else 
++	  u= (p1.X()+p2.X())/2.;
++
++	Standard_Boolean isVPeriodic = S->IsVPeriodic();
++	if(isVPeriodic) {
++	  Standard_Real VPeriod = S->VPeriod();
++	  Standard_Real p2y = p2.Y()+ShapeAnalysis::AdjustByPeriod(p2.Y(),p1.Y(),VPeriod);
++	  Standard_Real pmid = (p1.Y()+p2y)/2.;
++	  v = pmid+ShapeAnalysis::AdjustToPeriod(pmid,VF,VL);
++	}
++	else
++	  v = (p1.Y()+p2.Y())/2.;
+ 
+-        gp_Pnt P = C->Value( u );
++        gp_Pnt P = S->Value(u, v);
+         n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
+-        meshDS->SetNodeOnEdge(n12, edgeID, u);
+-        myTLinkNodeMap.insert(make_pair(link,n12));
++        meshDS->SetNodeOnFace(n12, faceID, u, v);
++        myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12));
+         return n12;
+       }
+-    }
++      if (edgeID>-1 || shapeType == TopAbs_EDGE) {
++
++	TopoDS_Edge E;
++	if( myShape.IsNull() )
++          E = TopoDS::Edge(meshDS->IndexToShape(edgeID));
++	else {
++          E = TopoDS::Edge(myShape);
++          edgeID = myShapeID;
++        }
++
++	double p1 = GetNodeU(E,n1);
++	double p2 = GetNodeU(E,n2);
++
++	double f,l;
++	Handle(Geom_Curve) C = BRep_Tool::Curve(E, f, l);
++	if(!C.IsNull()) {
++
++	  Standard_Boolean isPeriodic = C->IsPeriodic();
++	  double u;
++	  if(isPeriodic) {
++	    Standard_Real Period = C->Period();
++	    Standard_Real p = p2+ShapeAnalysis::AdjustByPeriod(p2,p1,Period);
++	    Standard_Real pmid = (p1+p)/2.;
++	    u = pmid+ShapeAnalysis::AdjustToPeriod(pmid,C->FirstParameter(),C->LastParameter());
++	  }
++	  else
++	    u = (p1+p2)/2.;
++
++          gp_Pnt P = C->Value( u );
++          n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
++          meshDS->SetNodeOnEdge(n12, edgeID, u);
++          myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12));
++          return n12;
++	}
++      }
++    }
++    // 3d variant
++    double x = ( n1->X() + n2->X() )/2.;
++    double y = ( n1->Y() + n2->Y() )/2.;
++    double z = ( n1->Z() + n2->Z() )/2.;
++    n12 = meshDS->AddNode(x,y,z);
++    if(edgeID>-1)
++        meshDS->SetNodeOnEdge(n12, edgeID);
++    else if(faceID>-1)
++        meshDS->SetNodeOnFace(n12, faceID);
++    else
++      meshDS->SetNodeInVolume(n12, myShapeID);
++    myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12));
++    return n12;
+   }
+-  // 3d variant
+-  double x = ( n1->X() + n2->X() )/2.;
+-  double y = ( n1->Y() + n2->Y() )/2.;
+-  double z = ( n1->Z() + n2->Z() )/2.;
+-  n12 = meshDS->AddNode(x,y,z);
+-  if(edgeID>0)
+-    meshDS->SetNodeOnEdge(n12, edgeID);
+-  else if(faceID>0)
+-    meshDS->SetNodeOnFace(n12, faceID);
+-  else
+-    meshDS->SetNodeInVolume(n12, myShapeID);
+-  myTLinkNodeMap.insert( make_pair( link, n12 ));
+-  return n12;
+ }
+ 
+ //=======================================================================
+@@ -758,14 +633,10 @@
+                                            const SMDS_MeshNode* n2,
+                                            const SMDS_MeshNode* n3,
+                                            const int id,
+-                                           const bool force3d)
++					   const bool force3d)
+ {
+   SMESHDS_Mesh * meshDS = GetMeshDS();
+   SMDS_MeshFace* elem = 0;
+-
+-  if( n1==n2 || n2==n3 || n3==n1 )
+-    return elem;
+-
+   if(!myCreateQuadratic) {
+     if(id)
+       elem = meshDS->AddFaceWithID(n1, n2, n3, id);
+@@ -799,30 +670,10 @@
+                                            const SMDS_MeshNode* n3,
+                                            const SMDS_MeshNode* n4,
+                                            const int id,
+-                                           const bool force3d)
++					   const bool force3d)
+ {
+   SMESHDS_Mesh * meshDS = GetMeshDS();
+   SMDS_MeshFace* elem = 0;
+-
+-  if( n1==n2 ) {
+-    return AddFace(n1,n3,n4,id,force3d);
+-  }
+-  if( n1==n3 ) {
+-    return AddFace(n1,n2,n4,id,force3d);
+-  }
+-  if( n1==n4 ) {
+-    return AddFace(n1,n2,n3,id,force3d);
+-  }
+-  if( n2==n3 ) {
+-    return AddFace(n1,n2,n4,id,force3d);
+-  }
+-  if( n2==n4 ) {
+-    return AddFace(n1,n2,n3,id,force3d);
+-  }
+-  if( n3==n4 ) {
+-    return AddFace(n1,n2,n3,id,force3d);
+-  }
+-
+   if(!myCreateQuadratic) {
+     if(id)
+       elem = meshDS->AddFaceWithID(n1, n2, n3, n4, id);
+@@ -859,7 +710,7 @@
+                                                const SMDS_MeshNode* n5,
+                                                const SMDS_MeshNode* n6,
+                                                const int id,
+-                                               const bool force3d)
++					       const bool force3d)
+ {
+   SMESHDS_Mesh * meshDS = GetMeshDS();
+   SMDS_MeshVolume* elem = 0;
+@@ -906,7 +757,7 @@
+                                                const SMDS_MeshNode* n3,
+                                                const SMDS_MeshNode* n4,
+                                                const int id, 
+-                                               const bool force3d)
++					       const bool force3d)
+ {
+   SMESHDS_Mesh * meshDS = GetMeshDS();
+   SMDS_MeshVolume* elem = 0;
+@@ -948,7 +799,7 @@
+                                                const SMDS_MeshNode* n4,
+                                                const SMDS_MeshNode* n5,
+                                                const int id, 
+-                                               const bool force3d)
++					       const bool force3d)
+ {
+   SMDS_MeshVolume* elem = 0;
+   if(!myCreateQuadratic) {
+@@ -999,7 +850,7 @@
+                                                const SMDS_MeshNode* n7,
+                                                const SMDS_MeshNode* n8,
+                                                const int id,
+-                                               const bool force3d)
++					       const bool force3d)
+ {
+   SMESHDS_Mesh * meshDS = GetMeshDS();
+   SMDS_MeshVolume* elem = 0;
+@@ -1366,1200 +1217,3 @@
+ {
+   return fabs(param-myPar1) < fabs(param-myPar2) ? myPar2 : myPar1;
+ }
+-
+-//=======================================================================
+-namespace { // Structures used by FixQuadraticElements()
+-//=======================================================================
+-
+-#define __DMP__(txt) \
+-//cout << txt
+-#define MSG(txt) __DMP__(txt<<endl)
+-#define MSGBEG(txt) __DMP__(txt)
+-
+-  const double straightTol2 = 1e-33; // to detect straing links
+-
+-  struct QFace;
+-  // ---------------------------------------
+-  /*!
+-   * \brief Quadratic link knowing its faces
+-   */
+-  struct QLink: public SMESH_TLink
+-  {
+-    const SMDS_MeshNode*          _mediumNode;
+-    mutable vector<const QFace* > _faces;
+-    mutable gp_Vec                _nodeMove;
+-    mutable int                   _nbMoves;
+-
+-    QLink(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, const SMDS_MeshNode* nm):
+-      SMESH_TLink( n1,n2 ), _mediumNode(nm), _nodeMove(0,0,0), _nbMoves(0) {
+-      _faces.reserve(4);
+-      //if ( MediumPos() != SMDS_TOP_3DSPACE )
+-        _nodeMove = MediumPnt() - MiddlePnt();
+-    }
+-    void SetContinuesFaces() const;
+-    const QFace* GetContinuesFace( const QFace* face ) const;
+-    bool OnBoundary() const;
+-    gp_XYZ MiddlePnt() const { return ( XYZ( node1() ) + XYZ( node2() )) / 2.; }
+-    gp_XYZ MediumPnt() const { return XYZ( _mediumNode ); }
+-
+-    SMDS_TypeOfPosition MediumPos() const
+-    { return _mediumNode->GetPosition()->GetTypeOfPosition(); }
+-    SMDS_TypeOfPosition EndPos(bool isSecond) const
+-    { return (isSecond ? node2() : node1())->GetPosition()->GetTypeOfPosition(); }
+-    const SMDS_MeshNode* EndPosNode(SMDS_TypeOfPosition pos) const
+-    { return EndPos(0) == pos ? node1() : EndPos(1) == pos ? node2() : 0; }
+-
+-    void Move(const gp_Vec& move, bool sum=false) const
+-    { _nodeMove += move; _nbMoves += sum ? (_nbMoves==0) : 1; }
+-    gp_XYZ Move() const { return _nodeMove.XYZ() / _nbMoves; }
+-    bool IsMoved() const { return (_nbMoves > 0 && !IsStraight()); }
+-    bool IsStraight() const { return _nodeMove.SquareMagnitude() <= straightTol2; }
+-
+-    bool operator<(const QLink& other) const {
+-      return (node1()->GetID() == other.node1()->GetID() ?
+-              node2()->GetID() < other.node2()->GetID() :
+-              node1()->GetID() < other.node1()->GetID());
+-    }
+-    struct PtrComparator {
+-      bool operator() (const QLink* l1, const QLink* l2 ) const { return *l1 < *l2; }
+-    };
+-  };
+-  // ---------------------------------------------------------
+-  /*!
+-   * \brief Link in the chain of links; it connects two faces
+-   */
+-  struct TChainLink
+-  {
+-    const QLink*         _qlink;
+-    mutable const QFace* _qfaces[2];
+-
+-    TChainLink(const QLink* qlink=0):_qlink(qlink) {
+-      _qfaces[0] = _qfaces[1] = 0;
+-    }
+-    void SetFace(const QFace* face) { int iF = _qfaces[0] ? 1 : 0; _qfaces[iF]=face; }
+-
+-    bool IsBoundary() const { return !_qfaces[1]; }
+-
+-    void RemoveFace( const QFace* face ) const
+-    { _qfaces[(face == _qfaces[1])] = 0; if (!_qfaces[0]) std::swap(_qfaces[0],_qfaces[1]); }
+-
+-    const QFace* NextFace( const QFace* f ) const
+-    { return _qfaces[0]==f ? _qfaces[1] : _qfaces[0]; }
+-
+-    const SMDS_MeshNode* NextNode( const SMDS_MeshNode* n ) const
+-    { return n == _qlink->node1() ? _qlink->node2() : _qlink->node1(); }
+-
+-    bool operator<(const TChainLink& other) const { return *_qlink < *other._qlink; }
+-
+-    operator bool() const { return (_qlink); }
+-
+-    const QLink* operator->() const { return _qlink; }
+-
+-    gp_Vec Normal() const;
+-  };
+-  // --------------------------------------------------------------------
+-  typedef list< TChainLink > TChain;
+-  typedef set < TChainLink > TLinkSet;
+-  typedef TLinkSet::const_iterator TLinkInSet;
+-
+-  const int theFirstStep = 5;
+-
+-  enum { ERR_OK, ERR_TRI, ERR_PRISM, ERR_UNKNOWN }; // errors of QFace::GetLinkChain()
+-  // --------------------------------------------------------------------
+-  /*!
+-   * \brief Face shared by two volumes and bound by QLinks
+-   */
+-  struct QFace: public TIDSortedElemSet
+-  {
+-    mutable const SMDS_MeshElement* _volumes[2];
+-    mutable vector< const QLink* >  _sides;
+-    mutable bool                    _sideIsAdded[4]; // added in chain of links
+-    gp_Vec                          _normal;
+-
+-    QFace( const vector< const QLink*>& links );
+-
+-    void SetVolume(const SMDS_MeshElement* v) const { _volumes[ _volumes[0] ? 1 : 0 ] = v; }
+-
+-    int NbVolumes() const { return !_volumes[0] ? 0 : !_volumes[1] ? 1 : 2; }
+-
+-    void AddSelfToLinks() const {
+-      for ( int i = 0; i < _sides.size(); ++i )
+-        _sides[i]->_faces.push_back( this );
+-    }
+-    int LinkIndex( const QLink* side ) const {
+-      for (int i=0; i<_sides.size(); ++i ) if ( _sides[i] == side ) return i;
+-      return -1;
+-    }
+-    bool GetLinkChain( int iSide, TChain& chain, SMDS_TypeOfPosition pos, int& error) const;
+-
+-    bool GetLinkChain( TChainLink& link, TChain& chain, SMDS_TypeOfPosition pos, int& error) const
+-    {
+-      int i = LinkIndex( link._qlink );
+-      if ( i < 0 ) return true;
+-      _sideIsAdded[i] = true;
+-      link.SetFace( this );
+-      // continue from opposite link
+-      return GetLinkChain( (i+2)%_sides.size(), chain, pos, error );
+-    }
+-    bool IsBoundary() const { return !_volumes[1]; }
+-
+-    bool Contains( const SMDS_MeshNode* node ) const { return count(node); }
+-
+-    TLinkInSet GetBoundaryLink( const TLinkSet&      links,
+-                                const TChainLink&    avoidLink,
+-                                TLinkInSet *         notBoundaryLink = 0,
+-                                const SMDS_MeshNode* nodeToContain = 0,
+-                                bool *               isAdjacentUsed = 0) const;
+-
+-    TLinkInSet GetLinkByNode( const TLinkSet&      links,
+-                              const TChainLink&    avoidLink,
+-                              const SMDS_MeshNode* nodeToContain) const;
+-
+-    const SMDS_MeshNode* GetNodeInFace() const {
+-      for ( int iL = 0; iL < _sides.size(); ++iL )
+-        if ( _sides[iL]->MediumPos() == SMDS_TOP_FACE ) return _sides[iL]->_mediumNode;
+-      return 0;
+-    }
+-
+-    gp_Vec LinkNorm(const int i, SMESH_MesherHelper* theFaceHelper=0) const;
+-
+-    double MoveByBoundary( const TChainLink&   theLink,
+-                           const gp_Vec&       theRefVec,
+-                           const TLinkSet&     theLinks,
+-                           SMESH_MesherHelper* theFaceHelper=0,
+-                           const double        thePrevLen=0,
+-                           const int           theStep=theFirstStep,
+-                           gp_Vec*             theLinkNorm=0,
+-                           double              theSign=1.0) const;
+-  };
+-
+-  //================================================================================
+-  /*!
+-   * \brief Dump QLink and QFace
+-   */
+-  ostream& operator << (ostream& out, const QLink& l)
+-  {
+-    out <<"QLink nodes: "
+-        << l.node1()->GetID() << " - "
+-        << l._mediumNode->GetID() << " - "
+-        << l.node2()->GetID() << endl;
+-    return out;
+-  }
+-  ostream& operator << (ostream& out, const QFace& f)
+-  {
+-    out <<"QFace nodes: "/*<< &f << "  "*/;
+-    for ( TIDSortedElemSet::const_iterator n = f.begin(); n != f.end(); ++n )
+-      out << (*n)->GetID() << " ";
+-    out << " \tvolumes: "
+-        << (f._volumes[0] ? f._volumes[0]->GetID() : 0) << " "
+-        << (f._volumes[1] ? f._volumes[1]->GetID() : 0);
+-    out << "  \tNormal: "<< f._normal.X() <<", "<<f._normal.Y() <<", "<<f._normal.Z() << endl;
+-    return out;
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Construct QFace from QLinks 
+-   */
+-  //================================================================================
+-
+-  QFace::QFace( const vector< const QLink*>& links )
+-  {
+-    _volumes[0] = _volumes[1] = 0;
+-    _sides = links;
+-    _sideIsAdded[0]=_sideIsAdded[1]=_sideIsAdded[2]=_sideIsAdded[3]=false;
+-    _normal.SetCoord(0,0,0);
+-    for ( int i = 1; i < _sides.size(); ++i ) {
+-      const QLink *l1 = _sides[i-1], *l2 = _sides[i];
+-      insert( l1->node1() ); insert( l1->node2() );
+-      // compute normal
+-      gp_Vec v1( XYZ( l1->node2()), XYZ( l1->node1()));
+-      gp_Vec v2( XYZ( l2->node1()), XYZ( l2->node2()));
+-      if ( l1->node1() != l2->node1() && l1->node2() != l2->node2() )
+-        v1.Reverse(); 
+-      _normal += v1 ^ v2;
+-    }
+-    double normSqSize = _normal.SquareMagnitude();
+-    if ( normSqSize > numeric_limits<double>::min() )
+-      _normal /= sqrt( normSqSize );
+-    else
+-      _normal.SetCoord(1e-33,0,0);
+-  }
+-  //================================================================================
+-  /*!
+-   * \brief Make up chain of links
+-   *  \param iSide - link to add first
+-   *  \param chain - chain to fill in
+-   *  \param pos   - postion of medium nodes the links should have
+-   *  \param error - out, specifies what is wrong
+-   *  \retval bool - false if valid chain can't be built; "valid" means that links
+-   *                 of the chain belongs to rectangles bounding hexahedrons
+-   */
+-  //================================================================================
+-
+-  bool QFace::GetLinkChain( int iSide, TChain& chain, SMDS_TypeOfPosition pos, int& error) const
+-  {
+-    if ( iSide >= _sides.size() ) // wrong argument iSide
+-      return false;
+-    if ( _sideIsAdded[ iSide ]) // already in chain
+-      return true;
+-
+-    if ( _sides.size() != 4 ) { // triangle - visit all my continous faces
+-      MSGBEG( *this );
+-      for ( int i = 0; i < _sides.size(); ++i ) {
+-        if ( !_sideIsAdded[i] && _sides[i] ) {
+-          _sideIsAdded[i]=true;
+-          TChain::iterator chLink = chain.insert( chain.begin(), TChainLink(_sides[i]));
+-          chLink->SetFace( this );
+-          if ( _sides[i]->MediumPos() >= pos )
+-            if ( const QFace* f = _sides[i]->GetContinuesFace( this ))
+-              f->GetLinkChain( *chLink, chain, pos, error );
+-        }
+-      }
+-      if ( error < ERR_TRI )
+-        error = ERR_TRI;
+-      return false;
+-    }
+-    _sideIsAdded[iSide] = true; // not to add this link to chain again
+-    const QLink* link = _sides[iSide];
+-    if ( !link)
+-      return true;
+-
+-    // add link into chain
+-    TChain::iterator chLink = chain.insert( chain.begin(), TChainLink(link));
+-    chLink->SetFace( this );
+-    MSGBEG( *this );
+-
+-    // propagate from rectangle to neighbour faces
+-    if ( link->MediumPos() >= pos ) {
+-      int nbLinkFaces = link->_faces.size();
+-      if ( nbLinkFaces == 4 || nbLinkFaces < 4 && link->OnBoundary()) {
+-        // hexahedral mesh or boundary quadrangles - goto a continous face
+-        if ( const QFace* f = link->GetContinuesFace( this ))
+-          return f->GetLinkChain( *chLink, chain, pos, error );
+-      }
+-      else {
+-        TChainLink chLink(link); // side face of prismatic mesh - visit all faces of iSide
+-        for ( int i = 0; i < nbLinkFaces; ++i )
+-          if ( link->_faces[i] )
+-            link->_faces[i]->GetLinkChain( chLink, chain, pos, error );
+-        if ( error < ERR_PRISM )
+-          error = ERR_PRISM;
+-        return false;
+-      }
+-    }
+-    return true;
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Return a boundary link of the triangle face
+-   *  \param links - set of all links
+-   *  \param avoidLink - link not to return
+-   *  \param notBoundaryLink - out, neither the returned link nor avoidLink
+-   *  \param nodeToContain - node the returned link must contain; if provided, search
+-   *                         also performed on adjacent faces
+-   *  \param isAdjacentUsed - returns true if link is found in adjacent faces
+-   */
+-  //================================================================================
+-
+-  TLinkInSet QFace::GetBoundaryLink( const TLinkSet&      links,
+-                                     const TChainLink&    avoidLink,
+-                                     TLinkInSet *         notBoundaryLink,
+-                                     const SMDS_MeshNode* nodeToContain,
+-                                     bool *               isAdjacentUsed) const
+-  {
+-    TLinkInSet linksEnd = links.end(), boundaryLink = linksEnd;
+-
+-    typedef list< pair< const QFace*, TLinkInSet > > TFaceLinkList;
+-    TFaceLinkList adjacentFaces;
+-
+-    for ( int iL = 0; iL < _sides.size(); ++iL )
+-    {
+-      if ( avoidLink._qlink == _sides[iL] )
+-        continue;
+-      TLinkInSet link = links.find( _sides[iL] );
+-      if ( link == linksEnd ) continue;
+-
+-      // check link
+-      if ( link->IsBoundary() ) {
+-        if ( !nodeToContain ||
+-             (*link)->node1() == nodeToContain ||
+-             (*link)->node2() == nodeToContain )
+-        {
+-          boundaryLink = link;
+-          if ( !notBoundaryLink ) break;
+-        }
+-      }
+-      else if ( notBoundaryLink ) {
+-        *notBoundaryLink = link;
+-        if ( boundaryLink != linksEnd ) break;
+-      }
+-
+-      if ( boundaryLink == linksEnd && nodeToContain ) // cellect adjacent faces
+-        if ( const QFace* adj = link->NextFace( this ))
+-          if ( adj->Contains( nodeToContain ))
+-            adjacentFaces.push_back( make_pair( adj, link ));
+-    }
+-
+-    if ( isAdjacentUsed ) *isAdjacentUsed = false;
+-    if ( boundaryLink == linksEnd && nodeToContain ) // check adjacent faces
+-    {
+-      TFaceLinkList::iterator adj = adjacentFaces.begin();
+-      for ( ; boundaryLink == linksEnd && adj != adjacentFaces.end(); ++adj )
+-        boundaryLink = adj->first->GetBoundaryLink( links, *(adj->second),
+-                                                    0, nodeToContain, isAdjacentUsed);
+-      if ( isAdjacentUsed ) *isAdjacentUsed = true;
+-    }
+-    return boundaryLink;
+-  }
+-  //================================================================================
+-  /*!
+-   * \brief Return a link ending at the given node but not avoidLink
+-   */
+-  //================================================================================
+-
+-  TLinkInSet QFace::GetLinkByNode( const TLinkSet&      links,
+-                                   const TChainLink&    avoidLink,
+-                                   const SMDS_MeshNode* nodeToContain) const
+-  {
+-    for ( int i = 0; i < _sides.size(); ++i )
+-      if ( avoidLink._qlink != _sides[i] &&
+-           (_sides[i]->node1() == nodeToContain || _sides[i]->node2() == nodeToContain ))
+-        return links.find( _sides[ i ]);
+-    return links.end();
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Return normal to the i-th side pointing outside the face
+-   */
+-  //================================================================================
+-
+-  gp_Vec QFace::LinkNorm(const int i, SMESH_MesherHelper* /*uvHelper*/) const
+-  {
+-    gp_Vec norm, vecOut;
+-//     if ( uvHelper ) {
+-//       TopoDS_Face face = TopoDS::Face( uvHelper->GetSubShape());
+-//       const SMDS_MeshNode* inFaceNode = uvHelper->GetNodeUVneedInFaceNode() ? GetNodeInFace() : 0;
+-//       gp_XY uv1 = uvHelper->GetNodeUV( face, _sides[i]->node1(), inFaceNode );
+-//       gp_XY uv2 = uvHelper->GetNodeUV( face, _sides[i]->node2(), inFaceNode );
+-//       norm.SetCoord( uv1.Y() - uv2.Y(), uv2.X() - uv1.X(), 0 );
+-
+-//       const QLink* otherLink = _sides[(i + 1) % _sides.size()];
+-//       const SMDS_MeshNode* otherNode =
+-//         otherLink->node1() == _sides[i]->node1() ? otherLink->node2() : otherLink->node1();
+-//       gp_XY pIn = uvHelper->GetNodeUV( face, otherNode, inFaceNode );
+-//       vecOut.SetCoord( uv1.X() - pIn.X(), uv1.Y() - pIn.Y(), 0 );
+-//     }
+-//     else {
+-      norm = _normal ^ gp_Vec( XYZ(_sides[i]->node1()), XYZ(_sides[i]->node2()));
+-      gp_XYZ pIn = ( XYZ( _sides[0]->node1() ) +
+-                     XYZ( _sides[0]->node2() ) +
+-                     XYZ( _sides[1]->node1() )) / 3.;
+-      vecOut.SetXYZ( _sides[i]->MiddlePnt() - pIn );
+-      //}
+-    if ( norm * vecOut < 0 )
+-      norm.Reverse();
+-    double mag2 = norm.SquareMagnitude();
+-    if ( mag2 > numeric_limits<double>::min() )
+-      norm /= sqrt( mag2 );
+-    return norm;
+-  }
+-  //================================================================================
+-  /*!
+-   * \brief Move medium node of theLink according to its distance from boundary
+-   *  \param theLink - link to fix
+-   *  \param theRefVec - movement of boundary
+-   *  \param theLinks - all adjacent links of continous triangles
+-   *  \param theFaceHelper - helper is not used so far
+-   *  \param thePrevLen - distance from the boundary
+-   *  \param theStep - number of steps till movement propagation limit
+-   *  \param theLinkNorm - out normal to theLink
+-   *  \param theSign - 1 or -1 depending on movement of boundary
+-   *  \retval double - distance from boundary to propagation limit or other boundary
+-   */
+-  //================================================================================
+-
+-  double QFace::MoveByBoundary( const TChainLink&   theLink,
+-                                const gp_Vec&       theRefVec,
+-                                const TLinkSet&     theLinks,
+-                                SMESH_MesherHelper* theFaceHelper,
+-                                const double        thePrevLen,
+-                                const int           theStep,
+-                                gp_Vec*             theLinkNorm,
+-                                double              theSign) const
+-  {
+-    if ( !theStep )
+-      return thePrevLen; // propagation limit reached
+-
+-    int iL; // index of theLink
+-    for ( iL = 0; iL < _sides.size(); ++iL )
+-      if ( theLink._qlink == _sides[ iL ])
+-        break;
+-
+-    MSG(string(theStep,'.')<<" Ref( "<<theRefVec.X()<<","<<theRefVec.Y()<<","<<theRefVec.Z()<<" )"
+-        <<" thePrevLen " << thePrevLen);
+-    MSG(string(theStep,'.')<<" "<<*theLink._qlink);
+-
+-    gp_Vec linkNorm = -LinkNorm( iL/*, theFaceHelper*/ ); // normal to theLink
+-    double refProj = theRefVec * linkNorm; // project movement vector to normal of theLink
+-    if ( theStep == theFirstStep )
+-      theSign = refProj < 0. ? -1. : 1.;
+-    else if ( theSign * refProj < 0.4 * theRefVec.Magnitude())
+-      return thePrevLen; // to propagate movement forward only, not in side dir or backward
+-
+-    int iL1 = (iL + 1) % 3, iL2 = (iL + 2) % 3; // indices of the two other links of triangle
+-    TLinkInSet link1 = theLinks.find( _sides[iL1] );
+-    TLinkInSet link2 = theLinks.find( _sides[iL2] );
+-    const QFace* f1 = link1->NextFace( this ); // adjacent faces
+-    const QFace* f2 = link2->NextFace( this );
+-
+-    // propagate to adjacent faces till limit step or boundary
+-    double len1 = thePrevLen + (theLink->MiddlePnt() - _sides[iL1]->MiddlePnt()).Modulus();
+-    double len2 = thePrevLen + (theLink->MiddlePnt() - _sides[iL2]->MiddlePnt()).Modulus();
+-    gp_Vec linkDir1, linkDir2;
+-    try {
+-      OCC_CATCH_SIGNALS;
+-      if ( f1 )
+-        len1 = f1->MoveByBoundary
+-          ( *link1, theRefVec, theLinks, theFaceHelper, len1, theStep-1, &linkDir1, theSign);
+-      else
+-        linkDir1 = LinkNorm( iL1/*, theFaceHelper*/ );
+-    } catch (...) {
+-      MSG( " --------------- EXCEPTION");
+-      return thePrevLen;
+-    }
+-    try {
+-      OCC_CATCH_SIGNALS;
+-      if ( f2 )
+-        len2 = f2->MoveByBoundary
+-          ( *link2, theRefVec, theLinks, theFaceHelper, len2, theStep-1, &linkDir2, theSign);
+-      else
+-        linkDir2 = LinkNorm( iL2/*, theFaceHelper*/ );
+-    } catch (...) {
+-      MSG( " --------------- EXCEPTION");
+-      return thePrevLen;
+-    }
+-
+-    double fullLen = 0;
+-    if ( theStep != theFirstStep )
+-    {
+-      // choose chain length by direction of propagation most codirected with theRefVec
+-      bool choose1 = ( theRefVec * linkDir1 * theSign > theRefVec * linkDir2 * theSign );
+-      fullLen = choose1 ? len1 : len2;
+-      double r = thePrevLen / fullLen;
+-
+-      gp_Vec move = linkNorm * refProj * ( 1 - r );
+-      theLink->Move( move, true );
+-
+-      MSG(string(theStep,'.')<<" Move "<< theLink->_mediumNode->GetID()<<
+-          " by " << refProj * ( 1 - r ) << " following " <<
+-          (choose1 ? *link1->_qlink : *link2->_qlink));
+-
+-      if ( theLinkNorm ) *theLinkNorm = linkNorm;
+-    }
+-    return fullLen;
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Find pairs of continues faces 
+-   */
+-  //================================================================================
+-
+-  void QLink::SetContinuesFaces() const
+-  {
+-    //       x0         x - QLink, [-|] - QFace, v - volume
+-    //   v0  |   v1   
+-    //       |          Between _faces of link x2 two vertical faces are continues
+-    // x1----x2-----x3  and two horizontal faces are continues. We set vertical faces
+-    //       |          to _faces[0] and _faces[1] and horizontal faces to
+-    //   v2  |   v3     _faces[2] and _faces[3] (or vise versa).
+-    //       x4
+-
+-    if ( _faces.empty() )
+-      return;
+-    int iFaceCont = -1;
+-    for ( int iF = 1; iFaceCont < 0 && iF < _faces.size(); ++iF )
+-    {
+-      // look for a face bounding none of volumes bound by _faces[0]
+-      bool sameVol = false;
+-      int nbVol = _faces[iF]->NbVolumes();
+-      for ( int iV = 0; !sameVol && iV < nbVol; ++iV )
+-        sameVol = ( _faces[iF]->_volumes[iV] == _faces[0]->_volumes[0] ||
+-                    _faces[iF]->_volumes[iV] == _faces[0]->_volumes[1]);
+-      if ( !sameVol )
+-        iFaceCont = iF;
+-    }
+-    if ( iFaceCont > 0 ) // continues faces found, set one by the other
+-    {
+-      if ( iFaceCont != 1 )
+-        std::swap( _faces[1], _faces[iFaceCont] );
+-    }
+-    else if ( _faces.size() > 1 ) // not found, set NULL by the first face
+-    {
+-      _faces.insert( ++_faces.begin(), 0 );
+-    }
+-  }
+-  //================================================================================
+-  /*!
+-   * \brief Return a face continues to the given one
+-   */
+-  //================================================================================
+-
+-  const QFace* QLink::GetContinuesFace( const QFace* face ) const
+-  {
+-    for ( int i = 0; i < _faces.size(); ++i ) {
+-      if ( _faces[i] == face ) {
+-        int iF = i < 2 ? 1-i : 5-i;
+-        return iF < _faces.size() ? _faces[iF] : 0;
+-      }
+-    }
+-    return 0;
+-  }
+-  //================================================================================
+-  /*!
+-   * \brief True if link is on mesh boundary
+-   */
+-  //================================================================================
+-
+-  bool QLink::OnBoundary() const
+-  {
+-    for ( int i = 0; i < _faces.size(); ++i )
+-      if (_faces[i] && _faces[i]->IsBoundary()) return true;
+-    return false;
+-  }
+-  //================================================================================
+-  /*!
+-   * \brief Return normal of link of the chain
+-   */
+-  //================================================================================
+-
+-  gp_Vec TChainLink::Normal() const {
+-    gp_Vec norm;
+-    if (_qfaces[0]) norm  = _qfaces[0]->_normal;
+-    if (_qfaces[1]) norm += _qfaces[1]->_normal;
+-    return norm;
+-  }
+-  //================================================================================
+-  /*!
+-   * \brief Move medium nodes of vertical links of pentahedrons adjacent by side faces
+-   */
+-  //================================================================================
+-
+-  void fixPrism( TChain& allLinks )
+-  {
+-    // separate boundary links from internal ones
+-    typedef set<const QLink*/*, QLink::PtrComparator*/> QLinkSet;
+-    QLinkSet interLinks, bndLinks1, bndLink2;
+-
+-    bool isCurved = false;
+-    for ( TChain::iterator lnk = allLinks.begin(); lnk != allLinks.end(); ++lnk ) {
+-      if ( (*lnk)->OnBoundary() )
+-        bndLinks1.insert( lnk->_qlink );
+-      else
+-        interLinks.insert( lnk->_qlink );
+-      isCurved = isCurved || !(*lnk)->IsStraight();
+-    }
+-    if ( !isCurved )
+-      return; // no need to move
+-
+-    QLinkSet *curBndLinks = &bndLinks1, *newBndLinks = &bndLink2;
+-
+-    while ( !interLinks.empty() && !curBndLinks->empty() )
+-    {
+-      // propagate movement from boundary links to connected internal links
+-      QLinkSet::iterator bnd = curBndLinks->begin(), bndEnd = curBndLinks->end();
+-      for ( ; bnd != bndEnd; ++bnd )
+-      {
+-        const QLink* bndLink = *bnd;
+-        for ( int i = 0; i < bndLink->_faces.size(); ++i ) // loop on faces of bndLink
+-        {
+-          const QFace* face = bndLink->_faces[i]; // quadrange lateral face of a prism
+-          if ( !face ) continue;
+-          // find and move internal link opposite to bndLink within the face
+-          int interInd = ( face->LinkIndex( bndLink ) + 2 ) % face->_sides.size();
+-          const QLink* interLink = face->_sides[ interInd ];
+-          QLinkSet::iterator pInterLink = interLinks.find( interLink );
+-          if ( pInterLink == interLinks.end() ) continue; // not internal link
+-          interLink->Move( bndLink->_nodeMove );
+-          // treated internal links become new boundary ones
+-          interLinks. erase( pInterLink );
+-          newBndLinks->insert( interLink );
+-        }
+-      }
+-      curBndLinks->clear();
+-      std::swap( curBndLinks, newBndLinks );
+-    }
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Fix links of continues triangles near curved boundary
+-   */
+-  //================================================================================
+-
+-  void fixTriaNearBoundary( TChain & allLinks, SMESH_MesherHelper& /*helper*/)
+-  {
+-    if ( allLinks.empty() ) return;
+-
+-    TLinkSet linkSet( allLinks.begin(), allLinks.end());
+-    TLinkInSet linkIt = linkSet.begin(), linksEnd = linkSet.end();
+-
+-    // move in 2d if we are on geom face
+-//     TopoDS_Face face;
+-//     TopLoc_Location loc;
+-//     SMESH_MesherHelper faceHelper( *helper.GetMesh());
+-//     while ( linkIt->IsBoundary()) ++linkIt;
+-//     if ( linkIt == linksEnd ) return;
+-//     if ( (*linkIt)->MediumPos() == SMDS_TOP_FACE ) {
+-//       bool checkPos = true;
+-//       TopoDS_Shape f = helper.GetSubShapeByNode( (*linkIt)->_mediumNode, helper.GetMeshDS() );
+-//       if ( !f.IsNull() && f.ShapeType() == TopAbs_FACE ) {
+-//         face = TopoDS::Face( f );
+-//         helper.GetNodeUV( face, (*linkIt)->_mediumNode, 0, &checkPos);
+-//         if (checkPos)
+-//           face.Nullify();
+-//         else
+-//           faceHelper.SetSubShape( face );
+-//       }
+-//     }
+-    for ( linkIt = linkSet.begin(); linkIt != linksEnd; ++linkIt)
+-    {
+-      if ( linkIt->IsBoundary() && !(*linkIt)->IsStraight() && linkIt->_qfaces[0])
+-      {
+-//         if ( !face.IsNull() ) {
+-//           const SMDS_MeshNode* inFaceNode =
+-//             faceHelper.GetNodeUVneedInFaceNode() ? linkIt->_qfaces[0]->GetNodeInFace() : 0;
+-//           gp_XY uvm = helper.GetNodeUV( face, (*linkIt)->_mediumNode, inFaceNode );
+-//           gp_XY uv1 = helper.GetNodeUV( face, (*linkIt)->node1(), inFaceNode);
+-//           gp_XY uv2 = helper.GetNodeUV( face, (*linkIt)->node2(), inFaceNode);
+-//           gp_XY uvMove = uvm - helper.GetMiddleUV( BRep_Tool::Surface(face,loc), uv1, uv2);
+-//           gp_Vec move( uvMove.X(), uvMove.Y(), 0 );
+-//           linkIt->_qfaces[0]->MoveByBoundary( *linkIt, move, linkSet, &faceHelper );
+-//         }
+-//         else {
+-          linkIt->_qfaces[0]->MoveByBoundary( *linkIt, (*linkIt)->_nodeMove, linkSet );
+-          //}
+-      }
+-    }
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Detect rectangular structure of links and build chains from them
+-   */
+-  //================================================================================
+-
+-  enum TSplitTriaResult {
+-    _OK, _NO_CORNERS, _FEW_ROWS, _MANY_ROWS, _NO_SIDELINK, _BAD_MIDQUAD, _NOT_RECT,
+-    _NO_MIDQUAD, _NO_UPTRIA, _BAD_SET_SIZE, _BAD_CORNER, _BAD_START, _NO_BOTLINK };
+-
+-  TSplitTriaResult splitTrianglesIntoChains( TChain &            allLinks,
+-                                             vector< TChain> &   resultChains,
+-                                             SMDS_TypeOfPosition pos )
+-  {
+-    // put links in the set and evalute number of result chains by number of boundary links
+-    TLinkSet linkSet;
+-    int nbBndLinks = 0;
+-    for ( TChain::iterator lnk = allLinks.begin(); lnk != allLinks.end(); ++lnk ) {
+-      linkSet.insert( *lnk );
+-      nbBndLinks += lnk->IsBoundary();
+-    }
+-    resultChains.clear();
+-    resultChains.reserve( nbBndLinks / 2 );
+-
+-    TLinkInSet linkIt, linksEnd = linkSet.end();
+-
+-    // find a boundary link with corner node; corner node has position pos-2
+-    // i.e. SMDS_TOP_VERTEX for links on faces and SMDS_TOP_EDGE for
+-    // links in volume
+-    SMDS_TypeOfPosition cornerPos = SMDS_TypeOfPosition(pos-2);
+-    const SMDS_MeshNode* corner = 0;
+-    for ( linkIt = linkSet.begin(); linkIt != linksEnd; ++linkIt )
+-      if ( linkIt->IsBoundary() && (corner = (*linkIt)->EndPosNode(cornerPos)))
+-        break;
+-    if ( !corner)
+-      return _NO_CORNERS;
+-
+-    TLinkInSet           startLink = linkIt;
+-    const SMDS_MeshNode* startCorner = corner;
+-    vector< TChain* >    rowChains;
+-    int iCol = 0;
+-
+-    while ( startLink != linksEnd) // loop on columns
+-    {
+-      // We suppose we have a rectangular structure like shown here. We have found a
+-      //               corner of the rectangle (startCorner) and a boundary link sharing  
+-      //    |/  |/  |  the startCorner (startLink). We are going to loop on rows of the   
+-      //  --o---o---o  structure making several chains at once. One chain (columnChain)   
+-      //    |\  |  /|  starts at startLink and continues upward (we look at the structure 
+-      //  \ | \ | / |  from such point that startLink is on the bottom of the structure). 
+-      //   \|  \|/  |  While going upward we also fill horizontal chains (rowChains) we   
+-      //  --o---o---o  encounter.                                                         
+-      //   /|\  |\  |
+-      //  / | \ | \ |  startCorner
+-      //    |  \|  \|,'
+-      //  --o---o---o
+-      //          `.startLink
+-
+-      if ( resultChains.size() == nbBndLinks / 2 )
+-        return _NOT_RECT;
+-      resultChains.push_back( TChain() );
+-      TChain& columnChain = resultChains.back();
+-
+-      TLinkInSet botLink = startLink; // current horizontal link to go up from
+-      corner = startCorner; // current corner the botLink ends at
+-      int iRow = 0;
+-      while ( botLink != linksEnd ) // loop on rows
+-      {
+-        // add botLink to the columnChain
+-        columnChain.push_back( *botLink );
+-
+-        const QFace* botTria = botLink->_qfaces[0]; // bottom triangle bound by botLink
+-        if ( !botTria )
+-        { // the column ends
+-
+-          #ifdef __BORLANDC__
+-          linkSet.erase( *botLink );
+-          #else
+-          linkSet.erase( botLink );
+-          #endif
+-
+-          if ( iRow != rowChains.size() )
+-            return _FEW_ROWS; // different nb of rows in columns
+-          break;
+-        }
+-        // find the link dividing the quadrangle (midQuadLink) and vertical boundary
+-        // link ending at <corner> (sideLink); there are two cases:
+-        // 1) midQuadLink does not end at <corner>, then we easily find it by botTria,
+-        //   since midQuadLink is not at boundary while sideLink is.
+-        // 2) midQuadLink ends at <corner>
+-        bool isCase2;
+-        TLinkInSet midQuadLink = linksEnd;
+-        TLinkInSet sideLink = botTria->GetBoundaryLink( linkSet, *botLink, &midQuadLink,
+-                                                        corner, &isCase2 );
+-        if ( isCase2 ) { // find midQuadLink among links of botTria
+-          midQuadLink = botTria->GetLinkByNode( linkSet, *botLink, corner );
+-          if ( midQuadLink->IsBoundary() )
+-            return _BAD_MIDQUAD;
+-        }
+-        if ( sideLink == linksEnd || midQuadLink == linksEnd || sideLink == midQuadLink )
+-          return sideLink == linksEnd ? _NO_SIDELINK : _NO_MIDQUAD;
+-
+-        // fill chains
+-        columnChain.push_back( *midQuadLink );
+-        if ( iRow >= rowChains.size() ) {
+-          if ( iCol > 0 )
+-            return _MANY_ROWS; // different nb of rows in columns
+-          if ( resultChains.size() == nbBndLinks / 2 )
+-            return _NOT_RECT;
+-          resultChains.push_back( TChain() );
+-          rowChains.push_back( & resultChains.back() );
+-        }
+-        rowChains[iRow]->push_back( *sideLink );
+-        rowChains[iRow]->push_back( *midQuadLink );
+-
+-        const QFace* upTria = midQuadLink->NextFace( botTria ); // upper tria of the rectangle
+-        if ( !upTria)
+-          return _NO_UPTRIA;
+-        if ( iRow == 0 ) {
+-          // prepare startCorner and startLink for the next column
+-          startCorner = startLink->NextNode( startCorner );
+-          if (isCase2)
+-            startLink = botTria->GetBoundaryLink( linkSet, *botLink, 0, startCorner );
+-          else
+-            startLink = upTria->GetBoundaryLink( linkSet, *midQuadLink, 0, startCorner );
+-          // check if no more columns remains
+-          if ( startLink != linksEnd ) {
+-            const SMDS_MeshNode* botNode = startLink->NextNode( startCorner );
+-            if ( (isCase2 ? botTria : upTria)->Contains( botNode ))
+-              startLink = linksEnd; // startLink bounds upTria or botTria
+-            else if ( startLink == botLink || startLink == midQuadLink || startLink == sideLink )
+-              return _BAD_START;
+-          }
+-        }
+-        // find bottom link and corner for the next row
+-        corner = sideLink->NextNode( corner );
+-        // next bottom link ends at the new corner
+-
+-        #ifdef __BORLANDC__
+-        linkSet.erase( *botLink );
+-        #else
+-        linkSet.erase( botLink );
+-        #endif
+-
+-        botLink = upTria->GetLinkByNode( linkSet, (isCase2 ? *sideLink : *midQuadLink), corner );
+-        if ( botLink == linksEnd || botLink == (isCase2 ? midQuadLink : sideLink))
+-          return _NO_BOTLINK;
+-
+-        #ifdef __BORLANDC__
+-        linkSet.erase( *midQuadLink );
+-        linkSet.erase( *sideLink );
+-        #else
+-        linkSet.erase( midQuadLink );
+-        linkSet.erase( sideLink );
+-        #endif
+-
+-        // make faces neighboring the found ones be boundary
+-        if ( startLink != linksEnd ) {
+-          const QFace* tria = isCase2 ? botTria : upTria;
+-          for ( int iL = 0; iL < 3; ++iL ) {
+-            linkIt = linkSet.find( tria->_sides[iL] );
+-            if ( linkIt != linksEnd )
+-              linkIt->RemoveFace( tria );
+-          }
+-        }
+-        if ( botLink->_qfaces[0] == upTria || botLink->_qfaces[1] == upTria )
+-          botLink->RemoveFace( upTria ); // make next botTria first in vector
+-
+-        iRow++;
+-      } // loop on rows
+-
+-      iCol++;
+-    }
+-    // In the linkSet, there must remain the last links of rowChains; add them
+-    if ( linkSet.size() != rowChains.size() )
+-      return _BAD_SET_SIZE;
+-    for ( int iRow = 0; iRow < rowChains.size(); ++iRow ) {
+-      // find the link (startLink) ending at startCorner
+-      corner = 0;
+-      for ( startLink = linkSet.begin(); startLink != linksEnd; ++startLink ) {
+-        if ( (*startLink)->node1() == startCorner ) {
+-          corner = (*startLink)->node2(); break;
+-        }
+-        else if ( (*startLink)->node2() == startCorner) {
+-          corner = (*startLink)->node1(); break;
+-        }
+-      }
+-      if ( startLink == linksEnd )
+-        return _BAD_CORNER;
+-      rowChains[ iRow ]->push_back( *startLink );
+-
+-      #ifdef __BORLANDC__
+-      linkSet.erase( *startLink );
+-      #else
+-      linkSet.erase( startLink );
+-      #endif
+-
+-      startCorner = corner;
+-    }
+-
+-    return _OK;
+-  }
+-}
+-
+-//=======================================================================
+-/*!
+- * \brief Move medium nodes of faces and volumes to fix distorted elements
+- * \param volumeOnly - to fix nodes on faces or not, if the shape is solid
+- * 
+- * Issue 0020307: EDF 992 SMESH : Linea/Quadratic with Medium Node on Geometry
+- */
+-//=======================================================================
+-
+-void SMESH_MesherHelper::FixQuadraticElements(bool volumeOnly)
+-{
+-  // apply algorithm to solids or geom faces
+-  // ----------------------------------------------
+-  if ( myShape.IsNull() ) {
+-    if ( !myMesh->HasShapeToMesh() ) return;
+-    SetSubShape( myMesh->GetShapeToMesh() );
+-
+-    TopTools_MapOfShape faces; // faces not in solid or in not meshed solid
+-    for ( TopExp_Explorer f(myShape,TopAbs_FACE,TopAbs_SOLID); f.More(); f.Next() ) {
+-      faces.Add( f.Current() );
+-    }
+-    for ( TopExp_Explorer v(myShape,TopAbs_SOLID); v.More(); v.Next() ) {
+-      if ( myMesh->GetSubMesh( v.Current() )->IsEmpty() ) { // get faces of solid
+-        for ( TopExp_Explorer f( v.Current(), TopAbs_FACE); f.More(); f.Next() )
+-          faces.Add( f.Current() );
+-      }
+-      else { // fix nodes in the solid and its faces
+-        SMESH_MesherHelper h(*myMesh);
+-        h.SetSubShape( v.Current() );
+-        h.FixQuadraticElements(false);
+-      }
+-    }
+-    // fix nodes on geom faces
+-    for ( TopTools_MapIteratorOfMapOfShape fIt( faces ); fIt.More(); fIt.Next() ) {
+-      SMESH_MesherHelper h(*myMesh);
+-      h.SetSubShape( fIt.Key() );
+-      h.FixQuadraticElements();
+-    }
+-    return;
+-  }
+-
+-  // Find out type of elements and get iterator on them
+-  // ---------------------------------------------------
+-
+-  SMDS_ElemIteratorPtr elemIt;
+-  SMDSAbs_ElementType elemType = SMDSAbs_All;
+-
+-  SMESH_subMesh* submesh = myMesh->GetSubMeshContaining( myShapeID );
+-  if ( !submesh )
+-    return;
+-  if ( SMESHDS_SubMesh* smDS = submesh->GetSubMeshDS() ) {
+-    elemIt = smDS->GetElements();
+-    if ( elemIt->more() ) {
+-      elemType = elemIt->next()->GetType();
+-      elemIt = smDS->GetElements();
+-    }
+-  }
+-  if ( !elemIt || !elemIt->more() || elemType < SMDSAbs_Face )
+-    return;
+-
+-  // Fill in auxiliary data structures
+-  // ----------------------------------
+-
+-  set< QLink > links;
+-  set< QFace > faces;
+-  set< QLink >::iterator pLink;
+-  set< QFace >::iterator pFace;
+-
+-  bool isCurved = false;
+-  bool hasRectFaces = false;
+-  set<int> nbElemNodeSet;
+-
+-  if ( elemType == SMDSAbs_Volume )
+-  {
+-    SMDS_VolumeTool volTool;
+-    while ( elemIt->more() ) // loop on volumes
+-    {
+-      const SMDS_MeshElement* vol = elemIt->next();
+-      if ( !vol->IsQuadratic() || !volTool.Set( vol ))
+-        return; //continue;
+-      for ( int iF = 0; iF < volTool.NbFaces(); ++iF ) // loop on faces of volume
+-      {
+-        int nbN = volTool.NbFaceNodes( iF );
+-        nbElemNodeSet.insert( nbN );
+-        const SMDS_MeshNode** faceNodes = volTool.GetFaceNodes( iF );
+-        vector< const QLink* > faceLinks( nbN/2 );
+-        for ( int iN = 0; iN < nbN; iN += 2 ) // loop on links of a face
+-        {
+-          // store QLink
+-          QLink link( faceNodes[iN], faceNodes[iN+2], faceNodes[iN+1] );
+-          pLink = links.insert( link ).first;
+-          faceLinks[ iN/2 ] = & *pLink;
+-          if ( !isCurved )
+-            isCurved = !link.IsStraight();
+-          if ( link.MediumPos() == SMDS_TOP_3DSPACE && !link.IsStraight() )
+-            return; // already fixed
+-        }
+-        // store QFace
+-        pFace = faces.insert( QFace( faceLinks )).first;
+-        if ( pFace->NbVolumes() == 0 )
+-          pFace->AddSelfToLinks();
+-        pFace->SetVolume( vol );
+-        hasRectFaces = hasRectFaces ||
+-          ( volTool.GetVolumeType() == SMDS_VolumeTool::QUAD_HEXA ||
+-            volTool.GetVolumeType() == SMDS_VolumeTool::QUAD_PENTA );
+-      }
+-    }
+-    set< QLink >::iterator pLink = links.begin();
+-    for ( ; pLink != links.end(); ++pLink )
+-      pLink->SetContinuesFaces();
+-  }
+-  else
+-  {
+-    while ( elemIt->more() ) // loop on faces
+-    {
+-      const SMDS_MeshElement* face = elemIt->next();
+-      if ( !face->IsQuadratic() )
+-        continue;
+-      nbElemNodeSet.insert( face->NbNodes() );
+-      int nbN = face->NbNodes()/2;
+-      vector< const QLink* > faceLinks( nbN );
+-      for ( int iN = 0; iN < nbN; ++iN ) // loop on links of a face
+-      {
+-        // store QLink
+-        QLink link( face->GetNode(iN), face->GetNode((iN+1)%nbN), face->GetNode(iN+nbN) );
+-        pLink = links.insert( link ).first;
+-        faceLinks[ iN ] = & *pLink;
+-        if ( !isCurved )
+-          isCurved = !link.IsStraight();
+-      }
+-      // store QFace
+-      pFace = faces.insert( QFace( faceLinks )).first;
+-      pFace->AddSelfToLinks();
+-      hasRectFaces = ( hasRectFaces || nbN == 4 );
+-    }
+-  }
+-  if ( !isCurved )
+-    return; // no curved edges of faces
+-
+-  // Compute displacement of medium nodes
+-  // -------------------------------------
+-
+-  // two loops on faces: the first is to treat boundary links, the second is for internal ones
+-  TopLoc_Location loc;
+-  // not treat boundary of volumic submesh
+-  int isInside = ( elemType == SMDSAbs_Volume && volumeOnly ) ? 1 : 0;
+-  for ( ; isInside < 2; ++isInside ) {
+-    MSG( "--------------- LOOP " << isInside << " ------------------");
+-    SMDS_TypeOfPosition pos = isInside ? SMDS_TOP_3DSPACE : SMDS_TOP_FACE;
+-
+-    for ( pFace = faces.begin(); pFace != faces.end(); ++pFace ) {
+-      if ( bool(isInside) == pFace->IsBoundary() )
+-        continue;
+-      for ( int dir = 0; dir < 2; ++dir ) // 2 directions of propagation from quadrangle
+-      {
+-        MSG( "CHAIN");
+-        // make chain of links connected via continues faces
+-        int error = ERR_OK;
+-        TChain rawChain;
+-        if ( !pFace->GetLinkChain( dir, rawChain, pos, error) && error ==ERR_UNKNOWN ) continue;
+-        rawChain.reverse();
+-        if ( !pFace->GetLinkChain( dir+2, rawChain, pos, error ) && error ==ERR_UNKNOWN ) continue;
+-
+-        vector< TChain > chains;
+-        if ( error == ERR_OK ) { // chains contains continues rectangles
+-          chains.resize(1);
+-          chains[0].splice( chains[0].begin(), rawChain );
+-        }
+-        else if ( error == ERR_TRI ) {  // chains contains continues triangles
+-          TSplitTriaResult res = splitTrianglesIntoChains( rawChain, chains, pos );
+-          if ( res != _OK ) { // not rectangles split into triangles
+-            fixTriaNearBoundary( rawChain, *this );
+-            break;
+-          }
+-        }
+-        else if ( error == ERR_PRISM ) { // side faces of prisms
+-          fixPrism( rawChain );
+-          break;
+-        }
+-        else {
+-          continue;
+-        }
+-        for ( int iC = 0; iC < chains.size(); ++iC )
+-        {
+-          TChain& chain = chains[iC];
+-          if ( chain.empty() ) continue;
+-          if ( chain.front()->IsStraight() && chain.back()->IsStraight() ) {
+-            MSG("3D straight");
+-            continue;
+-          }
+-          // mesure chain length and compute link position along the chain
+-          double chainLen = 0;
+-          vector< double > linkPos;
+-          MSGBEG( "Link medium nodes: ");
+-          TChain::iterator link0 = chain.begin(), link1 = chain.begin(), link2;
+-          for ( ++link1; link1 != chain.end(); ++link1, ++link0 ) {
+-            MSGBEG( (*link0)->_mediumNode->GetID() << "-" <<(*link1)->_mediumNode->GetID()<<" ");
+-            double len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus();
+-            while ( len < numeric_limits<double>::min() ) { // remove degenerated link
+-              link1 = chain.erase( link1 );
+-              if ( link1 == chain.end() )
+-                break;
+-              len = ((*link0)->MiddlePnt() - (*link1)->MiddlePnt()).Modulus();
+-            }
+-            chainLen += len;
+-            linkPos.push_back( chainLen );
+-          }
+-          MSG("");
+-          if ( linkPos.size() < 2 )
+-            continue;
+-
+-          gp_Vec move0 = chain.front()->_nodeMove;
+-          gp_Vec move1 = chain.back ()->_nodeMove;
+-
+-          TopoDS_Face face;
+-          bool checkUV = true;
+-          if ( !isInside ) {
+-            // compute node displacement of end links in parametric space of face
+-            const SMDS_MeshNode* nodeOnFace = (*(++chain.begin()))->_mediumNode;
+-            TopoDS_Shape f = GetSubShapeByNode( nodeOnFace, GetMeshDS() );
+-            if ( !f.IsNull() && f.ShapeType() == TopAbs_FACE ) {
+-              face = TopoDS::Face( f );
+-              for ( int is1 = 0; is1 < 2; ++is1 ) { // move0 or move1
+-                TChainLink& link = is1 ? chain.back() : chain.front();
+-                gp_XY uv1 = GetNodeUV( face, link->node1(), nodeOnFace, &checkUV);
+-                gp_XY uv2 = GetNodeUV( face, link->node2(), nodeOnFace, &checkUV);
+-                gp_XY uvm = GetNodeUV( face, link->_mediumNode, nodeOnFace, &checkUV);
+-                gp_XY uvMove = uvm - GetMiddleUV( BRep_Tool::Surface(face,loc), uv1, uv2);
+-                if ( is1 ) move1.SetCoord( uvMove.X(), uvMove.Y(), 0 );
+-                else       move0.SetCoord( uvMove.X(), uvMove.Y(), 0 );
+-              }
+-              if ( move0.SquareMagnitude() < straightTol2 &&
+-                   move1.SquareMagnitude() < straightTol2 ) {
+-                MSG("2D straight");
+-                continue; // straight - no need to move nodes of internal links
+-              }
+-            }
+-          }
+-          gp_Trsf trsf;
+-          if ( isInside || face.IsNull() )
+-          {
+-            // compute node displacement of end links in their local coord systems
+-            {
+-              TChainLink& ln0 = chain.front(), ln1 = *(++chain.begin());
+-              trsf.SetTransformation( gp_Ax3( gp::Origin(), ln0.Normal(),
+-                                              gp_Vec( ln0->MiddlePnt(), ln1->MiddlePnt() )));
+-              move0.Transform(trsf);
+-            }
+-            {
+-              TChainLink& ln0 = *(++chain.rbegin()), ln1 = chain.back();
+-              trsf.SetTransformation( gp_Ax3( gp::Origin(), ln1.Normal(),
+-                                              gp_Vec( ln0->MiddlePnt(), ln1->MiddlePnt() )));
+-              move1.Transform(trsf);
+-            }
+-          }
+-          // compute displacement of medium nodes
+-          link2 = chain.begin();
+-          link0 = link2++;
+-          link1 = link2++;
+-          for ( int i = 0; link2 != chain.end(); ++link0, ++link1, ++link2, ++i )
+-          {
+-            double r = linkPos[i] / chainLen;
+-            // displacement in local coord system
+-            gp_Vec move = (1. - r) * move0 + r * move1;
+-            if ( isInside || face.IsNull()) {
+-              // transform to global
+-              gp_Vec x01( (*link0)->MiddlePnt(), (*link1)->MiddlePnt() );
+-              gp_Vec x12( (*link1)->MiddlePnt(), (*link2)->MiddlePnt() );
+-              gp_Vec x = x01.Normalized() + x12.Normalized();
+-              trsf.SetTransformation( gp_Ax3( gp::Origin(), link1->Normal(), x), gp_Ax3() );
+-              move.Transform(trsf);
+-            }
+-            else {
+-              // compute 3D displacement by 2D one
+-              gp_XY oldUV   = GetNodeUV( face, (*link1)->_mediumNode, 0, &checkUV);
+-              gp_XY newUV   = oldUV + gp_XY( move.X(), move.Y() );
+-              gp_Pnt newPnt = BRep_Tool::Surface(face,loc)->Value( newUV.X(), newUV.Y());
+-              move = gp_Vec( XYZ((*link1)->_mediumNode), newPnt.Transformed(loc) );
+-#ifdef _DEBUG_
+-              if ( (XYZ((*link1)->node1()) - XYZ((*link1)->node2())).SquareModulus() <
+-                   move.SquareMagnitude())
+-              {
+-                gp_XY uv0 = GetNodeUV( face, (*link0)->_mediumNode, 0, &checkUV);
+-                gp_XY uv2 = GetNodeUV( face, (*link2)->_mediumNode, 0, &checkUV);
+-                MSG( "uv0: "<<uv0.X()<<", "<<uv0.Y()<<" \t" <<
+-                     "uv2: "<<uv2.X()<<", "<<uv2.Y()<<" \t" <<
+-                     "uvOld: "<<oldUV.X()<<", "<<oldUV.Y()<<" \t" <<
+-                     "newUV: "<<newUV.X()<<", "<<newUV.Y()<<" \t");
+-              }
+-#endif
+-            }
+-            (*link1)->Move( move );
+-            MSG( "Move " << (*link1)->_mediumNode->GetID() << " following "
+-                 << chain.front()->_mediumNode->GetID() <<"-"
+-                 << chain.back ()->_mediumNode->GetID() <<
+-                 " by " << move.Magnitude());
+-          }
+-        } // loop on chains of links
+-      } // loop on 2 directions of propagation from quadrangle
+-    } // loop on faces
+-  }
+-
+-  // Move nodes
+-  // -----------
+-
+-  for ( pLink = links.begin(); pLink != links.end(); ++pLink ) {
+-    if ( pLink->IsMoved() ) {
+-      //gp_Pnt p = pLink->MediumPnt() + pLink->Move();
+-      gp_Pnt p = pLink->MiddlePnt() + pLink->Move();
+-      GetMeshDS()->MoveNode( pLink->_mediumNode, p.X(), p.Y(), p.Z());
+-    }
+-  }
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Octree.cpp salomesmesh/src/SMESH/SMESH_Octree.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Octree.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_Octree.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -20,47 +20,28 @@
+ //  See http://www.salome-platform.org/ or email : webmaster.salome at opencascade.com
+ //
+ //  SMESH  SMESH_Octree : global Octree implementation
++// File      : SMESH_Octree.cxx
++// Created   : Tue Jan 16 16:00:00 2007
++// Author    : Nicolas Geimer & Aurélien Motteux(OCC)
++// Module    : SMESH
+ //
+-//  File      : SMESH_Octree.cxx
+-//  Created   : Tue Jan 16 16:00:00 2007
+-//  Author    : Nicolas Geimer & Aurélien Motteux(OCC)
+-//  Module    : SMESH
+-
+ #include "SMESH_Octree.hxx"
+ 
+ //===========================================================================
+ /*!
+- * Constructor. limit must be provided at tree root construction.
+- * limit will be deleted by SMESH_Octree.
++ * \brief SMESH_Octree Constructor
++ * \param maxLevel     - The level max the octree can reach (If <0 unlimited)
+  */
+ //===========================================================================
+-
+-SMESH_Octree::SMESH_Octree (SMESH_Octree::Limit* limit):
+-  myChildren(NULL),
+-  myFather(NULL),
+-  myIsLeaf( false ),
+-  myLimit( limit ),
+-  myLevel(0),
+-  myBox(NULL)
+-{
+-}
+-
+-//================================================================================
+-/*!
+- * \brief Compute the Octree
+- */
+-//================================================================================
+-
+-void SMESH_Octree::compute()
++SMESH_Octree::SMESH_Octree (const int maxLevel, const double minBoxSize):
++    myChildren(NULL),
++    myFather(NULL),
++    myLevel(0),
++    myMaxLevel(maxLevel),
++    myMinBoxSize(minBoxSize),
++    myIsLeaf(-1)
+ {
+-  if ( myLevel==0 )
+-  {
+-    myBox = buildRootBox();
+-    if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
+-      myIsLeaf = true;
+-    else
+-      buildChildren();
+-  }
++  myBox = new Bnd_B3d();
+ }
+ 
+ //======================================
+@@ -68,25 +49,85 @@
+  * \brief SMESH_Octree Destructor
+  */
+ //======================================
+-
+ SMESH_Octree::~SMESH_Octree ()
+ {
+   if(myChildren != NULL)
+   {
+-    if(!isLeaf())
++    if(!myIsLeaf)
+     {
+       for(int i = 0; i<8; i++)
+         delete myChildren[i];
+-      delete[] myChildren;
+-      myChildren = 0;
++      delete[] myChildren ;
+     }
+   }
+-  if ( myBox )
+-    delete myBox;
+-  myBox = 0;
+-  if ( level() == 0 )
+-    delete myLimit;
+-  myLimit = 0;
++  delete myBox;
++}
++
++//===========================================================================
++/*!
++ * \brief Set the bounding box of the Octree
++ * \param box          - 3d Bounding Box of the Octree
++ */
++//===========================================================================
++void SMESH_Octree::setBox(const Bnd_B3d* box)
++{
++//   delete myBox;
++//   myBox=new Bnd_B3d(*box);
++  *myBox = *box;
++}
++
++//===========================================================================
++/*!
++ * \brief Set box to the 3d Bounding Box of the Octree
++ * \param box          - Set box to the 3d Bounding Box of the Octree
++ */
++//===========================================================================
++void SMESH_Octree::getBox(Bnd_B3d& box)
++{
++//   if(box != NULL)
++//     delete box;
++//   box = new Bnd_B3d (*myBox);
++  box = *myBox;
++}
++
++//===========================================================================
++/*!
++ * \brief Set the max level of the Octree
++ * \param maxLevel     - The level max the octree can reach (If <0 unlimited)
++ */
++//===========================================================================
++void SMESH_Octree::setMaxLevel(const int maxLevel)
++{myMaxLevel = maxLevel;}
++
++
++//===========================================================================
++/*!
++ * \brief Compute the bigger dimension of the box
++ * \param box          - 3d Box
++ * \retval double - bigger dimension of the box
++ */
++//===========================================================================
++double SMESH_Octree::maxSize(const Bnd_B3d* box)
++{
++  if(box ==NULL)
++    return 0;
++  gp_XYZ min = box->CornerMin();
++  gp_XYZ max = box->CornerMax();
++  gp_XYZ Size = (max - min);
++  double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y();
++  return (returnVal>Size.Z())?returnVal:Size.Z();
++}
++
++//=============================
++/*!
++ * \brief Compute the Octree
++ */
++//=============================
++void SMESH_Octree::Compute()
++{
++  // As soon as the Octree is a Leaf, I stop building his children
++  if(!isLeaf())
++    buildChildren();
+ }
+ 
+ //=================================================================
+@@ -94,11 +135,8 @@
+  * \brief Build the 8 children boxes and call buildChildrenData()
+  */
+ //=================================================================
+-
+ void SMESH_Octree::buildChildren()
+ {
+-  if ( isLeaf() ) return;
+-
+   myChildren = new SMESH_Octree*[8];
+ 
+   gp_XYZ min = myBox->CornerMin();
+@@ -108,11 +146,12 @@
+   gp_XYZ childHsize = HSize/2.;
+ 
+   Standard_Real XminChild, YminChild, ZminChild;
++  Bnd_B3d* box;
+   gp_XYZ minChild;
+-  for (int i = 0; i < 8; i++)
++  for (int i =0; i<8; i++)
+   {
+-    // We build the eight boxes, we need 2 points to do that:
+-    // Min and Mid
++    // We build the eight boxes, we need 2 points to do that.
++    // Min, and Mid
+     // In binary, we can write i from 0 to 7
+     // For instance :
+     // 5 is 101, it corresponds here in coordinates to ZYX
+@@ -121,58 +160,24 @@
+     // Same scheme for X and Z
+     // I need the minChild to build the Bnd_B3d box.
+ 
+-    XminChild = (i%2==0)?min.X():mid.X();
+-    YminChild = ((i%4)/2==0)?min.Y():mid.Y();
+-    ZminChild = (i<4)?min.Z():mid.Z();
++    XminChild= (i%2==0)?min.X():mid.X();
++    YminChild= ((i%4)/2==0)?min.Y():mid.Y();
++    ZminChild= (i<4)?min.Z():mid.Z();
+     minChild.SetCoord(XminChild, YminChild, ZminChild);
+ 
++    box = new Bnd_B3d(minChild+childHsize,childHsize);
+     // The child is of the same type than its father (For instance, a SMESH_OctreeNode)
+-    // We allocate the memory we need for the child
++    // We allocate the memory we need fot the child
+     myChildren[i] = allocateOctreeChild();
+     // and we assign to him its box.
+-    myChildren[i]->myFather = this;
+-    myChildren[i]->myLimit = myLimit;
+-    myChildren[i]->myLevel = myLevel + 1;
+-    myChildren[i]->myBox = new Bnd_B3d(minChild+childHsize,childHsize);
+-    if ( myLimit->myMinBoxSize > 0. && myChildren[i]->maxSize() <= myLimit->myMinBoxSize )
+-      myChildren[i]->myIsLeaf = true;
++    myChildren[i]->setBox(box);
++    delete box;
+   }
+ 
+-  // After building the 8 boxes, we put the data into the children.
++  // After building the 8 boxes, we put the data into the children..
+   buildChildrenData();
+ 
+   //After we pass to the next level of the Octree
+-  for (int i = 0; i<8; i++)
+-    myChildren[i]->buildChildren();
+-}
+-
+-//================================================================================
+-/*!
+- * \brief Tell if Octree is a leaf or not
+- *        An inheriting class can influence it via myIsLeaf protected field
+- */
+-//================================================================================
+-
+-bool SMESH_Octree::isLeaf() const
+-{
+-  return myIsLeaf || ((myLimit->myMaxLevel > 0) ? (level() >= myLimit->myMaxLevel) : false );
+-}
+-
+-//===========================================================================
+-/*!
+- * \brief Compute the bigger dimension of my box
+- */
+-//===========================================================================
+-
+-double SMESH_Octree::maxSize() const
+-{
+-  if ( myBox )
+-  {
+-    gp_XYZ min = myBox->CornerMin();
+-    gp_XYZ max = myBox->CornerMax();
+-    gp_XYZ Size = (max - min);
+-    double returnVal = (Size.X()>Size.Y())?Size.X():Size.Y();
+-    return (returnVal>Size.Z())?returnVal:Size.Z();
+-  }
+-  return 0.;
++  for (int i =0; i<8; i++)
++    myChildren[i]->Compute();
+ }
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_OctreeNode.cpp salomesmesh/src/SMESH/SMESH_OctreeNode.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_OctreeNode.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_OctreeNode.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -46,22 +46,18 @@
+ //================================================================
+ SMESH_OctreeNode::SMESH_OctreeNode (const set<const SMDS_MeshNode*> & theNodes, const int maxLevel,
+                                     const int maxNbNodes , const double minBoxSize )
+-  :SMESH_Octree( new SMESH_Octree::Limit( maxLevel,minBoxSize)),
++  :SMESH_Octree(maxLevel,minBoxSize),
+   myMaxNbNodes(maxNbNodes),
+   myNodes(theNodes)
+ {
+-  compute();
+-}
+-
+-//================================================================================
+-/*!
+- * \brief Constructor used to allocate a child
+- */
+-//================================================================================
+-
+-SMESH_OctreeNode::SMESH_OctreeNode (int maxNbNodes):
+-  SMESH_Octree(), myMaxNbNodes(maxNbNodes)
+-{
++  // We need to compute the first bounding box via a special method
++  computeBoxForFather();
++  myNbNodes = myNodes.size();
++  myIsLeaf = ((myLevel == myMaxLevel) ||
++              (myNbNodes <= myMaxNbNodes) ||
++              (maxSize(myBox) <= myMinBoxSize));
++  // All the children (Boxes and Data) are computed in Compute()
++  Compute();
+ }
+ 
+ //==================================================================================
+@@ -69,10 +65,16 @@
+  * \brief Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren()
+  */
+ //==================================================================================
+-
+-SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild() const
++SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild()
+ {
+-  return new SMESH_OctreeNode(myMaxNbNodes);
++  SMESH_OctreeNode * theOctree = new SMESH_OctreeNode();
++  theOctree->myFather = this;
++  theOctree->myLevel = myLevel + 1;
++  theOctree->myMaxLevel = myMaxLevel;
++  theOctree->myMaxNbNodes = myMaxNbNodes;
++  theOctree->myMinBoxSize = myMinBoxSize;
++  theOctree->myNbNodes = 0;
++  return theOctree;
+ }
+ 
+ //======================================
+@@ -82,20 +84,25 @@
+  * We take the max/min coord of the nodes
+  */
+ //======================================
+-
+-Bnd_B3d* SMESH_OctreeNode::buildRootBox()
++void SMESH_OctreeNode::computeBoxForFather()
+ {
+-  Bnd_B3d* box = new Bnd_B3d;
+   set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
+   for (; it != myNodes.end(); it++) {
+     const SMDS_MeshNode* n1 = *it;
+     gp_XYZ p1( n1->X(), n1->Y(), n1->Z() );
+-    box->Add(p1);
++    myBox->Add(p1);
+   }
+-  if ( myNodes.size() <= myMaxNbNodes )
+-    myIsLeaf = true;
++}
+ 
+-  return box;
++//====================================================================================
++/*!
++ * \brief Tell if Octree is a leaf or not (has to be implemented in inherited classes)
++ * \retval      - True if the Octree is a leaf
++ */
++//====================================================================================
++const bool SMESH_OctreeNode::isLeaf()
++{
++  return myIsLeaf;
+ }
+ 
+ //====================================================================================
+@@ -106,15 +113,19 @@
+  * \retval bool - True if Node is in the box within precision
+  */
+ //====================================================================================
+-
+ const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double precision)
+ {
+-  gp_XYZ p (Node->X(),Node->Y(),Node->Z());
++  double X = Node->X();
++  double Y = Node->Y();
++  double Z = Node->Z();
++  bool Out = 1 ;
+   if (precision <= 0.)
+-    return !(getBox().IsOut(p));
+-  Bnd_B3d BoxWithPrecision = getBox();
++    return !(myBox->IsOut(gp_XYZ(X,Y,Z)));
++  Bnd_B3d BoxWithPrecision;
++  getBox(BoxWithPrecision);
+   BoxWithPrecision.Enlarge(precision);
+-  return ! BoxWithPrecision.IsOut(p);
++  Out = BoxWithPrecision.IsOut(gp_XYZ(X,Y,Z));
++  return !(Out);
+ }
+ 
+ //================================================
+@@ -125,15 +136,16 @@
+ //================================================
+ void SMESH_OctreeNode::buildChildrenData()
+ {
+-  gp_XYZ min = getBox().CornerMin();
+-  gp_XYZ max = getBox().CornerMax();
++  gp_XYZ min = myBox->CornerMin();
++  gp_XYZ max = myBox->CornerMax();
+   gp_XYZ mid = (min + max)/2.;
+ 
+   set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
++  int ChildBoxNum;
+   while (it != myNodes.end())
+   {
+     const SMDS_MeshNode* n1 = *it;
+-    int ChildBoxNum = getChildIndex( n1->X(), n1->Y(), n1->Z(), mid );
++    ChildBoxNum = (n1->X() > mid.X()) + (n1->Y() > mid.Y())*2 + (n1->Z() > mid.Z())*4;
+     SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[ChildBoxNum]);
+     myChild->myNodes.insert(myChild->myNodes.end(),n1);
+     myNodes.erase( it );
+@@ -142,8 +154,10 @@
+   for (int i = 0; i < 8; i++)
+   {
+     SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
+-    if ( myChild->myNodes.size() <= myMaxNbNodes )
+-      myChild->myIsLeaf = true;
++    myChild->myNbNodes = (myChild->myNodes).size();
++    myChild->myIsLeaf = ((myChild->myLevel == myMaxLevel) ||
++                         (myChild->myNbNodes <= myMaxNbNodes) ||
++                         (maxSize(myChild->myBox) <= myMinBoxSize));
+   }
+ }
+ 
+@@ -161,7 +175,7 @@
+ {
+   if (isInside(Node,precision))
+   {
+-    if (isLeaf())
++    if (myIsLeaf)
+     {
+       Result->insert(Result->end(), myNodes.begin(), myNodes.end());
+     }
+@@ -176,61 +190,6 @@
+   }
+ }
+ 
+-//================================================================================
+-/*!
+- * \brief Return in dist2Nodes nodes mapped to their square distance from Node
+- *  \param node - node to find nodes closest to
+- *  \param dist2Nodes - map of found nodes and their distances
+- *  \param precision - radius of a sphere to check nodes inside
+- *  \retval bool - true if an exact overlapping found
+- */
+-//================================================================================
+-
+-bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode *              node,
+-                                   map<double, const SMDS_MeshNode*>& dist2Nodes,
+-                                   double                             precision)
+-{
+-  if ( !dist2Nodes.empty() )
+-    precision = min ( precision, sqrt( dist2Nodes.begin()->first ));
+-  else if ( precision == 0. )
+-    precision = maxSize() / 2;
+-
+-  if (isInside(node,precision))
+-  {
+-    if (!isLeaf())
+-    {
+-      // first check a child containing node
+-      gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
+-      int nodeChild  = getChildIndex( node->X(), node->Y(), node->Z(), mid );
+-      if ( ((SMESH_OctreeNode*) myChildren[nodeChild])->NodesAround(node, dist2Nodes, precision))
+-        return true;
+-      
+-      for (int i = 0; i < 8; i++)
+-        if ( i != nodeChild )
+-          if (((SMESH_OctreeNode*) myChildren[i])->NodesAround(node, dist2Nodes, precision))
+-            return true;
+-    }
+-    else if ( NbNodes() > 0 )
+-    {
+-      double minDist = precision * precision;
+-      gp_Pnt p1 ( node->X(), node->Y(), node->Z() );
+-      set<const SMDS_MeshNode*>::iterator nIt = myNodes.begin();
+-      for ( ; nIt != myNodes.end(); ++nIt )
+-      {
+-        gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z() );
+-        double dist2 = p1.SquareDistance( p2 );
+-        if ( dist2 < minDist )
+-          dist2Nodes.insert( make_pair( minDist = dist2, *nIt ));
+-      }
+-//       if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes
+-//         dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end());
+-
+-      return ( sqrt( minDist) <= precision * 1e-12 );
+-    }
+-  }
+-  return false;
+-}
+-
+ //=============================
+ /*!
+  * \brief  Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
+@@ -243,14 +202,15 @@
+  * \param maxNbNodes - maximum Nodes in a Leaf of the SMESH_OctreeNode constructed, default value is 5
+  */
+ //=============================
+-void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*>& theSetOfNodes,
++void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*> theSetOfNodes,
+                                             list< list< const SMDS_MeshNode*> >* theGroupsOfNodes,
+                                             const double theTolerance,
+                                             const int maxLevel,
+                                             const int maxNbNodes)
+ {
+-  SMESH_OctreeNode theOctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
+-  theOctreeNode.FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
++  SMESH_OctreeNode* theOctreeNode = new SMESH_OctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
++  theOctreeNode->FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
++  delete theOctreeNode;
+ }
+ 
+ //=============================
+@@ -325,7 +285,7 @@
+   if (isInsideBool)
+   {
+     // I'm only looking in the leaves, since all the nodes are stored there.
+-    if (isLeaf())
++    if (myIsLeaf)
+     {
+       gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
+ 
+@@ -375,43 +335,6 @@
+ 
+ //================================================================================
+ /*!
+- * \brief Update data according to node movement
+- */
+-//================================================================================
+-
+-void SMESH_OctreeNode::UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt )
+-{
+-  if ( isLeaf() )
+-  {
+-    set<const SMDS_MeshNode*>::iterator pNode = myNodes.find( node );
+-    bool nodeInMe = ( pNode != myNodes.end() );
+-
+-    SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() );
+-    bool pointInMe = isInside( &pointNode, 1e-10 );
+-
+-    if ( pointInMe != nodeInMe )
+-    {
+-      if ( pointInMe )
+-        myNodes.insert( node );
+-      else
+-        myNodes.erase( node );
+-    }
+-  }
+-  else if ( myChildren )
+-  {
+-    gp_XYZ mid = (getBox().CornerMin() + getBox().CornerMax()) / 2.;
+-    int nodeChild  = getChildIndex( node->X(), node->Y(), node->Z(), mid );
+-    int pointChild = getChildIndex( toPnt.X(), toPnt.Y(), toPnt.Z(), mid );
+-    if ( nodeChild != pointChild )
+-    {
+-      ((SMESH_OctreeNode*) myChildren[ nodeChild  ])->UpdateByMoveNode( node, toPnt );
+-      ((SMESH_OctreeNode*) myChildren[ pointChild ])->UpdateByMoveNode( node, toPnt );
+-    }
+-  }
+-}
+-
+-//================================================================================
+-/*!
+  * \brief Return iterator over children
+  */
+ //================================================================================
+@@ -419,7 +342,7 @@
+ {
+   return SMESH_OctreeNodeIteratorPtr
+     ( new SMDS_SetIterator< SMESH_OctreeNode*, SMESH_Octree** >
+-      ( myChildren, (( isLeaf() || !myChildren ) ? myChildren : &myChildren[ 8 ] )));
++      ( myChildren, ( isLeaf() ? myChildren : &myChildren[ 8 ] )));
+ }
+ 
+ //================================================================================
+@@ -431,5 +354,5 @@
+ {
+   return SMDS_NodeIteratorPtr
+     ( new SMDS_SetIterator< SMDS_pNode, set< SMDS_pNode >::const_iterator >
+-      ( myNodes.begin(), myNodes.size() ? myNodes.end() : myNodes.begin()));
++      ( myNodes.begin(), myNodes.end() ));
+ }
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_Pattern.cpp salomesmesh/src/SMESH/SMESH_Pattern.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_Pattern.cpp	2012-05-04 05:32:54.000000000 -0500
++++ salomesmesh/src/SMESH/SMESH_Pattern.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,11 @@
+ // Created   : Mon Aug  2 10:30:00 2004
+ // Author    : Edward AGAPOV (eap)
+ //
++#ifdef _MSC_VER
++#define _USE_MATH_DEFINES
++#endif // _MSC_VER
++#include <cmath>
++
+ #include "SMESH_Pattern.hxx"
+ 
+ #include <BRepAdaptor_Curve.hxx>
+@@ -39,6 +44,7 @@
+ #include <GeomAdaptor_Surface.hxx>
+ #include <Geom_Curve.hxx>
+ #include <Geom_Surface.hxx>
++#include <Standard_Version.hxx>
+ #include <TopAbs_ShapeEnum.hxx>
+ #include <TopExp.hxx>
+ #include <TopExp_Explorer.hxx>
+@@ -74,6 +80,10 @@
+ 
+ #include "utilities.h"
+ 
++#ifndef PI
++#define PI M_PI
++#endif
++
+ using namespace std;
+ 
+ typedef map< const SMDS_MeshElement*, int > TNodePointIDMap;
+@@ -436,8 +446,13 @@
+   }
+   double u, v, minVal = DBL_MAX;
+   for ( int i = theProjectorPS.NbExt(); i > 0; i-- )
+-    if ( theProjectorPS.SquareDistance( i ) < minVal ) {
++#if OCC_VERSION_HEX >= 0x060500
++      if ( theProjectorPS.SquareDistance( i ) < minVal ) {
+       minVal = theProjectorPS.SquareDistance( i );
++#else
++      if ( theProjectorPS.Value( i ) < minVal ) {
++      minVal = theProjectorPS.Value( i );
++#endif
+       theProjectorPS.Point( i ).Parameter( u, v );
+     }
+   return gp_XY( u, v );
+@@ -1228,7 +1243,7 @@
+         maxLen2 = Max( maxLen2, ( n[1]->myUV - n[2]->myUV ).SquareModulus() );
+       }
+       maxLen2 = Max( maxLen2, ( n[2]->myUV - node->myUV ).SquareModulus() );
+-      minDiag = sqrt( maxLen2 ) * M_PI / 60.; // ~ maxLen * Sin( 3 deg )
++      minDiag = sqrt( maxLen2 ) * PI / 60.; // ~ maxLen * Sin( 3 deg )
+     }
+ 
+     // check if newUV is behind 3 dirs: n[0]-n[1], n[1]-n[2] and n[0]-n[2]
+@@ -1779,7 +1794,7 @@
+     double initAngle = initTgt1.Angle( initTgt2 );
+     double angle = node->myDir[0].Angle( node->myDir[1] );
+     if ( reversed ) angle = -angle;
+-    if ( initAngle > angle && initAngle - angle > M_PI / 2.1 ) {
++    if ( initAngle > angle && initAngle - angle > PI / 2.1 ) {
+       // find a close internal node
+       TIsoNode* nClose = 0;
+       list< TIsoNode* > testNodes;
+diff -Naur smesh-5.1.2.2.svn55/src/SMESH/SMESH_subMesh.cpp salomesmesh/src/SMESH/SMESH_subMesh.cpp
+--- smesh-5.1.2.2.svn55/src/SMESH/SMESH_subMesh.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESH/SMESH_subMesh.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -35,10 +35,9 @@
+ #include "SMESH_subMeshEventListener.hxx"
+ #include "SMESH_Comment.hxx"
+ #include "SMDS_SetIterator.hxx"
+-#include "SMDSAbs_ElementType.hxx"
+ 
+ #include "utilities.h"
+-#include "OpUtil.hxx"
++//#include "OpUtil.hxx"
+ 
+ #include <BRep_Builder.hxx>
+ #include <BRep_Tool.hxx>
+@@ -82,22 +81,22 @@
+                              SMESHDS_Mesh *       meshDS,
+                              const TopoDS_Shape & aSubShape)
+ {
+-        _subShape = aSubShape;
+-        _subMeshDS = meshDS->MeshElements(_subShape);   // may be null ...
+-        _father = father;
+-        _Id = Id;
+-        _dependenceAnalysed = _alwaysComputed = false;
+-
+-        if (_subShape.ShapeType() == TopAbs_VERTEX)
+-        {
+-                _algoState = HYP_OK;
+-                _computeState = READY_TO_COMPUTE;
+-        }
+-        else
+-        {
++	_subShape = aSubShape;
++	_subMeshDS = meshDS->MeshElements(_subShape);	// may be null ...
++	_father = father;
++	_Id = Id;
++	_dependenceAnalysed = _alwaysComputed = false;
++
++	if (_subShape.ShapeType() == TopAbs_VERTEX)
++	{
++		_algoState = HYP_OK;
++		_computeState = READY_TO_COMPUTE;
++	}
++	else
++	{
+           _algoState = NO_ALGO;
+           _computeState = NOT_READY;
+-        }
++	}
+ }
+ 
+ //=============================================================================
+@@ -108,7 +107,7 @@
+ 
+ SMESH_subMesh::~SMESH_subMesh()
+ {
+-  MESSAGE("SMESH_subMesh::~SMESH_subMesh");
++  //MESSAGE("SMESH_subMesh::~SMESH_subMesh");
+   // ****
+   DeleteOwnListeners();
+ }
+@@ -392,7 +391,7 @@
+     }
+   case TopAbs_COMPSOLID:
+     {
+-                //MESSAGE("compsolid");
++		//MESSAGE("compsolid");
+       for (TopExp_Explorer exp(_subShape, TopAbs_SOLID); exp.More();
+            exp.Next())
+       {
+@@ -448,7 +447,7 @@
+       for (TopExp_Explorer exp(_subShape, TopAbs_VERTEX); exp.More();
+            exp.Next())
+       {
+-                        InsertDependence(exp.Current());
++			InsertDependence(exp.Current());
+                       }
+       break;
+     }
+@@ -495,8 +494,8 @@
+ 
+ const TopoDS_Shape & SMESH_subMesh::GetSubShape() const
+ {
+-        //MESSAGE("SMESH_subMesh::GetSubShape");
+-        return _subShape;
++	//MESSAGE("SMESH_subMesh::GetSubShape");
++	return _subShape;
+ }
+ 
+ 
+@@ -947,12 +946,6 @@
+       break;
+     }
+     case REMOVE_FATHER_ALGO: {
+-      // IPAL21346. Edges not removed when Netgen 1d-2d is removed from a SOLID.
+-      // CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID.
+-      algo = dynamic_cast<SMESH_Algo*> (anHyp);
+-      if (!algo->NeedDescretBoundary())
+-        needFullClean = true;
+-
+       algo = gen->GetAlgo((*_father), _subShape);
+       if (algo == NULL)  // no more applying algo on father
+       {
+@@ -1148,48 +1141,48 @@
+ 
+ void SMESH_subMesh::DumpAlgoState(bool isMain)
+ {
+-        int dim = SMESH_Gen::GetShapeDim(_subShape);
++	int dim = SMESH_Gen::GetShapeDim(_subShape);
+ //   if (dim < 1) return;
+-        if (isMain)
+-        {
+-                const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
+-
+-                map < int, SMESH_subMesh * >::const_iterator itsub;
+-                for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
+-                {
+-                        SMESH_subMesh *sm = (*itsub).second;
+-                        sm->DumpAlgoState(false);
+-                }
+-        }
+-        int type = _subShape.ShapeType();
+-        MESSAGE("dim = " << dim << " type of shape " << type);
+-        switch (_algoState)
+-        {
+-        case NO_ALGO:
+-                MESSAGE(" AlgoState = NO_ALGO");
+-                break;
+-        case MISSING_HYP:
+-                MESSAGE(" AlgoState = MISSING_HYP");
+-                break;
+-        case HYP_OK:
+-                MESSAGE(" AlgoState = HYP_OK");
+-                break;
+-        }
+-        switch (_computeState)
+-        {
+-        case NOT_READY:
+-                MESSAGE(" ComputeState = NOT_READY");
+-                break;
+-        case READY_TO_COMPUTE:
+-                MESSAGE(" ComputeState = READY_TO_COMPUTE");
+-                break;
+-        case COMPUTE_OK:
+-                MESSAGE(" ComputeState = COMPUTE_OK");
+-                break;
+-        case FAILED_TO_COMPUTE:
+-                MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
+-                break;
+-        }
++	if (isMain)
++	{
++		const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
++
++		map < int, SMESH_subMesh * >::const_iterator itsub;
++		for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
++		{
++			SMESH_subMesh *sm = (*itsub).second;
++			sm->DumpAlgoState(false);
++		}
++	}
++	int type = _subShape.ShapeType();
++	MESSAGE("dim = " << dim << " type of shape " << type);
++	switch (_algoState)
++	{
++	case NO_ALGO:
++		MESSAGE(" AlgoState = NO_ALGO");
++		break;
++	case MISSING_HYP:
++		MESSAGE(" AlgoState = MISSING_HYP");
++		break;
++	case HYP_OK:
++		MESSAGE(" AlgoState = HYP_OK");
++		break;
++	}
++	switch (_computeState)
++	{
++	case NOT_READY:
++		MESSAGE(" ComputeState = NOT_READY");
++		break;
++	case READY_TO_COMPUTE:
++		MESSAGE(" ComputeState = READY_TO_COMPUTE");
++		break;
++	case COMPUTE_OK:
++		MESSAGE(" ComputeState = COMPUTE_OK");
++		break;
++	case FAILED_TO_COMPUTE:
++		MESSAGE(" ComputeState = FAILED_TO_COMPUTE");
++		break;
++	}
+ }
+ 
+ //================================================================================
+@@ -1284,13 +1277,13 @@
+       if ( _algoState == HYP_OK )
+         _computeState = READY_TO_COMPUTE;
+       break;
+-    case COMPUTE:               // nothing to do
++    case COMPUTE:		// nothing to do
+       break;
+     case CLEAN:
+       CleanDependants();
+       RemoveSubMeshElementsAndNodes();
+       break;
+-    case SUBMESH_COMPUTED:      // nothing to do
++    case SUBMESH_COMPUTED:	// nothing to do
+       break;
+     case SUBMESH_RESTORED:
+       ComputeSubMeshStateEngine( SUBMESH_RESTORED );
+@@ -1409,7 +1402,7 @@
+             _computeError->myComment += ex.GetMessageString();
+           }
+         }
+-        catch ( SALOME_Exception& S_ex ) {
++        catch ( SMESH_Exception& S_ex ) {
+           if ( !_computeError ) _computeError = SMESH_ComputeError::New();
+           _computeError->myName    = COMPERR_SLM_EXCEPTION;
+           _computeError->myComment = S_ex.what();
+@@ -1584,48 +1577,6 @@
+   return ret;
+ }
+ 
+-
+-//=============================================================================
+-/*!
+- *
+- */
+-//=============================================================================
+-
+-bool SMESH_subMesh::Evaluate(MapShapeNbElems& aResMap)
+-{
+-  _computeError.reset();
+-
+-  bool ret = true;
+-
+-  if (_subShape.ShapeType() == TopAbs_VERTEX) {
+-    std::vector<int> aVec(SMDSEntity_Last);
+-    for(int i= SMDSEntity_Node; i < SMDSEntity_Last; i++)
+-      aVec[i] = 0;
+-    aVec[SMDSEntity_Node] = 1;
+-    aResMap.insert(std::make_pair(this,aVec));
+-    return ret;
+-  }
+-
+-  SMESH_Gen *gen = _father->GetGen();
+-  SMESH_Algo *algo = 0;
+-  SMESH_Hypothesis::Hypothesis_Status hyp_status;
+-
+-  algo = gen->GetAlgo((*_father), _subShape);
+-  if(algo) {
+-    ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
+-    if (!ret) return false;
+-
+-    TopoDS_Shape shape = _subShape;
+-
+-    _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo);
+-
+-    ret = algo->Evaluate((*_father), shape, aResMap);
+-  }
+-
+-  return ret;
+-}
+-
+-
+ //=======================================================================
+ /*!
+  * \brief Update compute_state by _computeError and send proper events to
+diff -Naur smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Command.cpp salomesmesh/src/SMESHDS/SMESHDS_Command.cpp
+--- smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Command.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESHDS/SMESHDS_Command.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -88,22 +88,6 @@
+ //function : 
+ //purpose  : 
+ //=======================================================================
+-void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode)
+-{
+-  if (!myType == SMESHDS_Add0DElement)
+-  {
+-    MESSAGE("SMESHDS_Command::Add0DElement : Bad Type");
+-    return;
+-  }
+-  myIntegers.push_back(New0DElementID);
+-  myIntegers.push_back(idnode);
+-  myNumber++;
+-}
+-
+-//=======================================================================
+-//function : 
+-//purpose  : 
+-//=======================================================================
+ void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
+ {
+ 	if (!myType == SMESHDS_AddEdge)
+diff -Naur smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_GroupBase.cpp salomesmesh/src/SMESHDS/SMESHDS_GroupBase.cpp
+--- smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_GroupBase.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESHDS/SMESHDS_GroupBase.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes
+ //  File   : SMESHDS_Group.cxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_GroupBase.cxx,v 1.7.2.5 2008/11/27 12:31:37 abd Exp $
+ //
+ #include "SMESHDS_GroupBase.hxx"
+ #include "SMESHDS_Mesh.hxx"
+diff -Naur smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Group.cpp salomesmesh/src/SMESHDS/SMESHDS_Group.cpp
+--- smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Group.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESHDS/SMESHDS_Group.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESHDS : idl implementation based on 'SMESH' unit's classes
+ //  File   : SMESHDS_Group.cxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Group.cxx,v 1.9.2.1 2008/11/27 12:31:37 abd Exp $
+ //
+ #include "SMESHDS_Group.hxx"
+ #include "SMESHDS_Mesh.hxx"
+diff -Naur smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_GroupOnGeom.cpp salomesmesh/src/SMESHDS/SMESHDS_GroupOnGeom.cpp
+--- smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_GroupOnGeom.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESHDS/SMESHDS_GroupOnGeom.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -75,24 +75,23 @@
+   }
+   bool more()
+   {
+-    if ( myType == SMDSAbs_Node && myNodeIt != NULL )
++	if ( myType == SMDSAbs_Node && (myNodeIt!=NULL) )
+       return myNodeIt->more();
+     return ( myElem != 0 );
+   }
+   const SMDS_MeshElement* next()
+   {
+-    if ( myType == SMDSAbs_Node && myNodeIt != NULL )
++	if ( myType == SMDSAbs_Node && (myNodeIt!=NULL) )
+       return myNodeIt->next();
+     const SMDS_MeshElement* res = myElem;
+     myElem = 0;
+-    while ( myElemIt != NULL && myElemIt->more() ) {
++    while ( (myElemIt!=NULL) && myElemIt->more() ) {
+       myElem = myElemIt->next();
+       if ( myElem && myElem->GetType() == myType )
+         break;
+       else
+         myElem = 0;
+     }
+-    return res;
+   }
+ };
+ 
+diff -Naur smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Hypothesis.cpp salomesmesh/src/SMESHDS/SMESHDS_Hypothesis.cpp
+--- smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Hypothesis.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESHDS/SMESHDS_Hypothesis.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESHDS_Hypothesis.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Hypothesis.cxx,v 1.10.2.1 2008/11/27 12:31:37 abd Exp $
+ //
+ #include "SMESHDS_Hypothesis.hxx"
+ 
+diff -Naur smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Mesh.cpp salomesmesh/src/SMESHDS/SMESHDS_Mesh.cpp
+--- smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Mesh.cpp	2011-09-27 03:33:02.000000000 -0500
++++ salomesmesh/src/SMESHDS/SMESHDS_Mesh.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -42,10 +42,10 @@
+ 
+ using namespace std;
+ 
+-Standard_Boolean IsEqual( const TopoDS_Shape& S1, const TopoDS_Shape& S2 )
+-{
+-  return S1.IsSame( S2 );
+-}
++/*Standard_Boolean IsEqual( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) 
++  {
++    return S1.IsSame( S2 );
++  }*/
+ 
+ //=======================================================================
+ //function : Create
+@@ -249,30 +249,6 @@
+ }
+ 
+ //=======================================================================
+-//function : Add0DElement
+-//purpose  :
+-//=======================================================================
+-SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID(int nodeID, int ID)
+-{
+-  SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElementWithID(nodeID, ID);
+-  if (anElem) myScript->Add0DElement(ID, nodeID);
+-  return anElem;
+-}
+-
+-SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID
+-                                  (const SMDS_MeshNode * node, int ID)
+-{
+-  return Add0DElementWithID(node->GetID(), ID);
+-}
+-
+-SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElement(const SMDS_MeshNode * node)
+-{
+-  SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElement(node);
+-  if (anElem) myScript->Add0DElement(anElem->GetID(), node->GetID());
+-  return anElem;
+-}
+-
+-//=======================================================================
+ //function :AddEdgeWithID
+ //purpose  : 
+ //=======================================================================
+@@ -284,21 +260,21 @@
+ }
+ 
+ SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2, 
+-                                           int ID)
++					   const SMDS_MeshNode * n2, 
++					   int ID)
+ {
+   return AddEdgeWithID(n1->GetID(),
+-                       n2->GetID(),
+-                       ID);
++		       n2->GetID(),
++		       ID);
+ }
+ 
+ SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2)
++				     const SMDS_MeshNode * n2)
+ {
+   SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2);
+   if(anElem) myScript->AddEdge(anElem->GetID(), 
+-                               n1->GetID(), 
+-                               n2->GetID());
++			       n1->GetID(), 
++			       n2->GetID());
+   return anElem;
+ }
+ 
+@@ -314,25 +290,25 @@
+ }
+ 
+ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3, 
+-                                           int ID)
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3, 
++					   int ID)
+ {
+   return AddFaceWithID(n1->GetID(),
+-                       n2->GetID(),
+-                       n3->GetID(),
+-                       ID);
++		       n2->GetID(),
++		       n3->GetID(),
++		       ID);
+ }
+ 
+ SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1,
+-                                      const SMDS_MeshNode * n2,
+-                                      const SMDS_MeshNode * n3)
++				      const SMDS_MeshNode * n2,
++				      const SMDS_MeshNode * n3)
+ {
+   SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3);
+   if(anElem) myScript->AddFace(anElem->GetID(), 
+-                               n1->GetID(), 
+-                               n2->GetID(),
+-                               n3->GetID());
++			       n1->GetID(), 
++			       n2->GetID(),
++			       n3->GetID());
+   return anElem;
+ }
+ 
+@@ -348,29 +324,29 @@
+ }
+ 
+ SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4, 
+-                                           int ID)
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4, 
++					   int ID)
+ {
+   return AddFaceWithID(n1->GetID(),
+-                       n2->GetID(),
+-                       n3->GetID(),
+-                       n4->GetID(),
+-                       ID);
++		       n2->GetID(),
++		       n3->GetID(),
++		       n4->GetID(),
++		       ID);
+ }
+ 
+ SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4)
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4)
+ {
+   SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3, n4);
+   if(anElem) myScript->AddFace(anElem->GetID(), 
+-                               n1->GetID(), 
+-                               n2->GetID(), 
+-                               n3->GetID(),
+-                               n4->GetID());
++			       n1->GetID(), 
++			       n2->GetID(), 
++			       n3->GetID(),
++			       n4->GetID());
+   return anElem;
+ }
+ 
+@@ -386,29 +362,29 @@
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                               const SMDS_MeshNode * n2,
+-                                               const SMDS_MeshNode * n3,
+-                                               const SMDS_MeshNode * n4, 
+-                                               int ID)
++					       const SMDS_MeshNode * n2,
++					       const SMDS_MeshNode * n3,
++					       const SMDS_MeshNode * n4, 
++					       int ID)
+ {
+   return AddVolumeWithID(n1->GetID(), 
+-                         n2->GetID(), 
+-                         n3->GetID(),
+-                         n4->GetID(),
+-                         ID);
++			 n2->GetID(), 
++			 n3->GetID(),
++			 n4->GetID(),
++			 ID);
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                         const SMDS_MeshNode * n2,
+-                                         const SMDS_MeshNode * n3,
+-                                         const SMDS_MeshNode * n4)
++					 const SMDS_MeshNode * n2,
++					 const SMDS_MeshNode * n3,
++					 const SMDS_MeshNode * n4)
+ {
+   SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4);
+   if(anElem) myScript->AddVolume(anElem->GetID(), 
+-                                 n1->GetID(), 
+-                                 n2->GetID(), 
+-                                 n3->GetID(),
+-                                 n4->GetID());
++				 n1->GetID(), 
++				 n2->GetID(), 
++				 n3->GetID(),
++				 n4->GetID());
+   return anElem;
+ }
+ 
+@@ -424,33 +400,33 @@
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                               const SMDS_MeshNode * n2,
+-                                               const SMDS_MeshNode * n3,
+-                                               const SMDS_MeshNode * n4,
+-                                               const SMDS_MeshNode * n5, 
+-                                               int ID)
++					       const SMDS_MeshNode * n2,
++					       const SMDS_MeshNode * n3,
++					       const SMDS_MeshNode * n4,
++					       const SMDS_MeshNode * n5, 
++					       int ID)
+ {
+   return AddVolumeWithID(n1->GetID(), 
+-                         n2->GetID(), 
+-                         n3->GetID(),
+-                         n4->GetID(), 
+-                         n5->GetID(),
+-                         ID);
++			 n2->GetID(), 
++			 n3->GetID(),
++			 n4->GetID(), 
++			 n5->GetID(),
++			 ID);
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                         const SMDS_MeshNode * n2,
+-                                         const SMDS_MeshNode * n3,
+-                                         const SMDS_MeshNode * n4,
+-                                         const SMDS_MeshNode * n5)
++					 const SMDS_MeshNode * n2,
++					 const SMDS_MeshNode * n3,
++					 const SMDS_MeshNode * n4,
++					 const SMDS_MeshNode * n5)
+ {
+   SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5);
+   if(anElem) myScript->AddVolume(anElem->GetID(), 
+-                                 n1->GetID(), 
+-                                 n2->GetID(), 
+-                                 n3->GetID(),
+-                                 n4->GetID(), 
+-                                 n5->GetID());
++				 n1->GetID(), 
++				 n2->GetID(), 
++				 n3->GetID(),
++				 n4->GetID(), 
++				 n5->GetID());
+   return anElem;
+ }
+ 
+@@ -466,37 +442,37 @@
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                               const SMDS_MeshNode * n2,
+-                                               const SMDS_MeshNode * n3,
+-                                               const SMDS_MeshNode * n4,
+-                                               const SMDS_MeshNode * n5,
+-                                               const SMDS_MeshNode * n6, 
+-                                               int ID)
++					       const SMDS_MeshNode * n2,
++					       const SMDS_MeshNode * n3,
++					       const SMDS_MeshNode * n4,
++					       const SMDS_MeshNode * n5,
++					       const SMDS_MeshNode * n6, 
++					       int ID)
+ {
+   return AddVolumeWithID(n1->GetID(), 
+-                         n2->GetID(), 
+-                         n3->GetID(),
+-                         n4->GetID(), 
+-                         n5->GetID(), 
+-                         n6->GetID(),
+-                         ID);
++			 n2->GetID(), 
++			 n3->GetID(),
++			 n4->GetID(), 
++			 n5->GetID(), 
++			 n6->GetID(),
++			 ID);
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                         const SMDS_MeshNode * n2,
+-                                         const SMDS_MeshNode * n3,
+-                                         const SMDS_MeshNode * n4,
+-                                         const SMDS_MeshNode * n5,
+-                                         const SMDS_MeshNode * n6)
++					 const SMDS_MeshNode * n2,
++					 const SMDS_MeshNode * n3,
++					 const SMDS_MeshNode * n4,
++					 const SMDS_MeshNode * n5,
++					 const SMDS_MeshNode * n6)
+ {
+   SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6);
+   if(anElem) myScript->AddVolume(anElem->GetID(), 
+-                                 n1->GetID(), 
+-                                 n2->GetID(), 
+-                                 n3->GetID(),
+-                                 n4->GetID(), 
+-                                 n5->GetID(), 
+-                                 n6->GetID());
++				 n1->GetID(), 
++				 n2->GetID(), 
++				 n3->GetID(),
++				 n4->GetID(), 
++				 n5->GetID(), 
++				 n6->GetID());
+   return anElem;
+ }
+ 
+@@ -512,45 +488,45 @@
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                               const SMDS_MeshNode * n2,
+-                                               const SMDS_MeshNode * n3,
+-                                               const SMDS_MeshNode * n4,
+-                                               const SMDS_MeshNode * n5,
+-                                               const SMDS_MeshNode * n6,
+-                                               const SMDS_MeshNode * n7,
+-                                               const SMDS_MeshNode * n8, 
+-                                               int ID)
++					       const SMDS_MeshNode * n2,
++					       const SMDS_MeshNode * n3,
++					       const SMDS_MeshNode * n4,
++					       const SMDS_MeshNode * n5,
++					       const SMDS_MeshNode * n6,
++					       const SMDS_MeshNode * n7,
++					       const SMDS_MeshNode * n8, 
++					       int ID)
+ {
+   return AddVolumeWithID(n1->GetID(), 
+-                         n2->GetID(), 
+-                         n3->GetID(),
+-                         n4->GetID(), 
+-                         n5->GetID(), 
+-                         n6->GetID(), 
+-                         n7->GetID(), 
+-                         n8->GetID(),
+-                         ID);
++			 n2->GetID(), 
++			 n3->GetID(),
++			 n4->GetID(), 
++			 n5->GetID(), 
++			 n6->GetID(), 
++			 n7->GetID(), 
++			 n8->GetID(),
++			 ID);
+ }
+ 
+ SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
+-                                         const SMDS_MeshNode * n2,
+-                                         const SMDS_MeshNode * n3,
+-                                         const SMDS_MeshNode * n4,
+-                                         const SMDS_MeshNode * n5,
+-                                         const SMDS_MeshNode * n6,
+-                                         const SMDS_MeshNode * n7,
+-                                         const SMDS_MeshNode * n8)
++					 const SMDS_MeshNode * n2,
++					 const SMDS_MeshNode * n3,
++					 const SMDS_MeshNode * n4,
++					 const SMDS_MeshNode * n5,
++					 const SMDS_MeshNode * n6,
++					 const SMDS_MeshNode * n7,
++					 const SMDS_MeshNode * n8)
+ {
+   SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
+   if(anElem) myScript->AddVolume(anElem->GetID(), 
+-                                 n1->GetID(), 
+-                                 n2->GetID(), 
+-                                 n3->GetID(),
+-                                 n4->GetID(), 
+-                                 n5->GetID(), 
+-                                 n6->GetID(), 
+-                                 n7->GetID(), 
+-                                 n8->GetID());
++				 n1->GetID(), 
++				 n2->GetID(), 
++				 n3->GetID(),
++				 n4->GetID(), 
++				 n5->GetID(), 
++				 n6->GetID(), 
++				 n7->GetID(), 
++				 n8->GetID());
+   return anElem;
+ }
+ 
+@@ -1018,7 +994,7 @@
+ //=======================================================================
+ void SMESHDS_Mesh::UnSetNodeOnShape(const SMDS_MeshNode* aNode)
+ {
+-  if ( aNode != NULL && aNode->GetPosition() != NULL ) {
++  if ( (aNode!=NULL) && (aNode->GetPosition()!=NULL) ) {
+     map<int,SMESHDS_SubMesh*>::iterator it =
+       myShapeIndexToSubMesh.find( aNode->GetPosition()->GetShapeId() );
+     if ( it != myShapeIndexToSubMesh.end() )
+@@ -1059,7 +1035,7 @@
+ //=======================================================================
+ TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
+ {
+-        return myShape;
++	return myShape;
+ }
+ 
+ //=======================================================================
+@@ -1143,7 +1119,7 @@
+ //=======================================================================
+ SMESHDS_Script* SMESHDS_Mesh::GetScript()
+ {
+-        return myScript;
++	return myScript;
+ }
+ 
+ //=======================================================================
+@@ -1152,7 +1128,7 @@
+ //=======================================================================
+ void SMESHDS_Mesh::ClearScript()
+ {
+-        myScript->Clear();
++	myScript->Clear();
+ }
+ 
+ //=======================================================================
+@@ -1161,9 +1137,9 @@
+ //=======================================================================
+ bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S)
+ {
+-        if (myShape.IsNull()) MESSAGE("myShape is NULL");
+-        int Index = myIndexToShape.FindIndex(S);
+-        return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
++	if (myShape.IsNull()) MESSAGE("myShape is NULL");
++	int Index = myIndexToShape.FindIndex(S);
++	return myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end();
+ }
+ 
+ //=======================================================================
+@@ -1235,7 +1211,7 @@
+ //=======================================================================
+ const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const
+ {
+-        return myIndexToShape.FindKey(ShapeIndex);
++	return myIndexToShape.FindKey(ShapeIndex);
+ }
+ 
+ //=======================================================================
+@@ -1351,8 +1327,8 @@
+ {
+   SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2,n12);
+   if(anElem) myScript->AddEdge(anElem->GetID(), 
+-                               n1->GetID(), 
+-                               n2->GetID(),
++			       n1->GetID(), 
++			       n2->GetID(),
+                                n12->GetID());
+   return anElem;
+ }
+@@ -1367,9 +1343,9 @@
+                                            int ID)
+ {
+   return AddEdgeWithID(n1->GetID(),
+-                       n2->GetID(),
++		       n2->GetID(),
+                        n12->GetID(),
+-                       ID);
++		       ID);
+ }
+ 
+ 
+@@ -1386,7 +1362,7 @@
+ {
+   SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n12,n23,n31);
+   if(anElem) myScript->AddFace(anElem->GetID(), 
+-                               n1->GetID(), n2->GetID(), n3->GetID(),
++			       n1->GetID(), n2->GetID(), n3->GetID(),
+                                n12->GetID(), n23->GetID(), n31->GetID());
+   return anElem;
+ }
+@@ -1417,7 +1393,7 @@
+ {
+   return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(),
+                        n12->GetID(), n23->GetID(), n31->GetID(),
+-                       ID);
++		       ID);
+ }
+ 
+ 
+@@ -1436,7 +1412,7 @@
+ {
+   SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n4,n12,n23,n34,n41);
+   if(anElem) myScript->AddFace(anElem->GetID(), 
+-                               n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
++			       n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
+                                n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID());
+   return anElem;
+ }
+@@ -1469,7 +1445,7 @@
+ {
+   return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
+                        n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
+-                       ID);
++		       ID);
+ }
+ 
+ 
+@@ -1490,8 +1466,8 @@
+ {
+   SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
+   if(anElem) myScript->AddVolume(anElem->GetID(), 
+-                                 n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
+-                                 n12->GetID(), n23->GetID(), n31->GetID(),
++				 n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
++				 n12->GetID(), n23->GetID(), n31->GetID(),
+                                  n14->GetID(), n24->GetID(), n34->GetID());
+   return anElem;
+ }
+@@ -1509,7 +1485,7 @@
+   if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
+   return anElem;
+ }
+-        
++	
+ //=======================================================================
+ //function : AddVolumeWithID
+ //purpose  : 2d order tetrahedron of 10 nodes
+@@ -1575,7 +1551,7 @@
+                                  n15,n25,n35,n45);
+   return anElem;
+ }
+-        
++	
+ //=======================================================================
+ //function : AddVolumeWithID
+ //purpose  : 2d order pyramid of 13 nodes
+@@ -1652,7 +1628,7 @@
+                                  n45,n56,n64,n14,n25,n36);
+   return anElem;
+ }
+-        
++	
+ //=======================================================================
+ //function : AddVolumeWithID
+ //purpose  : 2d order Pentahedron with 15 nodes
+@@ -1740,7 +1716,7 @@
+                                  n56,n67,n78,n85,n15,n26,n37,n48);
+   return anElem;
+ }
+-        
++	
+ //=======================================================================
+ //function : AddVolumeWithID
+ //purpose  : 2d order Hexahedrons with 20 nodes
+diff -Naur smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Script.cpp salomesmesh/src/SMESHDS/SMESHDS_Script.cpp
+--- smesh-5.1.2.2.svn55/src/SMESHDS/SMESHDS_Script.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/SMESHDS/SMESHDS_Script.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -96,19 +96,6 @@
+ }
+ 
+ //=======================================================================
+-//function :
+-//purpose  :
+-//=======================================================================
+-void SMESHDS_Script::Add0DElement (int New0DElementID, int idnode)
+-{
+-  if (myIsEmbeddedMode) {
+-    myIsModified = true;
+-    return;
+-  }
+-  getCommand(SMESHDS_Add0DElement)->Add0DElement(New0DElementID, idnode);
+-}
+-
+-//=======================================================================
+ //function : 
+ //purpose  : 
+ //=======================================================================
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Arithmetic1D.cpp salomesmesh/src/StdMeshers/StdMeshers_Arithmetic1D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Arithmetic1D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Arithmetic1D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_Arithmetic1D.cxx
+ //  Author : Damien COQUERET, OCC
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Arithmetic1D.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_Arithmetic1D.hxx"
+ 
+@@ -73,11 +74,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_Arithmetic1D::SetLength(double length, bool isStartLength)
+-     throw(SALOME_Exception)
++     throw(SMESH_Exception)
+ {
+   if ( (isStartLength ? _begLength : _endLength) != length ) {
+     if (length <= 0)
+-      throw SALOME_Exception(LOCALIZED("length must be positive"));
++      throw SMESH_Exception(LOCALIZED("length must be positive"));
+     if ( isStartLength )
+       _begLength = length;
+     else
+@@ -104,32 +105,9 @@
+  */
+ //=============================================================================
+ 
+-void StdMeshers_Arithmetic1D::SetReversedEdges( std::vector<int>& ids )
+-{
+-  if ( ids != _edgeIDs ) {
+-    _edgeIDs = ids;
+-
+-    NotifySubMeshesHypothesisModification();
+-  }
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+ ostream & StdMeshers_Arithmetic1D::SaveTo(ostream & save)
+ {
+-  int listSize = _edgeIDs.size();
+-  save << _begLength << " " << _endLength << " " << listSize;
+-
+-  if ( listSize > 0 ) {
+-    for ( int i = 0; i < listSize; i++)
+-      save << " " << _edgeIDs[i];
+-    save << " " << _objEntry;
+-  }
+-
++  save << _begLength << " " << _endLength;
+   return save;
+ }
+ 
+@@ -142,25 +120,12 @@
+ istream & StdMeshers_Arithmetic1D::LoadFrom(istream & load)
+ {
+   bool isOK = true;
+-  int intVal;
+   isOK = (load >> _begLength);
+   if (!isOK)
+     load.clear(ios::badbit | load.rdstate());
+   isOK = (load >> _endLength);
+-
+   if (!isOK)
+     load.clear(ios::badbit | load.rdstate());
+-
+-  isOK = (load >> intVal);
+-  if (isOK && intVal > 0) {
+-    _edgeIDs.reserve( intVal );
+-    for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+-      isOK = (load >> intVal);
+-      if ( isOK ) _edgeIDs.push_back( intVal );
+-    }
+-    isOK = (load >> _objEntry);
+-  }
+-
+   return load;
+ }
+ 
+@@ -244,4 +209,3 @@
+ {
+   return ( _begLength = _endLength = dflts._elemLength );
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_AutomaticLength.cpp salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_AutomaticLength.cpp	2012-05-04 05:32:54.000000000 -0500
++++ salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,13 @@
+ //  File   : StdMeshers_AutomaticLength.cxx
+ //  Author : Edward AGAPOV, OCC
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_AutomaticLength.cxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $
+ //
++#ifdef _MSC_VER
++#define _USE_MATH_DEFINES
++#endif // _MSC_VER
++#include <cmath>
++
+ #include "StdMeshers_AutomaticLength.hxx"
+ 
+ #include "SMESH_Mesh.hxx"
+@@ -38,6 +44,10 @@
+ #include <TopoDS.hxx>
+ #include <TopoDS_Edge.hxx>
+ 
++#ifndef PI
++#define PI M_PI
++#endif
++
+ using namespace std;
+ 
+ //=============================================================================
+@@ -83,10 +93,10 @@
+ const double theFineConst   = 4.5;
+ 
+ void StdMeshers_AutomaticLength::SetFineness(double theFineness)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if ( theFineness < 0.0 || theFineness > 1.0 )
+-    throw SALOME_Exception(LOCALIZED("theFineness is out of range [0.0-1.0]"));
++    throw SMESH_Exception(LOCALIZED("theFineness is out of range [0.0-1.0]"));
+ 
+   if ( _fineness != theFineness )
+   {
+@@ -116,7 +126,7 @@
+    */
+   //================================================================================
+ 
+-  const double a14divPI = 14. / M_PI;
++  const double a14divPI = 14. / PI;
+ 
+   inline double segLength(double S0, double edgeLen, double minLen )
+   {
+@@ -210,9 +220,9 @@
+ 
+ double StdMeshers_AutomaticLength::GetLength(const SMESH_Mesh* theMesh,
+                                              const double      theEdgeLength)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  if ( !theMesh ) throw SALOME_Exception(LOCALIZED("NULL Mesh"));
++  if ( !theMesh ) throw SMESH_Exception(LOCALIZED("NULL Mesh"));
+ 
+   SMESHDS_Mesh* aMeshDS = const_cast< SMESH_Mesh* > ( theMesh )->GetMeshDS();
+   if ( theMesh != _mesh )
+@@ -232,12 +242,12 @@
+ 
+ double StdMeshers_AutomaticLength::GetLength(const SMESH_Mesh*   theMesh,
+                                              const TopoDS_Shape& anEdge)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+-  if ( !theMesh ) throw SALOME_Exception(LOCALIZED("NULL Mesh"));
++  if ( !theMesh ) throw SMESH_Exception(LOCALIZED("NULL Mesh"));
+ 
+   if ( anEdge.IsNull() || anEdge.ShapeType() != TopAbs_EDGE )
+-    throw SALOME_Exception(LOCALIZED("Bad edge shape"));
++    throw SMESH_Exception(LOCALIZED("Bad edge shape"));
+ 
+   if ( theMesh != _mesh )
+   {
+@@ -398,5 +408,3 @@
+ 
+ //   return true;
+ }
+-
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp	2012-05-04 05:32:54.000000000 -0500
++++ salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,10 @@
+ // Module    : SMESH
+ // Created   : Tue Nov 25 11:04:59 2008
+ // Author    : Edward AGAPOV (eap)
++#ifdef _MSC_VER
++#define _USE_MATH_DEFINES
++#endif // _MSC_VER
++#include <cmath>
+ 
+ #include "StdMeshers_CompositeHexa_3D.hxx"
+ 
+@@ -43,7 +47,6 @@
+ #include <TopExp_Explorer.hxx>
+ #include <TopTools_MapIteratorOfMapOfShape.hxx>
+ #include <TopTools_MapOfShape.hxx>
+-#include <TopTools_SequenceOfShape.hxx>
+ #include <TopoDS.hxx>
+ #include <TopoDS_Edge.hxx>
+ #include <TopoDS_Face.hxx>
+@@ -57,6 +60,10 @@
+ #include <set>
+ #include <vector>
+ 
++#ifndef PI
++#define PI M_PI
++#endif
++
+ 
+ #ifdef _DEBUG_
+ 
+@@ -151,7 +158,6 @@
+   #else
+   typedef list< _QuadFaceGrid > TChildren;
+   #endif
+-
+ public:
+   _QuadFaceGrid();
+ 
+@@ -263,7 +269,7 @@
+   :SMESH_3D_Algo(hypId, studyId, gen)
+ {
+   _name = "CompositeHexa_3D";
+-  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);       // 1 bit /shape type
++  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);	// 1 bit /shape type
+ }
+ 
+ //================================================================================
+@@ -519,213 +525,6 @@
+   return true;
+ }
+ 
+-
+-//=======================================================================
+-//function : GetNb2d
+-//purpose  : auxilary for Evaluate
+-//=======================================================================
+-int GetNb2d(_QuadFaceGrid* QFG, SMESH_Mesh& theMesh,
+-            MapShapeNbElems& aResMap)
+-{
+-  int nb2d = 0;
+-  _QuadFaceGrid::TChildIterator aCI = QFG->GetChildren();
+-  while( aCI.more() ) {
+-    const _QuadFaceGrid& currChild = aCI.next();
+-    SMESH_subMesh *sm = theMesh.GetSubMesh(currChild.GetFace());
+-    if( sm ) {
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      if( anIt == aResMap.end() ) continue;
+-      std::vector<int> aVec = (*anIt).second;
+-      nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-    }
+-  }
+-  return nb2d;
+-}
+-
+-
+-//================================================================================
+-/*!
+- *  Evaluate
+- */
+-//================================================================================
+-
+-bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh,
+-                                           const TopoDS_Shape& theShape,
+-                                           MapShapeNbElems& aResMap)
+-{
+-  SMESH_MesherHelper aTool(theMesh);
+-  bool _quadraticMesh = aTool.IsQuadraticSubMesh(theShape);
+-
+-
+-  // -------------------------
+-  // Try to find 6 side faces
+-  // -------------------------
+-  vector< _QuadFaceGrid > boxFaces; boxFaces.reserve( 6 );
+-  TopExp_Explorer exp;
+-  int iFace, nbFaces = 0;
+-  for ( exp.Init(theShape, TopAbs_FACE); exp.More(); exp.Next(), ++nbFaces )
+-  {
+-    _QuadFaceGrid f;
+-    if ( !f.Init( TopoDS::Face( exp.Current() )))
+-      //return error (COMPERR_BAD_SHAPE);
+-      return false;
+-    bool isContinuous = false;
+-    for ( int i=0; i < boxFaces.size() && !isContinuous; ++i )
+-      isContinuous = boxFaces[ i ].AddContinuousFace( f );
+-    if ( !isContinuous )
+-      boxFaces.push_back( f );
+-  }
+-  // Check what we have
+-  if ( boxFaces.size() != 6 && nbFaces != 6)
+-    //return error
+-    //  (COMPERR_BAD_SHAPE,
+-    //   SMESH_Comment("Can't find 6 sides of a box. Number of found sides - ")<<boxFaces.size());
+-    return false;
+-
+-  if ( boxFaces.size() != 6 && nbFaces == 6 ) { // strange ordinary box with continuous faces
+-    boxFaces.resize( 6 );
+-    iFace = 0;
+-    for ( exp.Init(theShape, TopAbs_FACE); exp.More(); exp.Next(), ++iFace )
+-      boxFaces[ iFace ].Init( TopoDS::Face( exp.Current() ) );
+-  }
+-
+-  // ----------------------------------------
+-  // Find out position of faces within a box
+-  // ----------------------------------------
+-
+-  _QuadFaceGrid *fBottom, *fTop, *fFront, *fBack, *fLeft, *fRight;
+-  // start from a bottom face
+-  fBottom = &boxFaces[0];
+-  // find vertical faces
+-  fFront = fBottom->FindAdjacentForSide( Q_BOTTOM, boxFaces );
+-  fLeft  = fBottom->FindAdjacentForSide( Q_RIGHT, boxFaces );
+-  fBack  = fBottom->FindAdjacentForSide( Q_TOP, boxFaces );
+-  fRight = fBottom->FindAdjacentForSide( Q_LEFT, boxFaces );
+-  // check the found
+-  if ( !fFront || !fBack || !fLeft || !fRight )
+-    //return error(COMPERR_BAD_SHAPE);
+-    return false;
+-  // top face
+-  fTop = 0;
+-  int i = 1;
+-  for(; i < boxFaces.size() && !fTop; ++i ) {
+-    fTop = & boxFaces[ i ];
+-    if ( fTop==fFront || fTop==fLeft || fTop==fBack || fTop==fRight )
+-      fTop = 0;
+-  }
+-  // set bottom of the top side
+-  if ( !fTop->SetBottomSide( fFront->GetSide( Q_TOP ) )) {
+-    if ( !fFront->IsComplex() )
+-      //return error( ERR_LI("Error in StdMeshers_CompositeHexa_3D::Compute()"));
+-      return false;
+-    else {
+-      _QuadFaceGrid::TChildIterator chIt = fFront->GetChildren();
+-      while ( chIt.more() ) {
+-        const _QuadFaceGrid& frontChild = chIt.next();
+-        if ( fTop->SetBottomSide( frontChild.GetSide( Q_TOP )))
+-          break;
+-      }
+-    }
+-  }
+-  if ( !fTop )
+-    //return error(COMPERR_BAD_SHAPE);
+-    return false;
+-
+-
+-  TopTools_SequenceOfShape BottomFaces;
+-  _QuadFaceGrid::TChildIterator aCI = fBottom->GetChildren();
+-  while( aCI.more() ) {
+-    const _QuadFaceGrid& currChild = aCI.next();
+-    BottomFaces.Append(currChild.GetFace());
+-  }
+-  // find boundary edges and internal nodes for bottom face
+-  TopTools_SequenceOfShape BndEdges;
+-  int nb0d_in = 0;
+-  //TopTools_MapOfShape BndEdges;
+-  for(i=1; i<=BottomFaces.Length(); i++) {
+-    for (TopExp_Explorer exp(BottomFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) {
+-      int nb0 = 0;
+-      SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current());
+-      if( sm ) {
+-        MapShapeNbElemsItr anIt = aResMap.find(sm);
+-        if( anIt == aResMap.end() ) continue;
+-        std::vector<int> aVec = (*anIt).second;
+-        nb0 = aVec[SMDSEntity_Node];
+-      }
+-      int j = 1;
+-      for(; j<=BndEdges.Length(); j++) {
+-        if( BndEdges.Value(j) == exp.Current() ) {
+-          // internal edge => remove it
+-          BndEdges.Remove(j);
+-          nb0d_in += nb0;
+-          break;
+-        }
+-      }
+-      if( j > BndEdges.Length() ) {
+-        BndEdges.Append(exp.Current());
+-      }
+-      //if( BndEdges.Contains(exp.Current()) ) {
+-      //BndEdges.Remove( exp.Current() );
+-      //}
+-      //else {
+-      //BndEdges.Add( exp.Current() );
+-      //}
+-    }
+-  }
+-
+-  // find number of 1d elems for bottom face
+-  int nb1d = 0;
+-  for(i=1; i<=BndEdges.Length(); i++) {
+-    SMESH_subMesh *sm = theMesh.GetSubMesh(BndEdges.Value(i));
+-    if( sm ) {
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      if( anIt == aResMap.end() ) continue;
+-      std::vector<int> aVec = (*anIt).second;
+-      nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-    }
+-  }
+-
+-  // find number of 2d elems on side faces
+-  int nb2d = 0;
+-  nb2d += GetNb2d(fFront, theMesh, aResMap);
+-  nb2d += GetNb2d(fRight, theMesh, aResMap);
+-  nb2d += GetNb2d(fBack, theMesh, aResMap);
+-  nb2d += GetNb2d(fLeft, theMesh, aResMap);
+-
+-  // find number of 2d elems and nodes on bottom faces
+-  int nb0d=0, nb2d_3=0, nb2d_4=0;
+-  for(i=1; i<=BottomFaces.Length(); i++) {
+-    SMESH_subMesh *sm = theMesh.GetSubMesh(BottomFaces.Value(i));
+-    if( sm ) {
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      if( anIt == aResMap.end() ) continue;
+-      std::vector<int> aVec = (*anIt).second;
+-      nb0d += aVec[SMDSEntity_Node];
+-      nb2d_3 += Max(aVec[SMDSEntity_Triangle],   aVec[SMDSEntity_Quad_Triangle]);
+-      nb2d_4 += Max(aVec[SMDSEntity_Quadrangle], aVec[SMDSEntity_Quad_Quadrangle]);
+-    }
+-  }
+-  nb0d += nb0d_in;
+-
+-  std::vector<int> aResVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-  if(_quadraticMesh) {
+-    aResVec[SMDSEntity_Quad_Penta] = nb2d_3 * ( nb2d/nb1d );
+-    aResVec[SMDSEntity_Quad_Hexa]  = nb2d_4 * ( nb2d/nb1d );
+-    aResVec[SMDSEntity_Node] = nb0d * ( 2*nb2d/nb1d - 1 );
+-  }
+-  else {
+-    aResVec[SMDSEntity_Node]  = nb0d * ( nb2d/nb1d - 1 );
+-    aResVec[SMDSEntity_Penta] = nb2d_3 * ( nb2d/nb1d );
+-    aResVec[SMDSEntity_Hexa]  = nb2d_4 * ( nb2d/nb1d );
+-  }
+-  SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
+-  aResMap.insert(std::make_pair(sm,aResVec));
+-
+-  return true;
+-}
+-
+-
+ //================================================================================
+ /*!
+  * \brief constructor of non-initialized _QuadFaceGrid
+@@ -812,7 +611,7 @@
+     int iMyCommon;
+     if ( mySides.Contain( otherSide, &iMyCommon ) ) {
+       // check if normals of two faces are collinear at all vertices of a otherSide
+-      const double angleTol = M_PI / 180 / 2;
++      const double angleTol = PI / 180 / 2;
+       int iV, nbV = otherSide.NbVertices(), nbCollinear = 0;
+       for ( iV = 0; iV < nbV; ++iV )
+       {
+@@ -1636,9 +1435,8 @@
+ void _FaceSide::SetBottomSide( int i )
+ {
+   if ( i > 0 && myID == Q_PARENT ) {
+-
++  
+     #ifdef __BORLANDC__
+-
+     list< _FaceSide > aList;
+     aList.clear();
+ 
+@@ -1662,15 +1460,13 @@
+     list< _FaceSide >::iterator sideEnd, side = myChildren.begin();
+     std::advance( side, i );
+     myChildren.splice( myChildren.begin(), myChildren, side, myChildren.end() );
+-
+     side = myChildren.begin(), sideEnd = myChildren.end();
+     for ( int i = 0; side != sideEnd; ++side, ++i ) {
+       side->SetID( EQuadSides(i) );
+       side->SetBottomSide(i);
+     }
+-
++    
+     #endif
+-
+   }
+ }
+ 
+@@ -1787,7 +1583,7 @@
+     #else
+     list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end();
+     #endif
+-    
++
+     for ( ; side != sideEnd; ++side ) {
+       side->Dump();
+       cout << "\t";
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp salomesmesh/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ //           Moved here from SMESH_Regular_1D.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #include "StdMeshers_CompositeSegment_1D.hxx"
+ #include "StdMeshers_FaceSide.hxx"
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Deflection1D.cpp salomesmesh/src/StdMeshers/StdMeshers_Deflection1D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Deflection1D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Deflection1D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,6 +22,7 @@
+ //  SMESH StdMeshers_Deflection1D : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_Deflection1D.cxx
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Deflection1D.cxx,v 1.7.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_Deflection1D.hxx"
+ #include "utilities.h"
+@@ -75,11 +76,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_Deflection1D::SetDeflection(double value)
+-     throw(SALOME_Exception)
++     throw(SMESH_Exception)
+ {
+   if (_value != value) {
+     if (value <= 0.)
+-      throw SALOME_Exception(LOCALIZED("Value must be positive"));
++      throw SMESH_Exception(LOCALIZED("Value must be positive"));
+ 
+     NotifySubMeshesHypothesisModification();
+ 
+@@ -233,3 +234,4 @@
+ {
+   return false;
+ }
++
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Distribution.cpp salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Distribution.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : StdMeshers_Distribution.cxx
+ //  Author : Alexandre SOLOVYOV
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Distribution.cxx,v 1.6.2.2 2008/11/27 13:03:50 abd Exp $
+ //
+ #include "StdMeshers_Distribution.hxx"
+ 
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_FaceSide.cpp salomesmesh/src/StdMeshers/StdMeshers_FaceSide.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_FaceSide.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_FaceSide.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -52,6 +52,8 @@
+ 
+ #include "utilities.h"
+ 
++using namespace std;
++
+ //================================================================================
+ /*!
+  * \brief Constructor of a side of one edge
+@@ -95,7 +97,6 @@
+   myMesh = theMesh;
+   myMissingVertexNodes = false;
+   myIgnoreMediumNodes = theIgnoreMediumNodes;
+-  myDefaultPnt2d = gp_Pnt2d( 1e+100, 1e+100 );
+   if ( nbEdges == 0 ) return;
+ 
+   SMESHDS_Mesh* meshDS = theMesh->GetMeshDS();
+@@ -158,34 +159,6 @@
+ 
+ //================================================================================
+ /*!
+- * \brief Constructor of a side for vertex using data from other FaceSide
+-  * \param theVertex - the vertex
+-  * \param theSide - the side
+- */
+-//================================================================================
+-
+-StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
+-                                         const gp_Pnt2d thePnt2d,
+-                                         const StdMeshers_FaceSide* theSide)
+-{
+-  myC2d.resize(1);
+-  myLength = 0;
+-  myMesh = theSide->GetMesh();
+-  myDefaultPnt2d = thePnt2d;
+-
+-  myPoints = theSide->GetUVPtStruct();
+-  myNbPonits = myNbSegments = myPoints.size();
+-  std::vector<uvPtStruct>::iterator it = myPoints.begin();
+-  for(; it!=myPoints.end(); it++) {
+-    (*it).u = thePnt2d.X();
+-    (*it).v = thePnt2d.Y();
+-    (*it).y = 0.0;
+-    (*it).node = theNode;
+-  }
+-}
+-
+-//================================================================================
+-/*!
+  * \brief Return info on nodes on the side
+   * \retval UVPtStruct* - array of data structures
+  */
+@@ -204,7 +177,8 @@
+ 
+     map< double, const SMDS_MeshNode*> u2node;
+     //int nbOnDegen = 0;
+-    for ( int i = 0; i < myEdge.size(); ++i ) {
++    for ( int i = 0; i < myEdge.size(); ++i )
++    {
+       // put 1st vertex node
+       TopoDS_Vertex VFirst, VLast;
+       TopExp::Vertices( myEdge[i], VFirst, VLast, true);
+@@ -212,8 +186,7 @@
+       double prevNormPar = ( i == 0 ? 0 : myNormPar[ i-1 ]); // normalized param
+       if ( node ) { // internal nodes may be missing
+         u2node.insert( make_pair( prevNormPar, node ));
+-      }
+-      else if ( i == 0 ) {
++      } else if ( i == 0 ) {
+         MESSAGE(" NO NODE on VERTEX" );
+         return myPoints;
+       }
+@@ -499,8 +472,7 @@
+     double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
+     return myC2d[ i ]->Value( myFirst[i] * ( 1 - r ) + myLast[i] * r );
+   }
+-  //return gp_Pnt2d( 1e+100, 1e+100 );
+-  return myDefaultPnt2d;
++  return gp_Pnt2d( 1e+100, 1e+100 );
+ }
+ 
+ //================================================================================
+@@ -541,7 +513,15 @@
+         return TSideVector(0);
+       }
+     }
+-    const bool isForward = true;
++    // find out side orientation, which is important if there are several wires (PAL19080) 
++    bool isForward = true;
++    if ( nbWires > 1 ) {
++      TopExp_Explorer e( theFace, TopAbs_EDGE );
++      while ( ! e.Current().IsSame( wireEdges.back() ))
++        e.Next();
++      isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() );
++    }
++
+     StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
+                                                          isForward, theIgnoreMediumNodes);
+     wires[ iW ] = StdMeshers_FaceSidePtr( wire );
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_FixedPoints1D.cpp salomesmesh/src/StdMeshers/StdMeshers_FixedPoints1D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_FixedPoints1D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_FixedPoints1D.cpp	1969-12-31 18:00:00.000000000 -0600
+@@ -1,243 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : implementaion of SMESH idl descriptions
+-//  File   : StdMeshers_FixedPoints1D.cxx
+-//  Author : Damien COQUERET, OCC
+-//  Module : SMESH
+-//
+-#include "StdMeshers_FixedPoints1D.hxx"
+-
+-#include "SMESH_Algo.hxx"
+-#include "SMESH_Mesh.hxx"
+-
+-//#include <BRep_Tool.hxx>
+-//#include <GCPnts_AbscissaPoint.hxx>
+-//#include <GeomAdaptor_Curve.hxx>
+-//#include <Geom_Curve.hxx>
+-//#include <TopExp.hxx>
+-//#include <TopLoc_Location.hxx>
+-//#include <TopTools_IndexedMapOfShape.hxx>
+-//#include <TopoDS.hxx>
+-//#include <TopoDS_Edge.hxx>
+-
+-using namespace std;
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-StdMeshers_FixedPoints1D::StdMeshers_FixedPoints1D(int hypId, int studyId,
+-                                                   SMESH_Gen * gen)
+-  :SMESH_Hypothesis(hypId, studyId, gen)
+-{
+-  _name = "FixedPoints1D";
+-  _param_algo_dim = 1; 
+-  _nbsegs.reserve( 1 );
+-  _nbsegs.push_back( 1 );
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-StdMeshers_FixedPoints1D::~StdMeshers_FixedPoints1D()
+-{
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-void StdMeshers_FixedPoints1D::SetPoints(std::vector<double>& listParams)
+-                              throw(SALOME_Exception)
+-{
+-  _params = listParams;
+-  NotifySubMeshesHypothesisModification();
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-void StdMeshers_FixedPoints1D::SetNbSegments(std::vector<int>& listNbSeg) 
+-                              throw(SALOME_Exception)
+-{
+-  _nbsegs = listNbSeg;
+-  NotifySubMeshesHypothesisModification();
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-void StdMeshers_FixedPoints1D::SetReversedEdges( std::vector<int>& ids )
+-{
+-  if ( ids != _edgeIDs ) {
+-    _edgeIDs = ids;
+-
+-    NotifySubMeshesHypothesisModification();
+-  }
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-ostream & StdMeshers_FixedPoints1D::SaveTo(ostream & save)
+-{
+-  int listSize = _params.size();
+-  save << listSize;
+-  if ( listSize > 0 ) {
+-    for ( int i = 0; i < listSize; i++) save << " " << _params[i];
+-  }
+-
+-  listSize = _nbsegs.size();
+-  save << listSize;
+-  if ( listSize > 0 ) {
+-    for ( int i = 0; i < listSize; i++) save << " " << _nbsegs[i];
+-  }
+-
+-  listSize = _edgeIDs.size();
+-  save << listSize;
+-  if ( listSize > 0 ) {
+-    for ( int i = 0; i < listSize; i++)
+-      save << " " << _edgeIDs[i];
+-  }
+-
+-  save << " " << _objEntry;
+-
+-  return save;
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-istream & StdMeshers_FixedPoints1D::LoadFrom(istream & load)
+-{
+-  bool isOK = true;
+-  int intVal;
+-  double dblVal;
+-
+-  isOK = (load >> intVal);
+-  if (isOK && intVal > 0) {
+-    _params.reserve( intVal );
+-    for (int i = 0; i < _params.capacity() && isOK; i++) {
+-      isOK = (load >> dblVal);
+-      if ( isOK ) _params.push_back( dblVal );
+-    }
+-  }
+-
+-  isOK = (load >> intVal);
+-  if (isOK && intVal > 0) {
+-    _nbsegs.reserve( intVal );
+-    for (int i = 0; i < _nbsegs.capacity() && isOK; i++) {
+-      isOK = (load >> intVal);
+-      if ( isOK ) _nbsegs.push_back( intVal );
+-    }
+-  }
+-
+-  isOK = (load >> intVal);
+-  if (isOK && intVal > 0) {
+-    _edgeIDs.reserve( intVal );
+-    for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+-      isOK = (load >> intVal);
+-      if ( isOK ) _edgeIDs.push_back( intVal );
+-    }
+-  }
+-
+-  isOK = (load >> _objEntry);
+-
+-  return load;
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-ostream & operator <<(ostream & save, StdMeshers_FixedPoints1D & hyp)
+-{
+-  return hyp.SaveTo( save );
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-istream & operator >>(istream & load, StdMeshers_FixedPoints1D & hyp)
+-{
+-  return hyp.LoadFrom( load );
+-}
+-
+-//================================================================================
+-/*!
+- * \brief Initialize start and end length by the mesh built on the geometry
+- * \param theMesh - the built mesh
+- * \param theShape - the geometry of interest
+- * \retval bool - true if parameter values have been successfully defined
+- */
+-//================================================================================
+-
+-bool StdMeshers_FixedPoints1D::SetParametersByMesh(const SMESH_Mesh*   theMesh,
+-                                                   const TopoDS_Shape& theShape)
+-{
+-  if ( !theMesh || theShape.IsNull() )
+-    return false;
+-
+-  _nbsegs.reserve( 1 );
+-  _nbsegs.push_back( 1 );
+-  return true;
+-}
+-
+-//================================================================================
+-/*!
+- * \brief Initialize my parameter values by default parameters.
+- *  \retval bool - true if parameter values have been successfully defined
+- */
+-//================================================================================
+-
+-bool StdMeshers_FixedPoints1D::SetParametersByDefaults(const TDefaults&  dflts,
+-                                                       const SMESH_Mesh* /*mesh*/)
+-{
+-  _nbsegs.reserve( 1 );
+-  _nbsegs.push_back( 1 );
+-  return true;
+-}
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Hexa_3D.cpp salomesmesh/src/StdMeshers/StdMeshers_Hexa_3D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Hexa_3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Hexa_3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -48,23 +48,17 @@
+ #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+ #include <TopTools_ListOfShape.hxx>
+-#include <TopTools_SequenceOfShape.hxx>
+-#include <TopTools_MapOfShape.hxx>
+ #include <TopoDS.hxx>
+ #include <gp_Pnt2d.hxx>
+ 
+ #include "utilities.h"
+-#include "Utils_ExceptHandlers.hxx"
++#include "SMESH_ExceptHandlers.hxx"
+ 
+ typedef SMESH_Comment TComm;
+ 
+ using namespace std;
+ 
+-static SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh &,
+-                                                    const TopoDS_Shape &);
+-
+-static bool EvaluatePentahedralMesh(SMESH_Mesh &, const TopoDS_Shape &,
+-                                    MapShapeNbElems &);
++static SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh &, const TopoDS_Shape &);
+ 
+ //=============================================================================
+ /*!
+@@ -77,7 +71,7 @@
+ {
+   MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D");
+   _name = "Hexa_3D";
+-  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);       // 1 bit /shape type
++  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);	// 1 bit /shape type
+ }
+ 
+ //=============================================================================
+@@ -298,10 +292,10 @@
+     try {
+       aQuads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace, _quadraticMesh);
+       if(!aQuads[i]) {
+-        return error( quadAlgo->GetComputeError());
++	return error( quadAlgo->GetComputeError());
+       }
+     }
+-    catch(SALOME_Exception & S_ex) {
++    catch(SMESH_Exception & S_ex) {
+       return ClearAndReturn( aQuads, error(COMPERR_SLM_EXCEPTION,TComm(S_ex.what()) <<
+                                            " Raised by StdMeshers_Quadrangle_2D "
+                                            " on face #" << meshDS->ShapeToIndex( aFace )));
+@@ -361,7 +355,7 @@
+   int _indX1 = GetFaceIndex(aMesh, aShape, meshFaces,
+                             aCube.V100, aCube.V101, aCube.V110, aCube.V111);
+ 
+-  // IPAL21120: SIGSEGV on Meshing attached Compound with Automatic Hexadralization
++  // IPAL21120:	SIGSEGV on Meshing attached Compound with Automatic Hexadralization
+   if ( _indY1 < 1 || _indZ0 < 1 || _indZ1 < 1 || _indX0 < 1 || _indX1 < 1 )
+     return error(COMPERR_BAD_SHAPE);
+ 
+@@ -374,8 +368,8 @@
+ 
+   // 1.7 - get convertion coefs from face 2D normalized to 3D normalized
+ 
+-  Conv2DStruct cx0;                     // for face X=0
+-  Conv2DStruct cx1;                     // for face X=1
++  Conv2DStruct cx0;			// for face X=0
++  Conv2DStruct cx1;			// for face X=1
+   Conv2DStruct cy0;
+   Conv2DStruct cy1;
+   Conv2DStruct cz0;
+@@ -414,12 +408,12 @@
+     const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX0]->GetSubShape());
+ 
+     faceQuadStruct *quad = aCube.quad_X0;
+-    int i = 0;                          // j = x/face , k = y/face
++    int i = 0;				// j = x/face , k = y/face
+     int nbdown = quad->side[0]->NbPoints();
+     int nbright = quad->side[1]->NbPoints();
+ 
+     SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+-                        
++			
+     while(itf->more()) {
+       const SMDS_MeshNode * node = itf->next();
+       if(aTool.IsMedium(node))
+@@ -433,8 +427,8 @@
+     for (int i1 = 0; i1 < nbdown; i1++)
+       for (int j1 = 0; j1 < nbright; j1++) {
+         int ij1 = j1 * nbdown + i1;
+-        int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic;     // j = x/face
+-        int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc;     // k = y/face
++        int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic;	// j = x/face
++        int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc;	// k = y/face
+         int ijk = k * nbx * nby + j * nbx + i;
+         //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+         np[ijk].node = quad->uv_grid[ij1].node;
+@@ -448,7 +442,7 @@
+     SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+ 
+     faceQuadStruct *quad = aCube.quad_X1;
+-    int i = nbx - 1;            // j = x/face , k = y/face
++    int i = nbx - 1;		// j = x/face , k = y/face
+     int nbdown = quad->side[0]->NbPoints();
+     int nbright = quad->side[1]->NbPoints();
+ 
+@@ -465,8 +459,8 @@
+     for (int i1 = 0; i1 < nbdown; i1++)
+       for (int j1 = 0; j1 < nbright; j1++) {
+         int ij1 = j1 * nbdown + i1;
+-        int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic;     // j = x/face
+-        int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc;     // k = y/face
++        int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic;	// j = x/face
++        int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc;	// k = y/face
+         int ijk = k * nbx * nby + j * nbx + i;
+         //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+         np[ijk].node = quad->uv_grid[ij1].node;
+@@ -480,7 +474,7 @@
+     SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+ 
+     faceQuadStruct *quad = aCube.quad_Y0;
+-    int j = 0;                          // i = x/face , k = y/face
++    int j = 0;				// i = x/face , k = y/face
+     int nbdown = quad->side[0]->NbPoints();
+     int nbright = quad->side[1]->NbPoints();
+ 
+@@ -497,8 +491,8 @@
+     for (int i1 = 0; i1 < nbdown; i1++)
+       for (int j1 = 0; j1 < nbright; j1++) {
+         int ij1 = j1 * nbdown + i1;
+-        int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic;     // i = x/face
+-        int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc;     // k = y/face
++        int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic;	// i = x/face
++        int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc;	// k = y/face
+         int ijk = k * nbx * nby + j * nbx + i;
+         //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+         np[ijk].node = quad->uv_grid[ij1].node;
+@@ -512,7 +506,7 @@
+     SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+ 
+     faceQuadStruct *quad = aCube.quad_Y1;
+-    int j = nby - 1;            // i = x/face , k = y/face
++    int j = nby - 1;		// i = x/face , k = y/face
+     int nbdown = quad->side[0]->NbPoints();
+     int nbright = quad->side[1]->NbPoints();
+ 
+@@ -529,8 +523,8 @@
+     for (int i1 = 0; i1 < nbdown; i1++)
+       for (int j1 = 0; j1 < nbright; j1++) {
+         int ij1 = j1 * nbdown + i1;
+-        int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic;     // i = x/face
+-        int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc;     // k = y/face
++        int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic;	// i = x/face
++        int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc;	// k = y/face
+         int ijk = k * nbx * nby + j * nbx + i;
+         //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+         np[ijk].node = quad->uv_grid[ij1].node;
+@@ -544,7 +538,7 @@
+     SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+ 
+     faceQuadStruct *quad = aCube.quad_Z0;
+-    int k = 0;                          // i = x/face , j = y/face
++    int k = 0;				// i = x/face , j = y/face
+     int nbdown = quad->side[0]->NbPoints();
+     int nbright = quad->side[1]->NbPoints();
+ 
+@@ -561,8 +555,8 @@
+     for (int i1 = 0; i1 < nbdown; i1++)
+       for (int j1 = 0; j1 < nbright; j1++) {
+         int ij1 = j1 * nbdown + i1;
+-        int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic;     // i = x/face
+-        int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc;     // j = y/face
++        int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic;	// i = x/face
++        int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc;	// j = y/face
+         int ijk = k * nbx * nby + j * nbx + i;
+         //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+         np[ijk].node = quad->uv_grid[ij1].node;
+@@ -576,7 +570,7 @@
+     SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes();
+ 
+     faceQuadStruct *quad = aCube.quad_Z1;
+-    int k = nbz - 1;            // i = x/face , j = y/face
++    int k = nbz - 1;		// i = x/face , j = y/face
+     int nbdown = quad->side[0]->NbPoints();
+     int nbright = quad->side[1]->NbPoints();
+     
+@@ -593,8 +587,8 @@
+     for (int i1 = 0; i1 < nbdown; i1++)
+       for (int j1 = 0; j1 < nbright; j1++) {
+         int ij1 = j1 * nbdown + i1;
+-        int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic;     // i = x/face
+-        int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc;     // j = y/face
++        int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic;	// i = x/face
++        int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc;	// j = y/face
+         int ijk = k * nbx * nby + j * nbx + i;
+         //MESSAGE(" "<<ij1<<" "<<i<<" "<<j<<" "<<ijk);
+         np[ijk].node = quad->uv_grid[ij1].node;
+@@ -655,9 +649,9 @@
+         GetPoint(p1yz, nbx - 1, j, k, nbx, nby, nbz, np, meshDS);
+ 
+         int ijk = k * nbx * nby + j * nbx + i;
+-        double x = double (i) / double (nbx - 1);       // *** seulement
+-        double y = double (j) / double (nby - 1);       // *** maillage
+-        double z = double (k) / double (nbz - 1);       // *** regulier
++        double x = double (i) / double (nbx - 1);	// *** seulement
++        double y = double (j) / double (nby - 1);	// *** maillage
++        double z = double (k) / double (nbz - 1);	// *** regulier
+ 
+         Pt3 X;
+         for (int i = 0; i < 3; i++) {
+@@ -742,127 +736,6 @@
+   return ClearAndReturn( aQuads, true );
+ }
+ 
+-
+-//=============================================================================
+-/*!
+- *  Evaluate
+- */
+-//=============================================================================
+-
+-bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh,
+-                                  const TopoDS_Shape & aShape,
+-                                  MapShapeNbElems& aResMap)
+-{
+-  vector < SMESH_subMesh * >meshFaces;
+-  TopTools_SequenceOfShape aFaces;
+-  for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
+-    aFaces.Append(exp.Current());
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
+-    ASSERT(aSubMesh);
+-    meshFaces.push_back(aSubMesh);
+-  }
+-  if (meshFaces.size() != 6) {
+-    //return error(COMPERR_BAD_SHAPE, TComm(meshFaces.size())<<" instead of 6 faces in a block");
+-    static StdMeshers_CompositeHexa_3D compositeHexa(-10, 0, aMesh.GetGen());
+-    return compositeHexa.Evaluate(aMesh, aShape, aResMap);
+-  }
+-  
+-  int i = 0;
+-  for(; i<6; i++) {
+-    //TopoDS_Shape aFace = meshFaces[i]->GetSubShape();
+-    TopoDS_Shape aFace = aFaces.Value(i+1);
+-    SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace);
+-    if( !algo ) {
+-      std::vector<int> aResVec(SMDSEntity_Last);
+-      for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-      SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-      aResMap.insert(std::make_pair(sm,aResVec));
+-      SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-      return false;
+-    }
+-    string algoName = algo->GetName();
+-    bool isAllQuad = false;
+-    if (algoName == "Quadrangle_2D") {
+-      MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i]);
+-      if( anIt == aResMap.end() ) continue;
+-      std::vector<int> aVec = (*anIt).second;
+-      int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+-      if( nbtri == 0 )
+-        isAllQuad = true;
+-    }
+-    if ( ! isAllQuad ) {
+-      return EvaluatePentahedralMesh(aMesh, aShape, aResMap);
+-    }
+-  }
+-  
+-  // find number of 1d elems for 1 face
+-  int nb1d = 0;
+-  TopTools_MapOfShape Edges1;
+-  bool IsQuadratic = false;
+-  bool IsFirst = true;
+-  for (TopExp_Explorer exp(aFaces.Value(1), TopAbs_EDGE); exp.More(); exp.Next()) {
+-    Edges1.Add(exp.Current());
+-    SMESH_subMesh *sm = aMesh.GetSubMesh(exp.Current());
+-    if( sm ) {
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      if( anIt == aResMap.end() ) continue;
+-      std::vector<int> aVec = (*anIt).second;
+-      nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-      if(IsFirst) {
+-        IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
+-        IsFirst = false;
+-      }
+-    }
+-  }
+-  // find face opposite to 1 face
+-  int OppNum = 0;
+-  for(i=2; i<=6; i++) {
+-    bool IsOpposite = true;
+-    for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) {
+-      if( Edges1.Contains(exp.Current()) ) {
+-        IsOpposite = false;
+-        break;
+-      }
+-    }
+-    if(IsOpposite) {
+-      OppNum = i;
+-      break;
+-    }
+-  }
+-  // find number of 2d elems on side faces
+-  int nb2d = 0;
+-  for(i=2; i<=6; i++) {
+-    if( i == OppNum ) continue;
+-    MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] );
+-    if( anIt == aResMap.end() ) continue;
+-    std::vector<int> aVec = (*anIt).second;
+-    nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  }
+-  
+-  MapShapeNbElemsItr anIt = aResMap.find( meshFaces[0] );
+-  std::vector<int> aVec = (*anIt).second;
+-  int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  int nb0d_face0 = aVec[SMDSEntity_Node];
+-
+-  std::vector<int> aResVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-  if(IsQuadratic) {
+-    aResVec[SMDSEntity_Quad_Hexa] = nb2d_face0 * ( nb2d/nb1d );
+-    int nb1d_face0_int = ( nb2d_face0*4 - nb1d ) / 2;
+-    aResVec[SMDSEntity_Node] = nb0d_face0 * ( 2*nb2d/nb1d - 1 ) - nb1d_face0_int * nb2d/nb1d;
+-  }
+-  else {
+-    aResVec[SMDSEntity_Node] = nb0d_face0 * ( nb2d/nb1d - 1 );
+-    aResVec[SMDSEntity_Hexa] = nb2d_face0 * ( nb2d/nb1d );
+-  }
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aResVec));
+-
+-  return true;
+-}
+-
+-
+ //=============================================================================
+ /*!
+  *  
+@@ -872,12 +745,12 @@
+ void StdMeshers_Hexa_3D::GetPoint(Pt3 p, int i, int j, int k, int nbx, int nby, int nbz,
+                                   Point3DStruct * np, const SMESHDS_Mesh * meshDS)
+ {
+-        int ijk = k * nbx * nby + j * nbx + i;
+-        const SMDS_MeshNode * node = np[ijk].node;
+-        p[0] = node->X();
+-        p[1] = node->Y();
+-        p[2] = node->Z();
+-        //MESSAGE(" "<<i<<" "<<j<<" "<<k<<" "<<p[0]<<" "<<p[1]<<" "<<p[2]);
++	int ijk = k * nbx * nby + j * nbx + i;
++	const SMDS_MeshNode * node = np[ijk].node;
++	p[0] = node->X();
++	p[1] = node->Y();
++	p[2] = node->Z();
++	//MESSAGE(" "<<i<<" "<<j<<" "<<k<<" "<<p[0]<<" "<<p[1]<<" "<<p[2]);
+ }
+ 
+ //=============================================================================
+@@ -887,35 +760,35 @@
+ //=============================================================================
+ 
+ int StdMeshers_Hexa_3D::GetFaceIndex(SMESH_Mesh & aMesh,
+-        const TopoDS_Shape & aShape,
+-        const vector < SMESH_subMesh * >&meshFaces,
+-        const TopoDS_Vertex & V0,
+-        const TopoDS_Vertex & V1,
+-        const TopoDS_Vertex & V2, const TopoDS_Vertex & V3)
+-{
+-        //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex");
+-        int faceIndex = -1;
+-        for (int i = 1; i < 6; i++)
+-        {
+-                const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape();
+-                //const TopoDS_Face& F = TopoDS::Face(aFace);
+-                TopTools_IndexedMapOfShape M;
+-                TopExp::MapShapes(aFace, TopAbs_VERTEX, M);
+-                bool verticesInShape = false;
+-                if (M.Contains(V0))
+-                        if (M.Contains(V1))
+-                                if (M.Contains(V2))
+-                                        if (M.Contains(V3))
+-                                                verticesInShape = true;
+-                if (verticesInShape)
+-                {
+-                        faceIndex = i;
+-                        break;
+-                }
+-        }
+-        //IPAL21120 ASSERT(faceIndex > 0);
+-        //SCRUTE(faceIndex);
+-        return faceIndex;
++	const TopoDS_Shape & aShape,
++	const vector < SMESH_subMesh * >&meshFaces,
++	const TopoDS_Vertex & V0,
++	const TopoDS_Vertex & V1,
++	const TopoDS_Vertex & V2, const TopoDS_Vertex & V3)
++{
++	//MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex");
++	int faceIndex = -1;
++	for (int i = 1; i < 6; i++)
++	{
++		const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape();
++		//const TopoDS_Face& F = TopoDS::Face(aFace);
++		TopTools_IndexedMapOfShape M;
++		TopExp::MapShapes(aFace, TopAbs_VERTEX, M);
++		bool verticesInShape = false;
++		if (M.Contains(V0))
++			if (M.Contains(V1))
++				if (M.Contains(V2))
++					if (M.Contains(V3))
++						verticesInShape = true;
++		if (verticesInShape)
++		{
++			faceIndex = i;
++			break;
++		}
++	}
++	//IPAL21120 ASSERT(faceIndex > 0);
++	//SCRUTE(faceIndex);
++	return faceIndex;
+ }
+ 
+ //=============================================================================
+@@ -925,46 +798,46 @@
+ //=============================================================================
+ 
+ TopoDS_Edge
+-        StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh,
+-        const TopoDS_Shape & aShape,
+-        const TopoDS_Face & aFace,
+-        const TopoDS_Vertex & aVertex,
+-        const TopTools_IndexedDataMapOfShapeListOfShape & MS)
+-{
+-        //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace");
+-        TopTools_IndexedDataMapOfShapeListOfShape MF;
+-        TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF);
+-        const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex);
+-        const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex);
+-//      SCRUTE(ancestorsInSolid.Extent());
+-//      SCRUTE(ancestorsInFace.Extent());
+-        ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees)
+-        ASSERT(ancestorsInFace.Extent() == 2);
+-
+-        TopoDS_Edge E;
+-        E.Nullify();
+-        TopTools_ListIteratorOfListOfShape its(ancestorsInSolid);
+-        for (; its.More(); its.Next())
+-        {
+-                TopoDS_Shape ancestor = its.Value();
+-                TopTools_ListIteratorOfListOfShape itf(ancestorsInFace);
+-                bool isInFace = false;
+-                for (; itf.More(); itf.Next())
+-                {
+-                        TopoDS_Shape ancestorInFace = itf.Value();
+-                        if (ancestorInFace.IsSame(ancestor))
+-                        {
+-                                isInFace = true;
+-                                break;
+-                        }
+-                }
+-                if (!isInFace)
+-                {
+-                        E = TopoDS::Edge(ancestor);
+-                        break;
+-                }
+-        }
+-        return E;
++	StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh,
++	const TopoDS_Shape & aShape,
++	const TopoDS_Face & aFace,
++	const TopoDS_Vertex & aVertex,
++	const TopTools_IndexedDataMapOfShapeListOfShape & MS)
++{
++	//MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace");
++	TopTools_IndexedDataMapOfShapeListOfShape MF;
++	TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF);
++	const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex);
++	const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex);
++// 	SCRUTE(ancestorsInSolid.Extent());
++// 	SCRUTE(ancestorsInFace.Extent());
++	ASSERT(ancestorsInSolid.Extent() == 6);	// 6 (edges doublees)
++	ASSERT(ancestorsInFace.Extent() == 2);
++
++	TopoDS_Edge E;
++	E.Nullify();
++	TopTools_ListIteratorOfListOfShape its(ancestorsInSolid);
++	for (; its.More(); its.Next())
++	{
++		TopoDS_Shape ancestor = its.Value();
++		TopTools_ListIteratorOfListOfShape itf(ancestorsInFace);
++		bool isInFace = false;
++		for (; itf.More(); itf.Next())
++		{
++			TopoDS_Shape ancestorInFace = itf.Value();
++			if (ancestorInFace.IsSame(ancestor))
++			{
++				isInFace = true;
++				break;
++			}
++		}
++		if (!isInFace)
++		{
++			E = TopoDS::Edge(ancestor);
++			break;
++		}
++	}
++	return E;
+ }
+ 
+ //=============================================================================
+@@ -974,135 +847,135 @@
+ //=============================================================================
+ 
+ void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad,
+-        const TopoDS_Shape & aShape,
+-        const TopoDS_Vertex & V0,
+-        const TopoDS_Vertex & V1,
+-        const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv)
+-{
+-//      MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs");
+-//      const TopoDS_Face & F = TopoDS::Face(aShape);
+-//      TopoDS_Edge E = quad.edge[0];
+-//      double f, l;
+-//      Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
+-//      TopoDS_Vertex VFirst, VLast;
+-//      TopExp::Vertices(E, VFirst, VLast);     // corresponds to f and l
+-//      bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0);
++	const TopoDS_Shape & aShape,
++	const TopoDS_Vertex & V0,
++	const TopoDS_Vertex & V1,
++	const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv)
++{
++//	MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs");
++// 	const TopoDS_Face & F = TopoDS::Face(aShape);
++// 	TopoDS_Edge E = quad.edge[0];
++// 	double f, l;
++// 	Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
++// 	TopoDS_Vertex VFirst, VLast;
++// 	TopExp::Vertices(E, VFirst, VLast);	// corresponds to f and l
++// 	bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0);
+   TopoDS_Vertex VA, VB;
+-//      if (isForward)
+-//      {
+-//              VA = VFirst;
+-//              VB = VLast;
+-//      }
+-//      else
+-//      {
+-//              VA = VLast;
+-//              VB = VFirst;
+-//      }
++// 	if (isForward)
++// 	{
++// 		VA = VFirst;
++// 		VB = VLast;
++// 	}
++// 	else
++// 	{
++// 		VA = VLast;
++// 		VB = VFirst;
++// 	}
+   VA = quad.side[0]->FirstVertex();
+   VB = quad.side[0]->LastVertex();
+   
+-        int a1, b1, c1, a2, b2, c2;
+-        if (VA.IsSame(V0))
+-                if (VB.IsSame(V1))
+-                {
+-                        a1 = 1;
+-                        b1 = 0;
+-                        c1 = 0;                         // x
+-                        a2 = 0;
+-                        b2 = 1;
+-                        c2 = 0;                         // y
+-                }
+-                else
+-                {
+-                        ASSERT(VB.IsSame(V3));
+-                        a1 = 0;
+-                        b1 = 1;
+-                        c1 = 0;                         // y
+-                        a2 = 1;
+-                        b2 = 0;
+-                        c2 = 0;                         // x
+-                }
+-        if (VA.IsSame(V1))
+-                if (VB.IsSame(V2))
+-                {
+-                        a1 = 0;
+-                        b1 = -1;
+-                        c1 = 1;                         // 1-y
+-                        a2 = 1;
+-                        b2 = 0;
+-                        c2 = 0;                         // x
+-                }
+-                else
+-                {
+-                        ASSERT(VB.IsSame(V0));
+-                        a1 = -1;
+-                        b1 = 0;
+-                        c1 = 1;                         // 1-x
+-                        a2 = 0;
+-                        b2 = 1;
+-                        c2 = 0;                         // y
+-                }
+-        if (VA.IsSame(V2))
+-                if (VB.IsSame(V3))
+-                {
+-                        a1 = -1;
+-                        b1 = 0;
+-                        c1 = 1;                         // 1-x
+-                        a2 = 0;
+-                        b2 = -1;
+-                        c2 = 1;                         // 1-y
+-                }
+-                else
+-                {
+-                        ASSERT(VB.IsSame(V1));
+-                        a1 = 0;
+-                        b1 = -1;
+-                        c1 = 1;                         // 1-y
+-                        a2 = -1;
+-                        b2 = 0;
+-                        c2 = 1;                         // 1-x
+-                }
+-        if (VA.IsSame(V3))
+-                if (VB.IsSame(V0))
+-                {
+-                        a1 = 0;
+-                        b1 = 1;
+-                        c1 = 0;                         // y
+-                        a2 = -1;
+-                        b2 = 0;
+-                        c2 = 1;                         // 1-x
+-                }
+-                else
+-                {
+-                        ASSERT(VB.IsSame(V2));
+-                        a1 = 1;
+-                        b1 = 0;
+-                        c1 = 0;                         // x
+-                        a2 = 0;
+-                        b2 = -1;
+-                        c2 = 1;                         // 1-y
+-                }
+-//      MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
+-//      MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
+-        conv.a1 = a1;
+-        conv.b1 = b1;
+-        conv.c1 = c1;
+-        conv.a2 = a2;
+-        conv.b2 = b2;
+-        conv.c2 = c2;
+-
+-        int nbdown = quad.side[0]->NbPoints();
+-        int nbright = quad.side[1]->NbPoints();
+-        conv.ia = int (a1);
+-        conv.ib = int (b1);
+-        conv.ic =
+-                int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1);
+-        conv.ja = int (a2);
+-        conv.jb = int (b2);
+-        conv.jc =
+-                int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1);
+-//      MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic);
+-//      MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc);
++	int a1, b1, c1, a2, b2, c2;
++	if (VA.IsSame(V0))
++		if (VB.IsSame(V1))
++		{
++			a1 = 1;
++			b1 = 0;
++			c1 = 0;				// x
++			a2 = 0;
++			b2 = 1;
++			c2 = 0;				// y
++		}
++		else
++		{
++			ASSERT(VB.IsSame(V3));
++			a1 = 0;
++			b1 = 1;
++			c1 = 0;				// y
++			a2 = 1;
++			b2 = 0;
++			c2 = 0;				// x
++		}
++	if (VA.IsSame(V1))
++		if (VB.IsSame(V2))
++		{
++			a1 = 0;
++			b1 = -1;
++			c1 = 1;				// 1-y
++			a2 = 1;
++			b2 = 0;
++			c2 = 0;				// x
++		}
++		else
++		{
++			ASSERT(VB.IsSame(V0));
++			a1 = -1;
++			b1 = 0;
++			c1 = 1;				// 1-x
++			a2 = 0;
++			b2 = 1;
++			c2 = 0;				// y
++		}
++	if (VA.IsSame(V2))
++		if (VB.IsSame(V3))
++		{
++			a1 = -1;
++			b1 = 0;
++			c1 = 1;				// 1-x
++			a2 = 0;
++			b2 = -1;
++			c2 = 1;				// 1-y
++		}
++		else
++		{
++			ASSERT(VB.IsSame(V1));
++			a1 = 0;
++			b1 = -1;
++			c1 = 1;				// 1-y
++			a2 = -1;
++			b2 = 0;
++			c2 = 1;				// 1-x
++		}
++	if (VA.IsSame(V3))
++		if (VB.IsSame(V0))
++		{
++			a1 = 0;
++			b1 = 1;
++			c1 = 0;				// y
++			a2 = -1;
++			b2 = 0;
++			c2 = 1;				// 1-x
++		}
++		else
++		{
++			ASSERT(VB.IsSame(V2));
++			a1 = 1;
++			b1 = 0;
++			c1 = 0;				// x
++			a2 = 0;
++			b2 = -1;
++			c2 = 1;				// 1-y
++		}
++// 	MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
++// 	MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
++	conv.a1 = a1;
++	conv.b1 = b1;
++	conv.c1 = c1;
++	conv.a2 = a2;
++	conv.b2 = b2;
++	conv.c2 = c2;
++
++	int nbdown = quad.side[0]->NbPoints();
++	int nbright = quad.side[1]->NbPoints();
++	conv.ia = int (a1);
++	conv.ib = int (b1);
++	conv.ic =
++		int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1);
++	conv.ja = int (a2);
++	conv.jb = int (b2);
++	conv.jc =
++		int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1);
++// 	MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic);
++// 	MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc);
+ }
+ 
+ //================================================================================
+@@ -1174,7 +1047,6 @@
+     }
+     SMESH_Hypothesis::Hypothesis_Status aStatus;
+     if ( aPrism3D->CheckHypothesis( aMesh, aShape, aStatus ) ) {
+-      aPrism3D->InitComputeError();
+       bOK = aPrism3D->Compute( aMesh, aShape );
+       err = aPrism3D->GetComputeError();
+     }
+@@ -1183,33 +1055,3 @@
+ }
+ 
+ 
+-//=======================================================================
+-//function : EvaluatePentahedralMesh
+-//purpose  : 
+-//=======================================================================
+-
+-bool EvaluatePentahedralMesh(SMESH_Mesh & aMesh,
+-                             const TopoDS_Shape & aShape,
+-                             MapShapeNbElems& aResMap)
+-{
+-  StdMeshers_Penta_3D anAlgo;
+-  bool bOK = anAlgo.Evaluate(aMesh, aShape, aResMap);
+-
+-  //err = anAlgo.GetComputeError();
+-  //if ( !bOK && anAlgo.ErrorStatus() == 5 )
+-  if( !bOK ) {
+-    static StdMeshers_Prism_3D * aPrism3D = 0;
+-    if ( !aPrism3D ) {
+-      SMESH_Gen* gen = aMesh.GetGen();
+-      aPrism3D = new StdMeshers_Prism_3D( gen->GetANewId(), 0, gen );
+-    }
+-    SMESH_Hypothesis::Hypothesis_Status aStatus;
+-    if ( aPrism3D->CheckHypothesis( aMesh, aShape, aStatus ) ) {
+-      return aPrism3D->Evaluate(aMesh, aShape, aResMap);
+-    }
+-  }
+-
+-  return bOK;
+-}
+-
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LayerDistribution2D.cpp salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LayerDistribution2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution2D.cpp	1969-12-31 18:00:00.000000000 -0600
+@@ -1,61 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : idl implementation based on 'SMESH' unit's classes
+-//  File   : StdMeshers_LayerDistribution2D.cxx
+-//  Author : Edward AGAPOV
+-//  Module : SMESH
+-//
+-#include "StdMeshers_LayerDistribution2D.hxx"
+-
+-#include "utilities.h"
+-
+-
+-//=============================================================================
+-/*!
+- *  StdMeshers_LayerDistribution2D::StdMeshers_LayerDistribution2D
+- *
+- *  Constructor
+- */
+-//=============================================================================
+-
+-StdMeshers_LayerDistribution2D::StdMeshers_LayerDistribution2D(int hypId,
+-                                                               int studyId,
+-                                                               SMESH_Gen * gen)
+-  : StdMeshers_LayerDistribution(hypId, studyId, gen)
+-{
+-  _name = "LayerDistribution2D"; // used by RadialQuadrangle_1D2D
+-  _param_algo_dim = 2; // 2D
+-  myHyp = 0;
+-}
+-
+-//=============================================================================
+-/*!
+- *  StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D
+- *
+- *  Destructor
+- */
+-//=============================================================================
+-
+-StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D()
+-{
+-  MESSAGE( "StdMeshers_LayerDistribution2D::~StdMeshers_LayerDistribution2D" );
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LayerDistribution.cpp salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LayerDistribution.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_LayerDistribution.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_LayerDistribution.cxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LayerDistribution.cxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_LayerDistribution.hxx"
+ 
+@@ -69,11 +70,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_LayerDistribution::SetLayerDistribution(SMESH_Hypothesis* hyp1D)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( myHyp != hyp1D ) {
+     if ( myHyp && hyp1D->GetDim() != 1 )
+-      throw SALOME_Exception(LOCALIZED("1D hypothesis is expected"));
++      throw SMESH_Exception(LOCALIZED("1D hypothesis is expected"));
+     myHyp = hyp1D;
+   }
+   std::ostringstream os;
+@@ -144,6 +145,7 @@
+ {
+   return false;
+ }
++
+ //================================================================================
+ /*!
+  * \brief Initialize my parameter values by default parameters.
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LengthFromEdges.cpp salomesmesh/src/StdMeshers/StdMeshers_LengthFromEdges.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LengthFromEdges.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_LengthFromEdges.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,7 @@
+ //           Moved here from SMESH_LengthFromEdges.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LengthFromEdges.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_LengthFromEdges.hxx"
+ 
+@@ -62,11 +63,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_LengthFromEdges::SetMode(int mode)
+-  throw (SALOME_Exception)
++  throw (SMESH_Exception)
+ {
+   int oldMode = _mode;
+   if (mode <= 0) 
+-    throw SALOME_Exception(LOCALIZED("mode must be positive"));
++    throw SMESH_Exception(LOCALIZED("mode must be positive"));
+   _mode = mode;
+   if (oldMode != _mode)
+     NotifySubMeshesHypothesisModification();
+@@ -151,6 +152,7 @@
+ {
+   return false;
+ }
++
+ //================================================================================
+ /*!
+  * \brief Initialize my parameter values by default parameters.
+@@ -163,3 +165,4 @@
+ {
+   return true;
+ }
++
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LocalLength.cpp salomesmesh/src/StdMeshers/StdMeshers_LocalLength.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_LocalLength.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_LocalLength.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,8 +24,8 @@
+ //           Moved here from SMESH_LocalLength.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LocalLength.cxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+-
+ #include "StdMeshers_LocalLength.hxx"
+ 
+ #include "SMESH_Mesh.hxx"
+@@ -77,11 +77,11 @@
+  */
+ //=============================================================================
+ 
+-void StdMeshers_LocalLength::SetLength(double length) throw(SALOME_Exception)
++void StdMeshers_LocalLength::SetLength(double length) throw(SMESH_Exception)
+ {
+   double oldLength = _length;
+   if (length <= 0)
+-    throw SALOME_Exception(LOCALIZED("length must be positive"));
++    throw SMESH_Exception(LOCALIZED("length must be positive"));
+   _length = length;
+   const double precision = 1e-7;
+   if (fabs(oldLength - _length) > precision)
+@@ -104,11 +104,11 @@
+  *  
+  */
+ //=============================================================================
+-void StdMeshers_LocalLength::SetPrecision (double thePrecision) throw(SALOME_Exception)
++void StdMeshers_LocalLength::SetPrecision (double thePrecision) throw(SMESH_Exception)
+ {
+   double oldPrecision = _precision;
+   if (_precision < 0)
+-    throw SALOME_Exception(LOCALIZED("precision cannot be negative"));
++    throw SMESH_Exception(LOCALIZED("precision cannot be negative"));
+   _precision = thePrecision;
+   const double precision = 1e-8;
+   if (fabs(oldPrecision - _precision) > precision)
+@@ -234,6 +234,7 @@
+ 
+   return nbEdges;
+ }
++
+ //================================================================================
+ /*!
+  * \brief Initialize my parameter values by default parameters.
+@@ -246,4 +247,3 @@
+ {
+   return ( _length = dflts._elemLength );
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MaxElementArea.cpp salomesmesh/src/StdMeshers/StdMeshers_MaxElementArea.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MaxElementArea.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_MaxElementArea.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,8 +24,8 @@
+ //           Moved here from SMESH_MaxElementArea.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementArea.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+-
+ #include "StdMeshers_MaxElementArea.hxx"
+ 
+ #include "SMESH_ControlsDef.hxx"
+@@ -71,11 +71,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_MaxElementArea::SetMaxArea(double maxArea)
+-  throw (SALOME_Exception)
++  throw (SMESH_Exception)
+ {
+   double oldArea = _maxArea;
+   if (maxArea <= 0) 
+-    throw SALOME_Exception(LOCALIZED("maxArea must be positive"));
++    throw SMESH_Exception(LOCALIZED("maxArea must be positive"));
+   _maxArea = maxArea;
+   if (_maxArea != oldArea)
+     NotifySubMeshesHypothesisModification();
+@@ -185,6 +185,7 @@
+   }
+   return _maxArea > 0;
+ }
++
+ //================================================================================
+ /*!
+  * \brief Initialize my parameter values by default parameters.
+@@ -197,4 +198,3 @@
+ {
+   return ( _maxArea = dflts._elemLength*dflts._elemLength );
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MaxElementVolume.cpp salomesmesh/src/StdMeshers/StdMeshers_MaxElementVolume.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MaxElementVolume.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_MaxElementVolume.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,7 @@
+ //           Moved here from SMESH_MaxElementVolume.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementVolume.cxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #include "StdMeshers_MaxElementVolume.hxx"
+ 
+@@ -72,11 +73,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_MaxElementVolume::SetMaxVolume(double maxVolume)
+-  throw (SALOME_Exception)
++  throw (SMESH_Exception)
+ {
+   double oldVolume = _maxVolume;
+   if (maxVolume <= 0) 
+-    throw SALOME_Exception(LOCALIZED("maxVolume must be positive"));
++    throw SMESH_Exception(LOCALIZED("maxVolume must be positive"));
+   _maxVolume = maxVolume;
+   if (_maxVolume != oldVolume)
+     NotifySubMeshesHypothesisModification();
+@@ -196,6 +197,7 @@
+   }
+   return _maxVolume > 0;
+ }
++
+ //================================================================================
+ /*!
+  * \brief Initialize my parameter values by default parameters.
+@@ -208,4 +210,3 @@
+ {
+   return ( _maxVolume = dflts._elemLength*dflts._elemLength*dflts._elemLength );
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MaxLength.cpp salomesmesh/src/StdMeshers/StdMeshers_MaxLength.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MaxLength.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_MaxLength.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -74,10 +74,10 @@
+  */
+ //=============================================================================
+ 
+-void StdMeshers_MaxLength::SetLength(double length) throw(SALOME_Exception)
++void StdMeshers_MaxLength::SetLength(double length) throw(SMESH_Exception)
+ {
+   if (length <= 0)
+-    throw SALOME_Exception(LOCALIZED("length must be positive"));
++    throw SMESH_Exception(LOCALIZED("length must be positive"));
+   if ( _length != length ) {
+     _length = length;
+     NotifySubMeshesHypothesisModification();
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp salomesmesh/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp	2009-12-17 02:32:26.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,7 @@
+ //           Moved here from SMESH_MEFISTO_2D.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx,v 1.11.2.3 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_MEFISTO_2D.hxx"
+ 
+@@ -50,10 +51,8 @@
+ 
+ #include <BRepTools.hxx>
+ #include <BRep_Tool.hxx>
+-#include <Geom_Curve.hxx>
+ #include <Geom2d_Curve.hxx>
+ #include <Geom_Surface.hxx>
+-#include <Precision.hxx>
+ #include <TopExp.hxx>
+ #include <TopExp_Explorer.hxx>
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+@@ -65,10 +64,6 @@
+ #include <TopoDS_Iterator.hxx>
+ #include <gp_Pnt2d.hxx>
+ 
+-#include <BRep_Tool.hxx>
+-#include <GProp_GProps.hxx>
+-#include <BRepGProp.hxx>
+-
+ using namespace std;
+ 
+ //=============================================================================
+@@ -197,7 +192,7 @@
+   TError problem;
+   TWireVector wires = StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, problem );
+   int nbWires = wires.size();
+-  if ( problem != NULL && !problem->IsOK() ) return error( problem );
++  if ( (problem!=NULL) && !problem->IsOK() ) return error( problem );
+   if ( nbWires == 0 ) return error( "Problem in StdMeshers_FaceSide::GetFaceWires()");
+   if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments
+     return error(COMPERR_BAD_INPUT_MESH,
+@@ -288,90 +283,6 @@
+   return isOk;
+ }
+ 
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-bool StdMeshers_MEFISTO_2D::Evaluate(SMESH_Mesh & aMesh,
+-				     const TopoDS_Shape & aShape,
+-				     MapShapeNbElems& aResMap)
+-{
+-  MESSAGE("StdMeshers_MEFISTO_2D::Evaluate");
+-
+-  TopoDS_Face F = TopoDS::Face(aShape.Oriented(TopAbs_FORWARD));
+-
+-  double aLen = 0.0;
+-  int NbSeg = 0;
+-  bool IsQuadratic = false;
+-  bool IsFirst = true;
+-  TopExp_Explorer exp(F,TopAbs_EDGE);
+-  for(; exp.More(); exp.Next()) {
+-    TopoDS_Edge E = TopoDS::Edge(exp.Current());
+-    MapShapeNbElemsItr anIt = aResMap.find( aMesh.GetSubMesh(E) );
+-    if( anIt == aResMap.end() ) continue;
+-    std::vector<int> aVec = (*anIt).second;
+-    int nbe = Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-    NbSeg += nbe;
+-    if(IsFirst) {
+-      IsQuadratic = ( aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge] );
+-      IsFirst = false;
+-    }
+-    double a,b;
+-    TopLoc_Location L;
+-    Handle(Geom_Curve) C = BRep_Tool::Curve(E,L,a,b);
+-    gp_Pnt P1;
+-    C->D0(a,P1);
+-    double dp = (b-a)/nbe;
+-    for(int i=1; i<=nbe; i++) {
+-      gp_Pnt P2;
+-      C->D0(a+i*dp,P2);
+-      aLen += P1.Distance(P2);
+-      P1 = P2;
+-    }
+-  }
+-  if(NbSeg<1) {
+-    std::vector<int> aResVec(SMDSEntity_Last);
+-    for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-    SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-    aResMap.insert(std::make_pair(sm,aResVec));
+-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
+-                                          "Submesh can not be evaluated",this));
+-    return false;
+-  }
+-  aLen = aLen/NbSeg; // middle length
+-
+-  _edgeLength = Precision::Infinite();
+-  double tmpLength = Min( _edgeLength, aLen );
+-
+-  GProp_GProps G;
+-  BRepGProp::SurfaceProperties(aShape,G);
+-  double anArea = G.Mass();
+-
+-  int nbFaces = Precision::IsInfinite( tmpLength ) ? 0 :
+-    (int)( anArea/(tmpLength*tmpLength*sqrt(3.)/4) );
+-  int nbNodes = (int) ( nbFaces*3 - (NbSeg-1)*2 ) / 6;
+-
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
+-  if(IsQuadratic) {
+-    aVec[SMDSEntity_Quad_Triangle] = nbFaces;
+-    aVec[SMDSEntity_Node] = (int)( nbNodes + nbFaces*3 - (NbSeg-1) );
+-  }
+-  else {
+-    aVec[SMDSEntity_Node] = nbNodes;
+-    aVec[SMDSEntity_Triangle] = nbFaces;
+-  }
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+-
+-
+ //=======================================================================
+ //function : fixOverlappedLinkUV
+ //purpose  : prevent failure due to overlapped adjacent links
+@@ -594,7 +505,7 @@
+       MESSAGE("Wrong mefistoToDS.size: "<<mefistoToDS.size()<<" < "<<m + uvPtVec.size()-1);
+       return error("Internal error");
+     }
+-
++    
+     list< int > mOnVertex;
+     vector<UVPtStruct>::const_iterator uvPt = uvPtVec.begin();
+     for ( ++uvPt; uvPt != uvPtVec.end(); ++uvPt )
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NotConformAllowed.cpp salomesmesh/src/StdMeshers/StdMeshers_NotConformAllowed.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NotConformAllowed.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_NotConformAllowed.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_NotConformAllowed.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NotConformAllowed.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_NotConformAllowed.hxx"
+ #include "utilities.h"
+@@ -111,6 +112,7 @@
+ {
+   return true;
+ }
++
+ //================================================================================
+ /*!
+  * \brief Initialize my parameter values by default parameters.
+@@ -123,4 +125,3 @@
+ {
+   return true;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NumberOfLayers2D.cpp salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NumberOfLayers2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers2D.cpp	1969-12-31 18:00:00.000000000 -0600
+@@ -1,63 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : idl implementation based on 'SMESH' unit's classes
+-//  File   : StdMeshers_NumberOfLayers2D.cxx
+-//  Author : Edward AGAPOV
+-//  Module : SMESH
+-//
+-
+-#include "StdMeshers_NumberOfLayers2D.hxx"
+-
+-#include "utilities.h"
+-
+-
+-//=============================================================================
+-/*!
+- *  StdMeshers_NumberOfLayers2D::StdMeshers_NumberOfLayers2D
+- *
+- *  Constructor
+- */
+-//=============================================================================
+-
+-StdMeshers_NumberOfLayers2D::StdMeshers_NumberOfLayers2D(int hypId,
+-                                                         int studyId,
+-                                                         SMESH_Gen * gen)
+-  : StdMeshers_NumberOfLayers(hypId, studyId, gen)
+-{
+-  _name = "NumberOfLayers2D"; // used by RadialQuadrangle_1D2D
+-  _param_algo_dim = 2; // 2D
+-  _nbLayers = 1;
+-}
+-
+-//=============================================================================
+-/*!
+- *  StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D
+- *
+- *  Destructor
+- */
+-//=============================================================================
+-
+-StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D()
+-{
+-  MESSAGE( "StdMeshers_NumberOfLayers2D::~StdMeshers_NumberOfLayers2D" );
+-}
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NumberOfLayers.cpp salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NumberOfLayers.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_NumberOfLayers.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_NumberOfLayers.cxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfLayers.cxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_NumberOfLayers.hxx"
+ 
+@@ -72,11 +73,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_NumberOfLayers::SetNumberOfLayers(int numberOfLayers)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( _nbLayers != numberOfLayers ) {
+     if ( numberOfLayers <= 0 )
+-      throw SALOME_Exception(LOCALIZED("numberOfLayers must be positive"));
++      throw SMESH_Exception(LOCALIZED("numberOfLayers must be positive"));
+     _nbLayers = numberOfLayers;
+ 
+     NotifySubMeshesHypothesisModification();
+@@ -174,4 +175,3 @@
+     return theMesh ? (_nbLayers = int( theMesh->GetShapeDiagonalSize() / dflts._elemLength/ 2.)) : 0;
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NumberOfSegments.cpp salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_NumberOfSegments.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,7 @@
+ //           Moved here from SMESH_NumberOfSegments.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfSegments.cxx,v 1.13.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_NumberOfSegments.hxx"
+ 
+@@ -49,8 +50,6 @@
+ #include <Standard_ErrorHandler.hxx>
+ #endif
+ 
+-//#include <Basics_Utils.hxx>
+-
+ using namespace std;
+ 
+ const double PRECISION = 1e-7;
+@@ -91,7 +90,7 @@
+ //=============================================================================
+ const vector<double>&
+ StdMeshers_NumberOfSegments::BuildDistributionExpr( const char* expr,int nbSeg,int conv )
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if( !buildDistribution( TCollection_AsciiString( ( Standard_CString )expr ), conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) )
+     _distr.resize( 0 );
+@@ -102,7 +101,7 @@
+ StdMeshers_NumberOfSegments::BuildDistributionTab( const vector<double>& tab,
+                                                    int nbSeg,
+                                                    int conv )
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if( !buildDistribution( tab, conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) )
+     _distr.resize( 0 );
+@@ -116,11 +115,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_NumberOfSegments::SetNumberOfSegments(int segmentsNumber)
+-throw(SALOME_Exception)
++throw(SMESH_Exception)
+ {
+   int oldNumberOfSegments = _numberOfSegments;
+   if (segmentsNumber <= 0)
+-    throw SALOME_Exception(LOCALIZED("number of segments must be positive"));
++    throw SMESH_Exception(LOCALIZED("number of segments must be positive"));
+   _numberOfSegments = segmentsNumber;
+ 
+   if (oldNumberOfSegments != _numberOfSegments)
+@@ -145,10 +144,10 @@
+ //================================================================================
+ 
+ void StdMeshers_NumberOfSegments::SetDistrType(DistrType typ)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if (typ < DT_Regular || typ > DT_ExprFunc)
+-    throw SALOME_Exception(LOCALIZED("distribution type is out of range"));
++    throw SMESH_Exception(LOCALIZED("distribution type is out of range"));
+ 
+   if (typ != _distrType)
+   {
+@@ -175,15 +174,15 @@
+ //================================================================================
+ 
+ void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if (_distrType != DT_Scale)
+     _distrType = DT_Scale;
+-    //throw SALOME_Exception(LOCALIZED("not a scale distribution"));
++    //throw SMESH_Exception(LOCALIZED("not a scale distribution"));
+   if (scaleFactor < PRECISION)
+-    throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
++    throw SMESH_Exception(LOCALIZED("scale factor must be positive"));
+   //if (fabs(scaleFactor - 1.0) < PRECISION)
+-  //  throw SALOME_Exception(LOCALIZED("scale factor must not be equal to 1"));
++  //  throw SMESH_Exception(LOCALIZED("scale factor must not be equal to 1"));
+ 
+   if (fabs(_scaleFactor - scaleFactor) > PRECISION)
+   {
+@@ -199,10 +198,10 @@
+ //================================================================================
+ 
+ double StdMeshers_NumberOfSegments::GetScaleFactor() const
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if (_distrType != DT_Scale)
+-    throw SALOME_Exception(LOCALIZED("not a scale distribution"));
++    throw SMESH_Exception(LOCALIZED("not a scale distribution"));
+   return _scaleFactor;
+ }
+ 
+@@ -213,13 +212,13 @@
+ //================================================================================
+ 
+ void StdMeshers_NumberOfSegments::SetTableFunction(const vector<double>& table)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if (_distrType != DT_TabFunc)
+     _distrType = DT_TabFunc;
+-  //throw SALOME_Exception(LOCALIZED("not a table function distribution"));
++  //throw SMESH_Exception(LOCALIZED("not a table function distribution"));
+   if ( (table.size() % 2) != 0 )
+-    throw SALOME_Exception(LOCALIZED("odd size of vector of table function"));
++    throw SMESH_Exception(LOCALIZED("odd size of vector of table function"));
+ 
+   int i;
+   double prev = -PRECISION;
+@@ -235,22 +234,22 @@
+ #ifdef NO_CAS_CATCH
+         OCC_CATCH_SIGNALS;
+ #endif
+-        val = pow( 10.0, val );
++	val = pow( 10.0, val );
+       } catch(Standard_Failure) {
+-        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+-        throw SALOME_Exception( LOCALIZED( "invalid value"));
+-        return;
++	Handle(Standard_Failure) aFail = Standard_Failure::Caught();
++	throw SMESH_Exception( LOCALIZED( "invalid value"));
++	return;
+       }
+     }
+     else if( _convMode==1 && val<0.0 )
+       val = 0.0;
+ 
+     if ( par<0 || par > 1)
+-      throw SALOME_Exception(LOCALIZED("parameter of table function is out of range [0,1]"));
++      throw SMESH_Exception(LOCALIZED("parameter of table function is out of range [0,1]"));
+     if ( fabs(par-prev)<PRECISION )
+-      throw SALOME_Exception(LOCALIZED("two parameters are the same"));
++      throw SMESH_Exception(LOCALIZED("two parameters are the same"));
+     if ( val < 0 )
+-      throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
++      throw SMESH_Exception(LOCALIZED("value of table function is not positive"));
+     if( val>PRECISION )
+       pos = true;
+     if (isSame)
+@@ -264,7 +263,7 @@
+   }
+ 
+   if( !pos )
+-    throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
++    throw SMESH_Exception(LOCALIZED("value of table function is not positive"));
+ 
+   if( pos && !isSame )
+   {
+@@ -280,10 +279,10 @@
+ //================================================================================
+ 
+ const vector<double>& StdMeshers_NumberOfSegments::GetTableFunction() const
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if (_distrType != DT_TabFunc)
+-    throw SALOME_Exception(LOCALIZED("not a table function distribution"));
++    throw SMESH_Exception(LOCALIZED("not a table function distribution"));
+   return _table;
+ }
+ 
+@@ -305,7 +304,7 @@
+     if( !name.IsNull() )
+     {
+       if( name->GetName()!="t" )
+-        res = false;
++	res = false;
+     }
+     else
+       res = isCorrectArg( sub );
+@@ -319,12 +318,10 @@
+  */
+ //================================================================================
+ bool process( const TCollection_AsciiString& str, int convMode,
+-              bool& syntax, bool& args,
+-              bool& non_neg, bool& non_zero,
+-              bool& singulars, double& sing_point )
++	      bool& syntax, bool& args,
++	      bool& non_neg, bool& non_zero,
++ 	      bool& singulars, double& sing_point )
+ {
+-  //Kernel_Utils::Localizer loc;
+-
+   bool parsed_ok = true;
+   Handle( ExprIntrp_GenExp ) myExpr;
+   try {
+@@ -363,20 +360,19 @@
+       double t = double(i)/double(max), val;
+       if( !f.value( t, val ) )
+       {
+-        sing_point = t;
+-        singulars = true;
+-        break;
++	sing_point = t;
++	singulars = true;
++	break;
+       }
+       if( val<0 )
+       {
+-        non_neg = false;
+-        break;
++	non_neg = false;
++	break;
+       }
+       if( val>PRECISION )
+-        non_zero = true;
++	non_zero = true;
+     }
+   }
+-
+   return res && non_neg && non_zero && ( !singulars );
+ }
+ 
+@@ -387,11 +383,11 @@
+ //================================================================================
+ 
+ void StdMeshers_NumberOfSegments::SetExpressionFunction(const char* expr)
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if (_distrType != DT_ExprFunc)
+     _distrType = DT_ExprFunc;
+-    //throw SALOME_Exception(LOCALIZED("not an expression function distribution"));
++    //throw SMESH_Exception(LOCALIZED("not an expression function distribution"));
+ 
+   // remove white spaces
+   TCollection_AsciiString str((Standard_CString)expr);
+@@ -406,19 +402,19 @@
+   if( !res )
+   {
+     if( !syntax )
+-      throw SALOME_Exception(LOCALIZED("invalid expression syntax"));
++      throw SMESH_Exception(LOCALIZED("invalid expression syntax"));
+     if( !args )
+-      throw SALOME_Exception(LOCALIZED("only 't' may be used as function argument"));
++      throw SMESH_Exception(LOCALIZED("only 't' may be used as function argument"));
+     if( !non_neg )
+-      throw SALOME_Exception(LOCALIZED("only non-negative function can be used as density"));
++      throw SMESH_Exception(LOCALIZED("only non-negative function can be used as density"));
+     if( singulars )
+     {
+       char buf[1024];
+       sprintf( buf, "Function has singular point in %.3f", sing_point );
+-      throw SALOME_Exception( buf );
++      throw SMESH_Exception( buf );
+     }
+     if( !non_zero )
+-      throw SALOME_Exception(LOCALIZED("f(t)=0 cannot be used as density"));
++      throw SMESH_Exception(LOCALIZED("f(t)=0 cannot be used as density"));
+ 
+     return;
+   }
+@@ -438,10 +434,10 @@
+ //================================================================================
+ 
+ const char* StdMeshers_NumberOfSegments::GetExpressionFunction() const
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+   if (_distrType != DT_ExprFunc)
+-    throw SALOME_Exception(LOCALIZED("not an expression function distribution"));
++    throw SMESH_Exception(LOCALIZED("not an expression function distribution"));
+   return _func.c_str();
+ }
+ 
+@@ -452,10 +448,10 @@
+ //================================================================================
+ 
+ void StdMeshers_NumberOfSegments::SetConversionMode( int conv )
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+ //   if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc)
+-//     throw SALOME_Exception(LOCALIZED("not a functional distribution"));
++//     throw SMESH_Exception(LOCALIZED("not a functional distribution"));
+ 
+   if( conv != _convMode )
+   {
+@@ -471,10 +467,10 @@
+ //================================================================================
+ 
+ int StdMeshers_NumberOfSegments::ConversionMode() const
+-  throw(SALOME_Exception)
++  throw(SMESH_Exception)
+ {
+ //   if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc)
+-//     throw SALOME_Exception(LOCALIZED("not a functional distribution"));
++//     throw SMESH_Exception(LOCALIZED("not a functional distribution"));
+   return _convMode;
+ }
+ 
+@@ -486,7 +482,6 @@
+ 
+ ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save)
+ {
+-  int listSize = _edgeIDs.size();
+   save << _numberOfSegments << " " << (int)_distrType;
+   switch (_distrType)
+   {
+@@ -509,13 +504,6 @@
+ 
+   if (_distrType == DT_TabFunc || _distrType == DT_ExprFunc)
+     save << " " << _convMode;
+-
+-  if ( _distrType != DT_Regular && listSize > 0 ) {
+-    save << " " << listSize;
+-    for ( int i = 0; i < listSize; i++ )
+-      save << " " << _edgeIDs[i];
+-    save << " " << _objEntry;
+-  }
+   
+   return save;
+ }
+@@ -632,18 +620,6 @@
+       load.clear(ios::badbit | load.rdstate());
+   }
+ 
+-  // load reversed edges IDs
+-  int intVal;
+-  isOK = (load >> intVal);
+-  if ( isOK && _distrType != DT_Regular && intVal > 0 ) {
+-    _edgeIDs.reserve( intVal );
+-    for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+-      isOK = (load >> intVal);
+-      if ( isOK ) _edgeIDs.push_back( intVal );
+-    }
+-    isOK = (load >> _objEntry);
+-  }
+-
+   return load;
+ }
+ 
+@@ -707,6 +683,7 @@
+ 
+   return nbEdges;
+ }
++
+ //================================================================================
+ /*!
+  * \brief Initialize my parameter values by default parameters.
+@@ -719,19 +696,3 @@
+ {
+   return (_numberOfSegments = dflts._nbSegments );
+ }
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-void StdMeshers_NumberOfSegments::SetReversedEdges( std::vector<int>& ids )
+-{
+-  if ( ids != _edgeIDs ) {
+-    _edgeIDs = ids;
+-
+-    NotifySubMeshesHypothesisModification();
+-  }
+-}
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Penta_3D.cpp salomesmesh/src/StdMeshers/StdMeshers_Penta_3D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Penta_3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Penta_3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -26,7 +26,7 @@
+ #include "StdMeshers_Penta_3D.hxx"
+ 
+ #include "utilities.h"
+-#include "Utils_ExceptHandlers.hxx"
++#include "SMESH_ExceptHandlers.hxx"
+ 
+ #include "SMDS_EdgePosition.hxx"
+ #include "SMDS_MeshElement.hxx"
+@@ -46,8 +46,6 @@
+ #include <TopTools_IndexedMapOfShape.hxx>
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+ #include <TopTools_ListOfShape.hxx>
+-#include <TopTools_SequenceOfShape.hxx>
+-#include <TopTools_MapOfShape.hxx>
+ #include <TopoDS.hxx>
+ #include <TopoDS_Edge.hxx>
+ #include <TopoDS_Shell.hxx>
+@@ -69,7 +67,7 @@
+ //purpose  : 
+ //=======================================================================
+ StdMeshers_Penta_3D::StdMeshers_Penta_3D()
+-  : myErrorStatus(SMESH_ComputeError::New())
++: myErrorStatus(SMESH_ComputeError::New())
+ {
+   myTol3D=0.1;
+   myWallNodesMaps.resize( SMESH_Block::NbFaces() );
+@@ -91,7 +89,7 @@
+ //purpose  : 
+ //=======================================================================
+ bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh, 
+-                                  const TopoDS_Shape& aShape)
++				  const TopoDS_Shape& aShape)
+ {
+   MESSAGE("StdMeshers_Penta_3D::Compute()");
+   //
+@@ -262,11 +260,11 @@
+   SMESH_Block::TShapeID wallFaceID[ NB_WALL_FACES ] = {
+     SMESH_Block::ID_Fx0z, SMESH_Block::ID_Fx1z,
+     SMESH_Block::ID_F0yz, SMESH_Block::ID_F1yz
+-  };
++    };
+   SMESH_Block::TShapeID baseEdgeID[ NB_WALL_FACES ] = {
+     SMESH_Block::ID_Ex00, SMESH_Block::ID_Ex10,
+     SMESH_Block::ID_E0y0, SMESH_Block::ID_E1y0
+-  };
++    };
+   for ( i = 0; i < NB_WALL_FACES ; ++i ) {
+     int fIndex = SMESH_Block::ShapeIndex( wallFaceID[ i ]);
+     bool ok = LoadIJNodes (myWallNodesMaps[ fIndex ],
+@@ -424,7 +422,7 @@
+       ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
+       if (!myErrorStatus->IsOK()) {
+         MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
+-        return;
++	return;
+       }
+       //
+       aTN.SetShapeSupportID(aSSID);
+@@ -432,13 +430,13 @@
+       aTN.SetBaseNodeID(iBNID);
+       //
+       if (aSSID!=SMESH_Block::ID_NONE){
+-        // try to find the node
+-        const TopoDS_Shape& aS=myBlock.Shape((int)aSSID);
+-        FindNodeOnShape(aS, aCoords, i, aTN);
++	// try to find the node
++	const TopoDS_Shape& aS=myBlock.Shape((int)aSSID);
++	FindNodeOnShape(aS, aCoords, i, aTN);
+       }
+       else{
+-        // create node and get its id
+-        CreateNode (bIsUpperLayer, aCoords, aTN);
++	// create node and get it id
++	CreateNode (bIsUpperLayer, aCoords, aTN);
+         //
+         if ( bIsUpperLayer ) {
+           const SMDS_MeshNode* n = aTN.Node();
+@@ -471,12 +469,39 @@
+       }
+       if (!myErrorStatus->IsOK()) {
+         MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
+-        return;
++	return;
+       }
+       //
+       myTNodes[ij]=aTN;
+     }
+   }
++  //DEB
++  /*
++  {
++    int iSSID, iBNID, aID;
++    //
++    for (i=0; i<myISize; ++i) {
++      printf(" Layer# %d\n", i);
++      for (j=0; j<myJSize; ++j) {
++	ij=i*myJSize+j; 
++	const StdMeshers_TNode& aTN=myTNodes[ij];
++	//const StdMeshers_TNode& aTN=aTNodes[ij];
++	const gp_XYZ& aXYZ=aTN.NormCoord();
++	iSSID=aTN.ShapeSupportID();
++	iBNID=aTN.BaseNodeID();
++	//
++	const SMDS_MeshNode* aNode=aTN.Node();
++	aID=aNode->GetID(); 
++	aX=aNode->X();
++	aY=aNode->Y();
++	aZ=aNode->Z();
++	printf("*** j:%d BNID#%d iSSID:%d ID:%d { %lf %lf %lf },  { %lf %lf %lf }\n",
++	       j,  iBNID, iSSID, aID, aXYZ.X(),  aXYZ.Y(), aXYZ.Z(), aX, aY, aZ);
++      }
++    }
++  }
++  */
++  //DEB t
+ }
+ 
+ 
+@@ -486,9 +511,9 @@
+ //=======================================================================
+ 
+ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
+-                                          const gp_XYZ&       aParams,
++					  const gp_XYZ&       aParams,
+                                           const int           z,
+-                                          StdMeshers_TNode&   aTN)
++					  StdMeshers_TNode&   aTN)
+ {
+   double aX, aY, aZ, aD, aTol2, minD;
+   gp_Pnt aP1, aP2;
+@@ -607,16 +632,16 @@
+   }
+   else {
+     // this variant is better for other cases
+-    //   SMESH_MesherHelper helper( *GetMesh() );
+-    //   const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ]));
+-    //   double u1 = helper.GetNodeU( edge, n1 );
+-    //   double u2 = helper.GetNodeU( edge, n2 );
+-    //   double u = ( 1. - r ) * u1 + r * u2;
+-    //   gp_XYZ topNodeParams;
+-    //   myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams );
+-    //   myBlock.Block().EdgePoint( edgeVec[ TOP ],
+-    //                              topNodeParams,
+-    //                              myShapeXYZ[ edgeVec[ TOP ]]);
++//   SMESH_MesherHelper helper( *GetMesh() );
++//   const TopoDS_Edge & edge = TopoDS::Edge( myBlock.Shape( edgeVec[ TOP ]));
++//   double u1 = helper.GetNodeU( edge, n1 );
++//   double u2 = helper.GetNodeU( edge, n2 );
++//   double u = ( 1. - r ) * u1 + r * u2;
++//   gp_XYZ topNodeParams;
++//   myBlock.Block().EdgeParameters( edgeVec[ TOP ], u, topNodeParams );
++//   myBlock.Block().EdgePoint( edgeVec[ TOP ],
++//                              topNodeParams,
++//                              myShapeXYZ[ edgeVec[ TOP ]]);
+   }
+ 
+   // base edge
+@@ -648,8 +673,8 @@
+       const StdMeshers_TNode& aTN = myTNodes[ij];
+       aSSID=aTN.ShapeSupportID();
+       if (aSSID==SMESH_Block::ID_NONE) {
+-        SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node();
+-        meshDS->SetNodeInVolume(aNode, shapeID);
++	SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node();
++	meshDS->SetNodeInVolume(aNode, shapeID);
+       }
+     }
+   }
+@@ -687,7 +712,7 @@
+       aJ[k] = GetIndexOnLayer(aID0);
+       if (!myErrorStatus->IsOK()) {
+         MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
+-        return;
++	return;
+       }
+       //
+       ++k;
+@@ -698,15 +723,15 @@
+       i1=i;
+       i2=i+1;
+       for(j=0; j<nbFaceNodes; ++j) {
+-        ij = i1*myJSize+aJ[j];
+-        const StdMeshers_TNode& aTN1 = myTNodes[ij];
+-        const SMDS_MeshNode* aN1 = aTN1.Node();
+-        aN[j]=aN1;
+-        //
+-        ij=i2*myJSize+aJ[j];
+-        const StdMeshers_TNode& aTN2 = myTNodes[ij];
+-        const SMDS_MeshNode* aN2 = aTN2.Node();
+-        aN[j+nbFaceNodes] = aN2;
++	ij = i1*myJSize+aJ[j];
++	const StdMeshers_TNode& aTN1 = myTNodes[ij];
++	const SMDS_MeshNode* aN1 = aTN1.Node();
++	aN[j]=aN1;
++	//
++	ij=i2*myJSize+aJ[j];
++	const StdMeshers_TNode& aTN2 = myTNodes[ij];
++	const SMDS_MeshNode* aN2 = aTN2.Node();
++	aN[j+nbFaceNodes] = aN2;
+       }
+       // check if volume orientation will be ok
+       if ( i == 0 ) {
+@@ -795,7 +820,7 @@
+   itn = aSM0->GetNodes();
+   aNbNodes = aSM0->NbNodes();
+   //printf("** aNbNodes=%d\n", aNbNodes);
+-  myTool->SetSubShape( aFxy1 ); // to set medium nodes to aFxy1
++
+   //
+   // set elements on aFxy1
+   vector<const SMDS_MeshNode*> aNodes1;
+@@ -824,7 +849,7 @@
+       aJ = GetIndexOnLayer(aID0);
+       if (!myErrorStatus->IsOK()) {
+         MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
+-        return;
++	return;
+       }
+       //
+       ij = aLevel*myJSize + aJ;
+@@ -846,7 +871,6 @@
+     }
+     meshDS->SetMeshElementOnShape(face, aFxy1);
+   }
+-  myTool->SetSubShape( myShape );
+ 
+   // update compute state of top face submesh
+   aSubMesh1->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+@@ -913,8 +937,8 @@
+ //purpose  : 
+ //=======================================================================
+ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
+-                                     const gp_XYZ& aParams,
+-                                     StdMeshers_TNode& aTN)
++				     const gp_XYZ& aParams,
++				     StdMeshers_TNode& aTN)
+ {
+   double aX, aY, aZ;
+   //
+@@ -923,15 +947,15 @@
+   SMDS_MeshNode* pNode=NULL; 
+   aTN.SetNode(pNode);  
+   //
+-  //   if (bIsUpperLayer) {
+-  //     // point on face Fxy1
+-  //     const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1);
+-  //     myBlock.Point(aParams, aS, aP);
+-  //   }
+-  //   else {
+-  //     // point inside solid
+-  //     myBlock.Point(aParams, aP);
+-  //   }
++//   if (bIsUpperLayer) {
++//     // point on face Fxy1
++//     const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_Fxy1);
++//     myBlock.Point(aParams, aS, aP);
++//   }
++//   else {
++//     // point inside solid
++//     myBlock.Point(aParams, aP);
++//   }
+   if (bIsUpperLayer) {
+     double u = aParams.X(), v = aParams.Y();
+     double u1 = ( 1. - u ), v1 = ( 1. - v );
+@@ -949,11 +973,11 @@
+     SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() );
+   }
+   //
+-  //   iErr=myBlock.ErrorStatus();
+-  //   if (iErr) {
+-  //     myErrorStatus=12; // can not find the node point;
+-  //     return;
+-  //   }
++//   iErr=myBlock.ErrorStatus();
++//   if (iErr) {
++//     myErrorStatus=12; // can not find the node point;
++//     return;
++//   }
+   //
+   aX=aP.X(); aY=aP.Y(); aZ=aP.Z(); 
+   //
+@@ -961,7 +985,7 @@
+   SMESHDS_Mesh* pMeshDS = pMesh->GetMeshDS();
+   //
+   pNode = pMeshDS->AddNode(aX, aY, aZ);
+-
++  
+   aTN.SetNode(pNode);
+ }
+ 
+@@ -970,42 +994,42 @@
+ //purpose  : 
+ //=======================================================================
+ void StdMeshers_Penta_3D::ShapeSupportID(const bool bIsUpperLayer,
+-                                         const SMESH_Block::TShapeID aBNSSID,
+-                                         SMESH_Block::TShapeID& aSSID)
++					 const SMESH_Block::TShapeID aBNSSID,
++					 SMESH_Block::TShapeID& aSSID)
+ {
+   switch (aBNSSID) {
+-  case SMESH_Block::ID_V000:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V001 : SMESH_Block::ID_E00z;
+-    break;
+-  case SMESH_Block::ID_V100:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V101 : SMESH_Block::ID_E10z;
+-    break; 
+-  case SMESH_Block::ID_V110:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V111 : SMESH_Block::ID_E11z;
+-    break;
+-  case SMESH_Block::ID_V010:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V011 : SMESH_Block::ID_E01z;
+-    break;
+-  case SMESH_Block::ID_Ex00:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z;
+-    break;
+-  case SMESH_Block::ID_Ex10:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z;
+-    break; 
+-  case SMESH_Block::ID_E0y0:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz;
+-    break; 
+-  case SMESH_Block::ID_E1y0:
+-    aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz;
+-    break; 
+-  case SMESH_Block::ID_Fxy0:
+-    aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ?  Shape_ID_Fxy1 : Shape_ID_NONE;
+-    break;   
+-  default:
+-    aSSID=SMESH_Block::ID_NONE;
+-    myErrorStatus->myName=10; // Can not find supporting shape ID
+-    myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D";
+-    break;
++    case SMESH_Block::ID_V000:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V001 : SMESH_Block::ID_E00z;
++      break;
++    case SMESH_Block::ID_V100:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V101 : SMESH_Block::ID_E10z;
++      break; 
++    case SMESH_Block::ID_V110:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V111 : SMESH_Block::ID_E11z;
++      break;
++    case SMESH_Block::ID_V010:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_V011 : SMESH_Block::ID_E01z;
++      break;
++    case SMESH_Block::ID_Ex00:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_Ex01 : SMESH_Block::ID_Fx0z;
++      break;
++    case SMESH_Block::ID_Ex10:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_Ex11 : SMESH_Block::ID_Fx1z;
++      break; 
++    case SMESH_Block::ID_E0y0:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_E0y1 : SMESH_Block::ID_F0yz;
++      break; 
++    case SMESH_Block::ID_E1y0:
++      aSSID=(bIsUpperLayer) ?  SMESH_Block::ID_E1y1 : SMESH_Block::ID_F1yz;
++      break; 
++    case SMESH_Block::ID_Fxy0:
++      aSSID=SMESH_Block::ID_NONE;//(bIsUpperLayer) ?  Shape_ID_Fxy1 : Shape_ID_NONE;
++      break;   
++    default:
++      aSSID=SMESH_Block::ID_NONE;
++      myErrorStatus->myName=10; // Can not find supporting shape ID
++      myErrorStatus->myComment = "Internal error of StdMeshers_Penta_3D";
++      break;
+   }
+   return;
+ }
+@@ -1042,25 +1066,25 @@
+       const SMDS_MeshElement * pElement = itf->next();
+       aElementType = pElement->GetType();
+       if (aElementType==SMDSAbs_Face) {
+-        iNbNodes = pElement->NbNodes();
+-        if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) {
+-          aFTr = aF;
+-          ++iCnt;
+-          if (iCnt>1) {
+-            // \begin{E.A.}
+-            // The current algorithm fails if there is more that one
+-            // face wich contains triangles ...
+-            // In that case, replace return by break to try another
+-            // method (coded in "if (iCnt != 1) { ... }")
+-            //
++	iNbNodes = pElement->NbNodes();
++	if ( iNbNodes==3 || (pElement->IsQuadratic() && iNbNodes==6) ) {
++	  aFTr = aF;
++	  ++iCnt;
++	  if (iCnt>1) {
++	    // \begin{E.A.}
++	    // The current algorithm fails if there is more that one
++	    // face wich contains triangles ...
++	    // In that case, replace return by break to try another
++	    // method (coded in "if (iCnt != 1) { ... }")
++	    //
+             // MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
+-            // myErrorStatus=5; // more than one face has triangulation
+-            // return;
+-            break;
+-            // \end{E.A.}
+-          }
+-          break; // next face
+-        }
++	    // myErrorStatus=5; // more than one face has triangulation
++	    // return;
++	    break;
++	    // \end{E.A.}
++	  }
++	  break; // next face
++	}
+       }
+     }
+   }
+@@ -1129,85 +1153,85 @@
+       int has_only_quad_f6 = 1;
+       //
+       for (i=1; i<=iNbF; ++i) {
+-        int ok = 1;
+-        const TopoDS_Shape& aF = aM(i);
+-        SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF);
+-        SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
+-        SMDS_ElemIteratorPtr itf = aSM->GetElements();
+-        while(itf->more()) {
+-          const SMDS_MeshElement * pElement = itf->next();
+-          aElementType = pElement->GetType();
+-          if (aElementType==SMDSAbs_Face) {
+-            iNbNodes = pElement->NbNodes();
+-            if ( iNbNodes!=4 ) {
+-              ok = 0;
+-              break ;
+-            }
+-          }
+-        }
+-        if (i==1) has_only_quad_f1 = ok ;
+-        if (i==2) has_only_quad_f2 = ok ;
+-        if (i==3) has_only_quad_f3 = ok ;
+-        if (i==4) has_only_quad_f4 = ok ;
+-        if (i==5) has_only_quad_f5 = ok ;
+-        if (i==6) has_only_quad_f6 = ok ;
++	int ok = 1;
++	const TopoDS_Shape& aF = aM(i);
++	SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF);
++	SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
++	SMDS_ElemIteratorPtr itf = aSM->GetElements();
++	while(itf->more()) {
++	  const SMDS_MeshElement * pElement = itf->next();
++	  aElementType = pElement->GetType();
++	  if (aElementType==SMDSAbs_Face) {
++	    iNbNodes = pElement->NbNodes();
++	    if ( iNbNodes!=4 ) {
++	      ok = 0;
++	      break ;
++	    }
++	  }
++	}
++	if (i==1) has_only_quad_f1 = ok ;
++	if (i==2) has_only_quad_f2 = ok ;
++	if (i==3) has_only_quad_f3 = ok ;
++	if (i==4) has_only_quad_f4 = ok ;
++	if (i==5) has_only_quad_f5 = ok ;
++	if (i==6) has_only_quad_f6 = ok ;
+       }
+       //
+       TopTools_IndexedMapOfShape aE;
+       TopExp::MapShapes(myShape, TopAbs_EDGE, aE);
+       int iNbE = aE.Extent();
+       if (iNbE == 12) {
+-        //
+-        int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements();
+-        int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements();
+-        int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements();
+-        int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements();
+-        int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements();
+-        int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements();
+-        int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements();
+-        int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements();
+-        int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements();
+-        int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements();
+-        int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements();
+-        int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements();
+-        //
+-        int nb_ok = 0 ;
+-        //
+-        if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) {
+-          if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) {
+-            if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) {
+-              if (nb_f5==nb_f6) {
+-                nb_ok += 1;
+-                aFTr = aM(5);
+-              }
+-            }
+-          }
+-        }
+-        if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) {
+-          if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) {
+-            if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) {
+-              if (nb_f3==nb_f4) {
+-                nb_ok += 1;
+-                aFTr = aM(3);
+-              }
+-            }
+-          }
+-        }
+-        if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) {
+-          if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) {
+-            if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) {
+-              if (nb_f1==nb_f2) {
+-                nb_ok += 1;
+-                aFTr = aM(1);
+-              }
+-            }
+-          }
+-        }
+-        //
+-        if ( nb_ok == 1 ) {
+-          isOK = 1;
+-        }
+-        //
++	//
++	int nb_e01 = pMesh->GetSubMeshContaining(aE(1))->GetSubMeshDS()->NbElements();
++	int nb_e02 = pMesh->GetSubMeshContaining(aE(2))->GetSubMeshDS()->NbElements();
++	int nb_e03 = pMesh->GetSubMeshContaining(aE(3))->GetSubMeshDS()->NbElements();
++	int nb_e04 = pMesh->GetSubMeshContaining(aE(4))->GetSubMeshDS()->NbElements();
++	int nb_e05 = pMesh->GetSubMeshContaining(aE(5))->GetSubMeshDS()->NbElements();
++	int nb_e06 = pMesh->GetSubMeshContaining(aE(6))->GetSubMeshDS()->NbElements();
++	int nb_e07 = pMesh->GetSubMeshContaining(aE(7))->GetSubMeshDS()->NbElements();
++	int nb_e08 = pMesh->GetSubMeshContaining(aE(8))->GetSubMeshDS()->NbElements();
++	int nb_e09 = pMesh->GetSubMeshContaining(aE(9))->GetSubMeshDS()->NbElements();
++	int nb_e10 = pMesh->GetSubMeshContaining(aE(10))->GetSubMeshDS()->NbElements();
++	int nb_e11 = pMesh->GetSubMeshContaining(aE(11))->GetSubMeshDS()->NbElements();
++	int nb_e12 = pMesh->GetSubMeshContaining(aE(12))->GetSubMeshDS()->NbElements();
++	//
++	int nb_ok = 0 ;
++	//
++	if ( (nb_e01==nb_e03) && (nb_e03==nb_e05) && (nb_e05==nb_e07) ) {
++	  if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f3 && has_only_quad_f4 ) {
++	    if ( (nb_e09==nb_e10) && (nb_e08==nb_e06) && (nb_e11==nb_e12) && (nb_e04==nb_e02) ) {
++	      if (nb_f5==nb_f6) {
++		nb_ok += 1;
++		aFTr = aM(5);
++	      }
++	    }
++	  }
++	}
++	if ( (nb_e02==nb_e04) && (nb_e04==nb_e06) && (nb_e06==nb_e08) ) {
++	  if ( has_only_quad_f1 && has_only_quad_f2 && has_only_quad_f5 && has_only_quad_f6 ) {
++	    if ( (nb_e01==nb_e03) && (nb_e10==nb_e12) && (nb_e05==nb_e07) && (nb_e09==nb_e11) ) {
++	      if (nb_f3==nb_f4) {
++		nb_ok += 1;
++		aFTr = aM(3);
++	      }
++	    }
++	  }
++	}
++	if ( (nb_e09==nb_e10) && (nb_e10==nb_e11) && (nb_e11==nb_e12) ) {
++	  if ( has_only_quad_f3 && has_only_quad_f4 && has_only_quad_f5 && has_only_quad_f6 ) {
++	    if ( (nb_e01==nb_e05) && (nb_e02==nb_e06) && (nb_e03==nb_e07) && (nb_e04==nb_e08) ) {
++	      if (nb_f1==nb_f2) {
++		nb_ok += 1;
++		aFTr = aM(1);
++	      }
++	    }
++	  }
++	}
++	//
++	if ( nb_ok == 1 ) {
++	  isOK = 1;
++	}
++	//
+       }
+     }
+     if (!isOK) {
+@@ -1260,11 +1284,11 @@
+       const TopoDS_Edge& aE=TopoDS::Edge(aEx);
+       TopExp::Vertices(aE, aV[0], aV[1]);
+       for (i=0; i<2; ++i) {
+-        if (!aV[i].IsSame(aV000)) {
+-          aV001=aV[i];
+-          bFound=!bFound;
+-          break;
+-        }
++	if (!aV[i].IsSame(aV000)) {
++	  aV001=aV[i];
++	  bFound=!bFound;
++	  break;
++	}
+       }
+     }
+   }
+@@ -1408,7 +1432,7 @@
+   SMESHDS_SubMesh* smVft = theMesh->MeshElements( vft );
+   if (!smFace || !smb || !smt || !sm1 || !sm2 || !smVfb || !smVlb || !smVft ) {
+     MESSAGE( "NULL submesh " <<smFace<<" "<<smb<<" "<<smt<<" "<<
+-             sm1<<" "<<sm2<<" "<<smVfb<<" "<<smVlb<<" "<<smVft);
++            sm1<<" "<<sm2<<" "<<smVfb<<" "<<smVlb<<" "<<smVft);
+     return false;
+   }
+   if ( smb->NbNodes() != smt->NbNodes() || sm1->NbNodes() != sm2->NbNodes() ) {
+@@ -1429,13 +1453,13 @@
+       int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4;
+       if( nf != smFace->NbNodes() ) {
+         MESSAGE( "Wrong nb face nodes: " <<
+-                 sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
++                sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
+         return false;
+       }
+     }
+     else {
+       MESSAGE( "Wrong nb face nodes: " <<
+-               sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
++              sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
+       return false;
+     }
+   }
+@@ -1570,7 +1594,7 @@
+           }
+         }
+         else if ( (nbFaceNodes==3 || (myCreateQuadratic && nbFaceNodes==6) )  &&
+-                  n3 == par_nVec_1->second[ row ] ) {
++                 n3 == par_nVec_1->second[ row ] ) {
+           n1 = n3;
+         }
+         else {
+@@ -1677,8 +1701,8 @@
+ //purpose  : 
+ //=======================================================================
+ void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell,
+-                                 const TopoDS_Vertex& theV000,
+-                                 const TopoDS_Vertex& theV001)
++				 const TopoDS_Vertex& theV000,
++				 const TopoDS_Vertex& theV001)
+ {
+   myErrorStatus=0;
+   //
+@@ -1699,7 +1723,7 @@
+ //purpose  : 
+ //=======================================================================
+ void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt, 
+-                                              gp_XYZ& theXYZ)
++					      gp_XYZ& theXYZ)
+ {
+   ComputeParameters(thePnt, myShell, theXYZ);
+ }
+@@ -1709,7 +1733,7 @@
+ //purpose  : 
+ //=======================================================================
+ void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt,
+-                                              const TopoDS_Shape& theShape,
++					      const TopoDS_Shape& theShape,
+                                               gp_XYZ& theXYZ)
+ {
+   myErrorStatus=0;
+@@ -1747,7 +1771,7 @@
+     return;
+   }
+   if ( SMESH_Block::IsEdgeID( aID ))
+-    bOk = myTBlock.EdgeParameters( aID, theU, theXYZ );
++      bOk = myTBlock.EdgeParameters( aID, theU, theXYZ );
+   if (!bOk) {
+     myErrorStatus=4; // problems with computation Parameters 
+     return;
+@@ -1758,7 +1782,8 @@
+ //function : Point
+ //purpose  : 
+ //=======================================================================
+-void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams, gp_Pnt& aP3D)
++ void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
++				   gp_Pnt& aP3D)
+ {
+   TopoDS_Shape aS;
+   //
+@@ -1769,9 +1794,9 @@
+ //function : Point
+ //purpose  : 
+ //=======================================================================
+-void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
+-                                  const TopoDS_Shape& theShape,
+-                                  gp_Pnt& aP3D)
++ void StdMeshers_SMESHBlock::Point(const gp_XYZ& theParams,
++				   const TopoDS_Shape& theShape,
++				   gp_Pnt& aP3D)
+ {
+   myErrorStatus = 0;
+   //
+@@ -1857,112 +1882,3 @@
+ }
+ 
+ 
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-bool StdMeshers_Penta_3D::Evaluate(SMESH_Mesh& aMesh, 
+-                                   const TopoDS_Shape& aShape,
+-                                   MapShapeNbElems& aResMap)
+-{
+-  MESSAGE("StdMeshers_Penta_3D::Evaluate()");
+-
+-  // find face contains only triangles
+-  vector < SMESH_subMesh * >meshFaces;
+-  TopTools_SequenceOfShape aFaces;
+-  int NumBase = 0, i = 0;
+-  for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
+-    i++;
+-    aFaces.Append(exp.Current());
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+-    meshFaces.push_back(aSubMesh);
+-    MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i]);
+-    if( anIt == aResMap.end() ) {
+-      NumBase = 0;
+-      break;
+-    }
+-    std::vector<int> aVec = (*anIt).second;
+-    int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+-    int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-    if( nbtri>0 && nbqua==0 ) {
+-      NumBase = i;
+-    }
+-  }
+-
+-  if(NumBase==0) {
+-    std::vector<int> aResVec(SMDSEntity_Last);
+-    for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-    SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-    aResMap.insert(std::make_pair(sm,aResVec));
+-    myErrorStatus->myName    = COMPERR_ALGO_FAILED;
+-    myErrorStatus->myComment = "Submesh can not be evaluated";
+-    return false;
+-  }
+-
+-  // find number of 1d elems for base face
+-  int nb1d = 0;
+-  TopTools_MapOfShape Edges1;
+-  for (TopExp_Explorer exp(aFaces.Value(NumBase), TopAbs_EDGE); exp.More(); exp.Next()) {
+-    Edges1.Add(exp.Current());
+-    SMESH_subMesh *sm = aMesh.GetSubMesh(exp.Current());
+-    if( sm ) {
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      if( anIt == aResMap.end() ) continue;
+-      std::vector<int> aVec = (*anIt).second;
+-      nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-    }
+-  }
+-  // find face opposite to base face
+-  int OppNum = 0;
+-  for(i=1; i<=6; i++) {
+-    if(i==NumBase) continue;
+-    bool IsOpposite = true;
+-    for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) {
+-      if( Edges1.Contains(exp.Current()) ) {
+-        IsOpposite = false;
+-        break;
+-      }
+-    }
+-    if(IsOpposite) {
+-      OppNum = i;
+-      break;
+-    }
+-  }
+-  // find number of 2d elems on side faces
+-  int nb2d = 0;
+-  for(i=1; i<=6; i++) {
+-    if( i==OppNum || i==NumBase ) continue;
+-    MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] );
+-    if( anIt == aResMap.end() ) continue;
+-    std::vector<int> aVec = (*anIt).second;
+-    nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  }
+-
+-  MapShapeNbElemsItr anIt = aResMap.find( meshFaces[NumBase-1] );
+-  std::vector<int> aVec = (*anIt).second;
+-  int nb2d_face0 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  int nb0d_face0 = aVec[SMDSEntity_Node];
+-
+-  anIt = aResMap.find( meshFaces[OppNum-1] );
+-  for(i=SMDSEntity_Node; i<SMDSEntity_Last; i++)
+-    (*anIt).second[i] = aVec[i];
+-
+-  SMESH_MesherHelper aTool (aMesh);
+-  bool _quadraticMesh = aTool.IsQuadraticSubMesh(aShape);
+-
+-  std::vector<int> aResVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-  if(_quadraticMesh) {
+-    aResVec[SMDSEntity_Quad_Penta] = nb2d_face0 * ( nb2d/nb1d );
+-    aResVec[SMDSEntity_Node] = nb0d_face0 * ( 2*nb2d/nb1d - 1 );
+-  }
+-  else {
+-    aResVec[SMDSEntity_Node] = nb0d_face0 * ( nb2d/nb1d - 1 );
+-    aResVec[SMDSEntity_Penta] = nb2d_face0 * ( nb2d/nb1d );
+-  }
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aResVec));
+-
+-  return true;
+-}
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Prism_3D.cpp salomesmesh/src/StdMeshers/StdMeshers_Prism_3D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Prism_3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Prism_3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -42,8 +42,6 @@
+ #include <TopExp.hxx>
+ #include <TopExp_Explorer.hxx>
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+-#include <TopTools_SequenceOfShape.hxx>
+-#include <TopTools_MapOfShape.hxx>
+ #include <TopoDS.hxx>
+ 
+ using namespace std;
+@@ -368,121 +366,6 @@
+   return true;
+ }
+ 
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh,
+-				   const TopoDS_Shape& theShape,
+-				   MapShapeNbElems& aResMap)
+-{
+-  // find face contains only triangles
+-  vector < SMESH_subMesh * >meshFaces;
+-  TopTools_SequenceOfShape aFaces;
+-  int NumBase = 0, i = 0, NbQFs = 0;
+-  for (TopExp_Explorer exp(theShape, TopAbs_FACE); exp.More(); exp.Next()) {
+-    i++;
+-    aFaces.Append(exp.Current());
+-    SMESH_subMesh *aSubMesh = theMesh.GetSubMesh(exp.Current());
+-    meshFaces.push_back(aSubMesh);
+-    MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i-1]);
+-    if( anIt==aResMap.end() ) {
+-      SMESH_ComputeErrorPtr& smError = aSubMesh->GetComputeError();
+-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-      return false;
+-    }
+-    std::vector<int> aVec = (*anIt).second;
+-    int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+-    int nbqua = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-    if( nbtri==0 && nbqua>0 ) {
+-      NbQFs++;
+-    }
+-    if( nbtri>0 ) {
+-      NumBase = i;
+-    }
+-  }
+-
+-  if(NbQFs<4) {
+-    std::vector<int> aResVec(SMDSEntity_Last);
+-    for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-    SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
+-    aResMap.insert(std::make_pair(sm,aResVec));
+-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-    return false;
+-  }
+-
+-  if(NumBase==0) NumBase = 1; // only quads => set 1 faces as base
+-
+-  // find number of 1d elems for base face
+-  int nb1d = 0;
+-  TopTools_MapOfShape Edges1;
+-  for (TopExp_Explorer exp(aFaces.Value(NumBase), TopAbs_EDGE); exp.More(); exp.Next()) {
+-    Edges1.Add(exp.Current());
+-    SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current());
+-    if( sm ) {
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      if( anIt == aResMap.end() ) continue;
+-      std::vector<int> aVec = (*anIt).second;
+-      nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-    }
+-  }
+-  // find face opposite to base face
+-  int OppNum = 0;
+-  for(i=1; i<=6; i++) {
+-    if(i==NumBase) continue;
+-    bool IsOpposite = true;
+-    for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) {
+-      if( Edges1.Contains(exp.Current()) ) {
+-	IsOpposite = false;
+-	break;
+-      }
+-    }
+-    if(IsOpposite) {
+-      OppNum = i;
+-      break;
+-    }
+-  }
+-  // find number of 2d elems on side faces
+-  int nb2d = 0;
+-  for(i=1; i<=6; i++) {
+-    if( i==OppNum || i==NumBase ) continue;
+-    MapShapeNbElemsItr anIt = aResMap.find( meshFaces[i-1] );
+-    if( anIt == aResMap.end() ) continue;
+-    std::vector<int> aVec = (*anIt).second;
+-    nb2d += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  }
+-  
+-  MapShapeNbElemsItr anIt = aResMap.find( meshFaces[NumBase-1] );
+-  std::vector<int> aVec = (*anIt).second;
+-  bool IsQuadratic = (aVec[SMDSEntity_Quad_Triangle]>aVec[SMDSEntity_Triangle]) ||
+-                     (aVec[SMDSEntity_Quad_Quadrangle]>aVec[SMDSEntity_Quadrangle]);
+-  int nb2d_face0_3 = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+-  int nb2d_face0_4 = Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  int nb0d_face0 = aVec[SMDSEntity_Node];
+-  int nb1d_face0_int = ( nb2d_face0_3*3 + nb2d_face0_4*4 - nb1d ) / 2;
+-
+-  std::vector<int> aResVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-  if(IsQuadratic) {
+-    aResVec[SMDSEntity_Quad_Penta] = nb2d_face0_3 * ( nb2d/nb1d );
+-    aResVec[SMDSEntity_Quad_Hexa] = nb2d_face0_4 * ( nb2d/nb1d );
+-    aResVec[SMDSEntity_Node] = nb0d_face0 * ( 2*nb2d/nb1d - 1 ) - nb1d_face0_int * nb2d/nb1d;
+-  }
+-  else {
+-    aResVec[SMDSEntity_Node] = nb0d_face0 * ( nb2d/nb1d - 1 );
+-    aResVec[SMDSEntity_Penta] = nb2d_face0_3 * ( nb2d/nb1d );
+-    aResVec[SMDSEntity_Hexa] = nb2d_face0_4 * ( nb2d/nb1d );
+-  }
+-  SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
+-  aResMap.insert(std::make_pair(sm,aResVec));
+-
+-  return true;
+-}
+-
+-
+ //================================================================================
+ /*!
+  * \brief Create prisms
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Projection_1D.cpp salomesmesh/src/StdMeshers/StdMeshers_Projection_1D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Projection_1D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Projection_1D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -372,97 +372,6 @@
+   return true;
+ }
+ 
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_Projection_1D::Evaluate(SMESH_Mesh& theMesh,
+-					const TopoDS_Shape& theShape,
+-					MapShapeNbElems& aResMap)
+-{
+-  if ( !_sourceHypo )
+-    return false;
+-
+-  SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh(); 
+-  SMESH_Mesh * tgtMesh = & theMesh;
+-  if ( !srcMesh )
+-    srcMesh = tgtMesh;
+-
+-  SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
+-
+-  // ---------------------------
+-  // Make subshapes association
+-  // ---------------------------
+-
+-  TopoDS_Edge srcEdge, tgtEdge = TopoDS::Edge( theShape.Oriented(TopAbs_FORWARD));
+-  TopoDS_Shape srcShape = _sourceHypo->GetSourceEdge().Oriented(TopAbs_FORWARD);
+-
+-  TAssocTool::TShapeShapeMap shape2ShapeMap;
+-  TAssocTool::InitVertexAssociation( _sourceHypo, shape2ShapeMap, tgtEdge );
+-  if ( !TAssocTool::FindSubShapeAssociation( tgtEdge, tgtMesh, srcShape, srcMesh,
+-                                             shape2ShapeMap) ||
+-       !shape2ShapeMap.IsBound( tgtEdge ))
+-    return error("Vertices association failed" );
+-
+-  srcEdge = TopoDS::Edge( shape2ShapeMap( tgtEdge ).Oriented(TopAbs_FORWARD));
+-//   cout << " srcEdge #" << srcMesh->GetMeshDS()->ShapeToIndex( srcEdge )
+-//        << " tgtEdge #" << tgtMesh->GetMeshDS()->ShapeToIndex( tgtEdge ) << endl;
+-
+-  TopoDS_Vertex tgtV[2], srcV[2];
+-  TopExp::Vertices( tgtEdge, tgtV[0], tgtV[1] );
+-  TopExp::Vertices( srcEdge, srcV[0], srcV[1] );
+-
+-  // ----------------------------------------------
+-  // Assure that mesh on a source edge is computed
+-  // ----------------------------------------------
+-
+-  SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( srcEdge );
+-  //SMESH_subMesh* tgtSubMesh = tgtMesh->GetSubMesh( tgtEdge );
+-
+-  if ( tgtMesh == srcMesh ) {
+-    if ( !TAssocTool::MakeComputed( srcSubMesh ))
+-      return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
+-  }
+-  else {
+-    if ( !srcSubMesh->IsMeshComputed() )
+-      return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
+-  }
+-  // -----------------------------------------------
+-  // Find out nodes distribution on the source edge
+-  // -----------------------------------------------
+-
+-  double srcLength = EdgeLength( srcEdge );
+-  double tgtLength = EdgeLength( tgtEdge );
+-  
+-  vector< double > params; // sorted parameters of nodes on the source edge
+-  if ( !SMESH_Algo::GetNodeParamOnEdge( srcMesh->GetMeshDS(), srcEdge, params ))
+-    return error(COMPERR_BAD_INPUT_MESH,"Bad node parameters on the source edge");
+-
+-  int nbNodes = params.size();
+-
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
+-
+-  aVec[SMDSEntity_Node] = nbNodes;
+-
+-  bool quadratic = false;
+-  SMDS_ElemIteratorPtr elemIt = srcSubMesh->GetSubMeshDS()->GetElements();
+-  if ( elemIt->more() )
+-    quadratic = elemIt->next()->IsQuadratic();
+-  if(quadratic)
+-    aVec[SMDSEntity_Quad_Edge] = (nbNodes-1)/2;
+-  else
+-    aVec[SMDSEntity_Edge] = nbNodes - 1;
+-
+-  SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+-
+-
+ //=============================================================================
+ /*!
+  * \brief Sets a default event listener to submesh of the source edge
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Projection_2D.cpp salomesmesh/src/StdMeshers/StdMeshers_Projection_2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Projection_2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Projection_2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -354,103 +354,8 @@
+ 
+   } // bool getBoundaryNodes()
+ 
+-  //================================================================================
+-  /*!
+-   * \brief Preform projection in case if tgtFace.IsPartner( srcFace )
+-   *  \param tgtFace - target face
+-   *  \param srcFace - source face
+-   *  \param tgtMesh - target mesh
+-   *  \param srcMesh - source mesh
+-   *  \retval bool - true if succeeded
+-   */
+-  //================================================================================
+-
+-  bool projectPartner(const TopoDS_Face&                tgtFace,
+-                      const TopoDS_Face&                srcFace,
+-                      SMESH_Mesh *                      tgtMesh,
+-                      SMESH_Mesh *                      srcMesh,
+-                      const TAssocTool::TShapeShapeMap& shape2ShapeMap)
+-  {
+-    if ( !tgtFace.IsPartner( srcFace ))
+-      return false;
+-
+-    // Fill map of src to tgt nodes with nodes on edges
+-
+-    map<const SMDS_MeshNode* , const SMDS_MeshNode*> src2tgtNodes;
+-    map<const SMDS_MeshNode* , const SMDS_MeshNode*>::iterator srcN_tgtN;
+-
+-    for ( TopExp_Explorer srcEdge( srcFace, TopAbs_EDGE); srcEdge.More(); srcEdge.Next() )
+-    {
+-      const TopoDS_Shape& tgtEdge = shape2ShapeMap( srcEdge.Current() );
+-      if ( !tgtEdge.IsPartner( srcEdge.Current() ))
+-        return false;
+-
+-      map< double, const SMDS_MeshNode* > srcNodes, tgtNodes;
+-      if ( !SMESH_Algo::GetSortedNodesOnEdge( srcMesh->GetMeshDS(),
+-                                              TopoDS::Edge( srcEdge.Current() ),
+-                                              /*ignoreMediumNodes = */true,
+-                                              srcNodes )
+-           ||
+-           !SMESH_Algo::GetSortedNodesOnEdge( tgtMesh->GetMeshDS(),
+-                                              TopoDS::Edge( tgtEdge ),
+-                                              /*ignoreMediumNodes = */true,
+-                                              tgtNodes )
+-           ||
+-           srcNodes.size() != tgtNodes.size())
+-        return false;
+-
+-      map< double, const SMDS_MeshNode* >::iterator u_tn = tgtNodes.begin();
+-      map< double, const SMDS_MeshNode* >::iterator u_sn = srcNodes.begin();
+-      for ( ; u_tn != tgtNodes.end(); ++u_tn, ++u_sn)
+-        src2tgtNodes.insert( make_pair( u_sn->second, u_tn->second ));
+-    }
+-
+-    // Make new faces
+-
+-    // transformation to get location of target nodes from source ones
+-    gp_Trsf srcTrsf = srcFace.Location();
+-    gp_Trsf tgtTrsf = tgtFace.Location();
+-    gp_Trsf trsf = srcTrsf.Inverted() * tgtTrsf;
+-
+-    // prepare the helper adding quadratic elements if necessary
+-    SMESH_MesherHelper helper( *tgtMesh );
+-    helper.IsQuadraticSubMesh( tgtFace );
+-    helper.SetElementsOnShape( true );
+-
+-    const SMDS_MeshNode* nullNode = 0;
+-
+-    SMESHDS_SubMesh* srcSubDS = srcMesh->GetMeshDS()->MeshElements( srcFace );
+-    SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements();
+-    while ( elemIt->more() ) // loop on all mesh faces on srcFace
+-    {
+-      const SMDS_MeshElement* elem = elemIt->next();
+-      vector< const SMDS_MeshNode* > tgtFaceNodes;
+-      tgtFaceNodes.reserve( elem->NbNodes() );
+-      SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
+-      while ( nodeIt->more() ) // loop on nodes of the source element
+-      {
+-        const SMDS_MeshNode* srcNode = (const SMDS_MeshNode*) nodeIt->next();
+-        srcN_tgtN = src2tgtNodes.insert( make_pair( srcNode, nullNode )).first;
+-        if ( srcN_tgtN->second == nullNode )
+-        {
+-          // create a new node
+-          gp_Pnt tgtP = gp_Pnt(srcNode->X(),srcNode->Y(),srcNode->Z()).Transformed( trsf );
+-          srcN_tgtN->second = helper.AddNode( tgtP.X(), tgtP.Y(), tgtP.Z() );
+-        }
+-        tgtFaceNodes.push_back( srcN_tgtN->second );
+-      }
+-      // create a new face (with reversed orientation)
+-      if ( tgtFaceNodes.size() == 3 )
+-        helper.AddFace( tgtFaceNodes[0],tgtFaceNodes[2],tgtFaceNodes[1]);
+-      else
+-        helper.AddFace( tgtFaceNodes[0],tgtFaceNodes[3],tgtFaceNodes[2],tgtFaceNodes[1]);
+-    }
+-    return true;
+-  }
+-
+ } // namespace
+ 
+-
+ //=======================================================================
+ //function : Compute
+ //purpose  : 
+@@ -500,10 +405,6 @@
+       return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
+   }
+ 
+-  // try to project from same face with different location
+-  if ( projectPartner( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap ))
+-    return true;
+-
+   // --------------------
+   // Prepare to mapping 
+   // --------------------
+@@ -741,83 +642,6 @@
+   return true;
+ }
+ 
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_Projection_2D::Evaluate(SMESH_Mesh& theMesh,
+-					const TopoDS_Shape& theShape,
+-					MapShapeNbElems& aResMap)
+-{
+-  if ( !_sourceHypo )
+-    return false;
+-
+-  SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh();
+-  SMESH_Mesh * tgtMesh = & theMesh;
+-  if ( !srcMesh )
+-    srcMesh = tgtMesh;
+-
+-  // ---------------------------
+-  // Make subshapes association
+-  // ---------------------------
+-
+-  TopoDS_Face tgtFace = TopoDS::Face( theShape.Oriented(TopAbs_FORWARD));
+-  TopoDS_Shape srcShape = _sourceHypo->GetSourceFace().Oriented(TopAbs_FORWARD);
+-
+-  TAssocTool::TShapeShapeMap shape2ShapeMap;
+-  TAssocTool::InitVertexAssociation( _sourceHypo, shape2ShapeMap, tgtFace );
+-  if ( !TAssocTool::FindSubShapeAssociation( tgtFace, tgtMesh, srcShape, srcMesh,
+-                                             shape2ShapeMap)  ||
+-       !shape2ShapeMap.IsBound( tgtFace ))
+-    return error(COMPERR_BAD_SHAPE,"Topology of source and target faces seems different" );
+-
+-  TopoDS_Face srcFace = TopoDS::Face( shape2ShapeMap( tgtFace ).Oriented(TopAbs_FORWARD));
+-
+-  // ----------------------------------------------
+-  // Assure that mesh on a source Face is computed
+-  // ----------------------------------------------
+-
+-  SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( srcFace );
+-
+-  if ( !srcSubMesh->IsMeshComputed() )
+-    return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
+-
+-
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
+-
+-  aVec[SMDSEntity_Node] = srcSubMesh->GetSubMeshDS()->NbNodes();
+-
+-  //bool quadratic = false;
+-  SMDS_ElemIteratorPtr elemIt = srcSubMesh->GetSubMeshDS()->GetElements();
+-  while ( elemIt->more() ) {
+-    const SMDS_MeshElement* E  = elemIt->next();
+-    if( E->NbNodes()==3 ) {
+-      aVec[SMDSEntity_Triangle]++;
+-    }
+-    else if( E->NbNodes()==4 ) {
+-      aVec[SMDSEntity_Quadrangle]++;
+-    }
+-    else if( E->NbNodes()==6 && E->IsQuadratic() ) {
+-      aVec[SMDSEntity_Quad_Triangle]++;
+-    }
+-    else if( E->NbNodes()==8 && E->IsQuadratic() ) {
+-      aVec[SMDSEntity_Quad_Quadrangle]++;
+-    }
+-    else {
+-      aVec[SMDSEntity_Polygon]++;
+-    }
+-  }
+-
+-  SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+-
+-
+ //=============================================================================
+ /*!
+  * \brief Sets a default event listener to submesh of the source face
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Projection_3D.cpp salomesmesh/src/StdMeshers/StdMeshers_Projection_3D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Projection_3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Projection_3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -68,7 +68,7 @@
+   :SMESH_3D_Algo(hypId, studyId, gen)
+ {
+   _name = "Projection_3D";
+-  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);  // 1 bit per shape type
++  _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);	// 1 bit per shape type
+ 
+   _compatibleHypothesis.push_back("ProjectionSource3D");
+   _sourceHypo = 0;
+@@ -308,9 +308,9 @@
+     TNodeNodeMap faceMatchingNodes;
+     if ( ! TAssocTool::FindMatchingNodesOnFaces( srcFace, srcMesh, tgtFace, tgtMesh, 
+                                                  shape2ShapeMap, faceMatchingNodes ))
+-      return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Mesh on faces #")
+-                   << srcMeshDS->ShapeToIndex( srcFace ) << " and "
+-                   << tgtMeshDS->ShapeToIndex( tgtFace ) << " seems different" );
++    return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Mesh on faces #")
++                 << srcMeshDS->ShapeToIndex( srcFace ) << " and "
++                 << tgtMeshDS->ShapeToIndex( tgtFace ) << " seems different" );
+ 
+     // put found matching nodes of 2 faces to the global map
+     src2tgtNodeMap.insert( faceMatchingNodes.begin(), faceMatchingNodes.end() );
+@@ -420,104 +420,6 @@
+   return true;
+ }
+ 
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_Projection_3D::Evaluate(SMESH_Mesh& aMesh,
+-                                        const TopoDS_Shape& aShape,
+-                                        MapShapeNbElems& aResMap)
+-{
+-  if ( !_sourceHypo )
+-    return false;
+-
+-  SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh();
+-  SMESH_Mesh * tgtMesh = & aMesh;
+-  if ( !srcMesh )
+-    srcMesh = tgtMesh;
+-
+-  // get shell from shape3D
+-  TopoDS_Shell srcShell, tgtShell;
+-  TopExp_Explorer exp( _sourceHypo->GetSource3DShape(), TopAbs_SHELL );
+-  int nbShell;
+-  for ( nbShell = 0; exp.More(); exp.Next(), ++nbShell )
+-    srcShell = TopoDS::Shell( exp.Current() );
+-  if ( nbShell != 1 )
+-    return error(COMPERR_BAD_SHAPE,
+-                 SMESH_Comment("Source shape must have 1 shell but not ") << nbShell);
+-
+-  exp.Init( aShape, TopAbs_SHELL );
+-  for ( nbShell = 0; exp.More(); exp.Next(), ++nbShell )
+-    tgtShell = TopoDS::Shell( exp.Current() );
+-  if ( nbShell != 1 )
+-    return error(COMPERR_BAD_SHAPE,
+-                 SMESH_Comment("Target shape must have 1 shell but not ") << nbShell);
+-
+-  // Check that shapes are blocks
+-  if ( TAssocTool::Count( tgtShell, TopAbs_FACE , 1 ) != 6 ||
+-       TAssocTool::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 ||
+-       TAssocTool::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 )
+-    return error(COMPERR_BAD_SHAPE, "Target shape is not a block");
+-  if ( TAssocTool::Count( srcShell, TopAbs_FACE , 1 ) != 6 ||
+-       TAssocTool::Count( srcShell, TopAbs_EDGE , 1 ) != 12 ||
+-       TAssocTool::Count( srcShell, TopAbs_WIRE , 1 ) != 6 )
+-    return error(COMPERR_BAD_SHAPE, "Source shape is not a block");
+-
+-  // Assure that mesh on a source shape is computed
+-
+-  SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( _sourceHypo->GetSource3DShape() );
+-
+-  if ( !srcSubMesh->IsMeshComputed() )
+-    return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
+-
+-
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
+-
+-  aVec[SMDSEntity_Node] = srcSubMesh->GetSubMeshDS()->NbNodes();
+-
+-  //bool quadratic = false;
+-  SMDS_ElemIteratorPtr elemIt = srcSubMesh->GetSubMeshDS()->GetElements();
+-  while ( elemIt->more() ) {
+-    const SMDS_MeshElement* E  = elemIt->next();
+-    if( E->NbNodes()==4 ) {
+-      aVec[SMDSEntity_Tetra]++;
+-    }
+-    else if( E->NbNodes()==5 ) {
+-      aVec[SMDSEntity_Pyramid]++;
+-    }
+-    else if( E->NbNodes()==6 ) {
+-      aVec[SMDSEntity_Penta]++;
+-    }
+-    else if( E->NbNodes()==8 ) {
+-      aVec[SMDSEntity_Hexa]++;
+-    }
+-    else if( E->NbNodes()==10 && E->IsQuadratic() ) {
+-      aVec[SMDSEntity_Quad_Tetra]++;
+-    }
+-    else if( E->NbNodes()==13 && E->IsQuadratic() ) {
+-      aVec[SMDSEntity_Quad_Pyramid]++;
+-    }
+-    else if( E->NbNodes()==15 && E->IsQuadratic() ) {
+-      aVec[SMDSEntity_Quad_Penta]++;
+-    }
+-    else if( E->NbNodes()==20 && E->IsQuadratic() ) {
+-      aVec[SMDSEntity_Quad_Hexa]++;
+-    }
+-    else {
+-      aVec[SMDSEntity_Polyhedra]++;
+-    }
+-  }
+-
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+-
+-
+ //=============================================================================
+ /*!
+  * \brief Sets a default event listener to submesh of the source shape
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionSource1D.cpp salomesmesh/src/StdMeshers/StdMeshers_ProjectionSource1D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionSource1D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_ProjectionSource1D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_ProjectionSource1D.cxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource1D.cxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #include "StdMeshers_ProjectionSource1D.hxx"
+ 
+@@ -72,13 +73,13 @@
+ //=============================================================================
+ 
+ void StdMeshers_ProjectionSource1D::SetSourceEdge(const TopoDS_Shape& edge)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( edge.IsNull() )
+-    throw SALOME_Exception(LOCALIZED("Null edge is not allowed"));
++    throw SMESH_Exception(LOCALIZED("Null edge is not allowed"));
+ 
+   if ( edge.ShapeType() != TopAbs_EDGE && edge.ShapeType() != TopAbs_COMPOUND )
+-    throw SALOME_Exception(LOCALIZED("Wrong shape type"));
++    throw SMESH_Exception(LOCALIZED("Wrong shape type"));
+ 
+   if ( !_sourceEdge.IsSame( edge ) )
+   {
+@@ -97,15 +98,15 @@
+ 
+ void StdMeshers_ProjectionSource1D::SetVertexAssociation(const TopoDS_Shape& sourceVertex,
+                                                          const TopoDS_Shape& targetVertex)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( sourceVertex.IsNull() != targetVertex.IsNull() )
+-    throw SALOME_Exception(LOCALIZED("Two or none vertices must be provided"));
++    throw SMESH_Exception(LOCALIZED("Two or none vertices must be provided"));
+ 
+   if ( !sourceVertex.IsNull() ) {
+     if ( sourceVertex.ShapeType() != TopAbs_VERTEX ||
+          targetVertex.ShapeType() != TopAbs_VERTEX )
+-      throw SALOME_Exception(LOCALIZED("Wrong shape type"));
++      throw SMESH_Exception(LOCALIZED("Wrong shape type"));
+   }
+ 
+   if ( !_sourceVertex.IsSame( sourceVertex ) ||
+@@ -241,4 +242,3 @@
+ {
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionSource2D.cpp salomesmesh/src/StdMeshers/StdMeshers_ProjectionSource2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionSource2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_ProjectionSource2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,8 @@
+ //  File   : StdMeshers_ProjectionSource2D.cxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource2D.cxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $
++//
+ #include "StdMeshers_ProjectionSource2D.hxx"
+ 
+ #include "SMESH_Mesh.hxx"
+@@ -71,13 +72,13 @@
+ //=============================================================================
+ 
+ void StdMeshers_ProjectionSource2D::SetSourceFace(const TopoDS_Shape& Face)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( Face.IsNull() )
+-    throw SALOME_Exception(LOCALIZED("Null Face is not allowed"));
++    throw SMESH_Exception(LOCALIZED("Null Face is not allowed"));
+ 
+   if ( Face.ShapeType() != TopAbs_FACE && Face.ShapeType() != TopAbs_COMPOUND )
+-    throw SALOME_Exception(LOCALIZED("Wrong shape type"));
++    throw SMESH_Exception(LOCALIZED("Wrong shape type"));
+ 
+   if ( !_sourceFace.IsSame( Face ) )
+   {
+@@ -99,19 +100,19 @@
+                                                          const TopoDS_Shape& sourceVertex2,
+                                                          const TopoDS_Shape& targetVertex1,
+                                                          const TopoDS_Shape& targetVertex2)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( sourceVertex1.IsNull() != targetVertex1.IsNull() ||
+        sourceVertex2.IsNull() != targetVertex2.IsNull() ||
+        sourceVertex1.IsNull() != targetVertex2.IsNull() )
+-    throw SALOME_Exception(LOCALIZED("Two or none pairs of vertices must be provided"));
++    throw SMESH_Exception(LOCALIZED("Two or none pairs of vertices must be provided"));
+ 
+   if ( !sourceVertex1.IsNull() ) {
+     if ( sourceVertex1.ShapeType() != TopAbs_VERTEX ||
+          sourceVertex2.ShapeType() != TopAbs_VERTEX ||
+          targetVertex1.ShapeType() != TopAbs_VERTEX ||
+          targetVertex2.ShapeType() != TopAbs_VERTEX )
+-      throw SALOME_Exception(LOCALIZED("Wrong shape type"));
++      throw SMESH_Exception(LOCALIZED("Wrong shape type"));
+   }
+ 
+   if ( !_sourceVertex1.IsSame( sourceVertex1 ) ||
+@@ -136,10 +137,9 @@
+ 
+ void StdMeshers_ProjectionSource2D::SetSourceMesh(SMESH_Mesh* mesh)
+ {
+-  if ( _sourceMesh != mesh ) {
++  if ( _sourceMesh != mesh )
+     _sourceMesh = mesh;
+     NotifySubMeshesHypothesisModification();
+-  }
+ }
+ 
+ //=============================================================================
+@@ -161,14 +161,14 @@
+ //=============================================================================
+ 
+ TopoDS_Vertex StdMeshers_ProjectionSource2D::GetSourceVertex(int i) const
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( i == 1 )
+     return _sourceVertex1;
+   else if ( i == 2 )
+     return _sourceVertex2;
+   else
+-    throw SALOME_Exception(LOCALIZED("Wrong vertex index"));
++    throw SMESH_Exception(LOCALIZED("Wrong vertex index"));
+ }
+ 
+ //=============================================================================
+@@ -179,14 +179,14 @@
+ //=============================================================================
+ 
+ TopoDS_Vertex StdMeshers_ProjectionSource2D::GetTargetVertex(int i) const
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( i == 1 )
+     return _targetVertex1;
+   else if ( i == 2 )
+     return _targetVertex2;
+   else
+-    throw SALOME_Exception(LOCALIZED("Wrong vertex index"));
++    throw SMESH_Exception(LOCALIZED("Wrong vertex index"));
+ }
+ 
+ //=============================================================================
+@@ -309,4 +309,3 @@
+ {
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionSource3D.cpp salomesmesh/src/StdMeshers/StdMeshers_ProjectionSource3D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionSource3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_ProjectionSource3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,8 @@
+ //  File   : StdMeshers_ProjectionSource3D.cxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource3D.cxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #include "StdMeshers_ProjectionSource3D.hxx"
+ 
+ #include "utilities.h"
+@@ -70,13 +71,13 @@
+ //=============================================================================
+ 
+ void StdMeshers_ProjectionSource3D::SetSource3DShape(const TopoDS_Shape& Shape)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( Shape.IsNull() )
+-    throw SALOME_Exception(LOCALIZED("Null Shape is not allowed"));
++    throw SMESH_Exception(LOCALIZED("Null Shape is not allowed"));
+ 
+   if ( SMESH_Gen::GetShapeDim( Shape ) != 3 )
+-    throw SALOME_Exception(LOCALIZED("Wrong shape type"));
++    throw SMESH_Exception(LOCALIZED("Wrong shape type"));
+ 
+   if ( !_sourceShape.IsSame( Shape ) )
+   {
+@@ -98,19 +99,19 @@
+                                                          const TopoDS_Shape& sourceVertex2,
+                                                          const TopoDS_Shape& targetVertex1,
+                                                          const TopoDS_Shape& targetVertex2)
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( sourceVertex1.IsNull() != targetVertex1.IsNull() ||
+        sourceVertex2.IsNull() != targetVertex2.IsNull() ||
+        sourceVertex1.IsNull() != targetVertex2.IsNull() )
+-    throw SALOME_Exception(LOCALIZED("Two or none pairs of vertices must be provided"));
++    throw SMESH_Exception(LOCALIZED("Two or none pairs of vertices must be provided"));
+ 
+   if ( !sourceVertex1.IsNull() ) {
+     if ( sourceVertex1.ShapeType() != TopAbs_VERTEX ||
+          sourceVertex2.ShapeType() != TopAbs_VERTEX ||
+          targetVertex1.ShapeType() != TopAbs_VERTEX ||
+          targetVertex2.ShapeType() != TopAbs_VERTEX )
+-      throw SALOME_Exception(LOCALIZED("Wrong shape type"));
++      throw SMESH_Exception(LOCALIZED("Wrong shape type"));
+   }
+ 
+   if ( !_sourceVertex1.IsSame( sourceVertex1 ) ||
+@@ -135,10 +136,9 @@
+ 
+ void StdMeshers_ProjectionSource3D::SetSourceMesh(SMESH_Mesh* mesh)
+ {
+-  if ( _sourceMesh != mesh ) {
++  if ( _sourceMesh != mesh )
+     _sourceMesh = mesh;
+     NotifySubMeshesHypothesisModification();
+-  }
+ }
+ 
+ //=============================================================================
+@@ -160,14 +160,14 @@
+ //=============================================================================
+ 
+ TopoDS_Vertex StdMeshers_ProjectionSource3D::GetSourceVertex(int i) const
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( i == 1 )
+     return _sourceVertex1;
+   else if ( i == 2 )
+     return _sourceVertex2;
+   else
+-    throw SALOME_Exception(LOCALIZED("Wrong vertex index"));
++    throw SMESH_Exception(LOCALIZED("Wrong vertex index"));
+ }
+ 
+ //=============================================================================
+@@ -178,14 +178,14 @@
+ //=============================================================================
+ 
+ TopoDS_Vertex StdMeshers_ProjectionSource3D::GetTargetVertex(int i) const
+-  throw ( SALOME_Exception )
++  throw ( SMESH_Exception )
+ {
+   if ( i == 1 )
+     return _targetVertex1;
+   else if ( i == 2 )
+     return _targetVertex2;
+   else
+-    throw SALOME_Exception(LOCALIZED("Wrong vertex index"));
++    throw SMESH_Exception(LOCALIZED("Wrong vertex index"));
+ }
+ 
+ 
+@@ -309,4 +309,3 @@
+ {
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionUtils.cpp salomesmesh/src/StdMeshers/StdMeshers_ProjectionUtils.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_ProjectionUtils.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_ProjectionUtils.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -67,15 +67,13 @@
+ 
+ 
+ #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
+-#define CONT_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); continue; }
+-#define SHOW_VERTEX(v,msg) \
+-// { \
+-//  if ( (v).IsNull() ) cout << msg << " NULL SHAPE" << endl; \
+-// else if ((v).ShapeType() == TopAbs_VERTEX) {\
+-//   gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( (v) ));\
+-//   cout<<msg<<" "<<(v).TShape().operator->()<<" ( "<<p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;}\
++#define SHOW_VERTEX(v,msg) // { \
++//  if ( v.IsNull() ) cout << msg << " NULL SHAPE" << endl; \
++// else if (v.ShapeType() == TopAbs_VERTEX) {\
++//   gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( v ));\
++//   cout << msg << (v).TShape().operator->()<<" ( " <<p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;}\
+ // else {\
+-// cout << msg << " "; TopAbs::Print((v).ShapeType(),cout) <<" "<<(v).TShape().operator->()<<endl;}\
++// cout << msg << " "; TopAbs::Print(v.ShapeType(),cout) <<" "<<(v).TShape().operator->()<<endl;}\
+ // }
+ #define SHOW_LIST(msg,l) \
+ // { \
+@@ -371,28 +369,8 @@
+                                                          SMESH_Mesh*         theMesh2,
+                                                          TShapeShapeMap &    theMap)
+ {
+-  // Structure of this long function is following
+-  // 1) Group->group projection: theShape1 is a group member,
+-  //    theShape2 is a group. We find a group theShape1 is in and recall self.
+-  // 2) Accosiate same shapes with different location (partners).
+-  // 3) If vertex association is given, perform accosiation according to shape type:
+-  //       switch ( ShapeType ) {
+-  //         case TopAbs_EDGE:
+-  //         case ...:
+-  //       }
+-  //    else try to accosiate in different ways:
+-  //       a) accosiate shapes by propagation and other simple cases
+-  //            switch ( ShapeType ) {
+-  //            case TopAbs_EDGE:
+-  //            case ...:
+-  //            }
+-  //       b) find association of a couple of vertices and recall self.
+-  //
+-
+-  // =================================================================================
+-  // Is it the case of associating a group member -> another group? (PAL16202, 16203)
+-  // =================================================================================
+   if ( theShape1.ShapeType() != theShape2.ShapeType() ) {
++    // is it the case of a group member -> another group? (PAL16202, 16203)
+     TopoDS_Shape group1, group2;
+     if ( theShape1.ShapeType() == TopAbs_COMPOUND ) {
+       group1 = theShape1;
+@@ -409,31 +387,6 @@
+   }
+ 
+   bool bidirect = ( !theShape1.IsSame( theShape2 ));
+-
+-  // ============
+-  // Is partner?
+-  // ============
+-  bool partner = theShape1.IsPartner( theShape2 );
+-  TopTools_DataMapIteratorOfDataMapOfShapeShape vvIt( theMap );
+-  for ( ; partner && vvIt.More(); vvIt.Next() )
+-    partner = vvIt.Key().IsPartner( vvIt.Value() );
+-
+-  if ( partner ) // Same shape with different location
+-  {
+-    // recursively associate all subshapes of theShape1 and theShape2
+-    typedef list< pair< TopoDS_Shape, TopoDS_Shape > > TShapePairsList;
+-    TShapePairsList shapesQueue( 1, make_pair( theShape1, theShape2 ));
+-    TShapePairsList::iterator s1_s2 = shapesQueue.begin();
+-    for ( ; s1_s2 != shapesQueue.end(); ++s1_s2 )
+-    {
+-      InsertAssociation( s1_s2->first, s1_s2->second, theMap, bidirect);
+-      TopoDS_Iterator s1It( s1_s2->first), s2It( s1_s2->second );
+-      for ( ; s1It.More(); s1It.Next(), s2It.Next() )
+-        shapesQueue.push_back( make_pair( s1It.Value(), s2It.Value() ));
+-    }
+-    return true;
+-  }
+-
+   if ( !theMap.IsEmpty() )
+   {
+     //======================================================================
+@@ -931,7 +884,6 @@
+         pair<int,TopoDS_Edge> step_edge = GetPropagationEdge( theMesh1, edge2, edge1 );
+         if ( !step_edge.second.IsNull() ) { // propagation found
+           propag_edges.insert( step_edge );
+-          if ( step_edge.first == 1 ) break; // most close found
+         }
+       }
+       if ( !propag_edges.empty() ) // propagation found
+@@ -1153,69 +1105,66 @@
+  */
+ //================================================================================
+ 
+-int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face&    face1,
+-                                                    TopoDS_Vertex         VV1[2],
+-                                                    const TopoDS_Face&    face2,
+-                                                    TopoDS_Vertex         VV2[2],
++int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1,
++                                                    TopoDS_Vertex      VV1[2],
++                                                    const TopoDS_Face& face2,
++                                                    TopoDS_Vertex      VV2[2],
+                                                     list< TopoDS_Edge > & edges1,
+                                                     list< TopoDS_Edge > & edges2)
+ {
+-  list< int > nbVInW1, nbVInW2;
+-  for ( int outer_wire_algo = 0; outer_wire_algo < 2; ++outer_wire_algo )
+-  {
+-    edges1.clear();
+-    edges2.clear();
++  edges1.clear();
++  edges2.clear();
+ 
+-    if ( SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbVInW1, outer_wire_algo) !=
+-         SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbVInW2, outer_wire_algo) )
+-      CONT_BAD_RESULT("Different number of wires in faces ");
++  list< int > nbVInW1, nbVInW2;
++  if ( SMESH_Block::GetOrderedEdges( face1, VV1[0], edges1, nbVInW1) !=
++       SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbVInW2) )
++    RETURN_BAD_RESULT("Different number of wires in faces ");
+ 
+-    if ( nbVInW1.front() != nbVInW2.front() )
+-      CONT_BAD_RESULT("Different number of edges in faces: " <<
++  if ( nbVInW1.front() != nbVInW2.front() )
++    RETURN_BAD_RESULT("Different number of edges in faces: " <<
+                       nbVInW1.front() << " != " << nbVInW2.front());
+ 
+-    // Define if we need to reverse one of wires to make edges in lists match each other
++  // Define if we need to reverse one of wires to make edges in lists match each other
+ 
+-    bool reverse = false;
++  bool reverse = false;
+ 
+-    list< TopoDS_Edge >::iterator edgeIt;
+-    if ( !VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) {
+-      reverse = true;
+-      edgeIt = --edges1.end();
+-      // check if the second vertex belongs to the first or last edge in the wire
+-      if ( !VV1[1].IsSame( TopExp::FirstVertex( *edgeIt, true ))) {
+-        bool KO = true; // belongs to none
+-        if ( nbVInW1.size() > 1 ) { // several wires
+-          edgeIt = edges1.begin();
+-          for ( int i = 1; i < nbVInW1.front(); ++i ) ++edgeIt;
+-          KO = !VV1[1].IsSame( TopExp::FirstVertex( *edgeIt, true ));
+-        }
+-        if ( KO )
+-          CONT_BAD_RESULT("GetOrderedEdges() failed");
+-      }
+-    }
+-    edgeIt = --edges2.end();
+-    if ( !VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true ))) {
+-      reverse = !reverse;
+-      // check if the second vertex belongs to the first or last edge in the wire
+-      if ( !VV2[1].IsSame( TopExp::FirstVertex( *edgeIt, true ))) {
+-        bool KO = true; // belongs to none
+-        if ( nbVInW2.size() > 1 ) { // several wires
+-          edgeIt = edges2.begin();
+-          for ( int i = 1; i < nbVInW2.front(); ++i ) ++edgeIt;
+-          KO = !VV2[1].IsSame( TopExp::FirstVertex( *edgeIt, true ));
+-        }
+-        if ( KO )
+-          CONT_BAD_RESULT("GetOrderedEdges() failed");
++  list< TopoDS_Edge >::iterator eBackIt;
++  if ( !VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) {
++    reverse = true;
++    eBackIt = --edges1.end();
++    // check if the second vertex belongs to the first or last edge in the wire
++    if ( !VV1[1].IsSame( TopExp::FirstVertex( *eBackIt, true ))) {
++      bool KO = true; // belongs to none
++      if ( nbVInW1.size() > 1 ) { // several wires
++        eBackIt = edges1.begin();
++        for ( int i = 1; i < nbVInW1.front(); ++i ) ++eBackIt;
++        KO = !VV1[1].IsSame( TopExp::FirstVertex( *eBackIt, true ));
++      }
++      if ( KO )
++        RETURN_BAD_RESULT("GetOrderedEdges() failed");
++    }
++  }
++  eBackIt = --edges2.end();
++  if ( !VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true ))) {
++    reverse = !reverse;
++    // check if the second vertex belongs to the first or last edge in the wire
++    if ( !VV2[1].IsSame( TopExp::FirstVertex( *eBackIt, true ))) {
++      bool KO = true; // belongs to none
++      if ( nbVInW2.size() > 1 ) { // several wires
++        eBackIt = edges2.begin();
++        for ( int i = 1; i < nbVInW2.front(); ++i ) ++eBackIt;
++        KO = !VV2[1].IsSame( TopExp::FirstVertex( *eBackIt, true ));
+       }
++      if ( KO )
++        RETURN_BAD_RESULT("GetOrderedEdges() failed");
+     }
+-    if ( reverse )
+-    {
+-      Reverse( edges2 , nbVInW2.front());
+-      if (( VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) !=
+-          ( VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true ))))
+-        CONT_BAD_RESULT("GetOrderedEdges() failed");
+-    }
++  }
++  if ( reverse )
++  {
++    Reverse( edges2 , nbVInW2.front());
++    if (( VV1[1].IsSame( TopExp::LastVertex( edges1.front(), true ))) !=
++        ( VV2[1].IsSame( TopExp::LastVertex( edges2.front(), true ))))
++      RETURN_BAD_RESULT("GetOrderedEdges() failed");
+   }
+   return nbVInW2.front();
+ }
+@@ -1278,7 +1227,7 @@
+     return isNew;
+   }
+   else {
+-    throw SALOME_Exception("StdMeshers_ProjectionUtils: attempt to associate NULL shape");
++    throw SMESH_Exception("StdMeshers_ProjectionUtils: attempt to associate NULL shape");
+   }
+   return false;
+ }
+@@ -2036,7 +1985,7 @@
+                                                   SMESH_Mesh*    srcMesh)
+ {
+   // Set listener that resets an event listener on source submesh when
+-  // "ProjectionSource*D" hypothesis is modified since source shape can be changed
++  // "ProjectionSource*D" hypothesis is modified
+   subMesh->SetEventListener( GetHypModifWaiter(),0,subMesh);
+ 
+   // Set an event listener to submesh of the source shape
+@@ -2056,16 +2005,13 @@
+         for (; it.More(); it.Next())
+         {
+           SMESH_subMesh* srcSM = srcMesh->GetSubMesh( it.Current() );
+-          if ( srcSM != subMesh )
+-          {
+-            SMESH_subMeshEventListenerData* data =
+-              srcSM->GetEventListenerData(GetSrcSubMeshListener());
+-            if ( data )
+-              data->mySubMeshes.push_back( subMesh );
+-            else
+-              data = SMESH_subMeshEventListenerData::MakeData( subMesh );
+-            subMesh->SetEventListener ( GetSrcSubMeshListener(), data, srcSM );
+-          }
++          SMESH_subMeshEventListenerData* data =
++            srcSM->GetEventListenerData(GetSrcSubMeshListener());
++          if ( data )
++            data->mySubMeshes.push_back( subMesh );
++          else
++            data = SMESH_subMeshEventListenerData::MakeData( subMesh );
++          subMesh->SetEventListener ( GetSrcSubMeshListener(), data, srcSM );
+         }
+       }
+       else
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -19,18 +19,17 @@
+ //
+ //  See http://www.salome-platform.org/ or email : webmaster.salome at opencascade.com
+ //
+-//  SMESH SMESH : implementaion of SMESH idl descriptions
++ //  SMESH SMESH : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_Quadrangle_2D.cxx
+ //           Moved here from SMESH_Quadrangle_2D.cxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx,v 1.14.2.5 2008/11/27 13:03:49 abd Exp $
+ //
+ #include "StdMeshers_Quadrangle_2D.hxx"
+ 
+ #include "StdMeshers_FaceSide.hxx"
+ 
+-#include "StdMeshers_QuadrangleParams.hxx"
+-
+ #include "SMESH_Gen.hxx"
+ #include "SMESH_Mesh.hxx"
+ #include "SMESH_subMesh.hxx"
+@@ -46,13 +45,6 @@
+ #include <BRepTools_WireExplorer.hxx>
+ #include <BRep_Tool.hxx>
+ #include <Geom_Surface.hxx>
+-
+-#ifndef __BORLANDC__
+-#include <NCollection_DefineArray2.hxx>
+-#else
+-#include <SMESH_DefineArray2.hxx>
+-#endif
+-
+ #include <Precision.hxx>
+ #include <TColStd_SequenceOfReal.hxx>
+ #include <TColgp_SequenceOfXY.hxx>
+@@ -60,8 +52,16 @@
+ #include <TopTools_ListIteratorOfListOfShape.hxx>
+ #include <TopoDS.hxx>
+ 
++#ifndef __BORLANDC__
++#include <NCollection_DefineArray2.hxx>
++#else
++#include <SMESH_DefineArray2.hxx>
++#endif
++
+ #include "utilities.h"
+-#include "Utils_ExceptHandlers.hxx"
++#include "SMESH_ExceptHandlers.hxx"
++
++#include <cmath>
+ 
+ #ifndef StdMeshers_Array2OfNode_HeaderFile
+ #define StdMeshers_Array2OfNode_HeaderFile
+@@ -89,14 +89,12 @@
+  */
+ //=============================================================================
+ 
+-StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
+-                                                    SMESH_Gen* gen)
++StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, SMESH_Gen* gen)
+      : SMESH_2D_Algo(hypId, studyId, gen)
+ {
+   MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
+   _name = "Quadrangle_2D";
+   _shapeType = (1 << TopAbs_FACE);
+-  _compatibleHypothesis.push_back("QuadrangleParams");
+   _compatibleHypothesis.push_back("QuadranglePreference");
+   _compatibleHypothesis.push_back("TrianglePreference");
+   myTool = 0;
+@@ -127,69 +125,25 @@
+   bool isOk = true;
+   aStatus = SMESH_Hypothesis::HYP_OK;
+ 
+-  const list <const SMESHDS_Hypothesis * >&hyps =
+-    GetUsedHypothesis(aMesh, aShape, false);
++
++  const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape, false);
+   const SMESHDS_Hypothesis *theHyp = 0;
+   
+-  if( hyps.size() == 1 ) {
+-    myTriaVertexID = -1;
+-    theHyp = hyps.front();
+-    if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) {
+-      const StdMeshers_QuadrangleParams* theHyp1 = 
+-        (const StdMeshers_QuadrangleParams*)theHyp;
+-      myTriaVertexID = theHyp1->GetTriaVertex();
+-      myQuadranglePreference= false;
+-      myTrianglePreference= false; 
+-    }
++  if(hyps.size() > 0){
++    theHyp = *hyps.begin();
+     if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) {
+       myQuadranglePreference= true;
+       myTrianglePreference= false; 
+-      myTriaVertexID = -1;
+     }
+     else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){
+       myQuadranglePreference= false;
+       myTrianglePreference= true; 
+-      myTriaVertexID = -1;
+     }
+   }
+-
+-  else if( hyps.size() > 1 ) {
+-    theHyp = hyps.front();
+-    if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) {
+-      const StdMeshers_QuadrangleParams* theHyp1 = 
+-        (const StdMeshers_QuadrangleParams*)theHyp;
+-      myTriaVertexID = theHyp1->GetTriaVertex();
+-      theHyp = hyps.back();
+-      if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) {
+-        myQuadranglePreference= true;
+-        myTrianglePreference= false; 
+-      }
+-      else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){
+-        myQuadranglePreference= false;
+-        myTrianglePreference= true; 
+-      }
+-    }
+-    else {
+-      if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) {
+-        myQuadranglePreference= true;
+-        myTrianglePreference= false; 
+-      }
+-      else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){
+-        myQuadranglePreference= false;
+-        myTrianglePreference= true; 
+-      }
+-      const StdMeshers_QuadrangleParams* theHyp2 = 
+-        (const StdMeshers_QuadrangleParams*)hyps.back();
+-      myTriaVertexID = theHyp2->GetTriaVertex();
+-    }
+-  }
+-
+   else {
+     myQuadranglePreference = false;
+     myTrianglePreference = false;
+-    myTriaVertexID = -1;
+   }
+-
+   return isOk;
+ }
+ 
+@@ -200,7 +154,7 @@
+ //=============================================================================
+ 
+ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
+-                                        const TopoDS_Shape& aShape)// throw (SALOME_Exception)
++                                        const TopoDS_Shape& aShape)// throw (SMESH_Exception)
+ {
+   // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
+   //Unexpect aCatchSalomeException);
+@@ -297,10 +251,15 @@
+       b = quad->uv_grid[j * nbhoriz + i + 1].node;
+       c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
+       d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
+-      SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
+-      if(face) {
+-        meshDS->SetMeshElementOnShape(face, geomFaceID);
+-      }
++      //SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
++      //meshDS->SetMeshElementOnShape(face, geomFaceID);
++	   if(!myTrianglePreference){
++          SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
++          meshDS->SetMeshElementOnShape(face, geomFaceID);
++        }
++        else {
++          SplitQuad(meshDS, geomFaceID, a, b, c, d);
++        }
+     }
+   }
+ 
+@@ -374,8 +333,9 @@
+       }
+ 
+       if (near == g) { // make triangle
++        //SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+         SMDS_MeshFace* face = myTool->AddFace(a, b, c);
+-        if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++        meshDS->SetMeshElementOnShape(face, geomFaceID);
+       }
+       else { // make quadrangle
+         if (near - 1 < ilow)
+@@ -386,7 +346,7 @@
+         
+         if(!myTrianglePreference){
+           SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
+-          if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++          meshDS->SetMeshElementOnShape(face, geomFaceID);
+         }
+         else {
+           SplitQuad(meshDS, geomFaceID, a, b, c, d);
+@@ -400,8 +360,9 @@
+               d = uv_e3[1].node;
+             else
+               d = quad->uv_grid[nbhoriz + k - 1].node;
++            //SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+             SMDS_MeshFace* face = myTool->AddFace(a, c, d);
+-            if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++            meshDS->SetMeshElementOnShape(face, geomFaceID);
+           }
+         }
+         g = near;
+@@ -462,8 +423,9 @@
+         }
+ 
+         if (near == g) { // make triangle
++          //SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+           SMDS_MeshFace* face = myTool->AddFace(a, b, c);
+-          if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++          meshDS->SetMeshElementOnShape(face, geomFaceID);
+         }
+         else { // make quadrangle
+           if (near + 1 > iup)
+@@ -473,7 +435,7 @@
+           //SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
+           if(!myTrianglePreference){
+             SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
+-            if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++            meshDS->SetMeshElementOnShape(face, geomFaceID);
+           }
+           else {
+             SplitQuad(meshDS, geomFaceID, a, b, c, d);
+@@ -486,8 +448,9 @@
+                 d = uv_e1[nbright - 2].node;
+               else
+                 d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node;
++              //SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+               SMDS_MeshFace* face = myTool->AddFace(a, c, d);
+-              if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++              meshDS->SetMeshElementOnShape(face, geomFaceID);
+             }
+           }
+           g = near;
+@@ -534,8 +497,9 @@
+       }
+ 
+       if (near == g) { // make triangle
++        //SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+         SMDS_MeshFace* face = myTool->AddFace(a, b, c);
+-        if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++        meshDS->SetMeshElementOnShape(face, geomFaceID);
+       }
+       else { // make quadrangle
+         if (near - 1 < jlow)
+@@ -546,7 +510,7 @@
+ 
+         if(!myTrianglePreference){
+           SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
+-          if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++          meshDS->SetMeshElementOnShape(face, geomFaceID);
+         }
+         else {
+           SplitQuad(meshDS, geomFaceID, a, b, c, d);
+@@ -559,8 +523,9 @@
+               d = uv_e0[nbdown - 2].node;
+             else
+               d = quad->uv_grid[nbhoriz*k - 2].node;
++            //SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+             SMDS_MeshFace* face = myTool->AddFace(a, c, d);
+-            if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++            meshDS->SetMeshElementOnShape(face, geomFaceID);
+           }
+         }
+         g = near;
+@@ -604,8 +569,9 @@
+         }
+ 
+         if (near == g) { // make triangle
++          //SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
+           SMDS_MeshFace* face = myTool->AddFace(a, b, c);
+-          if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++          meshDS->SetMeshElementOnShape(face, geomFaceID);
+         }
+         else { // make quadrangle
+           if (near + 1 > jup)
+@@ -615,7 +581,7 @@
+           //SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
+           if(!myTrianglePreference){
+             SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
+-            if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++            meshDS->SetMeshElementOnShape(face, geomFaceID);
+           }
+           else {
+             SplitQuad(meshDS, geomFaceID, a, b, c, d);
+@@ -628,8 +594,9 @@
+                 d = uv_e2[1].node;
+               else
+                 d = quad->uv_grid[nbhoriz*(k + 1) + 1].node;
++              //SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
+               SMDS_MeshFace* face = myTool->AddFace(a, c, d);
+-              if(face) meshDS->SetMeshElementOnShape(face, geomFaceID);
++              meshDS->SetMeshElementOnShape(face, geomFaceID);
+             }
+           }
+           g = near;
+@@ -642,101 +609,6 @@
+   return isOk;
+ }
+ 
+-
+-//=============================================================================
+-/*!
+- *  Evaluate
+- */
+-//=============================================================================
+-
+-bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh,
+-                                        const TopoDS_Shape& aShape,
+-                                        MapShapeNbElems& aResMap)
+-
+-{
+-  aMesh.GetSubMesh(aShape);
+-
+-  std::vector<int> aNbNodes(4);
+-  bool IsQuadratic = false;
+-  if( !CheckNbEdgesForEvaluate( aMesh, aShape, aResMap, aNbNodes, IsQuadratic ) ) {
+-    std::vector<int> aResVec(SMDSEntity_Last);
+-    for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-    SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-    aResMap.insert(std::make_pair(sm,aResVec));
+-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-    return false;
+-  }
+-
+-  if(myQuadranglePreference) {
+-    int n1 = aNbNodes[0];
+-    int n2 = aNbNodes[1];
+-    int n3 = aNbNodes[2];
+-    int n4 = aNbNodes[3];
+-    int nfull = n1+n2+n3+n4;
+-    int ntmp = nfull/2;
+-    ntmp = ntmp*2;
+-    if( nfull==ntmp && ( (n1!=n3) || (n2!=n4) ) ) {
+-      // special path for using only quandrangle faces
+-      return EvaluateQuadPref(aMesh, aShape, aNbNodes, aResMap, IsQuadratic);
+-      //return true;
+-    }
+-  }
+-
+-  int nbdown  = aNbNodes[0];
+-  int nbup    = aNbNodes[2];
+-
+-  int nbright = aNbNodes[1];
+-  int nbleft  = aNbNodes[3];
+-
+-  int nbhoriz  = Min(nbdown, nbup);
+-  int nbvertic = Min(nbright, nbleft);
+-
+-  int dh = Max(nbdown, nbup) - nbhoriz;
+-  int dv = Max(nbright, nbleft) - nbvertic;
+-
+-  //int kdh = 0;
+-  //if(dh>0) kdh = 1;
+-  //int kdv = 0;
+-  //if(dv>0) kdv = 1;
+-
+-  int nbNodes = (nbhoriz-2)*(nbvertic-2);
+-  //int nbFaces3 = dh + dv + kdh*(nbvertic-1)*2 + kdv*(nbhoriz-1)*2;
+-  int nbFaces3 = dh + dv;
+-  //if( kdh==1 && kdv==1 ) nbFaces3 -= 2;
+-  //if( dh>0 && dv>0 ) nbFaces3 -= 2;
+-  //int nbFaces4 = (nbhoriz-1-kdh)*(nbvertic-1-kdv);
+-  int nbFaces4 = (nbhoriz-1)*(nbvertic-1);
+-
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
+-  if(IsQuadratic) {
+-    aVec[SMDSEntity_Quad_Triangle] = nbFaces3;
+-    aVec[SMDSEntity_Quad_Quadrangle] = nbFaces4;
+-    int nbbndedges = nbdown + nbup + nbright + nbleft -4;
+-    int nbintedges = ( nbFaces4*4 + nbFaces3*3 - nbbndedges ) / 2;
+-    aVec[SMDSEntity_Node] = nbNodes + nbintedges;
+-    if( aNbNodes.size()==5 ) {
+-      aVec[SMDSEntity_Quad_Triangle] = nbFaces3 + aNbNodes[3] -1;
+-      aVec[SMDSEntity_Quad_Quadrangle] = nbFaces4 - aNbNodes[3] +1;
+-    }
+-  }
+-  else {
+-    aVec[SMDSEntity_Node] = nbNodes;
+-    aVec[SMDSEntity_Triangle] = nbFaces3;
+-    aVec[SMDSEntity_Quadrangle] = nbFaces4;
+-    if( aNbNodes.size()==5 ) {
+-      aVec[SMDSEntity_Triangle] = nbFaces3 + aNbNodes[3] - 1;
+-      aVec[SMDSEntity_Quadrangle] = nbFaces4 - aNbNodes[3] + 1;
+-    }
+-  }
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+-
+-
+ //================================================================================
+ /*!
+  * \brief Return true if only two given edges meat at their common vertex
+@@ -766,7 +638,7 @@
+ 
+ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMesh,
+                                                        const TopoDS_Shape & aShape)
+-  //throw(SALOME_Exception)
++  //throw(SMESH_Exception)
+ {
+   const TopoDS_Face & F = TopoDS::Face(aShape);
+   const bool ignoreMediumNodes = _quadraticMesh;
+@@ -786,41 +658,7 @@
+ 
+   int nbSides = 0;
+   list< TopoDS_Edge >::iterator edgeIt = edges.begin();
+-  if ( nbEdgesInWire.front() == 3 ) { // exactly 3 edges
+-    if(myTriaVertexID>0) {
+-      SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
+-      TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID));
+-      if(!V.IsNull()) {
+-        TopoDS_Edge E1,E2,E3;
+-        for(; edgeIt != edges.end(); ++edgeIt) {
+-          TopoDS_Edge E =  TopoDS::Edge(*edgeIt);
+-          TopoDS_Vertex VF, VL;
+-          TopExp::Vertices(E, VF, VL, true);
+-          if( VF.IsSame(V) )
+-            E1 = E;
+-          else if( VL.IsSame(V) )
+-            E3 = E;
+-          else
+-            E2 = E;
+-        }
+-        quad->side.reserve(4);
+-        quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes));
+-        quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes));
+-        quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes));
+-        std::vector<UVPtStruct> UVPSleft = quad->side[0]->GetUVPtStruct(true,0);
+-        std::vector<UVPtStruct> UVPStop = quad->side[1]->GetUVPtStruct(false,1);
+-        std::vector<UVPtStruct> UVPSright = quad->side[2]->GetUVPtStruct(true,1);
+-        const SMDS_MeshNode* aNode = UVPSleft[0].node;
+-        gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v );
+-        StdMeshers_FaceSide* VertFS =
+-          new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]);
+-        quad->side.push_back(VertFS);
+-        return quad;
+-      }
+-    }
+-    return 0;
+-  }
+-  else if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges
++  if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges
+     for ( ; edgeIt != edges.end(); ++edgeIt, nbSides++ )
+       quad->side.push_back( new StdMeshers_FaceSide(F, *edgeIt, &aMesh,
+                                                     nbSides<TOP_SIDE, ignoreMediumNodes));
+@@ -905,193 +743,6 @@
+   return quad;
+ }
+ 
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
+-                                                       const TopoDS_Shape & aShape,
+-                                                       MapShapeNbElems& aResMap,
+-                                                       std::vector<int>& aNbNodes,
+-                                                       bool& IsQuadratic)
+-
+-{
+-  const TopoDS_Face & F = TopoDS::Face(aShape);
+-
+-  // verify 1 wire only, with 4 edges
+-  TopoDS_Vertex V;
+-  list< TopoDS_Edge > edges;
+-  list< int > nbEdgesInWire;
+-  int nbWire = SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+-  if (nbWire != 1) {
+-    return false;
+-  }
+-
+-  aNbNodes.resize(4);
+-
+-  int nbSides = 0;
+-  list< TopoDS_Edge >::iterator edgeIt = edges.begin();
+-  SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt );
+-  MapShapeNbElemsItr anIt = aResMap.find(sm);
+-  if(anIt==aResMap.end()) {
+-    return false;
+-  }
+-  std::vector<int> aVec = (*anIt).second;
+-  IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
+-  if ( nbEdgesInWire.front() == 3 ) { // exactly 3 edges
+-    if(myTriaVertexID>0) {
+-      SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
+-      TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID));
+-      if(!V.IsNull()) {
+-        TopoDS_Edge E1,E2,E3;
+-        for(; edgeIt != edges.end(); ++edgeIt) {
+-          TopoDS_Edge E =  TopoDS::Edge(*edgeIt);
+-          TopoDS_Vertex VF, VL;
+-          TopExp::Vertices(E, VF, VL, true);
+-          if( VF.IsSame(V) )
+-            E1 = E;
+-          else if( VL.IsSame(V) )
+-            E3 = E;
+-          else
+-            E2 = E;
+-        }
+-        SMESH_subMesh * sm = aMesh.GetSubMesh(E1);
+-        MapShapeNbElemsItr anIt = aResMap.find(sm);
+-        if(anIt==aResMap.end()) return false;
+-        std::vector<int> aVec = (*anIt).second;
+-        if(IsQuadratic)
+-          aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+-        else
+-          aNbNodes[0] = aVec[SMDSEntity_Node] + 2;
+-        sm = aMesh.GetSubMesh(E2);
+-        anIt = aResMap.find(sm);
+-        if(anIt==aResMap.end()) return false;
+-        aVec = (*anIt).second;
+-        if(IsQuadratic)
+-          aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+-        else
+-          aNbNodes[1] = aVec[SMDSEntity_Node] + 2;
+-        sm = aMesh.GetSubMesh(E3);
+-        anIt = aResMap.find(sm);
+-        if(anIt==aResMap.end()) return false;
+-        aVec = (*anIt).second;
+-        if(IsQuadratic)
+-          aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+-        else
+-          aNbNodes[2] = aVec[SMDSEntity_Node] + 2;
+-        aNbNodes[3] = aNbNodes[1];
+-        aNbNodes.resize(5);
+-        nbSides = 4;
+-      }
+-    }
+-  }
+-  if ( nbEdgesInWire.front() == 4 ) { // exactly 4 edges
+-    for(; edgeIt != edges.end(); edgeIt++) {
+-      SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt );
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      if(anIt==aResMap.end()) {
+-        return false;
+-      }
+-      std::vector<int> aVec = (*anIt).second;
+-      if(IsQuadratic)
+-        aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2;
+-      else
+-        aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2;
+-      nbSides++;
+-    }
+-  }
+-  else if ( nbEdgesInWire.front() > 4 ) { // more than 4 edges - try to unite some
+-    list< TopoDS_Edge > sideEdges;
+-    while ( !edges.empty()) {
+-      sideEdges.clear();
+-      sideEdges.splice( sideEdges.end(), edges, edges.begin()); // edges.front() -> sideEdges.end()
+-      bool sameSide = true;
+-      while ( !edges.empty() && sameSide ) {
+-        sameSide = SMESH_Algo::IsContinuous( sideEdges.back(), edges.front() );
+-        if ( sameSide )
+-          sideEdges.splice( sideEdges.end(), edges, edges.begin());
+-      }
+-      if ( nbSides == 0 ) { // go backward from the first edge
+-        sameSide = true;
+-        while ( !edges.empty() && sameSide ) {
+-          sameSide = SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() );
+-          if ( sameSide )
+-            sideEdges.splice( sideEdges.begin(), edges, --edges.end());
+-        }
+-      }
+-      list<TopoDS_Edge>::iterator ite = sideEdges.begin();
+-      aNbNodes[nbSides] = 1;
+-      for(; ite!=sideEdges.end(); ite++) {
+-        SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
+-        MapShapeNbElemsItr anIt = aResMap.find(sm);
+-        if(anIt==aResMap.end()) {
+-          return false;
+-        }
+-        std::vector<int> aVec = (*anIt).second;
+-        if(IsQuadratic)
+-          aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
+-        else
+-          aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
+-      }
+-      ++nbSides;
+-    }
+-    // issue 20222. Try to unite only edges shared by two same faces
+-    if (nbSides < 4) {
+-      nbSides = 0;
+-      SMESH_Block::GetOrderedEdges (F, V, edges, nbEdgesInWire);
+-      while ( !edges.empty()) {
+-        sideEdges.clear();
+-        sideEdges.splice( sideEdges.end(), edges, edges.begin());
+-        bool sameSide = true;
+-        while ( !edges.empty() && sameSide ) {
+-          sameSide =
+-            SMESH_Algo::IsContinuous( sideEdges.back(), edges.front() ) &&
+-            twoEdgesMeatAtVertex( sideEdges.back(), edges.front(), aMesh );
+-          if ( sameSide )
+-            sideEdges.splice( sideEdges.end(), edges, edges.begin());
+-        }
+-        if ( nbSides == 0 ) { // go backward from the first edge
+-          sameSide = true;
+-          while ( !edges.empty() && sameSide ) {
+-            sameSide =
+-              SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() ) &&
+-              twoEdgesMeatAtVertex( sideEdges.front(), edges.back(), aMesh );
+-            if ( sameSide )
+-              sideEdges.splice( sideEdges.begin(), edges, --edges.end());
+-          }
+-        }
+-        list<TopoDS_Edge>::iterator ite = sideEdges.begin();
+-        aNbNodes[nbSides] = 1;
+-        for(; ite!=sideEdges.end(); ite++) {
+-          SMESH_subMesh * sm = aMesh.GetSubMesh( *ite );
+-          MapShapeNbElemsItr anIt = aResMap.find(sm);
+-          if(anIt==aResMap.end()) {
+-            return false;
+-          }
+-          std::vector<int> aVec = (*anIt).second;
+-          if(IsQuadratic)
+-            aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1;
+-          else
+-            aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1;
+-        }
+-        ++nbSides;
+-      }
+-    }
+-  }
+-  if (nbSides != 4) {
+-    if ( !nbSides )
+-      nbSides = nbEdgesInWire.front();
+-    error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides);
+-    return false;
+-  }
+-
+-  return true;
+-}
+-
+-
+ //=============================================================================
+ /*!
+  *  CheckAnd2Dcompute
+@@ -1101,7 +752,7 @@
+ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
+                            (SMESH_Mesh &         aMesh,
+                             const TopoDS_Shape & aShape,
+-                            const bool           CreateQuadratic) //throw(SALOME_Exception)
++                            const bool           CreateQuadratic) //throw(SMESH_Exception)
+ {
+   _quadraticMesh = CreateQuadratic;
+ 
+@@ -1154,7 +805,7 @@
+ 
+ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
+                                                   const TopoDS_Shape& aShape,
+-                                                  FaceQuadStruct* & quad) //throw (SALOME_Exception)
++                                                  FaceQuadStruct* & quad) //throw (SMESH_Exception)
+ {
+   // Algorithme décrit dans "Génération automatique de maillages"
+   // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
+@@ -1230,15 +881,17 @@
+   }
+ 
+   // normalized 2d values on grid
+-  for (int i = 0; i < nbhoriz; i++) {
+-    for (int j = 0; j < nbvertic; j++) {
++  for (int i = 0; i < nbhoriz; i++)
++  {
++    for (int j = 0; j < nbvertic; j++)
++    {
+       int ij = j * nbhoriz + i;
+       // --- droite i cste : x = x0 + y(x1-x0)
+-      double x0 = uv_e0[i].normParam;   // bas - sud
+-      double x1 = uv_e2[i].normParam;   // haut - nord
++      double x0 = uv_e0[i].normParam;	// bas - sud
++      double x1 = uv_e2[i].normParam;	// haut - nord
+       // --- droite j cste : y = y0 + x(y1-y0)
+-      double y0 = uv_e3[j].normParam;   // gauche-ouest
+-      double y1 = uv_e1[j].normParam;   // droite - est
++      double y0 = uv_e3[j].normParam;	// gauche-ouest
++      double y1 = uv_e1[j].normParam;	// droite - est
+       // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0)
+       double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
+       double y = y0 + x * (y1 - y0);
+@@ -1255,8 +908,10 @@
+   gp_UV a2( uv_e2.back().u,  uv_e2.back().v );
+   gp_UV a3( uv_e2.front().u, uv_e2.front().v );
+ 
+-  for (int i = 0; i < nbhoriz; i++) {
+-    for (int j = 0; j < nbvertic; j++) {
++  for (int i = 0; i < nbhoriz; i++)
++  {
++    for (int j = 0; j < nbvertic; j++)
++    {
+       int ij = j * nbhoriz + i;
+       double x = uv_grid[ij].x;
+       double y = uv_grid[ij].y;
+@@ -1334,6 +989,7 @@
+   return uv;
+ }
+ 
++
+ //=======================================================================
+ //function : CalcUV2
+ //purpose  : auxilary function for ComputeQuadPref
+@@ -1369,7 +1025,6 @@
+   return uv;
+ }
+ 
+-
+ //=======================================================================
+ /*!
+  * Create only quandrangle faces
+@@ -1457,7 +1112,7 @@
+   //       0   top    1
+   //      1------------1
+   //       |  |____|  |
+-  //       |  /    \  |
++  //       |L /    \ R|
+   //       | /  C   \ |
+   //  left |/________\| rigth
+   //       |          |
+@@ -1589,13 +1244,13 @@
+             SMDS_MeshFace* F =
+               myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j),
+                               NodesL.Value(i+1,j+1), NodesL.Value(i,j+1));
+-            if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++            meshDS->SetMeshElementOnShape(F, geomFaceID);
+           }
+           else {
+             SMDS_MeshFace* F =
+               myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i,j+1),
+                               NodesL.Value(i+1,j+1), NodesL.Value(i+1,j));
+-            if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++            meshDS->SetMeshElementOnShape(F, geomFaceID);
+           }
+         }
+       }
+@@ -1652,13 +1307,13 @@
+             SMDS_MeshFace* F =
+               myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j),
+                               NodesR.Value(i+1,j+1), NodesR.Value(i,j+1));
+-            if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++            meshDS->SetMeshElementOnShape(F, geomFaceID);
+           }
+           else {
+             SMDS_MeshFace* F =
+               myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i,j+1),
+                               NodesR.Value(i+1,j+1), NodesR.Value(i+1,j));
+-            if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++            meshDS->SetMeshElementOnShape(F, geomFaceID);
+           }
+         }
+       }
+@@ -1730,13 +1385,13 @@
+           SMDS_MeshFace* F =
+             myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
+                             NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
+-          if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++          meshDS->SetMeshElementOnShape(F, geomFaceID);
+         }
+         else {
+           SMDS_MeshFace* F =
+             myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1),
+                             NodesC.Value(i+1,j+1), NodesC.Value(i+1,j));
+-          if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++          meshDS->SetMeshElementOnShape(F, geomFaceID);
+         }
+       }
+     }
+@@ -1764,24 +1419,23 @@
+ 
+       }
+     }
+-    int nbf=0;
+     for(j=1; j<nnn-1; j++) {
+       for(i=1; i<nb; i++) {
+-        nbf++;
+         if(WisF) {
+           SMDS_MeshFace* F =
+             myTool->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j),
+                             NodesBRD.Value(i+1,j+1), NodesBRD.Value(i,j+1));
+-          if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++          meshDS->SetMeshElementOnShape(F, geomFaceID);
+         }
+         else {
+           SMDS_MeshFace* F =
+             myTool->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i,j+1),
+                             NodesBRD.Value(i+1,j+1), NodesBRD.Value(i+1,j));
+-          if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++          meshDS->SetMeshElementOnShape(F, geomFaceID);
+         }
+       }
+     }
++
+     int drl = abs(nr-nl);
+     // create faces for region C
+     StdMeshers_Array2OfNode NodesC(1,nb,1,drl+1+addv);
+@@ -1880,18 +1534,17 @@
+       // create faces
+       for(j=1; j<=drl+addv; j++) {
+         for(i=1; i<nb; i++) {
+-          nbf++;
+           if(WisF) {
+             SMDS_MeshFace* F =
+               myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
+                               NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
+-            if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++            meshDS->SetMeshElementOnShape(F, geomFaceID);
+           }
+           else {
+             SMDS_MeshFace* F =
+               myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1),
+                               NodesC.Value(i+1,j+1), NodesC.Value(i+1,j));
+-            if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++            meshDS->SetMeshElementOnShape(F, geomFaceID);
+           }
+         }
+       } // end nr<nl
+@@ -1914,18 +1567,17 @@
+         NodesLast.SetValue(nnn,1,NodesC.Value(nb,i));
+       }
+       for(i=1; i<nt; i++) {
+-        nbf++;
+         if(WisF) {
+           SMDS_MeshFace* F =
+             myTool->AddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1),
+                             NodesLast.Value(i+1,2), NodesLast.Value(i,2));
+-          if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++          meshDS->SetMeshElementOnShape(F, geomFaceID);
+         }
+         else {
+           SMDS_MeshFace* F =
+             myTool->AddFace(NodesLast.Value(i,1), NodesLast.Value(i,2),
+                             NodesLast.Value(i+1,2), NodesLast.Value(i+1,2));
+-          if(F) meshDS->SetMeshElementOnShape(F, geomFaceID);
++          meshDS->SetMeshElementOnShape(F, geomFaceID);
+         }
+       }
+     } // if( (drl+addv) > 0 )
+@@ -1936,140 +1588,6 @@
+   return isOk;
+ }
+ 
+-
+-//=======================================================================
+-/*!
+- * Evaluate only quandrangle faces
+- */
+-//=======================================================================
+-
+-bool StdMeshers_Quadrangle_2D::EvaluateQuadPref(SMESH_Mesh &        aMesh,
+-                                                const TopoDS_Shape& aShape,
+-                                                std::vector<int>& aNbNodes,
+-                                                MapShapeNbElems& aResMap,
+-                                                bool IsQuadratic)
+-{
+-  // Auxilary key in order to keep old variant
+-  // of meshing after implementation new variant
+-  // for bug 0016220 from Mantis.
+-  bool OldVersion = false;
+-
+-  const TopoDS_Face& F = TopoDS::Face(aShape);
+-  Handle(Geom_Surface) S = BRep_Tool::Surface(F);
+-
+-  int nb = aNbNodes[0];
+-  int nr = aNbNodes[1];
+-  int nt = aNbNodes[2];
+-  int nl = aNbNodes[3];
+-  int dh = abs(nb-nt);
+-  int dv = abs(nr-nl);
+-
+-  if( dh>=dv ) {
+-    if( nt>nb ) {
+-      // it is a base case => not shift 
+-    }
+-    else {
+-      // we have to shift on 2
+-      nb = aNbNodes[2];
+-      nr = aNbNodes[3];
+-      nt = aNbNodes[0];
+-      nl = aNbNodes[1];
+-    }
+-  }
+-  else {
+-    if( nr>nl ) {
+-      // we have to shift quad on 1
+-      nb = aNbNodes[3];
+-      nr = aNbNodes[0];
+-      nt = aNbNodes[1];
+-      nl = aNbNodes[2];
+-    }
+-    else {
+-      // we have to shift quad on 3
+-      nb = aNbNodes[1];
+-      nr = aNbNodes[2];
+-      nt = aNbNodes[3];
+-      nl = aNbNodes[0];
+-    }
+-  }
+-
+-  dh = abs(nb-nt);
+-  dv = abs(nr-nl);
+-  int nbh  = Max(nb,nt);
+-  int nbv = Max(nr,nl);
+-  int addh = 0;
+-  int addv = 0;
+-
+-  if(dh>dv) {
+-    addv = (dh-dv)/2;
+-    nbv = nbv + addv;
+-  }
+-  else { // dv>=dh
+-    addh = (dv-dh)/2;
+-    nbh = nbh + addh;
+-  }
+-
+-  int dl,dr;
+-  if(OldVersion) {
+-    // add some params to right and left after the first param
+-    // insert to right
+-    dr = nbv - nr;
+-    // insert to left
+-    dl = nbv - nl;
+-  }
+-  
+-  int nnn = Min(nr,nl);
+-
+-  int nbNodes = 0;
+-  int nbFaces = 0;
+-  if(OldVersion) {
+-    // step1: create faces for left domain
+-    if(dl>0) {
+-      nbNodes += dl*(nl-1);
+-      nbFaces += dl*(nl-1);
+-    }
+-    // step2: create faces for right domain
+-    if(dr>0) {
+-      nbNodes += dr*(nr-1);
+-      nbFaces += dr*(nr-1);
+-    }
+-    // step3: create faces for central domain
+-    nbNodes += (nb-2)*(nnn-1) + (nbv-nnn-1)*(nb-2);
+-    nbFaces += (nb-1)*(nbv-1);
+-  }
+-  else { // New version (!OldVersion)
+-    nbNodes += (nnn-2)*(nb-2);
+-    nbFaces += (nnn-2)*(nb-1);
+-    int drl = abs(nr-nl);
+-    nbNodes += drl*(nb-1) + addv*nb;
+-    nbFaces += (drl+addv)*(nb-1) + (nt-1);
+-  } // end new version implementation
+-
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
+-  if(IsQuadratic) {
+-    aVec[SMDSEntity_Quad_Quadrangle] = nbFaces;
+-    aVec[SMDSEntity_Node] = nbNodes + nbFaces*4;
+-    if( aNbNodes.size()==5 ) {
+-      aVec[SMDSEntity_Quad_Triangle] = aNbNodes[3] - 1;
+-      aVec[SMDSEntity_Quad_Quadrangle] = nbFaces - aNbNodes[3] + 1;
+-    }
+-  }
+-  else {
+-    aVec[SMDSEntity_Node] = nbNodes;
+-    aVec[SMDSEntity_Quadrangle] = nbFaces;
+-    if( aNbNodes.size()==5 ) {
+-      aVec[SMDSEntity_Triangle] = aNbNodes[3] - 1;
+-      aVec[SMDSEntity_Quadrangle] = nbFaces - aNbNodes[3] + 1;
+-    }
+-  }
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+-
+-
+ //=============================================================================
+ /*! Split quadrangle in to 2 triangles by smallest diagonal
+  *   
+@@ -2087,19 +1605,20 @@
+   gp_Pnt c(theNode3->X(),theNode3->Y(),theNode3->Z());
+   gp_Pnt d(theNode4->X(),theNode4->Y(),theNode4->Z());
+   SMDS_MeshFace* face;
+-  if(a.Distance(c) > b.Distance(d)){
+-    face = myTool->AddFace(theNode2, theNode4 , theNode1);
+-    if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID );
++  Standard_Real d1 = a.Distance(c);
++  Standard_Real d2 = b.Distance(d);
++  Standard_Real d3 = d2 - d1;
++  if(abs(d3) < gp::Resolution() || d1 > d2){
++    face = myTool->AddFace(theNode2, theNode4, theNode1);
++    theMeshDS->SetMeshElementOnShape(face, theFaceID );
+     face = myTool->AddFace(theNode2, theNode3, theNode4);
+-    if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID );
+-
++    theMeshDS->SetMeshElementOnShape(face, theFaceID );
+   }
+-  else{
++  else
++  {
+     face = myTool->AddFace(theNode1, theNode2 ,theNode3);
+-    if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID );
++    theMeshDS->SetMeshElementOnShape(face, theFaceID );
+     face = myTool->AddFace(theNode1, theNode3, theNode4);
+-    if(face) theMeshDS->SetMeshElementOnShape(face, theFaceID );
++    theMeshDS->SetMeshElementOnShape(face, theFaceID );
+   }
+ }
+-
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadrangleParams.cpp salomesmesh/src/StdMeshers/StdMeshers_QuadrangleParams.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadrangleParams.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_QuadrangleParams.cpp	1969-12-31 18:00:00.000000000 -0600
+@@ -1,165 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : implementaion of SMESH idl descriptions
+-//  File   : StdMeshers_QuadrangleParams.cxx
+-//  Author : Sergey KUUL, OCC
+-//  Module : SMESH
+-//
+-#include "StdMeshers_QuadrangleParams.hxx"
+-
+-#include "SMESH_Algo.hxx"
+-#include "SMESH_Mesh.hxx"
+-
+-#include <BRep_Tool.hxx>
+-#include <GCPnts_AbscissaPoint.hxx>
+-#include <GeomAdaptor_Curve.hxx>
+-#include <Geom_Curve.hxx>
+-#include <TopExp.hxx>
+-#include <TopLoc_Location.hxx>
+-#include <TopTools_IndexedMapOfShape.hxx>
+-#include <TopoDS.hxx>
+-#include <TopoDS_Edge.hxx>
+-
+-using namespace std;
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId,
+-							 SMESH_Gen * gen)
+-  :SMESH_Hypothesis(hypId, studyId, gen)
+-{
+-  _name = "QuadrangleParams";
+-  _param_algo_dim = 2;
+-  _triaVertexID = -1;
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams()
+-{
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-void StdMeshers_QuadrangleParams::SetTriaVertex(int id)
+-{
+-  if ( id != _triaVertexID ) {
+-    _triaVertexID = id;
+-    NotifySubMeshesHypothesisModification();
+-  }
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
+-{
+-  save << _triaVertexID << " " << _objEntry;
+-  return save;
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
+-{
+-  bool isOK = true;
+-  isOK = (load >> _triaVertexID);
+-  if (!isOK)
+-    load.clear(ios::badbit | load.rdstate());
+-
+-  isOK = (load >> _objEntry);
+-
+-  return load;
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
+-{
+-  return hyp.SaveTo( save );
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
+-{
+-  return hyp.LoadFrom( load );
+-}
+-
+-//================================================================================
+-/*!
+- * \brief Redifined method
+- * \param theMesh - the built mesh
+- * \param theShape - the geometry of interest
+- * \retval bool - true if parameter values have been successfully defined
+- */
+-//================================================================================
+-
+-bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
+-						      const TopoDS_Shape& theShape)
+-{
+-  if ( !theMesh || theShape.IsNull() )
+-    return false;
+-
+-  return true;
+-}
+-
+-//================================================================================
+-/*!
+- * \brief Initialize my parameter values by default parameters.
+- *  \retval bool - true if parameter values have been successfully defined
+- */
+-//================================================================================
+-
+-bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults&  dflts,
+-							  const SMESH_Mesh* /*mesh*/)
+-{
+-  return true;
+-}
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadranglePreference.cpp salomesmesh/src/StdMeshers/StdMeshers_QuadranglePreference.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadranglePreference.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_QuadranglePreference.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,8 @@
+ //  SMESH StdMeshers_QuadranglePreference : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_QuadranglePreference.cxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadranglePreference.cxx,v 1.4.2.1 2008/11/27 13:03:50 abd Exp $
++//
+ #include "StdMeshers_QuadranglePreference.hxx"
+ #include "utilities.h"
+ 
+@@ -125,4 +126,3 @@
+ {
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadraticMesh.cpp salomesmesh/src/StdMeshers/StdMeshers_QuadraticMesh.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadraticMesh.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_QuadraticMesh.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,8 @@
+ //  SMESH StdMeshers_QuadraticMesh : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_QuadraticMesh.cxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadraticMesh.cxx,v 1.4.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #include "StdMeshers_QuadraticMesh.hxx"
+ #include "utilities.h"
+ 
+@@ -120,4 +121,3 @@
+ {
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp	2012-05-04 05:32:54.000000000 -0500
++++ salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -25,6 +25,11 @@
+ // Created   : Wen May 07 16:37:07 2008
+ // Author    : Sergey KUUL (skl)
+ //
++#ifdef _MSC_VER
++#define _USE_MATH_DEFINES
++#endif // _MSC_VER
++#include <cmath>
++
+ #include "StdMeshers_QuadToTriaAdaptor.hxx"
+ 
+ #include <SMDS_FaceOfNodes.hxx>
+@@ -40,6 +45,10 @@
+ #include <gp_Lin.hxx>
+ #include <gp_Pln.hxx>
+ 
++#ifndef PI
++#define PI M_PI
++#endif
++
+ #ifndef __BORLANDC__
+ #include <NCollection_Array1.hxx>
+ typedef NCollection_Array1<TColStd_SequenceOfInteger> StdMeshers_Array1OfSequenceOfInteger;
+@@ -48,6 +57,7 @@
+ typedef SMESH_Array1<TColStd_SequenceOfInteger> StdMeshers_Array1OfSequenceOfInteger;
+ #endif
+ 
++
+ //=======================================================================
+ //function : StdMeshers_QuadToTriaAdaptor
+ //purpose  : 
+@@ -1037,19 +1047,19 @@
+           double ang1 = fabs(VN1.Angle(VI1));
+           double ang2 = fabs(VN2.Angle(VI2));
+           double h1,h2;
+-          if(ang1>M_PI/3.)
++          if(ang1>PI/3.)
+             h1 = VI1.Magnitude()/2;
+           else
+             h1 = VI1.Magnitude()*cos(ang1);
+-          if(ang2>M_PI/3.)
++          if(ang2>PI/3.)
+             h2 = VI2.Magnitude()/2;
+           else
+             h2 = VI2.Magnitude()*cos(ang2);
+           double coef1 = 0.5;
+-          if(ang1<M_PI/3)
++          if(ang1<PI/3)
+             coef1 -= cos(ang1)*0.25;
+           double coef2 = 0.5;
+-          if(ang2<M_PI/3)
++          if(ang2<PI/3)
+             coef2 -= cos(ang1)*0.25;
+ 
+           SMDS_MeshNode* aNode1 = const_cast<SMDS_MeshNode*>(Ns1[4]);
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp salomesmesh/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -42,15 +42,17 @@
+ 
+ #include "utilities.h"
+ 
++#include <Standard_Version.hxx>
+ #include <BRepAdaptor_Curve.hxx>
+ #include <BRepBuilderAPI_MakeEdge.hxx>
+ #include <BRepTools.hxx>
+-#include <BRep_Tool.hxx>
++#if OCC_VERSION_HEX >= 0x060600
++#include <BRepClass3d.hxx>
++#endif
+ #include <TopExp_Explorer.hxx>
+ #include <TopoDS.hxx>
+ #include <TopoDS_Shell.hxx>
+ #include <TopoDS_Solid.hxx>
+-#include <TopTools_MapOfShape.hxx>
+ #include <gp.hxx>
+ #include <gp_Pnt.hxx>
+ 
+@@ -161,7 +163,11 @@
+ 
+   // get 2 shells
+   TopoDS_Solid solid = TopoDS::Solid( aShape );
++#if OCC_VERSION_HEX >= 0x060600
++  TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid );
++#else
+   TopoDS_Shell outerShell = BRepTools::OuterShell( solid );
++#endif
+   TopoDS_Shape innerShell;
+   int nbShells = 0;
+   for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells )
+@@ -388,171 +394,3 @@
+   }
+   RETURN_BAD_RESULT("Bad hypothesis");
+ }
+-
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh,
+-					 const TopoDS_Shape& aShape,
+-					 MapShapeNbElems& aResMap)
+-{
+-  // get 2 shells
+-  TopoDS_Solid solid = TopoDS::Solid( aShape );
+-  TopoDS_Shell outerShell = BRepTools::OuterShell( solid );
+-  TopoDS_Shape innerShell;
+-  int nbShells = 0;
+-  for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells )
+-    if ( !outerShell.IsSame( It.Value() ))
+-      innerShell = It.Value();
+-  if ( nbShells != 2 ) {
+-    std::vector<int> aResVec(SMDSEntity_Last);
+-    for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-    SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-    aResMap.insert(std::make_pair(sm,aResVec));
+-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-    return false;
+-  }
+-
+-  // Associate subshapes of the shells
+-  TAssocTool::TShapeShapeMap shape2ShapeMap;
+-  if ( !TAssocTool::FindSubShapeAssociation( outerShell, &aMesh,
+-                                             innerShell, &aMesh,
+-                                             shape2ShapeMap) ) {
+-    std::vector<int> aResVec(SMDSEntity_Last);
+-    for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-    SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-    aResMap.insert(std::make_pair(sm,aResVec));
+-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-    return false;
+-  }
+-
+-  // get info for outer shell
+-  int nb0d_Out=0, nb2d_3_Out=0, nb2d_4_Out=0;
+-  //TopTools_SequenceOfShape FacesOut;
+-  for (TopExp_Explorer exp(outerShell, TopAbs_FACE); exp.More(); exp.Next()) {
+-    //FacesOut.Append(exp.Current());
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+-    MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
+-    std::vector<int> aVec = (*anIt).second;
+-    nb0d_Out += aVec[SMDSEntity_Node];
+-    nb2d_3_Out += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+-    nb2d_4_Out += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  }
+-  int nb1d_Out = 0;
+-  TopTools_MapOfShape tmpMap;
+-  for (TopExp_Explorer exp(outerShell, TopAbs_EDGE); exp.More(); exp.Next()) {
+-    if( tmpMap.Contains( exp.Current() ) )
+-      continue;
+-    tmpMap.Add( exp.Current() );
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+-    MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
+-    std::vector<int> aVec = (*anIt).second;
+-    nb0d_Out += aVec[SMDSEntity_Node];
+-    nb1d_Out += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-  }
+-  tmpMap.Clear();
+-  for (TopExp_Explorer exp(outerShell, TopAbs_VERTEX); exp.More(); exp.Next()) {
+-    if( tmpMap.Contains( exp.Current() ) )
+-      continue;
+-    tmpMap.Add( exp.Current() );
+-    nb0d_Out++;
+-  }
+-
+-  // get info for inner shell
+-  int nb0d_In=0, nb2d_3_In=0, nb2d_4_In=0;
+-  //TopTools_SequenceOfShape FacesIn;
+-  for (TopExp_Explorer exp(innerShell, TopAbs_FACE); exp.More(); exp.Next()) {
+-    //FacesIn.Append(exp.Current());
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+-    MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
+-    std::vector<int> aVec = (*anIt).second;
+-    nb0d_In += aVec[SMDSEntity_Node];
+-    nb2d_3_In += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
+-    nb2d_4_In += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
+-  }
+-  int nb1d_In = 0;
+-  tmpMap.Clear();
+-  bool IsQuadratic = false;
+-  bool IsFirst = true;
+-  for (TopExp_Explorer exp(innerShell, TopAbs_EDGE); exp.More(); exp.Next()) {
+-    if( tmpMap.Contains( exp.Current() ) )
+-      continue;
+-    tmpMap.Add( exp.Current() );
+-    SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
+-    MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
+-    std::vector<int> aVec = (*anIt).second;
+-    nb0d_In += aVec[SMDSEntity_Node];
+-    nb1d_In += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+-    if(IsFirst) {
+-      IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
+-      IsFirst = false;
+-    }
+-  }
+-  tmpMap.Clear();
+-  for (TopExp_Explorer exp(innerShell, TopAbs_VERTEX); exp.More(); exp.Next()) {
+-    if( tmpMap.Contains( exp.Current() ) )
+-      continue;
+-    tmpMap.Add( exp.Current() );
+-    nb0d_In++;
+-  }
+-
+-  bool IsOK = (nb0d_Out==nb0d_In) && (nb1d_Out==nb1d_In) && 
+-              (nb2d_3_Out==nb2d_3_In) && (nb2d_4_Out==nb2d_4_In);
+-  if(!IsOK) {
+-    std::vector<int> aResVec(SMDSEntity_Last);
+-    for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-    SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-    aResMap.insert(std::make_pair(sm,aResVec));
+-    SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-    smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-    return false;
+-  }
+-
+-  int nbLayers = 0;
+-  if( myNbLayerHypo ) {
+-    nbLayers = myNbLayerHypo->GetNumberOfLayers();
+-  }
+-  if ( myDistributionHypo ) {
+-    if ( !myDistributionHypo->GetLayerDistribution() ) {
+-      std::vector<int> aResVec(SMDSEntity_Last);
+-      for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-      SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-      aResMap.insert(std::make_pair(sm,aResVec));
+-      SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-      return false;
+-    }
+-    TopExp_Explorer exp(outerShell, TopAbs_VERTEX);
+-    TopoDS_Vertex Vout = TopoDS::Vertex(exp.Current());
+-    TopoDS_Vertex Vin = TopoDS::Vertex( shape2ShapeMap(Vout) );
+-    if ( myLayerPositions.empty() ) {
+-      gp_Pnt pIn = BRep_Tool::Pnt(Vin);
+-      gp_Pnt pOut = BRep_Tool::Pnt(Vout);
+-      computeLayerPositions( pIn, pOut );
+-    }
+-    nbLayers = myLayerPositions.size() + 1;
+-  }
+-
+-  std::vector<int> aResVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-  if(IsQuadratic) {
+-    aResVec[SMDSEntity_Quad_Penta] = nb2d_3_Out * nbLayers;
+-    aResVec[SMDSEntity_Quad_Hexa] = nb2d_4_Out * nbLayers;
+-    int nb1d = ( nb2d_3_Out*3 + nb2d_4_Out*4 ) / 2;
+-    aResVec[SMDSEntity_Node] = nb0d_Out * ( 2*nbLayers - 1 ) - nb1d * nbLayers;
+-  }
+-  else {
+-    aResVec[SMDSEntity_Node] = nb0d_Out * ( nbLayers - 1 );
+-    aResVec[SMDSEntity_Penta] = nb2d_3_Out * nbLayers;
+-    aResVec[SMDSEntity_Hexa] = nb2d_4_Out * nbLayers;
+-  }
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-  aResMap.insert(std::make_pair(sm,aResVec));
+-
+-  return true;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cpp salomesmesh/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cpp	2012-05-04 05:32:54.000000000 -0500
++++ salomesmesh/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cpp	1969-12-31 18:00:00.000000000 -0600
+@@ -1,1226 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : implementaion of SMESH idl descriptions
+-// File      : StdMeshers_RadialQuadrangle_1D2D.cxx
+-// Module    : SMESH
+-// Created   : Fri Oct 20 11:37:07 2006
+-// Author    : Edward AGAPOV (eap)
+-//
+-#include "StdMeshers_RadialQuadrangle_1D2D.hxx"
+-
+-//#include "StdMeshers_ProjectionUtils.hxx"
+-#include "StdMeshers_NumberOfLayers.hxx"
+-#include "StdMeshers_LayerDistribution.hxx"
+-//#include "StdMeshers_Prism_3D.hxx"
+-#include "StdMeshers_Regular_1D.hxx"
+-
+-#include "SMDS_MeshNode.hxx"
+-#include "SMESHDS_SubMesh.hxx"
+-#include "SMESH_Gen.hxx"
+-#include "SMESH_Mesh.hxx"
+-#include "SMESH_MesherHelper.hxx"
+-#include "SMESH_subMesh.hxx"
+-#include "SMESH_subMeshEventListener.hxx"
+-
+-#include "utilities.h"
+-
+-#include <BRepAdaptor_Curve.hxx>
+-#include <BRepBuilderAPI_MakeEdge.hxx>
+-#include <BRep_Tool.hxx>
+-#include <GeomAPI_ProjectPointOnSurf.hxx>
+-#include <Geom_Circle.hxx>
+-#include <Geom_Line.hxx>
+-#include <Geom_TrimmedCurve.hxx>
+-#include <TColgp_SequenceOfPnt.hxx>
+-#include <TColgp_SequenceOfPnt2d.hxx>
+-#include <TopExp_Explorer.hxx>
+-#include <TopoDS.hxx>
+-
+-
+-using namespace std;
+-
+-#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
+-#define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z())
+-
+-//typedef StdMeshers_ProjectionUtils TAssocTool;
+-
+-
+-//=======================================================================
+-//function : StdMeshers_RadialQuadrangle_1D2D
+-//purpose  : 
+-//=======================================================================
+-
+-StdMeshers_RadialQuadrangle_1D2D::StdMeshers_RadialQuadrangle_1D2D(int hypId,
+-                                                                   int studyId,
+-                                                                   SMESH_Gen* gen)
+-  :SMESH_2D_Algo(hypId, studyId, gen)
+-{
+-  _name = "RadialQuadrangle_1D2D";
+-  _shapeType = (1 << TopAbs_FACE);        // 1 bit per shape type
+-
+-  _compatibleHypothesis.push_back("LayerDistribution2D");
+-  _compatibleHypothesis.push_back("NumberOfLayers2D");
+-  myNbLayerHypo = 0;
+-  myDistributionHypo = 0;
+-  _requireDescretBoundary = false;
+-}
+-
+-
+-//================================================================================
+-/*!
+- * \brief Destructor
+- */
+-//================================================================================
+-
+-StdMeshers_RadialQuadrangle_1D2D::~StdMeshers_RadialQuadrangle_1D2D()
+-{}
+-
+-
+-//=======================================================================
+-//function : CheckHypothesis
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_RadialQuadrangle_1D2D::CheckHypothesis
+-                           (SMESH_Mesh&                          aMesh,
+-                            const TopoDS_Shape&                  aShape,
+-                            SMESH_Hypothesis::Hypothesis_Status& aStatus)
+-{
+-  // check aShape 
+-  myNbLayerHypo = 0;
+-  myDistributionHypo = 0;
+-
+-  list <const SMESHDS_Hypothesis * >::const_iterator itl;
+-
+-  const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
+-  if ( hyps.size() == 0 ) {
+-    aStatus = SMESH_Hypothesis::HYP_MISSING;
+-    return false;  // can't work with no hypothesis
+-  }
+-
+-  if ( hyps.size() > 1 ) {
+-    aStatus = SMESH_Hypothesis::HYP_ALREADY_EXIST;
+-    return false;
+-  }
+-
+-  const SMESHDS_Hypothesis *theHyp = hyps.front();
+-
+-  string hypName = theHyp->GetName();
+-
+-  if (hypName == "NumberOfLayers2D") {
+-    myNbLayerHypo = static_cast<const StdMeshers_NumberOfLayers *>(theHyp);
+-    aStatus = SMESH_Hypothesis::HYP_OK;
+-    return true;
+-  }
+-  if (hypName == "LayerDistribution2D") {
+-    myDistributionHypo = static_cast<const StdMeshers_LayerDistribution *>(theHyp);
+-    aStatus = SMESH_Hypothesis::HYP_OK;
+-    return true;
+-  }
+-  aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
+-  return true;
+-}
+-
+-namespace
+-{
+-  // ------------------------------------------------------------------------------
+-  /*!
+-   * \brief Listener used to mark edges meshed by StdMeshers_RadialQuadrangle_1D2D
+-   */
+-  class TLinEdgeMarker : public SMESH_subMeshEventListener
+-  {
+-    TLinEdgeMarker(): SMESH_subMeshEventListener(/*isDeletable=*/false) {}
+-  public:
+-    static SMESH_subMeshEventListener* getListener()
+-    {
+-      static TLinEdgeMarker theEdgeMarker;
+-      return &theEdgeMarker;
+-    }
+-  };
+-  
+-  // ------------------------------------------------------------------------------
+-  /*!
+-   * \brief Mark an edge as computed by StdMeshers_RadialQuadrangle_1D2D
+-   */
+-  void markLinEdgeAsComputedByMe(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh)
+-  {
+-    if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge ))
+-    {
+-      if ( !edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() ))
+-        faceSubMesh->SetEventListener( TLinEdgeMarker::getListener(),
+-                                       SMESH_subMeshEventListenerData::MakeData(faceSubMesh),
+-                                       edgeSM);
+-    }
+-  }
+-  // ------------------------------------------------------------------------------
+-  /*!
+-   * \brief Return true if a radial edge was meshed with StdMeshers_RadialQuadrangle_1D2D with
+-   * the same radial distribution
+-   */
+-  bool isEdgeCompitaballyMeshed(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh)
+-  {
+-    if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge ))
+-    {
+-      if ( SMESH_subMeshEventListenerData* otherFaceData =
+-           edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() ))
+-      {
+-        // compare hypothesis aplied to two disk faces sharing radial edges
+-        SMESH_Mesh& mesh = *faceSubMesh->GetFather();
+-        SMESH_Algo* radialQuadAlgo = mesh.GetGen()->GetAlgo(mesh, faceSubMesh->GetSubShape() );
+-        SMESH_subMesh* otherFaceSubMesh = otherFaceData->mySubMeshes.front();
+-        const list <const SMESHDS_Hypothesis *> & hyps1 =
+-          radialQuadAlgo->GetUsedHypothesis( mesh, faceSubMesh->GetSubShape());
+-        const list <const SMESHDS_Hypothesis *> & hyps2 =
+-          radialQuadAlgo->GetUsedHypothesis( mesh, otherFaceSubMesh->GetSubShape());
+-        if( hyps1.empty() && hyps2.empty() )
+-          return true; // defaul hyps
+-        if ( hyps1.size() != hyps2.size() ||
+-             strcmp( hyps1.front()->GetName(), hyps2.front()->GetName() ))
+-          return false;
+-        ostringstream hypDump1, hypDump2;
+-        list <const SMESHDS_Hypothesis*>::const_iterator hyp1 = hyps1.begin();
+-        for ( ; hyp1 != hyps1.end(); ++hyp1 )
+-          const_cast<SMESHDS_Hypothesis*>(*hyp1)->SaveTo( hypDump1 );
+-        list <const SMESHDS_Hypothesis*>::const_iterator hyp2 = hyps2.begin();
+-        for ( ; hyp2 != hyps2.end(); ++hyp2 )
+-          const_cast<SMESHDS_Hypothesis*>(*hyp2)->SaveTo( hypDump2 );
+-        return hypDump1.str() == hypDump2.str();
+-      }
+-    }
+-    return false;
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Return base curve of the edge and extremum parameters
+-   */
+-  //================================================================================
+-
+-  Handle(Geom_Curve) getCurve(const TopoDS_Edge& edge, double* f=0, double* l=0)
+-  {
+-    Handle(Geom_Curve) C;
+-    if ( !edge.IsNull() )
+-    {
+-      double first = 0., last = 0.;
+-      C = BRep_Tool::Curve(edge, first, last);
+-      if ( !C.IsNull() )
+-      {
+-        Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C);
+-        while( !tc.IsNull() ) {
+-          C = tc->BasisCurve();
+-          tc = Handle(Geom_TrimmedCurve)::DownCast(C);
+-        }
+-        if ( f ) *f = first;
+-        if ( l ) *l = last;
+-      }
+-    }
+-    return C;
+-  }
+-
+-  //================================================================================
+-  /*!
+-   * \brief Return edges of the face
+-   *  \retval int - nb of edges
+-   */
+-  //================================================================================
+-
+-  int analyseFace(const TopoDS_Shape& face,
+-                  TopoDS_Edge&        CircEdge,
+-                  TopoDS_Edge&        LinEdge1,
+-                  TopoDS_Edge&        LinEdge2)
+-  {
+-    CircEdge.Nullify(); LinEdge1.Nullify(); LinEdge2.Nullify();
+-    int nbe = 0;
+-
+-    for ( TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next(), ++nbe )
+-    {
+-      const TopoDS_Edge& E = TopoDS::Edge( exp.Current() );
+-      double f,l;
+-      Handle(Geom_Curve) C = getCurve(E,&f,&l);
+-      if ( !C.IsNull() )
+-      {
+-        if ( C->IsKind( STANDARD_TYPE(Geom_Circle)))
+-        {
+-          if ( CircEdge.IsNull() )
+-            CircEdge = E;
+-          else
+-            return 0;
+-        }
+-        else if ( LinEdge1.IsNull() )
+-          LinEdge1 = E;
+-        else
+-          LinEdge2 = E;
+-      }
+-    }
+-    return nbe;
+-  }
+-}
+-
+-//=======================================================================
+-/*!
+- * \brief Allow algo to do something after persistent restoration
+- * \param subMesh - restored submesh
+- *
+- * call markLinEdgeAsComputedByMe()
+- */
+-//=======================================================================
+-
+-void StdMeshers_RadialQuadrangle_1D2D::SubmeshRestored(SMESH_subMesh* faceSubMesh)
+-{
+-  if ( !faceSubMesh->IsEmpty() )
+-  {
+-    TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
+-    analyseFace( faceSubMesh->GetSubShape(), CircEdge, LinEdge1, LinEdge2 );
+-    if ( !LinEdge1.IsNull() ) markLinEdgeAsComputedByMe( LinEdge1, faceSubMesh );
+-    if ( !LinEdge2.IsNull() ) markLinEdgeAsComputedByMe( LinEdge2, faceSubMesh );
+-  }
+-}
+-
+-//=======================================================================
+-//function : Compute
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh&         aMesh,
+-                                               const TopoDS_Shape& aShape)
+-{
+-  TopExp_Explorer exp;
+-  SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+-
+-  myHelper = new SMESH_MesherHelper( aMesh );
+-  myHelper->IsQuadraticSubMesh( aShape );
+-  // to delete helper at exit from Compute()
+-  auto_ptr<SMESH_MesherHelper> helperDeleter( myHelper );
+-
+-  myLayerPositions.clear();
+-
+-  TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
+-  int nbe = analyseFace( aShape, CircEdge, LinEdge1, LinEdge2 );
+-  if( nbe>3 || nbe < 1 || CircEdge.IsNull() )
+-    return error(COMPERR_BAD_SHAPE);
+-  
+-  gp_Pnt P0,P1;
+-  // points for rotation
+-  TColgp_SequenceOfPnt Points;
+-  // angles for rotation
+-  TColStd_SequenceOfReal Angles;
+-  // Nodes1 and Nodes2 - nodes along radiuses
+-  // CNodes - nodes on circle edge
+-  vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes;
+-  SMDS_MeshNode * NC;
+-  // parameters edge nodes on face
+-  TColgp_SequenceOfPnt2d Pnts2d1;
+-  gp_Pnt2d PC;
+-
+-  int faceID = meshDS->ShapeToIndex(aShape);
+-  TopoDS_Face F = TopoDS::Face(aShape);
+-  Handle(Geom_Surface) S = BRep_Tool::Surface(F);
+-
+-  if(nbe==1)
+-  {
+-    Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge ));
+-
+-    bool ok = _gen->Compute( aMesh, CircEdge );
+-    if( !ok ) return false;
+-    map< double, const SMDS_MeshNode* > theNodes;
+-    ok = GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
+-    if( !ok ) return false;
+-
+-    CNodes.clear();
+-    map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
+-    const SMDS_MeshNode* NF = (*itn).second;
+-    CNodes.push_back( (*itn).second );
+-    double fang = (*itn).first;
+-    if ( itn != theNodes.end() ) {
+-      itn++;
+-      for(; itn != theNodes.end(); itn++ ) {
+-        CNodes.push_back( (*itn).second );
+-        double ang = (*itn).first - fang;
+-        if( ang>M_PI ) ang = ang - 2*M_PI;
+-        if( ang<-M_PI ) ang = ang + 2*M_PI;
+-        Angles.Append( ang ); 
+-      }
+-    }
+-    P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() );
+-    P0 = aCirc->Location();
+-
+-    myLayerPositions.clear();
+-    computeLayerPositions(P0,P1);
+-
+-    exp.Init( CircEdge, TopAbs_VERTEX );
+-    TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() );
+-    gp_Pnt2d p2dV = BRep_Tool::Parameters( V1, TopoDS::Face(aShape) );
+-
+-    NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
+-    GeomAPI_ProjectPointOnSurf PPS(P0,S);
+-    double U0,V0;
+-    PPS.Parameters(1,U0,V0);
+-    meshDS->SetNodeOnFace(NC, faceID, U0, V0);
+-    PC = gp_Pnt2d(U0,V0);
+-
+-    gp_Vec aVec(P0,P1);
+-    gp_Vec2d aVec2d(PC,p2dV);
+-    Nodes1.resize( myLayerPositions.size()+1 );
+-    Nodes2.resize( myLayerPositions.size()+1 );
+-    int i = 0;
+-    for(; i<myLayerPositions.size(); i++) {
+-      gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+-                P0.Y() + aVec.Y()*myLayerPositions[i],
+-                P0.Z() + aVec.Z()*myLayerPositions[i] );
+-      Points.Append(P);
+-      SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+-      Nodes1[i] = node;
+-      Nodes2[i] = node;
+-      double U = PC.X() + aVec2d.X()*myLayerPositions[i];
+-      double V = PC.Y() + aVec2d.Y()*myLayerPositions[i];
+-      meshDS->SetNodeOnFace( node, faceID, U, V );
+-      Pnts2d1.Append(gp_Pnt2d(U,V));
+-    }
+-    Nodes1[Nodes1.size()-1] = NF;
+-    Nodes2[Nodes1.size()-1] = NF;
+-  }
+-  else if(nbe==2 && LinEdge1.Orientation() != TopAbs_INTERNAL )
+-  {
+-    // one curve must be a half of circle and other curve must be
+-    // a segment of line
+-    double fp, lp;
+-    Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp ));
+-    if( fabs(fabs(lp-fp)-M_PI) > Precision::Confusion() ) {
+-      // not half of circle
+-      return error(COMPERR_BAD_SHAPE);
+-    }
+-    Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 ));
+-    if( aLine.IsNull() ) {
+-      // other curve not line
+-      return error(COMPERR_BAD_SHAPE);
+-    }
+-    bool linEdgeComputed = false;
+-    if( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1) ) {
+-      if( !sm1->IsEmpty() )
+-        if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) ))
+-          linEdgeComputed = true;
+-        else
+-          return error("Invalid set of hypotheses");
+-    }
+-
+-    bool ok = _gen->Compute( aMesh, CircEdge );
+-    if( !ok ) return false;
+-    map< double, const SMDS_MeshNode* > theNodes;
+-    GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
+-
+-    CNodes.clear();
+-    map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
+-    double fang = (*itn).first;
+-    itn++;
+-    for(; itn != theNodes.end(); itn++ ) {
+-      CNodes.push_back( (*itn).second );
+-      double ang = (*itn).first - fang;
+-      if( ang>M_PI ) ang = ang - 2*M_PI;
+-      if( ang<-M_PI ) ang = ang + 2*M_PI;
+-      Angles.Append( ang );
+-    }
+-    const SMDS_MeshNode* NF = theNodes.begin()->second;
+-    const SMDS_MeshNode* NL = theNodes.rbegin()->second;
+-    CNodes.push_back( NF );
+-    P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() );
+-    gp_Pnt P2( NL->X(), NL->Y(), NL->Z() );
+-    P0 = aCirc->Location();
+-
+-    myLayerPositions.clear();
+-    computeLayerPositions(P0,P1);
+-
+-    if ( linEdgeComputed )
+-    {
+-      if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes))
+-        return error("Invalid mesh on a straight edge");
+-
+-      vector< const SMDS_MeshNode* > *pNodes1 = &Nodes1, *pNodes2 = &Nodes2;
+-      bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF );
+-      if ( !nodesFromP0ToP1 ) std::swap( pNodes1, pNodes2 );
+-
+-      map< double, const SMDS_MeshNode* >::reverse_iterator ritn = theNodes.rbegin();
+-      itn = theNodes.begin();
+-      for ( int i = Nodes1.size()-1; i > -1; ++itn, ++ritn, --i )
+-      {
+-        (*pNodes1)[i] = ritn->second;
+-        (*pNodes2)[i] =  itn->second;
+-        Points.Append( gpXYZ( Nodes1[i]));
+-        Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i]));
+-      }
+-      NC = const_cast<SMDS_MeshNode*>( itn->second );
+-      Points.Remove( Nodes1.size() );
+-    }
+-    else
+-    {
+-      gp_Vec aVec(P0,P1);
+-      int edgeID = meshDS->ShapeToIndex(LinEdge1);
+-      // check orientation
+-      Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp);
+-      gp_Pnt Ptmp;
+-      Crv->D0(fp,Ptmp);
+-      bool ori = true;
+-      if( P1.Distance(Ptmp) > Precision::Confusion() )
+-        ori = false;
+-      // get UV points for edge
+-      gp_Pnt2d PF,PL;
+-      BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL );
+-      PC = gp_Pnt2d( (PF.X()+PL.X())/2, (PF.Y()+PL.Y())/2 );
+-      gp_Vec2d V2d;
+-      if(ori) V2d = gp_Vec2d(PC,PF);
+-      else V2d = gp_Vec2d(PC,PL);
+-      // add nodes on edge
+-      double cp = (fp+lp)/2;
+-      double dp2 = (lp-fp)/2;
+-      NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
+-      meshDS->SetNodeOnEdge(NC, edgeID, cp);
+-      Nodes1.resize( myLayerPositions.size()+1 );
+-      Nodes2.resize( myLayerPositions.size()+1 );
+-      int i = 0;
+-      for(; i<myLayerPositions.size(); i++) {
+-        gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+-                  P0.Y() + aVec.Y()*myLayerPositions[i],
+-                  P0.Z() + aVec.Z()*myLayerPositions[i] );
+-        Points.Append(P);
+-        SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+-        Nodes1[i] = node;
+-        double param;
+-        if(ori)
+-          param = fp + dp2*(1-myLayerPositions[i]);
+-        else
+-          param = cp + dp2*myLayerPositions[i];
+-        meshDS->SetNodeOnEdge(node, edgeID, param);
+-        P = gp_Pnt( P0.X() - aVec.X()*myLayerPositions[i],
+-                    P0.Y() - aVec.Y()*myLayerPositions[i],
+-                    P0.Z() - aVec.Z()*myLayerPositions[i] );
+-        node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+-        Nodes2[i] = node;
+-        if(!ori)
+-          param = fp + dp2*(1-myLayerPositions[i]);
+-        else
+-          param = cp + dp2*myLayerPositions[i];
+-        meshDS->SetNodeOnEdge(node, edgeID, param);
+-        // parameters on face
+-        gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
+-                      PC.Y() + V2d.Y()*myLayerPositions[i] );
+-        Pnts2d1.Append(P2d);
+-      }
+-      Nodes1[ myLayerPositions.size() ] = NF;
+-      Nodes2[ myLayerPositions.size() ] = NL;
+-      // create 1D elements on edge
+-      vector< const SMDS_MeshNode* > tmpNodes;
+-      tmpNodes.resize(2*Nodes1.size()+1);
+-      for(i=0; i<Nodes2.size(); i++)
+-        tmpNodes[Nodes2.size()-i-1] = Nodes2[i];
+-      tmpNodes[Nodes2.size()] = NC;
+-      for(i=0; i<Nodes1.size(); i++)
+-        tmpNodes[Nodes2.size()+1+i] = Nodes1[i];
+-      for(i=1; i<tmpNodes.size(); i++) {
+-        SMDS_MeshEdge* ME = myHelper->AddEdge( tmpNodes[i-1], tmpNodes[i] );
+-        if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+-      }
+-      markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F ));
+-    }
+-  }
+-  else // nbe==3 or ( nbe==2 && linEdge is INTERNAL )
+-  {
+-    if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
+-      LinEdge2 = LinEdge1;
+-
+-    // one curve must be a part of circle and other curves must be
+-    // segments of line
+-    double fp, lp;
+-    Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge ));
+-    Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 ));
+-    Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 ));
+-    if( aLine1.IsNull() || aLine2.IsNull() ) {
+-      // other curve not line
+-      return error(COMPERR_BAD_SHAPE);
+-    }
+-
+-    bool linEdge1Computed = false;
+-    if ( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1))
+-      if( !sm1->IsEmpty() )
+-        if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) ))
+-          linEdge1Computed = true;
+-        else
+-          return error("Invalid set of hypotheses");
+-
+-    bool linEdge2Computed = false;
+-    if ( SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2))
+-      if( !sm2->IsEmpty() )
+-        if( isEdgeCompitaballyMeshed( LinEdge2, aMesh.GetSubMesh(F)  ))
+-          linEdge2Computed = true;
+-        else
+-          return error("Invalid set of hypotheses");
+-
+-    bool ok = _gen->Compute( aMesh, CircEdge );
+-    if( !ok ) return false;
+-    map< double, const SMDS_MeshNode* > theNodes;
+-    GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes);
+-
+-    const SMDS_MeshNode* NF = theNodes.begin()->second;
+-    const SMDS_MeshNode* NL = theNodes.rbegin()->second;
+-    CNodes.clear();
+-    CNodes.push_back( NF );
+-    map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin();
+-    double fang = (*itn).first;
+-    itn++;
+-    for(; itn != theNodes.end(); itn++ ) {
+-      CNodes.push_back( (*itn).second );
+-      double ang = (*itn).first - fang;
+-      if( ang>M_PI ) ang = ang - 2*M_PI;
+-      if( ang<-M_PI ) ang = ang + 2*M_PI;
+-      Angles.Append( ang );
+-    }
+-    P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() );
+-    gp_Pnt P2( NL->X(), NL->Y(), NL->Z() );
+-    P0 = aCirc->Location();
+-
+-    myLayerPositions.clear();
+-    computeLayerPositions(P0,P1);
+-
+-    Nodes1.resize( myLayerPositions.size()+1 );
+-    Nodes2.resize( myLayerPositions.size()+1 );
+-
+-    exp.Init( LinEdge1, TopAbs_VERTEX );
+-    TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() );
+-    exp.Next();
+-    TopoDS_Vertex V2 = TopoDS::Vertex( exp.Current() );
+-    gp_Pnt PE1 = BRep_Tool::Pnt(V1);
+-    gp_Pnt PE2 = BRep_Tool::Pnt(V2);
+-    if( ( P1.Distance(PE1) > Precision::Confusion() ) &&
+-        ( P1.Distance(PE2) > Precision::Confusion() ) )
+-    {
+-      std::swap( LinEdge1, LinEdge2 );
+-      std::swap( linEdge1Computed, linEdge2Computed );
+-    }
+-    TopoDS_Vertex VC = V2;
+-    if( ( P1.Distance(PE1) > Precision::Confusion() ) &&
+-        ( P2.Distance(PE1) > Precision::Confusion() ) )
+-      VC = V1;
+-    int vertID = meshDS->ShapeToIndex(VC);
+-
+-    // LinEdge1
+-    if ( linEdge1Computed )
+-    {
+-      if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes))
+-        return error("Invalid mesh on a straight edge");
+-
+-      bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF );
+-      NC = const_cast<SMDS_MeshNode*>
+-        ( nodesFromP0ToP1 ? theNodes.begin()->second : theNodes.rbegin()->second );
+-      int i = 0, ir = Nodes1.size()-1;
+-      int * pi = nodesFromP0ToP1 ? &i : &ir;
+-      itn = theNodes.begin();
+-      if ( nodesFromP0ToP1 ) ++itn;
+-      for ( ; i < Nodes1.size(); ++i, --ir, ++itn )
+-      {
+-        Nodes1[*pi] = itn->second;
+-      }
+-      for ( i = 0; i < Nodes1.size()-1; ++i )
+-      {
+-        Points.Append( gpXYZ( Nodes1[i]));
+-        Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i]));
+-      }
+-    }
+-    else
+-    {
+-      int edgeID = meshDS->ShapeToIndex(LinEdge1);
+-      gp_Vec aVec(P0,P1);
+-      // check orientation
+-      Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp);
+-      gp_Pnt Ptmp = Crv->Value(fp);
+-      bool ori = false;
+-      if( P1.Distance(Ptmp) > Precision::Confusion() )
+-        ori = true;
+-      // get UV points for edge
+-      gp_Pnt2d PF,PL;
+-      BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL );
+-      gp_Vec2d V2d;
+-      if(ori) {
+-        V2d = gp_Vec2d(PF,PL);
+-        PC = PF;
+-      }
+-      else {
+-        V2d = gp_Vec2d(PL,PF);
+-        PC = PL;
+-      }
+-      NC = const_cast<SMDS_MeshNode*>( VertexNode( VC, meshDS ));
+-      if ( !NC )
+-      {
+-        NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z());
+-        meshDS->SetNodeOnVertex(NC, vertID);
+-      }
+-      double dp = lp-fp;
+-      int i = 0;
+-      for(; i<myLayerPositions.size(); i++) {
+-        gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+-                  P0.Y() + aVec.Y()*myLayerPositions[i],
+-                  P0.Z() + aVec.Z()*myLayerPositions[i] );
+-        Points.Append(P);
+-        SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+-        Nodes1[i] = node;
+-        double param;
+-        if(!ori)
+-          param = fp + dp*(1-myLayerPositions[i]);
+-        else
+-          param = fp + dp*myLayerPositions[i];
+-        meshDS->SetNodeOnEdge(node, edgeID, param);
+-        // parameters on face
+-        gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
+-                      PC.Y() + V2d.Y()*myLayerPositions[i] );
+-        Pnts2d1.Append(P2d);
+-      }
+-      Nodes1[ myLayerPositions.size() ] = NF;
+-      // create 1D elements on edge
+-      SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] );
+-      if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+-      for(i=1; i<Nodes1.size(); i++) {
+-        ME = myHelper->AddEdge( Nodes1[i-1], Nodes1[i] );
+-        if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+-      }
+-      if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
+-        Nodes2 = Nodes1;
+-    }
+-    markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F ));
+-
+-    // LinEdge2
+-    if ( linEdge2Computed )
+-    {
+-      if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge2,true,theNodes))
+-        return error("Invalid mesh on a straight edge");
+-
+-      bool nodesFromP0ToP2 = ( theNodes.rbegin()->second == NL );
+-      int i = 0, ir = Nodes1.size()-1;
+-      int * pi = nodesFromP0ToP2 ? &i : &ir;
+-      itn = theNodes.begin();
+-      if ( nodesFromP0ToP2 ) ++itn;
+-      for ( ; i < Nodes2.size(); ++i, --ir, ++itn )
+-        Nodes2[*pi] = itn->second;
+-    }
+-    else
+-    {
+-      int edgeID = meshDS->ShapeToIndex(LinEdge2);
+-      gp_Vec aVec = gp_Vec(P0,P2);
+-      // check orientation
+-      Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge2,fp,lp);
+-      gp_Pnt Ptmp = Crv->Value(fp);
+-      bool ori = false;
+-      if( P2.Distance(Ptmp) > Precision::Confusion() )
+-        ori = true;
+-      // get UV points for edge
+-      gp_Pnt2d PF,PL;
+-      BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL );
+-      gp_Vec2d V2d;
+-      if(ori) {
+-        V2d = gp_Vec2d(PF,PL);
+-        PC = PF;
+-      }
+-      else {
+-        V2d = gp_Vec2d(PL,PF);
+-        PC = PL;
+-      }
+-      double dp = lp-fp;
+-      for(int i=0; i<myLayerPositions.size(); i++) {
+-        gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
+-                  P0.Y() + aVec.Y()*myLayerPositions[i],
+-                  P0.Z() + aVec.Z()*myLayerPositions[i] );
+-        SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
+-        Nodes2[i] = node;
+-        double param;
+-        if(!ori)
+-          param = fp + dp*(1-myLayerPositions[i]);
+-        else
+-          param = fp + dp*myLayerPositions[i];
+-        meshDS->SetNodeOnEdge(node, edgeID, param);
+-        // parameters on face
+-        gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i],
+-                      PC.Y() + V2d.Y()*myLayerPositions[i] );
+-      }
+-      Nodes2[ myLayerPositions.size() ] = NL;
+-      // create 1D elements on edge
+-      SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes2[0] );
+-      if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+-      for(int i=1; i<Nodes2.size(); i++) {
+-        ME = myHelper->AddEdge( Nodes2[i-1], Nodes2[i] );
+-        if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
+-      }
+-    }
+-    markLinEdgeAsComputedByMe( LinEdge2, aMesh.GetSubMesh( F ));
+-  }
+-
+-  // orientation
+-  bool IsForward = ( CircEdge.Orientation()==TopAbs_FORWARD );
+-
+-  // create nodes and mesh elements on face
+-  // find axis of rotation
+-  gp_Pnt P2 = gp_Pnt( CNodes[1]->X(), CNodes[1]->Y(), CNodes[1]->Z() );
+-  gp_Vec Vec1(P0,P1);
+-  gp_Vec Vec2(P0,P2);
+-  gp_Vec Axis = Vec1.Crossed(Vec2);
+-  // create elements
+-  int i = 1;
+-  //cout<<"Angles.Length() = "<<Angles.Length()<<"   Points.Length() = "<<Points.Length()<<endl;
+-  //cout<<"Nodes1.size() = "<<Nodes1.size()<<"   Pnts2d1.Length() = "<<Pnts2d1.Length()<<endl;
+-  for(; i<Angles.Length(); i++) {
+-    vector< const SMDS_MeshNode* > tmpNodes;
+-    tmpNodes.reserve(Nodes1.size());
+-    gp_Trsf aTrsf;
+-    gp_Ax1 theAxis(P0,gp_Dir(Axis));
+-    aTrsf.SetRotation( theAxis, Angles.Value(i) );
+-    gp_Trsf2d aTrsf2d;
+-    aTrsf2d.SetRotation( PC, Angles.Value(i) );
+-    // create nodes
+-    int j = 1;
+-    for(; j<=Points.Length(); j++) {
+-      double cx,cy,cz;
+-      Points.Value(j).Coord( cx, cy, cz );
+-      aTrsf.Transforms( cx, cy, cz );
+-      SMDS_MeshNode* node = myHelper->AddNode( cx, cy, cz );
+-      // find parameters on face
+-      Pnts2d1.Value(j).Coord( cx, cy );
+-      aTrsf2d.Transforms( cx, cy );
+-      // set node on face
+-      meshDS->SetNodeOnFace( node, faceID, cx, cy );
+-      tmpNodes[j-1] = node;
+-    }
+-    // create faces
+-    tmpNodes[Points.Length()] = CNodes[i];
+-    // quad
+-    for(j=0; j<Nodes1.size()-1; j++) {
+-      SMDS_MeshFace* MF;
+-      if(IsForward)
+-        MF = myHelper->AddFace( tmpNodes[j], Nodes1[j],
+-                                Nodes1[j+1], tmpNodes[j+1] );
+-      else
+-        MF = myHelper->AddFace( tmpNodes[j], tmpNodes[j+1],
+-                                Nodes1[j+1], Nodes1[j] );
+-      if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+-    }
+-    // tria
+-    SMDS_MeshFace* MF;
+-    if(IsForward)
+-      MF = myHelper->AddFace( NC, Nodes1[0], tmpNodes[0] );
+-    else
+-      MF = myHelper->AddFace( NC, tmpNodes[0], Nodes1[0] );
+-    if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+-    for(j=0; j<Nodes1.size(); j++) {
+-      Nodes1[j] = tmpNodes[j];
+-    }
+-  }
+-  // create last faces
+-  // quad
+-  for(i=0; i<Nodes1.size()-1; i++) {
+-    SMDS_MeshFace* MF;
+-    if(IsForward)
+-      MF = myHelper->AddFace( Nodes2[i], Nodes1[i],
+-                              Nodes1[i+1], Nodes2[i+1] );
+-    else
+-      MF = myHelper->AddFace( Nodes2[i],  Nodes2[i+1],
+-                              Nodes1[i+1], Nodes1[i] );
+-    if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+-  }
+-  // tria
+-  SMDS_MeshFace* MF;
+-  if(IsForward)
+-    MF = myHelper->AddFace( NC, Nodes1[0], Nodes2[0] );
+-  else
+-    MF = myHelper->AddFace( NC, Nodes2[0], Nodes1[0] );
+-  if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
+-
+-  return true;
+-}
+-
+-
+-//================================================================================
+-//================================================================================
+-/*!
+- * \brief Class computing layers distribution using data of
+- *        StdMeshers_LayerDistribution hypothesis
+- */
+-//================================================================================
+-//================================================================================
+-
+-class TNodeDistributor: public StdMeshers_Regular_1D
+-{
+-  list <const SMESHDS_Hypothesis *> myUsedHyps;
+-public:
+-  // -----------------------------------------------------------------------------
+-  static TNodeDistributor* GetDistributor(SMESH_Mesh& aMesh)
+-  {
+-    const int myID = -1000;
+-    map < int, SMESH_1D_Algo * > & algoMap = aMesh.GetGen()->_map1D_Algo;
+-    map < int, SMESH_1D_Algo * >::iterator id_algo = algoMap.find( myID );
+-    if ( id_algo == algoMap.end() )
+-      return new TNodeDistributor( myID, 0, aMesh.GetGen() );
+-    return static_cast< TNodeDistributor* >( id_algo->second );
+-  }
+-  // -----------------------------------------------------------------------------
+-  bool Compute( vector< double > &                  positions,
+-                gp_Pnt                              pIn,
+-                gp_Pnt                              pOut,
+-                SMESH_Mesh&                         aMesh,
+-                const StdMeshers_LayerDistribution* hyp)
+-  {
+-    double len = pIn.Distance( pOut );
+-    if ( len <= DBL_MIN ) return error("Too close points of inner and outer shells");
+-
+-    if ( !hyp || !hyp->GetLayerDistribution() )
+-      return error( "Invalid LayerDistribution hypothesis");
+-    myUsedHyps.clear();
+-    myUsedHyps.push_back( hyp->GetLayerDistribution() );
+-
+-    TopoDS_Edge edge = BRepBuilderAPI_MakeEdge( pIn, pOut );
+-    SMESH_Hypothesis::Hypothesis_Status aStatus;
+-    if ( !StdMeshers_Regular_1D::CheckHypothesis( aMesh, edge, aStatus ))
+-      return error( "StdMeshers_Regular_1D::CheckHypothesis() failed "
+-                    "with LayerDistribution hypothesis");
+-
+-    BRepAdaptor_Curve C3D(edge);
+-    double f = C3D.FirstParameter(), l = C3D.LastParameter();
+-    list< double > params;
+-    if ( !StdMeshers_Regular_1D::computeInternalParameters( aMesh, C3D, len, f, l, params, false ))
+-      return error("StdMeshers_Regular_1D failed to compute layers distribution");
+-
+-    positions.clear();
+-    positions.reserve( params.size() );
+-    for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++)
+-      positions.push_back( *itU / len );
+-    return true;
+-  }
+-protected:
+-  // -----------------------------------------------------------------------------
+-  TNodeDistributor( int hypId, int studyId, SMESH_Gen* gen)
+-    : StdMeshers_Regular_1D( hypId, studyId, gen)
+-  {
+-  }
+-  // -----------------------------------------------------------------------------
+-  virtual const list <const SMESHDS_Hypothesis *> &
+-    GetUsedHypothesis(SMESH_Mesh &, const TopoDS_Shape &, const bool)
+-  {
+-    return myUsedHyps;
+-  }
+-  // -----------------------------------------------------------------------------
+-};
+-
+-//================================================================================
+-/*!
+- * \brief Compute positions of nodes between the internal and the external surfaces
+-  * \retval bool - is a success
+- */
+-//================================================================================
+-
+-bool StdMeshers_RadialQuadrangle_1D2D::computeLayerPositions(const gp_Pnt& pIn,
+-                                                             const gp_Pnt& pOut)
+-{
+-  if ( myNbLayerHypo )
+-  {
+-    int nbSegments = myNbLayerHypo->GetNumberOfLayers();
+-    myLayerPositions.resize( nbSegments - 1 );
+-    for ( int z = 1; z < nbSegments; ++z )
+-      myLayerPositions[ z - 1 ] = double( z )/ double( nbSegments );
+-    return true;
+-  }
+-  if ( myDistributionHypo ) {
+-    SMESH_Mesh * mesh = myHelper->GetMesh();
+-    if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions, pIn, pOut,
+-                                                            *mesh, myDistributionHypo ))
+-    {
+-      error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() );
+-      return false;
+-    }
+-  }
+-  RETURN_BAD_RESULT("Bad hypothesis");
+-}
+-
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh,
+-                                                const TopoDS_Shape& aShape,
+-                                                MapShapeNbElems& aResMap)
+-{
+-  if( aShape.ShapeType() != TopAbs_FACE ) {
+-    return false;
+-  }
+-  SMESH_subMesh * smf = aMesh.GetSubMesh(aShape);
+-  MapShapeNbElemsItr anIt = aResMap.find(smf);
+-  if( anIt != aResMap.end() ) {
+-    return false;
+-  }
+-
+-  myLayerPositions.clear();
+-  gp_Pnt P0(0,0,0);
+-  gp_Pnt P1(100,0,0);
+-  computeLayerPositions(P0,P1);
+-
+-  TopoDS_Edge E1,E2,E3;
+-  Handle(Geom_Curve) C1,C2,C3;
+-  double f1,l1,f2,l2,f3,l3;
+-  int nbe = 0;
+-  TopExp_Explorer exp;
+-  for ( exp.Init( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) {
+-    nbe++;
+-    TopoDS_Edge E = TopoDS::Edge( exp.Current() );
+-    if(nbe==1) {
+-      E1 = E;
+-      C1 = BRep_Tool::Curve(E,f1,l1);
+-    }
+-    else if(nbe==2) {
+-      E2 = E;
+-      C2 = BRep_Tool::Curve(E,f2,l2);
+-    }
+-    else if(nbe==3) {
+-      E3 = E;
+-      C3 = BRep_Tool::Curve(E,f3,l3);
+-    }
+-  }
+-
+-  TopoDS_Edge CircEdge, LinEdge1, LinEdge2;
+-  int nb0d=0, nb2d_tria=0, nb2d_quad=0;
+-  bool isQuadratic = false;
+-  if(nbe==1) {
+-    // C1 must be a circle
+-    Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1);
+-    if( !aCirc.IsNull() ) {
+-      bool ok = _gen->Evaluate( aMesh, CircEdge, aResMap );
+-      if(ok) {
+-        SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
+-        MapShapeNbElemsItr anIt = aResMap.find(sm);
+-        vector<int> aVec = (*anIt).second;
+-        isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
+-        if(isQuadratic) {
+-          // main nodes
+-          nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size();
+-          // radial medium nodes
+-          nb0d += (aVec[SMDSEntity_Node]+1) * (myLayerPositions.size()+1);
+-          // other medium nodes
+-          nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size();
+-        }
+-        else {
+-          nb0d = (aVec[SMDSEntity_Node]+1) * myLayerPositions.size();
+-        }
+-        nb2d_tria = aVec[SMDSEntity_Node] + 1;
+-        nb2d_quad = nb0d;
+-      }
+-    }
+-  }
+-  else if(nbe==2) {
+-    // one curve must be a half of circle and other curve must be
+-    // a segment of line
+-    Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1);
+-    while( !tc.IsNull() ) {
+-      C1 = tc->BasisCurve();
+-      tc = Handle(Geom_TrimmedCurve)::DownCast(C1);
+-    }
+-    tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
+-    while( !tc.IsNull() ) {
+-      C2 = tc->BasisCurve();
+-      tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
+-    }
+-    Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1);
+-    Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(C2);
+-    CircEdge = E1;
+-    LinEdge1 = E2;
+-    double fp = f1;
+-    double lp = l1;
+-    if( aCirc.IsNull() ) {
+-      aCirc = Handle(Geom_Circle)::DownCast(C2);
+-      CircEdge = E2;
+-      LinEdge1 = E1;
+-      fp = f2;
+-      lp = l2;
+-      aLine = Handle(Geom_Line)::DownCast(C3);
+-    }
+-    bool ok = !aCirc.IsNull() && !aLine.IsNull();
+-    if( fabs(fabs(lp-fp)-M_PI) > Precision::Confusion() ) {
+-      // not half of circle
+-      ok = false;
+-    }
+-    SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1);
+-    MapShapeNbElemsItr anIt = aResMap.find(sm1);
+-    if( anIt!=aResMap.end() ) {
+-      ok = false;
+-    }
+-    if(ok) {
+-      ok = _gen->Evaluate( aMesh, CircEdge, aResMap );
+-    }
+-    if(ok) {
+-      SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      vector<int> aVec = (*anIt).second;
+-      isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
+-      if(isQuadratic) {
+-        // main nodes
+-        nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size();
+-        // radial medium nodes
+-        nb0d += aVec[SMDSEntity_Node] * (myLayerPositions.size()+1);
+-        // other medium nodes
+-        nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size();
+-      }
+-      else {
+-        nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size();
+-      }
+-      nb2d_tria = aVec[SMDSEntity_Node] + 1;
+-      nb2d_quad = nb2d_tria * myLayerPositions.size();
+-      // add evaluation for edges
+-      vector<int> aResVec(SMDSEntity_Last);
+-      for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-      if(isQuadratic) {
+-        aResVec[SMDSEntity_Node] = 4*myLayerPositions.size() + 3;
+-        aResVec[SMDSEntity_Quad_Edge] = 2*myLayerPositions.size() + 2;
+-      }
+-      else {
+-        aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1;
+-        aResVec[SMDSEntity_Edge] = 2*myLayerPositions.size() + 2;
+-      }
+-      sm = aMesh.GetSubMesh(LinEdge1);
+-      aResMap.insert(make_pair(sm,aResVec));
+-    }
+-  }
+-  else { // nbe==3
+-    // one curve must be a part of circle and other curves must be
+-    // segments of line
+-    Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1);
+-    while( !tc.IsNull() ) {
+-      C1 = tc->BasisCurve();
+-      tc = Handle(Geom_TrimmedCurve)::DownCast(C1);
+-    }
+-    tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
+-    while( !tc.IsNull() ) {
+-      C2 = tc->BasisCurve();
+-      tc = Handle(Geom_TrimmedCurve)::DownCast(C2);
+-    }
+-    tc = Handle(Geom_TrimmedCurve)::DownCast(C3);
+-    while( !tc.IsNull() ) {
+-      C3 = tc->BasisCurve();
+-      tc = Handle(Geom_TrimmedCurve)::DownCast(C3);
+-    }
+-    Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1);
+-    Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast(C2);
+-    Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast(C3);
+-    CircEdge = E1;
+-    LinEdge1 = E2;
+-    LinEdge2 = E3;
+-    double fp = f1;
+-    double lp = l1;
+-    if( aCirc.IsNull() ) {
+-      aCirc = Handle(Geom_Circle)::DownCast(C2);
+-      CircEdge = E2;
+-      LinEdge1 = E3;
+-      LinEdge2 = E1;
+-      fp = f2;
+-      lp = l2;
+-      aLine1 = Handle(Geom_Line)::DownCast(C3);
+-      aLine2 = Handle(Geom_Line)::DownCast(C1);
+-      if( aCirc.IsNull() ) {
+-        aCirc = Handle(Geom_Circle)::DownCast(C3);
+-        CircEdge = E3;
+-        LinEdge1 = E1;
+-        LinEdge2 = E2;
+-        fp = f3;
+-        lp = l3;
+-        aLine1 = Handle(Geom_Line)::DownCast(C1);
+-        aLine2 = Handle(Geom_Line)::DownCast(C2);
+-      }
+-    }
+-    bool ok = !aCirc.IsNull() && !aLine1.IsNull() && !aLine1.IsNull();
+-    SMESH_subMesh* sm = aMesh.GetSubMesh(LinEdge1);
+-    MapShapeNbElemsItr anIt = aResMap.find(sm);
+-    if( anIt!=aResMap.end() ) {
+-      ok = false;
+-    }
+-    sm = aMesh.GetSubMesh(LinEdge2);
+-    anIt = aResMap.find(sm);
+-    if( anIt!=aResMap.end() ) {
+-      ok = false;
+-    }
+-    if(ok) {
+-      ok = _gen->Evaluate( aMesh, CircEdge, aResMap );
+-    }
+-    if(ok) {
+-      SMESH_subMesh * sm = aMesh.GetSubMesh(CircEdge);
+-      MapShapeNbElemsItr anIt = aResMap.find(sm);
+-      vector<int> aVec = (*anIt).second;
+-      isQuadratic = aVec[SMDSEntity_Quad_Edge]>aVec[SMDSEntity_Edge];
+-      if(isQuadratic) {
+-        // main nodes
+-        nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size();
+-        // radial medium nodes
+-        nb0d += aVec[SMDSEntity_Node] * (myLayerPositions.size()+1);
+-        // other medium nodes
+-        nb0d += (aVec[SMDSEntity_Node]+1) * myLayerPositions.size();
+-      }
+-      else {
+-        nb0d = aVec[SMDSEntity_Node] * myLayerPositions.size();
+-      }
+-      nb2d_tria = aVec[SMDSEntity_Node] + 1;
+-      nb2d_quad = nb2d_tria * myLayerPositions.size();
+-      // add evaluation for edges
+-      vector<int> aResVec(SMDSEntity_Last);
+-      for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-      if(isQuadratic) {
+-        aResVec[SMDSEntity_Node] = 2*myLayerPositions.size() + 1;
+-        aResVec[SMDSEntity_Quad_Edge] = myLayerPositions.size() + 1;
+-      }
+-      else {
+-        aResVec[SMDSEntity_Node] = myLayerPositions.size();
+-        aResVec[SMDSEntity_Edge] = myLayerPositions.size() + 1;
+-      }
+-      sm = aMesh.GetSubMesh(LinEdge1);
+-      aResMap.insert(make_pair(sm,aResVec));
+-      sm = aMesh.GetSubMesh(LinEdge2);
+-      aResMap.insert(make_pair(sm,aResVec));
+-    }
+-  }
+-
+-  vector<int> aResVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
+-  SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
+-
+-  //cout<<"nb0d = "<<nb0d<<"   nb2d_tria = "<<nb2d_tria<<"   nb2d_quad = "<<nb2d_quad<<endl;
+-  if(nb0d>0) {
+-    aResVec[0] = nb0d;
+-    if(isQuadratic) {
+-      aResVec[SMDSEntity_Quad_Triangle] = nb2d_tria;
+-      aResVec[SMDSEntity_Quad_Quadrangle] = nb2d_quad;
+-    }
+-    else {
+-      aResVec[SMDSEntity_Triangle] = nb2d_tria;
+-      aResVec[SMDSEntity_Quadrangle] = nb2d_quad;
+-    }
+-    aResMap.insert(make_pair(sm,aResVec));
+-    return true;
+-  }
+-
+-  // invalid case
+-  aResMap.insert(make_pair(sm,aResVec));
+-  SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-  smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
+-                                        "Submesh can not be evaluated",this));
+-  return false;
+-
+-}
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Regular_1D.cpp salomesmesh/src/StdMeshers/StdMeshers_Regular_1D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_Regular_1D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_Regular_1D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -48,7 +48,7 @@
+ #include "SMDS_MeshElement.hxx"
+ #include "SMDS_MeshNode.hxx"
+ 
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ #include "utilities.h"
+ 
+ #include <BRepAdaptor_Curve.hxx>
+@@ -63,7 +63,6 @@
+ #include <TopoDS_Edge.hxx>
+ 
+ #include <string>
+-#include <limits>
+ 
+ using namespace std;
+ 
+@@ -74,24 +73,22 @@
+ //=============================================================================
+ 
+ StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId,
+-        SMESH_Gen * gen):SMESH_1D_Algo(hypId, studyId, gen)
++	SMESH_Gen * gen):SMESH_1D_Algo(hypId, studyId, gen)
+ {
+-        MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D");
+-        _name = "Regular_1D";
+-        _shapeType = (1 << TopAbs_EDGE);
+-        _fpHyp = 0;
+-
+-        _compatibleHypothesis.push_back("LocalLength");
+-        _compatibleHypothesis.push_back("MaxLength");
+-        _compatibleHypothesis.push_back("NumberOfSegments");
+-        _compatibleHypothesis.push_back("StartEndLength");
+-        _compatibleHypothesis.push_back("Deflection1D");
+-        _compatibleHypothesis.push_back("Arithmetic1D");
+-        _compatibleHypothesis.push_back("FixedPoints1D");
+-        _compatibleHypothesis.push_back("AutomaticLength");
++	MESSAGE("StdMeshers_Regular_1D::StdMeshers_Regular_1D");
++	_name = "Regular_1D";
++	_shapeType = (1 << TopAbs_EDGE);
++
++	_compatibleHypothesis.push_back("LocalLength");
++	_compatibleHypothesis.push_back("MaxLength");
++	_compatibleHypothesis.push_back("NumberOfSegments");
++	_compatibleHypothesis.push_back("StartEndLength");
++	_compatibleHypothesis.push_back("Deflection1D");
++	_compatibleHypothesis.push_back("Arithmetic1D");
++	_compatibleHypothesis.push_back("AutomaticLength");
+ 
+-        _compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!!
+-        _compatibleHypothesis.push_back("Propagation"); // auxiliary !!!
++	_compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!!
++	_compatibleHypothesis.push_back("Propagation"); // auxiliary !!!
+ }
+ 
+ //=============================================================================
+@@ -183,15 +180,12 @@
+     {
+     case StdMeshers_NumberOfSegments::DT_Scale:
+       _value[ SCALE_FACTOR_IND ] = hyp->GetScaleFactor();
+-      _revEdgesIDs = hyp->GetReversedEdges();
+       break;
+     case StdMeshers_NumberOfSegments::DT_TabFunc:
+       _vvalue[ TAB_FUNC_IND ] = hyp->GetTableFunction();
+-      _revEdgesIDs = hyp->GetReversedEdges();
+       break;
+     case StdMeshers_NumberOfSegments::DT_ExprFunc:
+       _svalue[ EXPR_FUNC_IND ] = hyp->GetExpressionFunction();
+-      _revEdgesIDs = hyp->GetReversedEdges();
+       break;
+     case StdMeshers_NumberOfSegments::DT_Regular:
+       break;
+@@ -215,19 +209,6 @@
+     _value[ END_LENGTH_IND ] = hyp->GetLength( false );
+     ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
+     _hypType = ARITHMETIC_1D;
+-
+-    _revEdgesIDs = hyp->GetReversedEdges();
+-
+-    aStatus = SMESH_Hypothesis::HYP_OK;
+-  }
+-
+-  else if (hypName == "FixedPoints1D") {
+-    _fpHyp = dynamic_cast <const StdMeshers_FixedPoints1D*>(theHyp);
+-    ASSERT(_fpHyp);
+-    _hypType = FIXED_POINTS_1D;
+-
+-    _revEdgesIDs = _fpHyp->GetReversedEdges();
+-
+     aStatus = SMESH_Hypothesis::HYP_OK;
+   }
+ 
+@@ -240,9 +221,6 @@
+     _value[ END_LENGTH_IND ] = hyp->GetLength( false );
+     ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
+     _hypType = BEG_END_LENGTH;
+-
+-    _revEdgesIDs = hyp->GetReversedEdges();
+-
+     aStatus = SMESH_Hypothesis::HYP_OK;
+   }
+ 
+@@ -758,7 +736,7 @@
+     double an = _value[ END_LENGTH_IND ];
+ 
+     double  q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
+-    int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
++    int     n = int( 1 + ( an - a1 ) / q );
+ 
+     double U1 = theReverse ? l : f;
+     double Un = theReverse ? f : l;
+@@ -786,62 +764,6 @@
+     return true;
+   }
+ 
+-  case FIXED_POINTS_1D: {
+-    const std::vector<double>& aPnts = _fpHyp->GetPoints();
+-    const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
+-    int i = 0;
+-    TColStd_SequenceOfReal Params;
+-    for(; i<aPnts.size(); i++) {
+-      if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
+-      int j=1;
+-      bool IsExist = false;
+-      for(; j<=Params.Length(); j++) {
+-        if( fabs(aPnts[i]-Params.Value(j)) < 1e-4 ) {
+-          IsExist = true;
+-          break;
+-        }
+-        if( aPnts[i]<Params.Value(j) ) break;
+-      }
+-      if(!IsExist) Params.InsertBefore(j,aPnts[i]);
+-    }
+-    double pf, pl, par2, par1, psize;
+-    if (theReverse) {
+-      pf = l;
+-      pl = f;
+-    }
+-    else {
+-      pf = f;
+-      pl = l;
+-    }
+-    psize = pl - pf;
+-    par1 = pf;
+-    //cout<<"aPnts.size() = "<<aPnts.size()<<"  Params.Length() = "
+-    //    <<Params.Length()<<"   nbsegs.size() = "<<nbsegs.size()<<endl;
+-    for(i=0; i<Params.Length(); i++) {
+-      par2 = pf + Params.Value(i+1)*psize;
+-      int nbseg = ( i > nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
+-      double dp = (par2-par1)/nbseg;
+-      int j = 1;
+-      for(; j<=nbseg; j++) {
+-        double param = par1 + dp*j;
+-        theParams.push_back( param );
+-      }
+-      par1 = par2;
+-    }
+-    // add for last
+-    int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
+-    double dp = (pl-par1)/nbseg;
+-    int j = 1;
+-    for(; j<nbseg; j++) {
+-      double param = par1 + dp*j;
+-      theParams.push_back( param );
+-    }
+-    if (theReverse) {
+-      theParams.reverse(); // NPAL18025
+-    }
+-    return true;
+-  }
+-
+   case DEFLECTION: {
+ 
+     GCPnts_UniformDeflection Discret(theC3d, _value[ DEFLECTION_IND ], f, l, true);
+@@ -897,19 +819,8 @@
+   {
+     list< double > params;
+     bool reversed = false;
+-    if ( theMesh.GetShapeToMesh().ShapeType() >= TopAbs_WIRE ) {
+-      reversed = ( EE.Orientation() == TopAbs_REVERSED );
+-    }
+-    if ( !_mainEdge.IsNull() ) {
++    if ( !_mainEdge.IsNull() )
+       reversed = ( _mainEdge.Orientation() == TopAbs_REVERSED );
+-    }
+-    else if ( _revEdgesIDs.size() > 0 ) {
+-      for ( int i = 0; i < _revEdgesIDs.size(); i++) {
+-        if ( _revEdgesIDs[i] == shapeID ) {
+-          reversed = !reversed;
+-        }
+-      }
+-    }
+ 
+     BRepAdaptor_Curve C3d( E );
+     double length = EdgeLength( E );
+@@ -1019,82 +930,6 @@
+   return true;
+ }
+ 
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+-bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh,
+-                                     const TopoDS_Shape & theShape,
+-                                     MapShapeNbElems& aResMap)
+-{
+-  if ( _hypType == NONE )
+-    return false;
+-
+-  //SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
+-
+-  const TopoDS_Edge & EE = TopoDS::Edge(theShape);
+-  TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
+-  //  int shapeID = meshDS->ShapeToIndex( E );
+-
+-  double f, l;
+-  Handle(Geom_Curve) Curve = BRep_Tool::Curve(E, f, l);
+-
+-  TopoDS_Vertex VFirst, VLast;
+-  TopExp::Vertices(E, VFirst, VLast);   // Vfirst corresponds to f and Vlast to l
+-
+-  ASSERT(!VFirst.IsNull());
+-  ASSERT(!VLast.IsNull());
+-
+-  std::vector<int> aVec(SMDSEntity_Last);
+-  for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i] = 0;
+-
+-  if (!Curve.IsNull()) {
+-    list< double > params;
+-
+-    BRepAdaptor_Curve C3d( E );
+-    double length = EdgeLength( E );
+-    if ( ! computeInternalParameters( theMesh, C3d, length, f, l, params, false, true )) {
+-      SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
+-      aResMap.insert(std::make_pair(sm,aVec));
+-      SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+-      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
+-      return false;
+-    }
+-    redistributeNearVertices( theMesh, C3d, length, params, VFirst, VLast );
+-
+-    if(_quadraticMesh) {
+-      aVec[SMDSEntity_Node] = 2*params.size() + 1;
+-      aVec[SMDSEntity_Quad_Edge] = params.size() + 1;
+-    }
+-    else {
+-      aVec[SMDSEntity_Node] = params.size();
+-      aVec[SMDSEntity_Edge] = params.size() + 1;
+-    }
+-    
+-  }
+-  else {
+-    //MESSAGE("************* Degenerated edge! *****************");
+-    // Edge is a degenerated Edge : We put n = 5 points on the edge.
+-    if(_quadraticMesh) {
+-      aVec[SMDSEntity_Node] = 11;
+-      aVec[SMDSEntity_Quad_Edge] = 6;
+-    }
+-    else {
+-      aVec[SMDSEntity_Node] = 5;
+-      aVec[SMDSEntity_Edge] = 6;
+-    }
+-  }
+-
+-  SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
+-  aResMap.insert(std::make_pair(sm,aVec));
+-
+-  return true;
+-}
+-
+-
+ //=============================================================================
+ /*!
+  *  See comments in SMESH_Algo.cxx
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cpp salomesmesh/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_SegmentAroundVertex_0D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -94,18 +94,3 @@
+   // StdMeshers_SegmentLengthAroundVertex hypothesis
+   return true;
+ }
+-
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_SegmentAroundVertex_0D::Evaluate(SMESH_Mesh&,
+-						 const TopoDS_Shape&,
+-						 MapShapeNbElems&)
+-{
+-  // This algorithm exists in order just to enable assignation of
+-  // StdMeshers_SegmentLengthAroundVertex hypothesis
+-  return false;
+-}
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cpp salomesmesh/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,8 @@
+ //  SMESH SMESH : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_SegmentLengthAroundVertex.cxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #include "StdMeshers_SegmentLengthAroundVertex.hxx"
+ 
+ #include "SMESH_Mesh.hxx"
+@@ -73,10 +74,10 @@
+  */
+ //=============================================================================
+ 
+-void StdMeshers_SegmentLengthAroundVertex::SetLength(double length) throw(SALOME_Exception)
++void StdMeshers_SegmentLengthAroundVertex::SetLength(double length) throw(SMESH_Exception)
+ {
+   if (length <= 0)
+-    throw SALOME_Exception(LOCALIZED("length must be positive"));
++    throw SMESH_Exception(LOCALIZED("length must be positive"));
+   if (_length != length) {
+     _length = length;
+     NotifySubMeshesHypothesisModification();
+@@ -212,4 +213,3 @@
+ {
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_StartEndLength.cpp salomesmesh/src/StdMeshers/StdMeshers_StartEndLength.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_StartEndLength.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_StartEndLength.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,8 @@
+ //  SMESH StdMeshers_StartEndLength : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_StartEndLength.cxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_StartEndLength.cxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #include "StdMeshers_StartEndLength.hxx"
+ 
+ #include "SMESH_Algo.hxx"
+@@ -74,11 +75,11 @@
+ //=============================================================================
+ 
+ void StdMeshers_StartEndLength::SetLength(double length, bool isStartLength)
+-     throw(SALOME_Exception)
++     throw(SMESH_Exception)
+ {
+   if ( (isStartLength ? _begLength : _endLength) != length ) {
+     if (length <= 0)
+-      throw SALOME_Exception(LOCALIZED("length must be positive"));
++      throw SMESH_Exception(LOCALIZED("length must be positive"));
+     if ( isStartLength )
+       _begLength = length;
+     else
+@@ -105,33 +106,9 @@
+  */
+ //=============================================================================
+ 
+-void StdMeshers_StartEndLength::SetReversedEdges( std::vector<int>& ids )
+-{
+-  if ( ids != _edgeIDs ) {
+-    _edgeIDs = ids;
+-
+-    NotifySubMeshesHypothesisModification();
+-  }
+-}
+-
+-//=============================================================================
+-/*!
+- *  
+- */
+-//=============================================================================
+-
+ ostream & StdMeshers_StartEndLength::SaveTo(ostream & save)
+ {
+-  int listSize = _edgeIDs.size();
+-  save << _begLength << " " << _endLength << " " << listSize;
+-
+-  if ( listSize > 0 ) {
+-    for ( int i = 0; i < listSize; i++) {
+-      save << " " << _edgeIDs[i];
+-    }
+-    save << " " << _objEntry;
+-  }
+-
++  save << _begLength << " " <<_endLength;
+   return save;
+ }
+ 
+@@ -144,25 +121,12 @@
+ istream & StdMeshers_StartEndLength::LoadFrom(istream & load)
+ {
+   bool isOK = true;
+-  int intVal;
+   isOK = (load >> _begLength);
+   if (!isOK)
+     load.clear(ios::badbit | load.rdstate());
+   isOK = (load >> _endLength);
+-
+   if (!isOK)
+     load.clear(ios::badbit | load.rdstate());
+-  
+-  isOK = (load >> intVal);
+-  if (isOK && intVal > 0) {
+-    _edgeIDs.reserve( intVal );
+-    for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+-      isOK = (load >> intVal);
+-      if ( isOK ) _edgeIDs.push_back( intVal );
+-    }
+-    isOK = (load >> _objEntry);
+-  }
+-
+   return load;
+ }
+ 
+@@ -246,4 +210,3 @@
+ {
+   return (_begLength = _endLength = dflts._elemLength );
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_TrianglePreference.cpp salomesmesh/src/StdMeshers/StdMeshers_TrianglePreference.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_TrianglePreference.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_TrianglePreference.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,8 @@
+ //  SMESH StdMeshers_TrianglePreference 
+ //  File   : StdMeshers_TrianglePreference.cxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/Attic/StdMeshers_TrianglePreference.cxx,v 1.1.4.2 2008/11/27 13:03:49 abd Exp $
++//
+ #include "StdMeshers_TrianglePreference.hxx"
+ #include "utilities.h"
+ 
+@@ -125,4 +126,3 @@
+ {
+   return false;
+ }
+-
+diff -Naur smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp salomesmesh/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp
+--- smesh-5.1.2.2.svn55/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp	2014-07-13 10:33:02.000000000 -0500
+@@ -60,27 +60,10 @@
+ 
+ bool StdMeshers_UseExisting_1D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
+ {
+-  // This algorithm exists to allow mesh generation by mesh
+-  // edition functions in TUI mode
++  // This algorithm exists to allow mesh generation by mesh edition functions in TUI mode
+   return true;
+ }
+ 
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_UseExisting_1D::Evaluate(SMESH_Mesh&,
+-					 const TopoDS_Shape&,
+-					 MapShapeNbElems&)
+-{
+-  // This algorithm exists to allow mesh generation by mesh
+-  // edition functions in TUI mode
+-  return false;
+-}
+-
+-
+ //=======================================================================
+ //function : StdMeshers_UseExisting_2D
+ //purpose  : 
+@@ -114,22 +97,6 @@
+ 
+ bool StdMeshers_UseExisting_2D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
+ {
+-  // This algorithm exists to allow mesh generation by mesh edition
+-  // functions in TUI mode
++  // This algorithm exists to allow mesh generation by mesh edition functions in TUI mode
+   return true;
+ }
+-
+-
+-//=======================================================================
+-//function : Evaluate
+-//purpose  : 
+-//=======================================================================
+-
+-bool StdMeshers_UseExisting_2D::Evaluate(SMESH_Mesh&,
+-					 const TopoDS_Shape&,
+-					 MapShapeNbElems&)
+-{
+-  // This algorithm exists to allow mesh generation by mesh edition
+-  // functions in TUI mode
+-  return false;
+-}
+diff -Naur smesh-5.1.2.2.svn55/inc/Driver_Mesh.h salomesmesh/inc/Driver_Mesh.h
+--- smesh-5.1.2.2.svn55/inc/Driver_Mesh.h	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/Driver_Mesh.h	2014-07-13 10:33:02.000000000 -0500
+@@ -29,7 +29,7 @@
+ #include <string>
+ 
+ #ifdef WNT
+- #if defined MESHDRIVER_EXPORTS || defined MeshDriver_EXPORTS
++ #if defined MESHDRIVER_EXPORTS
+   #define MESHDRIVER_EXPORT __declspec( dllexport )
+  #else
+   #define MESHDRIVER_EXPORT __declspec( dllimport )
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_Defs.hxx salomesmesh/inc/NETGENPlugin_Defs.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_Defs.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_Defs.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -27,7 +27,7 @@
+ #define _NETGENPlugin_DEFS_HXX_
+ 
+ #ifdef WIN32
+-  #if defined NETGENPLUGIN_EXPORTS || defined NETGENEngine_EXPORTS
++  #ifdef NETGENPLUGIN_EXPORTS
+     #define NETGENPLUGIN_EXPORT __declspec( dllexport )
+   #else
+     #define NETGENPLUGIN_EXPORT __declspec( dllimport )
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_Hypothesis_2D.hxx salomesmesh/inc/NETGENPlugin_Hypothesis_2D.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_Hypothesis_2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_Hypothesis_2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ // Author    : Michael Sazonov (OCN)
+ // Date      : 27/03/2006
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx,v 1.4.2.2 2008/11/27 14:29:44 abd Exp $
+ //=============================================================================
+ //
+ #ifndef _NETGENPlugin_Hypothesis_2D_HXX_
+@@ -33,7 +33,7 @@
+ #include "NETGENPlugin_Defs.hxx"
+ 
+ #include "NETGENPlugin_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ //  Parameters for work of NETGEN.
+ // This class is just to give 2D dimension, actually
+@@ -50,8 +50,8 @@
+   static bool GetDefaultQuadAllowed();
+ 
+   // Persistence
+-  virtual ostream & SaveTo(ostream & save);
+-  virtual istream & LoadFrom(istream & load);
++  virtual std::ostream & SaveTo(std::ostream & save);
++  virtual std::istream & LoadFrom(std::istream & load);
+ 
+ private:
+   bool _quadAllowed;
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_Hypothesis.hxx salomesmesh/inc/NETGENPlugin_Hypothesis.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_Hypothesis.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_Hypothesis.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,8 @@
+ // Author    : Michael Sazonov (OCN)
+ // Date      : 27/03/2006
+ // Project   : SALOME
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx,v 1.4.2.2 2008/11/27 14:29:44 abd Exp $
++//=============================================================================
+ //
+ #ifndef _NETGENPlugin_Hypothesis_HXX_
+ #define _NETGENPlugin_Hypothesis_HXX_
+@@ -31,13 +33,11 @@
+ #include "NETGENPlugin_Defs.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ //  Parameters for work of NETGEN
+ //
+ 
+-using namespace std;
+-
+ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis: public SMESH_Hypothesis
+ {
+ public:
+@@ -88,10 +88,10 @@
+   static bool GetDefaultOptimize();
+ 
+   // Persistence
+-  virtual ostream & SaveTo(ostream & save);
+-  virtual istream & LoadFrom(istream & load);
+-  friend NETGENPLUGIN_EXPORT ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp);
+-  friend NETGENPLUGIN_EXPORT istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp);
++  virtual std::ostream & SaveTo(std::ostream & save);
++  virtual std::istream & LoadFrom(std::istream & load);
++  friend NETGENPLUGIN_EXPORT std::ostream & operator <<(std::ostream & save, NETGENPlugin_Hypothesis & hyp);
++  friend NETGENPLUGIN_EXPORT std::istream & operator >>(std::istream & load, NETGENPlugin_Hypothesis & hyp);
+ 
+   /*!
+    * \brief Does nothing
+@@ -100,8 +100,8 @@
+    * \retval bool - always false
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+-
+-  /*!
++  
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_Mesher.hxx salomesmesh/inc/NETGENPlugin_Mesher.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_Mesher.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_Mesher.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ // Author    : Michael Sazonov (OCN)
+ // Date      : 31/03/2006
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_Mesher.hxx,v 1.4.2.2 2008/11/27 14:29:44 abd Exp $
+ //=============================================================================
+ //
+ #ifndef _NETGENPlugin_Mesher_HXX_
+@@ -61,8 +61,6 @@
+ 
+   bool Compute();
+ 
+-  bool Evaluate(MapShapeNbElems& aResMap);
+-
+   static void PrepareOCCgeometry(netgen::OCCGeometry&          occgeom,
+                                  const TopoDS_Shape&           shape,
+                                  SMESH_Mesh&                   mesh,
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_2D3D.hxx salomesmesh/inc/NETGENPlugin_NETGEN_2D3D.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_2D3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_NETGEN_2D3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ // Author    : Michael Sazonov (OCN)
+ // Date      : 20/03/2006
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.hxx,v 1.4.2.2 2008/11/27 14:29:44 abd Exp $
+ //=============================================================================
+ //
+ #ifndef _NETGENPlugin_NETGEN_2D3D_HXX_
+@@ -35,7 +35,7 @@
+ #include "SMESH_3D_Algo.hxx"
+ #include "SMESH_Mesh.hxx"
+ #include "StdMeshers_MaxElementVolume.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ //class NETGENPlugin_Hypothesis;
+ 
+@@ -52,10 +52,6 @@
+   virtual bool Compute(SMESH_Mesh& aMesh,
+ 		       const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh& aMesh,
+-			const TopoDS_Shape& aShape,
+-			MapShapeNbElems& aResMap);
+-
+ protected:
+   const SMESHDS_Hypothesis* _hypothesis;
+ };
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_2D.hxx salomesmesh/inc/NETGENPlugin_NETGEN_2D.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_NETGEN_2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ // Author    : Michael Sazonov (OCN)
+ // Date      : 20/03/2006
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.hxx,v 1.4.2.2 2008/11/27 14:29:44 abd Exp $
+ //=============================================================================
+ //
+ #ifndef _NETGENPlugin_NETGEN_2D_HXX_
+@@ -35,7 +35,7 @@
+ #include "SMESH_2D_Algo.hxx"
+ #include "SMESH_Mesh.hxx"
+ #include "StdMeshers_MaxElementVolume.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ //class NETGENPlugin_Hypothesis_2D;
+ 
+@@ -52,9 +52,6 @@
+   virtual bool Compute(SMESH_Mesh& aMesh,
+ 		       const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
+-                        MapShapeNbElems& aResMap);
+-
+ protected:
+   const SMESHDS_Hypothesis* _hypothesis;
+ };
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_2D_ONLY.hxx salomesmesh/inc/NETGENPlugin_NETGEN_2D_ONLY.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_2D_ONLY.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_NETGEN_2D_ONLY.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -70,9 +70,6 @@
+   virtual bool Compute(SMESH_Mesh&         aMesh,
+                        const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   /*static TError AddSegmentsToMesh(netgen::Mesh&                    ngMesh,
+                                 OCCGeometry&                     geom,
+                                 const TSideVector&               wires,
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_3D.hxx salomesmesh/inc/NETGENPlugin_NETGEN_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_NETGEN_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_NETGEN_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -25,7 +25,7 @@
+ // Created   : lundi 27 Janvier 2003
+ // Author    : Nadir BOUHAMOU (CEA)
+ // Project   : SALOME
+-// $Header$
++// $Header: /home/server/cvs/NETGENPLUGIN/NETGENPLUGIN_SRC/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx,v 1.4.2.1 2008/11/27 14:29:45 abd Exp $
+ //=============================================================================
+ //
+ #ifndef _NETGENPlugin_NETGEN_3D_HXX_
+@@ -36,7 +36,7 @@
+ #include "SMESH_3D_Algo.hxx"
+ #include "SMESH_Mesh.hxx"
+ #include "StdMeshers_MaxElementVolume.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
+ {
+@@ -54,10 +54,6 @@
+   virtual bool Compute(SMESH_Mesh& aMesh,
+                        SMESH_MesherHelper* aHelper);
+   
+-  virtual bool Evaluate(SMESH_Mesh& aMesh,
+-			const TopoDS_Shape& aShape,
+-			MapShapeNbElems& aResMap);
+-
+ protected:
+   double _maxElementVolume;
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_SimpleHypothesis_2D.hxx salomesmesh/inc/NETGENPlugin_SimpleHypothesis_2D.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_SimpleHypothesis_2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_SimpleHypothesis_2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -31,13 +31,11 @@
+ #include "NETGENPlugin_Defs.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ //  Simplified parameters of NETGEN
+ //
+ 
+-using namespace std;
+-
+ class NETGENPLUGIN_EXPORT NETGENPlugin_SimpleHypothesis_2D: public SMESH_Hypothesis
+ {
+ public:
+@@ -47,7 +45,7 @@
+   /*!
+    * Sets <number of segments> value
+    */
+-  void SetNumberOfSegments(int nb) throw (SALOME_Exception);
++  void SetNumberOfSegments(int nb) throw (SMESH_Exception);
+   /*!
+    * Returns <number of segments> value.
+    * Can be zero in case if LocalLength() has been set
+@@ -57,7 +55,7 @@
+   /*!
+    * Sets <segment length> value
+    */
+-  void SetLocalLength(double segmentLength) throw (SALOME_Exception);
++  void SetLocalLength(double segmentLength) throw (SMESH_Exception);
+   /*!
+    * Returns <segment length> value.
+    * Can be zero in case if NumberOfSegments() has been set
+@@ -81,8 +79,8 @@
+   double GetMaxElementArea() const { return _area; }
+ 
+   // Persistence
+-  virtual ostream & SaveTo(ostream & save);
+-  virtual istream & LoadFrom(istream & load);
++  virtual std::ostream & SaveTo(std::ostream & save);
++  virtual std::istream & LoadFrom(std::istream & load);
+ 
+   /*!
+    * \brief Set parameters by mesh
+@@ -91,13 +89,13 @@
+    * \retval bool - true if theShape is meshed
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+-
+-  /*!
++  
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+-
++  
+ private:
+   int    _nbSegments;
+   double _segmentLength, _area;
+diff -Naur smesh-5.1.2.2.svn55/inc/NETGENPlugin_SimpleHypothesis_3D.hxx salomesmesh/inc/NETGENPlugin_SimpleHypothesis_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/NETGENPlugin_SimpleHypothesis_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/NETGENPlugin_SimpleHypothesis_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -31,13 +31,11 @@
+ #include "NETGENPlugin_Defs.hxx"
+ #include "NETGENPlugin_SimpleHypothesis_2D.hxx"
+ 
+-#include <Utils_SALOME_Exception.hxx>
++#include <SMESH_Exception.hxx>
+ 
+ //  Simplified parameters of NETGEN
+ //
+ 
+-using namespace std;
+-
+ class NETGENPLUGIN_EXPORT NETGENPlugin_SimpleHypothesis_3D: public NETGENPlugin_SimpleHypothesis_2D
+ {
+ public:
+@@ -50,8 +48,8 @@
+   double GetMaxElementVolume() const { return _volume; }
+ 
+   // Persistence
+-  virtual ostream & SaveTo(ostream & save);
+-  virtual istream & LoadFrom(istream & load);
++  virtual std::ostream & SaveTo(std::ostream & save);
++  virtual std::istream & LoadFrom(std::istream & load);
+ 
+   /*!
+    * \brief Set parameters by mesh
+diff -Naur smesh-5.1.2.2.svn55/inc/OpUtil.hxx salomesmesh/inc/OpUtil.hxx
+--- smesh-5.1.2.2.svn55/inc/OpUtil.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/OpUtil.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,4 +0,0 @@
+-#ifndef _OpUtil_HXX_
+-#define _OpUtil_HXX_
+-
+-#endif
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDSAbs_ElementType.hxx salomesmesh/inc/SMDSAbs_ElementType.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDSAbs_ElementType.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDSAbs_ElementType.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMDS : implementaion of Salome mesh data structure
+ //  File   : SMDSAbs_ElementType.hxx
+ //  Module : SMESH
+-
++//
+ #ifndef _SMDSAbs_ElementType_HeaderFile
+ #define _SMDSAbs_ElementType_HeaderFile
+ 
+@@ -30,34 +30,33 @@
+ /// Type (node, edge, face or volume) of elements
+ ///////////////////////////////////////////////////////////////////////////////
+ enum SMDSAbs_ElementType
+-  {
+-    SMDSAbs_All,
+-    SMDSAbs_Node,
+-    SMDSAbs_Edge,
+-    SMDSAbs_Face,
+-    SMDSAbs_Volume,
+-    SMDSAbs_0DElement,
+-    SMDSAbs_NbElementTypes
+-  };
++{
++	SMDSAbs_All,
++	SMDSAbs_Node,
++	SMDSAbs_Edge,
++	SMDSAbs_Face,
++	SMDSAbs_Volume,
++        SMDSAbs_NbElementTypes
++};
+ 
+ /*! enumeration for element geometry type */
+ enum SMDSAbs_GeometryType
+-  {
+-    // 0D element
+-    SMDSGeom_POINT,
+-    // 1D element
+-    SMDSGeom_EDGE,
+-    // 2D element
+-    SMDSGeom_TRIANGLE,
+-    SMDSGeom_QUADRANGLE,
+-    SMDSGeom_POLYGON,
+-    // 3D element
+-    SMDSGeom_TETRA,
+-    SMDSGeom_PYRAMID,
+-    SMDSGeom_HEXA,
+-    SMDSGeom_PENTA,
+-    SMDSGeom_POLYHEDRA,
+-  };
++{
++  // 0D element
++  SMDSGeom_POINT,
++  // 1D element
++  SMDSGeom_EDGE,
++  // 2D element
++  SMDSGeom_TRIANGLE,
++  SMDSGeom_QUADRANGLE,
++  SMDSGeom_POLYGON,
++  // 3D element
++  SMDSGeom_TETRA,
++  SMDSGeom_PYRAMID,
++  SMDSGeom_HEXA,
++  SMDSGeom_PENTA,
++  SMDSGeom_POLYHEDRA,
++};
+ 
+ 
+ enum SMDSAbs_ElementOrder {
+@@ -66,32 +65,4 @@
+   ORDER_QUADRATIC     /*! entities of 2nd order */
+ };
+ 
+-/*!
+- * Enumeration of entity type uses in mesh info array,
+- *  and should be synchronised with enum in SMDS  
+- */
+-enum SMDSAbs_EntityType {
+-  SMDSEntity_Node,
+-  SMDSEntity_0D,
+-  SMDSEntity_Edge,
+-  SMDSEntity_Quad_Edge,
+-  SMDSEntity_Triangle,
+-  SMDSEntity_Quad_Triangle,
+-  SMDSEntity_Quadrangle,
+-  SMDSEntity_Quad_Quadrangle,
+-  SMDSEntity_Polygon,
+-  SMDSEntity_Quad_Polygon,
+-  SMDSEntity_Tetra,
+-  SMDSEntity_Quad_Tetra,
+-  SMDSEntity_Pyramid,
+-  SMDSEntity_Quad_Pyramid,
+-  SMDSEntity_Hexa,
+-  SMDSEntity_Quad_Hexa,
+-  SMDSEntity_Penta,
+-  SMDSEntity_Quad_Penta,
+-  SMDSEntity_Polyhedra,
+-  SMDSEntity_Quad_Polyhedra,
+-  SMDSEntity_Last
+-};
+-
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_ElemIterator.hxx salomesmesh/inc/SMDS_ElemIterator.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_ElemIterator.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_ElemIterator.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,9 +22,9 @@
+ //  SMESH SMDS : implementaion of Salome mesh data structure
+ //  File   : SMDS_MeshElement.hxx
+ //  Module : SMESH
+-//  Created:   12.01.05 18:02:52
+-//  Author:    Michael Sazonov
+-
++// Created:   12.01.05 18:02:52
++// Author:    Michael Sazonov
++//
+ #ifndef SMDS_ElemIterator_HeaderFile
+ #define SMDS_ElemIterator_HeaderFile
+ 
+@@ -33,7 +33,6 @@
+ 
+ class SMDS_MeshElement;
+ class SMDS_MeshNode;
+-class SMDS_Mesh0DElement;
+ class SMDS_MeshEdge;
+ class SMDS_MeshFace;
+ class SMDS_MeshVolume;
+@@ -44,9 +43,6 @@
+ typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
+ typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
+ 
+-typedef SMDS_Iterator<const SMDS_Mesh0DElement *> SMDS_0DElementIterator;
+-typedef boost::shared_ptr<SMDS_Iterator<const SMDS_Mesh0DElement *> > SMDS_0DElementIteratorPtr;
+-
+ typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
+ typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_FaceOfEdges.hxx salomesmesh/inc/SMDS_FaceOfEdges.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_FaceOfEdges.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_FaceOfEdges.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -46,7 +46,6 @@
+                          const SMDS_MeshEdge* edge4);
+ 		
+ 	SMDSAbs_ElementType GetType() const;
+-        virtual SMDSAbs_EntityType   GetEntityType() const;
+ 	int NbNodes() const;
+ 	int NbEdges() const;
+ 	int NbFaces() const;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_FaceOfNodes.hxx salomesmesh/inc/SMDS_FaceOfNodes.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_FaceOfNodes.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_FaceOfNodes.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -56,8 +56,6 @@
+    */
+   virtual const SMDS_MeshNode* GetNode(const int ind) const;
+ 
+-  virtual SMDSAbs_EntityType   GetEntityType() const;
+-
+   protected:
+   	SMDS_ElemIteratorPtr
+ 		elementsIterator(SMDSAbs_ElementType type) const;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_Mesh0DElement.hxx salomesmesh/inc/SMDS_Mesh0DElement.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_Mesh0DElement.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_Mesh0DElement.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,62 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMDS : implementaion of Salome mesh data structure
+-//  File   : SMDS_Mesh0DElement.hxx
+-//  Module : SMESH
+-
+-#ifndef _SMDS_Mesh0DElement_HeaderFile
+-#define _SMDS_Mesh0DElement_HeaderFile
+-
+-#include "SMESH_SMDS.hxx"
+-
+-#include "SMDS_MeshElement.hxx"
+-
+-#include <iostream>
+-
+-class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshElement
+-{
+- public:
+-  SMDS_Mesh0DElement (const SMDS_MeshNode * node);
+-  bool ChangeNode (const SMDS_MeshNode * node);
+-  void Print (std::ostream & OS) const;
+-
+-  SMDSAbs_ElementType GetType() const;
+-  SMDSAbs_EntityType  GetEntityType() const {return SMDSEntity_0D;}
+-  int NbNodes() const;
+-  int NbEdges() const;
+-  friend bool operator< (const SMDS_Mesh0DElement& e1, const SMDS_Mesh0DElement& e2);
+-
+-  /*!
+-   * \brief Return node by its index
+-   * \param ind - node index
+-   * \retval const SMDS_MeshNode* - the node
+-   */
+-  virtual const SMDS_MeshNode* GetNode (const int ind) const;
+-
+- protected:
+-  SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
+-
+- protected:
+-  const SMDS_MeshNode* myNode;
+-};
+-
+-#endif
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_MeshEdge.hxx salomesmesh/inc/SMDS_MeshEdge.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_MeshEdge.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_MeshEdge.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -41,8 +41,7 @@
+                          const SMDS_MeshNode * node2);
+ 	void Print(std::ostream & OS) const;
+ 
+-	virtual SMDSAbs_ElementType GetType() const;
+-	virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Edge; }
++	SMDSAbs_ElementType GetType() const;
+ 	int NbNodes() const;
+ 	int NbEdges() const;
+ 	friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2);
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_MeshElement.hxx salomesmesh/inc/SMDS_MeshElement.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_MeshElement.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_MeshElement.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -64,8 +64,6 @@
+   virtual SMDSAbs_ElementType GetType() const = 0;
+   virtual bool IsPoly() const { return false; };
+   virtual bool IsQuadratic() const;
+-  //! Return type of entity
+-  virtual SMDSAbs_EntityType  GetEntityType() const = 0;
+ 
+   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_Mesh.hxx salomesmesh/inc/SMDS_Mesh.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_Mesh.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_Mesh.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,14 +22,13 @@
+ //  SMESH SMDS : implementaion of Salome mesh data structure
+ //  File   : SMDS_Mesh.hxx
+ //  Module : SMESH
+-
++//
+ #ifndef _SMDS_Mesh_HeaderFile
+ #define _SMDS_Mesh_HeaderFile
+ 
+ #include "SMESH_SMDS.hxx"
+ 
+ #include "SMDS_MeshNode.hxx"
+-#include "SMDS_Mesh0DElement.hxx"
+ #include "SMDS_MeshEdge.hxx"
+ #include "SMDS_MeshFace.hxx"
+ #include "SMDS_MeshVolume.hxx"
+@@ -44,64 +43,59 @@
+ 
+ class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
+ public:
+-
++  
+   SMDS_Mesh();
+-
++  
+   SMDS_NodeIteratorPtr nodesIterator() const;
+-  SMDS_0DElementIteratorPtr elements0dIterator() const;
+   SMDS_EdgeIteratorPtr edgesIterator() const;
+   SMDS_FaceIteratorPtr facesIterator() const;
+   SMDS_VolumeIteratorPtr volumesIterator() const;
+-  SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
+-
++  SMDS_ElemIteratorPtr elementsIterator() const;  
++  
+   SMDSAbs_ElementType GetElementType( const int id, const bool iselem ) const;
+ 
+   SMDS_Mesh *AddSubMesh();
+-
++  
+   virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
+   virtual SMDS_MeshNode* AddNode(double x, double y, double z);
+-
+-  virtual SMDS_Mesh0DElement* Add0DElementWithID(int n, int ID);
+-  virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * n, int ID);
+-  virtual SMDS_Mesh0DElement* Add0DElement      (const SMDS_MeshNode * n);
+-
++  
+   virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
+   virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       int ID);
++				       const SMDS_MeshNode * n2, 
++				       int ID);
+   virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2);
+-
++				 const SMDS_MeshNode * n2);
++  
+   // 2d order edge with 3 nodes: n12 - node between n1 and n2
+   virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
+   virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n12,
+-                                       int ID);
++				       const SMDS_MeshNode * n2, 
++				       const SMDS_MeshNode * n12, 
++				       int ID);
+   virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
+                                  const SMDS_MeshNode * n2,
+                                  const SMDS_MeshNode * n12);
+ 
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3,
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3);
+-
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3);
++  
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3,
+-                                       const SMDS_MeshNode * n4,
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3,
++				       const SMDS_MeshNode * n4, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3,
+-                                 const SMDS_MeshNode * n4);
+-
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3,
++				 const SMDS_MeshNode * n4);
++  
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
+                                        const SMDS_MeshEdge * e2,
+                                        const SMDS_MeshEdge * e3, int ID);
+@@ -122,100 +116,100 @@
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
+                                        int n12,int n23,int n31, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3,
+-                                       const SMDS_MeshNode * n12,
+-                                       const SMDS_MeshNode * n23,
+-                                       const SMDS_MeshNode * n31,
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3, 
++				       const SMDS_MeshNode * n12,
++				       const SMDS_MeshNode * n23,
++				       const SMDS_MeshNode * n31, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3,
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3,
+                                  const SMDS_MeshNode * n12,
+-                                 const SMDS_MeshNode * n23,
+-                                 const SMDS_MeshNode * n31);
++				 const SMDS_MeshNode * n23,
++				 const SMDS_MeshNode * n31);
+ 
+   // 2d order quadrangle
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
+                                        int n12,int n23,int n34,int n41, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3,
+-                                       const SMDS_MeshNode * n4,
+-                                       const SMDS_MeshNode * n12,
+-                                       const SMDS_MeshNode * n23,
+-                                       const SMDS_MeshNode * n34,
+-                                       const SMDS_MeshNode * n41,
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3,
++				       const SMDS_MeshNode * n4, 
++				       const SMDS_MeshNode * n12,
++				       const SMDS_MeshNode * n23,
++				       const SMDS_MeshNode * n34,
++				       const SMDS_MeshNode * n41, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3,
+-                                 const SMDS_MeshNode * n4,
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3,
++				 const SMDS_MeshNode * n4,
+                                  const SMDS_MeshNode * n12,
+-                                 const SMDS_MeshNode * n23,
+-                                 const SMDS_MeshNode * n34,
+-                                 const SMDS_MeshNode * n41);
++				 const SMDS_MeshNode * n23,
++				 const SMDS_MeshNode * n34,
++				 const SMDS_MeshNode * n41);
+ 
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4);
+-
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4);
++  
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
+                                            int n5, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5);
+-
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5);
++  
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
+                                            int n5, int n6, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6);
+-
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6);
++  
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
+                                            int n5, int n6, int n7, int n8, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6,
+-                                           const SMDS_MeshNode * n7,
+-                                           const SMDS_MeshNode * n8,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6,
++					   const SMDS_MeshNode * n7,
++					   const SMDS_MeshNode * n8, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6,
+-                                     const SMDS_MeshNode * n7,
+-                                     const SMDS_MeshNode * n8);
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6,
++				     const SMDS_MeshNode * n7,
++				     const SMDS_MeshNode * n8);
+ 
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
+                                            const SMDS_MeshFace * f2,
+@@ -255,24 +249,24 @@
+                                            int n12,int n23,int n31,
+                                            int n14,int n24,int n34, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n31,
+-                                           const SMDS_MeshNode * n14,
+-                                           const SMDS_MeshNode * n24,
+-                                           const SMDS_MeshNode * n34,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n31,
++					   const SMDS_MeshNode * n14, 
++					   const SMDS_MeshNode * n24,
++					   const SMDS_MeshNode * n34, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+                                      const SMDS_MeshNode * n31,
+-                                     const SMDS_MeshNode * n14,
++                                     const SMDS_MeshNode * n14, 
+                                      const SMDS_MeshNode * n24,
+                                      const SMDS_MeshNode * n34);
+ 
+@@ -282,28 +276,28 @@
+                                            int n15,int n25,int n35,int n45,
+                                            int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n34,
+-                                           const SMDS_MeshNode * n41,
+-                                           const SMDS_MeshNode * n15,
+-                                           const SMDS_MeshNode * n25,
+-                                           const SMDS_MeshNode * n35,
+-                                           const SMDS_MeshNode * n45,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n34,
++					   const SMDS_MeshNode * n41, 
++					   const SMDS_MeshNode * n15,
++					   const SMDS_MeshNode * n25,
++					   const SMDS_MeshNode * n35,
++					   const SMDS_MeshNode * n45, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+                                      const SMDS_MeshNode * n34,
+-                                     const SMDS_MeshNode * n41,
++                                     const SMDS_MeshNode * n41, 
+                                      const SMDS_MeshNode * n15,
+                                      const SMDS_MeshNode * n25,
+                                      const SMDS_MeshNode * n35,
+@@ -317,33 +311,33 @@
+                                            int n14,int n25,int n36,
+                                            int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6,
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n31,
+-                                           const SMDS_MeshNode * n45,
+-                                           const SMDS_MeshNode * n56,
+-                                           const SMDS_MeshNode * n64,
+-                                           const SMDS_MeshNode * n14,
+-                                           const SMDS_MeshNode * n25,
+-                                           const SMDS_MeshNode * n36,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n31, 
++					   const SMDS_MeshNode * n45,
++					   const SMDS_MeshNode * n56,
++					   const SMDS_MeshNode * n64, 
++					   const SMDS_MeshNode * n14,
++					   const SMDS_MeshNode * n25,
++					   const SMDS_MeshNode * n36, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6,
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6, 
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+-                                     const SMDS_MeshNode * n31,
++                                     const SMDS_MeshNode * n31, 
+                                      const SMDS_MeshNode * n45,
+                                      const SMDS_MeshNode * n56,
+-                                     const SMDS_MeshNode * n64,
++                                     const SMDS_MeshNode * n64, 
+                                      const SMDS_MeshNode * n14,
+                                      const SMDS_MeshNode * n25,
+                                      const SMDS_MeshNode * n36);
+@@ -356,42 +350,42 @@
+                                            int n15,int n26,int n37,int n48,
+                                            int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6,
+-                                           const SMDS_MeshNode * n7,
+-                                           const SMDS_MeshNode * n8,
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n34,
+-                                           const SMDS_MeshNode * n41,
+-                                           const SMDS_MeshNode * n56,
+-                                           const SMDS_MeshNode * n67,
+-                                           const SMDS_MeshNode * n78,
+-                                           const SMDS_MeshNode * n85,
+-                                           const SMDS_MeshNode * n15,
+-                                           const SMDS_MeshNode * n26,
+-                                           const SMDS_MeshNode * n37,
+-                                           const SMDS_MeshNode * n48,
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6,
++					   const SMDS_MeshNode * n7,
++					   const SMDS_MeshNode * n8, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n34,
++					   const SMDS_MeshNode * n41, 
++					   const SMDS_MeshNode * n56,
++					   const SMDS_MeshNode * n67,
++					   const SMDS_MeshNode * n78,
++					   const SMDS_MeshNode * n85, 
++					   const SMDS_MeshNode * n15,
++					   const SMDS_MeshNode * n26,
++					   const SMDS_MeshNode * n37,
++					   const SMDS_MeshNode * n48, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6,
+-                                     const SMDS_MeshNode * n7,
+-                                     const SMDS_MeshNode * n8,
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6,
++				     const SMDS_MeshNode * n7,
++				     const SMDS_MeshNode * n8, 
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+                                      const SMDS_MeshNode * n34,
+-                                     const SMDS_MeshNode * n41,
++                                     const SMDS_MeshNode * n41, 
+                                      const SMDS_MeshNode * n56,
+                                      const SMDS_MeshNode * n67,
+                                      const SMDS_MeshNode * n78,
+-                                     const SMDS_MeshNode * n85,
++                                     const SMDS_MeshNode * n85, 
+                                      const SMDS_MeshNode * n15,
+                                      const SMDS_MeshNode * n26,
+                                      const SMDS_MeshNode * n37,
+@@ -422,10 +416,9 @@
+   virtual void RemoveElement(const SMDS_MeshElement *        elem,
+                              std::list<const SMDS_MeshElement *>& removedElems,
+                              std::list<const SMDS_MeshElement *>& removedNodes,
+-                             bool                                 removenodes = false);
++							 bool                      removenodes = false);
+   virtual void RemoveElement(const SMDS_MeshElement * elem, bool removenodes = false);
+   virtual void RemoveNode(const SMDS_MeshNode * node);
+-  virtual void Remove0DElement(const SMDS_Mesh0DElement * elem0d);
+   virtual void RemoveEdge(const SMDS_MeshEdge * edge);
+   virtual void RemoveFace(const SMDS_MeshFace * face);
+   virtual void RemoveVolume(const SMDS_MeshVolume * volume);
+@@ -437,7 +430,7 @@
+   virtual void RemoveFreeElement(const SMDS_MeshElement * elem);
+ 
+   virtual void Clear();
+-
++  
+   virtual bool RemoveFromParent();
+   virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
+ 
+@@ -452,7 +445,6 @@
+   // Renumber all nodes or elements.
+ 
+   const SMDS_MeshNode *FindNode(int idnode) const;
+-  const SMDS_Mesh0DElement* Find0DElement(int idnode) const;
+   const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
+   const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const;
+   const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
+@@ -462,7 +454,6 @@
+   const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
+                                 int idnode5, int idnode6, int idnode7, int idnode8) const;
+   const SMDS_MeshElement *FindElement(int IDelem) const;
+-  static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
+   static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
+                                        const SMDS_MeshNode * n2);
+   static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
+@@ -508,13 +499,11 @@
+   const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; }
+ 
+   int NbNodes() const;
+-  int Nb0DElements() const;
+   int NbEdges() const;
+   int NbFaces() const;
+   int NbVolumes() const;
+   int NbSubMesh() const;
+   void DumpNodes() const;
+-  void Dump0DElements() const;
+   void DumpEdges() const;
+   void DumpFaces() const;
+   void DumpVolumes() const;
+@@ -538,7 +527,6 @@
+   bool Contains (const SMDS_MeshElement* elem) const;
+ 
+   typedef NCollection_Map<SMDS_MeshNode *> SetOfNodes;
+-  typedef NCollection_Map<SMDS_Mesh0DElement *> SetOf0DElements;
+   typedef NCollection_Map<SMDS_MeshEdge *> SetOfEdges;
+   typedef NCollection_Map<SMDS_MeshFace *> SetOfFaces;
+   typedef NCollection_Map<SMDS_MeshVolume *> SetOfVolumes;
+@@ -546,34 +534,32 @@
+ private:
+   SMDS_Mesh(SMDS_Mesh * parent);
+ 
+-  SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
+-                                 const SMDS_MeshNode * node2,
+-                                 const SMDS_MeshNode * node3);
++  SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1, 
++				 const SMDS_MeshNode * node2, 
++				 const SMDS_MeshNode * node3);
+   SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
+-                                   const SMDS_MeshNode * node2,
+-                                   const SMDS_MeshNode * node3,
+-                                   const SMDS_MeshNode * node4);
+-  SMDS_Mesh0DElement* Find0DElementOrCreate(const SMDS_MeshNode * n);
++				   const SMDS_MeshNode * node2, 
++				   const SMDS_MeshNode * node3, 
++				   const SMDS_MeshNode * node4);
+   SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
+-                                  const SMDS_MeshNode * n2);
++				  const SMDS_MeshNode * n2);
+   SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
+-                                  const SMDS_MeshNode *n2,
+-                                  const SMDS_MeshNode *n3);
++				  const SMDS_MeshNode *n2,
++				  const SMDS_MeshNode *n3);
+   SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
+-                                  const SMDS_MeshNode *n2,
+-                                  const SMDS_MeshNode *n3,
+-                                  const SMDS_MeshNode *n4);
++				  const SMDS_MeshNode *n2,
++				  const SMDS_MeshNode *n3,
++				  const SMDS_MeshNode *n4);
+ 
+   bool registerElement(int ID, SMDS_MeshElement * element);
+ 
+-  void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
+-                            const SMDS_MeshElement * element,
+-                            std::set<const SMDS_MeshElement*>& nodes);
++  void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren, 
++			    const SMDS_MeshElement * element, 
++			    std::set<const SMDS_MeshElement*>& nodes);
+ 
+   // Fields PRIVATE
+-
++  
+   SetOfNodes             myNodes;
+-  SetOf0DElements        my0DElements;
+   SetOfEdges             myEdges;
+   SetOfFaces             myFaces;
+   SetOfVolumes           myVolumes;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_MeshInfo.hxx salomesmesh/inc/SMDS_MeshInfo.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_MeshInfo.hxx	2010-05-24 02:35:46.000000000 -0500
++++ salomesmesh/inc/SMDS_MeshInfo.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -26,11 +26,6 @@
+ #ifndef SMDS_MeshInfo_HeaderFile
+ #define SMDS_MeshInfo_HeaderFile
+ 
+-#ifdef __BORLANDC__
+-#pragma warn -8066
+-#pragma warn -8012
+-#endif
+-
+ using namespace std;
+ 
+ #include "SMESH_SMDS.hxx"
+@@ -45,10 +40,7 @@
+   inline void Clear();
+ 
+   int NbNodes() const { return myNbNodes; }
+-  inline int NbElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
+-  inline int NbEntities(SMDSAbs_EntityType  type) const;
+ 
+-  int Nb0DElements() const { return myNb0DElements; }
+   inline int NbEdges      (SMDSAbs_ElementOrder order = ORDER_ANY) const;
+   inline int NbFaces      (SMDSAbs_ElementOrder order = ORDER_ANY) const;
+   inline int NbTriangles  (SMDSAbs_ElementOrder order = ORDER_ANY) const;
+@@ -68,7 +60,7 @@
+   // methods to count NOT POLY elements
+   inline void remove(const SMDS_MeshElement* el);
+   inline void add   (const SMDS_MeshElement* el);
+-  inline int  index(SMDSAbs_ElementType type, int nbNodes) const;
++  inline int  index(SMDSAbs_ElementType type, int nbNodes);
+   // methods to remove elements of ANY kind
+   inline void RemoveEdge(const SMDS_MeshElement* el);
+   inline void RemoveFace(const SMDS_MeshElement* el);
+@@ -76,7 +68,6 @@
+ 
+   int myNbNodes;
+ 
+-  int myNb0DElements;
+   int myNbEdges      , myNbQuadEdges      ;
+   int myNbTriangles  , myNbQuadTriangles  ;
+   int myNbQuadrangles, myNbQuadQuadrangles;
+@@ -94,7 +85,6 @@
+ 
+ inline SMDS_MeshInfo::SMDS_MeshInfo():
+   myNbNodes(0),
+-  myNb0DElements(0),
+   myNbEdges      (0), myNbQuadEdges      (0),
+   myNbTriangles  (0), myNbQuadTriangles  (0),
+   myNbQuadrangles(0), myNbQuadQuadrangles(0),
+@@ -106,47 +96,40 @@
+   myNbPolyhedrons(0)
+ {
+   // Number of nodes in standard element types
+-  // n   v  f  e  0  n
+-  // o   o  a  d  d  o
+-  // d   l  c  g     d
+-  // e      e  e     e
+-  // s
+-  // -----------------
+-  // 0         *
+-  // 1            .  *
++  // n   v  f  e
++  // o   o  a  d
++  // d   l  c  g
++  // e      e  e
++  // -----------
++  // 1      
+   // 2         *
+-  // 3      .     *
+-  // 4   *  .  .
+-  // 5   *
+-  // 6   *  .
+-  // 7
+-  // 8   *  .
+-  // 9
+-  // 10  *
+-  // 11     *
+-  // 12     *
+-  // 13  *
+-  // 14     *
+-  // 15  *
+-  // 16     *
+-  // 17
+-  // 18
+-  // 19
++  // 3      *
++  // 4   *  *  *
++  // 5   *  
++  // 6   *  *
++  // 7      
++  // 8   *  *
++  // 9      
++  // 10  *  
++  // 11     
++  // 12     
++  // 13  *  
++  // 14     
++  // 15  *  
++  // 16     
++  // 17     
++  // 18     
++  // 19     
+   // 20  *
+   //
+   // So to have a unique index for each type basing on nb of nodes, we use a shift:
+-  myShift.resize(SMDSAbs_NbElementTypes, 0);
+-
+-  myShift[ SMDSAbs_Face      ] = +8; // 3->11, 4->12, 6->14, 8->16
+-  myShift[ SMDSAbs_Edge      ] = -2; // 2->0, 4->2
+-  myShift[ SMDSAbs_0DElement ] = +2; // 1->3
++  myShift.resize(SMDSAbs_Volume + 1, 0);
++  myShift[ SMDSAbs_Face ] = +8; // 3->11, 4->12, 6->14, 8->16
++  myShift[ SMDSAbs_Edge ] = -2; // 2->0, 4->2
+ 
+   myNb.resize( index( SMDSAbs_Volume,20 ) + 1, NULL);
+-
+   myNb[ index( SMDSAbs_Node,1 )] = & myNbNodes;
+ 
+-  myNb[ index( SMDSAbs_0DElement,1 )] = & myNb0DElements;
+-
+   myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges;
+   myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges;
+ 
+@@ -164,15 +147,13 @@
+   myNb[ index( SMDSAbs_Volume, 15)] = & myNbQuadPrisms;  
+   myNb[ index( SMDSAbs_Volume, 20)] = & myNbQuadHexas;   
+ }
+-
+ inline void // Clear
+ SMDS_MeshInfo::Clear()
+ { for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
+   myNbPolygons=myNbPolyhedrons=0;
+ }
+-
+ inline int // index
+-SMDS_MeshInfo::index(SMDSAbs_ElementType type, int nbNodes) const
++SMDS_MeshInfo::index(SMDSAbs_ElementType type, int nbNodes)
+ { return nbNodes + myShift[ type ]; }
+ 
+ inline void // remove
+@@ -231,100 +212,4 @@
+ SMDS_MeshInfo::NbPrisms  (SMDSAbs_ElementOrder order) const
+ { return order == ORDER_ANY ? myNbPrisms+myNbQuadPrisms : order == ORDER_LINEAR ? myNbPrisms : myNbQuadPrisms; }
+ 
+-inline int // NbElements
+-SMDS_MeshInfo::NbElements(SMDSAbs_ElementType type) const
+-{ 
+-  int nb = 0;
+-  switch (type) {
+-  case SMDSAbs_All:
+-    for ( int i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i];
+-    nb += myNbPolygons + myNbPolyhedrons;
+-    break;
+-  case SMDSAbs_Volume:
+-    nb = myNbTetras+ myNbPyramids+ myNbPrisms+ myNbHexas+
+-      myNbQuadTetras+ myNbQuadPyramids+ myNbQuadPrisms+ myNbQuadHexas+myNbPolyhedrons;
+-    break;
+-  case SMDSAbs_Face:
+-    nb = myNbTriangles+ myNbQuadrangles+ myNbQuadTriangles+ myNbQuadQuadrangles + myNbPolygons;
+-    break;
+-  case SMDSAbs_Edge:
+-    nb = myNbEdges + myNbQuadEdges;
+-    break;
+-  case SMDSAbs_0DElement:
+-    nb = myNb0DElements;
+-    break;
+-  case SMDSAbs_Node:
+-    nb = myNbNodes;
+-    break;
+-  default:;
+-  }
+-  return nb;
+-}
+-
+-int // NbEntities
+-SMDS_MeshInfo::NbEntities(SMDSAbs_EntityType  type) const
+-{
+-  switch (type) {
+-  case SMDSEntity_Node:
+-    return myNbNodes;
+-    break;
+-  case SMDSEntity_0D:
+-    return myNb0DElements;
+-    break;
+-  case SMDSEntity_Edge:
+-    return myNbEdges;
+-    break;
+-  case SMDSEntity_Quad_Edge:
+-    return myNbQuadEdges;
+-    break;
+-  case SMDSEntity_Triangle:
+-    return myNbTriangles;
+-    break;
+-  case SMDSEntity_Quad_Triangle:
+-    return myNbQuadTriangles;
+-    break;
+-  case SMDSEntity_Quadrangle:
+-    return myNbQuadrangles;
+-    break;
+-  case SMDSEntity_Quad_Quadrangle:
+-    return myNbQuadQuadrangles;
+-    break;
+-  case SMDSEntity_Polygon:
+-    return myNbPolygons;
+-    break;
+-  case SMDSEntity_Tetra:
+-    return myNbTetras;
+-    break;
+-  case SMDSEntity_Quad_Tetra:
+-    return myNbQuadTetras;
+-    break;
+-  case SMDSEntity_Pyramid:
+-    return myNbPyramids;
+-    break;
+-  case SMDSEntity_Quad_Pyramid:
+-    return myNbQuadPyramids;
+-    break;
+-  case SMDSEntity_Hexa:
+-    return myNbHexas;
+-    break;
+-  case SMDSEntity_Quad_Hexa:
+-    return myNbQuadHexas;
+-    break;
+-  case SMDSEntity_Penta:
+-    return myNbPrisms;
+-    break;
+-  case SMDSEntity_Quad_Penta:
+-    return myNbQuadPrisms;
+-    break;
+-  case SMDSEntity_Polyhedra:
+-    return myNbPolyhedrons;
+-    break;
+-  case SMDSEntity_Quad_Polygon:
+-  case SMDSEntity_Quad_Polyhedra:
+-  default:
+-  break;
+-  }
+-  return 0;
+-}
+-
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_MeshNode.hxx salomesmesh/inc/SMDS_MeshNode.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_MeshNode.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_MeshNode.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -35,41 +35,40 @@
+ class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
+ {
+ 
+-public:
+-  SMDS_MeshNode(double x, double y, double z);
+-  void Print(std::ostream & OS) const;
+-  double X() const;
+-  double Y() const;
+-  double Z() const;
+-  void AddInverseElement(const SMDS_MeshElement * ME);
+-  void RemoveInverseElement(const SMDS_MeshElement * parent);
+-  void ClearInverseElements();
+-  bool emptyInverseElements();
+-  SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
+-  int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
+-  void SetPosition(const SMDS_PositionPtr& aPos);
+-  const SMDS_PositionPtr& GetPosition() const;
+-  SMDSAbs_ElementType GetType() const;
+-  SMDSAbs_EntityType  GetEntityType() const {return SMDSEntity_Node;}
+-  int NbNodes() const;
+-  void setXYZ(double x, double y, double z);
+-  friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
++  public:
++	SMDS_MeshNode(double x, double y, double z);
++	void Print(std::ostream & OS) const;
++	double X() const;
++	double Y() const;
++	double Z() const;
++	void AddInverseElement(const SMDS_MeshElement * ME);
++	void RemoveInverseElement(const SMDS_MeshElement * parent);
++	void ClearInverseElements();
++	bool emptyInverseElements();
++	SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
++        int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
++	void SetPosition(const SMDS_PositionPtr& aPos);
++	const SMDS_PositionPtr& GetPosition() const;
++	SMDSAbs_ElementType GetType() const;
++	int NbNodes() const;
++	void setXYZ(double x, double y, double z);
++	friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
+ 
+   /*!
+    * \brief Return node by its index
+-   * \param ind - node index
+-   * \retval const SMDS_MeshNode* - the node
++    * \param ind - node index
++    * \retval const SMDS_MeshNode* - the node
+    */
+   virtual const SMDS_MeshNode* GetNode(const int) const { return this; }
+ 
+-protected:
+-  SMDS_ElemIteratorPtr
+-  elementsIterator(SMDSAbs_ElementType type) const;
++  protected:
++	SMDS_ElemIteratorPtr
++		elementsIterator(SMDSAbs_ElementType type) const;
+ 
+-private:
+-  double myX, myY, myZ;
+-  SMDS_PositionPtr myPosition;
+-  NCollection_List<const SMDS_MeshElement*> myInverseElements;
++  private:
++	double myX, myY, myZ;
++	SMDS_PositionPtr myPosition;
++	NCollection_List<const SMDS_MeshElement*> myInverseElements;
+ };
+ 
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_PolygonalFaceOfNodes.hxx salomesmesh/inc/SMDS_PolygonalFaceOfNodes.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_PolygonalFaceOfNodes.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_PolygonalFaceOfNodes.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -40,7 +40,6 @@
+   SMDS_PolygonalFaceOfNodes (std::vector<const SMDS_MeshNode *> nodes);
+ 
+   virtual SMDSAbs_ElementType GetType() const;
+-  virtual SMDSAbs_EntityType  GetEntityType() const { return SMDSEntity_Polygon; }
+   virtual bool IsPoly() const { return true; };
+ 
+   bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes);
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_PolyhedralVolumeOfNodes.hxx salomesmesh/inc/SMDS_PolyhedralVolumeOfNodes.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_PolyhedralVolumeOfNodes.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_PolyhedralVolumeOfNodes.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -39,7 +39,6 @@
+   //virtual ~SMDS_PolyhedralVolumeOfNodes();
+ 
+   virtual SMDSAbs_ElementType GetType() const;	
+-  virtual SMDSAbs_EntityType   GetEntityType() const { return SMDSEntity_Polyhedra; }
+   virtual bool IsPoly() const { return true; };
+ 
+   bool ChangeNodes (const std::vector<const SMDS_MeshNode *> & nodes,
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_QuadraticEdge.hxx salomesmesh/inc/SMDS_QuadraticEdge.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_QuadraticEdge.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_QuadraticEdge.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -47,8 +47,6 @@
+ 
+   int NbNodes() const;
+ 
+-  virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Quad_Edge; }
+-
+   virtual bool IsQuadratic() const { return true; }
+ 
+   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_QuadraticFaceOfNodes.hxx salomesmesh/inc/SMDS_QuadraticFaceOfNodes.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_QuadraticFaceOfNodes.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_QuadraticFaceOfNodes.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -49,7 +49,6 @@
+                             const SMDS_MeshNode * n34,
+                             const SMDS_MeshNode * n41);
+ 
+-  virtual SMDSAbs_EntityType GetEntityType() const;
+   virtual bool IsQuadratic() const { return true; }
+ 
+   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_QuadraticVolumeOfNodes.hxx salomesmesh/inc/SMDS_QuadraticVolumeOfNodes.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_QuadraticVolumeOfNodes.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_QuadraticVolumeOfNodes.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -99,7 +99,6 @@
+                               const SMDS_MeshNode * n37,
+                               const SMDS_MeshNode * n48);
+ 
+-  virtual SMDSAbs_EntityType   GetEntityType() const;
+   virtual bool IsQuadratic() const { return true; }
+ 
+   virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_VolumeOfFaces.hxx salomesmesh/inc/SMDS_VolumeOfFaces.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_VolumeOfFaces.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_VolumeOfFaces.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -54,7 +54,6 @@
+                            const SMDS_MeshFace * face5,
+                            const SMDS_MeshFace * face6);
+ 
+-        virtual SMDSAbs_EntityType GetEntityType() const;
+ 	void Print(std::ostream & OS) const;
+ 	
+ 	int NbFaces() const;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_VolumeOfNodes.hxx salomesmesh/inc/SMDS_VolumeOfNodes.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_VolumeOfNodes.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_VolumeOfNodes.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -69,8 +69,7 @@
+ 	int NbFaces() const;
+ 	int NbNodes() const;
+ 	int NbEdges() const;
+-	virtual SMDSAbs_ElementType GetType() const;	
+-        virtual SMDSAbs_EntityType GetEntityType() const;
++	SMDSAbs_ElementType GetType() const;	
+ 
+   /*!
+    * \brief Return node by its index
+diff -Naur smesh-5.1.2.2.svn55/inc/SMDS_VolumeTool.hxx salomesmesh/inc/SMDS_VolumeTool.hxx
+--- smesh-5.1.2.2.svn55/inc/SMDS_VolumeTool.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMDS_VolumeTool.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -93,8 +93,6 @@
+ 
+   bool GetBaryCenter (double & X, double & Y, double & Z) const;
+ 
+-  bool IsOut(double X, double Y, double Z, double tol);
+-  // Classify a point
+ 
+   // -----------------------
+   // info on node connection
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_0D_Algo.hxx salomesmesh/inc/SMESH_0D_Algo.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_0D_Algo.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_0D_Algo.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESH : implementaion of SMESH idl descriptions
+ //  File   : SMESH_0D_Algo.hxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_0D_Algo.hxx,v 1.2.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef _SMESH_0D_ALGO_HXX_
+ #define _SMESH_0D_ALGO_HXX_
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_1D_Algo.hxx salomesmesh/inc/SMESH_1D_Algo.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_1D_Algo.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_1D_Algo.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_1D_Algo.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_1D_Algo.hxx,v 1.8.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef _SMESH_1D_ALGO_HXX_
+ #define _SMESH_1D_ALGO_HXX_
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_2D_Algo.hxx salomesmesh/inc/SMESH_2D_Algo.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_2D_Algo.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_2D_Algo.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_2D_Algo.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_2D_Algo.hxx,v 1.9.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef _SMESH_2D_ALGO_HXX_
+ #define _SMESH_2D_ALGO_HXX_
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_3D_Algo.hxx salomesmesh/inc/SMESH_3D_Algo.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_3D_Algo.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_3D_Algo.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_3D_Algo.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_3D_Algo.hxx,v 1.9.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef _SMESH_3D_ALGO_HXX_
+ #define _SMESH_3D_ALGO_HXX_
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Algo.hxx salomesmesh/inc/SMESH_Algo.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Algo.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Algo.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,8 +23,8 @@
+ //  File   : SMESH_Algo.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Algo.hxx,v 1.12.2.4 2008/11/27 12:25:15 abd Exp $
+ //
+-
+ #ifndef _SMESH_ALGO_HXX_
+ #define _SMESH_ALGO_HXX_
+ 
+@@ -54,9 +54,6 @@
+ class SMESH_subMesh;
+ class SMESH_MesherHelper;
+ 
+-typedef std::map< SMESH_subMesh*, std::vector<int> > MapShapeNbElems;
+-// vector must have size corresponding to EntityType_Last from SMDSAbs:
+-typedef std::map< SMESH_subMesh*, std::vector<int> >::iterator MapShapeNbElemsItr;
+ 
+ class SMESH_EXPORT SMESH_Algo:public SMESH_Hypothesis
+ {
+@@ -126,16 +123,6 @@
+   virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
+ 
+   /*!
+-   * \brief evaluates size of prospective mesh on a shape
+-    * \param aMesh - the mesh
+-    * \param aShape - the shape
+-    * \param aNbElems - prospective number of elements by types
+-    * \retval bool - is a success
+-   */
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap) = 0;
+-
+-  /*!
+    * \brief Returns a list of compatible hypotheses used to mesh a shape
+     * \param aMesh - the mesh 
+     * \param aShape - the shape
+@@ -176,10 +163,13 @@
+   bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
+                                  const bool         ignoreAuxiliary) const;
+   /*!
+-   * \brief Just return false as the algorithm does not hold parameters values
++   * \brief Initialize my parameter values by the mesh built on the geometry
++   *
++   * Just return false as the algorithm does not hold parameters values
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
++
+   /*!
+    * \brief return compute error
+    */
+@@ -253,7 +243,8 @@
+   static bool GetNodeParamOnEdge(const SMESHDS_Mesh*     theMesh,
+                                  const TopoDS_Edge&      theEdge,
+                                  std::vector< double > & theParams);
+-  /*!
++								 		 
++   /*!
+    * \brief Fill map of node parameter on geometrical edge to node it-self
+    * \param theMesh - The mesh containing nodes
+    * \param theEdge - The geometrical edge of interest
+@@ -265,6 +256,7 @@
+                                    const TopoDS_Edge&                         theEdge,
+                                    const bool                                 ignoreMediumNodes,
+                                    std::map< double, const SMDS_MeshNode* > & theNodes);
++								 
+   /*!
+    * \brief Find out elements orientation on a geometrical face
+    * \param theFace - The face correctly oriented in the shape being meshed
+@@ -303,7 +295,7 @@
+     * \retval const SMDS_MeshNode* - found node or NULL
+    */
+   static const SMDS_MeshNode* VertexNode(const TopoDS_Vertex& V,
+-                                         const SMESHDS_Mesh* meshDS);
++                                         const SMESHDS_Mesh*        meshDS);
+ 
+ protected:
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Block.hxx salomesmesh/inc/SMESH_Block.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Block.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Block.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -276,14 +276,11 @@
+   static int GetOrderedEdges (const TopoDS_Face&        theFace,
+                               TopoDS_Vertex             theFirstVertex,
+                               std::list< TopoDS_Edge >& theEdges,
+-                              std::list< int >  &       theNbVertexInWires,
+-                              const bool                theShapeAnalysisAlgo=false);
++                              std::list< int >  &       theNbVertexInWires);
+   // Return nb wires and a list of oredered edges.
+   // It is used to assign indices to subshapes.
+   // theFirstVertex may be NULL.
+   // Always try to set a seam edge first
+-  // if (theShapeAnalysisAlgo) then ShapeAnalysis::OuterWire() is used to find the outer
+-  // wire else BRepTools::OuterWire() is used
+ 
+  public:
+   // -----------------------------------------------------------
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_ControlsDef.hxx salomesmesh/inc/SMESH_ControlsDef.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_ControlsDef.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_ControlsDef.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -68,40 +68,30 @@
+ namespace SMESH{
+   namespace Controls{
+ 
+-    class SMESHCONTROLS_EXPORT TSequenceOfXYZ
++    class SMESHCONTROLS_EXPORT TSequenceOfXYZ: public std::vector<gp_XYZ>
+     {
+-      typedef std::vector<gp_XYZ>::size_type size_type;
+-
+     public:
+       TSequenceOfXYZ();
+ 
+       TSequenceOfXYZ(size_type n);
+ 
+-      TSequenceOfXYZ(size_type n, const gp_XYZ& t);
++      TSequenceOfXYZ(size_type n, const value_type& t);
+ 
+       TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
+ 
+       template <class InputIterator>
+       TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
+ 
+-      ~TSequenceOfXYZ();
+-
+       TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
+ 
+-      gp_XYZ& operator()(size_type n);
+-
+-      const gp_XYZ& operator()(size_type n) const;
+-
+-      void clear();
++      reference operator()(size_type n);
+ 
+-      void reserve(size_type n);
+-
+-      void push_back(const gp_XYZ& v);
+-
+-      size_type size() const;
++      const_reference operator()(size_type n) const;
+ 
+     private:
+-      std::vector<gp_XYZ> myArray;
++      reference operator[](size_type n);
++
++      const_reference operator[](size_type n) const;
+     };
+ 
+     /*
+@@ -132,9 +122,9 @@
+       void  SetPrecision( const long thePrecision );
+       
+       bool GetPoints(const int theId,
+-                     TSequenceOfXYZ& theRes) const;
++		     TSequenceOfXYZ& theRes) const;
+       static bool GetPoints(const SMDS_MeshElement* theElem,
+-                            TSequenceOfXYZ& theRes);
++			    TSequenceOfXYZ& theRes);
+     protected:
+       const SMDS_Mesh* myMesh;
+       const SMDS_MeshElement* myCurrElement;
+@@ -263,10 +253,10 @@
+       virtual double GetBadRate( double Value, int nbNodes ) const;
+       virtual SMDSAbs_ElementType GetType() const;
+       struct Value{
+-        double myLength;
+-        long myPntId[2];
+-        Value(double theLength, long thePntId1, long thePntId2);
+-        bool operator<(const Value& x) const;
++	double myLength;
++	long myPntId[2];
++	Value(double theLength, long thePntId1, long thePntId2);
++	bool operator<(const Value& x) const;
+       };
+       typedef std::set<Value> TValues;
+       void GetValues(TValues& theValues);
+@@ -296,9 +286,9 @@
+       virtual double GetBadRate( double Value, int nbNodes ) const;
+       virtual SMDSAbs_ElementType GetType() const;
+       struct Value{
+-        long myPntId[2];
+-        Value(long thePntId1, long thePntId2);
+-        bool operator<(const Value& x) const;
++	long myPntId[2];
++	Value(long thePntId1, long thePntId2);
++	bool operator<(const Value& x) const;
+       };
+       typedef std::map<Value,int> MValues;
+ 
+@@ -364,10 +354,10 @@
+       static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId  );
+       typedef long TElemId;
+       struct Border{
+-        TElemId myElemId;
+-        TElemId myPntId[2];
+-        Border(long theElemId, long thePntId1, long thePntId2);
+-        bool operator<(const Border& x) const;
++	TElemId myElemId;
++	TElemId myPntId[2];
++	Border(long theElemId, long thePntId1, long thePntId2);
++	bool operator<(const Border& x) const;
+       };
+       typedef std::set<Border> TBorders;
+       void GetBoreders(TBorders& theBorders);
+@@ -797,13 +787,13 @@
+       virtual
+       void
+       GetElementsId( const SMDS_Mesh* theMesh,
+-                     TIdSequence& theSequence );
++		     TIdSequence& theSequence );
+ 
+       static
+       void
+       GetElementsId( const SMDS_Mesh* theMesh,
+-                     PredicatePtr thePredicate,
+-                     TIdSequence& theSequence );
++		     PredicatePtr thePredicate,
++		     TIdSequence& theSequence );
+       
+     protected:
+       PredicatePtr myPredicate;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_DriverDAT.hxx salomesmesh/inc/SMESH_DriverDAT.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_DriverDAT.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_DriverDAT.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -27,7 +27,7 @@
+ #define _SMESH_DriverDAT_HXX_
+ 
+ #ifdef WNT
+- #if defined MESHDRIVERDAT_EXPORTS || defined MeshDriverDAT_EXPORTS
++ #if defined MESHDRIVERDAT_EXPORTS
+   #define MESHDRIVERDAT_EXPORT __declspec( dllexport )
+  #else
+   #define MESHDRIVERDAT_EXPORT __declspec( dllimport )
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_DriverSTL.hxx salomesmesh/inc/SMESH_DriverSTL.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_DriverSTL.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_DriverSTL.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -27,7 +27,7 @@
+ #define _SMESH_DriverSTL_HXX_
+ 
+ #ifdef WNT
+- #if defined MESHDRIVERSTL_EXPORTS || defined MeshDriverSTL_EXPORTS
++ #if defined MESHDRIVERSTL_EXPORTS
+   #define MESHDRIVERSTL_EXPORT __declspec( dllexport )
+  #else
+   #define MESHDRIVERSTL_EXPORT __declspec( dllimport )
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_DriverUNV.hxx salomesmesh/inc/SMESH_DriverUNV.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_DriverUNV.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_DriverUNV.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -27,7 +27,7 @@
+ #define _SMESH_DriverUNV_HXX_
+ 
+ #ifdef WNT
+- #if defined MESHDRIVERUNV_EXPORTS || defined MeshDriverUNV_EXPORTS
++ #if defined MESHDRIVERUNV_EXPORTS
+   #define MESHDRIVERUNV_EXPORT __declspec( dllexport )
+  #else
+   #define MESHDRIVERUNV_EXPORT __declspec( dllimport )
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_Command.hxx salomesmesh/inc/SMESHDS_Command.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_Command.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESHDS_Command.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -38,7 +38,6 @@
+   public:
+ 	SMESHDS_Command(const SMESHDS_CommandType aType);
+ 	void AddNode(int NewNodeID, double x, double y, double z);
+-	void Add0DElement(int New0DElementID, int idnode);
+ 	void AddEdge(int NewEdgeID, int idnode1, int idnode2);
+ 	void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
+ 	void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_CommandType.hxx salomesmesh/inc/SMESHDS_CommandType.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_CommandType.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESHDS_CommandType.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -53,9 +53,7 @@
+   SMESHDS_AddQuadTetrahedron,
+   SMESHDS_AddQuadPyramid,
+   SMESHDS_AddQuadPentahedron,
+-  SMESHDS_AddQuadHexahedron,
+-  // special type for 0D elements
+-  SMESHDS_Add0DElement
++  SMESHDS_AddQuadHexahedron
+ };
+ 
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_DataMapOfShape.hxx salomesmesh/inc/SMESHDS_DataMapOfShape.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_DataMapOfShape.hxx	2011-09-27 03:33:02.000000000 -0500
++++ salomesmesh/inc/SMESHDS_DataMapOfShape.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -32,7 +32,7 @@
+  * This method needed for instance NCollection_DataMap with TopoDS_Shape as key
+  */
+ 
+-inline Standard_Boolean SMESH_IsEqual(const TopoDS_Shape& S1,
++inline Standard_Boolean IsEqual(const TopoDS_Shape& S1,
+                                 const TopoDS_Shape& S2)
+ {
+   return S1.IsSame(S2);
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_GroupBase.hxx salomesmesh/inc/SMESHDS_GroupBase.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_GroupBase.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESHDS_GroupBase.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESHDS : management of mesh data and SMESH document
+ //  File   : SMESHDS_Group.hxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_GroupBase.hxx,v 1.8.2.1 2008/11/27 12:31:37 abd Exp $
+ //
+ #ifndef _SMESHDS_GroupBase_HeaderFile
+ #define _SMESHDS_GroupBase_HeaderFile
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_Group.hxx salomesmesh/inc/SMESHDS_Group.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_Group.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESHDS_Group.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESHDS : management of mesh data and SMESH document
+ //  File   : SMESHDS_Group.hxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Group.hxx,v 1.7.2.1 2008/11/27 12:31:37 abd Exp $
+ //
+ #ifndef _SMESHDS_Group_HeaderFile
+ #define _SMESHDS_Group_HeaderFile
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_Hypothesis.hxx salomesmesh/inc/SMESHDS_Hypothesis.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_Hypothesis.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESHDS_Hypothesis.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESHDS_Hypothesis.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_Hypothesis.hxx,v 1.10.2.1 2008/11/27 12:31:37 abd Exp $
+ //
+ #ifndef _SMESHDS_HYPOTHESIS_HXX_
+ #define _SMESHDS_HYPOTHESIS_HXX_
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_Mesh.hxx salomesmesh/inc/SMESHDS_Mesh.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_Mesh.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESHDS_Mesh.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -30,7 +30,6 @@
+ 
+ #include "SMDS_Mesh.hxx"
+ #include "SMDS_MeshNode.hxx"
+-#include "SMDS_Mesh0DElement.hxx"
+ #include "SMDS_MeshEdge.hxx"
+ #include "SMDS_MeshFace.hxx"
+ #include "SMDS_MeshVolume.hxx"
+@@ -67,164 +66,160 @@
+   bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
+   
+   virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
+-  virtual SMDS_MeshNode* AddNode(double x, double y, double z);
+-  
+-  virtual SMDS_Mesh0DElement* Add0DElementWithID(int nodeID, int ID);
+-  virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * node, int ID);
+-  virtual SMDS_Mesh0DElement* Add0DElement      (const SMDS_MeshNode * node);
++  virtual SMDS_MeshNode * AddNode(double x, double y, double z);
+   
+   virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
+   virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2, 
+-                                       int ID);
++				       const SMDS_MeshNode * n2, 
++				       int ID);
+   virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2);
++				 const SMDS_MeshNode * n2);
+   
+   // 2d order edge with 3 nodes: n12 - node between n1 and n2
+   virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
+   virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2, 
+-                                       const SMDS_MeshNode * n12, 
+-                                       int ID);
++				       const SMDS_MeshNode * n2, 
++				       const SMDS_MeshNode * n12, 
++				       int ID);
+   virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
+                                  const SMDS_MeshNode * n2,
+                                  const SMDS_MeshNode * n12);
+ 
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3, 
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3);
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3);
+ 
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3,
+-                                       const SMDS_MeshNode * n4, 
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3,
++				       const SMDS_MeshNode * n4, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3,
+-                                 const SMDS_MeshNode * n4);
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3,
++				 const SMDS_MeshNode * n4);
+ 
+   // 2d order triangle of 6 nodes
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
+                                        int n12,int n23,int n31, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3, 
+-                                       const SMDS_MeshNode * n12,
+-                                       const SMDS_MeshNode * n23,
+-                                       const SMDS_MeshNode * n31, 
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3, 
++				       const SMDS_MeshNode * n12,
++				       const SMDS_MeshNode * n23,
++				       const SMDS_MeshNode * n31, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3,
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3,
+                                  const SMDS_MeshNode * n12,
+-                                 const SMDS_MeshNode * n23,
+-                                 const SMDS_MeshNode * n31);
++				 const SMDS_MeshNode * n23,
++				 const SMDS_MeshNode * n31);
+ 
+   // 2d order quadrangle
+   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
+                                        int n12,int n23,int n34,int n41, int ID);
+   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
+-                                       const SMDS_MeshNode * n2,
+-                                       const SMDS_MeshNode * n3,
+-                                       const SMDS_MeshNode * n4, 
+-                                       const SMDS_MeshNode * n12,
+-                                       const SMDS_MeshNode * n23,
+-                                       const SMDS_MeshNode * n34,
+-                                       const SMDS_MeshNode * n41, 
+-                                       int ID);
++				       const SMDS_MeshNode * n2,
++				       const SMDS_MeshNode * n3,
++				       const SMDS_MeshNode * n4, 
++				       const SMDS_MeshNode * n12,
++				       const SMDS_MeshNode * n23,
++				       const SMDS_MeshNode * n34,
++				       const SMDS_MeshNode * n41, 
++				       int ID);
+   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
+-                                 const SMDS_MeshNode * n2,
+-                                 const SMDS_MeshNode * n3,
+-                                 const SMDS_MeshNode * n4,
++				 const SMDS_MeshNode * n2,
++				 const SMDS_MeshNode * n3,
++				 const SMDS_MeshNode * n4,
+                                  const SMDS_MeshNode * n12,
+-                                 const SMDS_MeshNode * n23,
+-                                 const SMDS_MeshNode * n34,
+-                                 const SMDS_MeshNode * n41);
++				 const SMDS_MeshNode * n23,
++				 const SMDS_MeshNode * n34,
++				 const SMDS_MeshNode * n41);
+ 
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4);
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4);
+ 
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5);
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5);
+ 
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6);
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6);
+ 
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6,
+-                                           const SMDS_MeshNode * n7,
+-                                           const SMDS_MeshNode * n8, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6,
++					   const SMDS_MeshNode * n7,
++					   const SMDS_MeshNode * n8, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6,
+-                                     const SMDS_MeshNode * n7,
+-                                     const SMDS_MeshNode * n8);
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6,
++				     const SMDS_MeshNode * n7,
++				     const SMDS_MeshNode * n8);
+   
+   // 2d order tetrahedron of 10 nodes
+   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
+                                            int n12,int n23,int n31,
+                                            int n14,int n24,int n34, int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4, 
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n31,
+-                                           const SMDS_MeshNode * n14, 
+-                                           const SMDS_MeshNode * n24,
+-                                           const SMDS_MeshNode * n34, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n31,
++					   const SMDS_MeshNode * n14, 
++					   const SMDS_MeshNode * n24,
++					   const SMDS_MeshNode * n34, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+                                      const SMDS_MeshNode * n31,
+@@ -238,24 +233,24 @@
+                                            int n15,int n25,int n35,int n45,
+                                            int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5, 
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n34,
+-                                           const SMDS_MeshNode * n41, 
+-                                           const SMDS_MeshNode * n15,
+-                                           const SMDS_MeshNode * n25,
+-                                           const SMDS_MeshNode * n35,
+-                                           const SMDS_MeshNode * n45, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n34,
++					   const SMDS_MeshNode * n41, 
++					   const SMDS_MeshNode * n15,
++					   const SMDS_MeshNode * n25,
++					   const SMDS_MeshNode * n35,
++					   const SMDS_MeshNode * n45, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+                                      const SMDS_MeshNode * n34,
+@@ -273,27 +268,27 @@
+                                            int n14,int n25,int n36,
+                                            int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6, 
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n31, 
+-                                           const SMDS_MeshNode * n45,
+-                                           const SMDS_MeshNode * n56,
+-                                           const SMDS_MeshNode * n64, 
+-                                           const SMDS_MeshNode * n14,
+-                                           const SMDS_MeshNode * n25,
+-                                           const SMDS_MeshNode * n36, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n31, 
++					   const SMDS_MeshNode * n45,
++					   const SMDS_MeshNode * n56,
++					   const SMDS_MeshNode * n64, 
++					   const SMDS_MeshNode * n14,
++					   const SMDS_MeshNode * n25,
++					   const SMDS_MeshNode * n36, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6, 
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6, 
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+                                      const SMDS_MeshNode * n31, 
+@@ -312,34 +307,34 @@
+                                            int n15,int n26,int n37,int n48,
+                                            int ID);
+   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
+-                                           const SMDS_MeshNode * n2,
+-                                           const SMDS_MeshNode * n3,
+-                                           const SMDS_MeshNode * n4,
+-                                           const SMDS_MeshNode * n5,
+-                                           const SMDS_MeshNode * n6,
+-                                           const SMDS_MeshNode * n7,
+-                                           const SMDS_MeshNode * n8, 
+-                                           const SMDS_MeshNode * n12,
+-                                           const SMDS_MeshNode * n23,
+-                                           const SMDS_MeshNode * n34,
+-                                           const SMDS_MeshNode * n41, 
+-                                           const SMDS_MeshNode * n56,
+-                                           const SMDS_MeshNode * n67,
+-                                           const SMDS_MeshNode * n78,
+-                                           const SMDS_MeshNode * n85, 
+-                                           const SMDS_MeshNode * n15,
+-                                           const SMDS_MeshNode * n26,
+-                                           const SMDS_MeshNode * n37,
+-                                           const SMDS_MeshNode * n48, 
+-                                           int ID);
++					   const SMDS_MeshNode * n2,
++					   const SMDS_MeshNode * n3,
++					   const SMDS_MeshNode * n4,
++					   const SMDS_MeshNode * n5,
++					   const SMDS_MeshNode * n6,
++					   const SMDS_MeshNode * n7,
++					   const SMDS_MeshNode * n8, 
++					   const SMDS_MeshNode * n12,
++					   const SMDS_MeshNode * n23,
++					   const SMDS_MeshNode * n34,
++					   const SMDS_MeshNode * n41, 
++					   const SMDS_MeshNode * n56,
++					   const SMDS_MeshNode * n67,
++					   const SMDS_MeshNode * n78,
++					   const SMDS_MeshNode * n85, 
++					   const SMDS_MeshNode * n15,
++					   const SMDS_MeshNode * n26,
++					   const SMDS_MeshNode * n37,
++					   const SMDS_MeshNode * n48, 
++					   int ID);
+   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
+-                                     const SMDS_MeshNode * n2,
+-                                     const SMDS_MeshNode * n3,
+-                                     const SMDS_MeshNode * n4,
+-                                     const SMDS_MeshNode * n5,
+-                                     const SMDS_MeshNode * n6,
+-                                     const SMDS_MeshNode * n7,
+-                                     const SMDS_MeshNode * n8, 
++				     const SMDS_MeshNode * n2,
++				     const SMDS_MeshNode * n3,
++				     const SMDS_MeshNode * n4,
++				     const SMDS_MeshNode * n5,
++				     const SMDS_MeshNode * n6,
++				     const SMDS_MeshNode * n7,
++				     const SMDS_MeshNode * n8, 
+                                      const SMDS_MeshNode * n12,
+                                      const SMDS_MeshNode * n23,
+                                      const SMDS_MeshNode * n34,
+@@ -405,9 +400,9 @@
+   void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
+   void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
+   void SetMeshElementOnShape(const SMDS_MeshElement * anElt,
+-                             const TopoDS_Shape & S);
++			     const TopoDS_Shape & S);
+   void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt,
+-                               const TopoDS_Shape & S);
++			       const TopoDS_Shape & S);
+   bool HasMeshElements(const TopoDS_Shape & S);
+   SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
+   SMESHDS_SubMesh * MeshElements(const int Index);
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESHDS_Script.hxx salomesmesh/inc/SMESHDS_Script.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESHDS_Script.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESHDS_Script.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -44,7 +44,6 @@
+         bool IsModified();
+ 
+ 	void AddNode(int NewNodeID, double x, double y, double z);
+-	void Add0DElement(int New0DElementID, int idnode);
+ 	void AddEdge(int NewEdgeID, int idnode1, int idnode2);
+ 	void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
+ 	void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_ExceptHandlers.hxx salomesmesh/inc/SMESH_ExceptHandlers.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_ExceptHandlers.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_ExceptHandlers.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -31,7 +31,19 @@
+ 
+ #include <stdexcept>
+ 
+-#include <SMESH_SMESH.hxx>
++#if defined SMESH_EXPORTS
++#if defined WIN32
++#define SMESH_EXPORT __declspec( dllexport )
++#else
++#define SMESH_EXPORT
++#endif
++#else
++#if defined WNT
++#define SMESH_EXPORT __declspec( dllimport )
++#else
++#define SMESH_EXPORT
++#endif
++#endif
+ 
+ typedef void (*PVF)();
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Exception.hxx salomesmesh/inc/SMESH_Exception.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Exception.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Exception.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -31,7 +31,19 @@
+ # define LOCALIZED(message) #message
+ #endif
+ 
+-#include <SMESH_SMESH.hxx>
++#if defined SMESH_EXPORTS
++#if defined WIN32
++#define SMESH_EXPORT __declspec( dllexport )
++#else
++#define SMESH_EXPORT
++#endif
++#else
++#if defined WNT
++#define SMESH_EXPORT __declspec( dllimport )
++#else
++#define SMESH_EXPORT
++#endif
++#endif
+ 
+ class SMESH_EXPORT SMESH_Exception : public std::exception
+ {
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Gen.hxx salomesmesh/inc/SMESH_Gen.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Gen.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Gen.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -30,7 +30,7 @@
+ 
+ #include "SMESH_SMESH.hxx"
+ 
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+ #include "SMESH_ComputeError.hxx"
+@@ -61,12 +61,12 @@
+ 
+ class SMESH_EXPORT  SMESH_Gen
+ {
+-public:
++ public:
+   SMESH_Gen();
+   ~SMESH_Gen();
+ 
+   SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+ 
+   /*!
+    * \brief Computes aMesh on aShape 
+@@ -78,21 +78,8 @@
+   bool Compute(::SMESH_Mesh &        aMesh,
+                const TopoDS_Shape &  aShape,
+                const bool            anUpward=false,
+-               const ::MeshDimension aDim=::MeshDim_3D,
+-               TSetOfInt*            aShapesId=0);
+-
+-  /*!
+-   * \brief evaluates size of prospective mesh on a shape 
+-   * \param aMesh - the mesh
+-   * \param aShape - the shape
+-   * \param aResMap - map for prospective numbers of elements
+-   * \retval bool - is a success
+-   */
+-  bool Evaluate(::SMESH_Mesh &        aMesh,
+-                const TopoDS_Shape &  aShape,
+-                MapShapeNbElems&      aResMap,
+-                const bool            anUpward=false,
+-                TSetOfInt*            aShapesId=0);
++	       const ::MeshDimension aDim=::MeshDim_3D,
++	       TSetOfInt*            aShapesId=0);
+ 
+   bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+   // notify on bad state of attached algos, return false
+@@ -109,7 +96,7 @@
+    */
+   void SetDefaultNbSegments(int nb) { _nbSegments = nb; }
+   int GetDefaultNbSegments() const { return _nbSegments; }
+-
++  
+   struct TAlgoStateError
+   {
+     TAlgoStateErrorName _name;
+@@ -138,6 +125,16 @@
+   SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
+   static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
+ 
++  // inherited methods from SALOMEDS::Driver
++
++//   void Save(int studyId, const char *aUrlOfFile);
++//   void Load(int studyId, const char *aUrlOfFile);
++//   void Close(int studyId);
++//   const char *ComponentDataType();
++
++//   const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
++//   const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
++
+   int GetANewId();
+ 
+   std::map < int, SMESH_Algo * >_mapAlgo;
+@@ -146,9 +143,9 @@
+   std::map < int, SMESH_2D_Algo * >_map2D_Algo;
+   std::map < int, SMESH_3D_Algo * >_map3D_Algo;
+ 
+-private:
++ private:
+ 
+-  int _localId;                     // unique Id of created objects, within SMESH_Gen entity
++  int _localId;				// unique Id of created objects, within SMESH_Gen entity
+   std::map < int, StudyContextStruct * >_mapStudyContext;
+ 
+   // hypotheses managing
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Group.hxx salomesmesh/inc/SMESH_Group.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Group.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Group.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : SMESH_Group.hxx
+ //  Author : Michael Sazonov (OCC)
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Group.hxx,v 1.8.2.1 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef _SMESH_Group_HeaderFile
+ #define _SMESH_Group_HeaderFile
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_HypoFilter.hxx salomesmesh/inc/SMESH_HypoFilter.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_HypoFilter.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_HypoFilter.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESH : implementaion of SMESH idl descriptions
+ //  File   : SMESH_HypoFilter.hxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_HypoFilter.hxx,v 1.6.2.2 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef SMESH_HypoFilter_HeaderFile
+ #define SMESH_HypoFilter_HeaderFile
+@@ -96,14 +96,10 @@
+   std::list<SMESH_HypoPredicate*> myPredicates;
+ 
+   // private methods
+- #ifdef __BORLANDC__
+  public:
+- #endif
+   enum Logical { AND, AND_NOT, OR, OR_NOT };
+   enum Comparison { EQUAL, NOT_EQUAL, MORE, LESS };
+- #ifdef __BORLANDC__
+  protected:
+- #endif
+   SMESH_HypoFilter(const SMESH_HypoFilter& other){}
+ 
+   void add( Logical bool_op, SMESH_HypoPredicate* pred )
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx salomesmesh/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_IndexedDataMapOfShapeIndexedMapOfShape.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -48,6 +48,8 @@
+ SMESH_DEFINE_INDEXEDMAP (SMESH_IndexedMapOfShape, SMESH_BaseCollectionShape, TopoDS_Shape)
+ #endif
+ 
++
++
+ #endif 
+ 
+ #ifndef SMESH_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_IndexedMap.hxx salomesmesh/inc/SMESH_IndexedMap.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_IndexedMap.hxx	2011-09-27 03:33:02.000000000 -0500
++++ salomesmesh/inc/SMESH_IndexedMap.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -226,7 +226,7 @@
+     pNode = (IndexedMapNode *) myData1[iK1];
+     while (pNode)
+     {
+-      if (SMESH_IsEqual (pNode->Key1(), theKey1))
++      if (IsEqual (pNode->Key1(), theKey1))
+         return pNode->Key2();
+       pNode = (IndexedMapNode *) pNode->Next();
+     }
+@@ -249,7 +249,7 @@
+     pNode1 = (IndexedMapNode *) myData1[iK1];
+     while (pNode1) 
+     {
+-      if (SMESH_IsEqual(pNode1->Key1(), theKey1))
++      if (IsEqual(pNode1->Key1(), theKey1)) 
+         return Standard_True;
+       pNode1 = (IndexedMapNode *) pNode1->Next();
+     }
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_MeshEditor.hxx salomesmesh/inc/SMESH_MeshEditor.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_MeshEditor.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_MeshEditor.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -41,7 +41,6 @@
+ 
+ #include <list>
+ #include <map>
+-#include <set>
+ 
+ class SMDS_MeshFace;
+ class SMDS_MeshNode;
+@@ -55,7 +54,7 @@
+                  std::list<const SMDS_MeshElement*> >        TElemOfElemListMap;
+ typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
+ 
+-//!< Set of elements sorted by ID, to be used to assure predictability of edition
++ //!< Set of elements sorted by ID, to be used to assure predictability of edition
+ typedef std::set< const SMDS_MeshElement*, TIDCompare >      TIDSortedElemSet;
+ 
+ typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* >   NLink;
+@@ -63,32 +62,6 @@
+ 
+ //=======================================================================
+ /*!
+- * \brief Searcher for the node closest to point
+- */
+-//=======================================================================
+-struct SMESH_NodeSearcher
+-{
+-  virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0;
+-  virtual void MoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ) = 0;
+-};
+-
+-//=======================================================================
+-/*!
+- * \brief Return elements of given type where the given point is IN or ON.
+- *
+- * 'ALL' type means elements of any type excluding nodes and 0D elements
+- */
+-//=======================================================================
+-
+-struct SMESH_ElementSearcher
+-{
+-  virtual void FindElementsByPoint(const gp_Pnt&                           point,
+-                                   SMDSAbs_ElementType                     type,
+-                                   std::vector< const SMDS_MeshElement* >& foundElems)=0;
+-};
+-
+-//=======================================================================
+-/*!
+  * \brief A sorted pair of nodes
+  */
+ //=======================================================================
+@@ -99,55 +72,18 @@
+   { if ( n1->GetID() < n2->GetID() ) std::swap( first, second ); }
+   SMESH_TLink(const NLink& link ):NLink( link )
+   { if ( first->GetID() < second->GetID() ) std::swap( first, second ); }
+-  const SMDS_MeshNode* node1() const { return first; }
+-  const SMDS_MeshNode* node2() const { return second; }
+ };
+ 
+-//=======================================================================
++// ============================================================
+ /*!
+- * auxiliary class
++ * \brief Searcher for the node closest to point
+  */
+-//=======================================================================
+-class SMESH_MeshEditor_PathPoint {
+-public:
+-  SMESH_MeshEditor_PathPoint() {
+-    myPnt.SetCoord(99., 99., 99.);
+-    myTgt.SetCoord(1.,0.,0.);
+-    myAngle=0.;
+-    myPrm=0.;
+-  }
+-  void SetPnt(const gp_Pnt& aP3D){
+-    myPnt=aP3D;
+-  }
+-  void SetTangent(const gp_Dir& aTgt){
+-    myTgt=aTgt;
+-  }
+-  void SetAngle(const double& aBeta){
+-    myAngle=aBeta;
+-  }
+-  void SetParameter(const double& aPrm){
+-    myPrm=aPrm;
+-  }
+-  const gp_Pnt& Pnt()const{
+-    return myPnt;
+-  }
+-  const gp_Dir& Tangent()const{
+-    return myTgt;
+-  }
+-  double Angle()const{
+-    return myAngle;
+-  }
+-  double Parameter()const{
+-    return myPrm;
+-  }
+-
+-protected:
+-  gp_Pnt myPnt;
+-  gp_Dir myTgt;
+-  double myAngle;
+-  double myPrm;
+-};
++// ============================================================
+ 
++struct SMESH_NodeSearcher
++{
++  virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0;
++};
+ 
+ // ============================================================
+ /*!
+@@ -356,16 +292,6 @@
+                                        const SMDS_MeshNode* theNodeStart,
+                                        const bool           theHasAngles,
+                                        std::list<double>&   theAngles,
+-                                       const bool           theLinearVariation,
+-                                       const bool           theHasRefPoint,
+-                                       const gp_Pnt&        theRefPoint,
+-                                       const bool           theMakeGroups);
+-  Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet &   theElements,
+-                                       SMESH_Mesh*          theTrackPattern,
+-                                       const SMDS_MeshNode* theNodeStart,
+-                                       const bool           theHasAngles,
+-                                       std::list<double>&   theAngles,
+-                                       const bool           theLinearVariation,
+                                        const bool           theHasRefPoint,
+                                        const gp_Pnt&        theRefPoint,
+                                        const bool           theMakeGroups);
+@@ -379,7 +305,6 @@
+                        SMESH_Mesh*        theTargetMesh=0);
+   // Move or copy theElements applying theTrsf to their nodes
+ 
+-
+   typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
+ 
+   void FindCoincidentNodes (std::set<const SMDS_MeshNode*> & theNodes,
+@@ -393,16 +318,6 @@
+    */
+   SMESH_NodeSearcher* GetNodeSearcher();
+ 
+-  /*!
+-   * \brief Return SMESH_ElementSearcher
+-   */
+-  SMESH_ElementSearcher* GetElementSearcher();
+-  /*!
+-   * \brief Return true if the point is IN or ON of the element
+-   */
+-  static bool isOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
+-
+-
+   int SimplifyFace (const std::vector<const SMDS_MeshNode *> faceNodes,
+                     std::vector<const SMDS_MeshNode *>&      poly_nodes,
+                     std::vector<int>&                        quantities) const;
+@@ -416,7 +331,7 @@
+   typedef std::list< std::list< int > > TListOfListOfElementsID;
+ 
+   void FindEqualElements(std::set<const SMDS_MeshElement*> & theElements,
+-                         TListOfListOfElementsID &           theGroupsOfElementsID);
++			 TListOfListOfElementsID &           theGroupsOfElementsID);
+   // Return list of group of elements build on the same nodes.
+   // Search among theElements or in the whole mesh if theElements is empty.
+ 
+@@ -601,25 +516,10 @@
+   const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
+ 
+   const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
+-
++  
+   bool DoubleNodes( const std::list< int >& theListOfNodes, 
+                     const std::list< int >& theListOfModifiedElems );
+-  
+-  bool DoubleNodes( const TIDSortedElemSet& theElems, 
+-                    const TIDSortedElemSet& theNodesNot,
+-                    const TIDSortedElemSet& theAffectedElems );
+-
+-  bool DoubleNodesInRegion( const TIDSortedElemSet& theElems, 
+-                            const TIDSortedElemSet& theNodesNot,
+-                            const TopoDS_Shape&     theShape );
+-  
+-  /*!
+-   * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+-   * The created 2D mesh elements based on nodes of free faces of boundary volumes
+-   * \return TRUE if operation has been completed successfully, FALSE otherwise
+-   */
+-  bool Make2DMeshFrom3D();
+-  
++
+ private:
+ 
+   /*!
+@@ -683,32 +583,6 @@
+                   TIDSortedElemSet&        elemSet,
+                   const int                nbSteps,
+                   SMESH_SequenceOfElemPtr& srcElements);
+-
+-  /*!
+-   * auxilary for ExtrusionAlongTrack
+-   */
+-  Extrusion_Error MakeEdgePathPoints(std::list<double>& aPrms,
+-                                     const TopoDS_Edge& aTrackEdge,
+-                                     bool FirstIsStart,
+-                                     list<SMESH_MeshEditor_PathPoint>& LPP);
+-  Extrusion_Error MakeExtrElements(TIDSortedElemSet& theElements,
+-                                   list<SMESH_MeshEditor_PathPoint>& fullList,
+-                                   const bool theHasAngles,
+-                                   list<double>& theAngles,
+-                                   const bool theLinearVariation,
+-                                   const bool theHasRefPoint,
+-                                   const gp_Pnt& theRefPoint,
+-                                   const bool theMakeGroups);
+-  void LinearAngleVariation(const int NbSteps,
+-                            list<double>& theAngles);
+-
+-  bool doubleNodes( SMESHDS_Mesh*     theMeshDS,
+-                    const TIDSortedElemSet& theElems,
+-                    const TIDSortedElemSet& theNodesNot,
+-                    std::map< const SMDS_MeshNode*,
+-                    const SMDS_MeshNode* >& theNodeNodeMap,
+-                    const bool theIsDoubleElem );
+-
+ private:
+ 
+   SMESH_Mesh * myMesh;
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_MesherHelper.hxx salomesmesh/inc/SMESH_MesherHelper.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_MesherHelper.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_MesherHelper.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -32,15 +32,15 @@
+ #include <SMDS_MeshNode.hxx>
+ #include <SMDS_QuadraticEdge.hxx>
+ 
+-#include <Geom_Surface.hxx>
+ #include <TopoDS_Face.hxx>
+ #include <TopoDS_Shape.hxx>
+ #include <gp_Pnt2d.hxx>
+ 
+ #include <map>
+ 
+-typedef std::map<SMESH_TLink, const SMDS_MeshNode*>           TLinkNodeMap;
+-typedef std::map<SMESH_TLink, const SMDS_MeshNode*>::iterator ItTLinkNode;
++typedef std::pair<const SMDS_MeshNode*, const SMDS_MeshNode*> NLink;
++typedef std::map<NLink, const SMDS_MeshNode*>                 NLinkNodeMap;
++typedef std::map<NLink, const SMDS_MeshNode*>::iterator       ItNLinkNode;
+ 
+ /*!
+  * \brief It helps meshers to add elements
+@@ -91,8 +91,9 @@
+    * \param meshDS - mesh DS
+    * \retval TopoDS_Shape - found support shape
+    */
+-  static TopoDS_Shape GetSubShapeByNode(const SMDS_MeshNode* node,
+-                                        SMESHDS_Mesh*        meshDS);
++  static const TopoDS_Shape& GetSubShapeByNode(const SMDS_MeshNode* node,
++                                               SMESHDS_Mesh*        meshDS)
++  { return meshDS->IndexToShape( node->GetPosition()->GetShapeId() ); }
+ 
+   /*!
+    * \brief Return a valid node index, fixing the given one if necessary
+@@ -125,7 +126,7 @@
+     
+   /*!
+    * Check submesh for given shape: if all elements on this shape are quadratic,
+-   * quadratic elements will be created. Also fill myTLinkNodeMap
++   * quadratic elements will be created. Also fill myNLinkNodeMap
+    */
+   bool IsQuadraticSubMesh(const TopoDS_Shape& theShape);
+   /*!
+@@ -139,12 +140,6 @@
+   bool GetIsQuadratic() const { return myCreateQuadratic; }
+ 
+   /*!
+-   * \brief Move medium nodes of faces and volumes to fix distorted elements
+-   * \param volumeOnly - fix nodes on geom faces or not if the shape is solid
+-   */
+-  void FixQuadraticElements(bool volumeOnly=true);
+-
+-  /*!
+    * \brief To set created elements on the shape set by IsQuadraticSubMesh()
+    *        or the next methods. By defaul elements are set on the shape if
+    *        a mesh has no shape to be meshed
+@@ -184,7 +179,7 @@
+                          const SMDS_MeshNode* n2,
+                          const SMDS_MeshNode* n3,
+                          const int id=0, 
+-                         const bool force3d = false);
++			 const bool force3d = false);
+   /*!
+    * Creates quadratic or linear quadrangle
+    */
+@@ -193,7 +188,7 @@
+                          const SMDS_MeshNode* n3,
+                          const SMDS_MeshNode* n4,
+                          const int id = 0,
+-                         const bool force3d = false);
++			 const bool force3d = false);
+   /*!
+    * Creates quadratic or linear tetraahedron
+    */
+@@ -202,7 +197,7 @@
+                              const SMDS_MeshNode* n3,
+                              const SMDS_MeshNode* n4,
+                              const int id = 0,
+-                             const bool force3d = true);
++			     const bool force3d = true);
+   /*!
+    * Creates quadratic or linear pyramid
+    */
+@@ -212,7 +207,7 @@
+                              const SMDS_MeshNode* n4,
+                              const SMDS_MeshNode* n5,
+                              const int id = 0,
+-                             const bool force3d = true);
++			     const bool force3d = true);
+   /*!
+    * Creates quadratic or linear pentahedron
+    */
+@@ -223,7 +218,7 @@
+                              const SMDS_MeshNode* n5,
+                              const SMDS_MeshNode* n6,
+                              const int id = 0, 
+-                             const bool force3d = true);
++			     const bool force3d = true);
+   /*!
+    * Creates quadratic or linear hexahedron
+    */
+@@ -236,35 +231,19 @@
+                              const SMDS_MeshNode* n7,
+                              const SMDS_MeshNode* n8,
+                              const int id = 0, 
+-                             bool force3d = true);
++			     bool force3d = true);
+   /*!
+    * \brief Return U of the given node on the edge
+    */
+   double GetNodeU(const TopoDS_Edge&   theEdge,
+-                  const SMDS_MeshNode* theNode,
+-                  bool*                check=0);
++                  const SMDS_MeshNode* theNode);
+   /*!
+    * \brief Return node UV on face
+-   *  \param inFaceNode - a node of element being created located inside a face
++    * \param inFaceNode - a node of element being created located inside a face
+    */
+   gp_XY GetNodeUV(const TopoDS_Face&   F,
+                   const SMDS_MeshNode* n,
+-                  const SMDS_MeshNode* inFaceNode=0,
+-                  bool*                check=0) const;
+-  /*!
+-   * \brief Check and fix node UV on a face
+-   *  \retval bool - false if UV is bad and could not be fixed
+-   */
+-  bool CheckNodeUV(const TopoDS_Face&   F,
+-                   const SMDS_MeshNode* n,
+-                   gp_XY&               uv,
+-                   const double         tol) const;
+-  /*!
+-   * \brief Return middle UV taking in account surface period
+-   */
+-  static gp_XY GetMiddleUV(const Handle(Geom_Surface)& surface,
+-                           const gp_XY&                uv1,
+-                           const gp_XY&                uv2);
++                  const SMDS_MeshNode* inFaceNode=0) const;
+   /*!
+    * \brief Check if inFaceNode argument is necessary for call GetNodeUV(F,..)
+     * \retval bool - return true if the face is periodic
+@@ -338,21 +317,21 @@
+                                      const SMDS_MeshNode* n2,
+                                      const bool force3d);
+   /*!
+-   * Auxilary function for filling myTLinkNodeMap
++   * Auxilary function for filling myNLinkNodeMap
+    */
+-  void AddTLinkNode(const SMDS_MeshNode* n1,
++  void AddNLinkNode(const SMDS_MeshNode* n1,
+                     const SMDS_MeshNode* n2,
+                     const SMDS_MeshNode* n12);
+   /**
+-   * Auxilary function for filling myTLinkNodeMap
++   * Auxilary function for filling myNLinkNodeMap
+    */
+-  void AddTLinkNodeMap(const TLinkNodeMap& aMap)
+-    { myTLinkNodeMap.insert(aMap.begin(), aMap.end()); }
++  void AddNLinkNodeMap(const NLinkNodeMap& aMap)
++    { myNLinkNodeMap.insert(aMap.begin(), aMap.end()); }
+ 
+   /**
+-   * Returns myTLinkNodeMap
++   * Returns myNLinkNodeMap
+    */
+-  const TLinkNodeMap& GetTLinkNodeMap() const { return myTLinkNodeMap; }
++  const NLinkNodeMap& GetNLinkNodeMap() const { return myNLinkNodeMap; }
+ 
+   /**
+    * Check mesh without geometry for: if all elements on this shape are quadratic,
+@@ -378,7 +357,7 @@
+   SMESH_MesherHelper (const SMESH_MesherHelper& theOther) {};
+ 
+   // special map for using during creation of quadratic elements
+-  TLinkNodeMap    myTLinkNodeMap;
++  NLinkNodeMap    myNLinkNodeMap;
+ 
+   std::set< int > myDegenShapeIds;
+   std::set< int > mySeamShapeIds;
+@@ -392,7 +371,6 @@
+   // to create quadratic elements
+   bool            myCreateQuadratic;
+   bool            mySetElemOnShape;
+-  std::set< int > myOkNodePosShapes;
+ 
+ };
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Mesh.hxx salomesmesh/inc/SMESH_Mesh.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Mesh.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Mesh.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : SMESH_Mesh.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_Mesh.hxx,v 1.18.2.3 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef _SMESH_MESH_HXX_
+ #define _SMESH_MESH_HXX_
+@@ -35,7 +36,7 @@
+ #include "SMESHDS_Command.hxx"
+ #include "SMDSAbs_ElementType.hxx"
+ 
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <TopoDS_Shape.hxx>
+ #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+@@ -55,10 +56,10 @@
+ {
+ public:
+   SMESH_Mesh(int               theLocalId, 
+-             int               theStudyId, 
+-             SMESH_Gen*        theGen,
+-             bool              theIsEmbeddedMode,
+-             SMESHDS_Document* theDocument);
++	     int               theStudyId, 
++	     SMESH_Gen*        theGen,
++	     bool              theIsEmbeddedMode,
++	     SMESHDS_Document* theDocument);
+   
+   virtual ~SMESH_Mesh();
+   
+@@ -74,7 +75,7 @@
+    * \brief Return true if there is a geometry to be meshed, not PseudoShape()
+    */
+   bool HasShapeToMesh() const { return _isShapeToMesh; }
+-  /*!
++   /*!
+    * \brief Return diagonal size of bounding box of shape to mesh.
+    */
+   double GetShapeDiagonalSize() const;
+@@ -93,7 +94,7 @@
+    */
+   void Clear();
+ 
+-  /*!
++   /*!
+    * \brief Remove all nodes and elements of indicated shape
+    */
+   void ClearSubMesh(const int theShapeId);
+@@ -110,15 +111,15 @@
+ 
+   SMESH_Hypothesis::Hypothesis_Status
+   AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+   
+   SMESH_Hypothesis::Hypothesis_Status
+   RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+   
+   const std::list <const SMESHDS_Hypothesis * >&
+   GetHypothesisList(const TopoDS_Shape & aSubShape) const
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+ 
+   const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape &    aSubShape,
+                                          const SMESH_HypoFilter& aFilter,
+@@ -130,9 +131,9 @@
+                     std::list <const SMESHDS_Hypothesis * >& aHypList,
+                     const bool                               andAncestors) const;
+ 
+-  const std::list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
++  const std::list<SMESHDS_Command*> & GetLog() throw(SMESH_Exception);
+   
+-  void ClearLog() throw(SALOME_Exception);
++  void ClearLog() throw(SMESH_Exception);
+   
+   int GetId()                { return _id; }
+   
+@@ -141,30 +142,30 @@
+   SMESH_Gen *GetGen()        { return _gen; }
+   
+   SMESH_subMesh *GetSubMesh(const TopoDS_Shape & aSubShape)
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+   
+   SMESH_subMesh *GetSubMeshContaining(const TopoDS_Shape & aSubShape) const
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+   
+   SMESH_subMesh *GetSubMeshContaining(const int aShapeID) const
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+   /*!
+    * \brief Return submeshes of groups containing the given subshape
+    */
+   std::list<SMESH_subMesh*> GetGroupSubMeshesContaining(const TopoDS_Shape & shape) const
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+   /*!
+    * \brief Say all submeshes that theChangedHyp has been modified
+    */
+   void NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp);
+ 
+   const std::list < SMESH_subMesh * >&
+-  GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) throw(SALOME_Exception);
++  GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) throw(SMESH_Exception);
+   /*!
+    * \brief Return True if anHyp is used to mesh aSubShape
+    */
+   bool IsUsedHypothesis(SMESHDS_Hypothesis *  anHyp,
+-                        const SMESH_subMesh * aSubMesh);
++			const SMESH_subMesh * aSubMesh);
+   /*!
+    * \brief check if a hypothesis alowing notconform mesh is present
+    */
+@@ -177,9 +178,9 @@
+    */
+   const TopTools_ListOfShape& GetAncestors(const TopoDS_Shape& theSubShape) const;
+ 
+-  void SetAutoColor(bool theAutoColor) throw(SALOME_Exception);
++  void SetAutoColor(bool theAutoColor) throw(SMESH_Exception);
+ 
+-  bool GetAutoColor() throw(SALOME_Exception);
++  bool GetAutoColor() throw(SMESH_Exception);
+ 
+   /*!
+    * \brief Return data map of descendant to ancestor shapes
+@@ -193,48 +194,46 @@
+   bool HasDuplicatedGroupNamesMED();
+ 
+   void ExportMED(const char *file, 
+-                 const char* theMeshName = NULL, 
+-                 bool theAutoGroups = true, 
+-                 int theVersion = 0) 
+-    throw(SALOME_Exception);
++		 const char* theMeshName = NULL, 
++		 bool theAutoGroups = true, 
++		 int theVersion = 0) 
++    throw(SMESH_Exception);
+ 
+-  void ExportDAT(const char *file) throw(SALOME_Exception);
+-  void ExportUNV(const char *file) throw(SALOME_Exception);
+-  void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception);
+-  
+-  int NbNodes() throw(SALOME_Exception);
++  void ExportDAT(const char *file) throw(SMESH_Exception);
++  void ExportUNV(const char *file) throw(SMESH_Exception);
++  void ExportSTL(const char *file, const bool isascii) throw(SMESH_Exception);
+   
+-  int Nb0DElements() throw(SALOME_Exception);
++  int NbNodes() throw(SMESH_Exception);
+   
+-  int NbEdges(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbEdges(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+   
+-  int NbFaces(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbFaces(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+   
+-  int NbTriangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbTriangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+   
+-  int NbQuadrangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbQuadrangles(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+ 
+-  int NbPolygons() throw(SALOME_Exception);
++  int NbPolygons() throw(SMESH_Exception);
+   
+-  int NbVolumes(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbVolumes(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+   
+-  int NbTetras(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbTetras(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+   
+-  int NbHexas(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbHexas(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+   
+-  int NbPyramids(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbPyramids(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+ 
+-  int NbPrisms(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
++  int NbPrisms(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SMESH_Exception);
+   
+-  int NbPolyhedrons() throw(SALOME_Exception);
++  int NbPolyhedrons() throw(SMESH_Exception);
+   
+-  int NbSubMesh() throw(SALOME_Exception);
++  int NbSubMesh() throw(SMESH_Exception);
+   
+   int NbGroup() const { return _mapGroup.size(); }
+   
+   SMESH_Group* AddGroup (const SMDSAbs_ElementType theType,
+-                         const char*               theName,
+-                         int&                      theId,
++			 const char*               theName,
++			 int&                      theId,
+                          const TopoDS_Shape&       theShape=TopoDS_Shape());
+   
+   typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
+@@ -273,7 +272,7 @@
+   bool                       _isAutoColor;
+ 
+   double                     _shapeDiagonal; //!< diagonal size of bounding box of shape to mesh
+-  
++
+   TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
+ 
+ protected:
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Octree.hxx salomesmesh/inc/SMESH_Octree.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Octree.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Octree.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -20,12 +20,11 @@
+ //  See http://www.salome-platform.org/ or email : webmaster.salome at opencascade.com
+ //
+ //  SMESH SMESH_Octree : global Octree implementation
++// File      : SMESH_Octree.hxx
++// Created   : Tue Jan 16 16:00:00 2007
++// Author    : Nicolas Geimer & Aurélien Motteux (OCC)
++// Module    : SMESH
+ //
+-//  File      : SMESH_Octree.hxx
+-//  Created   : Tue Jan 16 16:00:00 2007
+-//  Author    : Nicolas Geimer & Aurélien Motteux (OCC)
+-//  Module    : SMESH
+-
+ #ifndef _SMESH_OCTREE_HXX_
+ #define _SMESH_OCTREE_HXX_
+ 
+@@ -34,90 +33,67 @@
+ class SMESH_Octree {
+ 
+ public:
+-
+-  // Data limiting the tree height
+-  struct Limit {
+-    // MaxLevel of the Octree
+-    int    myMaxLevel;
+-    // Minimal size of the Box
+-    double myMinBoxSize;
+-
+-    // Default:
+-    // maxLevel-> 8^8 = 16777216 terminal trees
+-    // minSize -> box size not checked
+-    Limit(int maxLevel=8, double minSize=0.):myMaxLevel(maxLevel),myMinBoxSize(minSize) {}
+-    virtual ~Limit() {} // it can be inherited
+-  };
+-
+-  // Constructor. limit must be provided at tree root construction.
+-  // limit will be deleted by SMESH_Octree
+-  SMESH_Octree (Limit* limit=0);
++  // Constructor
++  SMESH_Octree (const int maxLevel = -1, const double minBoxSize = 0.);
+ 
+   // Destructor
+   virtual ~SMESH_Octree ();
+ 
+-  // Compute the Octree. Must be called by constructor of inheriting class
+-  void                   compute();
++  // Tell if Octree is a leaf or not (has to be implemented in inherited classes)
++  virtual const bool     isLeaf() = 0;
+ 
+-  // Tell if Octree is a leaf or not.
+-  // An inheriting class can influence it via myIsLeaf protected field
+-  bool                   isLeaf() const;
++  // Compute the Octree
++  void                   Compute();
+ 
+-  // Return its level
+-  int                    level() const { return myLevel; }
++  // Set the maximal level of the Octree
++  void                   setMaxLevel(const int maxLevel);
+ 
+-  // Get box to the 3d Bounding Box of the Octree
+-  const Bnd_B3d&         getBox() const { return *myBox; }
++  // Set the minimal size of the Box
++  void                   setMinBoxSize(const double minBoxSize){myMinBoxSize = minBoxSize;};
+ 
+-  // Compute the bigger dimension of my box
+-  double                 maxSize() const;
++  // Set the bounding box of the Octree
++  void                   setBox(const Bnd_B3d* box);
+ 
+-  // Return index of a child the given point is in
+-  inline int             getChildIndex(double x, double y, double z, const gp_XYZ& boxMiddle)const;
++  // Set box to the 3d Bounding Box of the Octree
++  void                   getBox(Bnd_B3d & box);
++
++  // Compute the bigger dimension of the box
++  static double          maxSize(const Bnd_B3d* box);
++
++  // Return its level
++  int                    level() const { return myLevel; }
+ 
+ protected:
+-  // Return box of the whole tree
+-  virtual Bnd_B3d*       buildRootBox() = 0;
++  // Constructor for children (has to be implemented in inherited classes)
++  virtual SMESH_Octree* allocateOctreeChild() = 0;
+ 
+-  // Constructor for children
+-  virtual SMESH_Octree*  allocateOctreeChild() const = 0;
++  // Build the 8 children boxes
++  void buildChildren();
+ 
+-  // Build the data in the 8 children
+-  virtual void           buildChildrenData() = 0;
++  // Build the data in the 8 children (has to be implemented in inherited classes)
++  virtual void buildChildrenData() = 0;
+ 
+   // members
+ 
++  // Box of the Octree
++  Bnd_B3d*       myBox;
++
+   // Array of 8 Octree children
+   SMESH_Octree** myChildren;
+ 
+   // Point the father, set to NULL for the level 0
+   SMESH_Octree*  myFather;
+ 
+-  // Tell us if the Octree is a leaf or not
+-  bool           myIsLeaf;
+-
+-  // Tree limit
+-  const Limit*   myLimit;
+-
+-private:
+-  // Build the 8 children boxes recursively
+-  void                   buildChildren();
+-
+   // Level of the Octree
+   int            myLevel;
+ 
+-  Bnd_B3d*       myBox;
+-};
++  // MaxLevel of the Octree
++  int            myMaxLevel;
+ 
+-//================================================================================
+-/*!
+- * \brief Return index of a child the given point is in
+- */
+-//================================================================================
+-
+-inline int SMESH_Octree::getChildIndex(double x, double y, double z, const gp_XYZ& mid) const
+-{
+-  return (x > mid.X()) + ( y > mid.Y())*2 + (z > mid.Z())*4;
+-}
++  // Minimal size of the Box
++  double         myMinBoxSize;
+ 
++  // Tell us if the Octree is a leaf or not (-1 if not initialized)
++  int            myIsLeaf;
++};
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_OctreeNode.hxx salomesmesh/inc/SMESH_OctreeNode.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_OctreeNode.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_OctreeNode.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -34,7 +34,6 @@
+ 
+ #include <list>
+ #include <set>
+-#include <map>
+ 
+ #include "SMDS_ElemIterator.hxx"
+ 
+@@ -45,7 +44,7 @@
+ typedef SMDS_Iterator<SMESH_OctreeNode*>            SMESH_OctreeNodeIterator;
+ typedef boost::shared_ptr<SMESH_OctreeNodeIterator> SMESH_OctreeNodeIteratorPtr;
+ 
+-class SMESH_OctreeNode : public SMESH_Octree {
++class SMESH_OctreeNode : public SMESH_Octree{
+ 
+ public:
+ 
+@@ -60,6 +59,9 @@
+ //=============================
+   virtual ~SMESH_OctreeNode () {};
+ 
++  // Tells us if SMESH_OctreeNode is a leaf or not (-1 = not initialiazed)
++  virtual const bool isLeaf();
++
+   // Tells us if Node is inside the current box with the precision "precision"
+   virtual const bool isInside(const SMDS_MeshNode * Node, const double precision = 0.);
+ 
+@@ -68,11 +70,6 @@
+                                  std::list<const SMDS_MeshNode*>* Result,
+                                  const double precision = 0.);
+ 
+-  // Return in dist2Nodes nodes mapped to their square distance from Node
+-  bool               NodesAround(const SMDS_MeshNode *                   Node,
+-                                 std::map<double, const SMDS_MeshNode*>& dist2Nodes,
+-                                 double                                  precision);
+-
+   // Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
+   // Search for all the nodes in nodes
+   void               FindCoincidentNodes ( std::set<const SMDS_MeshNode*>* nodes,
+@@ -81,16 +78,11 @@
+ 
+   // Static method that return in theGroupsOfNodes a list of group of nodes close to each other within
+   // theTolerance search for all the nodes in nodes
+-  static void        FindCoincidentNodes ( std::set<const SMDS_MeshNode*>& nodes,
++  static void        FindCoincidentNodes ( std::set<const SMDS_MeshNode*> nodes,
+                                            std::list< std::list< const SMDS_MeshNode*> >* theGroupsOfNodes,
+-                                           const double theTolerance = 0.00001,
+-                                           const int maxLevel = -1,
++                                           const double theTolerance = 0.00001, const int maxLevel = -1,
+                                            const int maxNbNodes = 5);
+   /*!
+-   * \brief Update data according to node movement
+-   */
+-  void                        UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt );
+-  /*!
+    * \brief Return iterator over children
+    */
+   SMESH_OctreeNodeIteratorPtr GetChildrenIterator();
+@@ -101,20 +93,25 @@
+   /*!
+    * \brief Return nb nodes in a tree
+    */
+-  int                         NbNodes() const { return myNodes.size(); }
++  int                         NbNodes() const { return myNbNodes; }
+ 
+ protected:
+ 
+-  SMESH_OctreeNode (int maxNbNodes );
+-
+-  // Compute the bounding box of the whole set of nodes myNodes
+-  virtual Bnd_B3d*      buildRootBox();
++//=============================
++/*!
++ * \brief Empty constructor
++ */
++//=============================
++  SMESH_OctreeNode (){};
+ 
+   // Shares the father's data with each of his child
+   virtual void          buildChildrenData();
+ 
++  // Compute the bounding box of the whole set of nodes myNodes (only used for OctreeNode level 0)
++  void                  computeBoxForFather();
++
+   // Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren()
+-  virtual SMESH_Octree* allocateOctreeChild() const;
++  virtual SMESH_Octree* allocateOctreeChild();
+ 
+   // Return in result a list of nodes closed to Node and remove it from SetOfNodes
+   void                  FindCoincidentNodes( const SMDS_MeshNode * Node,
+@@ -123,11 +120,13 @@
+                                              const double precision);
+ 
+   // The max number of nodes a leaf box can contain
+-  int                              myMaxNbNodes;
++  int                         myMaxNbNodes;
+ 
+   // The set of nodes inside the box of the Octree (Empty if Octree is not a leaf)
+   std::set<const SMDS_MeshNode*>   myNodes;
+ 
++  // The number of nodes I have inside the box
++  int                         myNbNodes;
+ };
+ 
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_Pattern.hxx salomesmesh/inc/SMESH_Pattern.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_Pattern.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_Pattern.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -299,7 +299,7 @@
+                           const TListOfEdgesList::iterator& theFromWire,
+                           const TListOfEdgesList::iterator& theToWire,
+                           const int                         theFirstEdgeID,
+-                          std::list< std::list< TPoint* > >&          theEdgesPointsList );
++                          std::list< std::list< TPoint* > >& theEdgesPointsList );
+   // sort wires in theWireList from theFromWire until theToWire,
+   // the wires are set in the order to correspond to the order
+   // of boundaries; after sorting, edges in the wires are put
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_SMESH.hxx salomesmesh/inc/SMESH_SMESH.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_SMESH.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_SMESH.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -27,7 +27,7 @@
+ #define _SMESH_SMESH_HXX_
+ 
+ #ifdef WNT
+- #if defined SMESHimpl_EXPORTS
++ #if defined SMESH_EXPORTS
+   #define SMESH_EXPORT __declspec( dllexport )
+  #else
+   #define SMESH_EXPORT __declspec( dllimport )
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_StdMeshers.hxx salomesmesh/inc/SMESH_StdMeshers.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_StdMeshers.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_StdMeshers.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -28,7 +28,7 @@
+ #define _SMESH_StdMeshers_HXX_
+ 
+ #ifdef WNT
+- #if defined STDMESHERS_EXPORTS || defined StdMeshers_EXPORTS
++ #if defined STDMESHERS_EXPORTS
+   #define STDMESHERS_EXPORT __declspec( dllexport )
+  #else
+   #define STDMESHERS_EXPORT __declspec( dllimport )
+diff -Naur smesh-5.1.2.2.svn55/inc/SMESH_subMesh.hxx salomesmesh/inc/SMESH_subMesh.hxx
+--- smesh-5.1.2.2.svn55/inc/SMESH_subMesh.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/SMESH_subMesh.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : SMESH_subMesh.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESH/SMESH_subMesh.hxx,v 1.12.2.3 2008/11/27 12:25:15 abd Exp $
+ //
+ #ifndef _SMESH_SUBMESH_HXX_
+ #define _SMESH_SUBMESH_HXX_
+@@ -33,9 +34,8 @@
+ #include "SMESHDS_SubMesh.hxx"
+ #include "SMESH_Hypothesis.hxx"
+ #include "SMESH_ComputeError.hxx"
+-#include "SMESH_Algo.hxx"
+ 
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <TopoDS_Shape.hxx>
+ 
+@@ -47,7 +47,7 @@
+ class SMESH_Algo;
+ class SMESH_Gen;
+ class SMESH_subMeshEventListener;
+-struct SMESH_subMeshEventListenerData;
++class SMESH_subMeshEventListenerData;
+ class SMESH_subMesh;
+ 
+ typedef SMESH_subMeshEventListener     EventListener;
+@@ -60,7 +60,7 @@
+ {
+  public:
+   SMESH_subMesh(int Id, SMESH_Mesh * father, SMESHDS_Mesh * meshDS,
+-                const TopoDS_Shape & aSubShape);
++		const TopoDS_Shape & aSubShape);
+   virtual ~ SMESH_subMesh();
+ 
+   int GetId() const;
+@@ -192,8 +192,6 @@
+ 
+   bool ComputeStateEngine(int event);
+ 
+-  bool Evaluate(MapShapeNbElems& aResMap);
+-
+   bool IsConform(const SMESH_Algo* theAlgo);
+   // check if a conform mesh will be produced by the Algo
+ 
+@@ -225,9 +223,10 @@
+    *        none mesh entity is bound to it
+    */
+   void SetIsAlwaysComputed(bool isAlCo);
++  
+   bool IsAlwaysComputed() { return _alwaysComputed; }
+ 
+-
++  
+ protected:
+   // ==================================================================
+   void InsertDependence(const TopoDS_Shape aSubShape);
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Arithmetic1D.hxx salomesmesh/inc/StdMeshers_Arithmetic1D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Arithmetic1D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Arithmetic1D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,18 +23,15 @@
+ //  File   : StdMeshers_Arithmetic1D.hxx
+ //  Author : Damien COQUERET, OCC
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Arithmetic1D.hxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #ifndef _SMESH_ARITHMETIC1D_HXX_
+ #define _SMESH_ARITHMETIC1D_HXX_
+ 
+-
+-
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
+-
+-#include <vector>
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_Arithmetic1D:
+   public SMESH_Hypothesis
+@@ -43,18 +40,10 @@
+   StdMeshers_Arithmetic1D(int hypId, int studyId, SMESH_Gen* gen);
+   virtual ~StdMeshers_Arithmetic1D();
+ 
+-  void SetLength(double length, bool isStartLength) throw(SALOME_Exception);
++  void SetLength(double length, bool isStartLength) throw(SMESH_Exception);
+ 
+   double GetLength(bool isStartLength) const;
+ 
+-  void SetReversedEdges( std::vector<int>& ids);
+-
+-  void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+-
+-  const char* GetObjectEntry() { return _objEntry.c_str(); }
+-
+-  const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
+-
+   virtual std::ostream & SaveTo(std::ostream & save);
+   virtual std::istream & LoadFrom(std::istream & load);
+   friend std::ostream& operator << (std::ostream & save, StdMeshers_Arithmetic1D & hyp);
+@@ -68,7 +57,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+@@ -76,8 +65,6 @@
+ 
+ protected:
+   double _begLength, _endLength;
+-  std::vector<int>   _edgeIDs;
+-  std::string        _objEntry;
+ };
+ 
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_AutomaticLength.hxx salomesmesh/inc/StdMeshers_AutomaticLength.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_AutomaticLength.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_AutomaticLength.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,14 +23,15 @@
+ //  File   : StdMeshers_AutomaticLength.hxx
+ //  Author : Edward AGAPOV, OCC
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_AutomaticLength.hxx,v 1.5.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #ifndef _SMESH_AutomaticLength_HXX_
+ #define _SMESH_AutomaticLength_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <map>
+ 
+@@ -55,13 +56,13 @@
+    * \brief Computes segment for a given edge
+    */
+   double GetLength(const SMESH_Mesh* aMesh, const TopoDS_Shape& anEdge)
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+ 
+   /*!
+    * \brief Computes segment length for an edge of given length
+    */
+   double GetLength(const SMESH_Mesh* aMesh, const double edgeLength)
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+ 
+   /*!
+    * \brief Set Fineness
+@@ -74,7 +75,7 @@
+    * is divided by (0.5 + 4.5 x theFineness)
+    */
+   void SetFineness(double theFineness)
+-    throw(SALOME_Exception);
++    throw(SMESH_Exception);
+ 
+   /*!
+    * \brief Return mesh Fineness
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_CompositeHexa_3D.hxx salomesmesh/inc/StdMeshers_CompositeHexa_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_CompositeHexa_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_CompositeHexa_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -50,9 +50,6 @@
+   virtual bool Compute(SMESH_Mesh&         aMesh,
+ 		       const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   virtual bool CheckHypothesis(SMESH_Mesh&         aMesh,
+                                const TopoDS_Shape& aShape,
+                                Hypothesis_Status&  aStatus);
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_CompositeSegment_1D.hxx salomesmesh/inc/StdMeshers_CompositeSegment_1D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_CompositeSegment_1D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_CompositeSegment_1D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,7 +22,7 @@
+ //  SMESH SMESH : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_CompositeSegment_1D.hxx
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_CompositeSegment_1D.hxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #ifndef _SMESH_CompositeSegment_1D_HXX_
+ #define _SMESH_CompositeSegment_1D_HXX_
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Deflection1D.hxx salomesmesh/inc/StdMeshers_Deflection1D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Deflection1D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Deflection1D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,15 +22,15 @@
+ //  SMESH StdMeshers : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_Deflection1D.hxx
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Deflection1D.hxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+-
+ #ifndef _StdMeshers_Deflection1D_HXX_
+ #define _StdMeshers_Deflection1D_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_Deflection1D:public SMESH_Hypothesis
+ {
+@@ -38,7 +38,7 @@
+   StdMeshers_Deflection1D(int hypId, int studyId, SMESH_Gen * gen);
+   virtual ~ StdMeshers_Deflection1D();
+ 
+-  void SetDeflection(double value) throw(SALOME_Exception);
++  void SetDeflection(double value) throw(SMESH_Exception);
+ 
+   double GetDeflection() const;
+   
+@@ -55,13 +55,13 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+ 
+-protected:
++ protected:
+   double _value;
+ };
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Distribution.hxx salomesmesh/inc/StdMeshers_Distribution.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Distribution.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Distribution.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,7 +23,7 @@
+ //  File   : StdMeshers_Distribution.hxx
+ //  Author : Alexandre SOLOVYOV
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Distribution.hxx,v 1.4.2.2 2008/11/27 13:03:49 abd Exp $
+ //
+ #ifndef _STD_MESHERS_DISTRIBUTION_HXX_
+ #define _STD_MESHERS_DISTRIBUTION_HXX_
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_FaceSide.hxx salomesmesh/inc/StdMeshers_FaceSide.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_FaceSide.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_FaceSide.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -93,12 +93,7 @@
+                       SMESH_Mesh*        theMesh,
+                       const bool         theIsForward,
+                       const bool         theIgnoreMediumNodes);
+-  /*!
+-   * \brief Wrap for vertex using data from other FaceSide
+-   */
+-  StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
+-                      const gp_Pnt2d thePnt2d,
+-                      const StdMeshers_FaceSide* theSide);
++
+   /*!
+    * \brief Return wires of a face as StdMeshers_FaceSide's
+    */
+@@ -207,7 +202,6 @@
+   int                               myNbPonits, myNbSegments;
+   SMESH_Mesh*                       myMesh;
+   bool                              myMissingVertexNodes, myIgnoreMediumNodes;
+-  gp_Pnt2d                          myDefaultPnt2d;
+ };
+ 
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_FixedPoints1D.hxx salomesmesh/inc/StdMeshers_FixedPoints1D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_FixedPoints1D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_FixedPoints1D.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,90 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : implementaion of SMESH idl descriptions
+-//  File   : StdMeshers_FixedPoints1D.hxx
+-//  Author : Damien COQUERET, OCC
+-//  Module : SMESH
+-//
+-#ifndef _SMESH_FIXEDPOINTS1D_HXX_
+-#define _SMESH_FIXEDPOINTS1D_HXX_
+-
+-
+-
+-#include "SMESH_StdMeshers.hxx"
+-
+-#include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
+-
+-#include <vector>
+-
+-class STDMESHERS_EXPORT StdMeshers_FixedPoints1D:
+-  public SMESH_Hypothesis
+-{
+-public:
+-  StdMeshers_FixedPoints1D(int hypId, int studyId, SMESH_Gen* gen);
+-  virtual ~StdMeshers_FixedPoints1D();
+-
+-  void SetPoints(std::vector<double>& listParams)
+-    throw(SALOME_Exception);
+-
+-  void SetNbSegments(std::vector<int>& listNbSeg) 
+-    throw(SALOME_Exception);
+-
+-  const std::vector<double>& GetPoints() const { return _params; }
+-
+-  const std::vector<int>& GetNbSegments() const { return _nbsegs; }
+-
+-  void SetReversedEdges( std::vector<int>& ids);
+-
+-  void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+-
+-  const char* GetObjectEntry() { return _objEntry.c_str(); }
+-
+-  const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
+-
+-  virtual std::ostream & SaveTo(std::ostream & save);
+-  virtual std::istream & LoadFrom(std::istream & load);
+-  friend std::ostream& operator << (std::ostream & save, StdMeshers_FixedPoints1D & hyp);
+-  friend std::istream& operator >> (std::istream & load, StdMeshers_FixedPoints1D & hyp);
+-
+-  /*!
+-   * \brief Initialize start and end length by the mesh built on the geometry
+-    * \param theMesh - the built mesh
+-    * \param theShape - the geometry of interest
+-    * \retval bool - true if parameter values have been successfully defined
+-   */
+-  virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+-
+-  /*!
+-   * \brief Initialize my parameter values by default parameters.
+-   *  \retval bool - true if parameter values have been successfully defined
+-   */
+-  virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+-
+-protected:
+-  std::vector<double> _params;
+-  std::vector<int>    _nbsegs;
+-  std::vector<int>    _edgeIDs;
+-  std::string         _objEntry;
+-};
+-
+-#endif
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Hexa_3D.hxx salomesmesh/inc/StdMeshers_Hexa_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Hexa_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Hexa_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -33,7 +33,7 @@
+ #include "SMESH_3D_Algo.hxx"
+ #include "SMESH_Mesh.hxx"
+ #include "StdMeshers_Quadrangle_2D.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include "SMESH_MesherHelper.hxx"
+ 
+@@ -75,10 +75,7 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh,
+ 		       const TopoDS_Shape& aShape)
+-    /*throw (SALOME_Exception)*/;
+-
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
++    /*throw (SMESH_Exception)*/;
+ 
+   static TopoDS_Vertex OppositeVertex(const TopoDS_Vertex& aVertex,
+                                       const TopTools_IndexedMapOfShape& aQuads0Vertices,
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_LayerDistribution2D.hxx salomesmesh/inc/StdMeshers_LayerDistribution2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_LayerDistribution2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_LayerDistribution2D.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,55 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : idl implementation based on 'SMESH' unit's calsses
+-//  File   : StdMeshers_LayerDistribution2D.hxx
+-//  Author : Edward AGAPOV
+-//  Module : SMESH
+-//
+-#ifndef _SMESH_LayerDistribution2D_HXX_
+-#define _SMESH_LayerDistribution2D_HXX_
+-
+-#include "StdMeshers_LayerDistribution.hxx"
+-
+-
+-// =========================================================
+-// =========================================================
+-/*!
+- * This hypothesis is used by "Radial quadrangle" algorithm.
+- * It specifies 1D hypothesis defining distribution of segments
+- * between the internal and the external surfaces.
+- */
+-// =========================================================
+-// =========================================================
+-
+-class STDMESHERS_EXPORT StdMeshers_LayerDistribution2D
+-                        :public StdMeshers_LayerDistribution
+-{
+-public:
+-  // Constructor
+-  StdMeshers_LayerDistribution2D(int hypId, int studyId, SMESH_Gen* gen);
+-  // Destructor
+-  virtual ~StdMeshers_LayerDistribution2D();
+-
+-};
+-
+-#endif
+-
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_LayerDistribution.hxx salomesmesh/inc/StdMeshers_LayerDistribution.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_LayerDistribution.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_LayerDistribution.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_LayerDistribution.hxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LayerDistribution.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #ifndef _SMESH_LayerDistribution_HXX_
+ #define _SMESH_LayerDistribution_HXX_
+@@ -30,7 +31,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <string>
+ 
+@@ -59,7 +60,7 @@
+     * \param hyp1D - 1D hypothesis
+    */
+   void SetLayerDistribution(SMESH_Hypothesis* hyp1D)
+-    throw ( SALOME_Exception );
++    throw ( SMESH_Exception );
+ 
+   /*!
+    * \brief Returns 1D hypothesis specifying distribution of layers
+@@ -82,7 +83,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_LengthFromEdges.hxx salomesmesh/inc/StdMeshers_LengthFromEdges.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_LengthFromEdges.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_LengthFromEdges.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,15 +24,15 @@
+ //           Moved here from SMESH_LengthFromEdges.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LengthFromEdges.hxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+-
+ #ifndef _SMESH_LENGTHFROMEDGES_HXX_
+ #define _SMESH_LENGTHFROMEDGES_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_LengthFromEdges:
+   public SMESH_Hypothesis
+@@ -42,7 +42,7 @@
+   virtual ~StdMeshers_LengthFromEdges();
+ 
+   void SetMode(int mode)
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   int GetMode();
+ 
+@@ -61,7 +61,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_LocalLength.hxx salomesmesh/inc/StdMeshers_LocalLength.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_LocalLength.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_LocalLength.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,15 +24,15 @@
+ //           Moved here from SMESH_LocalLength.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_LocalLength.hxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+-
+ #ifndef _SMESH_LOCALLENGTH_HXX_
+ #define _SMESH_LOCALLENGTH_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_LocalLength: public SMESH_Hypothesis
+ {
+@@ -40,8 +40,8 @@
+   StdMeshers_LocalLength(int hypId, int studyId, SMESH_Gen * gen);
+   virtual ~ StdMeshers_LocalLength();
+ 
+-  void SetLength(double length) throw(SALOME_Exception);
+-  void SetPrecision(double precision) throw(SALOME_Exception);
++  void SetLength(double length) throw(SMESH_Exception);
++  void SetPrecision(double precision) throw(SMESH_Exception);
+ 
+   double GetLength() const;
+   double GetPrecision() const;
+@@ -59,7 +59,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_MaxElementArea.hxx salomesmesh/inc/StdMeshers_MaxElementArea.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_MaxElementArea.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_MaxElementArea.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,7 @@
+ //           Moved here from SMESH_MaxElementArea.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementArea.hxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #ifndef _SMESH_MAXELEMENTAREA_HXX_
+ #define _SMESH_MAXELEMENTAREA_HXX_
+@@ -31,7 +32,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_MaxElementArea:public SMESH_Hypothesis
+ {
+@@ -39,7 +40,7 @@
+   StdMeshers_MaxElementArea(int hypId, int studyId, SMESH_Gen * gen);
+   virtual ~ StdMeshers_MaxElementArea();
+ 
+-  void SetMaxArea(double maxArea) throw(SALOME_Exception);
++  void SetMaxArea(double maxArea) throw(SMESH_Exception);
+ 
+   double GetMaxArea() const;
+ 
+@@ -56,7 +57,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_MaxElementVolume.hxx salomesmesh/inc/StdMeshers_MaxElementVolume.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_MaxElementVolume.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_MaxElementVolume.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,14 +24,15 @@
+ //           Moved here from SMESH_MaxElementVolume.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MaxElementVolume.hxx,v 1.8.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #ifndef _SMESH_MAXELEMENTVOLUME_HXX_
+ #define _SMESH_MAXELEMENTVOLUME_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_MaxElementVolume:
+   public SMESH_Hypothesis
+@@ -41,7 +42,7 @@
+   virtual ~StdMeshers_MaxElementVolume();
+ 
+   void SetMaxVolume(double maxVolume)
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   double GetMaxVolume() const;
+ 
+@@ -58,7 +59,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_MaxLength.hxx salomesmesh/inc/StdMeshers_MaxLength.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_MaxLength.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_MaxLength.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -28,7 +28,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_MaxLength: public SMESH_Hypothesis
+ {
+@@ -36,7 +36,7 @@
+   StdMeshers_MaxLength(int hypId, int studyId, SMESH_Gen * gen);
+   virtual ~ StdMeshers_MaxLength();
+ 
+-  void SetLength(double length) throw(SALOME_Exception);
++  void SetLength(double length) throw(SMESH_Exception);
+   double GetLength() const;
+ 
+   bool HavePreestimatedLength() const  { return _preestimated > 0.; }
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_MEFISTO_2D.hxx salomesmesh/inc/StdMeshers_MEFISTO_2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_MEFISTO_2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_MEFISTO_2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ //           Moved here from SMESH_MEFISTO_2D.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_MEFISTO_2D.hxx,v 1.9.2.2 2008/11/27 13:03:49 abd Exp $
+ //
+ #ifndef _StdMeshers_MEFISTO_2D_HXX_
+ #define _StdMeshers_MEFISTO_2D_HXX_
+@@ -57,9 +57,6 @@
+   virtual bool Compute(SMESH_Mesh& aMesh,
+ 		       const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   typedef boost::shared_ptr< StdMeshers_FaceSide> StdMeshers_FaceSidePtr;
+   typedef std::vector< StdMeshers_FaceSidePtr > TWireVector;
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_NotConformAllowed.hxx salomesmesh/inc/StdMeshers_NotConformAllowed.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_NotConformAllowed.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_NotConformAllowed.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_NotConformAllowed.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NotConformAllowed.hxx,v 1.8.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #ifndef _StdMeshers_NotConformAllowed_HXX_
+ #define _StdMeshers_NotConformAllowed_HXX_
+@@ -30,7 +31,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_NotConformAllowed:
+   public SMESH_Hypothesis
+@@ -54,7 +55,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_NumberOfLayers2D.hxx salomesmesh/inc/StdMeshers_NumberOfLayers2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_NumberOfLayers2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_NumberOfLayers2D.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,54 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : idl implementation based on 'SMESH' unit's calsses
+-//  File   : StdMeshers_NumberOfLayers2D.hxx
+-//  Author : Edward AGAPOV
+-//  Module : SMESH
+-//
+-#ifndef _SMESH_NumberOfLayers2D_HXX_
+-#define _SMESH_NumberOfLayers2D_HXX_
+-
+-#include "StdMeshers_NumberOfLayers.hxx"
+-
+-
+-// =========================================================
+-// =========================================================
+-/*!
+- * This hypothesis is used by "Radial quadrangle" algorithm.
+- * It specifies number of segments between the internal 
+- * and the external surfaces.
+- */
+-// =========================================================
+-// =========================================================
+-
+-class STDMESHERS_EXPORT StdMeshers_NumberOfLayers2D
+-                          : public StdMeshers_NumberOfLayers
+-{
+-public:
+-  // Constructor
+-  StdMeshers_NumberOfLayers2D(int hypId, int studyId, SMESH_Gen* gen);
+-  // Destructor
+-  virtual ~StdMeshers_NumberOfLayers2D();
+-};
+-
+-#endif
+-
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_NumberOfLayers.hxx salomesmesh/inc/StdMeshers_NumberOfLayers.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_NumberOfLayers.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_NumberOfLayers.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_NumberOfLayers.hxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfLayers.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #ifndef _SMESH_NumberOfLayers_HXX_
+ #define _SMESH_NumberOfLayers_HXX_
+@@ -30,7 +31,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class SMESH_Gen;
+ 
+@@ -53,7 +54,7 @@
+   virtual ~StdMeshers_NumberOfLayers();
+ 
+   // Sets <number of segments> parameter value
+-  void SetNumberOfLayers(int numberOfLayers) throw ( SALOME_Exception );
++  void SetNumberOfLayers(int numberOfLayers) throw ( SMESH_Exception );
+ 
+   // Returns <number of layers> parameter value
+   int GetNumberOfLayers() const;
+@@ -73,7 +74,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_NumberOfSegments.hxx salomesmesh/inc/StdMeshers_NumberOfSegments.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_NumberOfSegments.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_NumberOfSegments.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,6 +24,7 @@
+ //           Moved here from SMESH_NumberOfSegments.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_NumberOfSegments.hxx,v 1.12.2.1 2008/11/27 13:03:50 abd Exp $
+ //
+ #ifndef _SMESH_NUMBEROFSEGMENTS_HXX_
+ #define _SMESH_NUMBEROFSEGMENTS_HXX_
+@@ -31,7 +32,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ #include <vector>
+ 
+ /*!
+@@ -48,15 +49,15 @@
+   virtual ~StdMeshers_NumberOfSegments();
+ 
+   // Builds point distribution according to passed function
+-  const std::vector<double>& BuildDistributionExpr( const char*, int, int ) throw ( SALOME_Exception );
+-  const std::vector<double>& BuildDistributionTab( const std::vector<double>&, int, int ) throw ( SALOME_Exception );
++  const std::vector<double>& BuildDistributionExpr( const char*, int, int ) throw ( SMESH_Exception );
++  const std::vector<double>& BuildDistributionTab( const std::vector<double>&, int, int ) throw ( SMESH_Exception );
+ 
+   /*!
+    * \brief Set the number of segments
+     * \param segmentsNumber - must be greater than zero
+    */
+   void SetNumberOfSegments(int segmentsNumber)
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Get the number of segments
+@@ -78,7 +79,7 @@
+    * \brief Set distribution type
+    */
+   void SetDistrType(DistrType typ)
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Get distribution type
+@@ -89,19 +90,19 @@
+    * \brief Set scale factor for scale distribution
+    * \param scaleFactor - positive value different from 1
+    * 
+-   * Throws SALOME_Exception if distribution type is not DT_Scale,
++   * Throws SMESH_Exception if distribution type is not DT_Scale,
+    * or scaleFactor is not a positive value different from 1
+    */
+   virtual void SetScaleFactor(double scaleFactor)
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Get scale factor for scale distribution
+    * 
+-   * Throws SALOME_Exception if distribution type is not DT_Scale
++   * Throws SMESH_Exception if distribution type is not DT_Scale
+    */
+   double GetScaleFactor() const
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Set table function for distribution DT_TabFunc
+@@ -110,36 +111,36 @@
+    * must be even. The parameters must be in range [0,1] and sorted in
+    * increase order. The values of function must be positive.
+    * 
+-   * Throws SALOME_Exception if distribution type is not DT_TabFunc
++   * Throws SMESH_Exception if distribution type is not DT_TabFunc
+    */
+   void SetTableFunction(const std::vector<double>& table)
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Get table function for distribution DT_TabFunc
+    * 
+-   * Throws SALOME_Exception if distribution type is not DT_TabFunc
++   * Throws SMESH_Exception if distribution type is not DT_TabFunc
+    */
+   const std::vector<double>& GetTableFunction() const
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Set expression function for distribution DT_ExprFunc
+     * \param expr - string containing the expression of the function
+     *               f(t), e.g. "sin(t)"
+    * 
+-   * Throws SALOME_Exception if distribution type is not DT_ExprFunc
++   * Throws SMESH_Exception if distribution type is not DT_ExprFunc
+    */
+   void SetExpressionFunction( const char* expr)
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Get expression function for distribution DT_ExprFunc
+    * 
+-   * Throws SALOME_Exception if distribution type is not DT_ExprFunc
++   * Throws SMESH_Exception if distribution type is not DT_ExprFunc
+    */
+   const char* GetExpressionFunction() const
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Set conversion mode. When it is 0, it means "exponent mode":
+@@ -148,26 +149,19 @@
+    * F(t), where F(t0)=f(t0), if f(t0)>=0, otherwise F(t0) = 0.
+    * This mode is sensible only when function distribution is used (DT_TabFunc or DT_ExprFunc)
+    * 
+-   * Throws SALOME_Exception if distribution type is not functional
++   * Throws SMESH_Exception if distribution type is not functional
+    */
+   void SetConversionMode( int conv )
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+   /*!
+    * \brief Returns conversion mode
+    * 
+-   * Throws SALOME_Exception if distribution type is not functional
++   * Throws SMESH_Exception if distribution type is not functional
+    */
+   int ConversionMode() const
+-    throw (SALOME_Exception);
++    throw (SMESH_Exception);
+ 
+-  void SetReversedEdges( std::vector<int>& ids);
+-
+-  void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+-
+-  const char* GetObjectEntry() { return _objEntry.c_str(); }
+-
+-  const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
+ 
+   /*!
+    * \brief Initialize number of segments by the mesh built on the geometry
+@@ -177,7 +171,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+@@ -195,8 +189,6 @@
+   std::vector<double> _table, _distr;    //!< the table for DT_TabFunc, a sequence of pairs of numbers
+   std::string         _func;             //!< the expression of the function for DT_ExprFunc
+   int                 _convMode;         //!< flag of conversion mode: 0=exponent, 1=cut negative
+-  std::vector<int>    _edgeIDs;          //!< list of reversed edges ids
+-  std::string         _objEntry;          //!< Entry of the main object to reverse edges
+ };
+ 
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Penta_3D.hxx salomesmesh/inc/StdMeshers_Penta_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Penta_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Penta_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -45,7 +45,6 @@
+ #include "SMESH_Block.hxx"
+ #include "SMESH_ComputeError.hxx"
+ #include "SMESH_MesherHelper.hxx"
+-#include "SMESH_3D_Algo.hxx"
+ 
+ typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
+ 
+@@ -205,9 +204,6 @@
+     // The key of theIJNodes map is a normalized parameter of each
+     // 0-the node on theBaseEdge.
+ 
+-    bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-		  MapShapeNbElems& aResMap);
+-
+ 
+   protected: // methods
+     
+@@ -217,8 +213,8 @@
+ 
+     void MakeNodes();
+ 
+-    double SetHorizEdgeXYZ(const gp_XYZ&                  aBNXYZ,
+-                           const int                      aFaceID,
++    double SetHorizEdgeXYZ(const gp_XYZ&                       aBNXYZ,
++                           const int                           aFaceID,
+                            std::vector<const SMDS_MeshNode*>*& aCol1,
+                            std::vector<const SMDS_MeshNode*>*& aCol2);
+ 
+@@ -266,7 +262,7 @@
+     std::map < int, int >     myConnectingMap;
+     //
+     std::vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
+-    std::vector<gp_XYZ>               myShapeXYZ; // point on each sub-shape
++    std::vector<gp_XYZ>            myShapeXYZ; // point on each sub-shape
+ 
+     bool myCreateQuadratic;
+     SMESH_MesherHelper* myTool; // tool building quadratic elements
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Prism_3D.hxx salomesmesh/inc/StdMeshers_Prism_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Prism_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Prism_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -379,9 +379,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   /*!
+    * \brief Enable removal of quadrangles from the bottom face and
+    * triangles creation there by projection from the top
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Projection_1D.hxx salomesmesh/inc/StdMeshers_Projection_1D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Projection_1D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Projection_1D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -46,9 +46,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   /*!
+    * \brief Sets a default event listener to submesh of the source edge
+    *  \param whenSetToSubMesh - submesh where algo is set
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Projection_2D.hxx salomesmesh/inc/StdMeshers_Projection_2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Projection_2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Projection_2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -44,9 +44,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   /*!
+    * \brief Sets a default event listener to submesh of the source face
+    *  \param whenSetToSubMesh - submesh where algo is set
+@@ -57,7 +54,7 @@
+    * the whenSetToSubMesh submesh.
+    */
+   virtual void SetEventListener(SMESH_subMesh* whenSetToSubMesh);
+-  
++
+ protected:
+ 
+   const StdMeshers_ProjectionSource2D* _sourceHypo;
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Projection_3D.hxx salomesmesh/inc/StdMeshers_Projection_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Projection_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Projection_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -44,9 +44,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   /*!
+    * \brief Sets a default event listener to submesh of the source shape
+    *  \param whenSetToSubMesh - submesh where algo is set
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionSource1D.hxx salomesmesh/inc/StdMeshers_ProjectionSource1D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionSource1D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_ProjectionSource1D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,6 +23,7 @@
+ //  File   : StdMeshers_ProjectionSource1D.hxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource1D.hxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $
+ //
+ #ifndef _SMESH_ProjectionSource1D_HXX_
+ #define _SMESH_ProjectionSource1D_HXX_
+@@ -30,7 +31,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <TopoDS_Vertex.hxx>
+ 
+@@ -56,7 +57,7 @@
+    * Sets source <edge> to take a mesh pattern from
+    */
+   void SetSourceEdge(const TopoDS_Shape& edge)
+-    throw ( SALOME_Exception );
++    throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the source edge or a group containing edges
+@@ -85,7 +86,7 @@
+    */
+   void SetVertexAssociation(const TopoDS_Shape& sourceVertex,
+                             const TopoDS_Shape& targetVertex)
+-    throw ( SALOME_Exception );
++    throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the vertex associated with the target vertex.
+@@ -136,7 +137,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionSource2D.hxx salomesmesh/inc/StdMeshers_ProjectionSource2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionSource2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_ProjectionSource2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,14 +23,15 @@
+ //  File   : StdMeshers_ProjectionSource2D.hxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource2D.hxx,v 1.2.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #ifndef _SMESH_ProjectionSource2D_HXX_
+ #define _SMESH_ProjectionSource2D_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <TopoDS_Vertex.hxx>
+ 
+@@ -56,7 +57,7 @@
+    * Sets a source <face> to take a mesh pattern from
+    */
+   void SetSourceFace(const TopoDS_Shape& face)
+-    throw ( SALOME_Exception );
++    throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the source face or a group containing faces
+@@ -88,21 +89,21 @@
+                             const TopoDS_Shape& sourceVertex2,
+                             const TopoDS_Shape& targetVertex1,
+                             const TopoDS_Shape& targetVertex2)
+-    throw ( SALOME_Exception );
++    throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the <i>-th source vertex associated with the <i>-th target vertex.
+    * Result may be nil if association not set.
+    * Valid indices are 1 and 2
+    */
+-  TopoDS_Vertex GetSourceVertex(int i) const throw ( SALOME_Exception );
++  TopoDS_Vertex GetSourceVertex(int i) const throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the <i>-th target vertex associated with the <i>-th source vertex.
+    * Result may be nil if association not set.
+    * Valid indices are 1 and 2
+    */
+-  TopoDS_Vertex GetTargetVertex(int i) const throw ( SALOME_Exception );
++  TopoDS_Vertex GetTargetVertex(int i) const throw ( SMESH_Exception );
+ 
+   /*!
+    * \brief Test if vertex association defined
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionSource3D.hxx salomesmesh/inc/StdMeshers_ProjectionSource3D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionSource3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_ProjectionSource3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,14 +23,15 @@
+ //  File   : StdMeshers_ProjectionSource3D.hxx
+ //  Author : Edward AGAPOV
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_ProjectionSource3D.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $
++//
+ #ifndef _SMESH_ProjectionSource3D_HXX_
+ #define _SMESH_ProjectionSource3D_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <TopoDS_Vertex.hxx>
+ 
+@@ -56,7 +57,7 @@
+    * Sets a source <shape> to take a mesh pattern from
+    */
+   void SetSource3DShape(const TopoDS_Shape& shape)
+-    throw ( SALOME_Exception );
++    throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the source shape
+@@ -82,19 +83,19 @@
+                             const TopoDS_Shape& sourceVertex2,
+                             const TopoDS_Shape& targetVertex1,
+                             const TopoDS_Shape& targetVertex2)
+-    throw ( SALOME_Exception );
++    throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the <i>-th source vertex associated with the <i>-th target vertex.
+    * Result may be nil if association not set.
+    */
+-  TopoDS_Vertex GetSourceVertex(int i) const throw ( SALOME_Exception );
++  TopoDS_Vertex GetSourceVertex(int i) const throw ( SMESH_Exception );
+ 
+   /*!
+    * Returns the <i>-th target vertex associated with the <i>-th source vertex.
+    * Result may be nil if association not set.
+    */
+-  TopoDS_Vertex GetTargetVertex(int i) const throw ( SALOME_Exception );
++  TopoDS_Vertex GetTargetVertex(int i) const throw ( SMESH_Exception );
+ 
+   /*!
+    * \brief Test if vertex association defined
+@@ -138,7 +139,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionUtils.hxx salomesmesh/inc/StdMeshers_ProjectionUtils.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_ProjectionUtils.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_ProjectionUtils.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -81,10 +81,10 @@
+     * \param edges2 - out list of edges of face 2
+     * \retval int - nb of edges in an outer wire in a success case, else zero
+    */
+-  static int FindFaceAssociation(const TopoDS_Face&         face1,
+-                                 TopoDS_Vertex              VV1[2],
+-                                 const TopoDS_Face&         face2,
+-                                 TopoDS_Vertex              VV2[2],
++  static int FindFaceAssociation(const TopoDS_Face&    face1,
++                                 TopoDS_Vertex         VV1[2],
++                                 const TopoDS_Face&    face2,
++                                 TopoDS_Vertex         VV2[2],
+                                  std::list< TopoDS_Edge > & edges1,
+                                  std::list< TopoDS_Edge > & edges2);
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Propagation.hxx salomesmesh/inc/StdMeshers_Propagation.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Propagation.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Propagation.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -30,7 +30,7 @@
+ 
+ #include "SMESH_Hypothesis.hxx"
+ #include "SMESH_subMeshEventListener.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ #include <TopoDS_Edge.hxx>
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Quadrangle_2D.hxx salomesmesh/inc/StdMeshers_Quadrangle_2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Quadrangle_2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Quadrangle_2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -24,7 +24,7 @@
+ //           Moved here from SMESH_Quadrangle_2D.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-//  $Header$
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_Quadrangle_2D.hxx,v 1.12.2.4 2008/11/27 13:03:50 abd Exp $
+ //
+ #ifndef _SMESH_QUADRANGLE_2D_HXX_
+ #define _SMESH_QUADRANGLE_2D_HXX_
+@@ -32,7 +32,7 @@
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_2D_Algo.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ class SMESH_Mesh;
+ class SMESH_MesherHelper;
+@@ -40,7 +40,6 @@
+ class SMDS_MeshNode;
+ struct uvPtStruct;
+ 
+-
+ enum TSideID { BOTTOM_SIDE=0, RIGHT_SIDE, TOP_SIDE, LEFT_SIDE, NB_SIDES };
+ 
+ typedef uvPtStruct UVPtStruct;
+@@ -65,9 +64,6 @@
+   virtual bool Compute(SMESH_Mesh& aMesh,
+ 		       const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
+ 				    const TopoDS_Shape& aShape,
+                                     const bool CreateQuadratic);
+@@ -77,12 +73,6 @@
+   FaceQuadStruct* CheckNbEdges(SMESH_Mesh& aMesh,
+                                const TopoDS_Shape& aShape);
+ 
+-  bool CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh,
+-			       const TopoDS_Shape & aShape,
+-			       MapShapeNbElems& aResMap,
+-			       std::vector<int>& aNbNodes,
+-                               bool& IsQuadratic);
+-
+   bool SetNormalizedGrid(SMESH_Mesh& aMesh,
+ 			 const TopoDS_Shape& aShape,
+ 			 FaceQuadStruct*& quad);
+@@ -101,12 +91,6 @@
+                        const TopoDS_Shape& aShape,
+                        FaceQuadStruct* quad);
+ 
+-  bool EvaluateQuadPref(SMESH_Mesh& aMesh,
+-			const TopoDS_Shape& aShape,
+-			std::vector<int>& aNbNodes,
+-			MapShapeNbElems& aResMap,
+-                        bool IsQuadratic);
+-
+   UVPtStruct* LoadEdgePoints2(SMESH_Mesh& aMesh,
+ 			      const TopoDS_Face& F, const TopoDS_Edge& E,
+                               bool IsReverse);
+@@ -121,14 +105,12 @@
+ 
+   // true if QuadranglePreference hypothesis is assigned that forces
+   // 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
++  // is not the same in the case where the global number of nodes on edges is even
+   bool myQuadranglePreference;
+ 
+   bool myTrianglePreference;
+ 
+-  int myTriaVertexID;
+-
++  
+   SMESH_MesherHelper* myTool; // tool for working with quadratic elements
+ };
+ 
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_QuadrangleParams.hxx salomesmesh/inc/StdMeshers_QuadrangleParams.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_QuadrangleParams.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_QuadrangleParams.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,80 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : implementaion of SMESH idl descriptions
+-//  File   : StdMeshers_QuadrangleParams.hxx
+-//  Author : Sergey KUUL, OCC
+-//  Module : SMESH
+-//
+-#ifndef _SMESH_QUADRANGLEPARAMS_HXX_
+-#define _SMESH_QUADRANGLEPARAMS_HXX_
+-
+-
+-
+-#include "SMESH_StdMeshers.hxx"
+-
+-#include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
+-
+-class STDMESHERS_EXPORT StdMeshers_QuadrangleParams:
+-  public SMESH_Hypothesis
+-{
+-public:
+-  StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen);
+-  virtual ~StdMeshers_QuadrangleParams();
+-
+-  void SetTriaVertex(int id);
+-
+-  void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+-
+-  const char* GetObjectEntry() { return _objEntry.c_str(); }
+-
+-  int GetTriaVertex() const { return _triaVertexID; }
+-
+-  virtual std::ostream & SaveTo(std::ostream & save);
+-  virtual std::istream & LoadFrom(std::istream & load);
+-  friend std::ostream& operator << (std::ostream & save,
+-				    StdMeshers_QuadrangleParams & hyp);
+-  friend std::istream& operator >> (std::istream & load,
+-				    StdMeshers_QuadrangleParams & hyp);
+-
+-  /*!
+-   * \brief Initialize start and end length by the mesh built on the geometry
+-    * \param theMesh - the built mesh
+-    * \param theShape - the geometry of interest
+-    * \retval bool - true if parameter values have been successfully defined
+-   */
+-  virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh,
+-				   const TopoDS_Shape& theShape);
+-
+-  /*!
+-   * \brief Initialize my parameter values by default parameters.
+-   *  \retval bool - true if parameter values have been successfully defined
+-   */
+-  virtual bool SetParametersByDefaults(const TDefaults& dflts,
+-				       const SMESH_Mesh* theMesh=0);
+-
+-protected:
+-  int         _triaVertexID;
+-  std::string _objEntry;
+-};
+-
+-#endif
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_QuadranglePreference.hxx salomesmesh/inc/StdMeshers_QuadranglePreference.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_QuadranglePreference.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_QuadranglePreference.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,14 +22,15 @@
+ //  SMESH StdMeshers : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_QuadranglePreference.hxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadranglePreference.hxx,v 1.4.2.1 2008/11/27 13:03:49 abd Exp $
++//
+ #ifndef _StdMeshers_QuadranglePreference_HXX_
+ #define _StdMeshers_QuadranglePreference_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ /*!
+  * \brief Hypothesis for StdMeshers_Quadrangle_2D, forcing construction
+@@ -58,7 +59,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_QuadraticMesh.hxx salomesmesh/inc/StdMeshers_QuadraticMesh.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_QuadraticMesh.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_QuadraticMesh.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,14 +22,15 @@
+ //  SMESH StdMeshers : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_QuadraticMesh.hxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_QuadraticMesh.hxx,v 1.4.2.1 2008/11/27 13:03:50 abd Exp $
++//
+ #ifndef _StdMeshers_QuadraticMesh_HXX_
+ #define _StdMeshers_QuadraticMesh_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ /*!
+  * \brief Hypothesis for StdMeshers_Regular_1D, forcing construction of quadratic edges.
+@@ -60,7 +61,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_QuadToTriaAdaptor.hxx salomesmesh/inc/StdMeshers_QuadToTriaAdaptor.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_QuadToTriaAdaptor.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_QuadToTriaAdaptor.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -27,7 +27,7 @@
+ #define _SMESH_QuadToTriaAdaptor_HXX_
+ 
+ #include <SMESH_Mesh.hxx>
+-#include "SMESH_StdMeshers.hxx"
++#include <SMESH_StdMeshers.hxx>
+ #include <SMDS_FaceOfNodes.hxx>
+ #include <TColgp_HArray1OfPnt.hxx>
+ #include <TColgp_HArray1OfVec.hxx>
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_RadialPrism_3D.hxx salomesmesh/inc/StdMeshers_RadialPrism_3D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_RadialPrism_3D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_RadialPrism_3D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -51,9 +51,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+ protected:
+ 
+   typedef std::vector<const SMDS_MeshNode* >            TNodeColumn;
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_RadialQuadrangle_1D2D.hxx salomesmesh/inc/StdMeshers_RadialQuadrangle_1D2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_RadialQuadrangle_1D2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_RadialQuadrangle_1D2D.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,76 +0,0 @@
+-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+-//
+-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-//
+-//  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.
+-//
+-//  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 at opencascade.com
+-//
+-//  SMESH SMESH : implementaion of SMESH idl descriptions
+-//  File   : StdMeshers_RadialQuadrangle_1D2D.hxx
+-//  Module : SMESH
+-//
+-#ifndef _SMESH_RadialQuadrangle_1D2D_HXX_
+-#define _SMESH_RadialQuadrangle_1D2D_HXX_
+-
+-#include "SMESH_StdMeshers.hxx"
+-
+-#include "SMESH_2D_Algo.hxx"
+-//#include "SMDS_MeshNode.hxx"
+-
+-//#include <vector>
+-//#include <map>
+-
+-class StdMeshers_NumberOfLayers;
+-class StdMeshers_LayerDistribution;
+-class SMESH_MesherHelper;
+-class gp_Pnt;
+-
+-class STDMESHERS_EXPORT StdMeshers_RadialQuadrangle_1D2D: public SMESH_2D_Algo
+-{
+-public:
+-  StdMeshers_RadialQuadrangle_1D2D(int hypId, int studyId, SMESH_Gen* gen);
+-  virtual ~StdMeshers_RadialQuadrangle_1D2D();
+-
+-  virtual bool CheckHypothesis(SMESH_Mesh&                          aMesh,
+-                               const TopoDS_Shape&                  aShape,
+-                               SMESH_Hypothesis::Hypothesis_Status& aStatus);
+-
+-  virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+-
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-  /*!
+-   * \brief Allow algo to do something after persistent restoration
+-    * \param subMesh - restored submesh
+-   *
+-   * This method is called only if a submesh has HYP_OK algo_state.
+-   */
+-  virtual void SubmeshRestored(SMESH_subMesh* subMesh);
+-  
+-protected:
+-
+-  bool computeLayerPositions(const gp_Pnt& pIn,
+-                             const gp_Pnt& pOut);
+-
+-
+-  const StdMeshers_NumberOfLayers*    myNbLayerHypo;
+-  const StdMeshers_LayerDistribution* myDistributionHypo;
+-  SMESH_MesherHelper*                 myHelper;
+-  std::vector< double >               myLayerPositions;
+-};
+-
+-#endif
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_Regular_1D.hxx salomesmesh/inc/StdMeshers_Regular_1D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_Regular_1D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_Regular_1D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -32,8 +32,6 @@
+ 
+ #include "SMESH_1D_Algo.hxx"
+ 
+-#include "StdMeshers_FixedPoints1D.hxx"
+-
+ class Adaptor3d_Curve;
+ class TopoDS_Vertex;
+ class StdMeshers_SegmentLengthAroundVertex;
+@@ -51,9 +49,6 @@
+   virtual bool Compute(SMESH_Mesh& aMesh,
+ 		       const TopoDS_Shape& aShape);
+ 
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+-
+   virtual const std::list <const SMESHDS_Hypothesis *> &
+     GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool=true);
+ 
+@@ -99,7 +94,7 @@
+   StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh &          theMesh,
+                                                      const TopoDS_Vertex & theV);
+ 
+-  enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, NONE };
++  enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, NONE };
+ 
+   enum ValueIndex {
+     SCALE_FACTOR_IND = 0,
+@@ -125,13 +120,10 @@
+ 
+   HypothesisType _hypType;
+ 
+-  const StdMeshers_FixedPoints1D* _fpHyp;
+-
+   double _value[2];
+   int    _ivalue[3];
+   std::vector<double> _vvalue[1];
+   std::string         _svalue[1];
+-  std::vector<int>    _revEdgesIDs;
+ 
+   // a source of propagated hypothesis, is set by CheckHypothesis()
+   // always called before Compute()
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_SegmentAroundVertex_0D.hxx salomesmesh/inc/StdMeshers_SegmentAroundVertex_0D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_SegmentAroundVertex_0D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_SegmentAroundVertex_0D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -46,8 +46,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+   
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+ };
+ 
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_SegmentLengthAroundVertex.hxx salomesmesh/inc/StdMeshers_SegmentLengthAroundVertex.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_SegmentLengthAroundVertex.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_SegmentLengthAroundVertex.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -23,14 +23,15 @@
+ //  File   : StdMeshers_SegmentLengthAroundVertex.hxx
+ //  Author : Paul RASCLE, EDF
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.hxx,v 1.2.2.1 2008/11/27 13:03:50 abd Exp $
++//
+ #ifndef _SMESH_SegmentLengthAroundVertex_HXX_
+ #define _SMESH_SegmentLengthAroundVertex_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ /*!
+  * \brief This hypothesis specifies length of segments adjacent to the vertex the
+@@ -42,7 +43,7 @@
+   StdMeshers_SegmentLengthAroundVertex(int hypId, int studyId, SMESH_Gen * gen);
+   virtual ~ StdMeshers_SegmentLengthAroundVertex();
+ 
+-  void SetLength(double length) throw(SALOME_Exception);
++  void SetLength(double length) throw(SMESH_Exception);
+ 
+   double GetLength() const;
+ 
+@@ -59,7 +60,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_StartEndLength.hxx salomesmesh/inc/StdMeshers_StartEndLength.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_StartEndLength.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_StartEndLength.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,16 +22,15 @@
+ //  SMESH StdMeshers : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_StartEndLength.hxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/StdMeshers_StartEndLength.hxx,v 1.7.2.1 2008/11/27 13:03:50 abd Exp $
++//
+ #ifndef _STDMESHERS_STARTENDLENGTH_HXX_
+ #define _STDMESHERS_STARTENDLENGTH_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
+-
+-#include <vector>
++#include "SMESH_Exception.hxx"
+ 
+ class STDMESHERS_EXPORT StdMeshers_StartEndLength:public SMESH_Hypothesis
+ {
+@@ -39,17 +38,9 @@
+   StdMeshers_StartEndLength(int hypId, int studyId, SMESH_Gen * gen);
+   virtual ~ StdMeshers_StartEndLength();
+ 
+-  void SetLength(double length, bool isStartLength) throw(SALOME_Exception);
++  void SetLength(double length, bool isStartLength) throw(SMESH_Exception);
+ 
+   double GetLength(bool isStartLength) const;
+-
+-  void SetReversedEdges( std::vector<int>& ids);
+-
+-  const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
+-
+-  void SetObjectEntry( const char* entry ) { _objEntry = entry; }
+-
+-  const char* GetObjectEntry() { return _objEntry.c_str(); }
+   
+   virtual std::ostream & SaveTo(std::ostream & save);
+   virtual std::istream & LoadFrom(std::istream & load);
+@@ -65,7 +56,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+@@ -73,8 +64,6 @@
+ 
+ protected:
+   double _begLength, _endLength;
+-  std::vector<int>   _edgeIDs;
+-  std::string        _objEntry;
+ };
+ 
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_TrianglePreference.hxx salomesmesh/inc/StdMeshers_TrianglePreference.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_TrianglePreference.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_TrianglePreference.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -22,14 +22,15 @@
+ //  SMESH StdMeshers : implementaion of SMESH idl descriptions
+ //  File   : StdMeshers_TrianglePreference.hxx
+ //  Module : SMESH
+-
++//  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers/Attic/StdMeshers_TrianglePreference.hxx,v 1.1.4.2 2008/11/27 13:03:50 abd Exp $
++//
+ #ifndef _StdMeshers_TrianglePreference_HXX_
+ #define _StdMeshers_TrianglePreference_HXX_
+ 
+ #include "SMESH_StdMeshers.hxx"
+ 
+ #include "SMESH_Hypothesis.hxx"
+-#include "Utils_SALOME_Exception.hxx"
++#include "SMESH_Exception.hxx"
+ 
+ /*!
+  * \brief Hypothesis for StdMeshers_Quadrangle_2D, forcing construction
+@@ -57,7 +58,7 @@
+    */
+   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+ 
+-  /*!
++   /*!
+    * \brief Initialize my parameter values by default parameters.
+    *  \retval bool - true if parameter values have been successfully defined
+    */
+diff -Naur smesh-5.1.2.2.svn55/inc/StdMeshers_UseExisting_1D2D.hxx salomesmesh/inc/StdMeshers_UseExisting_1D2D.hxx
+--- smesh-5.1.2.2.svn55/inc/StdMeshers_UseExisting_1D2D.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/StdMeshers_UseExisting_1D2D.hxx	2014-07-13 10:33:02.000000000 -0500
+@@ -46,8 +46,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+   
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+ };
+ 
+ class STDMESHERS_EXPORT StdMeshers_UseExisting_1D: public SMESH_1D_Algo
+@@ -61,8 +59,6 @@
+ 
+   virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+   
+-  virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
+-                        MapShapeNbElems& aResMap);
+ };
+ 
+ #endif
+diff -Naur smesh-5.1.2.2.svn55/inc/utilities.h salomesmesh/inc/utilities.h
+--- smesh-5.1.2.2.svn55/inc/utilities.h	2009-02-05 03:28:20.000000000 -0600
++++ salomesmesh/inc/utilities.h	2014-07-13 10:33:02.000000000 -0500
+@@ -26,6 +26,9 @@
+ //  Module : SALOME
+ //  $Header: /home/server/cvs/KERNEL/KERNEL_SRC/src/SALOMELocalTrace/utilities.h,v 1.6.2.1 2007/01/22 13:51:27 prascle Exp $
+ 
++// switch off massaging in release:
++#define _NOMSG_
++
+ /* ---  Definition macros file to print informations if _DEBUG_ or _DEBUG is defined --- */
+ 
+ #ifndef UTILITIES_H
+diff -Naur smesh-5.1.2.2.svn55/inc/Utils_ExceptHandlers.hxx salomesmesh/inc/Utils_ExceptHandlers.hxx
+--- smesh-5.1.2.2.svn55/inc/Utils_ExceptHandlers.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/Utils_ExceptHandlers.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,7 +0,0 @@
+-#ifndef _Utils_ExceptHandlers_HXX_
+-#define _Utils_ExceptHandlers_HXX_
+-
+-#include <SMESH_ExceptHandlers.hxx>
+-#define SalomeException SmeshException
+-
+-#endif
+diff -Naur smesh-5.1.2.2.svn55/inc/Utils_SALOME_Exception.hxx salomesmesh/inc/Utils_SALOME_Exception.hxx
+--- smesh-5.1.2.2.svn55/inc/Utils_SALOME_Exception.hxx	2009-12-16 09:01:21.000000000 -0600
++++ salomesmesh/inc/Utils_SALOME_Exception.hxx	1969-12-31 18:00:00.000000000 -0600
+@@ -1,7 +0,0 @@
+-#ifndef _Utils_SALOME_Exception_HXX_
+-#define _Utils_SALOME_Exception_HXX_
+-
+-#include <SMESH_Exception.hxx>
+-#define SALOME_Exception SMESH_Exception
+-
+-#endif
diff --git a/smesh.spec b/smesh.spec
index 055ba22..33e1871 100644
--- a/smesh.spec
+++ b/smesh.spec
@@ -7,7 +7,7 @@
 
 Name:           smesh
 Version:        5.1.2.2
-Release:        12.svn%{svnrev}%{?dist}
+Release:        13%{?dist}
 Summary:        OpenCascade based MESH framework
 
 License:        LGPLv2
@@ -22,12 +22,13 @@ Source0:        %{name}-%{version}.svn%{svnrev}.tar.gz
 
 # Patch emailed upstream to Fotios Sioutis <sfotis at gmail.com>
 # on 12/21/11.
-Patch0:         smesh.patch
+Patch0:         smesh-freecad-full.patch
 Patch1:         smesh-cmake_fixes.patch
 Patch2:         smesh-5.1.2.2-rm_f2c.patch
-Patch3:         smesh-5.1.2.2-pi_to_m_pi.patch
-# http://tracker.dev.opencascade.org/view.php?id=23487
-Patch4:         smesh-OCE_0.13_port.patch
+
+# Patch for freecad specific tweaks.
+#Patch5:         smesh-freecad.patch
+Patch5:         smesh-freecad-full.patch
 
 %if 0%{?rhel} &&  0%{?rhel} <= 6
 BuildRequires:  cmake28
@@ -69,11 +70,9 @@ Development files and headers for %{name}.
 
 %prep
 %setup -q -n %{name}-%{version}.svn%{svnrev}
-%patch0 -p1
+%patch0 -p1 -b .freecad
 %patch1 -p1 -b .cmakefix
 %patch2 -p1 -b .f2c
-%patch3 -p1 -b .pi
-%patch4 -p1 -b .oce-0.13
 
 dos2unix -k LICENCE.lgpl.txt
 
@@ -117,7 +116,10 @@ make install DESTDIR=%{buildroot}
 
 
 %changelog
-* Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.1.2.2-12.svn55
+* Tue Jul 22 2014 Richard Shaw <hobbes1069 at gmail.com> - 5.1.2.2-13
+- Add patch for freecad specific tweaks.
+
+* Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org>
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 
 * Fri May 23 2014 Petr Machata <pmachata at redhat.com> - 5.1.2.2-11.svn55


More information about the scm-commits mailing list