Salome HOME
PAL15881 New NETGEN capability: is it possible to do only a 2D mesh ?
[modules/smesh.git] / src / StdMeshers / StdMeshers_Quadrangle_2D.cxx
index 0b0d057ed58edecc2ec47bb650894210a645514f..6852c9edb160d95b386d13116514db6270beaac0 100644 (file)
@@ -119,7 +119,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
   aStatus = SMESH_Hypothesis::HYP_OK;
 
   // there is only one compatible Hypothesis so far
-  const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
+  const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape, false);
   myQuadranglePreference = hyps.size() > 0;
 
   return isOk;
@@ -132,9 +132,10 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
 //=============================================================================
 
 bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
-                                        const TopoDS_Shape& aShape) throw (SALOME_Exception)
+                                        const TopoDS_Shape& aShape)// throw (SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
+  // PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
+  //Unexpect aCatchSalomeException);
 
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   aMesh.GetSubMesh(aShape);
@@ -562,10 +563,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
 
 FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMesh,
                                                        const TopoDS_Shape & aShape)
-     throw(SALOME_Exception)
+  //throw(SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
-
   const TopoDS_Face & F = TopoDS::Face(aShape);
   const bool ignoreMediumNodes = _quadraticMesh;
 
@@ -596,16 +595,14 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
       sideEdges.splice( sideEdges.end(), edges, edges.begin()); // edges.front() -> sideEdges.end()
       bool sameSide = true;
       while ( !edges.empty() && sameSide ) {
-        GeomAbs_Shape cont = SMESH_Algo::Continuity( sideEdges.back(), edges.front() );
-        sameSide = ( cont >= GeomAbs_G1 );
+        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 ) {
-          GeomAbs_Shape cont = SMESH_Algo::Continuity( sideEdges.front(), edges.back() );
-          sameSide = ( cont >= GeomAbs_G1 );
+          sameSide = SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() );
           if ( sameSide )
             sideEdges.splice( sideEdges.begin(), edges, --edges.end());
         }
@@ -626,7 +623,9 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
     }
     cout << endl;
 #endif
-    error(COMPERR_BAD_SHAPE, TComm("Face must have 4 side but not ") << nbSides);
+    if ( !nbSides )
+      nbSides = nbEdgesInWire.front();
+    error(COMPERR_BAD_SHAPE, TComm("Face must have 4 sides but not ") << nbSides);
     delete quad;
     quad = 0;
   }
@@ -643,10 +642,8 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &         aMes
 FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
                            (SMESH_Mesh &         aMesh,
                             const TopoDS_Shape & aShape,
-                            const bool           CreateQuadratic) throw(SALOME_Exception)
+                            const bool           CreateQuadratic) //throw(SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
-
   _quadraticMesh = CreateQuadratic;
 
   FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
@@ -693,9 +690,8 @@ namespace {
 
 bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
                                                   const TopoDS_Shape& aShape,
-                                                  FaceQuadStruct* & quad) throw (SALOME_Exception)
+                                                  FaceQuadStruct* & quad) //throw (SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
   // Algorithme décrit dans "Génération automatique de maillages"
   // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85
   // traitement dans le domaine paramétrique 2d u,v
@@ -736,7 +732,7 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh,
   const vector<UVPtStruct>& uv_e3 = GetUVPtStructIn( quad, 3, nbvertic - 1 );
 
   if ( uv_e0.empty() || uv_e1.empty() || uv_e2.empty() || uv_e3.empty() )
-    return error(dfltErr(), "Can't find nodes on sides");
+    return error( "Can't find nodes on sides");
 
   // nodes Id on "in" edges
   if (! quad->isEdgeOut[0]) {
@@ -886,21 +882,19 @@ static gp_UV CalcUV(double x0, double x1, double y0, double y1,
 bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh &        aMesh,
                                                 const TopoDS_Shape& aShape,
                                                 FaceQuadStruct*     quad)
-  throw (SALOME_Exception)
 {
-  Unexpect aCatch(SalomeException);
-
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   const TopoDS_Face& F = TopoDS::Face(aShape);
   Handle(Geom_Surface) S = BRep_Tool::Surface(F);
-  const TopoDS_Wire& W = BRepTools::OuterWire(F);
-  bool WisF = false;
-  if(W.Orientation()==TopAbs_FORWARD) 
-    WisF = true;
+//  const TopoDS_Wire& W = BRepTools::OuterWire(F);
+  bool WisF = true;
+//   if(W.Orientation()==TopAbs_FORWARD) 
+//     WisF = true;
   //if(WisF) cout<<"W is FORWARD"<<endl;
   //else cout<<"W is REVERSED"<<endl;
-  bool FisF = (F.Orientation()==TopAbs_FORWARD);
-  if(!FisF) WisF = !WisF;
+//   bool FisF = (F.Orientation()==TopAbs_FORWARD);
+//   if(!FisF) WisF = !WisF;
+//  WisF = FisF;
   int i,j,geomFaceID = meshDS->ShapeToIndex( F );
 
   int nb = quad->side[0]->NbPoints();