Salome HOME
IPAL52726: Hypotheses are missing from Object Browser after re-assignement
authoreap <eap@opencascade.com>
Tue, 5 May 2015 12:47:33 +0000 (15:47 +0300)
committereap <eap@opencascade.com>
Tue, 5 May 2015 12:47:33 +0000 (15:47 +0300)
  Fix addReference() in SMESH_Gen_i_1.cxx

IPAL52649: Irregular mesh created by Extrusion 3D algo
  Add projectQuads() (not used so far) in StdMeshers_Projection_2D.cxx

Fix errors detected by PVS-Studio as reported in www.viva64.com/en/b/0322/

src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx
src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx
src/DriverUNV/UNV_Utilities.hxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_Pattern.cxx
src/SMESHDS/SMESHDS_Command.cxx
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHUtils/SMESH_Block.cxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/StdMeshers/StdMeshers_Projection_2D.cxx

index 26742f7e93020fdd140dbcff3d67b970041a36c3..7c1616a2a31ee15db67d7f7d5b07ed7438528706 100644 (file)
@@ -53,7 +53,7 @@ Driver_Mesh::Status DriverDAT_R_SMDS_Mesh::Perform()
    ****************************************************************************/
   char *file2Read = (char *)myFile.c_str();
   FILE* aFileId = fopen(file2Read, "r");
-  if (aFileId < 0) {
+  if ( !aFileId ) {
     fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
     return DRS_FAIL;
   }
index e5ea9d0d35c7d9fefdbd1a538feaf8ee5d62e084..5205292604e60d996bc3809a989d509896c5c582 100644 (file)
@@ -39,10 +39,10 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
 
   int nbNodes, nbCells;
   //int i;
-  
+
   char *file2Read = (char *)myFile.c_str();
   FILE* aFileId = fopen(file2Read, "w+");
-  if (aFileId < 0) {
+  if ( !aFileId ) {
     fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
     return DRS_FAIL;
   }
@@ -50,10 +50,10 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
   /****************************************************************************
    *                       NOMBRES D'OBJETS                                    *
    ****************************************************************************/
-  
+
   /* Combien de noeuds ? */
   nbNodes = myMesh->NbNodes();
-  
+
   /* Combien de mailles, faces ou aretes ? */
   int /*nb_of_nodes,*/ nb_of_edges, nb_of_faces, nb_of_volumes;
   nb_of_edges = myMesh->NbEdges();
@@ -63,14 +63,14 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
   SCRUTE(nb_of_edges);
   SCRUTE(nb_of_faces);
   SCRUTE(nb_of_volumes);
-  
+
   fprintf(stdout, "%d %d\n", nbNodes, nbCells);
   fprintf(aFileId, "%d %d\n", nbNodes, nbCells);
-  
+
   /****************************************************************************
    *                       ECRITURE DES NOEUDS                                 *
    ****************************************************************************/
-  
+
   SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
   while(itNodes->more()){               
     const SMDS_MeshNode * node = itNodes->next();
index cb342af7aea115386af458c0eda1dc810d401ca3..413ccfa5a254d4c23c0bbfd99c0dd174b13abdda 100644 (file)
@@ -56,24 +56,27 @@ namespace UNV{
   {
     assert (in_file.good());
     assert (!ds_name.empty());
-    
+
     std::string olds, news;
-    
+
     in_file.seekg(0);
-    while(true){
+    while(true)
+    {
       in_file >> olds >> news;
       /*
        * a "-1" followed by a number means the beginning of a dataset
        * stop combing at the end of the file
        */
-      while( ((olds != "-1") || (news == "-1") ) && !in_file.eof() ){     
+      while( ((olds != "-1") || (news == "-1")))
+      {
         olds = news;
         in_file >> news;
-      }
-      if(in_file.eof())
-      {
-        in_file.clear();
-        return false;
+
+        if ( in_file.eof() || in_file.fail() )
+        {
+          in_file.clear();
+          return false;
+        }
       }
       if (news == ds_name)
         return true;
index 24042d9da45baf471bf2e72e06f5e63857786892..73030e901a943a47e4012b9870bc435b4411c03d 100644 (file)
@@ -2181,9 +2181,9 @@ SMESH_Group* SMESH_Mesh::ConvertToStandalone ( int theGroupID )
     return aGroup;
 
   SMESH_Group* anOldGrp = (*itg).second;
-  SMESHDS_GroupBase* anOldGrpDS = anOldGrp->GetGroupDS();
-  if ( !anOldGrp || !anOldGrpDS )
+  if ( !anOldGrp || !anOldGrp->GetGroupDS() )
     return aGroup;
+  SMESHDS_GroupBase* anOldGrpDS = anOldGrp->GetGroupDS();
 
   // create new standalone group
   aGroup = new SMESH_Group (theGroupID, this, anOldGrpDS->GetType(), anOldGrp->GetName() );
index 436a0ad0339816e6c832f0ef080d07123783653c..602ade3a3d2959cb633167ee3044b8f4e896adc9 100644 (file)
@@ -6307,9 +6307,11 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet                  theElemSets
     for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) {
       // check element type
       const SMDS_MeshElement* elem = *itElem;
-      SMDSAbs_ElementType   aTypeE = elem->GetType();
-      if ( !elem /*|| ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge )*/ )
+      if ( !elem )
         continue;
+      // SMDSAbs_ElementType aTypeE = elem->GetType();
+      // if ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge )
+      //   continue;
 
       vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
       newNodesItVec.reserve( elem->NbNodes() );
index 4ede79e45238b761df7b76f937295b066d151374..5db170d7bedf5006c9cedea05295f6fee5b8db3c 100644 (file)
@@ -540,7 +540,7 @@ static bool isMeshBoundToShape(SMESHDS_Mesh *     aMeshDS,
                                SMESHDS_SubMesh *  aFaceSubmesh,
                                const bool         isMainShape)
 {
-  if ( isMainShape ) {
+  if ( isMainShape && aFaceSubmesh ) {
     // check that all faces are bound to aFaceSubmesh
     if ( aMeshDS->NbFaces() != aFaceSubmesh->NbElements() )
       return false;
@@ -4448,7 +4448,7 @@ void SMESH_Pattern::arrangeBoundaries (list< list< TPoint* > >& boundaryList)
     }
 
     if ( outerBndPos != boundaryList.begin() )
-      boundaryList.splice( boundaryList.begin(), boundaryList, outerBndPos, ++outerBndPos );
+      boundaryList.splice( boundaryList.begin(), boundaryList, outerBndPos );
 
   } // if nbBoundaries > 1
 
index fcec3af323a0de7ea0ecbf7935b3f53faf0bb4bf..4fbd5464e1c6c22d86dadf521a10a9fb0ea78dae 100644 (file)
@@ -54,7 +54,7 @@ SMESHDS_Command::~SMESHDS_Command()
 //=======================================================================
 void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
 {
-        if (!myType == SMESHDS_AddNode)
+        if ( myType != SMESHDS_AddNode)
         {
                 MESSAGE("SMESHDS_Command::AddNode : Bad Type");
                 return;
@@ -72,7 +72,7 @@ void SMESHDS_Command::AddNode(int NewNodeID, double x, double y, double z)
 //=======================================================================
 void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
 {
-        if (!myType == SMESHDS_MoveNode)
+        if ( myType != SMESHDS_MoveNode)
         {
                 MESSAGE("SMESHDS_Command::MoveNode : Bad Type");
                 return;
@@ -90,7 +90,7 @@ void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
 //=======================================================================
 void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode)
 {
-  if (!myType == SMESHDS_Add0DElement)
+  if ( myType != SMESHDS_Add0DElement)
   {
     MESSAGE("SMESHDS_Command::Add0DElement : Bad Type");
     return;
@@ -106,7 +106,7 @@ void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode)
 //=======================================================================
 void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
 {
-        if (!myType == SMESHDS_AddEdge)
+        if ( myType != SMESHDS_AddEdge)
         {
                 MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
                 return;
@@ -124,7 +124,7 @@ void SMESHDS_Command::AddEdge(int NewEdgeID, int idnode1, int idnode2)
 void SMESHDS_Command::AddFace(int NewFaceID,
         int idnode1, int idnode2, int idnode3)
 {
-        if (!myType == SMESHDS_AddTriangle)
+        if ( myType != SMESHDS_AddTriangle)
         {
                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
                 return;
@@ -143,7 +143,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
 void SMESHDS_Command::AddFace(int NewFaceID,
         int idnode1, int idnode2, int idnode3, int idnode4)
 {
-        if (!myType == SMESHDS_AddQuadrangle)
+        if ( myType != SMESHDS_AddQuadrangle)
         {
                 MESSAGE("SMESHDS_Command::AddFace : Bad Type");
                 return;
@@ -163,7 +163,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
 void SMESHDS_Command::AddVolume(int NewVolID,
         int idnode1, int idnode2, int idnode3, int idnode4)
 {
-        if (!myType == SMESHDS_AddTetrahedron)
+        if ( myType != SMESHDS_AddTetrahedron)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -183,7 +183,7 @@ void SMESHDS_Command::AddVolume(int NewVolID,
 void SMESHDS_Command::AddVolume(int NewVolID,
         int idnode1, int idnode2, int idnode3, int idnode4, int idnode5)
 {
-        if (!myType == SMESHDS_AddPyramid)
+        if ( myType != SMESHDS_AddPyramid)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -205,7 +205,7 @@ void SMESHDS_Command::AddVolume(int NewVolID,
         int idnode1,
         int idnode2, int idnode3, int idnode4, int idnode5, int idnode6)
 {
-        if (!myType == SMESHDS_AddPrism)
+        if ( myType != SMESHDS_AddPrism)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -230,7 +230,7 @@ void SMESHDS_Command::AddVolume(int NewVolID,
         int idnode3,
         int idnode4, int idnode5, int idnode6, int idnode7, int idnode8)
 {
-        if (!myType == SMESHDS_AddHexahedron)
+        if ( myType != SMESHDS_AddHexahedron)
         {
                 MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
                 return;
@@ -280,7 +280,7 @@ void SMESHDS_Command::AddVolume(int NewVolID,
 void SMESHDS_Command::AddPolygonalFace (const int               ElementID,
                                         const std::vector<int>& nodes_ids)
 {
-  if (!myType == SMESHDS_AddPolygon) {
+  if ( myType != SMESHDS_AddPolygon) {
     MESSAGE("SMESHDS_Command::AddPolygonalFace : Bad Type");
     return;
   }
@@ -303,7 +303,7 @@ void SMESHDS_Command::AddPolyhedralVolume (const int               ElementID,
                                            const std::vector<int>& nodes_ids,
                                            const std::vector<int>& quantities)
 {
-  if (!myType == SMESHDS_AddPolyhedron) {
+  if ( myType != SMESHDS_AddPolyhedron) {
     MESSAGE("SMESHDS_Command::AddPolyhedralVolume : Bad Type");
     return;
   }
@@ -330,7 +330,7 @@ void SMESHDS_Command::AddPolyhedralVolume (const int               ElementID,
 //=======================================================================
 void SMESHDS_Command::RemoveNode(int NodeID)
 {
-        if (!myType == SMESHDS_RemoveNode)
+        if ( myType != SMESHDS_RemoveNode)
         {
                 MESSAGE("SMESHDS_Command::RemoveNode : Bad Type");
                 return;
@@ -345,7 +345,7 @@ void SMESHDS_Command::RemoveNode(int NodeID)
 //=======================================================================
 void SMESHDS_Command::RemoveElement(int ElementID)
 {
-        if (!myType == SMESHDS_RemoveElement)
+        if ( myType != SMESHDS_RemoveElement)
         {
                 MESSAGE("SMESHDS_Command::RemoveElement : Bad Type");
                 return;
@@ -361,7 +361,7 @@ void SMESHDS_Command::RemoveElement(int ElementID)
 
 void SMESHDS_Command::ChangeElementNodes(int ElementID, int nodes[], int nbnodes)
 {
-  if (!myType == SMESHDS_ChangeElementNodes)
+  if ( myType != SMESHDS_ChangeElementNodes)
   {
     MESSAGE("SMESHDS_Command::ChangeElementNodes : Bad Type");
     return;
@@ -411,7 +411,7 @@ void SMESHDS_Command::ChangePolyhedronNodes (const int               ElementID,
 
 void SMESHDS_Command::Renumber (const bool isNodes, const int startID, const int deltaID)
 {
-  if (!myType == SMESHDS_Renumber)
+  if ( myType != SMESHDS_Renumber)
   {
     MESSAGE("SMESHDS_Command::Renumber : Bad Type");
     return;
@@ -469,7 +469,7 @@ const list < double >&SMESHDS_Command::GetCoords()
 //=======================================================================
 void SMESHDS_Command::AddEdge(int NewEdgeID, int n1, int n2, int n12)
 {
-  if (!myType == SMESHDS_AddQuadEdge) {
+  if ( myType != SMESHDS_AddQuadEdge) {
     MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
     return;
   }
@@ -488,7 +488,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
                               int n1, int n2, int n3,
                               int n12, int n23, int n31)
 {
-  if (!myType == SMESHDS_AddQuadTriangle) {
+  if ( myType != SMESHDS_AddQuadTriangle) {
     MESSAGE("SMESHDS_Command::AddFace : Bad Type");
     return;
   }
@@ -510,7 +510,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
                               int n1, int n2, int n3,
                               int n12, int n23, int n31, int nCenter)
 {
-  if (!myType == SMESHDS_AddBiQuadTriangle) {
+  if ( myType != SMESHDS_AddBiQuadTriangle) {
     MESSAGE("SMESHDS_Command::AddFace : Bad Type");
     return;
   }
@@ -533,7 +533,7 @@ void SMESHDS_Command::AddFace(int NewFaceID,
                               int n1, int n2, int n3, int n4,
                               int n12, int n23, int n34, int n41)
 {
-  if (!myType == SMESHDS_AddQuadQuadrangle) {
+  if ( myType != SMESHDS_AddQuadQuadrangle) {
     MESSAGE("SMESHDS_Command::AddFace : Bad Type");
     return;
   }
@@ -582,7 +582,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
                                 int n12, int n23, int n31,
                                 int n14, int n24, int n34)
 {
-  if (!myType == SMESHDS_AddQuadTetrahedron) {
+  if ( myType != SMESHDS_AddQuadTetrahedron) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -609,7 +609,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
                                 int n12, int n23, int n34, int n41,
                                 int n15, int n25, int n35, int n45)
 {
-  if (!myType == SMESHDS_AddQuadPyramid) {
+  if ( myType != SMESHDS_AddQuadPyramid) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -640,7 +640,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
                                 int n45, int n56, int n64,
                                 int n14, int n25, int n36)
 {
-  if (!myType == SMESHDS_AddQuadPentahedron) {
+  if ( myType != SMESHDS_AddQuadPentahedron) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -673,7 +673,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3,
                                 int n56, int n67, int n78, int n85,
                                 int n15, int n26, int n37, int n48)
 {
-  if (!myType == SMESHDS_AddQuadHexahedron) {
+  if ( myType != SMESHDS_AddQuadHexahedron) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -713,7 +713,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3,
                                 int n1234,int n1256,int n2367,int n3478,
                                 int n1458,int n5678,int nCenter)
 {
-  if (!myType == SMESHDS_AddQuadHexahedron) {
+  if ( myType != SMESHDS_AddQuadHexahedron) {
     MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
     return;
   }
@@ -756,7 +756,7 @@ void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3,
 
 void SMESHDS_Command::AddBall(int NewBallID, int node, double diameter)
 {
-  if (!myType == SMESHDS_AddBall)
+  if ( myType != SMESHDS_AddBall)
   {
     MESSAGE("SMESHDS_Command::SMESHDS_AddBall : Bad Type");
     return;
index 13ad359cd248974aa38d8df02cf00c968107664f..67408d72002239ff23c172e0279a38d0556016d9 100644 (file)
@@ -551,17 +551,17 @@ void SMESHGUI_MeshOp::selectionDone()
         for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
           QString aSubGeomEntry = (*aSubShapesIter);
           _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data());
-        
-         if( pSubGeom ) { 
-           SALOMEDS_SObject* sobj = _CAST(SObject,pSubGeom);
-           if( sobj ) {
-             GEOM::GEOM_Object_var aSubGeomVar =
-               GEOM::GEOM_Object::_narrow(sobj->GetObject());
-             if( !aSubGeomVar->_is_nil() ){
-               aSeq[iSubSh] = aSubGeomVar;
-             }
-           }
-         }
+         
+          if( pSubGeom ) { 
+            SALOMEDS_SObject* sobj = _CAST(SObject,pSubGeom);
+            if( sobj ) {
+              GEOM::GEOM_Object_var aSubGeomVar =
+                GEOM::GEOM_Object::_narrow(sobj->GetObject());
+              if( !aSubGeomVar->_is_nil() ){
+                aSeq[iSubSh] = aSubGeomVar;
+              }
+            }
+          }
         }
       } else {
         // get geometry by selected sub-mesh
index 271ef8b0a682fb6a9b7ee13369a9facc6e6d2269..4f7bc42cfe03790bece2f80f7625f8512a720a4a 100644 (file)
@@ -596,6 +596,7 @@ Standard_Boolean SMESH_Block::Values(const math_Vector& theXYZ,
       if ( mag > DBL_MIN )
         dPi /= mag;
       drv[ iP - 1 ] = dPi;
+      // drv[ iP - 1 ] = dPi / 0.001;
     }
     for ( int iP = 0; iP < 3; iP++ ) {
 #if 1
@@ -725,7 +726,7 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint,
 
   bool hasHint = ( 0 <= theParamsHint.X() && theParamsHint.X() <= 1 &&
                    0 <= theParamsHint.Y() && theParamsHint.Y() <= 1 &&
-                   0 <= theParamsHint.Y() && theParamsHint.Y() <= 1 );
+                   0 <= theParamsHint.Z() && theParamsHint.Z() <= 1 );
   if ( !hasHint && !myGridComputed )
   {
     // define the first guess by thePoint projection on lines
index 65ee1e31d21d00f6a6a50600a17e51d6809166fc..6fd7ec30d531003909204e6ad87ac2d2caf9eee9 100644 (file)
@@ -415,14 +415,14 @@ static void addReference (SALOMEDS::Study_ptr   theStudy,
         theTag = tag;
     }
     if ( !theSObject->FindSubObject( theTag, aReferenceSO.inout() ))
-    {
       aReferenceSO = aStudyBuilder->NewObjectToTag( theSObject, theTag );
-      // add reference to the use case tree
-      // (to support tree representation customization and drag-n-drop)
-      SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
-      useCaseBuilder->AppendTo( aReferenceSO->GetFather(), aReferenceSO );
-    }
+
     aStudyBuilder->Addreference( aReferenceSO, aToObjSO );
+
+    // add reference to the use case tree
+    // (to support tree representation customization and drag-n-drop)
+    SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theStudy->GetUseCaseBuilder();
+    useCaseBuilder->AppendTo( theSObject, aReferenceSO );
   }
 }
 
index af482db570edb7349bba6a14356b301781b18a18..70833b1b4f10c3c7752c24ea11fc4694e44bb8b5 100644 (file)
@@ -58,6 +58,7 @@
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_MapOfShape.hxx>
 #include <TopoDS.hxx>
+#include <TopoDS_Solid.hxx>
 #include <gp_Ax2.hxx>
 #include <gp_Ax3.hxx>
 #include <gp_GTrsf.hxx>
@@ -952,10 +953,165 @@ namespace {
       case 3: helper.AddFace(tgtNodes[0], tgtNodes[2], tgtNodes[1]); break;
       case 4: helper.AddFace(tgtNodes[0], tgtNodes[3], tgtNodes[2], tgtNodes[1]); break;
       }
+    }  // loop on all mesh faces on srcFace
+
+    return true;
+  }
+
+  //================================================================================
+  /*!
+   * \brief Preform projection in case of quadrilateral faces
+   */
+  //================================================================================
+
+  bool projectQuads(const TopoDS_Face&                 tgtFace,
+                    const TopoDS_Face&                 srcFace,
+                    const TSideVector&                 tgtWires,
+                    const TSideVector&                 srcWires,
+                    const TAssocTool::TShapeShapeMap&  shape2ShapeMap,
+                    TAssocTool::TNodeNodeMap&          src2tgtNodes,
+                    const bool                         is1DComputed)
+  {
+    SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh();
+    SMESH_Mesh * srcMesh = srcWires[0]->GetMesh();
+    SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
+    SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
+
+    if ( srcWires[0]->NbEdges() != 4 )
+      return false;
+    if ( !is1DComputed )
+      return false;
+    for ( int iE = 0; iE < 4; ++iE )
+    {
+      SMESHDS_SubMesh* sm = srcMeshDS->MeshElements( srcWires[0]->Edge( iE ));
+      if ( !sm ) return false;
+      if ( sm->NbNodes() + sm->NbElements() == 0 ) return false;
+    }
+    if ( BRepAdaptor_Surface( tgtFace ).GetType() != GeomAbs_Plane )
+      return false;
+    // if ( BRepAdaptor_Surface( tgtFace ).GetType() == GeomAbs_Plane &&
+    //      BRepAdaptor_Surface( srcFace ).GetType() == GeomAbs_Plane )
+    //   return false; // too easy
+
+    // load EDGEs to SMESH_Block
+
+    SMESH_Block block;
+    TopTools_IndexedMapOfOrientedShape blockSubShapes;
+    {
+      const TopoDS_Solid& box = srcMesh->PseudoShape();
+      TopoDS_Shell shell = TopoDS::Shell( TopExp_Explorer( box, TopAbs_SHELL ).Current() );
+      TopoDS_Vertex v;
+      block.LoadBlockShapes( shell, v, v, blockSubShapes ); // fill all since operator[] is missing
+    }
+    const SMESH_Block::TShapeID srcFaceBID = SMESH_Block::ID_Fxy0;
+    const SMESH_Block::TShapeID tgtFaceBID = SMESH_Block::ID_Fxy1;
+    vector< int > edgeBID;
+    block.GetFaceEdgesIDs( srcFaceBID, edgeBID ); // u0, u1, 0v, 1v
+    blockSubShapes.Substitute( edgeBID[0], srcWires[0]->Edge(0) );
+    blockSubShapes.Substitute( edgeBID[1], srcWires[0]->Edge(2) );
+    blockSubShapes.Substitute( edgeBID[2], srcWires[0]->Edge(3) );
+    blockSubShapes.Substitute( edgeBID[3], srcWires[0]->Edge(1) );
+    block.GetFaceEdgesIDs( tgtFaceBID, edgeBID ); // u0, u1, 0v, 1v
+    blockSubShapes.Substitute( edgeBID[0], tgtWires[0]->Edge(0) );
+    blockSubShapes.Substitute( edgeBID[1], tgtWires[0]->Edge(2) );
+    blockSubShapes.Substitute( edgeBID[2], tgtWires[0]->Edge(3) );
+    blockSubShapes.Substitute( edgeBID[3], tgtWires[0]->Edge(1) );
+    block.LoadFace( srcFace, srcFaceBID, blockSubShapes );
+    block.LoadFace( tgtFace, tgtFaceBID, blockSubShapes );
+
+    // remember connectivity of new faces in terms of ( node-or-XY )
+
+    typedef std::pair< const SMDS_MeshNode*, gp_XYZ > TNodeOrXY; // node-or-XY
+    typedef std::vector< TNodeOrXY* >                 TFaceConn; // face connectivity
+    std::vector< TFaceConn >                    newFacesVec;     // connectivity of all faces
+    std::map< const SMDS_MeshNode*, TNodeOrXY > srcNode2tgtNXY;  // src node -> node-or-XY
+
+    TAssocTool::TNodeNodeMap::iterator                                       srcN_tgtN;
+    std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator                    srcN_tgtNXY;
+    std::pair< std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator, bool > n2n_isNew;
+    TNodeOrXY nullNXY( 0, gp_XYZ(0,0,0) );
+
+    SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace );
+    newFacesVec.resize( srcSubDS->NbElements() );
+    int iFaceSrc = 0;
+
+    SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements();
+    while ( elemIt->more() ) // loop on all mesh faces on srcFace
+    {
+      const SMDS_MeshElement* elem = elemIt->next();
+      TFaceConn& tgtNodes = newFacesVec[ iFaceSrc++ ];
+
+      const int nbN = elem->NbCornerNodes(); 
+      tgtNodes.resize( nbN );
+      for ( int i = 0; i < nbN; ++i ) // loop on nodes of the source element
+      {
+        const SMDS_MeshNode* srcNode = elem->GetNode(i);
+        n2n_isNew = srcNode2tgtNXY.insert( make_pair( srcNode, nullNXY ));
+        TNodeOrXY & tgtNodeOrXY = n2n_isNew.first->second;
+        if ( n2n_isNew.second ) // new src node encounters
+        {
+          srcN_tgtN = src2tgtNodes.find( srcNode );
+          if ( srcN_tgtN != src2tgtNodes.end() )
+          {
+            tgtNodeOrXY.first = srcN_tgtN->second; // tgt node exists
+          }
+          else 
+          {
+            // find XY of src node withing the quadrilateral srcFace
+            if ( !block.ComputeParameters( SMESH_TNodeXYZ( srcNode ),
+                                           tgtNodeOrXY.second, srcFaceBID ))
+              return false;
+          }
+        }
+        tgtNodes[ i ] = & tgtNodeOrXY;
+      }
+    }
+
+    // as all XY are computed, create tgt nodes and faces
+
+    SMESH_MesherHelper helper( *tgtMesh );
+    helper.SetSubShape( tgtFace );
+    if ( is1DComputed )
+      helper.IsQuadraticSubMesh( tgtFace );
+    else
+      helper.SetIsQuadratic( srcSubDS->GetElements()->next()->IsQuadratic() );
+    helper.SetElementsOnShape( true );
+    Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( tgtFace );
+
+    SMESH_MesherHelper srcHelper( *srcMesh );
+    srcHelper.SetSubShape( srcFace );
+
+    vector< const SMDS_MeshNode* > tgtNodes;
+    gp_XY uv;
+
+    for ( size_t iFaceTgt = 0; iFaceTgt < newFacesVec.size(); ++iFaceTgt )
+    {
+      TFaceConn& tgtConn = newFacesVec[ iFaceTgt ];
+      tgtNodes.resize( tgtConn.size() );
+      for ( size_t iN = 0; iN < tgtConn.size(); ++iN )
+      {
+        const SMDS_MeshNode* & tgtN = tgtConn[ iN ]->first;
+        if ( !tgtN ) // create a node
+        {
+          if ( !block.FaceUV( tgtFaceBID, tgtConn[iN]->second, uv ))
+            return false;
+          gp_Pnt p = tgtSurface->Value( uv.X(), uv.Y() );
+          tgtN = helper.AddNode( p.X(), p.Y(), p.Z(), uv.X(), uv.Y() );
+        }
+        tgtNodes[ tgtNodes.size() - iN - 1] = tgtN; // reversed orientation
+      }
+      switch ( tgtNodes.size() )
+      {
+      case 3: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2]); break;
+      case 4: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2], tgtNodes[3]); break;
+      default:
+        if ( tgtNodes.size() > 4 )
+          helper.AddPolygonalFace( tgtNodes );
+      }
     }
     return true;
 
-  } // bool projectBy2DSimilarity(...)
+  } // bool projectQuads(...)
 
   //================================================================================
   /*!
@@ -1126,6 +1282,12 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
     projDone = projectBy2DSimilarity( tgtFace, srcFace, tgtWires, srcWires,
                                       shape2ShapeMap, _src2tgtNodes, is1DComputed);
   }
+  if ( !projDone )
+  {
+    // projection in case of quadrilateral faces
+    // projDone = projectQuads( tgtFace, srcFace, tgtWires, srcWires,
+    //                          shape2ShapeMap, _src2tgtNodes, is1DComputed);
+  }
 
   helper.SetSubShape( tgtFace );