From fdd333902b38d82b436f13d9d1cf3abd6d2b8488 Mon Sep 17 00:00:00 2001 From: akl Date: Tue, 27 Mar 2007 09:30:44 +0000 Subject: [PATCH] IPAL15344 (SMESH_MeshEditor.idl: signature of MergeEqualElements() was changed): restore MergeEqualElements() signature; add MergeElements(). --- src/SMESH/SMESH_MeshEditor.cxx | 23 +++++++++++++++++++---- src/SMESH/SMESH_MeshEditor.hxx | 5 ++++- src/SMESH_I/SMESH_MeshEditor_i.cxx | 24 ++++++++++++++++++++---- src/SMESH_I/SMESH_MeshEditor_i.hxx | 3 ++- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 1838b6da4..889ea2f02 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -5071,7 +5071,8 @@ class SortableElement : public set //======================================================================= //function : FindEqualElements -//purpose : +//purpose : Return list of group of elements built on the same nodes. +// Search among theElements or in the whole mesh if theElements is empty //======================================================================= void SMESH_MeshEditor::FindEqualElements(set & theElements, TListOfListOfElementsID & theGroupsOfElementsID) @@ -5128,11 +5129,11 @@ void SMESH_MeshEditor::FindEqualElements(set & theEleme } //======================================================================= -//function : MergeEqualElements -//purpose : Remove all but one of elements built on the same nodes. +//function : MergeElements +//purpose : In each given group, substitute all elements by the first one. //======================================================================= -void SMESH_MeshEditor::MergeEqualElements(TListOfListOfElementsID & theGroupsOfElementsID) +void SMESH_MeshEditor::MergeElements(TListOfListOfElementsID & theGroupsOfElementsID) { myLastCreatedElems.Clear(); myLastCreatedNodes.Clear(); @@ -5164,6 +5165,20 @@ void SMESH_MeshEditor::MergeEqualElements(TListOfListOfElementsID & theGroupsOfE Remove( rmElemIds, false ); } +//======================================================================= +//function : MergeEqualElements +//purpose : Remove all but one of elements built on the same nodes. +//======================================================================= + +void SMESH_MeshEditor::MergeEqualElements() +{ + set aMeshElements; /* empty input - + to merge equal elements in the whole mesh */ + TListOfListOfElementsID aGroupsOfElementsID; + FindEqualElements(aMeshElements, aGroupsOfElementsID); + MergeElements(aGroupsOfElementsID); +} + //======================================================================= //function : FindFaceInSet //purpose : Return a face having linked nodes n1 and n2 and which is diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index d68fca860..483c2eae9 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -322,7 +322,10 @@ public: // Return list of group of elements build on the same nodes. // Search among theElements or in the whole mesh if theElements is empty. - void MergeEqualElements(TListOfListOfElementsID & theGroupsOfElementsID); + void MergeElements(TListOfListOfElementsID & theGroupsOfElementsID); + // In each group remove all but first of elements. + + void MergeEqualElements(); // Remove all but one of elements built on the same nodes. // Return nb of successfully merged groups. diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index a545dbd20..b00c3f634 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -1932,16 +1932,16 @@ void SMESH_MeshEditor_i::FindEqualElements(SMESH::SMESH_IDSource_ptr theObj } //======================================================================= -//function : MergeEqualElements +//function : MergeElements //purpose : //======================================================================= -void SMESH_MeshEditor_i::MergeEqualElements(const SMESH::array_of_long_array& GroupsOfElementsID) +void SMESH_MeshEditor_i::MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID) { initData(); TPythonDump aTPythonDump; - aTPythonDump << this << ".MergeEqualElements( ["; + aTPythonDump << this << ".MergeElements( ["; ::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID; @@ -1960,12 +1960,28 @@ void SMESH_MeshEditor_i::MergeEqualElements(const SMESH::array_of_long_array& Gr } ::SMESH_MeshEditor anEditor( myMesh ); - anEditor.MergeEqualElements(aListOfListOfElementsID); + anEditor.MergeElements(aListOfListOfElementsID); // Update Python script aTPythonDump << "] )"; } +//======================================================================= +//function : MergeEqualElements +//purpose : +//======================================================================= + +void SMESH_MeshEditor_i::MergeEqualElements() +{ + initData(); + + ::SMESH_MeshEditor anEditor( myMesh ); + anEditor.MergeEqualElements(); + + // Update Python script + TPythonDump() << this << ".MergeEqualElements()"; +} + //================================================================================ /*! * \brief If the given ID is a valid node ID (nodeID > 0), just move this node, else diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index 005395781..7e8dff39c 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -210,7 +210,8 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes); void FindEqualElements(SMESH::SMESH_IDSource_ptr theObject, SMESH::array_of_long_array_out GroupsOfElementsID); - void MergeEqualElements(const SMESH::array_of_long_array& GroupsOfElementsID); + void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID); + void MergeEqualElements(); CORBA::Long MoveClosestNodeToPoint(CORBA::Double x, CORBA::Double y, CORBA::Double z, -- 2.39.2