Salome HOME
Regression of SALOME_TESTS/Grids/smesh/2D_mesh_QuadranglePreference_01/B0
[modules/smesh.git] / src / StdMeshers / StdMeshers_Projection_2D.cxx
index 7467a19f9b5a9c913ea337c36cb15fd082ac4337..c4bbc0c6825a62e7c7cd539df111cb3cbc32d800 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  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
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -62,7 +62,8 @@ using namespace std;
 
 #define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
 
-typedef StdMeshers_ProjectionUtils TAssocTool;
+namespace TAssocTool = StdMeshers_ProjectionUtils;
+//typedef StdMeshers_ProjectionUtils TAssocTool;
 
 //=======================================================================
 //function : StdMeshers_Projection_2D
@@ -824,14 +825,17 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
   SMESH_subMesh* srcSubMesh = srcMesh->GetSubMesh( srcFace );
   SMESH_subMesh* tgtSubMesh = tgtMesh->GetSubMesh( tgtFace );
 
+  string srcMeshError;
   if ( tgtMesh == srcMesh ) {
-    if ( !TAssocTool::MakeComputed( srcSubMesh ) || !srcSubMesh->IsMeshComputed() )
-      return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
+    if ( !TAssocTool::MakeComputed( srcSubMesh ))
+      srcMeshError = TAssocTool::SourceNotComputedError( srcSubMesh, this );
   }
   else {
     if ( !srcSubMesh->IsMeshComputed() )
-      return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
+      srcMeshError = TAssocTool::SourceNotComputedError();
   }
+  if ( !srcMeshError.empty() )
+    return error(COMPERR_BAD_INPUT_MESH, srcMeshError );
 
   // ===========
   // Projection
@@ -861,15 +865,15 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
     done = projectBy2DSimilarity( tgtFace, srcFace, tgtMesh, srcMesh, shape2ShapeMap, is1DComputed);
   }
 
+  SMESH_MesherHelper helper( theMesh );
+  helper.SetSubShape( tgtFace );
+
   if ( !done )
   {
     // --------------------
     // Prepare to mapping 
     // --------------------
 
-    SMESH_MesherHelper helper( theMesh );
-    helper.SetSubShape( tgtFace );
-
     // Check if node projection to a face is needed
     Bnd_B2d uvBox;
     SMDS_ElemIteratorPtr faceIt = srcSubMesh->GetSubMeshDS()->GetElements();
@@ -1014,9 +1018,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
       map< double, const SMDS_MeshNode* >::iterator u_oldNode, u_newNode, u_newOnSeam, newEnd;
       set< const SMDS_MeshNode* > seamNodes;
 
-      // mapper puts on a seam edge nodes from 2 edges
+      // mapper changed, no more "mapper puts on a seam edge nodes from 2 edges"
       if ( isSeam && ! getBoundaryNodes ( sm, tgtFace, u2nodesOnSeam, seamNodes ))
-        RETURN_BAD_RESULT("getBoundaryNodes() failed");
+        ;//RETURN_BAD_RESULT("getBoundaryNodes() failed");
 
       SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
       while ( nIt->more() )
@@ -1140,7 +1144,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
       while ( faceIt->more() )
         tgtFaces.insert( tgtFaces.end(), faceIt->next() );
 
-      editor.ConvertToQuadratic(/*theForce3d=*/false, tgtFaces);
+      editor.ConvertToQuadratic(/*theForce3d=*/false, tgtFaces, false);
     }
 
     cleaner.Release(); // not to remove mesh
@@ -1182,7 +1186,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
     }
   }
   // Fix orientation
-  if ( SMESH_Algo::IsReversedSubMesh( face, meshDS ))
+  if ( helper.IsReversedSubMesh( face ))
   {
     SMESH_MeshEditor editor( tgtMesh );
     SMDS_ElemIteratorPtr eIt = meshDS->MeshElements( face )->GetElements();