]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Debug sewing. Enable polygons creation while sewing free border to side.
authorjfa <jfa@opencascade.com>
Wed, 9 Mar 2005 12:29:09 +0000 (12:29 +0000)
committerjfa <jfa@opencascade.com>
Wed, 9 Mar 2005 12:29:09 +0000 (12:29 +0000)
idl/SMESH_Mesh.idl
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MeshEditor.hxx
src/SMESHGUI/SMESHGUI_SewingDlg.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx

index 10debd7fd23f435d95bd1fddec8f66ca19b47b1e..029687e6a194929f17afaa5bb52f928dab15bc9c 100644 (file)
@@ -670,7 +670,8 @@ module SMESH
                                in long SecondNodeIDOnFreeBorder,
                                in long LastNodeIDOnFreeBorder,
                                in long FirstNodeIDOnSide,
-                               in long LastNodeIDOnSide);
+                               in long LastNodeIDOnSide,
+                              in boolean CreatePoly);
 
     Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
                                in long_array IDsOfSide2Elements,
index 40aabbe557b7fab20d3729eefc60621458e7f86d..007aac4517d3bfbd03c1990ea758267a4e645701 100644 (file)
@@ -975,12 +975,12 @@ bool SMESH_MeshEditor::TriToQuad (set<const SMDS_MeshElement*> &       theElems,
 }
 
 
-#define DUMPSO(txt) \
+/*#define DUMPSO(txt) \
 //  cout << txt << endl;
 //=============================================================================
-/*!
- *
- */
+//
+//
+//
 //=============================================================================
 static void swap( int i1, int i2, int idNodes[], gp_Pnt P[] )
 {
@@ -1252,7 +1252,7 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
 //   }
 
   return true;
-}
+}*/
 
 //=======================================================================
 //function : laplacianSmooth
@@ -3411,7 +3411,7 @@ SMESH_MeshEditor::Sew_Error
     LinkID_Gen aLinkID_Gen( GetMeshDS() );
     set<long> foundSideLinkIDs, checkedLinkIDs;
     SMDS_VolumeTool volume;
-    const SMDS_MeshNode* faceNodes[ 4 ];
+    //const SMDS_MeshNode* faceNodes[ 4 ];
 
     const SMDS_MeshNode*    sideNode;
     const SMDS_MeshElement* sideElem;
@@ -3439,6 +3439,7 @@ SMESH_MeshEditor::Sew_Error
         const SMDS_MeshElement* elem = invElemIt->next();
         // prepare data for a loop on links, of a face or a volume
         int iPrevNode, iNode = 0, nbNodes = elem->NbNodes();
+        const SMDS_MeshNode* faceNodes[ nbNodes ];
         bool isVolume = volume.Set( elem );
         const SMDS_MeshNode** nodes = isVolume ? volume.GetNodes() : faceNodes;
         if ( isVolume ) // --volume
@@ -3732,7 +3733,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
   // find indices of 2 link nodes and of the rest nodes
   int iNode = 0, il1, il2, i3, i4;
   il1 = il2 = i3 = i4 = -1;
-  const SMDS_MeshNode* nodes[ 8 ];
+  const SMDS_MeshNode* nodes[ theFace->NbNodes() ];
   SMDS_ElemIteratorPtr nodeIt = theFace->nodesIterator();
   while ( nodeIt->more() ) {
     const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
@@ -3751,11 +3752,12 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
 
   // arrange link nodes to go one after another regarding the face orientation
   bool reverse = ( Abs( il2 - il1 ) == 1 ? il2 < il1 : il1 < il2 );
+  list<const SMDS_MeshNode *> aNodesToInsert = theNodesToInsert;
   if ( reverse ) {
     iNode = il1;
     il1 = il2;
     il2 = iNode;
-    theNodesToInsert.reverse();
+    aNodesToInsert.reverse();
   }
   // check that not link nodes of a quadrangles are in good order
   int nbFaceNodes = theFace->NbNodes();
@@ -3768,7 +3770,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
   if (toCreatePoly || theFace->IsPoly()) {
 
     iNode = 0;
-    vector<const SMDS_MeshNode *> poly_nodes (nbFaceNodes + theNodesToInsert.size());
+    vector<const SMDS_MeshNode *> poly_nodes (nbFaceNodes + aNodesToInsert.size());
 
     // add nodes of face up to first node of link
     bool isFLN = false;
@@ -3782,8 +3784,8 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
     }
 
     // add nodes to insert
-    list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.begin();
-    for (; nIt != theNodesToInsert.end(); nIt++) {
+    list<const SMDS_MeshNode*>::iterator nIt = aNodesToInsert.begin();
+    for (; nIt != aNodesToInsert.end(); nIt++) {
       poly_nodes[iNode++] = *nIt;
     }
 
@@ -3811,13 +3813,13 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
     return;
   }
 
-  // put theNodesToInsert between theBetweenNode1 and theBetweenNode2
-  int nbLinkNodes = 2 + theNodesToInsert.size();
+  // put aNodesToInsert between theBetweenNode1 and theBetweenNode2
+  int nbLinkNodes = 2 + aNodesToInsert.size();
   const SMDS_MeshNode* linkNodes[ nbLinkNodes ];
   linkNodes[ 0 ] = nodes[ il1 ];
   linkNodes[ nbLinkNodes - 1 ] = nodes[ il2 ];
-  list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.begin();
-  for ( iNode = 1; nIt != theNodesToInsert.end(); nIt++ ) {
+  list<const SMDS_MeshNode*>::iterator nIt = aNodesToInsert.begin();
+  for ( iNode = 1; nIt != aNodesToInsert.end(); nIt++ ) {
     linkNodes[ iNode++ ] = *nIt;
   }
   // decide how to split a quadrangle: compare possible variants
index 638e6152b3d4b94e5bba691e4384a16eb07e14d6..beafd34e111d7a23894e00cd27544bd9e1d79ba0 100644 (file)
@@ -232,16 +232,16 @@ class SMESH_MeshEditor {
   // insert theNodesToInsert into theFace between theBetweenNode1 and theBetweenNode2.
   // If toCreatePoly is true, replace theFace by polygon, else split theFace.
 
-  static int SortQuadNodes (const SMDS_Mesh * theMesh,
-                            int               theNodeIds[] );
-  // Set 4 nodes of a quadrangle face in a good order.
-  // Swap 1<->2 or 2<->3 nodes and correspondingly return
-  // 1 or 2 else 0.
-
-  static bool SortHexaNodes (const SMDS_Mesh * theMesh,
-                             int               theNodeIds[] );
-  // Set 8 nodes of a hexahedron in a good order.
-  // Return success status
+//  static int SortQuadNodes (const SMDS_Mesh * theMesh,
+//                            int               theNodeIds[] );
+//  // Set 4 nodes of a quadrangle face in a good order.
+//  // Swap 1<->2 or 2<->3 nodes and correspondingly return
+//  // 1 or 2 else 0.
+//
+//  static bool SortHexaNodes (const SMDS_Mesh * theMesh,
+//                             int               theNodeIds[] );
+//  // Set 8 nodes of a hexahedron in a good order.
+//  // Return success status
 
   static void AddToSameGroups (const SMDS_MeshElement* elemToAdd,
                                const SMDS_MeshElement* elemInGroups,
index 5a0e1375ced6eaf9791b0b41fa18e8c7acf78258..391e7295709b5d1999c274de1f23f474382dfbcd 100644 (file)
@@ -347,7 +347,7 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
   myOk1 = myOk2 = myOk3 = myOk4 = myOk5 = myOk6 = false;
   myEditCurrentArgument = LineEdit1;
   myEditCurrentArgument->setFocus();
-  
+
   if (!TextLabel5->isEnabled())
     {
       TextLabel5->setEnabled(true);
@@ -360,10 +360,10 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
       SelectButton6->setEnabled(true);
       LineEdit6->setEnabled(true);
     }
-  
+
   if (constructorId != 0 && CheckBoxPoly->isVisible())
     CheckBoxPoly->hide();
-       
+
   switch(constructorId)
     {
     case 0 :
@@ -374,7 +374,7 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
 
         if (!CheckBoxPoly->isVisible())
           CheckBoxPoly->show();
-       
+
        break;
       }
     case 1 :
@@ -382,13 +382,13 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
        GroupArguments->setTitle( tr( "SEW_CONFORM_FREE_BORDERS" ) );
        SubGroup1->setTitle( tr( "BORDER_1" ) );
        SubGroup2->setTitle( tr( "BORDER_2" ) );
-       
+
        TextLabel6->setEnabled(false);
        SelectButton6->setEnabled(false);
        LineEdit6->setEnabled(false);
-       
+
        myOk6 = true;
-         
+
        break;
       }
     case 2 :
@@ -400,7 +400,10 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
        TextLabel5->setEnabled(false);
        SelectButton5->setEnabled(false);
        LineEdit5->setEnabled(false);
-       
+
+        if (!CheckBoxPoly->isVisible())
+          CheckBoxPoly->show();
+
        myOk5 = true;
 
        break;
@@ -410,7 +413,7 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
        GroupArguments->setTitle( tr( "SEW_SIDE_ELEMENTS" ) );
        SubGroup1->setTitle( tr( "SIDE_1" ) );
        SubGroup2->setTitle( tr( "SIDE_2" ) );
-       
+
        TextLabel1->setText( tr( "SMESH_ID_ELEMENTS" ) );
        TextLabel2->setText( tr( "NODE1_TO_MERGE" ) );
        TextLabel3->setText( tr( "NODE2_TO_MERGE" ) );
@@ -426,7 +429,7 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
        break;
       }
     }
-  
+
   if (constructorId != 3)
     {
       TextLabel1->setText( tr( "FIRST_NODE_ID" ) );
@@ -435,14 +438,14 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
       TextLabel4->setText( tr( "FIRST_NODE_ID" ) );
       TextLabel5->setText( tr( "SECOND_NODE_ID" ) );
       TextLabel6->setText( tr( "LAST_NODE_ID" ) );
-      
+
       LineEdit1->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
       LineEdit4->setValidator( new SMESHGUI_IdValidator( this, "validator", 1));
 
       SMESH::SetPointRepresentation(true);
       QAD_Application::getDesktop()->SetSelectionMode( NodeSelection, true );
     }
-  
+
   connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 }
 
@@ -490,7 +493,8 @@ bool SMESHGUI_SewingDlg::ClickOnApply()
                                                   LineEdit2->text().toLong(),
                                                   LineEdit3->text().toLong(),
                                                   LineEdit4->text().toLong(),
-                                                  LineEdit6->text().toLong());
+                                                  LineEdit6->text().toLong(),
+                                                   toCreatePoly);
          else if (aConstructorId == 3)
            {
              QStringList aListElementsId1 = QStringList::split( " ", LineEdit1->text(), false);
index d1b0e9f1dd7ef60307fa1c4deb76b89531188d0d..46ccb4b89eda6b211134fb4c30ae90b91fa7d2e4 100644 (file)
@@ -998,7 +998,8 @@ SMESH::SMESH_MeshEditor::Sew_Error
                                       CORBA::Long SecondNodeIDOnFreeBorder,
                                       CORBA::Long LastNodeIDOnFreeBorder,
                                       CORBA::Long FirstNodeIDOnSide,
-                                      CORBA::Long LastNodeIDOnSide)
+                                      CORBA::Long LastNodeIDOnSide,
+                                      CORBA::Boolean CreatePoly)
 {
   SMESHDS_Mesh* aMesh = GetMeshDS();
 
@@ -1025,7 +1026,7 @@ SMESH::SMESH_MeshEditor::Sew_Error
                                             aSide2SecondNode,
                                             aSide2ThirdNode,
                                             false,
-                                            false) );
+                                            CreatePoly) );
 }
 
 //=======================================================================
index 73e26d2ac5025069fd785115979d35dc49ebf0dc..b6aeb31913177602ad0818fb60681c28b31759db 100644 (file)
@@ -177,7 +177,8 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
                     CORBA::Long SecondNodeIDOnFreeBorder,
                     CORBA::Long LastNodeIDOnFreeBorder,
                     CORBA::Long FirstNodeIDOnSide,
-                    CORBA::Long LastNodeIDOnSide);
+                    CORBA::Long LastNodeIDOnSide,
+                    CORBA::Boolean CreatePoly);
   SMESH::SMESH_MeshEditor::Sew_Error
     SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
                     const SMESH::long_array& IDsOfSide2Elements,