From: eap Date: Wed, 19 Mar 2014 14:29:49 +0000 (+0400) Subject: 22487: EDF 2778 SMESH: Add a GUI for the flat elements generation X-Git-Tag: V7_4_0a1~27 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=9ab3722c1b5f134261069e4a7fefe6b9c10820a9 22487: EDF 2778 SMESH: Add a GUI for the flat elements generation --- diff --git a/doc/salome/gui/SMESH/images/duplicate01.png b/doc/salome/gui/SMESH/images/duplicate01.png index 02938fa41..f7acf9025 100644 Binary files a/doc/salome/gui/SMESH/images/duplicate01.png and b/doc/salome/gui/SMESH/images/duplicate01.png differ diff --git a/doc/salome/gui/SMESH/images/duplicate02.png b/doc/salome/gui/SMESH/images/duplicate02.png index 9653a3ea0..4bca64476 100644 Binary files a/doc/salome/gui/SMESH/images/duplicate02.png and b/doc/salome/gui/SMESH/images/duplicate02.png differ diff --git a/doc/salome/gui/SMESH/images/duplicate03.png b/doc/salome/gui/SMESH/images/duplicate03.png index 72b2a7a80..00c8c871f 100644 Binary files a/doc/salome/gui/SMESH/images/duplicate03.png and b/doc/salome/gui/SMESH/images/duplicate03.png differ diff --git a/doc/salome/gui/SMESH/images/duplicate04.png b/doc/salome/gui/SMESH/images/duplicate04.png new file mode 100644 index 000000000..70cb4adfb Binary files /dev/null and b/doc/salome/gui/SMESH/images/duplicate04.png differ diff --git a/doc/salome/gui/SMESH/input/double_nodes_page.doc b/doc/salome/gui/SMESH/input/double_nodes_page.doc index 817a7e40a..c86f0bdc1 100644 --- a/doc/salome/gui/SMESH/input/double_nodes_page.doc +++ b/doc/salome/gui/SMESH/input/double_nodes_page.doc @@ -4,7 +4,7 @@ \n This operation allows duplicating mesh nodes or/and elements, which can be useful to emulate a crack in the model. -Duplication consists in creation of mesh element "equal" to existing ones. +Duplication consists in creation of mesh elements "equal" to existing ones. To duplicate nodes or/and elements:
    @@ -14,7 +14,7 @@ Duplication consists in creation of mesh element "equal" to existing ones.
    \image html duplicate_nodes.png "Duplicate Nodes or/and Elements button" -
  1. Check in the dialog box one of three radio buttons corresponding to +
  2. Check in the dialog box one of four radio buttons corresponding to the type of duplication operation you would like to perform.
  3. Fill the other fields available in the dialog box (depending on the chosen operation mode).
  4. @@ -22,11 +22,12 @@ Duplication consists in creation of mesh element "equal" to existing ones. operation of duplication.
-\n "Duplicate Nodes or/and Elements" dialog has three working modes: +\n "Duplicate Nodes or/and Elements" dialog has four working modes:
@@ -103,12 +104,11 @@ located at the "crack" (if any) are cloned automatically.

Duplicate elements only

This mode duplicates the given elements, i.e. creates new elements with the same nodes as the given elements. -
- \image html duplicate03.png +Parameters to be defined in this mode: +
+\anchor mode_group_boundary_anchor +

Duplicate nodes on group boundaries

+ +This mode duplicates nodes located on boundaries between given groups of +volumes. If required, flat elements are created on the duplicated +nodes: a triangular facet shared by two volumes of two groups generates +a flat prism, a quadrangular facet generates a flat hexahedron. +
+The created flat volumes are stored in groups. These groups are named +according to the position of the group in the list of groups: group +"j_n_p" is a group of flat elements that are built between the group \#n +and the group \#p in the group list. All the flat elements are gathered +into the group named "joints3D". The flat element of the multiple +junctions between the simple junction are stored in a group named +"jointsMultiples". + +
+ +\image html duplicate04.png + +Parameters to be defined in this mode: + +
See Also a sample TUI Script of a \ref tui_duplicate_nodes "Duplicate nodes or/and elements" operation. diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index f52be7d13..397efff44 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -1275,10 +1275,13 @@ module SMESH * Triangles are transformed in prisms, and quadrangles in hexahedrons. * \param theDomains - list of groups of volumes * \param createJointElems - if TRUE, create the elements + * \param onAllBoundaries - if TRUE, the nodes and elements are also created on + * the boundary between \a theDomains and the rest mesh * \return TRUE if operation has been completed successfully, FALSE otherwise */ boolean DoubleNodesOnGroupBoundaries( in ListOfGroups theDomains, - in boolean createJointElems ) + in boolean createJointElems, + in boolean onAllBoundaries) raises (SALOME::SALOME_Exception); /*! diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index fc5611aa8..aeb0faf2e 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -197,6 +197,7 @@ SET(SMESH_RESOURCES_FILES mesh_duplicate_nodes.png mesh_duplicate_nodes_with_elem.png mesh_duplicate_elem_only.png + mesh_duplicate_group_boundary.png mesh_bounding_box.png mesh_hypo_viscous_layers.png mesh_tree_hypo_viscous_layers.png diff --git a/resources/mesh_duplicate_group_boundary.png b/resources/mesh_duplicate_group_boundary.png new file mode 100644 index 000000000..0de9a344a Binary files /dev/null and b/resources/mesh_duplicate_group_boundary.png differ diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 350fcd60f..931caa434 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -10563,7 +10563,12 @@ double SMESH_MeshEditor::OrientedAngle(const gp_Pnt& p0, const gp_Pnt& p1, const gp_Vec v2(p0, g2); gp_Vec n1 = vref.Crossed(v1); gp_Vec n2 = vref.Crossed(v2); - return n2.AngleWithRef(n1, vref); + try { + return n2.AngleWithRef(n1, vref); + } + catch ( Standard_Failure ) { + } + return Max( v1.Magnitude(), v2.Magnitude() ); } /*! @@ -10576,13 +10581,16 @@ double SMESH_MeshEditor::OrientedAngle(const gp_Pnt& p0, const gp_Pnt& p1, const * If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created. * All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation). * The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples". - * @param theElems - list of groups of volumes, where a group of volume is a set of - * SMDS_MeshElements sorted by Id. - * @param createJointElems - if TRUE, create the elements - * @return TRUE if operation has been completed successfully, FALSE otherwise + * \param theElems - list of groups of volumes, where a group of volume is a set of + * SMDS_MeshElements sorted by Id. + * \param createJointElems - if TRUE, create the elements + * \param onAllBoundaries - if TRUE, the nodes and elements are also created on + * the boundary between \a theDomains and the rest mesh + * \return TRUE if operation has been completed successfully, FALSE otherwise */ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector& theElems, - bool createJointElems) + bool createJointElems, + bool onAllBoundaries) { MESSAGE("----------------------------------------------"); MESSAGE("SMESH_MeshEditor::doubleNodesOnGroupBoundaries"); @@ -10611,15 +10619,20 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector volume to modify) @@ -10648,7 +10661,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorgetVtkId(); @@ -10661,26 +10674,30 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfromVtkToSmds(neighborsVtkIds[n]); const SMDS_MeshElement* elem = meshDS->FindElement(smdsId); - if (! domain.count(elem)) // neighbor is in another domain : face is shared + if (elem && ! domain.count(elem)) // neighbor is in another domain : face is shared { bool ok = false ; - for (int idombis = 0; idombis < theElems.size(); idombis++) // check if the neighbor belongs to another domain of the list + for (int idombis = 0; idombis < theElems.size() && !ok; idombis++) // check if the neighbor belongs to another domain of the list { // MESSAGE("Domain " << idombis); const TIDSortedElemSet& domainbis = theElems[idombis]; if ( domainbis.count(elem)) ok = true ; // neighbor is in a correct domain : face is kept } - if ( ok ) // the characteristics of the face is stored + if ( ok || onAllBoundaries ) // the characteristics of the face is stored { DownIdType face(downIds[n], downTypes[n]); - if (!faceDomains.count(face)) - faceDomains[face] = emptyMap; // create an empty entry for face if (!faceDomains[face].count(idom)) { faceDomains[face][idom] = vtkId; // volume associated to face in this domain celldom[vtkId] = idom; //MESSAGE(" cell with a border " << vtkId << " domain " << idom); } + if ( !ok ) + { + theRestDomElems.insert( elem ); + faceDomains[face][iRestDom] = neighborsVtkIds[n]; + celldom[neighborsVtkIds[n]] = iRestDom; + } } } } @@ -10694,14 +10711,14 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector domvol = itface->second; + const std::map& domvol = itface->second; if (!domvol.count(idomain)) continue; DownIdType face = itface->first; @@ -10730,8 +10747,6 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector > mutipleNodesToFace; // nodes multi domains with domain order to transform in Face (junction between 3 or more 2D domains) MESSAGE(".. Duplication of the nodes"); - for (int idomain = 0; idomain < theElems.size(); idomain++) + for (int idomain = idom0; idomain < nbDomains; idomain++) { itface = faceDomains.begin(); for (; itface != faceDomains.end(); ++itface) { - std::map domvol = itface->second; + const std::map& domvol = itface->second; if (!domvol.count(idomain)) continue; DownIdType face = itface->first; @@ -10770,15 +10785,12 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector::iterator itdom = domvol.begin(); + std::map::const_iterator itdom = domvol.begin(); for (; itdom != domvol.end(); ++itdom) { int idom = itdom->first; @@ -10816,7 +10828,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfromVtkToSmds(vtkVolIds[ivol]); SMDS_MeshElement* elem = (SMDS_MeshElement*)meshDS->FindElement(smdsId); - if (theElems[idom].count(elem)) + if (domain.count(elem)) { SMDS_VtkVolume* svol = dynamic_cast(elem); domvol[idom] = svol; @@ -11070,7 +11083,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector >::const_iterator itnod = nodeDomains.begin(); for (; itnod != nodeDomains.end(); ++itnod) diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index 84cd288c2..865a395c9 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -553,7 +553,8 @@ public: double OrientedAngle(const gp_Pnt& p0, const gp_Pnt& p1, const gp_Pnt& g1, const gp_Pnt& g2); bool DoubleNodesOnGroupBoundaries( const std::vector& theElems, - bool createJointElems); + bool createJointElems, + bool onAllBoundaries); bool CreateFlatElementsOnFacesGroups( const std::vector& theElems ); diff --git a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx index 407984de7..924ad3589 100644 --- a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.cxx @@ -110,6 +110,7 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) QPixmap iconWithoutElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES"))); QPixmap iconWithElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES_WITH_ELEM"))); QPixmap iconElemOnly (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_ELEM_ONLY"))); + QPixmap iconGrpBoundary (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_GROUP_BOUNDARY"))); QPixmap iconSelect (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT"))); // Main layout @@ -130,13 +131,17 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) aRadioButton2->setIcon(iconWithElem); QRadioButton* aRadioButton3 = new QRadioButton(aConstructorsBox); aRadioButton3->setIcon(iconElemOnly); + QRadioButton* aRadioButton4 = new QRadioButton(aConstructorsBox); + aRadioButton4->setIcon(iconGrpBoundary); aConstructorsBoxLayout->addWidget(aRadioButton1); aConstructorsBoxLayout->addWidget(aRadioButton2); aConstructorsBoxLayout->addWidget(aRadioButton3); + aConstructorsBoxLayout->addWidget(aRadioButton4); myGroupConstructors->addButton(aRadioButton1, 0); myGroupConstructors->addButton(aRadioButton2, 1); myGroupConstructors->addButton(aRadioButton3, 2); + myGroupConstructors->addButton(aRadioButton4, 3); // Arguments myGroupArguments = new QGroupBox(this); @@ -162,8 +167,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) myLineEdit3 = new QLineEdit(myGroupArguments); myLineEdit3->setReadOnly(true); - myCheckBoxNewElemGroup = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_ELEMENTS"), myGroupArguments); - myCheckBoxNewNodeGroup = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_NODES"), myGroupArguments); + myCheckBox1 = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_ELEMENTS"), myGroupArguments); + myCheckBox2 = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_NODES"), myGroupArguments); aGroupArgumentsLayout->addWidget(myTextLabel1, 0, 0); aGroupArgumentsLayout->addWidget(mySelectButton1, 0, 1); @@ -174,8 +179,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) aGroupArgumentsLayout->addWidget(myTextLabel3, 2, 0); aGroupArgumentsLayout->addWidget(mySelectButton3, 2, 1); aGroupArgumentsLayout->addWidget(myLineEdit3, 2, 2); - aGroupArgumentsLayout->addWidget(myCheckBoxNewElemGroup, 3, 0); - aGroupArgumentsLayout->addWidget(myCheckBoxNewNodeGroup, 4, 0); + aGroupArgumentsLayout->addWidget(myCheckBox1, 3, 0); + aGroupArgumentsLayout->addWidget(myCheckBox2, 4, 0); aGroupArgumentsLayout->setRowStretch(5, 1); // Buttons @@ -207,8 +212,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) aMainLayout->addWidget(myGroupArguments); aMainLayout->addWidget(aGroupButtons); - myCheckBoxNewElemGroup->setChecked(true); - myCheckBoxNewNodeGroup->setChecked(true); + myCheckBox1->setChecked(true); + myCheckBox2->setChecked(true); // Initialize the dialog Init(); @@ -223,6 +228,8 @@ SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule ) connect(mySelectButton2, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument())); connect(mySelectButton3, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument())); + connect(myCheckBox2, SIGNAL(stateChanged(int)), SLOT(updateButtons())); + connect(myButtonOk, SIGNAL(clicked()), this, SLOT(onOk())); connect(myButtonClose, SIGNAL(clicked()), this, SLOT(reject())); connect(myButtonApply, SIGNAL(clicked()), this, SLOT(onApply())); @@ -298,8 +305,9 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId) myTextLabel1->setText(tr("GROUP_NODES_TO_DUPLICATE")); myTextLabel2->setText(tr("GROUP_NODES_TO_REPLACE")); - myCheckBoxNewElemGroup->hide(); - myCheckBoxNewNodeGroup->show(); + myCheckBox1->hide(); + myCheckBox2->show(); + myCheckBox2->setText( tr("CONSTRUCT_NEW_GROUP_NODES")); // Hide the third field myTextLabel2->show(); @@ -319,8 +327,10 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId) myTextLabel2->setText(tr("GROUP_NODES_NOT_DUPLICATE")); myTextLabel3->setText(tr("GROUP_ELEMS_TO_REPLACE")); - myCheckBoxNewElemGroup->show(); - myCheckBoxNewNodeGroup->show(); + myCheckBox1->show(); + myCheckBox2->show(); + myCheckBox1->setText( tr("CONSTRUCT_NEW_GROUP_ELEMENTS")); + myCheckBox2->setText( tr("CONSTRUCT_NEW_GROUP_NODES")); // Show the third field myTextLabel2->show(); @@ -338,8 +348,30 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId) myGroupArguments->setTitle(tr("DUPLICATION_ONLY_ELEMS")); myTextLabel1->setText(tr("GROUP_ELEMS_TO_DUPLICATE")); - myCheckBoxNewElemGroup->show(); - myCheckBoxNewNodeGroup->hide(); + myCheckBox1->show(); + myCheckBox1->setText( tr("CONSTRUCT_NEW_GROUP_ELEMENTS")); + myCheckBox2->hide(); + + // Hide the second and the third field + myTextLabel2->hide(); + mySelectButton2->hide(); + myLineEdit2->hide(); + myTextLabel3->hide(); + mySelectButton3->hide(); + myLineEdit3->hide(); + + break; + } + case 3: + { + // Set text to the group of arguments and to all the labels + myGroupArguments->setTitle(tr("DUPLICATION_GROUP_BOUNDARY")); + myTextLabel1->setText(tr("GROUP_VOLUME_GROUPS")); + + myCheckBox1->show(); + myCheckBox2->show(); + myCheckBox1->setText( tr("CREATE_JOINT_ELEMENTS")); + myCheckBox2->setText( tr("ON_ALL_BOUNDARIES")); // Hide the second and the third field myTextLabel2->hide(); @@ -367,8 +399,8 @@ bool SMESHGUI_DuplicateNodesDlg::onApply() BusyLocker lock( myBusy ); - bool toCreateElemGroup = myCheckBoxNewElemGroup->isChecked(); - bool toCreateNodeGroup = myCheckBoxNewNodeGroup->isChecked(); + bool toCreateElemGroup = myCheckBox1->isChecked(); + bool toCreateNodeGroup = myCheckBox2->isChecked(); int operationMode = myGroupConstructors->checkedId(); // Apply changes @@ -451,14 +483,28 @@ bool SMESHGUI_DuplicateNodesDlg::onApply() } break; } + case 3: + { + bool createJointElems = myCheckBox1->isChecked(); + bool onAllBoundaries = myCheckBox2->isChecked(); + + SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups(); + g1->length( myGroups1.count() ); + for ( int i = 0; i < myGroups1.count(); i++ ) + g1[i] = myGroups1[i]; + + result = aMeshEditor->DoubleNodesOnGroupBoundaries( g1.in(), createJointElems, onAllBoundaries ); + + break; } + } // switch( operationMode ) } catch (const SALOME::SALOME_Exception& S_ex) { SalomeApp_Tools::QtCatchCorbaException(S_ex); } catch ( const std::exception& exc ) { INFOS( "Follow exception was cought:\n\t" << exc.what() ); - } + } catch (...) { INFOS( "Unknown exception was cought !!!" ); } @@ -553,6 +599,9 @@ void SMESHGUI_DuplicateNodesDlg::onSelectionChanged() case 2: ok = ( aGroupType != SMESH::NODE ); break; + case 3: + ok = ( aGroupType == SMESH::VOLUME ); + break; } } if ( ok ) aGroups << aGroup; @@ -575,8 +624,15 @@ void SMESHGUI_DuplicateNodesDlg::onSelectionChanged() else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3.clear(); myCurrentLineEdit->clear(); } - // Enable/disable "Apply and Close" and "Apply" buttons + updateButtons(); +} + +/*! + * \brief Enable/disable "Apply and Close" and "Apply" buttons + */ +void SMESHGUI_DuplicateNodesDlg::updateButtons() +{ bool isDataValid = isValid(); myButtonOk->setEnabled( isDataValid ); myButtonApply->setEnabled( isDataValid ); @@ -610,12 +666,15 @@ void SMESHGUI_DuplicateNodesDlg::onEditCurrentArgument() */ bool SMESHGUI_DuplicateNodesDlg::isValid() { - return myGroupConstructors->checkedId() == 1 ? - ( !myGroups1.isEmpty() && !myGroups3.isEmpty() ) : - ( !myGroups1.isEmpty() ); + switch( myGroupConstructors->checkedId() ) + { + case 1: return ( !myGroups1.isEmpty() && !myGroups3.isEmpty() ); + case 3: return ( myGroups1.count() > ( myCheckBox2->isChecked() ? 0 : 1 )); + default: return !myGroups1.isEmpty(); + } + return false; } - /*! \brief SLOT called when dialog shoud be deativated. */ diff --git a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h index 847cbf163..5bf5247d2 100644 --- a/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_DuplicateNodesDlg.h @@ -83,6 +83,8 @@ private slots: void onDeactivate(); + void updateButtons(); + private: QLineEdit* myCurrentLineEdit; @@ -98,8 +100,8 @@ private: QLineEdit* myLineEdit1; QLineEdit* myLineEdit2; QLineEdit* myLineEdit3; - QCheckBox* myCheckBoxNewElemGroup; - QCheckBox* myCheckBoxNewNodeGroup; + QCheckBox* myCheckBox1; + QCheckBox* myCheckBox2; QPushButton* myButtonOk; QPushButton* myButtonApply; diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index c985f167e..f9082a77b 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -435,10 +435,14 @@ ICON_SMESH_DUPLICATE_NODES_WITH_ELEM mesh_duplicate_nodes_with_elem.png - + ICON_SMESH_DUPLICATE_ELEM_ONLY mesh_duplicate_elem_only.png + + ICON_SMESH_DUPLICATE_GROUP_BOUNDARY + mesh_duplicate_group_boundary.png + ICON_SMESH_TREE_ALGO mesh_tree_algo.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index ec5ab322c..350444ec3 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -6752,6 +6752,10 @@ It is impossible to read point coordinates from file DUPLICATION_ONLY_ELEMS Duplicate elements only + + DUPLICATION_GROUP_BOUNDARY + Duplicate nodes on group boundaries + GROUP_ELEMS_TO_DUPLICATE Group of elements to duplicate @@ -6764,6 +6768,10 @@ It is impossible to read point coordinates from file GROUP_ELEMS_TO_REPLACE Group of elements to replace nodes with new ones + + GROUP_VOLUME_GROUPS + Groups of volumes + CONSTRUCT_NEW_GROUP_NODES Construct group with newly created nodes @@ -6772,6 +6780,14 @@ It is impossible to read point coordinates from file CONSTRUCT_NEW_GROUP_ELEMENTS Construct group with newly created elements + + CREATE_JOINT_ELEMENTS + Create joint elements + + + ON_ALL_BOUNDARIES + On all boundaries + SMESHGUI_Make2DFrom3DDlg diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 5d52e7177..9de57c975 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -6875,18 +6875,21 @@ CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D() * If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created. * All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation). * The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples". - * @param theDomains - list of groups of volumes - * @param createJointElems - if TRUE, create the elements - * @return TRUE if operation has been completed successfully, FALSE otherwise + * \param theDomains - list of groups of volumes + * \param createJointElems - if TRUE, create the elements + * \param onAllBoundaries - if TRUE, the nodes and elements are also created on + * the boundary between \a theDomains and the rest mesh + * \return TRUE if operation has been completed successfully, FALSE otherwise */ //================================================================================ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains, - CORBA::Boolean createJointElems ) + CORBA::Boolean createJointElems, + CORBA::Boolean onAllBoundaries ) throw (SALOME::SALOME_Exception) { - bool aResult = false; + bool isOK = false; SMESH_TRY; initData(); @@ -6894,10 +6897,11 @@ SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& the SMESHDS_Mesh* aMeshDS = getMeshDS(); // MESSAGE("theDomains.length = "< domains; - domains.clear(); + domains.resize( theDomains.length() ); for ( int i = 0, n = theDomains.length(); i < n; i++ ) { @@ -6906,26 +6910,25 @@ SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& the { // if ( aGrp->GetType() != SMESH::VOLUME ) // THROW_SALOME_CORBA_EXCEPTION("Not a volume group", SALOME::BAD_PARAM); - TIDSortedElemSet domain; - domain.clear(); - domains.push_back(domain); SMESH::long_array_var anIDs = aGrp->GetIDs(); arrayToSet( anIDs, aMeshDS, domains[ i ], SMDSAbs_All ); } } - aResult = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems ); + isOK = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems, onAllBoundaries ); // TODO publish the groups of flat elements in study - declareMeshModified( /*isReComputeSafe=*/ !aResult ); + declareMeshModified( /*isReComputeSafe=*/ !isOK ); // Update Python script TPythonDump() << "isDone = " << this << ".DoubleNodesOnGroupBoundaries( " << &theDomains - << ", " << createJointElems << " )"; + << ", " << createJointElems << ", " << onAllBoundaries << " )"; SMESH_CATCH( SMESH::throwCorbaException ); - return aResult; + myMesh_i->CreateGroupServants(); // publish created groups if any + + return isOK; } //================================================================================ diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index 87682048b..ead3048b0 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -923,12 +923,15 @@ public: * The nodes of the internal faces at the boundaries of the groups are doubled. * In option, the internal faces are replaced by flat elements. * Triangles are transformed in prisms, and quadrangles in hexahedrons. - * @param theDomains - list of groups of volumes - * @param createJointElems - if TRUE, create the elements - * @return TRUE if operation has been completed successfully, FALSE otherwise + * \param theDomains - list of groups of volumes + * \param createJointElems - if TRUE, create the elements + * \param onAllBoundaries - if TRUE, the nodes and elements are also create on + * the boundary between \a theDomains and the rest mesh + * \return TRUE if operation has been completed successfully, FALSE otherwise */ CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains, - CORBA::Boolean createJointElems ) + CORBA::Boolean createJointElems, + CORBA::Boolean onAllBoundaries ) throw (SALOME::SALOME_Exception); /*! * \brief Double nodes on some external faces and create flat elements. diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 262685a43..223cf9130 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -4503,9 +4503,11 @@ class Mesh: # Triangles are transformed in prisms, and quadrangles in hexahedrons. # @param theDomains - list of groups of volumes # @param createJointElems - if TRUE, create the elements + # @param onAllBoundaries - if TRUE, the nodes and elements are also created on + # the boundary between \a theDomains and the rest mesh # @return TRUE if operation has been completed successfully, FALSE otherwise - def DoubleNodesOnGroupBoundaries(self, theDomains, createJointElems ): - return self.editor.DoubleNodesOnGroupBoundaries( theDomains, createJointElems ) + def DoubleNodesOnGroupBoundaries(self, theDomains, createJointElems, onAllBoundaries=False ): + return self.editor.DoubleNodesOnGroupBoundaries( theDomains, createJointElems, onAllBoundaries ) ## Double nodes on some external faces and create flat elements. # Flat elements are mainly used by some types of mechanic calculations.