]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Update documentation, add more tests
authorjfa <jfa@opencascade.com>
Wed, 22 Dec 2021 12:10:10 +0000 (15:10 +0300)
committerjfa <jfa@opencascade.com>
Wed, 22 Dec 2021 12:10:10 +0000 (15:10 +0300)
doc/salome/examples/test_cdc_uniform_01.py [new file with mode: 0644]
doc/salome/examples/test_cdc_uniform_02.py [new file with mode: 0644]
doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_groups.png [new file with mode: 0644]
doc/salome/gui/SMESH/input/homard_create_boundary.rst
src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx
src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx
src/SMESHGUI/SMESHGUI_HomardListGroup.cxx

diff --git a/doc/salome/examples/test_cdc_uniform_01.py b/doc/salome/examples/test_cdc_uniform_01.py
new file mode 100644 (file)
index 0000000..ae9d477
--- /dev/null
@@ -0,0 +1,148 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Raffinement uniforme d'un maillage en triangles
+
+Copyright 2021 EDF
+Gérald NICOLAS
++33.1.78.19.43.52
+"""
+__revision__ = "V02.04"
+
+import os
+import tempfile
+
+import salome
+
+#=============== Options ====================
+# REPDATA = répertoire du cas-test
+REPDATA = tempfile.mkdtemp()
+LONG = 36.
+LARG = 24.
+NOM_MAILLAGE = "Maillage"
+#============================================
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+
+### Create Part
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "Long", "{}".format(LONG))
+model.addParameter(Part_1_doc, "Larg", "{}".format(LARG))
+
+### Create Sketch
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+
+### Create SketchLine
+SketchLine_1 = Sketch_1.addLine(36, 0, 0, 0)
+
+### Create SketchProjection
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result())
+
+### Create SketchLine
+SketchLine_2 = Sketch_1.addLine(0, 0, 0, 24)
+
+### Create SketchLine
+SketchLine_3 = Sketch_1.addLine(0, 24, 36, 24)
+
+### Create SketchLine
+SketchLine_4 = Sketch_1.addLine(36, 24, 36, 0)
+Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+Sketch_1.setHorizontal(SketchLine_1.result())
+Sketch_1.setVertical(SketchLine_2.result())
+Sketch_1.setHorizontal(SketchLine_3.result())
+Sketch_1.setVertical(SketchLine_4.result())
+Sketch_1.setLength(SketchLine_3.result(), "Long")
+Sketch_1.setLength(SketchLine_2.result(), "Larg")
+model.do()
+
+### Create Face
+Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")])
+
+### Create Symmetry
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Face_1")], model.selection("EDGE", "PartSet/OY"), keepOriginal = True, keepSubResults = True)
+
+### Create Symmetry
+Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_1")], model.selection("EDGE", "PartSet/OX"), keepOriginal = True, keepSubResults = True)
+
+### Create Rotation
+Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_2")], axis = model.selection("EDGE", "PartSet/OX"), angle = 90, keepSubResults = True)
+
+### Create Recover
+Recover_1 = model.addRecover(Part_1_doc, Rotation_1, [Symmetry_2.result()])
+
+### Create Partition
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Rotation_1"), model.selection("COMPOUND", "all-in-Recover_1")], keepSubResults = True)
+
+### Create Group
+for IAUX in range(1,9):
+  _ = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Partition_1_1_{}".format(IAUX))])
+
+model.end()
+
+###
+### SHAPERSTUDY component
+###
+
+model.publishToShaperStudy()
+import SHAPERSTUDY
+l_aux = SHAPERSTUDY.shape(model.featureStringId(Partition_1))
+
+###
+### SMESH component
+###
+
+import  SMESH
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+
+Maillage_1 = smesh.Mesh(l_aux[0])
+Maillage_1.SetName(NOM_MAILLAGE)
+
+L_MAILLE = min(LARG,LONG)/5.
+NETGEN_1D_2D = Maillage_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
+NETGEN_2D_Parameters_1.SetMaxSize( L_MAILLE )
+NETGEN_2D_Parameters_1.SetMinSize( L_MAILLE/10. )
+for groupe in l_aux[1:]:
+  groupe_nom = groupe.GetName()
+  _ = Maillage_1.GroupOnGeom(groupe,groupe_nom,SMESH.FACE)
+
+_ = Maillage_1.Compute()
+
+FIC_MAIL = os.path.join(REPDATA, "Uniform_01.med")
+Maillage_1.ExportMED(FIC_MAIL)
+
+# Uniform refinement
+import SMESHHOMARD
+smeshhomard = smesh.Adaptation("Uniform")
+Case_1 = smeshhomard.CreateCase(NOM_MAILLAGE, FIC_MAIL, REPDATA)
+Case_1.SetConfType(0)
+smeshhomard.SetKeepMedOUT(True)
+smeshhomard.SetPublishMeshOUT(True)
+smeshhomard.SetMeshNameOUT("{}_R".format(NOM_MAILLAGE))
+FIC_MAIL = os.path.join(REPDATA, "Uniform_01_R.med")
+smeshhomard.SetMeshFileOUT(FIC_MAIL)
+smeshhomard.SetKeepWorkingFiles(False)
+codret = smeshhomard.Compute()
+
+# Check
+if os.path.isfile(FIC_MAIL):
+  os.remove(FIC_MAIL)
+else:
+  print("Test Uniform refinement: Error: no output med file")
+  assert(False)
+
+# Ménage
+os.rmdir(REPDATA)
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser()
diff --git a/doc/salome/examples/test_cdc_uniform_02.py b/doc/salome/examples/test_cdc_uniform_02.py
new file mode 100644 (file)
index 0000000..fefcf44
--- /dev/null
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Raffinement uniforme d'un maillage en tétraèdres
+
+Copyright 2021 EDF
+Gérald NICOLAS
++33.1.78.19.43.52
+"""
+__revision__ = "V02.03"
+
+import os
+import tempfile
+
+import salome
+
+#=============== Options ====================
+# REPDATA = répertoire du cas-test
+REPDATA = tempfile.mkdtemp()
+LONG = 36.
+LARG = 24.
+NOM_MAILLAGE = "BOX"
+#============================================
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+
+### Create Part
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "Long", "{}".format(LONG))
+model.addParameter(Part_1_doc, "Larg", "{}".format(LARG))
+model.addParameter(Part_1_doc, "HAUT", "(LARG+LONG)")
+
+### Create Box
+Box_1 = model.addBox(Part_1_doc, "LONG", "LARG", "HAUT")
+
+### Create Group
+Group_1 = model.addGroup(Part_1_doc, "Vertices", [model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]")])
+
+### Create Group
+Group_2_objects = [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"),
+                   model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"),
+                   model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]")]
+Group_2 = model.addGroup(Part_1_doc, "Edges", Group_2_objects)
+
+### Create Group
+Group_3_objects = [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"),
+                   model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"),
+                   model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]")]
+Group_3 = model.addGroup(Part_1_doc, "Edges", Group_3_objects)
+
+### Create Group
+Group_4 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Box_1_1/Right")])
+
+model.end()
+
+###
+### SHAPERSTUDY component
+###
+
+model.publishToShaperStudy()
+import SHAPERSTUDY
+l_aux = SHAPERSTUDY.shape(model.featureStringId(Box_1))
+
+###
+### SMESH component
+###
+
+import  SMESH
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+
+Maillage_1 = smesh.Mesh(l_aux[0])
+Maillage_1.SetName(NOM_MAILLAGE)
+
+L_MAILLE = min(LARG,LONG)/5.
+NETGEN_1D_2D_3D = Maillage_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)
+NETGEN_3D_Parameters_1 = NETGEN_1D_2D_3D.Parameters()
+NETGEN_3D_Parameters_1.SetMaxSize( L_MAILLE )
+NETGEN_3D_Parameters_1.SetMinSize( L_MAILLE/5. )
+NETGEN_3D_Parameters_1.SetSecondOrder( 1 )
+_ = Maillage_1.GroupOnGeom(l_aux[1],l_aux[1].GetName(),SMESH.NODE)
+_ = Maillage_1.GroupOnGeom(l_aux[2],l_aux[2].GetName(),SMESH.EDGE)
+_ = Maillage_1.GroupOnGeom(l_aux[3],l_aux[3].GetName(),SMESH.EDGE)
+_ = Maillage_1.GroupOnGeom(l_aux[4],l_aux[4].GetName(),SMESH.FACE)
+
+_ = Maillage_1.Compute()
+
+#FIC_MAIL = os.path.join(REPDATA, "Uniform_02.med")
+#Maillage_1.ExportMED(FIC_MAIL)
+
+# Uniform refinement
+import SMESHHOMARD
+smeshhomard = smesh.Adaptation("Uniform")
+#Case_1 = homard.CreateCase(NOM_MAILLAGE, FIC_MAIL, REPDATA)
+Case_1 = homard.CreateCase(NOM_MAILLAGE, Maillage_1.GetMesh(), REPDATA)
+Case_1.SetConfType(0)
+smeshhomard.SetKeepMedOUT(True)
+smeshhomard.SetPublishMeshOUT(True)
+smeshhomard.SetMeshNameOUT("{}_R".format(NOM_MAILLAGE))
+FIC_MAIL = os.path.join(REPDATA, "Uniform_02_R.med")
+smeshhomard.SetMeshFileOUT(FIC_MAIL)
+smeshhomard.SetKeepWorkingFiles(False)
+codret = smeshhomard.Compute()
+
+# Check
+if os.path.isfile(FIC_MAIL):
+  os.remove(FIC_MAIL)
+else:
+  print("Test Uniform refinement: Error: no output med file")
+  assert(False)
+
+# Ménage
+os.rmdir(REPDATA)
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser()
diff --git a/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_groups.png b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_groups.png
new file mode 100644 (file)
index 0000000..815591e
Binary files /dev/null and b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_groups.png differ
index 5053f648a6b10c8388743eeed10df1cc32c2d4a7..230ce001d7f278e6809843c6f605b1d01f4d8e59 100644 (file)
@@ -41,6 +41,15 @@ The window invites in the choice of a file that contains the CAO with XAO format
 .. note::
   The coherence between this CAO and the initial mesh is not checked.
 
+Filtering by the groups
+***********************
+.. index:: single: group
+
+We can restrict the application of the boundary to groups. So elements not belonging to these groups will not be affected. We check the associated button **Filtering with groups**. The list of the present groups of elements in the mesh is shown. It is enough to check those wanted to restrict the boundary.
+
+.. image:: ../images/adaptation_with_homard_boundary_groups.png
+   :align: center
+
 .. _homard_create_boundary_Di:
 
 Discrete boundary
index fb74f255383ff2f89fd4168ed777d12c4bb73417..c215ac0c895fea5b6ee91106faf22f11bc9c17ce 100644 (file)
@@ -636,9 +636,11 @@ void SMESHGUI_HomardAdaptDlg::SetBoundaryNo()
 // ------------------------------------------------------------------------
 void SMESHGUI_HomardAdaptDlg::SetBoundaryCAO()
 {
-  myArgs->GBBoundaryC->setVisible(1);
-  myArgs->GBBoundaryN->setVisible(0);
-  adjustSize();
+  if (CheckCase(true)) {
+    myArgs->GBBoundaryC->setVisible(1);
+    myArgs->GBBoundaryN->setVisible(0);
+    adjustSize();
+  }
 }
 // ------------------------------------------------------------------------
 void SMESHGUI_HomardAdaptDlg::SetBoundaryNonCAO()
index f6899c28dcfe0ca63504ff42b321ce12981ef236..e3180f4cbad7cbb280c7a0e9cbd9054bb95092bf 100644 (file)
@@ -956,7 +956,7 @@ void SMESH_CreateBoundaryCAO::setGroups (QStringList listGroup)
 }
 // ------------------------------------------------------------------------
 void SMESH_CreateBoundaryCAO::SetFiltrage()
-// // ------------------------------------------------------------------------
+// ------------------------------------------------------------------------
 {
   if (!CBGroupe->isChecked()) return;
 
@@ -1564,11 +1564,11 @@ bool SMESH_EditBoundaryCAO::PushOnApply()
 }
 // ------------------------------------------------------------------------
 void SMESH_EditBoundaryCAO::SetFiltrage()
-// // ------------------------------------------------------------------------
+// ------------------------------------------------------------------------
 {
   if (!CBGroupe->isChecked()) return;
-  SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase();
-  SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
+  //SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase();
+  //SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
 
   SMESH_EditListGroupCAO *aDlg = new SMESH_EditListGroupCAO
     (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen),
@@ -1576,14 +1576,14 @@ void SMESH_EditBoundaryCAO::SetFiltrage()
   aDlg->show();
 }
 
-// -------------------------------------------------------------------------------------------------------------------------------------
-SMESH_EditBoundaryDi::SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal,
-                                      SMESHHOMARD::HOMARD_Gen_var myHomardGen,
-                                      QString caseName, QString Name):
-// -------------------------------------------------------------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------------
 /* Constructs a SMESH_EditBoundaryDi
     herite de SMESH_CreateBoundaryDi
 */
+// ------------------------------------------------------------------------------------
+SMESH_EditBoundaryDi::SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal,
+                                      SMESHHOMARD::HOMARD_Gen_var myHomardGen,
+                                      QString caseName, QString Name):
   SMESH_CreateBoundaryDi(parent, modal, myHomardGen, caseName, Name)
 {
     MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str());
index ab7050cd262dd4a8fa78d3c9b2f882030bba8b71..32c4586f86eec660b58a6f2ad13ee375ae7a6e1f 100644 (file)
 using namespace std;
 
 // ------------------------------------------------------------------------------------
-SMESH_CreateListGroupCAO::SMESH_CreateListGroupCAO(SMESH_CreateBoundaryCAO* parentBound, bool modal,
-                                             SMESHHOMARD::HOMARD_Gen_var myHomardGen0,
-                                             QString aCaseName,
-                                             QStringList listeGroupesHypo)
+SMESH_CreateListGroupCAO::SMESH_CreateListGroupCAO(SMESH_CreateBoundaryCAO* parentBound,
+                                                   bool modal,
+                                                   SMESHHOMARD::HOMARD_Gen_var myHomardGen0,
+                                                   QString aCaseName,
+                                                   QStringList listeGroupesHypo)
   : QDialog(0), SMESH_Ui_CreateListGroup(),
     _aCaseName (aCaseName),
     _listeGroupesHypo (listeGroupesHypo),
     _parentBound(parentBound)
 {
-  MESSAGE("Debut de  SMESH_CreateListGroupCAO");
+  MESSAGE("Debut de SMESH_CreateListGroupCAO");
   myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
   setupUi(this);
   setModal(modal);
   InitConnect();
   InitGroupes();
 }
-// --------------------------------------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------------
 SMESH_CreateListGroupCAO::SMESH_CreateListGroupCAO(SMESH_CreateBoundaryCAO* parentBound,
                                              SMESHHOMARD::HOMARD_Gen_var myHomardGen,
                                              QString aCaseName,
@@ -112,7 +113,7 @@ void SMESH_CreateListGroupCAO::PushOnOK()
 void SMESH_CreateListGroupCAO::PushOnHelp()
 // ------------------------------------------------------------------------
 {
-  SMESH::ShowHelpFile(QString("gui_create_hypothese.html"));
+  SMESH::ShowHelpFile(QString("homard_create_boundary.html#filtering-by-the-groups"));
 }
 // ------------------------------------------------------------------------
 void SMESH_CreateListGroupCAO::InitGroupes()
@@ -220,7 +221,7 @@ void SMESH_CreateListGroup::PushOnOK()
 void SMESH_CreateListGroup::PushOnHelp()
 // ------------------------------------------------------------------------
 {
-  SMESH::ShowHelpFile(QString("gui_create_hypothese.html"));
+  SMESH::ShowHelpFile(QString("homard_create_boundary.html#filtering-by-the-groups"));
 }
 // ------------------------------------------------------------------------
 void SMESH_CreateListGroup::InitGroupes()