mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-26 11:10:34 +05:00
23080: [CEA 1497] Do not merge a middle node in quadratic with the extreme nodes of a segment
This commit is contained in:
parent
fe7d1d5767
commit
b22e182dd1
BIN
doc/salome/gui/SMESH/images/mergenodes.png
Executable file → Normal file
BIN
doc/salome/gui/SMESH/images/mergenodes.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 34 KiB |
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 23 KiB |
@ -21,6 +21,10 @@ then converted to the single node.
|
|||||||
processed.
|
processed.
|
||||||
<li>\b Tolerance is a maximum distance between nodes sufficient for
|
<li>\b Tolerance is a maximum distance between nodes sufficient for
|
||||||
merging.</li>
|
merging.</li>
|
||||||
|
<li>Activation of <b>No merge of corner and medium nodes</b> check-box
|
||||||
|
prevents merging medium nodes of quadratic elements with corner
|
||||||
|
nodes. This check-box is enabled provided that the selected mesh
|
||||||
|
includes quadratic elements.</li>
|
||||||
<li><b>Exclude Groups</b> group box allows to ignore the nodes which
|
<li><b>Exclude Groups</b> group box allows to ignore the nodes which
|
||||||
belong to the specified mesh groups.
|
belong to the specified mesh groups.
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -609,41 +609,44 @@ module SMESH
|
|||||||
in AxisStruct Axis,
|
in AxisStruct Axis,
|
||||||
in double AngleInRadians,
|
in double AngleInRadians,
|
||||||
in boolean CopyGroups,
|
in boolean CopyGroups,
|
||||||
in string MeshName)
|
in string MeshName)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
void RotateObject (in SMESH_IDSource theObject,
|
void RotateObject (in SMESH_IDSource theObject,
|
||||||
in AxisStruct Axis,
|
in AxisStruct Axis,
|
||||||
in double AngleInRadians,
|
in double AngleInRadians,
|
||||||
in boolean Copy)
|
in boolean Copy)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
|
ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
|
||||||
in AxisStruct Axis,
|
in AxisStruct Axis,
|
||||||
in double AngleInRadians)
|
in double AngleInRadians)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
|
SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
|
||||||
in AxisStruct Axis,
|
in AxisStruct Axis,
|
||||||
in double AngleInRadians,
|
in double AngleInRadians,
|
||||||
in boolean CopyGroups,
|
in boolean CopyGroups,
|
||||||
in string MeshName)
|
in string MeshName)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
void FindCoincidentNodes (in double Tolerance,
|
void FindCoincidentNodes (in double Tolerance,
|
||||||
out array_of_long_array GroupsOfNodes)
|
out array_of_long_array GroupsOfNodes,
|
||||||
|
in boolean SeparateCornersAndMedium)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
void FindCoincidentNodesOnPart (in SMESH_IDSource SubMeshOrGroup,
|
void FindCoincidentNodesOnPart (in SMESH_IDSource SubMeshOrGroup,
|
||||||
in double Tolerance,
|
in double Tolerance,
|
||||||
out array_of_long_array GroupsOfNodes)
|
out array_of_long_array GroupsOfNodes,
|
||||||
|
in boolean SeparateCornersAndMedium)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
void FindCoincidentNodesOnPartBut (in SMESH_IDSource SubMeshOrGroup,
|
void FindCoincidentNodesOnPartBut (in SMESH_IDSource SubMeshOrGroup,
|
||||||
in double Tolerance,
|
in double Tolerance,
|
||||||
out array_of_long_array GroupsOfNodes,
|
out array_of_long_array GroupsOfNodes,
|
||||||
in ListOfIDSources ExceptSubMeshOrGroups)
|
in ListOfIDSources ExceptSubMeshOrGroups,
|
||||||
|
in boolean SeparateCornersAndMedium)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
void MergeNodes (in array_of_long_array GroupsOfNodes)
|
void MergeNodes (in array_of_long_array GroupsOfNodes)
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -6983,27 +6983,67 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return list of group of nodes close to each other within theTolerance
|
* * \brief Return list of group of nodes close to each other within theTolerance
|
||||||
* Search among theNodes or in the whole mesh if theNodes is empty using
|
* * Search among theNodes or in the whole mesh if theNodes is empty using
|
||||||
* an Octree algorithm
|
* * an Octree algorithm
|
||||||
|
* \param [in,out] theNodes - the nodes to treat
|
||||||
|
* \param [in] theTolerance - the tolerance
|
||||||
|
* \param [out] theGroupsOfNodes - the result groups of coincident nodes
|
||||||
|
* \param [in] theSeparateCornersAndMedium - if \c true, in quadratic mesh puts
|
||||||
|
* corner and medium nodes in separate groups
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void SMESH_MeshEditor::FindCoincidentNodes (TIDSortedNodeSet & theNodes,
|
void SMESH_MeshEditor::FindCoincidentNodes (TIDSortedNodeSet & theNodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
TListOfListOfNodes & theGroupsOfNodes)
|
TListOfListOfNodes & theGroupsOfNodes,
|
||||||
|
bool theSeparateCornersAndMedium)
|
||||||
{
|
{
|
||||||
myLastCreatedElems.Clear();
|
myLastCreatedElems.Clear();
|
||||||
myLastCreatedNodes.Clear();
|
myLastCreatedNodes.Clear();
|
||||||
|
|
||||||
if ( theNodes.empty() )
|
if ( myMesh->NbEdges ( ORDER_QUADRATIC ) +
|
||||||
{ // get all nodes in the mesh
|
myMesh->NbFaces ( ORDER_QUADRATIC ) +
|
||||||
|
myMesh->NbVolumes( ORDER_QUADRATIC ) == 0 )
|
||||||
|
theSeparateCornersAndMedium = false;
|
||||||
|
|
||||||
|
TIDSortedNodeSet& corners = theNodes;
|
||||||
|
TIDSortedNodeSet medium;
|
||||||
|
|
||||||
|
if ( theNodes.empty() ) // get all nodes in the mesh
|
||||||
|
{
|
||||||
|
TIDSortedNodeSet* nodes[2] = { &corners, &medium };
|
||||||
SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator(/*idInceasingOrder=*/true);
|
SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator(/*idInceasingOrder=*/true);
|
||||||
while ( nIt->more() )
|
if ( theSeparateCornersAndMedium )
|
||||||
theNodes.insert( theNodes.end(),nIt->next());
|
while ( nIt->more() )
|
||||||
|
{
|
||||||
|
const SMDS_MeshNode* n = nIt->next();
|
||||||
|
TIDSortedNodeSet* & nodeSet = nodes[ SMESH_MesherHelper::IsMedium( n )];
|
||||||
|
nodeSet->insert( nodeSet->end(), n );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
while ( nIt->more() )
|
||||||
|
theNodes.insert( theNodes.end(),nIt->next() );
|
||||||
|
}
|
||||||
|
else if ( theSeparateCornersAndMedium ) // separate corners from medium nodes
|
||||||
|
{
|
||||||
|
TIDSortedNodeSet::iterator nIt = corners.begin();
|
||||||
|
while ( nIt != corners.end() )
|
||||||
|
if ( SMESH_MesherHelper::IsMedium( *nIt ))
|
||||||
|
{
|
||||||
|
medium.insert( medium.end(), *nIt );
|
||||||
|
corners.erase( nIt++ );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++nIt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESH_OctreeNode::FindCoincidentNodes ( theNodes, &theGroupsOfNodes, theTolerance);
|
if ( !corners.empty() )
|
||||||
|
SMESH_OctreeNode::FindCoincidentNodes ( corners, &theGroupsOfNodes, theTolerance );
|
||||||
|
if ( !medium.empty() )
|
||||||
|
SMESH_OctreeNode::FindCoincidentNodes ( medium, &theGroupsOfNodes, theTolerance );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -7763,7 +7803,7 @@ void SMESH_MeshEditor::FindEqualElements(TIDSortedElemSet & theElements,
|
|||||||
{ // get all elements in the mesh
|
{ // get all elements in the mesh
|
||||||
SMDS_ElemIteratorPtr eIt = GetMeshDS()->elementsIterator();
|
SMDS_ElemIteratorPtr eIt = GetMeshDS()->elementsIterator();
|
||||||
while ( eIt->more() )
|
while ( eIt->more() )
|
||||||
theElements.insert( theElements.end(), eIt->next());
|
theElements.insert( theElements.end(), eIt->next() );
|
||||||
}
|
}
|
||||||
|
|
||||||
vector< TGroupOfElems > arrayOfGroups;
|
vector< TGroupOfElems > arrayOfGroups;
|
||||||
@ -7771,31 +7811,32 @@ void SMESH_MeshEditor::FindEqualElements(TIDSortedElemSet & theElements,
|
|||||||
TMapOfNodeSet mapOfNodeSet;
|
TMapOfNodeSet mapOfNodeSet;
|
||||||
|
|
||||||
TIDSortedElemSet::iterator elemIt = theElements.begin();
|
TIDSortedElemSet::iterator elemIt = theElements.begin();
|
||||||
for ( int i = 0, j=0; elemIt != theElements.end(); ++elemIt, ++j ) {
|
for ( int i = 0; elemIt != theElements.end(); ++elemIt )
|
||||||
|
{
|
||||||
const SMDS_MeshElement* curElem = *elemIt;
|
const SMDS_MeshElement* curElem = *elemIt;
|
||||||
SortableElement SE(curElem);
|
SortableElement SE(curElem);
|
||||||
int ind = -1;
|
|
||||||
// check uniqueness
|
// check uniqueness
|
||||||
pair< TMapOfNodeSet::iterator, bool> pp = mapOfNodeSet.insert(make_pair(SE, i));
|
pair< TMapOfNodeSet::iterator, bool> pp = mapOfNodeSet.insert(make_pair(SE, i));
|
||||||
if( !(pp.second) ) {
|
if ( !pp.second ) { // one more coincident elem
|
||||||
TMapOfNodeSet::iterator& itSE = pp.first;
|
TMapOfNodeSet::iterator& itSE = pp.first;
|
||||||
ind = (*itSE).second;
|
int ind = (*itSE).second;
|
||||||
arrayOfGroups[ind].push_back(curElem->GetID());
|
arrayOfGroups[ind].push_back( curElem->GetID() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
groupOfElems.clear();
|
arrayOfGroups.push_back( groupOfElems );
|
||||||
groupOfElems.push_back(curElem->GetID());
|
arrayOfGroups.back().push_back( curElem->GetID() );
|
||||||
arrayOfGroups.push_back(groupOfElems);
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
groupOfElems.clear();
|
||||||
vector< TGroupOfElems >::iterator groupIt = arrayOfGroups.begin();
|
vector< TGroupOfElems >::iterator groupIt = arrayOfGroups.begin();
|
||||||
for ( ; groupIt != arrayOfGroups.end(); ++groupIt ) {
|
for ( ; groupIt != arrayOfGroups.end(); ++groupIt )
|
||||||
groupOfElems = *groupIt;
|
{
|
||||||
if ( groupOfElems.size() > 1 ) {
|
if ( groupIt->size() > 1 ) {
|
||||||
groupOfElems.sort();
|
//groupOfElems.sort(); -- theElements is sorted already
|
||||||
theGroupsOfElementsID.push_back(groupOfElems);
|
theGroupsOfElementsID.push_back( groupOfElems );
|
||||||
|
theGroupsOfElementsID.back().splice( theGroupsOfElementsID.back().end(), *groupIt );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,8 @@ public:
|
|||||||
|
|
||||||
void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
|
void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
TListOfListOfNodes & theGroupsOfNodes);
|
TListOfListOfNodes & theGroupsOfNodes,
|
||||||
|
bool theSeparateCornersAndMedium);
|
||||||
// Return list of group of nodes close to each other within theTolerance.
|
// Return list of group of nodes close to each other within theTolerance.
|
||||||
// Search among theNodes or in the whole mesh if theNodes is empty.
|
// Search among theNodes or in the whole mesh if theNodes is empty.
|
||||||
|
|
||||||
|
@ -93,6 +93,10 @@
|
|||||||
#define SPACING 6
|
#define SPACING 6
|
||||||
#define MARGIN 11
|
#define MARGIN 11
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
enum ActionType { MERGE_NODES, MERGE_ELEMENTS };
|
||||||
|
}
|
||||||
namespace SMESH
|
namespace SMESH
|
||||||
{
|
{
|
||||||
class TIdPreview
|
class TIdPreview
|
||||||
@ -307,7 +311,7 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
{
|
{
|
||||||
setModal(false);
|
setModal(false);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
setWindowTitle(myAction == 1 ? tr("SMESH_MERGE_ELEMENTS") : tr("SMESH_MERGE_NODES"));
|
setWindowTitle(myAction == MERGE_ELEMENTS ? tr("SMESH_MERGE_ELEMENTS") : tr("SMESH_MERGE_NODES"));
|
||||||
|
|
||||||
myIdPreview = new SMESH::TIdPreview(SMESH::GetViewWindow( mySMESHGUI ));
|
myIdPreview = new SMESH::TIdPreview(SMESH::GetViewWindow( mySMESHGUI ));
|
||||||
|
|
||||||
@ -325,7 +329,7 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
DlgLayout->setMargin(MARGIN);
|
DlgLayout->setMargin(MARGIN);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupConstructors = new QGroupBox(myAction == 1 ?
|
GroupConstructors = new QGroupBox(myAction == MERGE_ELEMENTS ?
|
||||||
tr("SMESH_MERGE_ELEMENTS") :
|
tr("SMESH_MERGE_ELEMENTS") :
|
||||||
tr("SMESH_MERGE_NODES"),
|
tr("SMESH_MERGE_NODES"),
|
||||||
this);
|
this);
|
||||||
@ -336,7 +340,7 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
GroupConstructorsLayout->setMargin(MARGIN);
|
GroupConstructorsLayout->setMargin(MARGIN);
|
||||||
|
|
||||||
RadioButton = new QRadioButton(GroupConstructors);
|
RadioButton = new QRadioButton(GroupConstructors);
|
||||||
RadioButton->setIcon(myAction == 1 ? IconMergeElems : IconMergeNodes);
|
RadioButton->setIcon(myAction == MERGE_ELEMENTS ? IconMergeElems : IconMergeNodes);
|
||||||
RadioButton->setChecked(true);
|
RadioButton->setChecked(true);
|
||||||
GroupConstructorsLayout->addWidget(RadioButton);
|
GroupConstructorsLayout->addWidget(RadioButton);
|
||||||
ButtonGroup->addButton(RadioButton, 0);
|
ButtonGroup->addButton(RadioButton, 0);
|
||||||
@ -378,7 +382,7 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
// Controls for coincident elements detecting
|
// Controls for coincident elements detecting
|
||||||
GroupCoincident = new QGroupBox(myAction == 1 ?
|
GroupCoincident = new QGroupBox(myAction == MERGE_ELEMENTS ?
|
||||||
tr("COINCIDENT_ELEMENTS") :
|
tr("COINCIDENT_ELEMENTS") :
|
||||||
tr("COINCIDENT_NODES"),
|
tr("COINCIDENT_NODES"),
|
||||||
this);
|
this);
|
||||||
@ -387,12 +391,16 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
aCoincidentLayout->setSpacing(SPACING);
|
aCoincidentLayout->setSpacing(SPACING);
|
||||||
aCoincidentLayout->setMargin(MARGIN);
|
aCoincidentLayout->setMargin(MARGIN);
|
||||||
|
|
||||||
if (myAction == 0) { // case merge nodes
|
if (myAction == MERGE_NODES) // case merge nodes
|
||||||
|
{
|
||||||
QWidget* foo = new QWidget(GroupCoincident);
|
QWidget* foo = new QWidget(GroupCoincident);
|
||||||
TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), foo);
|
TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), foo);
|
||||||
SpinBoxTolerance = new SMESHGUI_SpinBox(foo);
|
SpinBoxTolerance = new SMESHGUI_SpinBox(foo);
|
||||||
SpinBoxTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
SpinBoxTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||||
|
|
||||||
|
SeparateCornersAndMedium = new QCheckBox(tr("SEPARATE_CORNERS_AND_MEDIUM"), foo);
|
||||||
|
SeparateCornersAndMedium->setEnabled( false );
|
||||||
|
|
||||||
GroupExclude = new QGroupBox(tr("EXCLUDE_GROUPS"), foo);
|
GroupExclude = new QGroupBox(tr("EXCLUDE_GROUPS"), foo);
|
||||||
GroupExclude->setCheckable( true );
|
GroupExclude->setCheckable( true );
|
||||||
GroupExclude->setChecked( false );
|
GroupExclude->setChecked( false );
|
||||||
@ -405,9 +413,10 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
QGridLayout* fooLayout = new QGridLayout( foo );
|
QGridLayout* fooLayout = new QGridLayout( foo );
|
||||||
fooLayout->setSpacing(SPACING);
|
fooLayout->setSpacing(SPACING);
|
||||||
fooLayout->setMargin(0);
|
fooLayout->setMargin(0);
|
||||||
fooLayout->addWidget(TextLabelTolerance, 0, 0 );
|
fooLayout->addWidget(TextLabelTolerance, 0, 0 );
|
||||||
fooLayout->addWidget(SpinBoxTolerance, 0, 1 );
|
fooLayout->addWidget(SpinBoxTolerance, 0, 1 );
|
||||||
fooLayout->addWidget(GroupExclude, 1, 0, 1, 2 );
|
fooLayout->addWidget(SeparateCornersAndMedium, 1, 0 );
|
||||||
|
fooLayout->addWidget(GroupExclude, 2, 0, 1, 2 );
|
||||||
aCoincidentLayout->addWidget(foo);
|
aCoincidentLayout->addWidget(foo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -430,7 +439,7 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
RemoveGroupButton = new QPushButton(tr("SMESH_BUT_REMOVE"), GroupCoincidentWidget);
|
RemoveGroupButton = new QPushButton(tr("SMESH_BUT_REMOVE"), GroupCoincidentWidget);
|
||||||
|
|
||||||
SelectAllCB = new QCheckBox(tr("SELECT_ALL"), GroupCoincidentWidget);
|
SelectAllCB = new QCheckBox(tr("SELECT_ALL"), GroupCoincidentWidget);
|
||||||
ShowIDs = new QCheckBox(myAction == 1 ? tr("SHOW_ELEMS_IDS") : tr("SHOW_NODES_IDS"), GroupCoincidentWidget);
|
ShowIDs = new QCheckBox(myAction == MERGE_ELEMENTS ? tr("SHOW_ELEMS_IDS") : tr("SHOW_NODES_IDS"), GroupCoincidentWidget);
|
||||||
|
|
||||||
GroupCoincidentLayout->addWidget(ListCoincident, 0, 0, 4, 2);
|
GroupCoincidentLayout->addWidget(ListCoincident, 0, 0, 4, 2);
|
||||||
GroupCoincidentLayout->addWidget(DetectButton, 0, 2);
|
GroupCoincidentLayout->addWidget(DetectButton, 0, 2);
|
||||||
@ -501,9 +510,9 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction)
|
|||||||
DlgLayout->addWidget(GroupEdit);
|
DlgLayout->addWidget(GroupEdit);
|
||||||
DlgLayout->addWidget(GroupButtons);
|
DlgLayout->addWidget(GroupButtons);
|
||||||
|
|
||||||
GroupCoincidentWidget->setVisible( myAction != 0 );
|
GroupCoincidentWidget->setVisible( myAction != MERGE_NODES );
|
||||||
GroupCoincident->setVisible( myAction == 0 );
|
GroupCoincident ->setVisible( myAction == MERGE_NODES );
|
||||||
//if GroupExclude->setVisible( myAction == 0 );
|
//if GroupExclude->setVisible( myAction == MERGE_NODES );
|
||||||
GroupEdit->hide();
|
GroupEdit->hide();
|
||||||
|
|
||||||
this->resize(10,10);
|
this->resize(10,10);
|
||||||
@ -528,7 +537,7 @@ SMESHGUI_MergeDlg::~SMESHGUI_MergeDlg()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_MergeDlg::Init()
|
void SMESHGUI_MergeDlg::Init()
|
||||||
{
|
{
|
||||||
if (myAction == 0) {
|
if ( myAction == MERGE_NODES ) {
|
||||||
SpinBoxTolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision");
|
SpinBoxTolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision");
|
||||||
SpinBoxTolerance->SetValue(1e-05);
|
SpinBoxTolerance->SetValue(1e-05);
|
||||||
}
|
}
|
||||||
@ -578,7 +587,7 @@ void SMESHGUI_MergeDlg::Init()
|
|||||||
// Update Buttons
|
// Update Buttons
|
||||||
updateControls();
|
updateControls();
|
||||||
|
|
||||||
if (myAction == 0)
|
if ( myAction == MERGE_NODES )
|
||||||
myHelpFileName = "merging_nodes_page.html";
|
myHelpFileName = "merging_nodes_page.html";
|
||||||
else
|
else
|
||||||
myHelpFileName = "merging_elements_page.html";
|
myHelpFileName = "merging_elements_page.html";
|
||||||
@ -639,7 +648,7 @@ bool SMESHGUI_MergeDlg::ClickOnApply()
|
|||||||
SMESH::array_of_long_array_var aGroupsOfElements = new SMESH::array_of_long_array;
|
SMESH::array_of_long_array_var aGroupsOfElements = new SMESH::array_of_long_array;
|
||||||
|
|
||||||
if ( ListCoincident->count() == 0) {
|
if ( ListCoincident->count() == 0) {
|
||||||
if (myAction == 0)
|
if ( myAction == MERGE_NODES )
|
||||||
SUIT_MessageBox::warning(this,
|
SUIT_MessageBox::warning(this,
|
||||||
tr("SMESH_WARNING"),
|
tr("SMESH_WARNING"),
|
||||||
tr("SMESH_NO_NODES_DETECTED"));
|
tr("SMESH_NO_NODES_DETECTED"));
|
||||||
@ -663,13 +672,13 @@ bool SMESHGUI_MergeDlg::ClickOnApply()
|
|||||||
aGroupsOfElements[anArrayNum++] = anIds.inout();
|
aGroupsOfElements[anArrayNum++] = anIds.inout();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( myAction == 0 )
|
if( myAction == MERGE_NODES )
|
||||||
aMeshEditor->MergeNodes (aGroupsOfElements.inout());
|
aMeshEditor->MergeNodes (aGroupsOfElements.inout());
|
||||||
else
|
else
|
||||||
aMeshEditor->MergeElements (aGroupsOfElements.inout());
|
aMeshEditor->MergeElements (aGroupsOfElements.inout());
|
||||||
|
|
||||||
if ( myTypeId == 0 ) {
|
if ( myTypeId == 0 ) {
|
||||||
if (myAction == 0 )
|
if (myAction == MERGE_NODES )
|
||||||
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INFORMATION"),
|
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INFORMATION"),
|
||||||
tr("SMESH_MERGED_NODES").arg(QString::number(ListCoincident->count()).toLatin1().data()));
|
tr("SMESH_MERGED_NODES").arg(QString::number(ListCoincident->count()).toLatin1().data()));
|
||||||
else
|
else
|
||||||
@ -805,6 +814,16 @@ void SMESHGUI_MergeDlg::updateControls()
|
|||||||
buttonOk->setEnabled(enable);
|
buttonOk->setEnabled(enable);
|
||||||
buttonApply->setEnabled(enable);
|
buttonApply->setEnabled(enable);
|
||||||
DetectButton->setEnabled( !myMesh->_is_nil() );
|
DetectButton->setEnabled( !myMesh->_is_nil() );
|
||||||
|
|
||||||
|
if ( myAction == MERGE_NODES )
|
||||||
|
{
|
||||||
|
bool has2ndOrder = (( !myMesh->_is_nil() ) &&
|
||||||
|
( myMesh->NbEdgesOfOrder( SMESH::ORDER_QUADRATIC ) > 0 ||
|
||||||
|
myMesh->NbFacesOfOrder( SMESH::ORDER_QUADRATIC ) > 0 ||
|
||||||
|
myMesh->NbVolumesOfOrder( SMESH::ORDER_QUADRATIC ) > 0 ));
|
||||||
|
|
||||||
|
SeparateCornersAndMedium->setEnabled( has2ndOrder );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -831,7 +850,7 @@ void SMESHGUI_MergeDlg::onDetect()
|
|||||||
else src = SMESH::SMESH_IDSource::_duplicate( mySubMeshOrGroup );
|
else src = SMESH::SMESH_IDSource::_duplicate( mySubMeshOrGroup );
|
||||||
|
|
||||||
switch (myAction) {
|
switch (myAction) {
|
||||||
case 0 :
|
case MERGE_NODES :
|
||||||
for ( int i = 0; GroupExclude->isChecked() && i < ListExclude->count(); i++ ) {
|
for ( int i = 0; GroupExclude->isChecked() && i < ListExclude->count(); i++ ) {
|
||||||
if ( ListExclude->item( i )->checkState() == Qt::Checked ) {
|
if ( ListExclude->item( i )->checkState() == Qt::Checked ) {
|
||||||
aExcludeGroups->length( aExcludeGroups->length()+1 );
|
aExcludeGroups->length( aExcludeGroups->length()+1 );
|
||||||
@ -841,9 +860,11 @@ void SMESHGUI_MergeDlg::onDetect()
|
|||||||
aMeshEditor->FindCoincidentNodesOnPartBut(src.in(),
|
aMeshEditor->FindCoincidentNodesOnPartBut(src.in(),
|
||||||
SpinBoxTolerance->GetValue(),
|
SpinBoxTolerance->GetValue(),
|
||||||
aGroupsArray.out(),
|
aGroupsArray.out(),
|
||||||
aExcludeGroups.in());
|
aExcludeGroups.in(),
|
||||||
|
SeparateCornersAndMedium->isEnabled() &&
|
||||||
|
SeparateCornersAndMedium->isChecked());
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case MERGE_ELEMENTS :
|
||||||
aMeshEditor->FindEqualElements(src.in(), aGroupsArray.out());
|
aMeshEditor->FindEqualElements(src.in(), aGroupsArray.out());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -906,7 +927,7 @@ void SMESHGUI_MergeDlg::onSelectGroup()
|
|||||||
mySelectionMgr->setSelectedObjects(aList,false);
|
mySelectionMgr->setSelectedObjects(aList,false);
|
||||||
|
|
||||||
if (ShowIDs->isChecked())
|
if (ShowIDs->isChecked())
|
||||||
if (myAction == 0) {
|
if ( myAction == MERGE_NODES ) {
|
||||||
myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices);
|
myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices);
|
||||||
myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility());
|
myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility());
|
||||||
}
|
}
|
||||||
@ -959,7 +980,7 @@ void SMESHGUI_MergeDlg::onSelectElementFromGroup()
|
|||||||
mySelectionMgr->setSelectedObjects(aList);
|
mySelectionMgr->setSelectedObjects(aList);
|
||||||
|
|
||||||
if (ShowIDs->isChecked())
|
if (ShowIDs->isChecked())
|
||||||
if (myAction == 0) {
|
if (myAction == MERGE_NODES) {
|
||||||
myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices);
|
myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices);
|
||||||
myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility());
|
myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility());
|
||||||
}
|
}
|
||||||
@ -1187,13 +1208,13 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
|
|||||||
if ( myActor && myTypeId == 1 && mySelector->IsSelectionEnabled() ) {
|
if ( myActor && myTypeId == 1 && mySelector->IsSelectionEnabled() ) {
|
||||||
mySubMeshOrGroup = SMESH::SMESH_IDSource::_nil();
|
mySubMeshOrGroup = SMESH::SMESH_IDSource::_nil();
|
||||||
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
|
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
|
||||||
|
|
||||||
if ((!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil() || //SUBMESH OR GROUP
|
if ((!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil() || //SUBMESH OR GROUP
|
||||||
!SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO)->_is_nil()) &&
|
!SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO)->_is_nil()) &&
|
||||||
!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
||||||
mySubMeshOrGroup = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
mySubMeshOrGroup = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||||
|
|
||||||
if (myAction == 0) {
|
if (myAction == MERGE_NODES) {
|
||||||
SMESH::SetPointRepresentation(true);
|
SMESH::SetPointRepresentation(true);
|
||||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
aViewWindow->SetSelectionMode(NodeSelection);
|
aViewWindow->SetSelectionMode(NodeSelection);
|
||||||
@ -1204,7 +1225,7 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// process groups
|
// process groups
|
||||||
if ( myAction == 0 && !myMesh->_is_nil() && myEntry != aCurrentEntry ) {
|
if ( myAction == MERGE_NODES && !myMesh->_is_nil() && myEntry != aCurrentEntry ) {
|
||||||
myGroups.clear();
|
myGroups.clear();
|
||||||
ListExclude->clear();
|
ListExclude->clear();
|
||||||
SMESH::ListOfGroups_var aListOfGroups = myMesh->GetGroups();
|
SMESH::ListOfGroups_var aListOfGroups = myMesh->GetGroups();
|
||||||
@ -1317,7 +1338,7 @@ void SMESHGUI_MergeDlg::onTypeChanged (int id)
|
|||||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
aViewWindow->SetSelectionMode(ActorSelection);
|
aViewWindow->SetSelectionMode(ActorSelection);
|
||||||
mySelectionMgr->clearFilters();
|
mySelectionMgr->clearFilters();
|
||||||
if (myAction == 0)
|
if (myAction == MERGE_NODES)
|
||||||
GroupCoincidentWidget->hide();
|
GroupCoincidentWidget->hide();
|
||||||
else
|
else
|
||||||
GroupCoincident->hide();
|
GroupCoincident->hide();
|
||||||
@ -1338,7 +1359,7 @@ void SMESHGUI_MergeDlg::onTypeChanged (int id)
|
|||||||
myMeshOrSubMeshOrGroupFilter =
|
myMeshOrSubMeshOrGroupFilter =
|
||||||
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
|
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
|
||||||
|
|
||||||
if (myAction == 0) {
|
if (myAction == MERGE_NODES) {
|
||||||
GroupCoincidentWidget->show();
|
GroupCoincidentWidget->show();
|
||||||
SMESH::SetPointRepresentation(true);
|
SMESH::SetPointRepresentation(true);
|
||||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
|
@ -125,6 +125,7 @@ private:
|
|||||||
QWidget* GroupCoincidentWidget;
|
QWidget* GroupCoincidentWidget;
|
||||||
QLabel* TextLabelTolerance;
|
QLabel* TextLabelTolerance;
|
||||||
SMESHGUI_SpinBox* SpinBoxTolerance;
|
SMESHGUI_SpinBox* SpinBoxTolerance;
|
||||||
|
QCheckBox* SeparateCornersAndMedium;
|
||||||
QPushButton* DetectButton;
|
QPushButton* DetectButton;
|
||||||
QListWidget* ListCoincident;
|
QListWidget* ListCoincident;
|
||||||
QPushButton* AddGroupButton;
|
QPushButton* AddGroupButton;
|
||||||
|
@ -5100,6 +5100,10 @@ Please select a group and try again</translation>
|
|||||||
<source>EXCLUDE_GROUPS</source>
|
<source>EXCLUDE_GROUPS</source>
|
||||||
<translation>Exclude Groups</translation>
|
<translation>Exclude Groups</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SEPARATE_CORNERS_AND_MEDIUM</source>
|
||||||
|
<translation>No merge of corner and medium nodes</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SMESHGUI_ExtrusionAlongPathDlg</name>
|
<name>SMESHGUI_ExtrusionAlongPathDlg</name>
|
||||||
|
@ -275,42 +275,33 @@ void SMESH_OctreeNode::FindCoincidentNodes (TIDSortedNodeSet& theSetOfNodes,
|
|||||||
* \param theGroupsOfNodes - list of nodes closed to each other returned
|
* \param theGroupsOfNodes - list of nodes closed to each other returned
|
||||||
*/
|
*/
|
||||||
//=============================
|
//=============================
|
||||||
void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet* theSetOfNodes,
|
void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet* theSetOfNodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes)
|
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes)
|
||||||
{
|
{
|
||||||
TIDSortedNodeSet::iterator it1 = theSetOfNodes->begin();
|
TIDSortedNodeSet::iterator it1 = theSetOfNodes->begin();
|
||||||
list<const SMDS_MeshNode*>::iterator it2;
|
list<const SMDS_MeshNode*>::iterator it2;
|
||||||
|
|
||||||
|
list<const SMDS_MeshNode*> ListOfCoincidentNodes;
|
||||||
|
TIDCompare idLess;
|
||||||
|
|
||||||
while (it1 != theSetOfNodes->end())
|
while (it1 != theSetOfNodes->end())
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode * n1 = *it1;
|
const SMDS_MeshNode * n1 = *it1;
|
||||||
|
|
||||||
list<const SMDS_MeshNode*> ListOfCoincidentNodes;// Initialize the lists via a declaration, it's enough
|
|
||||||
|
|
||||||
list<const SMDS_MeshNode*> * groupPtr = 0;
|
|
||||||
|
|
||||||
// Searching for Nodes around n1 and put them in ListofCoincidentNodes.
|
// Searching for Nodes around n1 and put them in ListofCoincidentNodes.
|
||||||
// Found nodes are also erased from theSetOfNodes
|
// Found nodes are also erased from theSetOfNodes
|
||||||
FindCoincidentNodes(n1, theSetOfNodes, &ListOfCoincidentNodes, theTolerance);
|
FindCoincidentNodes(n1, theSetOfNodes, &ListOfCoincidentNodes, theTolerance);
|
||||||
|
|
||||||
// We build a list {n1 + his neigbours} and add this list in theGroupsOfNodes
|
if ( !ListOfCoincidentNodes.empty() )
|
||||||
for (it2 = ListOfCoincidentNodes.begin(); it2 != ListOfCoincidentNodes.end(); it2++)
|
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* n2 = *it2;
|
// We build a list {n1 + his neigbours} and add this list in theGroupsOfNodes
|
||||||
if ( !groupPtr )
|
if ( idLess( n1, ListOfCoincidentNodes.front() )) ListOfCoincidentNodes.push_front( n1 );
|
||||||
{
|
else ListOfCoincidentNodes.push_back ( n1 );
|
||||||
theGroupsOfNodes->push_back( list<const SMDS_MeshNode*>() );
|
ListOfCoincidentNodes.sort( idLess );
|
||||||
groupPtr = & theGroupsOfNodes->back();
|
theGroupsOfNodes->push_back( list<const SMDS_MeshNode*>() );
|
||||||
groupPtr->push_back( n1 );
|
theGroupsOfNodes->back().splice( theGroupsOfNodes->back().end(), ListOfCoincidentNodes );
|
||||||
}
|
|
||||||
if (groupPtr->front() > n2)
|
|
||||||
groupPtr->push_front( n2 );
|
|
||||||
else
|
|
||||||
groupPtr->push_back( n2 );
|
|
||||||
}
|
}
|
||||||
if (groupPtr != 0)
|
|
||||||
groupPtr->sort();
|
|
||||||
|
|
||||||
theSetOfNodes->erase(it1);
|
theSetOfNodes->erase(it1);
|
||||||
it1 = theSetOfNodes->begin();
|
it1 = theSetOfNodes->begin();
|
||||||
|
@ -2632,11 +2632,12 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
|
|||||||
} // if an IDSource is a mesh
|
} // if an IDSource is a mesh
|
||||||
} //meshes loop
|
} //meshes loop
|
||||||
|
|
||||||
if (theMergeNodesAndElements) {
|
if (theMergeNodesAndElements) // merge nodes
|
||||||
// merge nodes
|
{
|
||||||
TIDSortedNodeSet aMeshNodes; // no input nodes
|
TIDSortedNodeSet aMeshNodes; // no input nodes
|
||||||
SMESH_MeshEditor::TListOfListOfNodes aGroupsOfNodes;
|
SMESH_MeshEditor::TListOfListOfNodes aGroupsOfNodes;
|
||||||
aNewEditor.FindCoincidentNodes( aMeshNodes, theMergeTolerance, aGroupsOfNodes );
|
aNewEditor.FindCoincidentNodes( aMeshNodes, theMergeTolerance, aGroupsOfNodes,
|
||||||
|
/*SeparateCornersAndMedium=*/ false );
|
||||||
aNewEditor.MergeNodes( aGroupsOfNodes );
|
aNewEditor.MergeNodes( aGroupsOfNodes );
|
||||||
// merge elements
|
// merge elements
|
||||||
aNewEditor.MergeEqualElements();
|
aNewEditor.MergeEqualElements();
|
||||||
|
@ -3952,57 +3952,18 @@ SMESH_MeshEditor_i::ScaleMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : FindCoincidentNodes
|
//function : findCoincidentNodes
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double Tolerance,
|
void SMESH_MeshEditor_i::
|
||||||
SMESH::array_of_long_array_out GroupsOfNodes)
|
findCoincidentNodes (TIDSortedNodeSet & Nodes,
|
||||||
throw (SALOME::SALOME_Exception)
|
CORBA::Double Tolerance,
|
||||||
|
SMESH::array_of_long_array_out GroupsOfNodes,
|
||||||
|
CORBA::Boolean SeparateCornersAndMedium)
|
||||||
{
|
{
|
||||||
SMESH_TRY;
|
|
||||||
initData();
|
|
||||||
|
|
||||||
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
|
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
|
||||||
TIDSortedNodeSet nodes; // no input nodes
|
getEditor().FindCoincidentNodes( Nodes, Tolerance, aListOfListOfNodes, SeparateCornersAndMedium );
|
||||||
getEditor().FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
|
|
||||||
|
|
||||||
GroupsOfNodes = new SMESH::array_of_long_array;
|
|
||||||
GroupsOfNodes->length( aListOfListOfNodes.size() );
|
|
||||||
::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
|
|
||||||
for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ ) {
|
|
||||||
list< const SMDS_MeshNode* >& aListOfNodes = *llIt;
|
|
||||||
list< const SMDS_MeshNode* >::iterator lIt = aListOfNodes.begin();;
|
|
||||||
SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
|
|
||||||
aGroup.length( aListOfNodes.size() );
|
|
||||||
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
|
|
||||||
aGroup[ j ] = (*lIt)->GetID();
|
|
||||||
}
|
|
||||||
TPythonDump() << "coincident_nodes = " << this << ".FindCoincidentNodes( "
|
|
||||||
<< Tolerance << " )";
|
|
||||||
|
|
||||||
SMESH_CATCH( SMESH::throwCorbaException );
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : FindCoincidentNodesOnPart
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void SMESH_MeshEditor_i::FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr theObject,
|
|
||||||
CORBA::Double Tolerance,
|
|
||||||
SMESH::array_of_long_array_out GroupsOfNodes)
|
|
||||||
throw (SALOME::SALOME_Exception)
|
|
||||||
{
|
|
||||||
SMESH_TRY;
|
|
||||||
initData();
|
|
||||||
|
|
||||||
TIDSortedNodeSet nodes;
|
|
||||||
idSourceToNodeSet( theObject, getMeshDS(), nodes );
|
|
||||||
|
|
||||||
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
|
|
||||||
if(!nodes.empty())
|
|
||||||
getEditor().FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
|
|
||||||
|
|
||||||
GroupsOfNodes = new SMESH::array_of_long_array;
|
GroupsOfNodes = new SMESH::array_of_long_array;
|
||||||
GroupsOfNodes->length( aListOfListOfNodes.size() );
|
GroupsOfNodes->length( aListOfListOfNodes.size() );
|
||||||
@ -4016,9 +3977,56 @@ void SMESH_MeshEditor_i::FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr
|
|||||||
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
|
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
|
||||||
aGroup[ j ] = (*lIt)->GetID();
|
aGroup[ j ] = (*lIt)->GetID();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FindCoincidentNodes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void SMESH_MeshEditor_i::
|
||||||
|
FindCoincidentNodes (CORBA::Double Tolerance,
|
||||||
|
SMESH::array_of_long_array_out GroupsOfNodes,
|
||||||
|
CORBA::Boolean SeparateCornersAndMedium)
|
||||||
|
throw (SALOME::SALOME_Exception)
|
||||||
|
{
|
||||||
|
SMESH_TRY;
|
||||||
|
initData();
|
||||||
|
|
||||||
|
TIDSortedNodeSet nodes; // no input nodes
|
||||||
|
findCoincidentNodes( nodes, Tolerance, GroupsOfNodes, SeparateCornersAndMedium );
|
||||||
|
|
||||||
|
TPythonDump() << "coincident_nodes = " << this << ".FindCoincidentNodes( "
|
||||||
|
<< Tolerance << ", "
|
||||||
|
<< SeparateCornersAndMedium << " )";
|
||||||
|
|
||||||
|
SMESH_CATCH( SMESH::throwCorbaException );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FindCoincidentNodesOnPart
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void SMESH_MeshEditor_i::
|
||||||
|
FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr theObject,
|
||||||
|
CORBA::Double Tolerance,
|
||||||
|
SMESH::array_of_long_array_out GroupsOfNodes,
|
||||||
|
CORBA::Boolean SeparateCornersAndMedium)
|
||||||
|
throw (SALOME::SALOME_Exception)
|
||||||
|
{
|
||||||
|
SMESH_TRY;
|
||||||
|
initData();
|
||||||
|
|
||||||
|
TIDSortedNodeSet nodes;
|
||||||
|
idSourceToNodeSet( theObject, getMeshDS(), nodes );
|
||||||
|
|
||||||
|
findCoincidentNodes( nodes, Tolerance, GroupsOfNodes, SeparateCornersAndMedium );
|
||||||
|
|
||||||
TPythonDump() << "coincident_nodes_on_part = " << this << ".FindCoincidentNodesOnPart( "
|
TPythonDump() << "coincident_nodes_on_part = " << this << ".FindCoincidentNodesOnPart( "
|
||||||
<<theObject<<", "
|
<< theObject <<", "
|
||||||
<< Tolerance << " )";
|
<< Tolerance << ", "
|
||||||
|
<< SeparateCornersAndMedium << " )";
|
||||||
|
|
||||||
SMESH_CATCH( SMESH::throwCorbaException );
|
SMESH_CATCH( SMESH::throwCorbaException );
|
||||||
}
|
}
|
||||||
@ -4034,7 +4042,8 @@ void SMESH_MeshEditor_i::
|
|||||||
FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr theObject,
|
FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr theObject,
|
||||||
CORBA::Double theTolerance,
|
CORBA::Double theTolerance,
|
||||||
SMESH::array_of_long_array_out theGroupsOfNodes,
|
SMESH::array_of_long_array_out theGroupsOfNodes,
|
||||||
const SMESH::ListOfIDSources& theExceptSubMeshOrGroups)
|
const SMESH::ListOfIDSources& theExceptSubMeshOrGroups,
|
||||||
|
CORBA::Boolean theSeparateCornersAndMedium)
|
||||||
throw (SALOME::SALOME_Exception)
|
throw (SALOME::SALOME_Exception)
|
||||||
{
|
{
|
||||||
SMESH_TRY;
|
SMESH_TRY;
|
||||||
@ -4045,32 +4054,18 @@ FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
|
|
||||||
for ( int i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
|
for ( int i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
|
||||||
{
|
{
|
||||||
TIDSortedNodeSet exceptNodes;
|
SMDS_ElemIteratorPtr nodeIt = myMesh_i->GetElements( theExceptSubMeshOrGroups[i],
|
||||||
idSourceToNodeSet( theExceptSubMeshOrGroups[i], getMeshDS(), exceptNodes );
|
SMESH::NODE );
|
||||||
TIDSortedNodeSet::iterator avoidNode = exceptNodes.begin();
|
while ( nodeIt->more() )
|
||||||
for ( ; avoidNode != exceptNodes.end(); ++avoidNode)
|
nodes.erase( cast2Node( nodeIt->next() ));
|
||||||
nodes.erase( *avoidNode );
|
|
||||||
}
|
}
|
||||||
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
|
findCoincidentNodes( nodes, theTolerance, theGroupsOfNodes, theSeparateCornersAndMedium );
|
||||||
if(!nodes.empty())
|
|
||||||
getEditor().FindCoincidentNodes( nodes, theTolerance, aListOfListOfNodes );
|
|
||||||
|
|
||||||
theGroupsOfNodes = new SMESH::array_of_long_array;
|
|
||||||
theGroupsOfNodes->length( aListOfListOfNodes.size() );
|
|
||||||
::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
|
|
||||||
for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ )
|
|
||||||
{
|
|
||||||
list< const SMDS_MeshNode* >& aListOfNodes = *llIt;
|
|
||||||
list< const SMDS_MeshNode* >::iterator lIt = aListOfNodes.begin();;
|
|
||||||
SMESH::long_array& aGroup = (*theGroupsOfNodes)[ i ];
|
|
||||||
aGroup.length( aListOfNodes.size() );
|
|
||||||
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
|
|
||||||
aGroup[ j ] = (*lIt)->GetID();
|
|
||||||
}
|
|
||||||
TPythonDump() << "coincident_nodes_on_part = " << this << ".FindCoincidentNodesOnPartBut( "
|
TPythonDump() << "coincident_nodes_on_part = " << this << ".FindCoincidentNodesOnPartBut( "
|
||||||
<< theObject<<", "
|
<< theObject<<", "
|
||||||
<< theTolerance << ", "
|
<< theTolerance << ", "
|
||||||
<< theExceptSubMeshOrGroups << " )";
|
<< theExceptSubMeshOrGroups << ", "
|
||||||
|
<< theSeparateCornersAndMedium << " )";
|
||||||
|
|
||||||
SMESH_CATCH( SMESH::throwCorbaException );
|
SMESH_CATCH( SMESH::throwCorbaException );
|
||||||
}
|
}
|
||||||
|
@ -472,16 +472,19 @@ public:
|
|||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
void FindCoincidentNodes (CORBA::Double Tolerance,
|
void FindCoincidentNodes (CORBA::Double Tolerance,
|
||||||
SMESH::array_of_long_array_out GroupsOfNodes)
|
SMESH::array_of_long_array_out GroupsOfNodes,
|
||||||
|
CORBA::Boolean SeparateCornersAndMedium)
|
||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
|
void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
|
||||||
CORBA::Double Tolerance,
|
CORBA::Double Tolerance,
|
||||||
SMESH::array_of_long_array_out GroupsOfNodes)
|
SMESH::array_of_long_array_out GroupsOfNodes,
|
||||||
|
CORBA::Boolean SeparateCornersAndMedium)
|
||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr Object,
|
void FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr Object,
|
||||||
CORBA::Double Tolerance,
|
CORBA::Double Tolerance,
|
||||||
SMESH::array_of_long_array_out GroupsOfNodes,
|
SMESH::array_of_long_array_out GroupsOfNodes,
|
||||||
const SMESH::ListOfIDSources& ExceptSubMeshOrGroups)
|
const SMESH::ListOfIDSources& ExceptSubMeshOrGroups,
|
||||||
|
CORBA::Boolean SeparateCornersAndMedium)
|
||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes)
|
void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes)
|
||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
@ -903,6 +906,12 @@ private: //!< private methods
|
|||||||
const bool emptyIfIsMesh = false,
|
const bool emptyIfIsMesh = false,
|
||||||
IDSource_Error* error = 0);
|
IDSource_Error* error = 0);
|
||||||
|
|
||||||
|
void findCoincidentNodes( TIDSortedNodeSet & Nodes,
|
||||||
|
CORBA::Double Tolerance,
|
||||||
|
SMESH::array_of_long_array_out GroupsOfNodes,
|
||||||
|
CORBA::Boolean SeparateCornersAndMedium);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private: //!< fields
|
private: //!< fields
|
||||||
|
|
||||||
|
@ -4299,31 +4299,39 @@ class Mesh:
|
|||||||
|
|
||||||
## Finds groups of adjacent nodes within Tolerance.
|
## Finds groups of adjacent nodes within Tolerance.
|
||||||
# @param Tolerance the value of tolerance
|
# @param Tolerance the value of tolerance
|
||||||
# @return the list of pairs of nodes IDs (e.g. [[1,12],[25,4]])
|
# @param SeparateCornerAndMediumNodes if @c True, in quadratic mesh puts
|
||||||
|
# corner and medium nodes in separate groups thus preventing
|
||||||
|
# their further merge.
|
||||||
|
# @return the list of groups of nodes IDs (e.g. [[1,12,13],[4,25]])
|
||||||
# @ingroup l2_modif_trsf
|
# @ingroup l2_modif_trsf
|
||||||
def FindCoincidentNodes (self, Tolerance):
|
def FindCoincidentNodes (self, Tolerance, SeparateCornerAndMediumNodes=False):
|
||||||
return self.editor.FindCoincidentNodes(Tolerance)
|
return self.editor.FindCoincidentNodes( Tolerance, SeparateCornerAndMediumNodes )
|
||||||
|
|
||||||
## Finds groups of ajacent nodes within Tolerance.
|
## Finds groups of ajacent nodes within Tolerance.
|
||||||
# @param Tolerance the value of tolerance
|
# @param Tolerance the value of tolerance
|
||||||
# @param SubMeshOrGroup SubMesh or Group
|
# @param SubMeshOrGroup SubMesh or Group
|
||||||
# @param exceptNodes list of either SubMeshes, Groups or node IDs to exclude from search
|
# @param exceptNodes list of either SubMeshes, Groups or node IDs to exclude from search
|
||||||
# @return the list of pairs of nodes IDs (e.g. [[1,12],[25,4]])
|
# @param SeparateCornerAndMediumNodes if @c True, in quadratic mesh puts
|
||||||
|
# corner and medium nodes in separate groups thus preventing
|
||||||
|
# their further merge.
|
||||||
|
# @return the list of groups of nodes IDs (e.g. [[1,12,13],[4,25]])
|
||||||
# @ingroup l2_modif_trsf
|
# @ingroup l2_modif_trsf
|
||||||
def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance, exceptNodes=[]):
|
def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance,
|
||||||
|
exceptNodes=[], SeparateCornerAndMediumNodes=False):
|
||||||
unRegister = genObjUnRegister()
|
unRegister = genObjUnRegister()
|
||||||
if (isinstance( SubMeshOrGroup, Mesh )):
|
if (isinstance( SubMeshOrGroup, Mesh )):
|
||||||
SubMeshOrGroup = SubMeshOrGroup.GetMesh()
|
SubMeshOrGroup = SubMeshOrGroup.GetMesh()
|
||||||
if not isinstance( exceptNodes, list):
|
if not isinstance( exceptNodes, list ):
|
||||||
exceptNodes = [ exceptNodes ]
|
exceptNodes = [ exceptNodes ]
|
||||||
if exceptNodes and isinstance( exceptNodes[0], int):
|
if exceptNodes and isinstance( exceptNodes[0], int ):
|
||||||
exceptNodes = [ self.GetIDSource( exceptNodes, SMESH.NODE)]
|
exceptNodes = [ self.GetIDSource( exceptNodes, SMESH.NODE )]
|
||||||
unRegister.set( exceptNodes )
|
unRegister.set( exceptNodes )
|
||||||
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes)
|
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,
|
||||||
|
exceptNodes, SeparateCornerAndMediumNodes)
|
||||||
|
|
||||||
## Merges nodes
|
## Merges nodes
|
||||||
# @param GroupsOfNodes a list of pairs of nodes IDs for merging
|
# @param GroupsOfNodes a list of groups of nodes IDs for merging
|
||||||
# (e.g. [[1,12],[25,4]], then nodes 12 and 4 will be removed and replaced
|
# (e.g. [[1,12,13],[25,4]], then nodes 12, 13 and 4 will be removed and replaced
|
||||||
# by nodes 1 and 25 correspondingly in all elements and groups
|
# by nodes 1 and 25 correspondingly in all elements and groups
|
||||||
# @ingroup l2_modif_trsf
|
# @ingroup l2_modif_trsf
|
||||||
def MergeNodes (self, GroupsOfNodes):
|
def MergeNodes (self, GroupsOfNodes):
|
||||||
@ -4331,7 +4339,7 @@ class Mesh:
|
|||||||
|
|
||||||
## Finds the elements built on the same nodes.
|
## Finds the elements built on the same nodes.
|
||||||
# @param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching
|
# @param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching
|
||||||
# @return the list of pairs of equal elements IDs (e.g. [[1,12],[25,4]])
|
# @return the list of groups of equal elements IDs (e.g. [[1,12,13],[4,25]])
|
||||||
# @ingroup l2_modif_trsf
|
# @ingroup l2_modif_trsf
|
||||||
def FindEqualElements (self, MeshOrSubMeshOrGroup=None):
|
def FindEqualElements (self, MeshOrSubMeshOrGroup=None):
|
||||||
if not MeshOrSubMeshOrGroup:
|
if not MeshOrSubMeshOrGroup:
|
||||||
@ -4341,8 +4349,8 @@ class Mesh:
|
|||||||
return self.editor.FindEqualElements( MeshOrSubMeshOrGroup )
|
return self.editor.FindEqualElements( MeshOrSubMeshOrGroup )
|
||||||
|
|
||||||
## Merges elements in each given group.
|
## Merges elements in each given group.
|
||||||
# @param GroupsOfElementsID a list of pairs of elements IDs for merging
|
# @param GroupsOfElementsID a list of groups of elements IDs for merging
|
||||||
# (e.g. [[1,12],[25,4]], then elements 12 and 4 will be removed and
|
# (e.g. [[1,12,13],[25,4]], then elements 12, 13 and 4 will be removed and
|
||||||
# replaced by elements 1 and 25 in all groups)
|
# replaced by elements 1 and 25 in all groups)
|
||||||
# @ingroup l2_modif_trsf
|
# @ingroup l2_modif_trsf
|
||||||
def MergeElements(self, GroupsOfElementsID):
|
def MergeElements(self, GroupsOfElementsID):
|
||||||
|
@ -592,7 +592,8 @@ namespace
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
TopoDS_Edge makeEdgeFromMA( SMESH_MesherHelper& theHelper,
|
TopoDS_Edge makeEdgeFromMA( SMESH_MesherHelper& theHelper,
|
||||||
const SMESH_MAT2d::MedialAxis& theMA )
|
const SMESH_MAT2d::MedialAxis& theMA,
|
||||||
|
const double theMinSegLen)
|
||||||
{
|
{
|
||||||
if ( theMA.nbBranches() != 1 )
|
if ( theMA.nbBranches() != 1 )
|
||||||
return TopoDS_Edge();
|
return TopoDS_Edge();
|
||||||
@ -605,14 +606,31 @@ namespace
|
|||||||
TopoDS_Face face = TopoDS::Face( theHelper.GetSubShape() );
|
TopoDS_Face face = TopoDS::Face( theHelper.GetSubShape() );
|
||||||
Handle(Geom_Surface) surface = BRep_Tool::Surface( face );
|
Handle(Geom_Surface) surface = BRep_Tool::Surface( face );
|
||||||
|
|
||||||
// cout << "from salome.geom import geomBuilder" << endl;
|
vector< gp_Pnt > pnt;
|
||||||
// cout << "geompy = geomBuilder.New(salome.myStudy)" << endl;
|
pnt.reserve( uv.size() * 2 );
|
||||||
Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, uv.size());
|
pnt.push_back( surface->Value( uv[0].X(), uv[0].Y() ));
|
||||||
for ( size_t i = 0; i < uv.size(); ++i )
|
for ( size_t i = 1; i < uv.size(); ++i )
|
||||||
{
|
{
|
||||||
gp_Pnt p = surface->Value( uv[i].X(), uv[i].Y() );
|
gp_Pnt p = surface->Value( uv[i].X(), uv[i].Y() );
|
||||||
|
int nbDiv = int( p.Distance( pnt.back() ) / theMinSegLen );
|
||||||
|
for ( int iD = 1; iD < nbDiv; ++iD )
|
||||||
|
{
|
||||||
|
double R = iD / double( nbDiv );
|
||||||
|
gp_XY uvR = uv[i-1] * (1 - R) + uv[i] * R;
|
||||||
|
pnt.push_back( surface->Value( uvR.X(), uvR.Y() ));
|
||||||
|
}
|
||||||
|
pnt.push_back( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
// cout << "from salome.geom import geomBuilder" << endl;
|
||||||
|
// cout << "geompy = geomBuilder.New(salome.myStudy)" << endl;
|
||||||
|
Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, pnt.size());
|
||||||
|
for ( size_t i = 0; i < pnt.size(); ++i )
|
||||||
|
{
|
||||||
|
gp_Pnt& p = pnt[i];
|
||||||
points->SetValue( i+1, p );
|
points->SetValue( i+1, p );
|
||||||
//cout << "geompy.MakeVertex( "<< p.X()<<", " << p.Y()<<", " << p.Z()<<" )" << endl;
|
// cout << "geompy.MakeVertex( "<< p.X()<<", " << p.Y()<<", " << p.Z()
|
||||||
|
// <<" theName = 'p_" << i << "')" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
GeomAPI_Interpolate interpol( points, /*isClosed=*/false, gp::Resolution());
|
GeomAPI_Interpolate interpol( points, /*isClosed=*/false, gp::Resolution());
|
||||||
@ -658,6 +676,7 @@ namespace
|
|||||||
const SMESH_MAT2d::MedialAxis& theMA,
|
const SMESH_MAT2d::MedialAxis& theMA,
|
||||||
const SinuousFace& theSinuFace,
|
const SinuousFace& theSinuFace,
|
||||||
SMESH_Algo* the1dAlgo,
|
SMESH_Algo* the1dAlgo,
|
||||||
|
const double theMinSegLen,
|
||||||
vector<double>& theMAParams )
|
vector<double>& theMAParams )
|
||||||
{
|
{
|
||||||
// check if all EDGEs of one size are meshed, then MA discretization is not needed
|
// check if all EDGEs of one size are meshed, then MA discretization is not needed
|
||||||
@ -674,7 +693,7 @@ namespace
|
|||||||
return true; // discretization is not needed
|
return true; // discretization is not needed
|
||||||
|
|
||||||
|
|
||||||
TopoDS_Edge branchEdge = makeEdgeFromMA( theHelper, theMA );
|
TopoDS_Edge branchEdge = makeEdgeFromMA( theHelper, theMA, theMinSegLen );
|
||||||
if ( branchEdge.IsNull() )
|
if ( branchEdge.IsNull() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1446,7 +1465,7 @@ bool StdMeshers_QuadFromMedialAxis_1D2D::Compute(SMESH_Mesh& theMesh,
|
|||||||
_regular1D->SetSegmentLength( minSegLen );
|
_regular1D->SetSegmentLength( minSegLen );
|
||||||
|
|
||||||
vector<double> maParams;
|
vector<double> maParams;
|
||||||
if ( ! divideMA( helper, ma, sinuFace, _regular1D, maParams ))
|
if ( ! divideMA( helper, ma, sinuFace, _regular1D, minSegLen, maParams ))
|
||||||
return error(COMPERR_BAD_SHAPE);
|
return error(COMPERR_BAD_SHAPE);
|
||||||
|
|
||||||
_progress = 0.4;
|
_progress = 0.4;
|
||||||
|
Loading…
Reference in New Issue
Block a user