From bb5286e3163ad595fc320142f65b15e173eea4da Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 9 Mar 2005 12:29:09 +0000 Subject: [PATCH] Debug sewing. Enable polygons creation while sewing free border to side. --- idl/SMESH_Mesh.idl | 3 ++- src/SMESH/SMESH_MeshEditor.cxx | 32 +++++++++++++++-------------- src/SMESH/SMESH_MeshEditor.hxx | 20 +++++++++--------- src/SMESHGUI/SMESHGUI_SewingDlg.cxx | 30 +++++++++++++++------------ src/SMESH_I/SMESH_MeshEditor_i.cxx | 5 +++-- src/SMESH_I/SMESH_MeshEditor_i.hxx | 3 ++- 6 files changed, 51 insertions(+), 42 deletions(-) diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index 10debd7fd..029687e6a 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -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, diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 40aabbe55..007aac451 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -975,12 +975,12 @@ bool SMESH_MeshEditor::TriToQuad (set & 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 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( 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 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 poly_nodes (nbFaceNodes + theNodesToInsert.size()); + vector 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::iterator nIt = theNodesToInsert.begin(); - for (; nIt != theNodesToInsert.end(); nIt++) { + list::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::iterator nIt = theNodesToInsert.begin(); - for ( iNode = 1; nIt != theNodesToInsert.end(); nIt++ ) { + list::iterator nIt = aNodesToInsert.begin(); + for ( iNode = 1; nIt != aNodesToInsert.end(); nIt++ ) { linkNodes[ iNode++ ] = *nIt; } // decide how to split a quadrangle: compare possible variants diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index 638e6152b..beafd34e1 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -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, diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index 5a0e1375c..391e72957 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -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); diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index d1b0e9f1d..46ccb4b89 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -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) ); } //======================================================================= diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index 73e26d2ac..b6aeb3191 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -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, -- 2.39.2