From: vsr Date: Wed, 23 Jul 2008 11:49:09 +0000 (+0000) Subject: Merge from V4_1_0_maintainance branch (from tag mergeto_BR_QT4_Dev_08Jul08) X-Git-Tag: V5_1_0a1~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ddd20dd94358856385f639219bbdfbd1e14239d7;p=modules%2Fsmesh.git Merge from V4_1_0_maintainance branch (from tag mergeto_BR_QT4_Dev_08Jul08) --- diff --git a/build_configure b/build_configure index 66f991e57..11867ee41 100755 --- a/build_configure +++ b/build_configure @@ -32,10 +32,10 @@ fi for option do case $option in - -with-ihm | --with-ihm) + -with-gui | --with-gui) SMESH_WITH_GUI="yes" break;; - -without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no) + -without-gui | --without-gui | -with-gui=no | --with-gui=no) SMESH_WITH_GUI="no" break;; esac diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index 66ce3648e..e3813b650 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -41,7 +41,9 @@ usr_docs: filesl=`find .`; \ for filen in $${filesl}; do \ sed 's/\([^s1e]\)smeshDC\|^smeshDC/\1smesh/g' $${filen} > ./tmp; \ - mv -f tmp $${filen}; \ + sed 's/smesh:://g' ./tmp > ./tmp1; \ + rm -f tmp; \ + mv -f tmp1 $${filen}; \ done; \ cd ..; \ echo "Running doxygen in directory: "`pwd`; \ diff --git a/doc/salome/gui/SMESH/images/a-clipping2.png b/doc/salome/gui/SMESH/images/a-clipping2.png index 639792ca3..26e1481f3 100755 Binary files a/doc/salome/gui/SMESH/images/a-clipping2.png and b/doc/salome/gui/SMESH/images/a-clipping2.png differ diff --git a/doc/salome/gui/SMESH/images/a-creategroup.png b/doc/salome/gui/SMESH/images/a-creategroup.png index 38ef5a856..3878261ec 100755 Binary files a/doc/salome/gui/SMESH/images/a-creategroup.png and b/doc/salome/gui/SMESH/images/a-creategroup.png differ diff --git a/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png b/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png index 532eac08f..88c16241e 100755 Binary files a/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png and b/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png differ diff --git a/doc/salome/gui/SMESH/images/a-cuttingofquadrangles.png b/doc/salome/gui/SMESH/images/a-cuttingofquadrangles.png index ff9ae68e1..7301e499f 100755 Binary files a/doc/salome/gui/SMESH/images/a-cuttingofquadrangles.png and b/doc/salome/gui/SMESH/images/a-cuttingofquadrangles.png differ diff --git a/doc/salome/gui/SMESH/images/a-filteronedges.png b/doc/salome/gui/SMESH/images/a-filteronedges.png index 48b3ece01..d0732dcb2 100755 Binary files a/doc/salome/gui/SMESH/images/a-filteronedges.png and b/doc/salome/gui/SMESH/images/a-filteronedges.png differ diff --git a/doc/salome/gui/SMESH/images/a-maxelarea.png b/doc/salome/gui/SMESH/images/a-maxelarea.png index b4af4b23f..4306ed55f 100755 Binary files a/doc/salome/gui/SMESH/images/a-maxelarea.png and b/doc/salome/gui/SMESH/images/a-maxelarea.png differ diff --git a/doc/salome/gui/SMESH/images/a-maxelvolume.png b/doc/salome/gui/SMESH/images/a-maxelvolume.png index 2611807fd..033e7004e 100755 Binary files a/doc/salome/gui/SMESH/images/a-maxelvolume.png and b/doc/salome/gui/SMESH/images/a-maxelvolume.png differ diff --git a/doc/salome/gui/SMESH/images/a-nbsegments1.png b/doc/salome/gui/SMESH/images/a-nbsegments1.png index 35c09094d..27668505c 100755 Binary files a/doc/salome/gui/SMESH/images/a-nbsegments1.png and b/doc/salome/gui/SMESH/images/a-nbsegments1.png differ diff --git a/doc/salome/gui/SMESH/images/a-nbsegments2.png b/doc/salome/gui/SMESH/images/a-nbsegments2.png index 7f33c61ff..8d4f277d9 100755 Binary files a/doc/salome/gui/SMESH/images/a-nbsegments2.png and b/doc/salome/gui/SMESH/images/a-nbsegments2.png differ diff --git a/doc/salome/gui/SMESH/images/a-patterntype.png b/doc/salome/gui/SMESH/images/a-patterntype.png index 3383cd75e..45cfe934c 100755 Binary files a/doc/salome/gui/SMESH/images/a-patterntype.png and b/doc/salome/gui/SMESH/images/a-patterntype.png differ diff --git a/doc/salome/gui/SMESH/images/a-patterntype1.png b/doc/salome/gui/SMESH/images/a-patterntype1.png index 38449225a..f61e2a779 100755 Binary files a/doc/salome/gui/SMESH/images/a-patterntype1.png and b/doc/salome/gui/SMESH/images/a-patterntype1.png differ diff --git a/doc/salome/gui/SMESH/images/a-startendlength.png b/doc/salome/gui/SMESH/images/a-startendlength.png index e48f617d2..947567d7f 100755 Binary files a/doc/salome/gui/SMESH/images/a-startendlength.png and b/doc/salome/gui/SMESH/images/a-startendlength.png differ diff --git a/doc/salome/gui/SMESH/images/a-unionoftriangles.png b/doc/salome/gui/SMESH/images/a-unionoftriangles.png index d9ef53c11..7e5adfd64 100755 Binary files a/doc/salome/gui/SMESH/images/a-unionoftriangles.png and b/doc/salome/gui/SMESH/images/a-unionoftriangles.png differ diff --git a/doc/salome/gui/SMESH/images/addedge.png b/doc/salome/gui/SMESH/images/addedge.png index c9eeaf970..abfb791e5 100755 Binary files a/doc/salome/gui/SMESH/images/addedge.png and b/doc/salome/gui/SMESH/images/addedge.png differ diff --git a/doc/salome/gui/SMESH/images/addhexahedron.png b/doc/salome/gui/SMESH/images/addhexahedron.png index fd2ef245a..e86c0b141 100755 Binary files a/doc/salome/gui/SMESH/images/addhexahedron.png and b/doc/salome/gui/SMESH/images/addhexahedron.png differ diff --git a/doc/salome/gui/SMESH/images/addnode.png b/doc/salome/gui/SMESH/images/addnode.png index 167a966b8..5f1a85e26 100755 Binary files a/doc/salome/gui/SMESH/images/addnode.png and b/doc/salome/gui/SMESH/images/addnode.png differ diff --git a/doc/salome/gui/SMESH/images/addpolygon.png b/doc/salome/gui/SMESH/images/addpolygon.png index 785a62341..014d5555d 100755 Binary files a/doc/salome/gui/SMESH/images/addpolygon.png and b/doc/salome/gui/SMESH/images/addpolygon.png differ diff --git a/doc/salome/gui/SMESH/images/addquadrangle.png b/doc/salome/gui/SMESH/images/addquadrangle.png index 2bbddf158..5c61988ce 100755 Binary files a/doc/salome/gui/SMESH/images/addquadrangle.png and b/doc/salome/gui/SMESH/images/addquadrangle.png differ diff --git a/doc/salome/gui/SMESH/images/addtetrahedron.png b/doc/salome/gui/SMESH/images/addtetrahedron.png index 0a415707a..68637a2cd 100755 Binary files a/doc/salome/gui/SMESH/images/addtetrahedron.png and b/doc/salome/gui/SMESH/images/addtetrahedron.png differ diff --git a/doc/salome/gui/SMESH/images/addtriangle.png b/doc/salome/gui/SMESH/images/addtriangle.png index 405d6f57f..ef719c6ca 100755 Binary files a/doc/salome/gui/SMESH/images/addtriangle.png and b/doc/salome/gui/SMESH/images/addtriangle.png differ diff --git a/doc/salome/gui/SMESH/images/aqt.png b/doc/salome/gui/SMESH/images/aqt.png index 32e36bd0e..55a0052e7 100755 Binary files a/doc/salome/gui/SMESH/images/aqt.png and b/doc/salome/gui/SMESH/images/aqt.png differ diff --git a/doc/salome/gui/SMESH/images/automaticlength.png b/doc/salome/gui/SMESH/images/automaticlength.png index d96ffc82d..15fb8b35e 100755 Binary files a/doc/salome/gui/SMESH/images/automaticlength.png and b/doc/salome/gui/SMESH/images/automaticlength.png differ diff --git a/doc/salome/gui/SMESH/images/blsurf_parameters.png b/doc/salome/gui/SMESH/images/blsurf_parameters.png new file mode 100644 index 000000000..22d038ac5 Binary files /dev/null and b/doc/salome/gui/SMESH/images/blsurf_parameters.png differ diff --git a/doc/salome/gui/SMESH/images/blsurf_parameters_advanced.png b/doc/salome/gui/SMESH/images/blsurf_parameters_advanced.png new file mode 100644 index 000000000..0f2c07dc3 Binary files /dev/null and b/doc/salome/gui/SMESH/images/blsurf_parameters_advanced.png differ diff --git a/doc/salome/gui/SMESH/images/buildcompound.png b/doc/salome/gui/SMESH/images/buildcompound.png index 1a5bea166..f712ef639 100755 Binary files a/doc/salome/gui/SMESH/images/buildcompound.png and b/doc/salome/gui/SMESH/images/buildcompound.png differ diff --git a/doc/salome/gui/SMESH/images/creategroup.png b/doc/salome/gui/SMESH/images/creategroup.png index 207e2099e..6fa1d360e 100755 Binary files a/doc/salome/gui/SMESH/images/creategroup.png and b/doc/salome/gui/SMESH/images/creategroup.png differ diff --git a/doc/salome/gui/SMESH/images/createmesh-inv.png b/doc/salome/gui/SMESH/images/createmesh-inv.png index 8273aac45..e53f5ff53 100755 Binary files a/doc/salome/gui/SMESH/images/createmesh-inv.png and b/doc/salome/gui/SMESH/images/createmesh-inv.png differ diff --git a/doc/salome/gui/SMESH/images/createmesh-inv2.png b/doc/salome/gui/SMESH/images/createmesh-inv2.png index 2bee11b7c..0a67501c3 100755 Binary files a/doc/salome/gui/SMESH/images/createmesh-inv2.png and b/doc/salome/gui/SMESH/images/createmesh-inv2.png differ diff --git a/doc/salome/gui/SMESH/images/createmesh-inv3.png b/doc/salome/gui/SMESH/images/createmesh-inv3.png index 6dfabaaa8..0a67501c3 100755 Binary files a/doc/salome/gui/SMESH/images/createmesh-inv3.png and b/doc/salome/gui/SMESH/images/createmesh-inv3.png differ diff --git a/doc/salome/gui/SMESH/images/cutgroups.png b/doc/salome/gui/SMESH/images/cutgroups.png index 87e6da88b..1985f97aa 100755 Binary files a/doc/salome/gui/SMESH/images/cutgroups.png and b/doc/salome/gui/SMESH/images/cutgroups.png differ diff --git a/doc/salome/gui/SMESH/images/deletegroups.png b/doc/salome/gui/SMESH/images/deletegroups.png index 383a79aa8..2b2163c98 100755 Binary files a/doc/salome/gui/SMESH/images/deletegroups.png and b/doc/salome/gui/SMESH/images/deletegroups.png differ diff --git a/doc/salome/gui/SMESH/images/diagonalinversion.png b/doc/salome/gui/SMESH/images/diagonalinversion.png index 967e7a12e..1abcdb789 100755 Binary files a/doc/salome/gui/SMESH/images/diagonalinversion.png and b/doc/salome/gui/SMESH/images/diagonalinversion.png differ diff --git a/doc/salome/gui/SMESH/images/distributionwithanalyticdensity.png b/doc/salome/gui/SMESH/images/distributionwithanalyticdensity.png index 87ebc5ffe..7dea248c6 100755 Binary files a/doc/salome/gui/SMESH/images/distributionwithanalyticdensity.png and b/doc/salome/gui/SMESH/images/distributionwithanalyticdensity.png differ diff --git a/doc/salome/gui/SMESH/images/distributionwithtabledensity.png b/doc/salome/gui/SMESH/images/distributionwithtabledensity.png index 9ea6cab98..3bd40bc45 100755 Binary files a/doc/salome/gui/SMESH/images/distributionwithtabledensity.png and b/doc/salome/gui/SMESH/images/distributionwithtabledensity.png differ diff --git a/doc/salome/gui/SMESH/images/editgroup.png b/doc/salome/gui/SMESH/images/editgroup.png index c0a50f36f..689bb1c38 100755 Binary files a/doc/salome/gui/SMESH/images/editgroup.png and b/doc/salome/gui/SMESH/images/editgroup.png differ diff --git a/doc/salome/gui/SMESH/images/extrusion1.png b/doc/salome/gui/SMESH/images/extrusion1.png index b48278242..ba8177b9c 100644 Binary files a/doc/salome/gui/SMESH/images/extrusion1.png and b/doc/salome/gui/SMESH/images/extrusion1.png differ diff --git a/doc/salome/gui/SMESH/images/extrusion2.png b/doc/salome/gui/SMESH/images/extrusion2.png index d1d6d0823..958a8f2e9 100755 Binary files a/doc/salome/gui/SMESH/images/extrusion2.png and b/doc/salome/gui/SMESH/images/extrusion2.png differ diff --git a/doc/salome/gui/SMESH/images/extrusionalongaline1.png b/doc/salome/gui/SMESH/images/extrusionalongaline1.png index 300d24228..7d68ecfbe 100755 Binary files a/doc/salome/gui/SMESH/images/extrusionalongaline1.png and b/doc/salome/gui/SMESH/images/extrusionalongaline1.png differ diff --git a/doc/salome/gui/SMESH/images/extrusionalongaline2.png b/doc/salome/gui/SMESH/images/extrusionalongaline2.png index 23ca6060f..797fe9697 100755 Binary files a/doc/salome/gui/SMESH/images/extrusionalongaline2.png and b/doc/salome/gui/SMESH/images/extrusionalongaline2.png differ diff --git a/doc/salome/gui/SMESH/images/ghs3d_parameters_advanced.png b/doc/salome/gui/SMESH/images/ghs3d_parameters_advanced.png new file mode 100644 index 000000000..4f36203ba Binary files /dev/null and b/doc/salome/gui/SMESH/images/ghs3d_parameters_advanced.png differ diff --git a/doc/salome/gui/SMESH/images/ghs3d_parameters_basic.png b/doc/salome/gui/SMESH/images/ghs3d_parameters_basic.png new file mode 100644 index 000000000..0cce50bb8 Binary files /dev/null and b/doc/salome/gui/SMESH/images/ghs3d_parameters_basic.png differ diff --git a/doc/salome/gui/SMESH/images/intersectgroups.png b/doc/salome/gui/SMESH/images/intersectgroups.png index b28b4d4d6..566baaea8 100755 Binary files a/doc/salome/gui/SMESH/images/intersectgroups.png and b/doc/salome/gui/SMESH/images/intersectgroups.png differ diff --git a/doc/salome/gui/SMESH/images/mergeelems.png b/doc/salome/gui/SMESH/images/mergeelems.png index dbd87877e..aaac9e86a 100755 Binary files a/doc/salome/gui/SMESH/images/mergeelems.png and b/doc/salome/gui/SMESH/images/mergeelems.png differ diff --git a/doc/salome/gui/SMESH/images/mergenodes.png b/doc/salome/gui/SMESH/images/mergenodes.png index d7437e400..54c686a2c 100755 Binary files a/doc/salome/gui/SMESH/images/mergenodes.png and b/doc/salome/gui/SMESH/images/mergenodes.png differ diff --git a/doc/salome/gui/SMESH/images/mesh_clear.png b/doc/salome/gui/SMESH/images/mesh_clear.png new file mode 100644 index 000000000..0d44a126d Binary files /dev/null and b/doc/salome/gui/SMESH/images/mesh_clear.png differ diff --git a/doc/salome/gui/SMESH/images/meshcomputationsucceed.png b/doc/salome/gui/SMESH/images/meshcomputationsucceed.png index ab2357910..19765ee5a 100644 Binary files a/doc/salome/gui/SMESH/images/meshcomputationsucceed.png and b/doc/salome/gui/SMESH/images/meshcomputationsucceed.png differ diff --git a/doc/salome/gui/SMESH/images/movenodes.png b/doc/salome/gui/SMESH/images/movenodes.png index 16e9e6262..a375dd142 100755 Binary files a/doc/salome/gui/SMESH/images/movenodes.png and b/doc/salome/gui/SMESH/images/movenodes.png differ diff --git a/doc/salome/gui/SMESH/images/netgen2d.png b/doc/salome/gui/SMESH/images/netgen2d.png index b2a9f25ed..29e09ef13 100644 Binary files a/doc/salome/gui/SMESH/images/netgen2d.png and b/doc/salome/gui/SMESH/images/netgen2d.png differ diff --git a/doc/salome/gui/SMESH/images/orientaation1.png b/doc/salome/gui/SMESH/images/orientaation1.png index c23b0b8a8..667d3db1c 100755 Binary files a/doc/salome/gui/SMESH/images/orientaation1.png and b/doc/salome/gui/SMESH/images/orientaation1.png differ diff --git a/doc/salome/gui/SMESH/images/patternmapping1.png b/doc/salome/gui/SMESH/images/patternmapping1.png index 14daae187..7c86883ea 100755 Binary files a/doc/salome/gui/SMESH/images/patternmapping1.png and b/doc/salome/gui/SMESH/images/patternmapping1.png differ diff --git a/doc/salome/gui/SMESH/images/patternmapping2.png b/doc/salome/gui/SMESH/images/patternmapping2.png index fbcf35544..59adeb732 100755 Binary files a/doc/salome/gui/SMESH/images/patternmapping2.png and b/doc/salome/gui/SMESH/images/patternmapping2.png differ diff --git a/doc/salome/gui/SMESH/images/removeelements.png b/doc/salome/gui/SMESH/images/removeelements.png index 42a79b5b1..b743efb31 100755 Binary files a/doc/salome/gui/SMESH/images/removeelements.png and b/doc/salome/gui/SMESH/images/removeelements.png differ diff --git a/doc/salome/gui/SMESH/images/removenodes.png b/doc/salome/gui/SMESH/images/removenodes.png index cfcb777c6..c7d4ba591 100755 Binary files a/doc/salome/gui/SMESH/images/removenodes.png and b/doc/salome/gui/SMESH/images/removenodes.png differ diff --git a/doc/salome/gui/SMESH/images/renumberelements.png b/doc/salome/gui/SMESH/images/renumberelements.png index 0812b5066..4fef9d40f 100755 Binary files a/doc/salome/gui/SMESH/images/renumberelements.png and b/doc/salome/gui/SMESH/images/renumberelements.png differ diff --git a/doc/salome/gui/SMESH/images/renumbernodes.png b/doc/salome/gui/SMESH/images/renumbernodes.png index 90a0eda13..8298cabfd 100755 Binary files a/doc/salome/gui/SMESH/images/renumbernodes.png and b/doc/salome/gui/SMESH/images/renumbernodes.png differ diff --git a/doc/salome/gui/SMESH/images/revolution1.png b/doc/salome/gui/SMESH/images/revolution1.png index 0334e3b7e..17307999b 100755 Binary files a/doc/salome/gui/SMESH/images/revolution1.png and b/doc/salome/gui/SMESH/images/revolution1.png differ diff --git a/doc/salome/gui/SMESH/images/revolution2.png b/doc/salome/gui/SMESH/images/revolution2.png index 5612f9106..1f20ac0d8 100755 Binary files a/doc/salome/gui/SMESH/images/revolution2.png and b/doc/salome/gui/SMESH/images/revolution2.png differ diff --git a/doc/salome/gui/SMESH/images/revolutionsn1.png b/doc/salome/gui/SMESH/images/revolutionsn1.png new file mode 100644 index 000000000..6564c7fc6 Binary files /dev/null and b/doc/salome/gui/SMESH/images/revolutionsn1.png differ diff --git a/doc/salome/gui/SMESH/images/revolutionsn2.png b/doc/salome/gui/SMESH/images/revolutionsn2.png new file mode 100644 index 000000000..67a673144 Binary files /dev/null and b/doc/salome/gui/SMESH/images/revolutionsn2.png differ diff --git a/doc/salome/gui/SMESH/images/rotation.png b/doc/salome/gui/SMESH/images/rotation.png index aed7744ba..afde4eda3 100755 Binary files a/doc/salome/gui/SMESH/images/rotation.png and b/doc/salome/gui/SMESH/images/rotation.png differ diff --git a/doc/salome/gui/SMESH/images/selectionfilterlibrary.png b/doc/salome/gui/SMESH/images/selectionfilterlibrary.png index f07c09641..90d7af581 100755 Binary files a/doc/salome/gui/SMESH/images/selectionfilterlibrary.png and b/doc/salome/gui/SMESH/images/selectionfilterlibrary.png differ diff --git a/doc/salome/gui/SMESH/images/sewing1.png b/doc/salome/gui/SMESH/images/sewing1.png index 795d7a06b..cd74a2839 100755 Binary files a/doc/salome/gui/SMESH/images/sewing1.png and b/doc/salome/gui/SMESH/images/sewing1.png differ diff --git a/doc/salome/gui/SMESH/images/sewing2.png b/doc/salome/gui/SMESH/images/sewing2.png index 66a409973..f9136e24c 100755 Binary files a/doc/salome/gui/SMESH/images/sewing2.png and b/doc/salome/gui/SMESH/images/sewing2.png differ diff --git a/doc/salome/gui/SMESH/images/sewing3.png b/doc/salome/gui/SMESH/images/sewing3.png index 6c74f1cbf..919a3be4d 100755 Binary files a/doc/salome/gui/SMESH/images/sewing3.png and b/doc/salome/gui/SMESH/images/sewing3.png differ diff --git a/doc/salome/gui/SMESH/images/sewing4.png b/doc/salome/gui/SMESH/images/sewing4.png index cd9869a85..0adfa6a0c 100755 Binary files a/doc/salome/gui/SMESH/images/sewing4.png and b/doc/salome/gui/SMESH/images/sewing4.png differ diff --git a/doc/salome/gui/SMESH/images/smoothing.png b/doc/salome/gui/SMESH/images/smoothing.png index 0fda00a22..dbd903ea9 100755 Binary files a/doc/salome/gui/SMESH/images/smoothing.png and b/doc/salome/gui/SMESH/images/smoothing.png differ diff --git a/doc/salome/gui/SMESH/images/symmetry1.png b/doc/salome/gui/SMESH/images/symmetry1.png index c8fda3e9d..af9e4d29e 100755 Binary files a/doc/salome/gui/SMESH/images/symmetry1.png and b/doc/salome/gui/SMESH/images/symmetry1.png differ diff --git a/doc/salome/gui/SMESH/images/symmetry2.png b/doc/salome/gui/SMESH/images/symmetry2.png index b92fdd9f6..5af1c2039 100755 Binary files a/doc/salome/gui/SMESH/images/symmetry2.png and b/doc/salome/gui/SMESH/images/symmetry2.png differ diff --git a/doc/salome/gui/SMESH/images/symmetry3.png b/doc/salome/gui/SMESH/images/symmetry3.png index b573636bc..35533ea05 100755 Binary files a/doc/salome/gui/SMESH/images/symmetry3.png and b/doc/salome/gui/SMESH/images/symmetry3.png differ diff --git a/doc/salome/gui/SMESH/images/translation1.png b/doc/salome/gui/SMESH/images/translation1.png index f6909fbdb..320e2fc95 100755 Binary files a/doc/salome/gui/SMESH/images/translation1.png and b/doc/salome/gui/SMESH/images/translation1.png differ diff --git a/doc/salome/gui/SMESH/images/translation2.png b/doc/salome/gui/SMESH/images/translation2.png index d1923e67f..553653996 100755 Binary files a/doc/salome/gui/SMESH/images/translation2.png and b/doc/salome/gui/SMESH/images/translation2.png differ diff --git a/doc/salome/gui/SMESH/images/uniongroups.png b/doc/salome/gui/SMESH/images/uniongroups.png index 936c3b9f7..ead30c82b 100755 Binary files a/doc/salome/gui/SMESH/images/uniongroups.png and b/doc/salome/gui/SMESH/images/uniongroups.png differ diff --git a/doc/salome/gui/SMESH/images/unionoftwotriangles.png b/doc/salome/gui/SMESH/images/unionoftwotriangles.png index b9d2bdbd7..8e80411e0 100755 Binary files a/doc/salome/gui/SMESH/images/unionoftwotriangles.png and b/doc/salome/gui/SMESH/images/unionoftwotriangles.png differ diff --git a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc index 716ddd90d..1d6154014 100644 --- a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc @@ -102,9 +102,7 @@ length, you define only the Number of Segments. \image html b-mberofsegments.png -
Scale Distribution - each next segment differs from the -previous according to the formula: Ai+1 = Ai * k, where \b k is a -Scale Factor. +
Scale Distribution - length of segments gradually changes depending on the Scale Factor, which is a ratio of the first segment length to the last segment length. \image html a-nbsegments2.png diff --git a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc index f55d75d8d..35d3bc65a 100644 --- a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc @@ -38,7 +38,7 @@ operations. \image html addnode.png In this dialog box set coordinates for your node in the \b Coordinates -set of fields and click the \b Apply or \b OK button. Your node will be +set of fields and click the \b Apply or Apply and Close button. Your node will be created: \image html add_node.png @@ -51,7 +51,7 @@ created: In this dialog box specify the nodes which will form your edge by selecting them in the 3D viewer with pressed Shift button and click -the \b Apply or \b OK button. Your edge will be created: +the \b Apply or Apply and Close button. Your edge will be created: \image html add_edge.png @@ -63,7 +63,7 @@ the \b Apply or \b OK button. Your edge will be created: In this dialog box specify the nodes which will form your triangle by selecting them in the 3D viewer with pressed Shift button and click -the \b Apply or \b OK button. Your triangle will be created: +the \b Apply or Apply and Close button. Your triangle will be created: \image html add_triangle.png @@ -75,7 +75,7 @@ the \b Apply or \b OK button. Your triangle will be created: In this dialog box specify the nodes which will form your quadrangle by selecting them in the 3D viewer with pressed Shift button and click -the \b Apply or \b OK button. Your quadrangle will be created: +the \b Apply or Apply and Close button. Your quadrangle will be created: \image html add_quadrangle.png @@ -87,7 +87,7 @@ the \b Apply or \b OK button. Your quadrangle will be created: In this dialog box specify the nodes which will form your polygon by selecting them in the 3D viewer with pressed Shift button and click -the \b Apply or \b OK button. +the \b Apply or Apply and Close button. \image html add_polygone.png @@ -99,7 +99,7 @@ the \b Apply or \b OK button. In this dialog box specify the nodes which will form your tetrahedron by selecting them in the 3D viewer with pressed Shift button and click -the \b Apply or \b OK button. Your tetrahedron will be created: +the \b Apply or Apply and Close button. Your tetrahedron will be created: \image html image70.jpg @@ -111,7 +111,7 @@ the \b Apply or \b OK button. Your tetrahedron will be created: In this dialog box specify the nodes which will form your hexahedron by selecting them in the 3D viewer with pressed Shift button and click -the \b Apply or \b OK button. Your hexahedron will be created: +the \b Apply or Apply and Close button. Your hexahedron will be created: \image html image71.jpg @@ -133,7 +133,7 @@ it does not provide you with the necessary level of precision. If you select \b Face as Elements Type, you will be able to select the faces which will form your polyhedron in the 3D viewer with pressed Shift button. If you've managed to obtain the necessary result, click the -\b Apply or \b OK button. Your polyhedron will be created: +\b Apply or Apply and Close button. Your polyhedron will be created: \image html add_polyhedron.png diff --git a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc index 50d8eafb1..a6e4b20dd 100644 --- a/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_quadratic_elements.doc @@ -26,7 +26,7 @@ selection).The edges formed by the corner nodes will appear in the table. To define the middle nodes for each edge double-click on the respective field and input the number of the node. All edges and the object formed by them will be displayed in the Object browser. When -all edges are defined you will be able to click \b OK or \b Apply button to +all edges are defined you will be able to click \b Apply or Apply and Close button to add the element to the mesh. \image html aqt.png diff --git a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc index fa1772524..a1231dbba 100644 --- a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc +++ b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc @@ -21,7 +21,7 @@ shape of a mesh.
  • For meshing of 2D entities (faces):
  • +Note that BLSURF and GHS3D are commercial meshers.\n + There also is a number of more specific algorithms: -
  • Click the \b Apply or \b OK button to confirm the operation.
  • +
  • Click the \b Apply or Apply and Close button to confirm the operation.

  • See Also a sample TUI Script of a diff --git a/doc/salome/gui/SMESH/input/clipping.doc b/doc/salome/gui/SMESH/input/clipping.doc index 858789e9a..6c6346ee1 100644 --- a/doc/salome/gui/SMESH/input/clipping.doc +++ b/doc/salome/gui/SMESH/input/clipping.doc @@ -23,6 +23,6 @@ cross-section in the 3D Viewer. \image html image99.gif -To get a new object from \b Clipping, click \b Ok. +To get a new object from \b Clipping, click \b Apply. */ diff --git a/doc/salome/gui/SMESH/input/constructing_meshes.doc b/doc/salome/gui/SMESH/input/constructing_meshes.doc index 995ee4377..d905ff23e 100644 --- a/doc/salome/gui/SMESH/input/constructing_meshes.doc +++ b/doc/salome/gui/SMESH/input/constructing_meshes.doc @@ -90,12 +90,14 @@ failure is provided. \image html meshcomputationfail.png After you select the error, Show Subshape button allows -visualizing the mesh elements that cause it. +visualizing the geometrical entity that causes it. \image html failed_computation.png -Publish Subshape button allows importing it in a separate MED -or UNV file. +Publish Subshape button publishes the subshape, whose meshing +failed, in GEOM component as a child of the mesh geometry, which +allows analyzing the problem geometry and creating a submesh on it in +order to locally tune hypotheses. NOTE It is possible to define a 1D or a 2D mesh in a python script and then use such submeshes in the construction of a 3D diff --git a/doc/salome/gui/SMESH/input/creating_groups.doc b/doc/salome/gui/SMESH/input/creating_groups.doc index bba92d58a..d21a4d78e 100644 --- a/doc/salome/gui/SMESH/input/creating_groups.doc +++ b/doc/salome/gui/SMESH/input/creating_groups.doc @@ -43,11 +43,12 @@ mesh elements. \n Select from set of fields allows to choose a submesh or an existing group whose elements of the previously defined type will be added to the list of elements which will form your group. -\n Color Number (integer only, ranging from 0 to 9999) - allows to -assign to the group a certain index, for example, defining boundary -conditions. This feature introduces a useful element of preprocessing -in Mesh module. Note that Color number attribute has nothing to do -with the colors used for the display of the elements of the group. +\n Color - allows to assign to the group a certain color, for +example, defining boundary conditions. This feature introduces a +useful element of preprocessing in Mesh module. Note that Color attribute defines +the colors used for the display of the elements of the group. +\n Warning The Med Color group interface may change in future versions of Salome. + \image html creategroup.png diff --git a/doc/salome/gui/SMESH/input/creating_meshes.doc b/doc/salome/gui/SMESH/input/creating_meshes.doc index 3f392f2fc..b8256ada9 100644 --- a/doc/salome/gui/SMESH/input/creating_meshes.doc +++ b/doc/salome/gui/SMESH/input/creating_meshes.doc @@ -21,6 +21,8 @@
  • \ref a2d_meshing_hypo_page
  • \ref max_element_volume_hypo_page
  • \ref netgen_2d_3d_hypo_page
  • +
  • \ref ghs3d_hypo_page
  • +
  • \ref blsurf_hypo_page
  • \ref additional_hypo_page
  • \subpage constructing_submeshes_page
  • diff --git a/doc/salome/gui/SMESH/input/cutting_quadrangles.doc b/doc/salome/gui/SMESH/input/cutting_quadrangles.doc index d857165e1..be6d0fdd8 100644 --- a/doc/salome/gui/SMESH/input/cutting_quadrangles.doc +++ b/doc/salome/gui/SMESH/input/cutting_quadrangles.doc @@ -50,7 +50,7 @@ list. -
  • Click the \b Apply or \b OK button to confirm the operation.
  • +
  • Click the \b Apply or Apply and Close button to confirm the operation.
  • \image html image52.jpg diff --git a/doc/salome/gui/SMESH/input/defining_hypo.doc b/doc/salome/gui/SMESH/input/defining_hypo.doc index 5a4eb7503..fb4fa9728 100644 --- a/doc/salome/gui/SMESH/input/defining_hypo.doc +++ b/doc/salome/gui/SMESH/input/defining_hypo.doc @@ -8,6 +8,8 @@
  • \subpage a2d_meshing_hypo_page
  • \subpage max_element_volume_hypo_page
  • \subpage netgen_2d_3d_hypo_page
  • +
  • \subpage ghs3d_hypo_page
  • +
  • \subpage blsurf_hypo_page
  • \subpage additional_hypo_page
  • diff --git a/doc/salome/gui/SMESH/input/deleting_groups.doc b/doc/salome/gui/SMESH/input/deleting_groups.doc index 02779cde6..21eea88df 100644 --- a/doc/salome/gui/SMESH/input/deleting_groups.doc +++ b/doc/salome/gui/SMESH/input/deleting_groups.doc @@ -6,8 +6,8 @@ select one or several groups you wish to delete in the 3D viewer or in the Object Browser. \n The selected groups will be listed in Delete groups with contents -menu. Then click Ok button to remove the selected groups and close the -menu or Apply button to remove them and proceed with the selection. +menu. Then click Apply and Close button to remove the selected groups and close the +menu or \b Apply button to remove them and proceed with the selection. \image html deletegroups.png diff --git a/doc/salome/gui/SMESH/input/diagonal_inversion_of_elements.doc b/doc/salome/gui/SMESH/input/diagonal_inversion_of_elements.doc index 871e110cc..998665996 100644 --- a/doc/salome/gui/SMESH/input/diagonal_inversion_of_elements.doc +++ b/doc/salome/gui/SMESH/input/diagonal_inversion_of_elements.doc @@ -20,7 +20,7 @@ The following dialog box shall appear:
  • Enter the ID of the required edge in the \b Edge field or select this edge in the 3D viewer.
  • -
  • Click the \b Apply or \b OK button.
  • +
  • Click the \b Apply or Apply and Close button.
  • \image html image38.jpg diff --git a/doc/salome/gui/SMESH/input/editing_groups.doc b/doc/salome/gui/SMESH/input/editing_groups.doc index 5658f2f4e..3a69e757a 100644 --- a/doc/salome/gui/SMESH/input/editing_groups.doc +++ b/doc/salome/gui/SMESH/input/editing_groups.doc @@ -17,7 +17,7 @@ The following dialog box will appear: In this dialog box you can modify the name of your group and add or remove the elements forming it. For more information see \ref creating_groups_page "Creating Groups" page. -
  • Click the \b OK or \b Apply button to confirm modification of the +
  • Click the \b Apply or Apply and Close button to confirm modification of the group.
  • diff --git a/doc/salome/gui/SMESH/input/extrusion_along_path.doc b/doc/salome/gui/SMESH/input/extrusion_along_path.doc index ce96f99d9..f11746aa0 100644 --- a/doc/salome/gui/SMESH/input/extrusion_along_path.doc +++ b/doc/salome/gui/SMESH/input/extrusion_along_path.doc @@ -135,6 +135,9 @@ button and remove them from the list by pressing the "Remove" button. \image html image106.gif
    "Remove" button
    +Linear variation of the angles option allows defining the angle of gradual rotation for the whole path. +At each step the shape will be rotated by angle/nb. of steps. + diff --git a/doc/salome/gui/SMESH/input/ghs3d_hypo.doc b/doc/salome/gui/SMESH/input/ghs3d_hypo.doc new file mode 100644 index 000000000..15622b971 --- /dev/null +++ b/doc/salome/gui/SMESH/input/ghs3d_hypo.doc @@ -0,0 +1,68 @@ +/*! + +\page ghs3d_hypo_page GHS3D Parameters hypothesis + +\n GHS3D Parameters hypothesis works only with Tetrahedron (GHS3D) +algorithm. This algorithm is a commercial software. + +\image html ghs3d_parameters_basic.png + + + +*/ \ No newline at end of file diff --git a/doc/salome/gui/SMESH/input/index.doc b/doc/salome/gui/SMESH/input/index.doc index f09cdea83..4f772a285 100644 --- a/doc/salome/gui/SMESH/input/index.doc +++ b/doc/salome/gui/SMESH/input/index.doc @@ -26,6 +26,8 @@
  • \ref a2d_meshing_hypo_page
  • \ref max_element_volume_hypo_page
  • \ref netgen_2d_3d_hypo_page
  • +
  • \ref ghs3d_hypo_page
  • +
  • \ref blsurf_hypo_page
  • \ref additional_hypo_page
  • \ref constructing_submeshes_page
  • diff --git a/doc/salome/gui/SMESH/input/merging_elements.doc b/doc/salome/gui/SMESH/input/merging_elements.doc index fef7cd25a..9fa748059 100644 --- a/doc/salome/gui/SMESH/input/merging_elements.doc +++ b/doc/salome/gui/SMESH/input/merging_elements.doc @@ -8,41 +8,35 @@ selectable in the dialog box. \image html mergeelems.png - -
  • To confirm your choice click \b OK or \b Apply button.
  • - In this picture you see a triangle which coincides with one of the elements of the mesh. After we apply Merge Elements functionality, the @@ -50,7 +44,7 @@ triangle will be completely merged with the mesh. \image html meshtrianglemergeelem1.png -
    See Also a sample TUI Script of a -\ref tui_merging_elements "Merge Elements" operation. +
    See Also a sample TUI Script of a +\ref tui_merging_elements "Merge Elements" operation. */ diff --git a/doc/salome/gui/SMESH/input/merging_nodes.doc b/doc/salome/gui/SMESH/input/merging_nodes.doc index 7c5d62273..e5ad35753 100644 --- a/doc/salome/gui/SMESH/input/merging_nodes.doc +++ b/doc/salome/gui/SMESH/input/merging_nodes.doc @@ -48,7 +48,7 @@ one.
    -
  • To confirm your choice click \b OK or \b Apply button.
  • +
  • To confirm your choice click \b Apply or Apply and Close button.
  • \image html merging_nodes1.png diff --git a/doc/salome/gui/SMESH/input/moving_nodes.doc b/doc/salome/gui/SMESH/input/moving_nodes.doc index 2c0cd795b..5842401a6 100644 --- a/doc/salome/gui/SMESH/input/moving_nodes.doc +++ b/doc/salome/gui/SMESH/input/moving_nodes.doc @@ -23,7 +23,7 @@ The following dialog box shall appear: select this node in the 3D viewer. The coordinates of your node will be automatically displayed in the \b Coordinates set of fields.
  • Set new coordinates for your node in the \b Coordinates set of fields.
  • -
  • Click the \b Apply or \b OK button.
  • +
  • Click the \b Apply or Apply and Close button.
  • \image html moving_nodes1.png diff --git a/doc/salome/gui/SMESH/input/removing_nodes_and_elements.doc b/doc/salome/gui/SMESH/input/removing_nodes_and_elements.doc index be1944a48..a9fb5c7f3 100644 --- a/doc/salome/gui/SMESH/input/removing_nodes_and_elements.doc +++ b/doc/salome/gui/SMESH/input/removing_nodes_and_elements.doc @@ -7,6 +7,7 @@
    @@ -62,13 +63,32 @@ The following dialog box will appear: In this dialog box you can specify one or several elements of your mesh (with pressed Shift button) by choosing them in the 3D viewer. -
  • Click OK or Apply to confirm deletion of the specified elements.
  • +
  • Click \b Apply or Apply and Close to confirm deletion of the specified elements.
  • \image html remove_elements1.png \image html remove_elements2.png + +
    +\anchor clear_mesh_anchor +

    Clearing Mesh Data

    + +To remove all nodes and all types of cells in your mesh at once: +
      +
    1. Select your mesh in the Object Browser or in the 3D viewer.
    2. + +
    3. From the Modification menu choose Remove and from the associated +submenu select the Clear Mesh Data, or just click "Clear Mesh Data" +button in the toolbar. You can also right-click on the mesh in the +Object Browser and select Clear Mesh Data in the pop-up menu. +
    + +\image html mesh_clear.png +
    "Clear Mesh Data" button
    + +
    See Also a sample TUI Script of a \ref tui_removing_nodes_and_elements "Removing Nodes and Elements" operation. diff --git a/doc/salome/gui/SMESH/input/renumbering_nodes_and_elements.doc b/doc/salome/gui/SMESH/input/renumbering_nodes_and_elements.doc index 9ed74c377..21c7be752 100644 --- a/doc/salome/gui/SMESH/input/renumbering_nodes_and_elements.doc +++ b/doc/salome/gui/SMESH/input/renumbering_nodes_and_elements.doc @@ -29,7 +29,7 @@ The following dialog box will appear:
  • Fill the \b Mesh field by selecting your mesh in the Object Browser or in the 3D viewer.
  • -
  • Click the \b Apply or \b OK button to perform the operation.
  • +
  • Click the \b Apply or Apply and Close button to perform the operation.

  • @@ -52,7 +52,7 @@ The following dialog box will appear:
  • Fill the \b Mesh field by selecting your mesh in the Object Browser or in the 3D viewer.
  • -
  • Click the \b Apply or \b OK button to perform the operation.
  • +
  • Click the \b Apply or Apply and Close button to perform the operation.

  • See Also a sample TUI Script of a diff --git a/doc/salome/gui/SMESH/input/revolution.doc b/doc/salome/gui/SMESH/input/revolution.doc index 60ee2ab8e..6f3f289d0 100644 --- a/doc/salome/gui/SMESH/input/revolution.doc +++ b/doc/salome/gui/SMESH/input/revolution.doc @@ -32,10 +32,22 @@ selecting them in the 3D viewer or select the whole mesh or submesh,
  • specify the axis (point and vector) around which the elements will be revolved,
  • -
  • angle of rotation,
  • -
  • number of steps,
  • +
  • angle of rotation and number of steps,
  • +
  • tolerance of rotation
  • + +
  • Preview checkbox allows showing the results of parameter-setting in the viewer
  • Generate Groups checkbox allows copying the groups of elements of the source mesh to the newly created one.
  • @@ -43,7 +55,6 @@ elements of the source mesh to the newly created one.
  • Click the \b Apply or \b OK button.
  • -\image html image78.jpg
    See Also a sample TUI Script of a \ref tui_revolution "Revolution" operation. diff --git a/doc/salome/gui/SMESH/input/selection_filter_library.doc b/doc/salome/gui/SMESH/input/selection_filter_library.doc index 613febb9c..70dc9a65f 100644 --- a/doc/salome/gui/SMESH/input/selection_filter_library.doc +++ b/doc/salome/gui/SMESH/input/selection_filter_library.doc @@ -25,8 +25,10 @@ criterion. The \b Clear button deletes all criteria. \n Each Entity type has its specific list of criteria, however all filters have common syntax. For each criterion you should specify the Threshold Value and whether we search for the elements that should be -\b More, \b Less or \b Equal to this \b Value. You should also specify if the -criterion is \b Unary or \b Binary. +\b More, \b Less or \b Equal to this \b Value. You can also nagate the +sense of a criterion using \b Unary operator Not and you should +specify logical relations between criteria using \b Binary operators +Or and And. \n Some criteria should have the additional parameter of \b Tolerance. When we create a Standalone Group using filters (for this click @@ -40,7 +42,115 @@ the whole \b Mesh, the Initial Selection or the Current Group. existing filter from Selection filter library and Add to... button gives you a possibility to save your current filter in the Library. +\n Note: If button Apply and Close is disabled, there +is no selected mesh in Object Browser and the filter can not be +created. You have to select the mesh and the button will be enabled. \image html a-filteronedges.png -*/ \ No newline at end of file +Some criteria are applicable to all Entity types: + + +The following criteria are applicable to all Entity types except Volumes: + + +Additional criteria to select mesh Edges are the following: + + +Additional criteria to select mesh Faces are the following: + + +Additional criteria to select mesh Volumes are the following: + + + +*/ diff --git a/doc/salome/gui/SMESH/input/sewing_meshes.doc b/doc/salome/gui/SMESH/input/sewing_meshes.doc index e40f8fdc8..eff82ab4b 100644 --- a/doc/salome/gui/SMESH/input/sewing_meshes.doc +++ b/doc/salome/gui/SMESH/input/sewing_meshes.doc @@ -18,7 +18,7 @@ and from its sub-menu select the \b Sewing item.
  • Check in the dialog box one of the radio buttons corresponding to the type of sewing operation you would like to perform.
  • Fill the other fields available in the dialog box.
  • -
  • Click the \b OK or \b Apply button to perform the operation of sewing.
  • +
  • Click the \b Apply or Apply and Close button to perform the operation of sewing.

  • diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index 6e2b421c9..a21f56d2e 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -5,14 +5,25 @@ \n Python package smesh defines several classes, destined for easy and clear mesh creation and edition (see the \ref introduction_to_mesh_python_page "example"). +\n Documentation for smesh package is now available in two forms. + +\n 1. Here you can find structured + documentation for smesh package, where all methods and + classes are grouped by their functionality, like it is done in + the GUI documentation. + +\n 2. And here the \ref smeshDC "linear documentation for smesh package" + is represented, grouped only by classes, declared in the smesh.py file. + \n Please draw your attention to the below notes before address to -the \ref smeshDC "documentation for smesh.py" +the documentation" -\n 1. The main page of the \ref smeshDC "documentation for smesh.py" - contains a list of data structures and a list of functions, - provided by the package smesh.py. The first item in the data - structures list (\ref smeshDC::smeshDC "class smesh") also - represents documentation for methods of the package smesh.py itself. +\n 1. The main page of the \ref smeshDC "linear documentation for smesh package" + contains a list of data structures and a list of + functions, provided by the package smesh.py. The first item in + the data structures list (\ref smeshDC::smeshDC "class smesh") + also represents documentation for methods of the package + smesh.py itself. \n 2. Package smesh.py gives interface to create and manage meshes. Please, use it to create an empty mesh or to import @@ -24,7 +35,7 @@ the \ref smeshDC "documentation for smesh.py" data structures list). \n 4. Class Mesh allows to assign algorithms to a mesh. -\n \t Please note, that there are always available some algorithms, +\n Please note, that there are always available some algorithms, included in standard Salome installation: - REGULAR(1D), COMPOSITE(1D), MEFISTO(2D), Quadrangle(2D), Hexa(3D), etc. @@ -33,9 +44,9 @@ the \ref smeshDC "documentation for smesh.py" - NETGEN(1D-2D,2D,1D-2D-3D,3D), \n others are based on commercial meshers: - - GHS3D(3D). + - GHS3D(3D), BLSURF(2D). -\n \t To add hypotheses, please use interfaces, provided by the +\n To add hypotheses, please use interfaces, provided by the assigned algorithms. */ diff --git a/doc/salome/gui/SMESH/input/symmetry.doc b/doc/salome/gui/SMESH/input/symmetry.doc index efbad6595..c18089e63 100644 --- a/doc/salome/gui/SMESH/input/symmetry.doc +++ b/doc/salome/gui/SMESH/input/symmetry.doc @@ -33,10 +33,10 @@ or some of its elements specifying: \n When Create as new mesh radio button is selected, the source mesh (or elements) remains at its previous location and a new mesh is created at the new location and appears in the Object Browser with the default name MeshName_mirrored (you can change this name in the adjacent box). \n Copy groups checkbox allows copying the groups of elements of the source mesh to the newly created one. -. + \par
    See Also a sample TUI Script of a \ref tui_symmetry "Symmetry" operation. -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/uniting_set_of_triangles.doc b/doc/salome/gui/SMESH/input/uniting_set_of_triangles.doc index fc3a74aed..9c1413523 100644 --- a/doc/salome/gui/SMESH/input/uniting_set_of_triangles.doc +++ b/doc/salome/gui/SMESH/input/uniting_set_of_triangles.doc @@ -37,7 +37,7 @@ the list. -
  • Click the \b Apply or \b OK button to confirm the operation.
  • +
  • Click the \b Apply or Apply and Close button to confirm the operation.
  • If some selected triangle elements have no adjacent edges with one of diff --git a/doc/salome/gui/SMESH/input/uniting_two_triangles.doc b/doc/salome/gui/SMESH/input/uniting_two_triangles.doc index 36d46f688..ef883522e 100644 --- a/doc/salome/gui/SMESH/input/uniting_two_triangles.doc +++ b/doc/salome/gui/SMESH/input/uniting_two_triangles.doc @@ -21,7 +21,7 @@ The following dialog box shall appear:
  • Enter the ID of the required edge in the \b Edge field or select this edge in the 3D viewer.
  • -
  • Click the \b Apply or \b OK button.
  • +
  • Click the \b Apply or Apply and Close button.
  • \image html uniting_two_triangles1.png diff --git a/doc/salome/gui/SMESH/input/using_operations_on_groups.doc b/doc/salome/gui/SMESH/input/using_operations_on_groups.doc index c6d4d75a7..12267df2b 100644 --- a/doc/salome/gui/SMESH/input/using_operations_on_groups.doc +++ b/doc/salome/gui/SMESH/input/using_operations_on_groups.doc @@ -41,7 +41,7 @@ For example, we have two groups Group1 and Group2. \image html image135.gif
    Group12
    -
  • Click the \b Ok or \b Apply button to confirm creation of the group.
  • +
  • Click the \b Apply or Apply and Close button to confirm creation of the group.
  • See Also a sample TUI Script of a @@ -77,7 +77,7 @@ For example, we have two groups Group1 and Group2. \image html image136.gif
    Group12a
    -
  • Click the \b Ok or \b Apply button to confirm creation of the group.
  • +
  • Click the \b Apply or Apply and Close button to confirm creation of the group.
  • See Also a sample TUI Script of an @@ -113,7 +113,7 @@ For example, we have two groups Group1 and Group2. \image html image137.gif
    Group12b
    -
  • Click the \b Ok or \b Apply button to confirm creation of the +
  • Click the \b Apply or Apply and Close button to confirm creation of the group.
  • diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index 362bea45a..cad0d9f62 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -101,10 +101,11 @@ module SMESH }; struct ComputeError { - short code; // ComputeErrorName or, if negative, algo specific code - string comment; // textual problem description - string algoName; - short subShapeID; // id of subshape of a shape to mesh + short code; // ComputeErrorName or, if negative, algo specific code + string comment; // textual problem description + string algoName; + short subShapeID; // id of subshape of a shape to mesh + boolean hasBadMesh; // there are elements preventing computation available for visualization }; typedef sequence compute_error_array; @@ -236,6 +237,13 @@ module SMESH in GEOM::GEOM_Object theSubObject ) raises ( SALOME::SALOME_Exception ); + /*! + * Return mesh elements preventing computation of a subshape + */ + MeshPreviewStruct GetBadInputElements( in SMESH_Mesh theMesh, + in short theSubShapeID ) + raises ( SALOME::SALOME_Exception ); + /*! * Return indeces of faces, edges and vertices of given subshapes * within theMainObject diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index fd70cc9f5..a29123bc9 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -141,7 +141,8 @@ module SMESH HYP_ALREADY_EXIST,// such hypothesis already exist HYP_BAD_DIM, // bad dimension HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group - HYP_BAD_GEOMETRY // geometry mismatches algorithm's expectation + HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation + HYP_NEED_SHAPE // algorithm can work on shape only }; /*! @@ -177,6 +178,22 @@ module SMESH const long EXTRUSION_FLAG_BOUNDARY = 1; const long EXTRUSION_FLAG_SEW = 2; + /*! + * Structure used in mesh edit preview data (MeshPreviewStruct) + */ + struct ElementSubType { ElementType SMDS_ElementType; + boolean isPoly; + long nbNodesInElement; }; + + typedef sequence types_array; + + /*! + * Structure containing mesh edit preview data + */ + struct MeshPreviewStruct { nodes_array nodesXYZ; + long_array elementConnectivities; + types_array elementTypes; }; + interface SMESH_IDSource { /*! @@ -204,6 +221,11 @@ module SMESH GEOM::GEOM_Object GetShapeToMesh() raises (SALOME::SALOME_Exception); + /*! + * Remove all nodes and elements + */ + void Clear() + raises (SALOME::SALOME_Exception); /*! * Get the subMesh object associated to a subShape. The subMesh object diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index 121f8a307..bae2f8f95 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -29,22 +29,6 @@ module SMESH { - /*! - * Structure used in mesh edit preview data - */ - struct ElementSubType { ElementType SMDS_ElementType; - boolean isPoly; - long nbNodesInElement; }; - - typedef sequence types_array; - - /*! - * Structure containing mesh edit preview data - */ - struct MeshPreviewStruct { nodes_array nodesXYZ; - long_array elementConnectivities; - types_array elementTypes; }; - /*! * This interface makes modifications on the Mesh - removing elements and nodes etc. */ diff --git a/resources/Makefile.am b/resources/Makefile.am index cd286e5c9..73391035c 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -39,6 +39,7 @@ dist_salomeres_DATA = \ mesh_area.png \ mesh_aspect.png \ mesh_aspect_3d.png \ + mesh_clear.png \ mesh_compute.png \ mesh_diagonal.png \ mesh_edit.png \ @@ -83,15 +84,11 @@ dist_salomeres_DATA = \ mesh_tree_algo_quad.png \ mesh_tree_algo_regular.png \ mesh_tree_algo_tetra.png \ - mesh_tree_algo_netgen_2d3d.png \ - mesh_tree_algo_netgen_2d.png \ mesh_tree_hypo_area.png \ mesh_tree_hypo_length.png \ mesh_tree_hypo.png \ mesh_tree_hypo_segment.png \ mesh_tree_hypo_volume.png \ - mesh_tree_hypo_netgen.png \ - mesh_tree_hypo_netgen_2d.png \ mesh_tree_mesh.png \ mesh_tree_importedmesh.png \ mesh_tree_mesh_warn.png \ diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 9a8e1f229..ff008e6d8 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -52,5 +52,6 @@ + diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml index 72fc3c05d..25cbd18bc 100644 --- a/resources/StdMeshers.xml +++ b/resources/StdMeshers.xml @@ -236,7 +236,7 @@ GetVersion() == MED::eV2_1 ) + maxSize = MED::GetNOMLength(); + else + maxSize = MED::GetNOMLength(); + int lastCharPos = min( maxSize, (int) aValue.size() ) - 1; + while ( isspace( aValue[ lastCharPos ] )) + aValue.resize( lastCharPos-- ); MED::PFamilyInfo anInfo; - string aValue = aStr.str(); if(myId == 0 || myGroupAttributVal == 0){ anInfo = theWrapper->CrFamilyInfo(theMeshInfo, aValue, @@ -382,7 +391,17 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup) myGroupNames.insert(string(theGroup->GetStoreName())); Quantity_Color aColor = theGroup->GetColor(); - myGroupAttributVal = aColor.Hue(); + double aRed = aColor.Red(); + double aGreen = aColor.Green(); + double aBlue = aColor.Blue(); + int aR = int( aRed*255 ); + int aG = int( aGreen*255 ); + int aB = int( aBlue*255 ); +// cout << "aRed = " << aR << endl; +// cout << "aGreen = " << aG << endl; +// cout << "aBlue = " << aB << endl; + myGroupAttributVal = (int)(aR*1000000 + aG*1000 + aB); + //cout << "myGroupAttributVal = " << myGroupAttributVal << endl; } //============================================================================= diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index b19cea4d0..9e4312839 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -113,10 +113,19 @@ DriverMED_R_SMESHDS_Mesh TInt aNbGrp = aFamilyInfo->GetNbGroup(); if(MYDEBUG) MESSAGE("belong to " << aNbGrp << " groups"); + bool isAttrOk = false; + if(aFamilyInfo->GetNbAttr() == aNbGrp) + isAttrOk = true; for (TInt iGr = 0; iGr < aNbGrp; iGr++) { std::string aGroupName = aFamilyInfo->GetGroupName(iGr); + if(isAttrOk){ + TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr); + aFamily->SetGroupAttributVal(anAttrVal); + } + if(MYDEBUG) MESSAGE(aGroupName); aFamily->AddGroupName(aGroupName); + } aFamily->SetId( aFamId ); myFamilies[aFamId] = aFamily; @@ -124,7 +133,7 @@ DriverMED_R_SMESHDS_Mesh } if (aMeshInfo->GetType() == MED::eSTRUCTURE){ - bool aRes = buildMeshGrille(aMed,aMeshInfo); + /*bool aRes = */buildMeshGrille(aMed,aMeshInfo); continue; } @@ -793,6 +802,9 @@ void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup) { element = *anElemsIter; theGroup->SMDSGroup().Add(element); + int aGroupAttrVal = aFamily->GetGroupAttributVal(); + if( aGroupAttrVal != 0) + theGroup->SetColorGroup(aGroupAttrVal); } if ( element ) theGroup->SetType( theGroup->SMDSGroup().GetType() ); diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index f5370662b..cd5bd4c27 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -220,10 +220,108 @@ namespace{ } }; typedef boost::shared_ptr TCoordHelperPtr; - + + + //------------------------------------------------------- + /*! + * \brief Class helping to use either SMDS_EdgeIterator, SMDS_FaceIterator + * or SMDS_VolumeIterator in the same code + */ + //------------------------------------------------------- + struct TElemIterator + { + virtual const SMDS_MeshElement* next() = 0; + virtual ~TElemIterator() {} + }; + typedef boost::shared_ptr PElemIterator; + + template< class SMDSIteratorPtr > class TypedElemIterator: public TElemIterator + { + SMDSIteratorPtr myItPtr; + public: + TypedElemIterator(SMDSIteratorPtr it): myItPtr(it) {} + virtual const SMDS_MeshElement* next() { + if ( myItPtr->more() ) return myItPtr->next(); + else return 0; + } + }; + typedef TypedElemIterator< SMDS_EdgeIteratorPtr > TEdgeIterator; + typedef TypedElemIterator< SMDS_FaceIteratorPtr > TFaceIterator; + typedef TypedElemIterator< SMDS_VolumeIteratorPtr > TVolumeIterator; + + //------------------------------------------------------- + /*! + * \brief Structure describing element type + */ + //------------------------------------------------------- + struct TElemTypeData + { + EEntiteMaillage _entity; + EGeometrieElement _geomType; + TInt _nbElems; + SMDSAbs_ElementType _smdsType; + + TElemTypeData (EEntiteMaillage entity, EGeometrieElement geom, TInt nb, SMDSAbs_ElementType type) + : _entity(entity), _geomType(geom), _nbElems( nb ), _smdsType( type ) {} + }; + + + typedef NCollection_DataMap< Standard_Address, int > TElemFamilyMap; + //typedef map TElemFamilyMap; + + //================================================================================ + /*! + * \brief Fills element to famaly ID map for element type. + * Removes all families of anElemType + */ + //================================================================================ + + void fillElemFamilyMap( TElemFamilyMap & anElemFamMap, + list & aFamilies, + const SMDSAbs_ElementType anElemType) + { + anElemFamMap.Clear(); + //anElemFamMap.clear(); + list::iterator aFamsIter = aFamilies.begin(); + while ( aFamsIter != aFamilies.end() ) + { + if ((*aFamsIter)->GetType() != anElemType) { + aFamsIter++; + } + else { + int aFamId = (*aFamsIter)->GetId(); + const set& anElems = (*aFamsIter)->GetElements(); + set::const_iterator anElemsIter = anElems.begin(); + for (; anElemsIter != anElems.end(); anElemsIter++) + { + anElemFamMap.Bind( (Standard_Address)*anElemsIter, aFamId ); + //anElemFamMap[*anElemsIter] = aFamId; + } + // remove a family from the list + aFamilies.erase( aFamsIter++ ); + } + } + } + + //================================================================================ + /*! + * \brief For an element, return family ID found in the map or a default one + */ + //================================================================================ + + int getFamilyId( const TElemFamilyMap & anElemFamMap, + const SMDS_MeshElement* anElement, + const int aDefaultFamilyId) + { + if ( anElemFamMap.IsBound( (Standard_Address) anElement )) + return anElemFamMap( (Standard_Address) anElement ); +// TElemFamilyMap::iterator elem_famNum = anElemFamMap.find( anElement ); +// if ( elem_famNum != anElemFamMap.end() ) +// return elem_famNum->second; + return aDefaultFamilyId; + } } - Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() { Status aResult = DRS_OK; @@ -231,7 +329,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() INFOS("SMDS_MESH with hasConstructionEdges() or hasConstructionFaces() do not supports!!!"); return DRS_FAIL; } - try{ + try { MESSAGE("Perform - myFile : "<GetName()); myMed->SetMeshInfo(aMeshInfo); - // Storing SMDS groups and sub-meshes - //----------------------------------- + // Storing SMDS groups and sub-meshes as med families + //---------------------------------------------------- int myNodesDefaultFamilyId = 0; int myEdgesDefaultFamilyId = 0; int myFacesDefaultFamilyId = 0; @@ -342,7 +440,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY; MESSAGE("Perform - aFamilyInfo"); - map anElemFamMap; + //cout << " DriverMED_Family::MakeFamilies() " << endl; list aFamilies; if (myAllSubMeshes) { aFamilies = DriverMED_Family::MakeFamilies @@ -359,20 +457,12 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() myDoGroupOfFaces && nbFaces, myDoGroupOfVolumes && nbVolumes); } - list::iterator aFamsIter = aFamilies.begin(); - - for (; aFamsIter != aFamilies.end(); aFamsIter++) + //cout << " myMed->SetFamilyInfo() " << endl; + list::iterator aFamsIter; + for (aFamsIter = aFamilies.begin(); aFamsIter != aFamilies.end(); aFamsIter++) { PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(myMed,aMeshInfo); myMed->SetFamilyInfo(aFamilyInfo); - int aFamId = (*aFamsIter)->GetId(); - - const set& anElems = (*aFamsIter)->GetElements(); - set::const_iterator anElemsIter = anElems.begin(); - for (; anElemsIter != anElems.end(); anElemsIter++) - { - anElemFamMap[*anElemsIter] = aFamId; - } } // Storing SMDS nodes to the MED file for the MED mesh @@ -381,648 +471,386 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() typedef map TNodeIdMap; TNodeIdMap aNodeIdMap; #endif - TInt aNbElems = myMesh->NbNodes(); - MED::TIntVector anElemNums(aNbElems); - MED::TIntVector aFamilyNums(aNbElems); - MED::TFloatVector aCoordinates(aNbElems*aMeshDimension); - for(TInt iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){ + const EModeSwitch theMode = eFULL_INTERLACE; + const ERepere theSystem = eCART; + const EBooleen theIsElemNum = eVRAI; + const EBooleen theIsElemNames = eFAUX; + const EConnectivite theConnMode = eNOD; + + TInt aNbNodes = myMesh->NbNodes(); + //cout << " myMed->CrNodeInfo() aNbNodes = " << aNbNodes << endl; + PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo, aNbNodes, + theMode, theSystem, theIsElemNum, theIsElemNames); + + //cout << " fillElemFamilyMap( SMDSAbs_Node )" << endl; + // find family numbers for nodes + TElemFamilyMap anElemFamMap; + fillElemFamilyMap( anElemFamMap, aFamilies, SMDSAbs_Node ); + + for (TInt iNode = 0; aCoordHelperPtr->Next(); iNode++) + { + // coordinates + TCoordSlice aTCoordSlice = aNodeInfo->GetCoordSlice( iNode ); for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){ - aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord); + aTCoordSlice[iCoord] = aCoordHelperPtr->GetCoord(iCoord); } + // node number int aNodeID = aCoordHelperPtr->GetID(); - anElemNums[iNode] = aNodeID; + aNodeInfo->SetElemNum( iNode, aNodeID ); #ifdef _EDF_NODE_IDS_ aNodeIdMap[aNodeID] = iNode+1; #endif + // family number const SMDS_MeshNode* aNode = aCoordHelperPtr->GetNode(); - if (anElemFamMap.find(aNode) != anElemFamMap.end()) - aFamilyNums[iNode] = anElemFamMap[aNode]; - else - aFamilyNums[iNode] = myNodesDefaultFamilyId; + int famNum = getFamilyId( anElemFamMap, aNode, myNodesDefaultFamilyId ); + aNodeInfo->SetFamNum( iNode, famNum ); } + anElemFamMap.Clear(); - MED::TStringVector aCoordNames(aMeshDimension); - MED::TStringVector aCoordUnits(aMeshDimension); - for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){ - aCoordNames[iCoord] = aCoordHelperPtr->GetName(iCoord); - aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord); + // coordinate names and units + for (TInt iCoord = 0; iCoord < aMeshDimension; iCoord++) { + aNodeInfo->SetCoordName( iCoord, aCoordHelperPtr->GetName(iCoord)); + aNodeInfo->SetCoordUnit( iCoord, aCoordHelperPtr->GetUnit(iCoord)); } - const ERepere SMDS_COORDINATE_SYSTEM = eCART; - - PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo, - aCoordinates, - eFULL_INTERLACE, - SMDS_COORDINATE_SYSTEM, - aCoordNames, - aCoordUnits, - aFamilyNums, - anElemNums); - MESSAGE("Perform - aNodeInfo->GetNbElem() = "<GetNbElem() = "<SetNodeInfo(aNodeInfo); + aNodeInfo.reset(); // free memory used for arrays + + + // Storing SMDS elements to the MED file for the MED mesh + //------------------------------------------------------- + // Write one element type at once in order to minimize memory usage (PAL19276) + + const SMDS_MeshInfo& nbElemInfo = myMesh->GetMeshInfo(); + // poly elements are not supported by med-2.1 + bool polyTypesSupported = myMed->CrPolygoneInfo(aMeshInfo,eMAILLE,ePOLYGONE,0,0); + TInt nbPolygonNodes = 0, nbPolyhedronNodes = 0, nbPolyhedronFaces = 0; - // Storing others SMDS elements to the MED file for the MED mesh - //-------------------------------------------------------------- - EEntiteMaillage SMDS_MED_ENTITY = eMAILLE; - const EConnectivite SMDS_MED_CONNECTIVITY = eNOD; + // collect info on all geom types - // Storing SMDS Edges - if(TInt aNbElems = myMesh->NbEdges()){ + list< TElemTypeData > aTElemTypeDatas; + + EEntiteMaillage anEntity = eMAILLE; #ifdef _ELEMENTS_BY_DIM_ - SMDS_MED_ENTITY = eARETE; + anEntity = eARETE; #endif - // count edges of diff types - int aNbSeg3 = 0, aNbSeg2 = 0; - SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator(); - while ( anIter->more() ) - if ( anIter->next()->NbNodes() == 3 ) - ++aNbSeg3; - aNbSeg2 = aNbElems - aNbSeg3; - - TInt aNbSeg2Conn = MED::GetNbNodes(eSEG2); - MED::TIntVector aSeg2ElemNums, aSeg2FamilyNums, aSeg2Conn; - aSeg2ElemNums .reserve( aNbSeg2 ); - aSeg2FamilyNums.reserve( aNbSeg2 ); - aSeg2Conn .reserve( aNbSeg2*aNbSeg2Conn ); - - TInt aNbSeg3Conn = MED::GetNbNodes(eSEG3); - MED::TIntVector aSeg3ElemNums, aSeg3FamilyNums, aSeg3Conn; - aSeg3ElemNums .reserve( aNbSeg3 ); - aSeg3FamilyNums.reserve( aNbSeg3 ); - aSeg3Conn .reserve( aNbSeg3*aNbSeg3Conn ); - - anIter = myMesh->edgesIterator(); - while ( anIter->more() ) { - const SMDS_MeshEdge* anElem = anIter->next(); - TInt aNbNodes = anElem->NbNodes(); - - TInt aNbConnectivity; - MED::TIntVector* anElemNums; - MED::TIntVector* aFamilyNums; - MED::TIntVector* aConnectivity; - switch(aNbNodes){ - case 2: - aNbConnectivity = aNbSeg2Conn; - anElemNums = &aSeg2ElemNums; - aFamilyNums = &aSeg2FamilyNums; - aConnectivity = &aSeg2Conn; - break; - case 3: - aNbConnectivity = aNbSeg3Conn; - anElemNums = &aSeg3ElemNums; - aFamilyNums = &aSeg3FamilyNums; - aConnectivity = &aSeg3Conn; - break; - default: - break; - } - - for(TInt iNode = 0; iNode < aNbNodes; iNode++) { - const SMDS_MeshElement* aNode = anElem->GetNode( iNode ); -#ifdef _EDF_NODE_IDS_ - aConnectivity->push_back( aNodeIdMap[aNode->GetID()] ); -#else - aConnectivity->push_back( aNode->GetID() ); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eSEG2, + nbElemInfo.NbEdges( ORDER_LINEAR ), + SMDSAbs_Edge)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eSEG3, + nbElemInfo.NbEdges( ORDER_QUADRATIC ), + SMDSAbs_Edge)); +#ifdef _ELEMENTS_BY_DIM_ + anEntity = eFACE; #endif - } + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eTRIA3, + nbElemInfo.NbTriangles( ORDER_LINEAR ), + SMDSAbs_Face)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eTRIA6, + nbElemInfo.NbTriangles( ORDER_QUADRATIC ), + SMDSAbs_Face)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eQUAD4, + nbElemInfo.NbQuadrangles( ORDER_LINEAR ), + SMDSAbs_Face)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eQUAD8, + nbElemInfo.NbQuadrangles( ORDER_QUADRATIC ), + SMDSAbs_Face)); + if ( polyTypesSupported ) { + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePOLYGONE, + nbElemInfo.NbPolygons(), + SMDSAbs_Face)); + // we need one more loop on poly elements to count nb of their nodes + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePOLYGONE, + nbElemInfo.NbPolygons(), + SMDSAbs_Face)); + } +#ifdef _ELEMENTS_BY_DIM_ + anEntity = eMAILLE; +#endif + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eTETRA4, + nbElemInfo.NbTetras( ORDER_LINEAR ), + SMDSAbs_Volume)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eTETRA10, + nbElemInfo.NbTetras( ORDER_QUADRATIC ), + SMDSAbs_Volume)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePYRA5, + nbElemInfo.NbPyramids( ORDER_LINEAR ), + SMDSAbs_Volume)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePYRA13, + nbElemInfo.NbPyramids( ORDER_QUADRATIC ), + SMDSAbs_Volume)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePENTA6, + nbElemInfo.NbPrisms( ORDER_LINEAR ), + SMDSAbs_Volume)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePENTA15, + nbElemInfo.NbPrisms( ORDER_QUADRATIC ), + SMDSAbs_Volume)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eHEXA8, + nbElemInfo.NbHexas( ORDER_LINEAR ), + SMDSAbs_Volume)); + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + eHEXA20, + nbElemInfo.NbHexas( ORDER_QUADRATIC ), + SMDSAbs_Volume)); + if ( polyTypesSupported ) { + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePOLYEDRE, + nbElemInfo.NbPolyhedrons(), + SMDSAbs_Volume)); + // we need one more loop on poly elements to count nb of their nodes + aTElemTypeDatas.push_back( TElemTypeData(anEntity, + ePOLYEDRE, + nbElemInfo.NbPolyhedrons(), + SMDSAbs_Volume)); + } - anElemNums->push_back(anElem->GetID()); + vector< bool > isElemFamMapBuilt( SMDSAbs_NbElementTypes, false ); - map::iterator edge_fam = anElemFamMap.find( anElem ); - if ( edge_fam != anElemFamMap.end() ) - aFamilyNums->push_back( edge_fam->second ); - else - aFamilyNums->push_back( myEdgesDefaultFamilyId ); - } - - if ( aNbSeg2 ) { - PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo, - SMDS_MED_ENTITY, - eSEG2, - aSeg2Conn, - SMDS_MED_CONNECTIVITY, - aSeg2FamilyNums, - aSeg2ElemNums); - myMed->SetCellInfo(aCellInfo); - } - if ( aNbSeg3 ) { - PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo, - SMDS_MED_ENTITY, - eSEG3, - aSeg3Conn, - SMDS_MED_CONNECTIVITY, - aSeg3FamilyNums, - aSeg3ElemNums); - myMed->SetCellInfo(aCellInfo); + // loop on all geom types of elements + + list< TElemTypeData >::iterator aElemTypeData = aTElemTypeDatas.begin(); + for ( ; aElemTypeData != aTElemTypeDatas.end(); ++aElemTypeData ) + { + if ( aElemTypeData->_nbElems == 0 ) + continue; + + // iterator on elements of a current type + PElemIterator elemIterator; + int defaultFamilyId = 0; + switch ( aElemTypeData->_smdsType ) { + case SMDSAbs_Edge: + elemIterator = PElemIterator( new TEdgeIterator( myMesh->edgesIterator() )); + defaultFamilyId = myEdgesDefaultFamilyId; + break; + case SMDSAbs_Face: + elemIterator = PElemIterator( new TFaceIterator( myMesh->facesIterator() )); + defaultFamilyId = myFacesDefaultFamilyId; + break; + case SMDSAbs_Volume: + elemIterator = PElemIterator( new TVolumeIterator( myMesh->volumesIterator() )); + defaultFamilyId = myVolumesDefaultFamilyId; + break; + default: + continue; } - } + int iElem = 0; - // Storing SMDS Faces - if(TInt aNbElems = myMesh->NbFaces()){ - SMDS_FaceIteratorPtr anIter = myMesh->facesIterator(); -#ifdef _ELEMENTS_BY_DIM_ - SMDS_MED_ENTITY = eFACE; -#endif - TInt aNbTriaConn = MED::GetNbNodes(eTRIA3); - MED::TIntVector anTriaElemNums; - anTriaElemNums.reserve(aNbElems); - MED::TIntVector aTriaFamilyNums; - aTriaFamilyNums.reserve(aNbElems); - MED::TIntVector aTriaConn; - aTriaConn.reserve(aNbElems*aNbTriaConn); - - TInt aNbTria6Conn = MED::GetNbNodes(eTRIA6); - MED::TIntVector anTria6ElemNums; - anTria6ElemNums.reserve(aNbElems); - MED::TIntVector aTria6FamilyNums; - aTria6FamilyNums.reserve(aNbElems); - MED::TIntVector aTria6Conn; - aTria6Conn.reserve(aNbElems*aNbTria6Conn); - - TInt aNbQuadConn = MED::GetNbNodes(eQUAD4); - MED::TIntVector aQuadElemNums; - aQuadElemNums.reserve(aNbElems); - MED::TIntVector aQuadFamilyNums; - aQuadFamilyNums.reserve(aNbElems); - MED::TIntVector aQuadConn; - aQuadConn.reserve(aNbElems*aNbQuadConn); - - TInt aNbQuad8Conn = MED::GetNbNodes(eQUAD8); - MED::TIntVector aQuad8ElemNums; - aQuad8ElemNums.reserve(aNbElems); - MED::TIntVector aQuad8FamilyNums; - aQuad8FamilyNums.reserve(aNbElems); - MED::TIntVector aQuad8Conn; - aQuad8Conn.reserve(aNbElems*aNbQuad8Conn); - - MED::TIntVector aPolygoneElemNums; - aPolygoneElemNums.reserve(aNbElems); - MED::TIntVector aPolygoneInds; - aPolygoneInds.reserve(aNbElems + 1); - aPolygoneInds.push_back(1); // reference on the first element in the connectivities - MED::TIntVector aPolygoneFamilyNums; - aPolygoneFamilyNums.reserve(aNbElems); - MED::TIntVector aPolygoneConn; - aPolygoneConn.reserve(aNbElems*aNbQuadConn); - - for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){ - const SMDS_MeshFace* anElem = anIter->next(); - TInt aNbNodes = anElem->NbNodes(); - SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); - TInt aNbConnectivity; - MED::TIntVector* anElemNums; - MED::TIntVector* aFamilyNums; - MED::TIntVector* aConnectivity; - if (anElem->IsPoly()) { - aNbConnectivity = aNbNodes; - anElemNums = &aPolygoneElemNums; - aFamilyNums = &aPolygoneFamilyNums; - aConnectivity = &aPolygoneConn; - } - else { - switch(aNbNodes){ - case 3: - aNbConnectivity = aNbTriaConn; - anElemNums = &anTriaElemNums; - aFamilyNums = &aTriaFamilyNums; - aConnectivity = &aTriaConn; - break; - case 4: - aNbConnectivity = aNbQuadConn; - anElemNums = &aQuadElemNums; - aFamilyNums = &aQuadFamilyNums; - aConnectivity = &aQuadConn; - break; - case 6: - aNbConnectivity = aNbTria6Conn; - anElemNums = &anTria6ElemNums; - aFamilyNums = &aTria6FamilyNums; - aConnectivity = &aTria6Conn; - break; - case 8: - aNbConnectivity = aNbQuad8Conn; - anElemNums = &aQuad8ElemNums; - aFamilyNums = &aQuad8FamilyNums; - aConnectivity = &aQuad8Conn; - break; - default: - break; + //cout << " Treat type " << aElemTypeData->_geomType << " nb = " <_nbElems<< endl; + // Treat POLYGONs + // --------------- + if ( aElemTypeData->_geomType == ePOLYGONE ) + { + if ( nbPolygonNodes == 0 ) { + // Count nb of nodes + while ( const SMDS_MeshElement* anElem = elemIterator->next() ) { + if ( anElem->IsPoly() ) { + nbPolygonNodes += anElem->NbNodes(); + if ( ++iElem == aElemTypeData->_nbElems ) + break; + } } } - MED::TIntVector aVector(aNbNodes); - for(TInt iNode = 0; aNodesIter->more(); iNode++){ - const SMDS_MeshElement* aNode = aNodesIter->next(); + else { + // Store in med file + PPolygoneInfo aPolygoneInfo = myMed->CrPolygoneInfo(aMeshInfo, + aElemTypeData->_entity, + aElemTypeData->_geomType, + aElemTypeData->_nbElems, + nbPolygonNodes, + theConnMode, theIsElemNum, + theIsElemNames); + TElemNum & index = *(aPolygoneInfo->myIndex.get()); + index[0] = 1; + + while ( const SMDS_MeshElement* anElem = elemIterator->next() ) + { + if ( !anElem->IsPoly() ) + continue; + + // index + TInt aNbNodes = anElem->NbNodes(); + index[ iElem+1 ] = index[ iElem ] + aNbNodes; + + // connectivity + TConnSlice aTConnSlice = aPolygoneInfo->GetConnSlice( iElem ); + for(TInt iNode = 0; iNode < aNbNodes; iNode++) { + const SMDS_MeshElement* aNode = anElem->GetNode( iNode ); #ifdef _EDF_NODE_IDS_ - aVector[iNode] = aNodeIdMap[aNode->GetID()]; + aTConnSlice[ iNode ] = aNodeIdMap[aNode->GetID()]; #else - aVector[iNode] = aNode->GetID(); + aTConnSlice[ iNode ] = aNode->GetID(); #endif - } + } + // element number + aPolygoneInfo->SetElemNum( iElem, anElem->GetID() ); - TInt aSize = aConnectivity->size(); - aConnectivity->resize(aSize+aNbConnectivity); - // There is some differences between SMDS and MED in cells mapping - switch(aNbNodes){ - case 4: - (*aConnectivity)[aSize+0] = aVector[0]; - (*aConnectivity)[aSize+1] = aVector[1]; - (*aConnectivity)[aSize+2] = aVector[3]; - (*aConnectivity)[aSize+3] = aVector[2]; - default: - for(TInt iNode = 0; iNode < aNbNodes; iNode++) - (*aConnectivity)[aSize+iNode] = aVector[iNode]; - } + // family number + int famNum = getFamilyId( anElemFamMap, anElem, defaultFamilyId ); + aPolygoneInfo->SetFamNum( iElem, famNum ); - if (anElem->IsPoly()) { - // fill indices for polygonal element - TInt aPrevPos = aPolygoneInds.back(); - aPolygoneInds.push_back(aPrevPos + aNbNodes); + if ( ++iElem == aPolygoneInfo->GetNbElem() ) + break; + } + // if(TInt aNbElems = aPolygoneElemNums.size()) + // // add one element in connectivities, + // // referenced by the last element in indices + // aPolygoneConn.push_back(0); + //cout << " SetPolygoneInfo(aPolygoneInfo)" << endl; + myMed->SetPolygoneInfo(aPolygoneInfo); } - anElemNums->push_back(anElem->GetID()); + } - if (anElemFamMap.find(anElem) != anElemFamMap.end()) - aFamilyNums->push_back(anElemFamMap[anElem]); - else - aFamilyNums->push_back(myFacesDefaultFamilyId); - } - if(TInt aNbElems = anTriaElemNums.size()){ - PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo, - SMDS_MED_ENTITY, - eTRIA3, - aTriaConn, - SMDS_MED_CONNECTIVITY, - aTriaFamilyNums, - anTriaElemNums); - MESSAGE("Perform - anEntity = "<_geomType == ePOLYEDRE ) + { + if ( nbPolyhedronNodes == 0 ) { + // Count nb of nodes + while ( const SMDS_MeshElement* anElem = elemIterator->next() ) { + const SMDS_PolyhedralVolumeOfNodes* aPolyedre = + dynamic_cast( anElem ); + if ( aPolyedre ) { + nbPolyhedronNodes += aPolyedre->NbNodes(); + nbPolyhedronFaces += aPolyedre->NbFaces(); + if ( ++iElem == aElemTypeData->_nbElems ) + break; + } } - - anElemNums = &aPolyedreElemNums; - aFamilyNums = &aPolyedreFamilyNums; - - TInt aNodeId, aNbFaces = aPolyedre->NbFaces(); - for (int iface = 1; iface <= aNbFaces; iface++) { - int aNbFaceNodes = aPolyedre->NbFaceNodes(iface); - for (int inode = 1; inode <= aNbFaceNodes; inode++) { - aNodeId = aPolyedre->GetFaceNode(iface, inode)->GetID(); + } + else { + // Store in med file + PPolyedreInfo aPolyhInfo = myMed->CrPolyedreInfo(aMeshInfo, + aElemTypeData->_entity, + aElemTypeData->_geomType, + aElemTypeData->_nbElems, + nbPolyhedronFaces+1, + nbPolyhedronNodes, + theConnMode, + theIsElemNum, + theIsElemNames); + TElemNum & index = *(aPolyhInfo->myIndex.get()); + TElemNum & faces = *(aPolyhInfo->myFaces.get()); + TElemNum & conn = *(aPolyhInfo->myConn.get()); + index[0] = 1; + faces[0] = 1; + + TInt iFace = 0, iNode = 0; + while ( const SMDS_MeshElement* anElem = elemIterator->next() ) + { + const SMDS_PolyhedralVolumeOfNodes* aPolyedre = + dynamic_cast( anElem ); + if ( !aPolyedre ) + continue; + + // index + TInt aNbFaces = aPolyedre->NbFaces(); + index[ iElem+1 ] = index[ iElem ] + aNbFaces; + + // face index + for (TInt f = 1; f <= aNbFaces; ++f, ++iFace ) { + int aNbFaceNodes = aPolyedre->NbFaceNodes( f ); + faces[ iFace+1 ] = faces[ iFace ] + aNbFaceNodes; + } + // connectivity + SMDS_ElemIteratorPtr nodeIt = anElem->nodesIterator(); + while ( nodeIt->more() ) { + const SMDS_MeshElement* aNode = nodeIt->next(); #ifdef _EDF_NODE_IDS_ - aPolyedreConn.push_back(aNodeIdMap[aNodeId]); + conn[ iNode ] = aNodeIdMap[aNode->GetID()]; #else - aPolyedreConn.push_back(aNodeId); + conn[ iNode ] = aNode->GetID(); #endif + ++iNode; } - TInt aPrevPos = aPolyedreFaces.back(); - aPolyedreFaces.push_back(aPrevPos + aNbFaceNodes); + // element number + aPolyhInfo->SetElemNum( iElem, anElem->GetID() ); + + // family number + int famNum = getFamilyId( anElemFamMap, anElem, defaultFamilyId ); + aPolyhInfo->SetFamNum( iElem, famNum ); + + if ( ++iElem == aPolyhInfo->GetNbElem() ) + break; } - TInt aPrevPos = aPolyedreInds.back(); - aPolyedreInds.push_back(aPrevPos + aNbFaces); + //cout << " SetPolyedreInfo(aPolyhInfo )" << endl; + myMed->SetPolyedreInfo(aPolyhInfo); + } + } // if (aElemTypeData->_geomType == ePOLYEDRE ) + else + { + // Treat standard types + // --------------------- + + // allocate data arrays + PCellInfo aCellInfo = myMed->CrCellInfo( aMeshInfo, + aElemTypeData->_entity, + aElemTypeData->_geomType, + aElemTypeData->_nbElems, + theConnMode, + theIsElemNum, + theIsElemNames); + // build map of family numbers for this type + if ( !isElemFamMapBuilt[ aElemTypeData->_smdsType ]) + { + //cout << " fillElemFamilyMap()" << endl; + fillElemFamilyMap( anElemFamMap, aFamilies, aElemTypeData->_smdsType ); + isElemFamMapBuilt[ aElemTypeData->_smdsType ] = true; } - else { - TInt aNbNodes = anElem->NbNodes(); - SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); - TInt aNbConnectivity; - MED::TIntVector* aConnectivity; - switch(aNbNodes){ - case 4: - aNbConnectivity = aNbTetraConn; - anElemNums = &anTetraElemNums; - aFamilyNums = &aTetraFamilyNums; - aConnectivity = &aTetraConn; - break; - case 5: - aNbConnectivity = aNbPyraConn; - anElemNums = &anPyraElemNums; - aFamilyNums = &aPyraFamilyNums; - aConnectivity = &aPyraConn; - break; - case 6: - aNbConnectivity = aNbPentaConn; - anElemNums = &anPentaElemNums; - aFamilyNums = &aPentaFamilyNums; - aConnectivity = &aPentaConn; - break; - case 8: - aNbConnectivity = aNbHexaConn; - anElemNums = &aHexaElemNums; - aFamilyNums = &aHexaFamilyNums; - aConnectivity = &aHexaConn; - break; - case 10: - aNbConnectivity = aNbTetra10Conn; - anElemNums = &anTetra10ElemNums; - aFamilyNums = &aTetra10FamilyNums; - aConnectivity = &aTetra10Conn; - break; - case 13: - aNbConnectivity = aNbPyra13Conn; - anElemNums = &anPyra13ElemNums; - aFamilyNums = &aPyra13FamilyNums; - aConnectivity = &aPyra13Conn; - break; - case 15: - aNbConnectivity = aNbPenta15Conn; - anElemNums = &anPenta15ElemNums; - aFamilyNums = &aPenta15FamilyNums; - aConnectivity = &aPenta15Conn; - break; - case 20: - aNbConnectivity = aNbHexa20Conn; - anElemNums = &aHexa20ElemNums; - aFamilyNums = &aHexa20FamilyNums; - aConnectivity = &aHexa20Conn; - } - TInt aSize = aConnectivity->size(); - aConnectivity->resize(aSize + aNbConnectivity); + TInt aNbNodes = MED::GetNbNodes(aElemTypeData->_geomType); + while ( const SMDS_MeshElement* anElem = elemIterator->next() ) + { + if ( anElem->NbNodes() != aNbNodes || anElem->IsPoly() ) + continue; // other geometry - MED::TIntVector aVector(aNbNodes); - for(TInt iNode = 0; aNodesIter->more(); iNode++){ - const SMDS_MeshElement* aNode = aNodesIter->next(); + // connectivity + TConnSlice aTConnSlice = aCellInfo->GetConnSlice( iElem ); + for (TInt iNode = 0; iNode < aNbNodes; iNode++) { + const SMDS_MeshElement* aNode = anElem->GetNode( iNode ); #ifdef _EDF_NODE_IDS_ - aVector[iNode] = aNodeIdMap[aNode->GetID()]; + aTConnSlice[ iNode ] = aNodeIdMap[aNode->GetID()]; #else - aVector[iNode] = aNode->GetID(); + aTConnSlice[ iNode ] = aNode->GetID(); #endif } - // There is some difference between SMDS and MED in cells mapping - switch(aNbNodes){ - case 5: - (*aConnectivity)[aSize+0] = aVector[0]; - (*aConnectivity)[aSize+1] = aVector[3]; - (*aConnectivity)[aSize+2] = aVector[2]; - (*aConnectivity)[aSize+3] = aVector[1]; - (*aConnectivity)[aSize+4] = aVector[4]; - default: - for(TInt iNode = 0; iNode < aNbNodes; iNode++) - (*aConnectivity)[aSize+iNode] = aVector[iNode]; - } - } + // element number + aCellInfo->SetElemNum( iElem, anElem->GetID() ); - anElemNums->push_back(anElem->GetID()); + // family number + int famNum = getFamilyId( anElemFamMap, anElem, defaultFamilyId ); + aCellInfo->SetFamNum( iElem, famNum ); - if (anElemFamMap.find(anElem) != anElemFamMap.end()) - aFamilyNums->push_back(anElemFamMap[anElem]); - else - aFamilyNums->push_back(myVolumesDefaultFamilyId); + if ( ++iElem == aCellInfo->GetNbElem() ) + break; + } + // store data in a file + //cout << " SetCellInfo(aCellInfo)" << endl; + myMed->SetCellInfo(aCellInfo); } - if(TInt aNbElems = anTetraElemNums.size()){ - PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo, - SMDS_MED_ENTITY, - eTETRA4, - aTetraConn, - SMDS_MED_CONNECTIVITY, - aTetraFamilyNums, - anTetraElemNums); - MESSAGE("Perform - anEntity = "< 0) { SMDS_MeshGroup* aNodesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Node); std::string aGrName = (useSuffix) ? aRec.GroupName + "_Nodes" : aRec.GroupName; + int i = aGrName.find( "\r" ); + if (i > 0) + aGrName.erase (i, 2); myGroupNames.insert(TGroupNamesMap::value_type(aNodesGroup, aGrName)); myGroupId.insert(TGroupIdMap::value_type(aNodesGroup, aLabel)); @@ -305,6 +308,9 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform() aEdgesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Edge); if (!useSuffix && createdGroup) useSuffix = true; std::string aEdgesGrName = (useSuffix) ? aRec.GroupName + "_Edges" : aRec.GroupName; + int i = aEdgesGrName.find( "\r" ); + if (i > 0) + aEdgesGrName.erase (i, 2); myGroupNames.insert(TGroupNamesMap::value_type(aEdgesGroup, aEdgesGrName)); myGroupId.insert(TGroupIdMap::value_type(aEdgesGroup, aLabel)); createdGroup = true; @@ -316,6 +322,9 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform() aFacesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Face); if (!useSuffix && createdGroup) useSuffix = true; std::string aFacesGrName = (useSuffix) ? aRec.GroupName + "_Faces" : aRec.GroupName; + int i = aFacesGrName.find( "\r" ); + if (i > 0) + aFacesGrName.erase (i, 2); myGroupNames.insert(TGroupNamesMap::value_type(aFacesGroup, aFacesGrName)); myGroupId.insert(TGroupIdMap::value_type(aFacesGroup, aLabel)); createdGroup = true; @@ -327,6 +336,9 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform() aVolumeGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Volume); if (!useSuffix && createdGroup) useSuffix = true; std::string aVolumeGrName = (useSuffix) ? aRec.GroupName + "_Volumes" : aRec.GroupName; + int i = aVolumeGrName.find( "\r" ); + if (i > 0) + aVolumeGrName.erase (i, 2); myGroupNames.insert(TGroupNamesMap::value_type(aVolumeGroup, aVolumeGrName)); myGroupId.insert(TGroupIdMap::value_type(aVolumeGroup, aLabel)); createdGroup = true; diff --git a/src/DriverUNV/UNV2417_Structure.cxx b/src/DriverUNV/UNV2417_Structure.cxx index a9da97d62..abc2a140e 100644 --- a/src/DriverUNV/UNV2417_Structure.cxx +++ b/src/DriverUNV/UNV2417_Structure.cxx @@ -92,7 +92,7 @@ void UNV2417::ReadGroup(const std::string& myGroupLabel, std::ifstream& in_strea std::getline(in_stream, aRec.GroupName, '\n'); // Finalise previous reading std::getline(in_stream, aRec.GroupName, '\n'); - + int aElType; int aElId; int aNum; diff --git a/src/MEFISTO2/aptrte.cxx b/src/MEFISTO2/aptrte.cxx index 8768bd1cc..b2559e323 100755 --- a/src/MEFISTO2/aptrte.cxx +++ b/src/MEFISTO2/aptrte.cxx @@ -582,7 +582,7 @@ void aptrte( Z nutysu, R aretmx, mnarcf3 = new Z[mxarcf]; if( mnarcf3 == NULL ) { - cout << "aptrte: MC saturee mnarcf3=" << mnarcf3 << endl; + MESSAGE ( "aptrte: MC saturee mnarcf3=" << mnarcf3 ); goto ERREUR; } teamqt( nutysu, aretmx, airemx, diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index cf7628f57..b54b4df79 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -287,7 +287,8 @@ SMESH_ActorDef::SMESH_ActorDef() //Fix for Bug 13314: //Incorrect "Min value" in Scalar Bar in Mesh: - myScalarBarActor->SetLabelFormat("%.4g"); + // myScalarBarActor->SetLabelFormat("%.4g"); + // changes was commented because of regression bug IPAL 19981 mgr = SUIT_Session::session()->resourceMgr(); if( !mgr ) diff --git a/src/SMDS/SMDS_MemoryLimit.cxx b/src/SMDS/SMDS_MemoryLimit.cxx index e31a9a498..99bb9b0f9 100644 --- a/src/SMDS/SMDS_MemoryLimit.cxx +++ b/src/SMDS/SMDS_MemoryLimit.cxx @@ -5,7 +5,7 @@ // Executable to find out a lower RAM limit (MB), i.e. at what size of freeRAM // reported by sysinfo, no more memory can be allocated. // This is not done inside a function of SALOME because allocated memory is not returned -// to the system +// to the system. (PAL16631) #ifndef WIN32 #include @@ -15,7 +15,9 @@ #include #endif -int main (int argc, char ** argv) { +int main (int argc, char ** argv) +{ + // To better understand what is going on here, consult bug [SALOME platform 0019911] #ifndef WIN32 struct sysinfo si; int err = sysinfo( &si ); @@ -23,8 +25,11 @@ int main (int argc, char ** argv) { return -1; unsigned long freeRamKb = ( si.freeram * si.mem_unit ) / 1024; - const unsigned long stepKb = 8; // less nb leads to hung up on Mandriva2006 without swap - // (other platforms not tested w/o swap) + // totat RAM size in Gb, float is in order not to have 1 instead of 1.9 + float totalramGb = float( si.totalram * si.mem_unit ) / 1024 / 1024 / 1024; + + // nb Kbites to allocate at one step. Small nb leads to hung up + const int stepKb = int( 5 * totalramGb ); unsigned long nbSteps = freeRamKb / stepKb * 2; try { diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 44d4259b2..02180dc5a 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -43,6 +43,9 @@ using namespace std; #include #endif +// number of added entitis to check memory after +#define CHECKMEMORY_INTERVAL 1000 + //================================================================================ /*! * \brief Raise an exception if free memory (ram+swap) too low @@ -70,7 +73,7 @@ int SMDS_Mesh::CheckMemory(const bool doNotRaise) throw (std::bad_alloc) else limit = int( limit * 1.5 ); #ifdef _DEBUG_ - cout << "SMDS_Mesh::CheckMemory() memory limit = " << limit << " MB" << endl; + MESSAGE ( "SMDS_Mesh::CheckMemory() memory limit = " << limit << " MB" ); #endif } @@ -86,7 +89,7 @@ int SMDS_Mesh::CheckMemory(const bool doNotRaise) throw (std::bad_alloc) if ( doNotRaise ) return 0; #ifdef _DEBUG_ - cout<<"SMDS_Mesh::CheckMemory() throws as free memory too low: " << freeMb <<" MB" << endl; + MESSAGE ("SMDS_Mesh::CheckMemory() throws as free memory too low: " << freeMb <<" MB" ); #endif throw std::bad_alloc(); #else @@ -151,7 +154,7 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID) // find the MeshNode corresponding to ID const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID); if(!node){ - CheckMemory(); + if ( myNodes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); SMDS_MeshNode * node=new SMDS_MeshNode(x, y, z); myNodes.Add(node); myNodeIDFactory->BindID(ID,node); @@ -200,7 +203,8 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1, { if ( !n1 || !n2 ) return 0; - CheckMemory(); + if ( myEdges.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); + SMDS_MeshEdge * edge=new SMDS_MeshEdge(n1,n2); if(myElementIDFactory->BindID(ID, edge)) { SMDS_MeshNode *node1,*node2; @@ -339,7 +343,8 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1, return NULL; if ( !e1 || !e2 || !e3 ) return 0; - CheckMemory(); + if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); + SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3); myFaces.Add(face); myInfo.myNbTriangles++; @@ -379,7 +384,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1, if (!hasConstructionEdges()) return NULL; if ( !e1 || !e2 || !e3 || !e4 ) return 0; - CheckMemory(); + if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3,e4); myFaces.Add(face); myInfo.myNbQuadrangles++; @@ -444,7 +449,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, { SMDS_MeshVolume* volume = 0; if ( !n1 || !n2 || !n3 || !n4) return volume; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if(hasConstructionFaces()) { SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3); SMDS_MeshFace * f2=FindFaceOrCreate(n1,n2,n4); @@ -530,7 +535,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, { SMDS_MeshVolume* volume = 0; if ( !n1 || !n2 || !n3 || !n4 || !n5) return volume; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if(hasConstructionFaces()) { SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3,n4); SMDS_MeshFace * f2=FindFaceOrCreate(n1,n2,n5); @@ -620,7 +625,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, { SMDS_MeshVolume* volume = 0; if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6) return volume; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if(hasConstructionFaces()) { SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3); SMDS_MeshFace * f2=FindFaceOrCreate(n4,n5,n6); @@ -722,7 +727,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, { SMDS_MeshVolume* volume = 0; if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6 || !n7 || !n8) return volume; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if(hasConstructionFaces()) { SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3,n4); SMDS_MeshFace * f2=FindFaceOrCreate(n5,n6,n7,n8); @@ -782,7 +787,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1, if (!hasConstructionFaces()) return NULL; if ( !f1 || !f2 || !f3 || !f4) return 0; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4); myVolumes.Add(volume); myInfo.myNbTetras++; @@ -826,7 +831,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1, if (!hasConstructionFaces()) return NULL; if ( !f1 || !f2 || !f3 || !f4 || !f5) return 0; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5); myVolumes.Add(volume); myInfo.myNbPyramids++; @@ -872,7 +877,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1, if (!hasConstructionFaces()) return NULL; if ( !f1 || !f2 || !f3 || !f4 || !f5 || !f6) return 0; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6); myVolumes.Add(volume); myInfo.myNbPrisms++; @@ -910,7 +915,7 @@ SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID { SMDS_MeshFace * face; - CheckMemory(); + if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if (hasConstructionEdges()) { MESSAGE("Error : Not implemented"); @@ -975,7 +980,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID const int ID) { SMDS_MeshVolume* volume; - CheckMemory(); + if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if (hasConstructionFaces()) { MESSAGE("Error : Not implemented"); return NULL; @@ -1046,7 +1051,7 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1, const SMDS_MeshNode * node3) { if ( !node1 || !node2 || !node3) return 0; - CheckMemory(); + if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if(hasConstructionEdges()) { SMDS_MeshEdge *edge1, *edge2, *edge3; @@ -1078,7 +1083,7 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1, const SMDS_MeshNode * node4) { if ( !node1 || !node2 || !node3 || !node4 ) return 0; - CheckMemory(); + if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); if(hasConstructionEdges()) { SMDS_MeshEdge *edge1, *edge2, *edge3, *edge4; @@ -1363,7 +1368,7 @@ SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1, SMDS_MeshEdge * toReturn=NULL; toReturn=const_cast(FindEdge(node1,node2)); if(toReturn==NULL) { - CheckMemory(); + if ( myEdges.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory(); toReturn=new SMDS_MeshEdge(node1,node2); myEdges.Add(toReturn); myInfo.myNbEdges++; diff --git a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx index c91f37627..2f330da67 100644 --- a/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx +++ b/src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx @@ -204,7 +204,7 @@ public: if (type == SMDSAbs_Face) vTool.GetAllExistingFaces( myElems ); else - vTool.GetAllExistingFaces( myElems ); + vTool.GetAllExistingEdges( myElems ); } /// Return true if and only if there are other object in this iterator virtual bool more() { return myIndex < myElems.size(); } diff --git a/src/SMESH/SMESH_Algo.cxx b/src/SMESH/SMESH_Algo.cxx index 47346f2da..fea326576 100644 --- a/src/SMESH/SMESH_Algo.cxx +++ b/src/SMESH/SMESH_Algo.cxx @@ -502,6 +502,7 @@ bool SMESH_Algo::error(SMESH_ComputeErrorPtr error) if ( error ) { _error = error->myName; _comment = error->myComment; + _badInputElements = error->myBadElements; return error->IsOK(); } return true; @@ -515,7 +516,11 @@ bool SMESH_Algo::error(SMESH_ComputeErrorPtr error) SMESH_ComputeErrorPtr SMESH_Algo::GetComputeError() const { - return SMESH_ComputeError::New( _error, _comment, this ); + SMESH_ComputeErrorPtr err = SMESH_ComputeError::New( _error, _comment, this ); + // hope this method is called by only SMESH_subMesh after this->Compute() + err->myBadElements.splice( err->myBadElements.end(), + (list&) _badInputElements ); + return err; } //================================================================================ @@ -528,5 +533,23 @@ void SMESH_Algo::InitComputeError() { _error = COMPERR_OK; _comment.clear(); + list::iterator elem = _badInputElements.begin(); + for ( ; elem != _badInputElements.end(); ++elem ) + if ( (*elem)->GetID() < 1 ) + delete *elem; + _badInputElements.clear(); } +//================================================================================ +/*! + * \brief store a bad input element preventing computation, + * which may be a temporary one i.e. not residing the mesh, + * then it will be deleted by InitComputeError() + */ +//================================================================================ + +void SMESH_Algo::addBadInputElement(const SMDS_MeshElement* elem) +{ + if ( elem ) + _badInputElements.push_back( elem ); +} diff --git a/src/SMESH/SMESH_Algo.hxx b/src/SMESH/SMESH_Algo.hxx index f08fd85e7..1a47fa291 100644 --- a/src/SMESH/SMESH_Algo.hxx +++ b/src/SMESH/SMESH_Algo.hxx @@ -293,6 +293,12 @@ protected: * \brief store error and return error->IsOK() */ bool error(SMESH_ComputeErrorPtr error); + /*! + * \brief store a bad input element preventing computation, + * which may be a temporary one i.e. not residing the mesh, + * then it will be deleted by InitComputeError() + */ + void addBadInputElement(const SMDS_MeshElement* elem); protected: @@ -310,6 +316,7 @@ protected: int _error; //!< SMESH_ComputeErrorName or anything algo specific std::string _comment; //!< any text explaining what is wrong in Compute() + std::list _badInputElements; //!< to explain COMPERR_BAD_INPUT_MESH }; #endif diff --git a/src/SMESH/SMESH_Block.cxx b/src/SMESH/SMESH_Block.cxx index 59d48a978..bf85ab033 100644 --- a/src/SMESH/SMESH_Block.cxx +++ b/src/SMESH/SMESH_Block.cxx @@ -495,7 +495,7 @@ Standard_Boolean SMESH_Block::Values(const math_Vector& theXYZ, return true; } #ifdef DEBUG_PARAM_COMPUTE - cout << "PARAM GUESS: " << params.X() << " "<< params.Y() << " "<< params.X() << endl; + MESSAGE ( "PARAM GUESS: " << params.X() << " "<< params.Y() << " "<< params.X() ); myNbIterations++; // how many times call ShellPoint() #endif ShellPoint( params, P ); @@ -556,8 +556,7 @@ Standard_Boolean SMESH_Block::Values(const math_Vector& theXYZ, #endif } #ifdef DEBUG_PARAM_COMPUTE - cout << "F = " << theFxyz(1) << - " DRV: " << theDf(1,1) << " " << theDf(1,2) << " " << theDf(1,3) << endl; + MESSAGE ( "F = " << theFxyz(1) << " DRV: " << theDf(1,1) << " " << theDf(1,2) << " " << theDf(1,3) ); myNbIterations +=3; // how many times call ShellPoint() #endif @@ -613,9 +612,9 @@ bool SMESH_Block::computeParameters(const gp_Pnt& thePoint, } #ifdef DEBUG_PARAM_COMPUTE mySumDist += distance(); - cout << " ------ SOLUTION: ( "<< myParam.X() <<" "<< myParam.Y() <<" "<< myParam.Z() <<" )"< theNbVertexInWires.back() ) { #ifdef _DEBUG_ gp_Pnt p = BRep_Tool::Pnt( theFirstVertex ); - cout << " : Warning : vertex "<< theFirstVertex.TShape().operator->() - << " ( " << p.X() << " " << p.Y() << " " << p.Z() << " )" - << " not found in outer wire of face "<< theFace.TShape().operator->() - << " with vertices: " << endl; + MESSAGE ( " : Warning : vertex "<< theFirstVertex.TShape().operator->() + << " ( " << p.X() << " " << p.Y() << " " << p.Z() << " )" + << " not found in outer wire of face "<< theFace.TShape().operator->() + << " with vertices: " ); wExp.Init( *wlIt, theFace ); for ( int i = 0; wExp.More(); wExp.Next(), i++ ) { @@ -1035,8 +1034,8 @@ int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace, edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() )); TopoDS_Vertex v = TopExp::FirstVertex( edge, true ); gp_Pnt p = BRep_Tool::Pnt( v ); - cout << i << " " << v.TShape().operator->() << " " - << p.X() << " " << p.Y() << " " << p.Z() << " " << endl; + MESSAGE_ADD ( i << " " << v.TShape().operator->() << " " + << p.X() << " " << p.Y() << " " << p.Z() << " " << std::endl ); } #endif break; // break infinite loop diff --git a/src/SMESH/SMESH_ComputeError.hxx b/src/SMESH/SMESH_ComputeError.hxx index 91f2712c2..07c6116b1 100644 --- a/src/SMESH/SMESH_ComputeError.hxx +++ b/src/SMESH/SMESH_ComputeError.hxx @@ -30,9 +30,11 @@ #define SMESH_ComputeError_HeaderFile #include +#include #include class SMESH_Algo; +class SMDS_MeshElement; struct SMESH_ComputeError; typedef boost::shared_ptr SMESH_ComputeErrorPtr; @@ -66,6 +68,8 @@ struct SMESH_ComputeError std::string myComment; const SMESH_Algo* myAlgo; + std::list myBadElements; //!< to explain COMPERR_BAD_INPUT_MESH + static SMESH_ComputeErrorPtr New( int error = COMPERR_OK, std::string comment = "", const SMESH_Algo* algo = 0) @@ -82,19 +86,19 @@ struct SMESH_ComputeError }; -#define case2char(err) case err: return #err; +#define _case2char(err) case err: return #err; std::string SMESH_ComputeError::CommonName() const { switch( myName ) { - case2char(COMPERR_OK ); - case2char(COMPERR_BAD_INPUT_MESH); - case2char(COMPERR_STD_EXCEPTION ); - case2char(COMPERR_OCC_EXCEPTION ); - case2char(COMPERR_SLM_EXCEPTION ); - case2char(COMPERR_EXCEPTION ); - case2char(COMPERR_MEMORY_PB ); - case2char(COMPERR_ALGO_FAILED ); + _case2char(COMPERR_OK ); + _case2char(COMPERR_BAD_INPUT_MESH); + _case2char(COMPERR_STD_EXCEPTION ); + _case2char(COMPERR_OCC_EXCEPTION ); + _case2char(COMPERR_SLM_EXCEPTION ); + _case2char(COMPERR_EXCEPTION ); + _case2char(COMPERR_MEMORY_PB ); + _case2char(COMPERR_ALGO_FAILED ); default:; } return ""; diff --git a/src/SMESH/SMESH_Hypothesis.hxx b/src/SMESH/SMESH_Hypothesis.hxx index b3c885303..a63ea921e 100644 --- a/src/SMESH/SMESH_Hypothesis.hxx +++ b/src/SMESH/SMESH_Hypothesis.hxx @@ -55,7 +55,8 @@ public: HYP_ALREADY_EXIST,// such hypothesis already exist HYP_BAD_DIM, // bad dimension HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group - HYP_BAD_GEOMETRY // shape geometry mismatches algorithm's expectation + HYP_BAD_GEOMETRY, // shape geometry mismatches algorithm's expectation + HYP_NEED_SHAPE // algorithm can work on shape only }; static bool IsStatusFatal(Hypothesis_Status theStatus) { return theStatus >= HYP_UNKNOWN_FATAL; } diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index dc852beed..4648b5a3d 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -114,6 +114,7 @@ SMESH_Mesh::~SMESH_Mesh() SMESH_Group *aGroup = (*itg).second; delete aGroup; } + _mapGroup.clear(); } //============================================================================= @@ -201,6 +202,56 @@ const TopoDS_Solid& SMESH_Mesh::PseudoShape() return aSolid; } +//======================================================================= +/*! + * \brief Remove all nodes and elements + */ +//======================================================================= + +void SMESH_Mesh::Clear() +{ + // clear sub-meshes; get ready to re-compute as a side-effect + + if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) + { + SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true, + /*complexShapeFirst=*/false); + while ( smIt->more() ) + { + sm = smIt->next(); + TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType(); + if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID ) + // all other shapes depends on vertices so they are already cleaned + sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); + // to recompute even if failed + sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); + } + } + + // clear entities not on sub-meshes + + SMDS_VolumeIteratorPtr vIt = _myMeshDS->volumesIterator(); + while ( vIt->more() ) + _myMeshDS->RemoveFreeElement( vIt->next(), 0 ); + + SMDS_FaceIteratorPtr fIt = _myMeshDS->facesIterator(); + while ( fIt->more() ) + _myMeshDS->RemoveFreeElement( fIt->next(), 0 ); + + SMDS_EdgeIteratorPtr eIt = _myMeshDS->edgesIterator(); + while ( eIt->more() ) + _myMeshDS->RemoveFreeElement( eIt->next(), 0 ); + + SMDS_NodeIteratorPtr nIt = _myMeshDS->nodesIterator(); + while ( nIt->more() ) { + const SMDS_MeshNode * node = nIt->next(); + if ( node->NbInverseElements() == 0 ) + _myMeshDS->RemoveFreeNode( node, 0 ); + else + _myMeshDS->RemoveNode(node); + } +} + //======================================================================= //function : UNVToMesh //purpose : diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index c0dc3e4f7..b67593db6 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -82,6 +82,10 @@ public: */ static const TopoDS_Solid& PseudoShape(); + /*! + * \brief Remove all nodes and elements + */ + void Clear(); int UNVToMesh(const char* theFileName); /*! diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 6b94beafe..53ddc1557 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -7633,10 +7633,9 @@ SMESH_MeshEditor::FindMatchingNodes(set& theSide1, return SEW_TOPO_DIFF_SETS_OF_ELEMENTS; } #ifdef DEBUG_MATCHING_NODES - cout << " Link 1: " << link[0].first->GetID() <<" "<< link[0].second->GetID() - << " F 1: " << face[0]; - cout << "| Link 2: " << link[1].first->GetID() <<" "<< link[1].second->GetID() - << " F 2: " << face[1] << " | Bind: "<GetID() <<" "<< link[0].second->GetID() + << " F 1: " << face[0] << "| Link 2: " << link[1].first->GetID() <<" " + << link[1].second->GetID() << " F 2: " << face[1] << " | Bind: " ) ; #endif int nbN = nbNodes[0]; { @@ -7644,7 +7643,7 @@ SMESH_MeshEditor::FindMatchingNodes(set& theSide1, list::iterator n2 = notLinkNodes[1].begin(); for ( int i = 0 ; i < nbN - 2; ++i ) { #ifdef DEBUG_MATCHING_NODES - cout << (*n1)->GetID() << " to " << (*n2)->GetID() << endl; + MESSAGE ( (*n1)->GetID() << " to " << (*n2)->GetID() ); #endif nReplaceMap.insert( make_pair( *(n1++), *(n2++) )); } @@ -7666,8 +7665,8 @@ SMESH_MeshEditor::FindMatchingNodes(set& theSide1, else // new in set == encountered for the first time: add { #ifdef DEBUG_MATCHING_NODES - cout << "Add link 1: " << n1->GetID() << " " << n2->GetID() << " "; - cout << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " << endl; + MESSAGE ( "Add link 1: " << n1->GetID() << " " << n2->GetID() << " " + << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " ); #endif linkList[0].push_back ( NLink( n1, n2 )); linkList[1].push_back ( NLink( nReplaceMap[n1], nReplaceMap[n2] )); diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 11a00e5e4..2d29d7d89 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -337,8 +337,8 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F, ok = ( V == vert.Current() ); if ( !ok ) { #ifdef _DEBUG_ - cout << "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID - << " not in face " << GetMeshDS()->ShapeToIndex( F ) << endl; + MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID + << " not in face " << GetMeshDS()->ShapeToIndex( F ) ); #endif // get UV of a vertex closest to the node double dist = 1e100; diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index 1ab83c71e..21690dfee 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -32,13 +32,13 @@ using namespace std; #include #include #include +#include #include #include #include #include #include #include -//#include #include #include #include @@ -655,9 +655,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh, TopoDS_Edge & edge = *elIt; list< TPoint* > & ePoints = getShapePoints( edge ); double f, l; - Handle(Geom2d_Curve) C2d; - if ( !theProject ) - C2d = BRep_Tool::CurveOnSurface( edge, face, f, l ); + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface( edge, face, f, l ); bool isForward = ( edge.Orientation() == TopAbs_FORWARD ); TopoDS_Shape v1 = TopExp::FirstVertex( edge, true ); // always FORWARD @@ -733,7 +731,30 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh, const SMDS_EdgePosition* epos = static_cast(node->GetPosition().get()); double u = epos->GetUParameter(); - paramNodeMap.insert( TParamNodeMap::value_type( u, node )); + paramNodeMap.insert( make_pair( u, node )); + } + if ( paramNodeMap.size() != eSubMesh->NbNodes() ) { + // wrong U on edge, project + Extrema_ExtPC proj; + BRepAdaptor_Curve aCurve( edge ); + proj.Initialize( aCurve, f, l ); + paramNodeMap.clear(); + nIt = eSubMesh->GetNodes(); + for ( int iNode = 0; nIt->more(); ++iNode ) { + const SMDS_MeshNode* node = smdsNode( nIt->next() ); + proj.Perform( gp_Pnt( node->X(), node->Y(), node->Z())); + double u = 0; + if ( proj.IsDone() ) { + for ( int i = 1, nb = proj.NbExt(); i <= nb; ++i ) + if ( proj.IsMin( i )) { + u = proj.Point( i ).Parameter(); + break; + } + } else { + u = isForward ? iNode : eSubMesh->NbNodes() - iNode; + } + paramNodeMap.insert( make_pair( u, node )); + } } // put U in [0,1] so that the first key-point has U==0 double du = l - f; @@ -2093,8 +2114,8 @@ double SMESH_Pattern::setFirstEdge (list< TopoDS_Edge > & theWire, int theFirstE bndBox.Get( minPar[0], minPar[1], maxPar[0], maxPar[1] ); eBndBox.Get( eMinPar[0], eMinPar[1], eMaxPar[0], eMaxPar[1] ); #ifdef DBG_SETFIRSTEDGE - cout << "EDGES: X: " << eMinPar[0] << " - " << eMaxPar[0] << " Y: " - << eMinPar[1] << " - " << eMaxPar[1] << endl; + MESSAGE ( "EDGES: X: " << eMinPar[0] << " - " << eMaxPar[0] << " Y: " + << eMinPar[1] << " - " << eMaxPar[1] ); #endif for ( int iC = 1, i = 0; i < 2; iC++, i++ ) // loop on 2 coordinates { @@ -2120,7 +2141,7 @@ double SMESH_Pattern::setFirstEdge (list< TopoDS_Edge > & theWire, int theFirstE for ( iE = 0 ; iE < nbEdges; iE++ ) { #ifdef DBG_SETFIRSTEDGE - cout << " VARIANT " << iE << endl; + MESSAGE ( " VARIANT " << iE ); #endif // evaluate the distance between UV computed by the 2 methods: // by isos intersection ( myXYZ ) and by edge p-curves ( myUV ) @@ -2134,13 +2155,13 @@ double SMESH_Pattern::setFirstEdge (list< TopoDS_Edge > & theWire, int theFirstE TPoint* p = (*pIt); dist += ( p->myUV - gp_XY( p->myXYZ.X(), p->myXYZ.Y() )).SquareModulus(); #ifdef DBG_SETFIRSTEDGE - cout << " ISO : ( " << p->myXYZ.X() << ", "<< p->myXYZ.Y() << " ) PCURVE : ( " << - p->myUV.X() << ", " << p->myUV.Y() << ") " << endl; + MESSAGE ( " ISO : ( " << p->myXYZ.X() << ", "<< p->myXYZ.Y() << " ) PCURVE : ( " << + p->myUV.X() << ", " << p->myUV.Y() << ") " ); #endif } } #ifdef DBG_SETFIRSTEDGE - cout << "dist -- " << dist << endl; + MESSAGE ( "dist -- " << dist ); #endif if ( dist < minDist ) { minDist = dist; @@ -4634,7 +4655,7 @@ void SMESH_Pattern::DumpPoints() const #ifdef _DEBUG_ vector< TPoint >::const_iterator pVecIt = myPoints.begin(); for ( int i = 0; pVecIt != myPoints.end(); pVecIt++, i++ ) - cout << i << ": " << *pVecIt; + MESSAGE_ADD ( std::endl << i << ": " << *pVecIt ); #endif } diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 3a1c9fa0d..756a76899 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -497,16 +497,9 @@ const TopoDS_Shape & SMESH_subMesh::GetSubShape() const bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) const { int aHypDim = theHypothesis->GetDim(); - if(_father->HasShapeToMesh()) { - int aShapeDim = SMESH_Gen::GetShapeDim(_subShape); - if ( aHypDim <= aShapeDim ) - return true; - } - else - //Only 3D hypothesis may be assigned to the mesh w/o geometry - return aHypDim == 3; -// if ( aHypDim < aShapeDim ) -// return ( _father->IsMainShape( _subShape )); + int aShapeDim = SMESH_Gen::GetShapeDim(_subShape); + if ( aHypDim <= aShapeDim ) + return true; return false; } @@ -607,9 +600,8 @@ SMESH_Hypothesis::Hypothesis_Status // check if a shape needed by algo is present // ------------------------------------------- algo = static_cast< SMESH_Algo* >( anHyp ); - if(_father->GetShapeToMesh() != SMESH_Mesh::PseudoShape()) - if ( !_father->HasShapeToMesh() && algo->NeedShape() ) - return SMESH_Hypothesis::HYP_BAD_GEOMETRY; + if ( !_father->HasShapeToMesh() && algo->NeedShape() ) + return SMESH_Hypothesis::HYP_NEED_SHAPE; // ---------------------- // check mesh conformity // ---------------------- @@ -625,17 +617,6 @@ SMESH_Hypothesis::Hypothesis_Status if ( ! CanAddHypothesis( anHyp )) // check dimension return SMESH_Hypothesis::HYP_BAD_DIM; - if(anHyp->GetDim() == 3 && !_father->HasShapeToMesh() - && event == ADD_ALGO) { - //Only NETGEN_3D and GHS3D_3D can be assigned to the Mesh w/o geometryy - bool isNetgen3D = (strcmp( "NETGEN_3D", anHyp->GetName()) == 0); - bool isGhs3d = (strcmp( "GHS3D_3D", anHyp->GetName()) == 0); - if( !isNetgen3D && !isGhs3d) - return SMESH_Hypothesis::HYP_BAD_DIM; - } - - - if ( /*!anHyp->IsAuxiliary() &&*/ GetSimilarAttached( _subShape, anHyp ) ) return SMESH_Hypothesis::HYP_ALREADY_EXIST; @@ -1223,7 +1204,12 @@ bool SMESH_subMesh::ComputeStateEngine(int event) _computeState = READY_TO_COMPUTE; SMESHDS_SubMesh* smDS = GetSubMeshDS(); if ( smDS && smDS->NbNodes() ) { - _computeState = COMPUTE_OK; + if ( event == CLEAN ) { + CleanDependants(); + cleanSubMesh( this ); + } + else + _computeState = COMPUTE_OK; } else if ( event == COMPUTE && !_alwaysComputed ) { const TopoDS_Vertex & V = TopoDS::Vertex( _subShape ); @@ -1309,9 +1295,14 @@ bool SMESH_subMesh::ComputeStateEngine(int event) SetAlgoState(MISSING_HYP); break; } + TopoDS_Shape shape = _subShape; // check submeshes needed if (_father->HasShapeToMesh() ) { - bool subComputed = SubMeshesComputed(); + bool subComputed = false; + if (!algo->OnlyUnaryInput()) + shape = GetCollection( gen, algo, subComputed ); + else + subComputed = SubMeshesComputed(); ret = ( algo->NeedDescretBoundary() ? subComputed : ( !subComputed || _father->IsNotConformAllowed() )); if (!ret) { @@ -1329,7 +1320,6 @@ bool SMESH_subMesh::ComputeStateEngine(int event) ret = false; _computeState = FAILED_TO_COMPUTE; _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo); - TopoDS_Shape shape = _subShape; try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; @@ -1346,16 +1336,13 @@ bool SMESH_subMesh::ComputeStateEngine(int event) } else { - if (!algo->OnlyUnaryInput()) { - shape = GetCollection( gen, algo ); - } ret = algo->Compute((*_father), shape); } if ( !ret ) _computeError = algo->GetComputeError(); } catch ( std::bad_alloc& exc ) { - printf("std::bad_alloc thrown inside algo->Compute()\n"); + MESSAGE("std::bad_alloc thrown inside algo->Compute()"); if ( _computeError ) { _computeError->myName = COMPERR_MEMORY_PB; //_computeError->myComment = exc.what(); @@ -1364,7 +1351,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) throw exc; } catch ( Standard_OutOfMemory& exc ) { - printf("Standard_OutOfMemory thrown inside algo->Compute()\n"); + MESSAGE("Standard_OutOfMemory thrown inside algo->Compute()"); if ( _computeError ) { _computeError->myName = COMPERR_MEMORY_PB; //_computeError->myComment = exc.what(); @@ -1505,6 +1492,9 @@ bool SMESH_subMesh::ComputeStateEngine(int event) switch (event) { case MODIF_ALGO_STATE: + algo = gen->GetAlgo((*_father), _subShape); + if (algo && !algo->NeedDescretBoundary()) + CleanDependsOn(); // clean sub-meshes with event CLEAN if (_algoState == HYP_OK) _computeState = READY_TO_COMPUTE; else @@ -1613,15 +1603,15 @@ bool SMESH_subMesh::CheckComputeError(SMESH_Algo* theAlgo, const TopoDS_Shape& t text << " \"" << _computeError->myComment << "\""; #ifdef _DEBUG_ - cout << text << endl; + MESSAGE_BEGIN ( text ); // Show vertices location of a failed shape TopTools_IndexedMapOfShape vMap; TopExp::MapShapes( _subShape, TopAbs_VERTEX, vMap ); - cout << "Subshape vertices " << ( vMap.Extent()>10 ? "(first 10):" : ":") << endl; + MESSAGE_ADD ( "Subshape vertices " << ( vMap.Extent()>10 ? "(first 10):" : ":") ); for ( int iv = 1; iv <= vMap.Extent() && iv < 11; ++iv ) { gp_Pnt P( BRep_Tool::Pnt( TopoDS::Vertex( vMap( iv ) ))); - cout << "#" << _father->GetMeshDS()->ShapeToIndex( vMap( iv )) << " "; - cout << P.X() << " " << P.Y() << " " << P.Z() << " " << endl; + MESSAGE_ADD ( "#" << _father->GetMeshDS()->ShapeToIndex( vMap( iv )) << " " + << P.X() << " " << P.Y() << " " << P.Z() << " " ); } #else INFOS( text ); @@ -1777,10 +1767,14 @@ void SMESH_subMesh::RemoveSubMeshElementsAndNodes() // meshed at once along with _subShape //======================================================================= -TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo) +TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, + SMESH_Algo* theAlgo, + bool & theSubComputed) { MESSAGE("SMESH_subMesh::GetCollection"); + theSubComputed = SubMeshesComputed(); + TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh(); if ( mainShape.IsSame( _subShape )) @@ -1812,6 +1806,8 @@ TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlg if (anAlgo == theAlgo && anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp) aBuilder.Add( aCompound, S ); + if ( !subMesh->SubMeshesComputed() ) + theSubComputed = false; } } diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index a82567391..9b3860ae0 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -241,7 +241,9 @@ protected: * \brief Return a shape containing all sub-shapes of the MainShape that can be * meshed at once along with _subShape */ - TopoDS_Shape GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo); + TopoDS_Shape GetCollection(SMESH_Gen * theGen, + SMESH_Algo* theAlgo, + bool & theSubComputed); /*! * \brief Apply theAlgo to all subshapes in theCollection diff --git a/src/SMESHClient/SMESH_Client.cxx b/src/SMESHClient/SMESH_Client.cxx index dd44ec964..add923749 100644 --- a/src/SMESHClient/SMESH_Client.cxx +++ b/src/SMESHClient/SMESH_Client.cxx @@ -623,9 +623,11 @@ SMESH_Client::SMESH_Client(CORBA::ORB_ptr theORB, // just set client mesh pointer to server mesh pointer //SMESH_Mesh* aMesh = reinterpret_cast(theMesh->GetMeshPtr()); CORBA::LongLong pointeur = theMesh->GetMeshPtr(); - cerr <<"SMESH_Client::SMESH_Client pointeur " << pointeur << endl; + if( MYDEBUG ) + MESSAGE("SMESH_Client::SMESH_Client pointeur "< (pointeur); - cerr <<"SMESH_Client::SMESH_Client aMesh " << aMesh << endl; + if ( MYDEBUG ) + MESSAGE("SMESH_Client::SMESH_Client aMesh "<GetMeshDS()->IsEmbeddedMode()){ mySMESHDSMesh = aMesh->GetMeshDS(); mySMDSMesh = mySMESHDSMesh; diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index 1fc450002..f21b6df54 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -169,13 +169,20 @@ void SMESHDS_GroupBase::SetType(SMDSAbs_ElementType theType) void SMESHDS_GroupBase::SetColorGroup(int theColorGroup) { - if( theColorGroup < 0 || theColorGroup > 360 ) - { - MESSAGE("SMESHDS_GroupBase::SetColorGroup : Value must be in range [0,360]"); + int aRed = ( theColorGroup/1000000 ); + int aGreen = ( theColorGroup -aRed*1000000)/1000; + int aBlue = ( theColorGroup - aRed*1000000 - aGreen*1000 ); + double aR = aRed/255.0; + double aG = aGreen/255.0; + double aB = aBlue/255.0; + if ( aR < 0. || aR > 1. || // PAL19395 + aG < 0. || aG > 1. || + aB < 0. || aB > 1. ) +// #ifdef _DEBUG_ +// cout << "SMESHDS_GroupBase::SetColorGroup("< 0 ) { SUIT_OverrideCursor wc; _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - try { + QStringList errors; + bool isEmpty = false; + for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) { + QString filename = *it; SMESH::mesh_array_var aMeshes = new SMESH::mesh_array; - switch ( theCommandID ) { - case 112: - { - aMeshes->length( 1 ); - aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.toLatin1().data()); - break; - } - case 113: - { - SMESH::DriverMED_ReadStatus res; - aMeshes = theComponentMesh->CreateMeshesFromMED(filename.toLatin1().data(),res); - if ( res != SMESH::DRS_OK ) { - wc.suspend(); - SUIT_MessageBox::warning(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr(QString("SMESH_DRS_%1").arg(res). - toLatin1().data())); - aMeshes->length( 0 ); - wc.resume(); + try { + switch ( theCommandID ) { + case 111: + { + // DAT format (currently unsupported) + errors.append( QString( "%1 :\n\t%2" ).arg( filename ). + arg( QObject::tr( "SMESH_ERR_NOT_SUPPORTED_FORMAT" ) ) ); + break; + } + case 112: + { + // UNV format + aMeshes->length( 1 ); + aMeshes[0] = theComponentMesh->CreateMeshesFromUNV( filename.toLatin1().constData() ); + if ( aMeshes[0]->_is_nil() ) + errors.append( QString( "%1 :\n\t%2" ).arg( filename ). + arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) ); + break; + } + case 113: + { + // MED format + SMESH::DriverMED_ReadStatus res; + aMeshes = theComponentMesh->CreateMeshesFromMED( filename.toLatin1().constData(), res ); + if ( res != SMESH::DRS_OK ) { + errors.append( QString( "%1 :\n\t%2" ).arg( filename ). + arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) ); + } + break; } - break; } } + catch ( const SALOME::SALOME_Exception& S_ex ) { + errors.append( QString( "%1 :\n\t%2" ).arg( filename ). + arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) ); + } - bool isEmpty = false; for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) { _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] ); if ( aMeshSO ) { _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" ); - aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_IMPORTED"); + aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() ); - } else + } + else { isEmpty = true; + } } + } - if ( isEmpty ) { - wc.suspend(); - SUIT_MessageBox::warning(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_DRS_EMPTY")); - wc.resume(); - } - - SMESHGUI::GetSMESHGUI()->updateObjBrowser(); + // update Object browser + SMESHGUI::GetSMESHGUI()->updateObjBrowser(); + + // show Error message box if there were errors + if ( errors.count() > 0 ) { + SUIT_MessageBox::critical( SMESHGUI::desktop(), + QObject::tr( "SMESH_ERROR" ), + QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) ); } - catch (const SALOME::SALOME_Exception& S_ex){ - wc.suspend(); - SalomeApp_Tools::QtCatchCorbaException(S_ex); - wc.resume(); + + // show warning message box, if some imported mesh is empty + if ( isEmpty ) { + SUIT_MessageBox::warning( SMESHGUI::desktop(), + QObject::tr( "SMESH_WRN_WARNING" ), + QObject::tr( "SMESH_DRS_SOME_EMPTY" ) ); } } } - void ExportMeshToFile( int theCommandID ) { LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); @@ -257,8 +281,8 @@ return; } // PAL18696 - QString v21( aMesh->GetVersionString( SMESH::MED_V2_1, 2)); - QString v22( aMesh->GetVersionString( SMESH::MED_V2_2, 2)); + QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2)); + QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2)); aFilterMap.insert( QString("MED ") + v21 + " (*.med)", SMESH::MED_V2_1 ); aFilterMap.insert( QString("MED ") + v22 + " (*.med)", SMESH::MED_V2_2 ); } @@ -323,10 +347,15 @@ if ( resMgr ) toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false ); - if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) - - aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false); + QString anInitialPath = ""; + if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) + anInitialPath = QDir::currentPath(); + if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) { + if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath(); + aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + anIObject->getName(), + aFilter, aTitle, false); + } else if(theCommandID == 140 || theCommandID == 141) { // Export to STL QStringList filters; QMap::const_iterator it = aFilterMapSTL.begin(); @@ -337,6 +366,9 @@ fd->setWindowTitle( aTitle ); fd->setFilters( filters ); fd->selectFilter( QObject::tr("STL ASCII (*.stl)") ); + if ( !anInitialPath.isEmpty() ) + fd->setDirectory( anInitialPath ); + fd->selectFile(anIObject->getName()); bool is_ok = false; while (!is_ok) { if ( fd->exec() ) @@ -346,20 +378,27 @@ } delete fd; } - else { + else { // Export to MED QStringList filters; + QString aDefaultFilter; QMap::const_iterator it = aFilterMap.begin(); - for ( ; it != aFilterMap.end(); ++it ) + for ( ; it != aFilterMap.end(); ++it ) { filters.push_back( it.key() ); + if (it.value() == SMESH::MED_V2_2) + aDefaultFilter = it.key(); + } //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true ); SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true ); fd->setWindowTitle( aTitle ); fd->setFilters( filters ); - //fd->selectFilter( QObject::tr("MED 2.2 (*.med)") ); - fd->selectFilter( filters.last() ); + //fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") ); + fd->selectFilter(aDefaultFilter); fd->SetChecked(toCreateGroups); + if ( !anInitialPath.isEmpty() ) + fd->setDirectory( anInitialPath ); + fd->selectFile(anIObject->getName()); bool is_ok = false; while (!is_ok) { if ( fd->exec() ) @@ -839,9 +878,23 @@ LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr(); SALOME_ListIO selected; aSel->selectedObjects( selected, QString::null, false ); + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder(); + _PTR(GenericAttribute) anAttr; + _PTR(AttributeIOR) anIOR; + + int objectCount = 0; QString aParentComponent = QString::null; for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() ) { + _PTR(SObject) aSO = aStudy->FindObjectID(anIt.Value()->getEntry()); + if (aSO) { + // check if object is not reference + _PTR(SObject) refobj; + if ( !aSO->ReferencedObject( refobj ) ) + objectCount++; + } + QString cur = anIt.Value()->getComponentDataType(); if( aParentComponent.isNull() ) aParentComponent = cur; @@ -849,6 +902,9 @@ aParentComponent = ""; } + if ( objectCount == 0 ) + return; // No Valid Objects Selected + if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) { SUIT_MessageBox::warning( SMESHGUI::desktop(), QObject::tr("ERR_ERROR"), @@ -868,11 +924,6 @@ SUIT_ViewManager* vm = anApp->activeViewManager(); int nbSf = vm->getViewsCount(); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder(); - _PTR(GenericAttribute) anAttr; - _PTR(AttributeIOR) anIOR; - SALOME_ListIteratorOfListIO It(selected); aStudyBuilder->NewCommand(); // There is a transaction @@ -888,6 +939,10 @@ continue; } + _PTR(SObject) refobj; + if ( aSO && aSO->ReferencedObject( refobj ) ) + continue; // skip references + // put the whole hierarchy of sub-objects of the selected SO into a list and // then treat them all starting from the deepest objects (at list back) @@ -1493,6 +1548,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) ( new SMESHGUI_BuildCompoundDlg( this ) )->show(); } break; + case 407: // DIAGONAL INVERSION case 408: // Delete diagonal { @@ -1922,6 +1978,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if( aSel ) aSel->selectedObjects( selected ); + bool isAny = false; // iss there any appropriate object selected + SALOME_ListIteratorOfListIO It( selected ); for ( ; It.More(); It.Next() ) { @@ -1935,22 +1993,39 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { aName = anAttr; QString newName = QString(aName->Value().c_str()); - newName = LightApp_NameDlg::getName(desktop(), newName); - if ( !newName.isEmpty() ) - { - //old source: aStudy->renameIObject( IObject, newName ); - aName->SetValue( newName.toLatin1().data() ); - // if current object is group update group's name - SMESH::SMESH_GroupBase_var aGroup = - SMESH::IObjectToInterface(IObject); - if (!aGroup->_is_nil() ) - aGroup->SetName( newName.toLatin1().data() ); - - updateObjBrowser(); + // check type to prevent renaming of inappropriate objects + int aType = SMESHGUI_Selection::type(IObject->getEntry(), aStudy); + if (aType == MESH || aType == GROUP || + aType == SUBMESH || aType == SUBMESH_COMPOUND || + aType == SUBMESH_SOLID || aType == SUBMESH_FACE || + aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX || + aType == HYPOTHESIS || aType == ALGORITHM) + { + isAny = true; + newName = LightApp_NameDlg::getName(desktop(), newName); + if ( !newName.isEmpty() ) + { + //old source: aStudy->renameIObject( IObject, newName ); + aName->SetValue( newName.toLatin1().constData() ); + + // if current object is group update group's name + SMESH::SMESH_GroupBase_var aGroup = + SMESH::IObjectToInterface(IObject); + if (!aGroup->_is_nil() ) + aGroup->SetName( newName.toLatin1().constData() ); + + updateObjBrowser(); + } } } } + } // for + + if (!isAny) { + SUIT_MessageBox::warning(desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_WRN_NO_APPROPRIATE_SELECTION")); } break; } @@ -2090,6 +2165,46 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } break; } + case 4043: { // CLEAR_MESH + + if(checkLock(aStudy)) break; + + SALOME_ListIO selected; + if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() ) + aSel->selectedObjects( selected ); + + SUIT_OverrideCursor wc; + SALOME_ListIteratorOfListIO It (selected); + for ( ; It.More(); It.Next() ) + { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + SMESH::SMESH_Mesh_var aMesh = + SMESH::IObjectToInterface(IOS); + if ( aMesh->_is_nil()) continue; + try { + SMESH::UpdateView(SMESH::eErase, IOS->getEntry()); + aMesh->Clear(); + _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh); + SMESH::ModifiedMesh( aMeshSObj, false, true); + // hide groups and submeshes + _PTR(ChildIterator) anIter = + SMESH::GetActiveStudyDocument()->NewChildIterator( aMeshSObj ); + for ( anIter->InitEx(true); anIter->More(); anIter->Next() ) + { + _PTR(SObject) so = anIter->Value(); + SMESH::UpdateView(SMESH::eErase, so->GetID().c_str()); + } + } + catch (const SALOME::SALOME_Exception& S_ex){ + wc.suspend(); + SalomeApp_Tools::QtCatchCorbaException(S_ex); + wc.resume(); + } + } + SMESH::UpdateView(); + updateObjBrowser(); + break; + } case 4051: // RENUMBERING NODES { if(checkLock(aStudy)) break; @@ -2472,6 +2587,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 4032, "HEXA", "ICON_DLG_HEXAS" ); createSMESHAction( 4041, "REMOVE_NODES", "ICON_DLG_REM_NODE" ); createSMESHAction( 4042, "REMOVE_ELEMENTS", "ICON_DLG_REM_ELEMENT" ); + createSMESHAction( 4043, "CLEAR_MESH" , "ICON_CLEAR_MESH" ); createSMESHAction( 4051, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" ); createSMESHAction( 4052, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" ); createSMESHAction( 4061, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" ); @@ -2563,7 +2679,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 5105, toolsId, -1 ); - createMenu( 702, meshId, -1 ); + createMenu( 702, meshId, -1 ); // "Mesh" menu createMenu( 703, meshId, -1 ); createMenu( 704, meshId, -1 ); createMenu( 710, meshId, -1 ); @@ -2622,6 +2738,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 4041, removeId, -1 ); createMenu( 4042, removeId, -1 ); + createMenu( 4043, removeId, -1 ); createMenu( 4051, renumId, -1 ); createMenu( 4052, renumId, -1 ); @@ -2709,6 +2826,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( separator(), addRemTb ); createTool( 4041, addRemTb ); createTool( 4042, addRemTb ); + createTool( 4043, addRemTb ); createTool( separator(), addRemTb ); createTool( 4051, addRemTb ); createTool( 4052, addRemTb ); @@ -2738,7 +2856,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( 214, dispModeTb ); QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality(); - QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam() + QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam() myRules.clear(); QString OB = "'ObjectBrowser'", @@ -2775,12 +2893,15 @@ void SMESHGUI::initialize( CAM_Application* app ) createPopupItem( 801, OB, mesh ); // CREATE_GROUP createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( 1100, OB, hypo, "" /*"&& $hasReference={false}"*/ ); // EDIT HYPOTHESIS + createPopupItem( 1100, OB, hypo); // EDIT HYPOTHESIS createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS - createPopupItem( 1101, OB, mesh_group + " " + hyp_alg, "" /*"&& $hasReference={false}"*/ ); // RENAME + createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME + popupMgr()->insert( separator(), -1, 0 ); + createPopupItem( 4043, OB, mesh ); // CLEAR_MESH popupMgr()->insert( separator(), -1, 0 ); QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc ); + createPopupItem( 125, OB, mesh, only_one_non_empty ); // EXPORT_MED createPopupItem( 126, OB, mesh, only_one_non_empty ); // EXPORT_UNV createPopupItem( 141, OB, mesh, only_one_non_empty ); // EXPORT_STL @@ -3010,6 +3131,30 @@ void SMESHGUI::initialize( CAM_Application* app ) this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) ); } +//================================================================================ +/*! + * \brief Return true if SMESH or GEOM objects are selected. + * Is called form LightApp_Module::activateModule() which clear selection if + * not isSelectionCompatible() + */ +//================================================================================ + +bool SMESHGUI::isSelectionCompatible() +{ + bool isCompatible = true; + SALOME_ListIO selected; + if ( LightApp_SelectionMgr *Sel = selectionMgr() ) + Sel->selectedObjects( selected ); + + SALOME_ListIteratorOfListIO It( selected ); + for ( ; isCompatible && It.More(); It.Next()) + isCompatible = + ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) || + ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 ); + + return isCompatible; +} + bool SMESHGUI::activateModule( SUIT_Study* study ) { bool res = SalomeApp_Module::activateModule( study ); @@ -3022,6 +3167,9 @@ bool SMESHGUI::activateModule( SUIT_Study* study ) action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED + action( 33)->setEnabled(true); // Delete: Key_Delete + action(1101)->setEnabled(true); // Rename: Key_F2 + return res; } @@ -3037,6 +3185,9 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study ) action(112)->setShortcut(QKeySequence()); // Import UNV action(113)->setShortcut(QKeySequence()); // Import MED + action( 33)->setEnabled(false); // Delete: Key_Delete + action(1101)->setEnabled(false); // Rename: Key_F2 + return SalomeApp_Module::deactivateModule( study ); } @@ -3078,6 +3229,25 @@ QString SMESHGUI::engineIOR() const return QString( anIOR.in() ); } +void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title ) +{ + SalomeApp_Module::contextMenuPopup( client, menu, title ); + SALOME_ListIO lst; + selectionMgr()->selectedObjects( lst ); + if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) { + Handle(SALOME_InteractiveObject) io = lst.First(); + SalomeApp_Study* appStudy = dynamic_cast( application()->activeStudy() ); + _PTR(Study) study = appStudy->studyDS(); + _PTR(SObject) obj = study->FindObjectID( io->getEntry() ); + if ( obj ) { + QString aName = QString( obj->GetName().c_str() ); + while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup + aName.remove( (aName.length() - 1), 1 ); + title = aName; + } + } +} + LightApp_Selection* SMESHGUI::createSelection() const { return new SMESHGUI_Selection(); diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index b644fb4e1..b1bb0dc52 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -103,6 +103,7 @@ public : void EmitSignalStudyFrameChanged(); void EmitSignalCloseAllDialogs(); + virtual void contextMenuPopup( const QString&, QMenu*, QString& ); virtual void createPreferences(); virtual void preferencesChanged( const QString&, const QString& ); @@ -141,6 +142,8 @@ protected: virtual LightApp_Operation* createOperation( const int ) const; + virtual bool isSelectionCompatible(); + private: void OnEditDelete(); diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index a8d640da2..415f32f6f 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -321,7 +321,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index 94db73192..95aa3f8e9 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -319,17 +319,48 @@ static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7}; -class SMESHGUI_IdEditItem: public QTableWidgetItem +/*! + \class BusyLocker + \brief Simple 'busy state' flag locker. + \internal +*/ + +class BusyLocker { public: - SMESHGUI_IdEditItem(const QString& text ): - QTableWidgetItem(text, QTableWidgetItem::UserType+100) {}; - ~SMESHGUI_IdEditItem() {}; + //! Constructor. Sets passed boolean flag to \c true. + BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; } + //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false. + ~BusyLocker() { myBusy = false; } +private: + bool& myBusy; //! External 'busy state' boolean flag +}; + +/*! + \class IdEditItem + \brief Simple editable table item. + \internal +*/ + +class IdEditItem: public QTableWidgetItem +{ +public: + IdEditItem(const QString& text ); + ~IdEditItem(); QWidget* createEditor() const; }; -QWidget* SMESHGUI_IdEditItem::createEditor() const +IdEditItem::IdEditItem(const QString& text ) + : QTableWidgetItem(text, QTableWidgetItem::UserType+100) +{ +} + +IdEditItem::~IdEditItem() +{ +} + +QWidget* IdEditItem::createEditor() const { QLineEdit *aLineEdit = new QLineEdit(text(), tableWidget()); aLineEdit->setValidator( new SMESHGUI_IdValidator(tableWidget(), 1) ); @@ -345,7 +376,8 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myType( theType ) + myType( theType ), + myBusy( false ) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); @@ -440,7 +472,7 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM aGroupButtonsLayout->setSpacing(SPACING); aGroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); @@ -482,7 +514,6 @@ SMESHGUI_AddQuadraticElementDlg::~SMESHGUI_AddQuadraticElementDlg() void SMESHGUI_AddQuadraticElementDlg::Init() { myRadioButton1->setChecked(true); - myIsEditCorners = true; mySMESHGUI->SetActiveDialogBox((QDialog*)this); myActor = 0; @@ -550,12 +581,14 @@ void SMESHGUI_AddQuadraticElementDlg::Init() for ( int row = 0; row < myTable->rowCount(); row++ ) { myTable->setItem( row, 0, new QTableWidgetItem( "" ) ); + myTable->item( row, 0 )->setFlags(0); - SMESHGUI_IdEditItem* anEditItem = new SMESHGUI_IdEditItem( "" ); + IdEditItem* anEditItem = new IdEditItem( "" ); anEditItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); myTable->setItem(row, 1, anEditItem); myTable->setItem( row, 2, new QTableWidgetItem( "" ) ); + myTable->item( row, 2 )->setFlags(0); } /* signals and slots connections */ @@ -580,8 +613,6 @@ void SMESHGUI_AddQuadraticElementDlg::Init() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( NodeSelection ); - myBusy = false; - SetEditCorners(); } @@ -591,68 +622,66 @@ void SMESHGUI_AddQuadraticElementDlg::Init() //================================================================================= void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() { - if (IsValid() && !mySMESHGUI->isActiveStudyLocked()) { - myBusy = true; - - std::vector anIds; + if ( mySMESHGUI->isActiveStudyLocked() || myBusy || !IsValid() ) + return; - switch (myType) { - case QUAD_EDGE: - anIds.push_back(myTable->item(0, 0)->text().toInt()); - anIds.push_back(myTable->item(0, 2)->text().toInt()); - anIds.push_back(myTable->item(0, 1)->text().toInt()); - break; - case QUAD_TRIANGLE: - case QUAD_QUADRANGLE: - case QUAD_TETRAHEDRON: - case QUAD_PYRAMID: - case QUAD_PENTAHEDRON: - case QUAD_HEXAHEDRON: - for ( int row = 0; row < myNbCorners; row++ ) - anIds.push_back(myTable->item(row, 0)->text().toInt()); - for ( int row = 0; row < myTable->rowCount(); row++ ) - anIds.push_back(myTable->item(row, 1)->text().toInt()); - break; - } - if ( myReverseCB->isChecked()) - SMESH::ReverseConnectivity( anIds, myType ); + BusyLocker lock( myBusy ); + + std::vector anIds; + + switch (myType) { + case QUAD_EDGE: + anIds.push_back(myTable->item(0, 0)->text().toInt()); + anIds.push_back(myTable->item(0, 2)->text().toInt()); + anIds.push_back(myTable->item(0, 1)->text().toInt()); + break; + case QUAD_TRIANGLE: + case QUAD_QUADRANGLE: + case QUAD_TETRAHEDRON: + case QUAD_PYRAMID: + case QUAD_PENTAHEDRON: + case QUAD_HEXAHEDRON: + for ( int row = 0; row < myNbCorners; row++ ) + anIds.push_back(myTable->item(row, 0)->text().toInt()); + for ( int row = 0; row < myTable->rowCount(); row++ ) + anIds.push_back(myTable->item(row, 1)->text().toInt()); + break; + } + if ( myReverseCB->isChecked()) + SMESH::ReverseConnectivity( anIds, myType ); - int aNumberOfIds = anIds.size(); - SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; - anArrayOfIdeces->length( aNumberOfIds ); + int aNumberOfIds = anIds.size(); + SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; + anArrayOfIdeces->length( aNumberOfIds ); - for (int i = 0; i < aNumberOfIds; i++) - anArrayOfIdeces[i] = anIds[ i ]; + for (int i = 0; i < aNumberOfIds; i++) + anArrayOfIdeces[i] = anIds[ i ]; - SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - switch (myType) { - case QUAD_EDGE: - aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break; - case QUAD_TRIANGLE: - case QUAD_QUADRANGLE: - aMeshEditor->AddFace(anArrayOfIdeces.inout()); break; - case QUAD_TETRAHEDRON: - case QUAD_PYRAMID: - case QUAD_PENTAHEDRON: - case QUAD_HEXAHEDRON: - aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break; - } + SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + switch (myType) { + case QUAD_EDGE: + aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break; + case QUAD_TRIANGLE: + case QUAD_QUADRANGLE: + aMeshEditor->AddFace(anArrayOfIdeces.inout()); break; + case QUAD_TETRAHEDRON: + case QUAD_PYRAMID: + case QUAD_PENTAHEDRON: + case QUAD_HEXAHEDRON: + aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break; + } - SALOME_ListIO aList; aList.Append( myActor->getIO() ); - mySelector->ClearIndex(); - mySelectionMgr->setSelectedObjects( aList, false ); + SALOME_ListIO aList; aList.Append( myActor->getIO() ); + mySelector->ClearIndex(); + mySelectionMgr->setSelectedObjects( aList, false ); - SMESH::UpdateView(); - mySimulation->SetVisibility(false); + mySimulation->SetVisibility(false); + SMESH::UpdateView(); - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - - UpdateTable(); - SetEditCorners(); + UpdateTable(); + SetEditCorners(); - myBusy = false; - } + updateButtons(); } //================================================================================= @@ -712,11 +741,8 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnHelp() void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText) { if (myBusy) return; - myBusy = true; + BusyLocker lock( myBusy ); - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - mySimulation->SetVisibility(false); // hilight entered nodes @@ -730,13 +756,15 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText) QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); bool allOk = true; for (int i = 0; i < aListId.count(); i++) { - if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) + if ( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) + { newIndices.Add( n->GetID() ); + } else - { - allOk = false; - break; - } + { + allOk = false; + break; + } } mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); @@ -747,15 +775,8 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText) UpdateTable( allOk ); } - if( IsValid() ) { - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); - } - - if ( sender() == myTable ) - displaySimulation(); - - myBusy = false; + updateButtons(); + displaySimulation(); } //================================================================================= @@ -765,73 +786,65 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText) void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() { if (myBusy) return; + BusyLocker lock( myBusy ); if ( myIsEditCorners ) - { - // clear - myActor = 0; - - myBusy = true; - myCornerNodes->setText(""); - myBusy = false; - - if (!GroupButtons->isEnabled()) // inactive - return; - - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - - mySimulation->SetVisibility(false); - - // get selected mesh - SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + { + // clear + myActor = 0; + + myCornerNodes->setText(""); + + if (!GroupButtons->isEnabled()) // inactive + return; + + mySimulation->SetVisibility(false); - if (aList.Extent() != 1) - { - UpdateTable(); - return; - } + // get selected mesh + SALOME_ListIO aList; + mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + + if (aList.Extent() != 1) + { + UpdateTable(); + updateButtons(); + return; + } - Handle(SALOME_InteractiveObject) anIO = aList.First(); - myMesh = SMESH::GetMeshByIO(anIO); - if (myMesh->_is_nil()) - return; + Handle(SALOME_InteractiveObject) anIO = aList.First(); + myMesh = SMESH::GetMeshByIO(anIO); + if (myMesh->_is_nil()) { + updateButtons(); + return; + } - myActor = SMESH::FindActorByEntry(anIO->getEntry()); + myActor = SMESH::FindActorByEntry(anIO->getEntry()); - } + } - if (!myActor) + if (!myActor) { + updateButtons(); return; + } // get selected nodes QString aString = ""; int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString); if ( myIsEditCorners ) - { - myBusy = true; - myCornerNodes->setText(aString); - myBusy = false; - - UpdateTable(); - } + { + myCornerNodes->setText(aString); + + UpdateTable(); + } else if ( myTable->isEnabled() && nbNodes == 1 ) - { - myBusy = true; - int theRow = myTable->currentRow(), theCol = myTable->currentColumn(); - if ( theCol == 1 ) - myTable->item(theRow, 1)->setText(aString); - myBusy = false; - } + { + int theRow = myTable->currentRow(), theCol = myTable->currentColumn(); + if ( theCol == 1 ) + myTable->item(theRow, 1)->setText(aString); + } - if ( IsValid() ) - { - buttonOk->setEnabled( true ); - buttonApply->setEnabled( true ); - } - + updateButtons(); displaySimulation(); } @@ -841,42 +854,47 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() //================================================================================= void SMESHGUI_AddQuadraticElementDlg::displaySimulation() { - if (!myIsEditCorners) { + if ( IsValid() ) + { SMESH::TElementSimulation::TVTKIds anIds; // Collect ids from the dialog int anID; bool ok; int aDisplayMode = VTK_SURFACE; - + if ( myType == QUAD_EDGE ) - { - anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 0)->text().toInt() ) ); - anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 2)->text().toInt() ) ); - anID = myTable->item(0, 1)->text().toInt(&ok); - if (!ok) anID = myTable->item(0, 0)->text().toInt(); - anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) ); - aDisplayMode = VTK_WIREFRAME; - } + { + anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 0)->text().toInt() ) ); + anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 2)->text().toInt() ) ); + anID = myTable->item(0, 1)->text().toInt(&ok); + if (!ok) anID = myTable->item(0, 0)->text().toInt(); + anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) ); + aDisplayMode = VTK_WIREFRAME; + } else + { + for ( int row = 0; row < myNbCorners; row++ ) + anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) ); + + for ( int row = 0; row < myTable->rowCount(); row++ ) { - for ( int row = 0; row < myNbCorners; row++ ) - anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) ); - - for ( int row = 0; row < myTable->rowCount(); row++ ) - { - anID = myTable->item(row, 1)->text().toInt(&ok); - if (!ok) { - anID = myTable->item(row, 0)->text().toInt(); - aDisplayMode = VTK_WIREFRAME; - } - anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) ); - } + anID = myTable->item(row, 1)->text().toInt(&ok); + if (!ok) { + anID = myTable->item(row, 0)->text().toInt(); + aDisplayMode = VTK_WIREFRAME; + } + anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) ); } + } mySimulation->SetPosition(myActor,myType,anIds,aDisplayMode,myReverseCB->isChecked()); - SMESH::UpdateView(); } + else + { + mySimulation->SetVisibility(false); + } + SMESH::UpdateView(); } //================================================================================= @@ -887,8 +905,8 @@ void SMESHGUI_AddQuadraticElementDlg::SetEditCorners() { myCornerNodes->setFocus(); myIsEditCorners = true; - SelectionIntoArgument(); + updateButtons(); } //================================================================================= @@ -964,13 +982,9 @@ void SMESHGUI_AddQuadraticElementDlg::hideEvent (QHideEvent*) //================================================================================= void SMESHGUI_AddQuadraticElementDlg::onReverse (int state) { - if (!IsValid()) - return; - - if (state >= 0) { - mySimulation->SetVisibility(false); - displaySimulation(); - } + mySimulation->SetVisibility(false); + displaySimulation(); + updateButtons(); } @@ -989,15 +1003,15 @@ bool SMESHGUI_AddQuadraticElementDlg::IsValid() bool ok; for ( int row = 0; row < myTable->rowCount(); row++ ) - { - int anID = myTable->item(row, 1)->text().toInt(&ok); - if ( !ok ) - return false; - - const SMDS_MeshNode * aNode = aMesh->FindNode(anID); - if ( !aNode ) - return false; - } + { + int anID = myTable->item(row, 1)->text().toInt(&ok); + if ( !ok ) + return false; + + const SMDS_MeshNode * aNode = aMesh->FindNode(anID); + if ( !aNode ) + return false; + } return true; } @@ -1011,63 +1025,63 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) QStringList aListCorners = myCornerNodes->text().split(" ", QString::SkipEmptyParts); if ( aListCorners.count() == myNbCorners && theConersValidity ) - { - myTable->setEnabled( true ); - - // clear the Middle column - for ( int row = 0; row < myTable->rowCount(); row++ ) - myTable->item( row, 1 )->setText(""); - - int* aFirstColIds; - int* aLastColIds; - - switch (myType) { - case QUAD_EDGE: - aFirstColIds = FirstEdgeIds; - aLastColIds = LastEdgeIds; - break; - case QUAD_TRIANGLE: - aFirstColIds = FirstTriangleIds; - aLastColIds = LastTriangleIds; - break; - case QUAD_QUADRANGLE: - aFirstColIds = FirstQuadrangleIds; - aLastColIds = LastQuadrangleIds; - break; - case QUAD_TETRAHEDRON: - aFirstColIds = FirstTetrahedronIds; - aLastColIds = LastTetrahedronIds; - break; - case QUAD_PYRAMID: - aFirstColIds = FirstPyramidIds; - aLastColIds = LastPyramidIds; - break; - case QUAD_PENTAHEDRON: - aFirstColIds = FirstPentahedronIds; - aLastColIds = LastPentahedronIds; - break; - case QUAD_HEXAHEDRON: - aFirstColIds = FirstHexahedronIds; - aLastColIds = LastHexahedronIds; - break; - } - - // fill the First and the Last columns - for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++) - myTable->item( i, 0 )->setText( aListCorners[ aFirstColIds[i] ] ); - - for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++) - myTable->item( i, 2 )->setText( aListCorners[ aLastColIds[i] ] ); + { + myTable->setEnabled( true ); + + // clear the Middle column + for ( int row = 0; row < myTable->rowCount(); row++ ) + myTable->item( row, 1 )->setText(""); + + int* aFirstColIds; + int* aLastColIds; + + switch (myType) { + case QUAD_EDGE: + aFirstColIds = FirstEdgeIds; + aLastColIds = LastEdgeIds; + break; + case QUAD_TRIANGLE: + aFirstColIds = FirstTriangleIds; + aLastColIds = LastTriangleIds; + break; + case QUAD_QUADRANGLE: + aFirstColIds = FirstQuadrangleIds; + aLastColIds = LastQuadrangleIds; + break; + case QUAD_TETRAHEDRON: + aFirstColIds = FirstTetrahedronIds; + aLastColIds = LastTetrahedronIds; + break; + case QUAD_PYRAMID: + aFirstColIds = FirstPyramidIds; + aLastColIds = LastPyramidIds; + break; + case QUAD_PENTAHEDRON: + aFirstColIds = FirstPentahedronIds; + aLastColIds = LastPentahedronIds; + break; + case QUAD_HEXAHEDRON: + aFirstColIds = FirstHexahedronIds; + aLastColIds = LastHexahedronIds; + break; } + + // fill the First and the Last columns + for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++) + myTable->item( i, 0 )->setText( aListCorners[ aFirstColIds[i] ] ); + + for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++) + myTable->item( i, 2 )->setText( aListCorners[ aLastColIds[i] ] ); + } else - { - // clear table - for ( int row = 0; row < myTable->rowCount(); row++ ) - for ( int col = 0; col < myTable->columnCount(); col++ ) - if ( QTableWidgetItem* aTWI = myTable->item(row, col) ) aTWI->setText(""); - - myTable->setEnabled( false ); - } + { + // clear table + for ( int row = 0; row < myTable->rowCount(); row++ ) + for ( int col = 0; col < myTable->columnCount(); col++ ) + if ( QTableWidgetItem* aTWI = myTable->item(row, col) ) aTWI->setText(""); + + myTable->setEnabled( false ); + } } @@ -1077,10 +1091,9 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) //================================================================================= void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol ) { - if ( theCol == 1 ) - myIsEditCorners = false; - + myIsEditCorners = false; displaySimulation(); + updateButtons(); } @@ -1090,7 +1103,9 @@ void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCo //================================================================================= void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol) { - onTextChange( myTable->item(theRow, theCol)->text() ); + myIsEditCorners = false; + displaySimulation(); + updateButtons(); } //================================================================================= @@ -1108,3 +1123,10 @@ void SMESHGUI_AddQuadraticElementDlg::keyPressEvent( QKeyEvent* e ) ClickOnHelp(); } } + +void SMESHGUI_AddQuadraticElementDlg::updateButtons() +{ + bool valid = IsValid(); + buttonOk->setEnabled( valid ); + buttonApply->setEnabled( valid ); +} diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h index f610dd9a6..4ea0011b3 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h @@ -76,6 +76,7 @@ private: void displaySimulation(); void UpdateTable( bool = true ); bool IsValid(); + void updateButtons(); SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index dcfaa7e1b..bbb6a03b4 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -155,7 +155,7 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index b573cf688..c3c6201b3 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -276,7 +276,7 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ): GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); @@ -344,7 +344,9 @@ SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg() { // no need to delete child widgets, Qt does it all for us std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false)); - SMESH::RenderViewWindow(SMESH::GetViewWindow(mySMESHGUI)); + + if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI)) + SMESH::RenderViewWindow(aViewWindow); } double SMESHGUI_ClippingDlg::getDistance() const diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 6d7036a63..539024934 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -29,6 +29,8 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_HypothesesUtils.h" +#include "SMESHGUI_MeshEditPreview.h" +#include "SMESH_ActorUtils.h" #include #include @@ -107,7 +109,9 @@ static void addSeparator( QWidget* parent ) } } -enum TCol { COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, NB_COLUMNS }; +enum TCol { + COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS +}; //using namespace SMESH; @@ -125,7 +129,8 @@ namespace SMESH { char* myBuf; MemoryReserve(): myBuf( new char[1024*1024*1] ){} // 1M - ~MemoryReserve() { delete [] myBuf; } + void release() { delete [] myBuf; myBuf = 0; } + ~MemoryReserve() { release(); } }; // ========================================================================================= @@ -266,8 +271,8 @@ namespace SMESH if ( !actor ) { actor = GEOM_Actor::New(); if ( actor ) { - actor->setInputShape(shape,0,0); - //actor->SetProperty(myProperty); + actor->SetShape(shape,0,0); + actor->SetProperty(myProperty); actor->SetShadingProperty(myProperty); actor->SetWireframeProperty(myProperty); actor->SetPreviewProperty(myProperty); @@ -429,7 +434,7 @@ namespace SMESH /*! * \brief Return a list of selected rows */ - bool getSelectedRows(QTableWidget* table, QList& rows) + int getSelectedRows(QTableWidget* table, QList& rows) { rows.clear(); QList selRanges = table->selectedRanges(); @@ -442,7 +447,7 @@ namespace SMESH if ( rows.isEmpty() && table->currentRow() > -1 ) rows.append( table->currentRow() ); - return !rows.isEmpty(); + return rows.count(); } } // namespace SMESH @@ -785,7 +790,7 @@ void SMESHGUI_MeshInfosBox::SetInfoByMesh(SMESH::SMESH_Mesh_var mesh) */ //======================================================================= -SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, OK/* | Help*/ ) +SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, Close/* | Help*/ ) { QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame()); aDlgLay->setMargin( 0 ); @@ -842,11 +847,13 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent) myTable = new QTableWidget( 1, NB_COLUMNS, myCompErrorGroup); myShowBtn = new QPushButton(tr("SHOW_SHAPE"), myCompErrorGroup); myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), myCompErrorGroup); + myBadMeshBtn = new QPushButton(tr("SHOW_BAD_MESH"), myCompErrorGroup); //myTable->setReadOnly( true ); // VSR: check myTable->setEditTriggers( QAbstractItemView::NoEditTriggers ); myTable->hideColumn( COL_PUBLISHED ); myTable->hideColumn( COL_SHAPEID ); + myTable->hideColumn( COL_BAD_MESH ); myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive ); QStringList headers; @@ -862,10 +869,11 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent) QGridLayout* grpLayout = new QGridLayout(myCompErrorGroup); grpLayout->setSpacing(SPACING); grpLayout->setMargin(MARGIN); - grpLayout->addWidget( myTable, 0, 0, 3, 1 ); + grpLayout->addWidget( myTable, 0, 0, 4, 1 ); grpLayout->addWidget( myShowBtn, 0, 1 ); grpLayout->addWidget( myPublishBtn, 1, 1 ); - grpLayout->setRowStretch( 2, 1 ); + grpLayout->addWidget( myBadMeshBtn, 2, 1 ); + grpLayout->setRowStretch( 3, 1 ); // Hypothesis definition errors @@ -916,12 +924,15 @@ SMESHGUI_ComputeOp::SMESHGUI_ComputeOp() { myDlg = new SMESHGUI_ComputeDlg; myTShapeDisplayer = new SMESH::TShapeDisplayer(); + myBadMeshDisplayer = 0; + //myHelpFileName = "/files/about_meshes.htm"; // V3 myHelpFileName = "about_meshes_page.html"; // V4 // connect signals and slots connect(myDlg->myShowBtn, SIGNAL (clicked()), SLOT(onPreviewShape())); connect(myDlg->myPublishBtn, SIGNAL (clicked()), SLOT(onPublishShape())); + connect(myDlg->myBadMeshBtn, SIGNAL (clicked()), SLOT(onShowBadMesh())); connect(table(), SIGNAL(itemSelectionChanged()), SLOT(currentCellChanged())); connect(table(), SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged())); } @@ -937,7 +948,7 @@ void SMESHGUI_ComputeOp::startOperation() // check selection - SMESH::SMESH_Mesh_var aMesh; + myMesh = SMESH::SMESH_Mesh::_nil(); myMainShape = GEOM::GEOM_Object::_nil(); LightApp_SelectionMgr *Sel = selectionMgr(); @@ -953,8 +964,8 @@ void SMESHGUI_ComputeOp::startOperation() } Handle(SALOME_InteractiveObject) IObject = selected.First(); - aMesh = SMESH::GetMeshByIO(IObject); - if (aMesh->_is_nil()) { + myMesh = SMESH::GetMeshByIO(IObject); + if (myMesh->_is_nil()) { SUIT_MessageBox::warning(desktop(), tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_NO_AVAILABLE_DATA")); @@ -971,15 +982,15 @@ void SMESHGUI_ComputeOp::startOperation() bool computeFailed = true, memoryLack = false; - _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh); - myMainShape = aMesh->GetShapeToMesh(); - bool hasShape = aMesh->HasShapeToMesh(); + _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh); + myMainShape = myMesh->GetShapeToMesh(); + bool hasShape = myMesh->HasShapeToMesh(); bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape; if ( shapeOK && aMeshSObj ) { myDlg->myMeshName->setText( aMeshSObj->GetName().c_str() ); SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen(); - SMESH::algo_error_array_var errors = gen->GetAlgoState(aMesh,myMainShape); + SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape); if ( errors->length() > 0 ) { aHypErrors = SMESH::GetMessageOnAlgoStateErrors( errors.in() ); } @@ -988,7 +999,7 @@ void SMESHGUI_ComputeOp::startOperation() #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif - if (gen->Compute(aMesh, myMainShape)) + if (gen->Compute(myMesh, myMainShape)) computeFailed = false; } catch(const SALOME::SALOME_Exception & S_ex){ @@ -998,7 +1009,7 @@ void SMESHGUI_ComputeOp::startOperation() #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif - aCompErrors = gen->GetComputeErrors( aMesh, myMainShape ); + aCompErrors = gen->GetComputeErrors( myMesh, myMainShape ); // check if there are memory problems for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i ) memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB ); @@ -1009,7 +1020,7 @@ void SMESHGUI_ComputeOp::startOperation() // NPAL16631: if ( !memoryLack ) { - SMESH::ModifiedMesh(aMeshSObj, !computeFailed, aMesh->NbNodes() == 0); + SMESH::ModifiedMesh(aMeshSObj, !computeFailed, myMesh->NbNodes() == 0); update( UF_ObjBrowser | UF_Model ); // SHOW MESH @@ -1024,7 +1035,7 @@ void SMESHGUI_ComputeOp::startOperation() } catch (...) { #ifdef _DEBUG_ - cout << "Exception thrown during mesh visualization" << endl; + MESSAGE ( "Exception thrown during mesh visualization" ); #endif if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning? SMESH::OnVisuException(); @@ -1037,6 +1048,10 @@ void SMESHGUI_ComputeOp::startOperation() Sel->setSelectedObjects( selected ); } } + + if ( memoryLack ) + aMemoryReserve.release(); + myDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED")); myDlg->myMemoryLackGroup->hide(); @@ -1055,7 +1070,7 @@ void SMESHGUI_ComputeOp::startOperation() } else if ( noCompError && noHypoError ) { - myDlg->myFullInfo->SetInfoByMesh( aMesh ); + myDlg->myFullInfo->SetInfoByMesh( myMesh ); myDlg->myFullInfo->show(); myDlg->myBriefInfo->hide(); myDlg->myHypErrorGroup->hide(); @@ -1064,7 +1079,7 @@ void SMESHGUI_ComputeOp::startOperation() else { QTableWidget* tbl = myDlg->myTable; - myDlg->myBriefInfo->SetInfoByMesh( aMesh ); + myDlg->myBriefInfo->SetInfoByMesh( myMesh ); myDlg->myBriefInfo->show(); myDlg->myFullInfo->hide(); @@ -1097,6 +1112,7 @@ void SMESHGUI_ComputeOp::startOperation() else tbl->showColumn( COL_SHAPE ); tbl->setColumnWidth( COL_ERROR, 200 ); + bool hasBadMesh = false; for ( int row = 0; row < aCompErrors->length(); ++row ) { SMESH::ComputeError & err = aCompErrors[ row ]; @@ -1121,12 +1137,22 @@ void SMESHGUI_ComputeOp::startOperation() if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) ); else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled + text = err.hasBadMesh ? "hasBadMesh" : ""; + if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) ); + else tbl->item( row, COL_BAD_MESH )->setText( text ); + if ( err.hasBadMesh ) hasBadMesh = true; + //tbl->item( row, COL_ERROR )->setWordWrap( true ); // VSR: TODO ??? tbl->resizeRowToContents( row ); } tbl->resizeColumnToContents( COL_ALGO ); tbl->resizeColumnToContents( COL_SHAPE ); + if ( hasBadMesh ) + myDlg->myBadMeshBtn->show(); + else + myDlg->myBadMeshBtn->hide(); + tbl->setCurrentCell(0,0); currentCellChanged(); // to update buttons } @@ -1144,6 +1170,13 @@ void SMESHGUI_ComputeOp::stopOperation() { SMESHGUI_Operation::stopOperation(); myTShapeDisplayer->SetVisibility( false ); + if ( myBadMeshDisplayer ) { + myBadMeshDisplayer->SetVisibility( false ); + // delete it in order not to have problems at its destruction when the viewer + // where it worked is dead due to e.g. study closing + delete myBadMeshDisplayer; + myBadMeshDisplayer = 0; + } } //================================================================================ @@ -1195,6 +1228,39 @@ void SMESHGUI_ComputeOp::onPublishShape() currentCellChanged(); // to update buttons } +//================================================================================ +/*! + * \brief show mesh elements preventing computation of a submesh of current row + */ +//================================================================================ + +void SMESHGUI_ComputeOp::onShowBadMesh() +{ + myTShapeDisplayer->SetVisibility( false ); + QList rows; + if ( SMESH::getSelectedRows( table(), rows ) == 1 ) { + bool hasBadMesh = ( !table()->item(rows.front(), COL_BAD_MESH)->text().isEmpty() ); + if ( hasBadMesh ) { + int curSub = table()->item(rows.front(), COL_SHAPEID)->text().toInt(); + SMESHGUI* gui = getSMESHGUI(); + SMESH::SMESH_Gen_var gen = gui->GetSMESHGen(); + SVTK_ViewWindow* view = SMESH::GetViewWindow( gui ); + if ( myBadMeshDisplayer ) delete myBadMeshDisplayer; + myBadMeshDisplayer = new SMESHGUI_MeshEditPreview( view ); + SMESH::MeshPreviewStruct_var aMeshData = gen->GetBadInputElements(myMesh,curSub); + vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3); + vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); + // delete property !!!!!!!!!! + vtkProperty* prop = vtkProperty::New(); + prop->SetLineWidth( aLineWidth * 3 ); + prop->SetPointSize( aPointSize * 3 ); + prop->SetColor( 250, 0, 250 ); + myBadMeshDisplayer->GetActor()->SetProperty( prop ); + myBadMeshDisplayer->SetData( aMeshData._retn() ); + } + } +} + //================================================================================ /*! * \brief SLOT called when a selected cell in table() changed @@ -1204,10 +1270,12 @@ void SMESHGUI_ComputeOp::onPublishShape() void SMESHGUI_ComputeOp::currentCellChanged() { myTShapeDisplayer->SetVisibility( false ); + if ( myBadMeshDisplayer ) + myBadMeshDisplayer->SetVisibility( false ); - bool publishEnable = 0, showEnable = 0, showOnly = 1; + bool publishEnable = 0, showEnable = 0, showOnly = 1, hasBadMesh = 0; QList rows; - SMESH::getSelectedRows( table(), rows ); + int nbSelected = SMESH::getSelectedRows( table(), rows ); int row; foreach ( row, rows ) { @@ -1225,9 +1293,13 @@ void SMESHGUI_ComputeOp::currentCellChanged() else { showEnable = true; } + + if ( !table()->item(row, COL_BAD_MESH)->text().isEmpty() ) + hasBadMesh = true; } myDlg->myPublishBtn->setEnabled( publishEnable ); - myDlg->myShowBtn->setEnabled( showEnable ); + myDlg->myShowBtn ->setEnabled( showEnable ); + myDlg->myBadMeshBtn->setEnabled( hasBadMesh && ( nbSelected == 1 )); } //================================================================================ @@ -1266,7 +1338,9 @@ void SMESHGUI_ComputeOp::onPreviewShape() SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp() { - if ( myTShapeDisplayer ) delete myTShapeDisplayer; + delete myTShapeDisplayer; + if ( myBadMeshDisplayer ) + delete myBadMeshDisplayer; } //================================================================================ diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.h b/src/SMESHGUI/SMESHGUI_ComputeDlg.h index 6413a4d23..cab75f2ad 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.h +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.h @@ -42,6 +42,7 @@ class QPushButton; class QTableWidget; class QLabel; class SMESHGUI_ComputeDlg; +class SMESHGUI_MeshEditPreview; namespace SMESH { @@ -71,6 +72,7 @@ protected slots: private slots: void onPreviewShape(); void onPublishShape(); + void onShowBadMesh(); void currentCellChanged(); private: @@ -78,8 +80,10 @@ private: SMESHGUI_ComputeDlg* myDlg; + SMESH::SMESH_Mesh_var myMesh; GEOM::GEOM_Object_var myMainShape; SMESH::TShapeDisplayer* myTShapeDisplayer; + SMESHGUI_MeshEditPreview* myBadMeshDisplayer; }; /*! @@ -151,6 +155,7 @@ private: QTableWidget* myTable; QPushButton* myShowBtn; QPushButton* myPublishBtn; + QPushButton* myBadMeshBtn; SMESHGUI_MeshInfosBox* myBriefInfo; SMESHGUI_MeshInfosBox* myFullInfo; diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index 3aaf82c35..687c9da09 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -252,7 +252,7 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI GroupButtonsLayout->setSpacing( SPACING ); GroupButtonsLayout->setMargin( MARGIN ); - buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons ); + buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons ); buttonOk->setAutoDefault( true ); buttonOk->setDefault( true ); buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons ); diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx index 72f5ac4c1..e1d2b3082 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx @@ -125,10 +125,10 @@ QWidget* SMESHGUI_DeleteGroupDlg::createButtonFrame (QWidget* theParent) { QGroupBox* aFrame = new QGroupBox(theParent); - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); - myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); - myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); + myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame); + myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); + myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); QHBoxLayout* aLay = new QHBoxLayout(aFrame); aLay->setMargin(MARGIN); diff --git a/src/SMESHGUI/SMESHGUI_Dialog.cxx b/src/SMESHGUI/SMESHGUI_Dialog.cxx index fe4b4634e..4b4c109b5 100644 --- a/src/SMESHGUI/SMESHGUI_Dialog.cxx +++ b/src/SMESHGUI/SMESHGUI_Dialog.cxx @@ -48,6 +48,7 @@ SMESHGUI_Dialog::SMESHGUI_Dialog( QWidget* parent, const bool modal, typeName( pr + MESH ) = tr( "DLG_MESH" ); typeName( pr + HYPOTHESIS ) = tr( "DLG_HYPO" ); typeName( pr + ALGORITHM ) = tr( "DLG_ALGO" ); + setButtonText(1, tr("SMESH_BUT_APPLY_AND_CLOSE")); //rename OK to Apply and Close if ( flags & Close ) setButtonPosition( Right, Close ); } diff --git a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx index e080369aa..58079ec23 100644 --- a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx @@ -434,7 +434,7 @@ SMESHGUI_EditMeshDlg::SMESHGUI_EditMeshDlg (SMESHGUI* theModule, GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index 435a7f4c2..80298f7c8 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -284,7 +284,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - OkButton = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + OkButton = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); OkButton->setAutoDefault(true); OkButton->setDefault(true); diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index 788cb76d6..e09419d7a 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -125,7 +125,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 7a12b1522..8de8a1c34 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -2062,11 +2062,11 @@ QWidget* SMESHGUI_FilterDlg::createButtonFrame (QWidget* theParent) aLay->setMargin(MARGIN); aLay->setSpacing(SPACING); - myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp); - myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp); - myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp); - myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp); - myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp); + myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGrp); + myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp); + myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp); + myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp); + myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp); aLay->addWidget(myButtons[ BTN_OK ]); aLay->addSpacing(10); @@ -2460,9 +2460,13 @@ void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg) // name : SMESHGUI_FilterDlg::SetGroupIds // Purpose : Set mesh //======================================================================= -void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_ptr theMesh) +void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh) { myMesh = theMesh; + if ( myMesh->_is_nil() ) { + myButtons[BTN_OK]->setEnabled(false); + myButtons[BTN_Apply]->setEnabled(false); + } } //======================================================================= @@ -2797,6 +2801,14 @@ void SMESHGUI_FilterDlg::onSelectionDone() int aRow, aCol; const SALOME_ListIO& aList = mySelector->StoredIObjects(); + if ( myMesh->_is_nil() && aList.Extent()>0 ) { + myMesh = SMESH::IObjectToInterface(aList.First()); + if ( !(myMesh->_is_nil()) ) { + myButtons[BTN_OK]->setEnabled(true); + myButtons[BTN_Apply]->setEnabled(true); + } + } + if (aList.Extent() != 1 || !myTable->CurrentCell(aRow, aCol) || myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGeom && @@ -2816,6 +2828,7 @@ void SMESHGUI_FilterDlg::onSelectionDone() } } + //======================================================================= // name : SMESHGUI_FilterDlg::onCriterionChanged // Purpose : SLOT called when cretarion of current row changed. Update selection diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h index 29f70ece3..639d5f748 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.h @@ -222,7 +222,7 @@ public: void Init( const int ); void SetSelection(); - void SetMesh( SMESH::SMESH_Mesh_ptr ); + void SetMesh (SMESH::SMESH_Mesh_var); void SetSourceWg( QWidget* ); static SMESH::Filter::Criterion createCriterion(); @@ -284,7 +284,7 @@ private: SMESHGUI* mySMESHGUI; LightApp_SelectionMgr* mySelectionMgr; SVTK_Selector* mySelector; - SMESH::SMESH_Mesh_ptr myMesh; + SMESH::SMESH_Mesh_var myMesh; QWidget* mySourceWg; SALOME_DataMapOfIOMapOfInteger myIObjects; diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index e9f38e862..9a94cb156 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -253,7 +253,7 @@ QWidget* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent) aLay->setMargin(MARGIN); aLay->setSpacing(SPACING); - myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp); + myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGrp); myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp); myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp); diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 536fe9ff6..19af7e001 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -63,6 +63,10 @@ // SALOME KERNEL includes #include +// VTK Includes +#include +#include + // OCCT includes #include @@ -100,18 +104,20 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), + mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ), myIsBusy( false ), + myNameChanged( false ), myActor( 0 ) { - initDialog(true); - if (!theMesh->_is_nil()) - init(theMesh); - else { - mySelectSubMesh->setEnabled(false); - mySelectGroup->setEnabled(false); - myGeomGroupBtn->setEnabled(false); - myGeomGroupLine->setEnabled(false); + initDialog( true ); + if ( !theMesh->_is_nil() ) + init( theMesh ); + else + { + mySelectSubMesh->setEnabled( false ); + mySelectGroup->setEnabled( false ); + myGeomGroupBtn->setEnabled( false ); + myGeomGroupLine->setEnabled( false ); } } @@ -124,18 +130,20 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), - myIsBusy( false ) + mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ), + myIsBusy( false ), + myNameChanged( false ) { - initDialog(false); - if (!theGroup->_is_nil()) - init(theGroup); - else { - mySelectSubMesh->setEnabled(false); - mySelectGroup->setEnabled(false); + initDialog( false ); + if ( !theGroup->_is_nil() ) + init( theGroup ); + else + { + mySelectSubMesh->setEnabled( false ); + mySelectGroup->setEnabled( false ); myCurrentLineEdit = myMeshGroupLine; - setSelectionMode(5); + setSelectionMode( 5 ); } } @@ -143,7 +151,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, // function : SMESHGUI_GroupDlg() // purpose : //================================================================================= -void SMESHGUI_GroupDlg::initDialog(bool create) +void SMESHGUI_GroupDlg::initDialog( bool create) { setModal( false ); setAttribute( Qt::WA_DeleteOnClose, true ); @@ -155,166 +163,167 @@ void SMESHGUI_GroupDlg::initDialog(bool create) myShapeByMeshOp = 0; myGeomPopup = 0; myGeomObjects = new GEOM::ListOfGO(); - myGeomObjects->length(0); + myGeomObjects->length( 0 ); - QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); + QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); - setWindowTitle(create ? tr("SMESH_CREATE_GROUP_TITLE") : tr("SMESH_EDIT_GROUP_TITLE")); + setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) ); myHelpFileName = create ? "creating_groups_page.html" : "editing_groups_page.html"; - setSizeGripEnabled(true); + setSizeGripEnabled( true); - QGridLayout* aMainLayout = new QGridLayout(this); + QGridLayout* aMainLayout = new QGridLayout( this ); aMainLayout->setMargin( MARGIN ); aMainLayout->setSpacing( SPACING ); /***************************************************************/ - QLabel* meshGroupLab = new QLabel(create ? tr("SMESH_MESH") : tr("SMESH_GROUP"), this); - myMeshGroupBtn = new QPushButton(this); - myMeshGroupBtn->setIcon(image0); - myMeshGroupLine = new QLineEdit(this); - myMeshGroupLine->setReadOnly(true); + QLabel* meshGroupLab = new QLabel( create ? tr( "SMESH_MESH" ) : tr( "SMESH_GROUP" ), this ); + myMeshGroupBtn = new QPushButton( this ); + myMeshGroupBtn->setIcon( image0 ); + myMeshGroupLine = new QLineEdit( this ); + myMeshGroupLine->setReadOnly( true ); /***************************************************************/ - QGroupBox* aTypeBox = new QGroupBox(tr("SMESH_ELEMENTS_TYPE"), this); - myTypeGroup = new QButtonGroup(this); + QGroupBox* aTypeBox = new QGroupBox( tr( "SMESH_ELEMENTS_TYPE" ), this ); + myTypeGroup = new QButtonGroup( this ); QHBoxLayout* aTypeBoxLayout = new QHBoxLayout( aTypeBox ); aTypeBoxLayout->setMargin( MARGIN ); aTypeBoxLayout->setSpacing( SPACING ); QStringList types; - types.append(tr("MESH_NODE")); - types.append(tr("SMESH_EDGE")); - types.append(tr("SMESH_FACE")); - types.append(tr("SMESH_VOLUME")); + types.append( tr( "MESH_NODE" ) ); + types.append( tr( "SMESH_EDGE" ) ); + types.append( tr( "SMESH_FACE" ) ); + types.append( tr( "SMESH_VOLUME" ) ); QRadioButton* rb; - for (int i = 0; i < types.count(); i++) { - rb = new QRadioButton(types[i], aTypeBox); - myTypeGroup->addButton(rb, i); + for ( int i = 0; i < types.count(); i++ ) + { + rb = new QRadioButton( types[i], aTypeBox ); + myTypeGroup->addButton( rb, i ); aTypeBoxLayout->addWidget( rb ); } - aTypeBox->setEnabled(create); + aTypeBox->setEnabled( create ); myTypeId = -1; /***************************************************************/ - QLabel* aName = new QLabel(tr("SMESH_NAME"), this); - aName->setMinimumWidth(50); - myName = new QLineEdit(this); + QLabel* aName = new QLabel( tr( "SMESH_NAME" ), this ); + aName->setMinimumWidth( 50 ); + myName = new QLineEdit( this ); /***************************************************************/ - QGroupBox* aGrpTypeBox = new QGroupBox(tr("SMESH_GROUP_TYPE"), this); - myGrpTypeGroup = new QButtonGroup(this); + QGroupBox* aGrpTypeBox = new QGroupBox( tr( "SMESH_GROUP_TYPE" ), this ); + myGrpTypeGroup = new QButtonGroup( this ); QHBoxLayout* aGrpTypeBoxLayout = new QHBoxLayout( aGrpTypeBox ); aGrpTypeBoxLayout->setMargin( MARGIN ); aGrpTypeBoxLayout->setSpacing( SPACING ); - QRadioButton* rb1 = new QRadioButton( tr("SMESH_GROUP_STANDALONE"), aGrpTypeBox); - QRadioButton* rb2 = new QRadioButton( tr("SMESH_GROUP_GEOMETRY"), aGrpTypeBox); - myGrpTypeGroup->addButton(rb1, 0); - myGrpTypeGroup->addButton(rb2, 1); - aGrpTypeBoxLayout->addWidget(rb1); - aGrpTypeBoxLayout->addWidget(rb2); - aGrpTypeBox->setEnabled(create); + QRadioButton* rb1 = new QRadioButton( tr( "SMESH_GROUP_STANDALONE" ), aGrpTypeBox ); + QRadioButton* rb2 = new QRadioButton( tr( "SMESH_GROUP_GEOMETRY" ), aGrpTypeBox ); + myGrpTypeGroup->addButton( rb1, 0 ); + myGrpTypeGroup->addButton( rb2, 1 ); + aGrpTypeBoxLayout->addWidget( rb1 ); + aGrpTypeBoxLayout->addWidget( rb2 ); + aGrpTypeBox->setEnabled( create ); myGrpTypeId = -1; /***************************************************************/ - myWGStack = new QStackedWidget(this); + myWGStack = new QStackedWidget( this ); QWidget* wg1 = new QWidget( myWGStack ); QWidget* wg2 = new QWidget( myWGStack ); /***************************************************************/ - QGroupBox* aContentBox = new QGroupBox(tr("SMESH_CONTENT"), wg1); - QGridLayout* aContentBoxLayout = new QGridLayout(aContentBox); - aContentBoxLayout->setMargin(MARGIN); - aContentBoxLayout->setSpacing(SPACING); - - QLabel* aLabel = new QLabel(tr("SMESH_ID_ELEMENTS"), aContentBox); - myElements = new QListWidget(aContentBox); - myElements->setSelectionMode(QListWidget::ExtendedSelection); - - myFilter = new QPushButton(tr("SMESH_BUT_FILTER"), aContentBox); - QPushButton* aAddBtn = new QPushButton(tr("SMESH_BUT_ADD"), aContentBox); - QPushButton* aRemoveBtn = new QPushButton(tr("SMESH_BUT_REMOVE"), aContentBox); - QPushButton* aSortBtn = new QPushButton(tr("SMESH_BUT_SORT"), aContentBox); - - aContentBoxLayout->addWidget(aLabel, 0, 0); - aContentBoxLayout->addWidget(myElements, 1, 0, 6, 1); - aContentBoxLayout->addWidget(myFilter, 1, 1); - aContentBoxLayout->addWidget(aAddBtn, 3, 1); - aContentBoxLayout->addWidget(aRemoveBtn, 4, 1); - aContentBoxLayout->addWidget(aSortBtn, 6, 1); - - aContentBoxLayout->setColumnStretch(0, 1); - aContentBoxLayout->setRowStretch(2, 1); - aContentBoxLayout->setRowStretch(5, 1); + QGroupBox* aContentBox = new QGroupBox( tr( "SMESH_CONTENT" ), wg1 ); + QGridLayout* aContentBoxLayout = new QGridLayout( aContentBox ); + aContentBoxLayout->setMargin( MARGIN ); + aContentBoxLayout->setSpacing( SPACING ); + + QLabel* aLabel = new QLabel( tr( "SMESH_ID_ELEMENTS" ), aContentBox ); + myElements = new QListWidget( aContentBox ); + myElements->setSelectionMode( QListWidget::ExtendedSelection ); + + myFilter = new QPushButton( tr( "SMESH_BUT_FILTER" ), aContentBox ); + QPushButton* aAddBtn = new QPushButton( tr( "SMESH_BUT_ADD" ), aContentBox ); + QPushButton* aRemoveBtn = new QPushButton( tr( "SMESH_BUT_REMOVE" ), aContentBox ); + QPushButton* aSortBtn = new QPushButton( tr( "SMESH_BUT_SORT" ), aContentBox ); + + aContentBoxLayout->addWidget( aLabel, 0, 0 ); + aContentBoxLayout->addWidget( myElements, 1, 0, 6, 1 ); + aContentBoxLayout->addWidget( myFilter, 1, 1 ); + aContentBoxLayout->addWidget( aAddBtn, 3, 1 ); + aContentBoxLayout->addWidget( aRemoveBtn, 4, 1 ); + aContentBoxLayout->addWidget( aSortBtn, 6, 1 ); + + aContentBoxLayout->setColumnStretch( 0, 1 ); + aContentBoxLayout->setRowStretch( 2, 1 ); + aContentBoxLayout->setRowStretch( 5, 1 ); /***************************************************************/ - QGroupBox* aSelectBox = new QGroupBox(tr("SMESH_SELECT_FROM"), wg1); - QGridLayout* aSelectBoxLayout = new QGridLayout(aSelectBox); - aSelectBoxLayout->setMargin(MARGIN); - aSelectBoxLayout->setSpacing(SPACING); - - mySelectSubMesh = new QCheckBox(tr("SMESH_SUBMESH"), aSelectBox); - mySubMeshBtn = new QPushButton(aSelectBox); - mySubMeshBtn->setIcon(image0); - mySubMeshLine = new QLineEdit(aSelectBox); - mySubMeshLine->setReadOnly(true); - onSelectSubMesh(false); - - mySelectGroup = new QCheckBox(tr("SMESH_GROUP"), aSelectBox); - myGroupBtn = new QPushButton(aSelectBox); - myGroupBtn->setIcon(image0); - myGroupLine = new QLineEdit(aSelectBox); - myGroupLine->setReadOnly(true); - onSelectGroup(false); - - aSelectBoxLayout->addWidget(mySelectSubMesh, 0, 0); - aSelectBoxLayout->addWidget(mySubMeshBtn, 0, 1); - aSelectBoxLayout->addWidget(mySubMeshLine, 0, 2); - aSelectBoxLayout->addWidget(mySelectGroup, 1, 0); - aSelectBoxLayout->addWidget(myGroupBtn, 1, 1); - aSelectBoxLayout->addWidget(myGroupLine, 1, 2); + QGroupBox* aSelectBox = new QGroupBox( tr( "SMESH_SELECT_FROM" ), wg1 ); + QGridLayout* aSelectBoxLayout = new QGridLayout( aSelectBox ); + aSelectBoxLayout->setMargin( MARGIN ); + aSelectBoxLayout->setSpacing( SPACING ); + + mySelectSubMesh = new QCheckBox( tr( "SMESH_SUBMESH" ), aSelectBox ); + mySubMeshBtn = new QPushButton( aSelectBox ); + mySubMeshBtn->setIcon( image0 ); + mySubMeshLine = new QLineEdit( aSelectBox ); + mySubMeshLine->setReadOnly( true ); + onSelectSubMesh( false ); + + mySelectGroup = new QCheckBox( tr( "SMESH_GROUP" ), aSelectBox ); + myGroupBtn = new QPushButton( aSelectBox ); + myGroupBtn->setIcon( image0 ); + myGroupLine = new QLineEdit( aSelectBox ); + myGroupLine->setReadOnly( true ); + onSelectGroup( false ); + + aSelectBoxLayout->addWidget( mySelectSubMesh, 0, 0 ); + aSelectBoxLayout->addWidget( mySubMeshBtn, 0, 1 ); + aSelectBoxLayout->addWidget( mySubMeshLine, 0, 2 ); + aSelectBoxLayout->addWidget( mySelectGroup, 1, 0 ); + aSelectBoxLayout->addWidget( myGroupBtn, 1, 1 ); + aSelectBoxLayout->addWidget( myGroupLine, 1, 2 ); /***************************************************************/ - QVBoxLayout* wg1Layout = new QVBoxLayout(wg1); - wg1Layout->setMargin(0); - wg1Layout->setSpacing(SPACING); - wg1Layout->addWidget(aContentBox); - wg1Layout->addWidget(aSelectBox); - wg1Layout->setStretchFactor(aContentBox, 10); + QVBoxLayout* wg1Layout = new QVBoxLayout( wg1 ); + wg1Layout->setMargin( 0 ); + wg1Layout->setSpacing( SPACING ); + wg1Layout->addWidget( aContentBox ); + wg1Layout->addWidget( aSelectBox ); + wg1Layout->setStretchFactor( aContentBox, 10 ); /***************************************************************/ - QLabel* geomObject = new QLabel(tr("SMESH_OBJECT_GEOM"), wg2); - myGeomGroupBtn = new QToolButton(wg2); - myGeomGroupBtn->setIcon(image0); - myGeomGroupBtn->setCheckable(true); - myGeomGroupLine = new QLineEdit(wg2); - myGeomGroupLine->setReadOnly(true); //VSR ??? - onSelectGeomGroup(false); + QLabel* geomObject = new QLabel( tr( "SMESH_OBJECT_GEOM" ), wg2 ); + myGeomGroupBtn = new QToolButton( wg2 ); + myGeomGroupBtn->setIcon( image0 ); + myGeomGroupBtn->setCheckable( true ); + myGeomGroupLine = new QLineEdit( wg2 ); + myGeomGroupLine->setReadOnly( true ); //VSR ??? + onSelectGeomGroup( false ); - myGeomGroupBtn->setEnabled(create); - myGeomGroupLine->setEnabled(create); + myGeomGroupBtn->setEnabled( create ); + myGeomGroupLine->setEnabled( create ); /***************************************************************/ QGridLayout* wg2Layout = new QGridLayout( wg2 ); - wg2Layout->setMargin(0); - wg1Layout->setSpacing(SPACING); - wg2Layout->addWidget(geomObject, 0, 0); - wg2Layout->addWidget(myGeomGroupBtn, 0, 1); - wg2Layout->addWidget(myGeomGroupLine,0, 2); - wg2Layout->setRowStretch(1, 5); + wg2Layout->setMargin( 0 ); + wg1Layout->setSpacing( SPACING ); + wg2Layout->addWidget( geomObject, 0, 0 ); + wg2Layout->addWidget( myGeomGroupBtn, 0, 1 ); + wg2Layout->addWidget( myGeomGroupLine,0, 2 ); + wg2Layout->setRowStretch( 1, 5 ); /***************************************************************/ myWGStack->insertWidget( 0, wg1 ); myWGStack->insertWidget( 1, wg2 ); /***************************************************************/ - QGroupBox* aColorBox = new QGroupBox(tr("SMESH_SET_COLOR"), this); + QGroupBox* aColorBox = new QGroupBox(tr( "SMESH_SET_COLOR" ), this); QHBoxLayout* aColorBoxLayout = new QHBoxLayout(aColorBox); aColorBoxLayout->setMargin(MARGIN); aColorBoxLayout->setSpacing(SPACING); - QLabel* aColorLab = new QLabel(tr("SMESH_CHECK_COLOR"), aColorBox ); + QLabel* aColorLab = new QLabel(tr( "SMESH_CHECK_COLOR" ), aColorBox ); myColorBtn = new QtxColorButton(aColorBox); myColorBtn->setSizePolicy( QSizePolicy::MinimumExpanding, myColorBtn->sizePolicy().verticalPolicy() ); @@ -330,14 +339,14 @@ void SMESHGUI_GroupDlg::initDialog(bool create) aBtnLayout->setMargin(MARGIN); aBtnLayout->setSpacing(SPACING); - myOKBtn = new QPushButton(tr("SMESH_BUT_OK"), aButtons); + myOKBtn = new QPushButton(tr( "SMESH_BUT_APPLY_AND_CLOSE" ), aButtons); myOKBtn->setAutoDefault(true); myOKBtn->setDefault(true); - myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aButtons); + myApplyBtn = new QPushButton(tr( "SMESH_BUT_APPLY" ), aButtons); myApplyBtn->setAutoDefault(true); - myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aButtons); + myCloseBtn = new QPushButton(tr( "SMESH_BUT_CLOSE" ), aButtons); myCloseBtn->setAutoDefault(true); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aButtons); + myHelpBtn = new QPushButton(tr( "SMESH_BUT_HELP" ), aButtons); myHelpBtn->setAutoDefault(true); aBtnLayout->addWidget(myOKBtn); @@ -408,7 +417,7 @@ void SMESHGUI_GroupDlg::initDialog(bool create) myTypeGroup->button(0)->setChecked(true); updateButtons(); - //myName->setText(GetDefaultName(tr("SMESH_GROUP"))); + //myName->setText(GetDefaultName(tr( "SMESH_GROUP" ))); } //================================================================================= @@ -439,7 +448,7 @@ QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) _PTR(Study) aStudy = appStudy->studyDS(); std::set aSet; - _PTR(SComponent) aMeshCompo (aStudy->FindComponent("SMESH")); + _PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" )); if (aMeshCompo) { _PTR(ChildIterator) it (aStudy->NewChildIterator(aMeshCompo)); _PTR(SObject) obj; @@ -469,12 +478,16 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) mySelectionMgr->installFilter(myMeshFilter); /* init data from current selection */ + restoreShowEntityMode(); myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh); + setShowEntityMode(); myGroup = SMESH::SMESH_Group::_nil(); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); - myActor = SMESH::FindActorByObject(myMesh); - SMESH::SetPickable(myActor); + // NPAL19389: create a group with a selection in another group + // set actor of myMesh, if it is visible, else try + // any visible actor of group or submesh of myMesh + SetAppropriateActor(); setDefaultGroupColor(); @@ -499,11 +512,15 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) //================================================================================= void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) { + restoreShowEntityMode(); myMesh = theGroup->GetMesh(); + setShowEntityMode(); + myNameChanged = true; + myName->blockSignals(true); myName->setText(theGroup->GetName()); + myName->blockSignals(false); myName->home(false); - myOldName = myName->text(); SALOMEDS::Color aColor = theGroup->GetColor(); setGroupColor( aColor ); @@ -521,58 +538,75 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) myGroup = SMESH::SMESH_Group::_narrow( theGroup ); - if ( !myGroup->_is_nil() ) - { - myActor = SMESH::FindActorByObject(myMesh); - if ( !myActor ) - myActor = SMESH::FindActorByObject(myGroup); - SMESH::SetPickable(myActor); + if (!myGroup->_is_nil()) + { + // NPAL19389: create a group with a selection in another group + // set actor of myMesh, if it is visible, else set + // actor of myGroup, if it is visible, else try + // any visible actor of group or submesh of myMesh + // commented, because an attempt to set selection on not displayed cells leads to error + //SetAppropriateActor(); + myActor = SMESH::FindActorByObject(myMesh); + if ( !myActor ) + myActor = SMESH::FindActorByObject(myGroup); + SMESH::SetPickable(myActor); - myGrpTypeGroup->button(0)->setChecked(true); - onGrpTypeChanged(0); + myGrpTypeGroup->button(0)->setChecked(true); + onGrpTypeChanged(0); - myCurrentLineEdit = 0; - myElements->clear(); - setSelectionMode(aType); - myTypeId = aType; + myCurrentLineEdit = 0; + myElements->clear(); + setSelectionMode(aType); + myTypeId = aType; - myIdList.clear(); - if (!myGroup->IsEmpty()) { - SMESH::long_array_var anElements = myGroup->GetListOfID(); - int k = anElements->length(); - for (int i = 0; i < k; i++) { - myIdList.append(anElements[i]); - myElements->addItem(QString::number(anElements[i])); - } - myElements->selectAll(); + setShowEntityMode(); // depends on myTypeId + + myIdList.clear(); + if (!myGroup->IsEmpty()) { + SMESH::long_array_var anElements = myGroup->GetListOfID(); + int k = anElements->length(); + for (int i = 0; i < k; i++) { + myIdList.append(anElements[i]); + myElements->addItem(QString::number(anElements[i])); } + myElements->selectAll(); } + } else + { + myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup ); + + if ( !myGroupOnGeom->_is_nil() ) { - myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup ); + // NPAL19389: create a group with a selection in another group + // set actor of myMesh, if it is visible, else set + // actor of myGroupOnGeom, if it is visible, else try + // any visible actor of group or submesh of myMesh + // commented, because an attempt to set selection on not displayed cells leads to error + //SetAppropriateActor(); + myActor = SMESH::FindActorByObject(myMesh); + if ( !myActor ) + myActor = SMESH::FindActorByObject(myGroupOnGeom); + SMESH::SetPickable(myActor); - if ( !myGroupOnGeom->_is_nil() ) - { - myActor = SMESH::FindActorByObject(myMesh); - if ( !myActor ) - myActor = SMESH::FindActorByObject(myGroup); - SMESH::SetPickable(myActor); - - myGrpTypeGroup->button(1)->setChecked(true); - onGrpTypeChanged(1); - - QString aShapeName(""); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape(); - if (!aGroupShape->_is_nil()) - { - _PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry()); - aShapeName = aGroupShapeSO->GetName().c_str(); - } - myGeomGroupLine->setText( aShapeName ); - myName->setText("Group On " + aShapeName); - } + myGrpTypeGroup->button(1)->setChecked(true); + onGrpTypeChanged(1); + + QString aShapeName( "" ); + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape(); + if (!aGroupShape->_is_nil()) + { + _PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry()); + aShapeName = aGroupShapeSO->GetName().c_str(); + } + myGeomGroupLine->setText( aShapeName ); + myNameChanged = true; + myName->blockSignals(true); + myName->setText( "Group On " + aShapeName); + myName->blockSignals(false); } + } } //================================================================================= @@ -603,7 +637,9 @@ void SMESHGUI_GroupDlg::updateButtons() //================================================================================= void SMESHGUI_GroupDlg::onNameChanged (const QString& text) { + myOldName = myName->text(); updateButtons(); + myNameChanged = !myName->text().trimmed().isEmpty(); } //================================================================================= @@ -616,8 +652,9 @@ void SMESHGUI_GroupDlg::onTypeChanged (int id) myElements->clear(); if (myCurrentLineEdit == 0) setSelectionMode(id); + myTypeId = id; + setShowEntityMode(); } - myTypeId = id; } //================================================================================= @@ -628,8 +665,9 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged (int id) { if (myGrpTypeId != id) { myWGStack->setCurrentIndex( id ); - if (id == 0) - myName->setText(myOldName); + myName->blockSignals(true); + myName->setText(myOldName); + myName->blockSignals(false); onSelectGeomGroup(id == 1); } myGrpTypeId = id; @@ -748,7 +786,7 @@ bool SMESHGUI_GroupDlg::onApply() SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" ); /* init for next operation */ - myName->setText(""); + myName->setText( "" ); myElements->clear(); myGroup = SMESH::SMESH_Group::_nil(); @@ -859,7 +897,7 @@ bool SMESHGUI_GroupDlg::onApply() if (op->IsDone()) { // publish the GEOM group in study - QString aNewGeomGroupName ("Auto_group_for_"); + QString aNewGeomGroupName ( "Auto_group_for_" ); aNewGeomGroupName += myName->text(); SALOMEDS::SObject_var aNewGroupSO = geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, @@ -880,7 +918,7 @@ bool SMESHGUI_GroupDlg::onApply() SMESH::setFileType ( aMeshGroupSO,"COULEURGROUP" ); /* init for next operation */ - myName->setText(""); + myName->setText( "" ); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); } else { // edition @@ -918,7 +956,7 @@ void SMESHGUI_GroupDlg::onOK() //================================================================================= void SMESHGUI_GroupDlg::onListSelectionChanged() { - // MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor); + // MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor); if( myIsBusy || !myActor) return; myIsBusy = true; @@ -953,34 +991,37 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() int aNbSel = aList.Extent(); myElements->clearSelection(); - if (myCurrentLineEdit) { - myCurrentLineEdit->setText(""); + if (myCurrentLineEdit) + { + myCurrentLineEdit->setText( "" ); QString aString = ""; - if (myCurrentLineEdit == myMeshGroupLine) { + if (myCurrentLineEdit == myMeshGroupLine) + { mySelectSubMesh->setEnabled(false); mySelectGroup->setEnabled(false); - myGroupLine->setText(""); - mySubMeshLine->setText(""); + myGroupLine->setText( "" ); + mySubMeshLine->setText( "" ); myGeomGroupBtn->setEnabled(false); myGeomGroupLine->setEnabled(false); - myGeomGroupLine->setText(""); + myGeomGroupLine->setText( "" ); myGeomObjects = new GEOM::ListOfGO(); myGeomObjects->length(0); if (myGeomGroupBtn->isChecked()) myGeomGroupBtn->setChecked(false); if (!myCreate) - myName->setText(""); + myName->setText( "" ); myElements->clear(); if (aNbSel != 1 ) { myGroup = SMESH::SMESH_Group::_nil(); - myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); + myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); + restoreShowEntityMode(); myMesh = SMESH::SMESH_Mesh::_nil(); - updateGeomPopup(); + updateGeomPopup(); updateButtons(); myIsBusy = false; return; @@ -988,8 +1029,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() Handle(SALOME_InteractiveObject) IO = aList.First(); if (myCreate) { - myMesh = SMESH::IObjectToInterface(IO); - updateGeomPopup(); + restoreShowEntityMode(); + myMesh = SMESH::IObjectToInterface(IO); + setShowEntityMode(); + updateGeomPopup(); if (myMesh->_is_nil()) { updateButtons(); @@ -998,8 +1041,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() } myGroup = SMESH::SMESH_Group::_nil(); - myActor = SMESH::FindActorByObject(myMesh); - SMESH::SetPickable(myActor); + // NPAL19389: create a group with a selection in another group + // set actor of myMesh, if it is visible, else try + // any visible actor of group or submesh of myMesh + SetAppropriateActor(); aString = aList.First()->getName(); myMeshGroupLine->setText(aString); @@ -1010,7 +1055,8 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myGeomGroupBtn->setEnabled(true); myGeomGroupLine->setEnabled(true); updateButtons(); - } else { + } + else { SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface(IO); if (aGroup->_is_nil()) { @@ -1034,33 +1080,34 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() return; if (myGrpTypeId == 0) + { + if (myTypeId == -1) + onTypeChanged(0); + else { - if (myTypeId == -1) - onTypeChanged(0); - else - { - myElements->clear(); - setSelectionMode(myTypeId); - } + myElements->clear(); + setSelectionMode(myTypeId); } + } myIsBusy = false; return; - } else if (myCurrentLineEdit == myGeomGroupLine) { - + } + else if (myCurrentLineEdit == myGeomGroupLine) + { myGeomObjects = new GEOM::ListOfGO(); // The mesh SObject _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh); if (aNbSel == 0 || !aMeshSO) - { - myGeomObjects->length(0); - updateButtons(); - myIsBusy = false; - return; - } + { + myGeomObjects->length(0); + updateButtons(); + myIsBusy = false; + return; + } myGeomObjects->length(aNbSel); @@ -1069,52 +1116,51 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() int i = 0; SALOME_ListIteratorOfListIO anIt (aList); - for ( ; anIt.More(); anIt.Next()) { - - testResult = Standard_False; - aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult); - - // Check if the object is a geometry group - if (!testResult || CORBA::is_nil(aGeomGroup)) - continue; - + for (; anIt.More(); anIt.Next()) + { + testResult = Standard_False; + aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult); - // Check if group constructed on the same shape as a mesh or on its child - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - GEOM::GEOM_IGroupOperations_var anOp = - SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); + // Check if the object is a geometry group + if (!testResult || CORBA::is_nil(aGeomGroup)) + continue; - // The main shape of the group - GEOM::GEOM_Object_var aGroupMainShape; - if (aGeomGroup->GetType() == 37) - aGroupMainShape = anOp->GetMainShape(aGeomGroup); - else - aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup); - _PTR(SObject) aGroupMainShapeSO = - //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape)); - aStudy->FindObjectID(aGroupMainShape->GetStudyEntry()); - - _PTR(SObject) anObj, aRef; - bool isRefOrSubShape = false; - if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) { - //if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) { - if (aRef->GetID() == aGroupMainShapeSO->GetID()) { - isRefOrSubShape = true; - } else { - _PTR(SObject) aFather = aGroupMainShapeSO->GetFather(); - _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent(); - //while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) { - while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) { - //if (strcmp(aRef->GetID(), aFather->GetID()) == 0) - if (aRef->GetID() == aFather->GetID()) - isRefOrSubShape = true; - else - aFather = aFather->GetFather(); - } - } - } - if (isRefOrSubShape) - myGeomObjects[i++] = aGeomGroup; + // Check if group constructed on the same shape as a mesh or on its child + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + GEOM::GEOM_IGroupOperations_var anOp = + SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); + + // The main shape of the group + GEOM::GEOM_Object_var aGroupMainShape; + if (aGeomGroup->GetType() == 37) + aGroupMainShape = anOp->GetMainShape(aGeomGroup); + else + aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup); + _PTR(SObject) aGroupMainShapeSO = + //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape)); + aStudy->FindObjectID(aGroupMainShape->GetStudyEntry()); + + _PTR(SObject) anObj, aRef; + bool isRefOrSubShape = false; + if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) { + //if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) { + if (aRef->GetID() == aGroupMainShapeSO->GetID()) { + isRefOrSubShape = true; + } else { + _PTR(SObject) aFather = aGroupMainShapeSO->GetFather(); + _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent(); + //while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) { + while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) { + //if (strcmp(aRef->GetID(), aFather->GetID()) == 0) + if (aRef->GetID() == aFather->GetID()) + isRefOrSubShape = true; + else + aFather = aFather->GetFather(); + } + } + } + if (isRefOrSubShape) + myGeomObjects[i++] = aGeomGroup; } myGeomObjects->length(i); @@ -1127,28 +1173,72 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() aNbSel = i; } - if(aNbSel >= 1) { - if(aNbSel > 1) { - if(myCurrentLineEdit == mySubMeshLine) - aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel); - else if(myCurrentLineEdit == myGroupLine) - aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel); - else if(myCurrentLineEdit == myGeomGroupLine) - aString = tr("%1 Objects").arg(aNbSel); - } else { - aString = aList.First()->getName(); + if (aNbSel >= 1) { + if (aNbSel > 1) { + if (myCurrentLineEdit == mySubMeshLine) + aString = tr( "SMESH_SUBMESH_SELECTED" ).arg(aNbSel); + else if (myCurrentLineEdit == myGroupLine) + aString = tr( "SMESH_GROUP_SELECTED" ).arg(aNbSel); + else if (myCurrentLineEdit == myGeomGroupLine) + aString = tr( "%1 Objects" ).arg(aNbSel); + } + else { + aString = aList.First()->getName(); } } myCurrentLineEdit->setText(aString); - myOldName = myName->text(); - myName->setText(aString); myCurrentLineEdit->home(false); + // 07.06.2008 skl for IPAL19574: + // change name of group only if it is empty + if( myName->text().trimmed().isEmpty() || !myNameChanged ) { + myOldName = myName->text(); + myName->blockSignals(true); + myName->setText(aString); + myName->blockSignals(false); + } updateButtons(); + } + else // !myCurrentLineEdit: local selection of nodes or elements + { + if (aNbSel == 1 && myActor && myActor->hasIO()) + { +#ifdef ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION + // NPAL19389: create a group with a selection in another group + // Switch myActor to the newly selected one, if the last + // is visible and belongs to group or submesh of myMesh + Handle(SALOME_InteractiveObject) curIO = myActor->getIO(); + Handle(SALOME_InteractiveObject) selIO = aList.First(); + if (curIO->hasEntry() && selIO->hasEntry()) { + const char* selEntry = selIO->getEntry(); + if (strcmp(curIO->getEntry(), selEntry) != 0) { + // different objects: selected and myActor + SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView(); + if (aViewWindow && aViewWindow->isVisible(selIO)) { + // newly selected actor is visible + + // mesh entry + _PTR(SObject) aSObject = SMESH::FindSObject(myMesh); + if (aSObject) { + CORBA::String_var meshEntry = aSObject->GetID().c_str(); + int len = strlen(meshEntry); + + if (strncmp(selEntry, meshEntry, len) == 0) { + // selected object is myMesh or a part of it + SMESH_Actor* anActor = SMESH::FindActorByEntry(selEntry); + if (anActor) { + myActor = anActor; + SMESH::SetPickable(myActor); + } + } + } + } + } + } + // NPAL19389 END +#endif // ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION - } else { - if (aNbSel == 1 && myActor ) { QString aListStr = ""; int aNbItems = 0; if (myTypeId == 0) { @@ -1159,7 +1249,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() if (aNbItems > 0) { QListWidgetItem* anItem; QList listItemsToSel; - QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts); + QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts); for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) { QList found = myElements->findItems(*it, Qt::MatchExactly); foreach(anItem, found) @@ -1185,6 +1275,11 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myActor = SMESH::FindActorByObject(myMesh); } + // somehow, if we display the mesh, while selecting from another actor, + // the mesh becomes pickable, and there is no way to select any element + if (myActor) + SMESH::SetPickable(myActor); + myIsBusy = false; } @@ -1205,7 +1300,7 @@ void SMESHGUI_GroupDlg::onSelectSubMesh(bool on) setSelectionMode(4); } else { - mySubMeshLine->setText(""); + mySubMeshLine->setText( "" ); myCurrentLineEdit = 0; if (myTypeId != -1) setSelectionMode(myTypeId); @@ -1229,7 +1324,7 @@ void SMESHGUI_GroupDlg::onSelectGroup(bool on) setSelectionMode(5); } else { - myGroupLine->setText(""); + myGroupLine->setText( "" ); myCurrentLineEdit = 0; if (myTypeId != -1) setSelectionMode(myTypeId); @@ -1259,7 +1354,7 @@ void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on) else { myGeomGroupBtn->setChecked(false); myGeomObjects->length(0); - myGeomGroupLine->setText(""); + myGeomGroupLine->setText( "" ); myCurrentLineEdit = 0; if (myTypeId != -1) setSelectionMode(myTypeId); @@ -1391,7 +1486,7 @@ void SMESHGUI_GroupDlg::onAdd() aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr); } if (aNbItems > 0) { - QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts); + QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts); for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) { QList found = myElements->findItems(*it, Qt::MatchExactly); if (found.count() == 0) { @@ -1728,6 +1823,7 @@ void SMESHGUI_GroupDlg::onClose() SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters SMESH::SetPointRepresentation(false); SMESH::SetPickable(); + restoreShowEntityMode(); } mySelectionMgr->clearSelected(); @@ -1747,7 +1843,7 @@ void SMESHGUI_GroupDlg::onHelp() { LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); if (app) - app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString( "" ), myHelpFileName); else { QString platform; #ifdef WIN32 @@ -1755,9 +1851,9 @@ void SMESHGUI_GroupDlg::onHelp() #else platform = "application"; #endif - SUIT_MessageBox::warning(this, tr("WRN_WARNING"), - tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", + SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ), + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg(app->resourceMgr()->stringValue( "ExternalBrowser", platform)). arg(myHelpFileName)); } @@ -1839,8 +1935,8 @@ void SMESHGUI_GroupDlg::updateGeomPopup() if ( enable ) { if ( !myGeomPopup ) { myGeomPopup = new QMenu(this); - myActions[myGeomPopup->addAction( tr("DIRECT_GEOM_SELECTION") )] = DIRECT_GEOM_INDEX; - myActions[myGeomPopup->addAction( tr("GEOM_BY_MESH_ELEM_SELECTION") )] = GEOM_BY_MESH_INDEX; + myActions[myGeomPopup->addAction( tr( "DIRECT_GEOM_SELECTION" ) )] = DIRECT_GEOM_INDEX; + myActions[myGeomPopup->addAction( tr( "GEOM_BY_MESH_ELEM_SELECTION" ) )] = GEOM_BY_MESH_INDEX; connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) ); } connect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) )); @@ -2029,3 +2125,122 @@ void SMESHGUI_GroupDlg::setDefaultGroupColor() setGroupQColor( aQColor ); } + +//================================================================================= +// function : SetAppropriateActor() +// purpose : Find more appropriate of visible actors, set it to myActor, allow picking +// NPAL19389: create a group with a selection in another group. +// if mesh actor is not visible - find any first visible group or submesh +//================================================================================= +bool SMESHGUI_GroupDlg::SetAppropriateActor() +{ + bool isActor = false; + + if (myMesh->_is_nil()) return false; + + SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView(); + + // try mesh actor + myActor = SMESH::FindActorByObject(myMesh); + if (myActor && myActor->hasIO()) + { + isActor = true; + if (aViewWindow && !aViewWindow->isVisible(myActor->getIO())) + isActor = false; + } + + // try current group actor + if (!isActor) { + if (!myGroup->_is_nil()) { + myActor = SMESH::FindActorByObject(myGroup); + if (myActor && myActor->hasIO()) + { + isActor = true; + if (aViewWindow && !aViewWindow->isVisible(myActor->getIO())) + isActor = false; + } + } + } + + // try current group on geometry actor + if (!isActor) { + if (!myGroupOnGeom->_is_nil()) { + myActor = SMESH::FindActorByObject(myGroupOnGeom); + if (myActor && myActor->hasIO()) + { + isActor = true; + if (aViewWindow && !aViewWindow->isVisible(myActor->getIO())) + isActor = false; + } + } + } + + // try any visible actor of group or submesh of current mesh + if (!isActor && aViewWindow) { + // mesh entry + _PTR(SObject) aSObject = SMESH::FindSObject(myMesh); + if (aSObject) { + CORBA::String_var meshEntry = aSObject->GetID().c_str(); + int len = strlen(meshEntry); + + // iterate on all actors in current view window, search for + // any visible actor, that belongs to group or submesh of current mesh + vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors(); + aCollection->InitTraversal(); + for (vtkActor *anAct = aCollection->GetNextActor(); + anAct && !isActor; + anAct = aCollection->GetNextActor()) + { + SMESH_Actor *anActor = dynamic_cast(anAct); + if (anActor && anActor->hasIO()) { + Handle(SALOME_InteractiveObject) anIO = anActor->getIO(); + if (aViewWindow->isVisible(anIO)) { + if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0) { + myActor = anActor; + isActor = true; + } + } + } + } + } + } + + if (isActor) + SMESH::SetPickable(myActor); + + return isActor; +} + +//======================================================================= +//function : setShowEntityMode +//purpose : make shown only entity corresponding to my type +//======================================================================= +void SMESHGUI_GroupDlg::setShowEntityMode() +{ + if ( !myMesh->_is_nil() ) { + if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) { + if (!myStoredShownEntity) + myStoredShownEntity = actor->GetEntityMode(); + switch ( myTypeId ) { + case 0: restoreShowEntityMode(); break; + case 1: actor->SetEntityMode( SMESH_Actor::eEdges ); break; + case 2: actor->SetEntityMode( SMESH_Actor::eFaces ); break; + case 3: actor->SetEntityMode( SMESH_Actor::eVolumes ); break; + } + } + } +} + +//======================================================================= +//function : restoreShowEntityMode +//purpose : restore ShowEntity mode of myActor +//======================================================================= +void SMESHGUI_GroupDlg::restoreShowEntityMode() +{ + if ( myStoredShownEntity && !myMesh->_is_nil() ) { + if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) { + actor->SetEntityMode(myStoredShownEntity); + } + } + myStoredShownEntity = 0; +} diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h index cab0697f6..76c34f686 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.h @@ -120,6 +120,9 @@ private: void setSelectionMode( int ); void updateButtons(); void updateGeomPopup(); + bool SetAppropriateActor(); + void setShowEntityMode(); + void restoreShowEntityMode(); void setGroupColor( const SALOMEDS::Color& ); SALOMEDS::Color getGroupColor() const; @@ -134,6 +137,7 @@ private: SMESH_Actor* myActor; /* Current mesh actor */ int myGrpTypeId; /* Current group type id : standalone or group on geometry */ int myTypeId; /* Current type id = radio button id */ + int myStoredShownEntity; /* Store ShowEntity mode of myMesh */ QLineEdit* myCurrentLineEdit; /* Current LineEdit */ SVTK_Selector* mySelector; @@ -194,6 +198,8 @@ private: QString myHelpFileName; QMap myActions; + + bool myNameChanged; //added by skl for IPAL19574 }; #endif // SMESHGUI_GROUPDLG_H diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx index 86b655275..919fa2f9b 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx @@ -171,7 +171,7 @@ QWidget* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent) { QGroupBox* aFrame = new QGroupBox(theParent); - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); + myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 3a0bc9ffa..0b9b9ea9d 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -216,7 +216,7 @@ namespace SMESH // Init list of available hypotheses, if needed InitAvailableHypotheses(); - bool checkGeometry = !isNeedGeometry; + bool checkGeometry = ( !isNeedGeometry && isAlgo ); // fill list of hypotheses/algorithms THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap; THypothesisDataMap::iterator anIter; diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index 6e9554cb0..dff58aebe 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -334,7 +334,7 @@ QWidget* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent) QFrame* aFrame = new QFrame(theParent); aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); + myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index 1d39661bc..e4bbc8bed 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -121,7 +121,7 @@ QWidget* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) QFrame* aFrame = new QFrame(theParent); aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); + myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index 80d574dde..42dbb6b8e 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -273,7 +273,7 @@ QWidget* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent) { QGroupBox* aFrame = new QGroupBox(theParent); - myOkBtn = new QPushButton (tr("SMESH_BUT_OK" ), aFrame); + myOkBtn = new QPushButton (tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame); myApplyBtn = new QPushButton (tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton (tr("SMESH_BUT_CLOSE"), aFrame); myHelpBtn = new QPushButton (tr("SMESH_BUT_HELP"), aFrame); diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index 11f2e8ccf..4bf4ddeb9 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -280,7 +280,7 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ): QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); GroupButtonsLayout->setSpacing( SPACING ); GroupButtonsLayout->setMargin( MARGIN ); - buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons ); + buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons ); buttonOk->setAutoDefault( true ); buttonOk->setDefault( true ); buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons ); diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index d7228e830..b30ce2982 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -275,7 +275,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* QHBoxLayout* myButtonGrpLayout = new QHBoxLayout( myButtonGrp ); myButtonGrpLayout->setSpacing( SPACING_SIZE ); myButtonGrpLayout->setMargin( MARGIN_SIZE ); - myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), myButtonGrp ); + myOkBtn = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), myButtonGrp ); myOkBtn->setAutoDefault( true ); myOkBtn->setDefault( true ); myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), myButtonGrp ); myApplyBtn->setAutoDefault( true ); diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index c8aa32a60..f9689c657 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -131,7 +131,7 @@ SMESHGUI_RemoveElementsDlg GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx index 50404e8cc..2f2a5e3f9 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx @@ -131,7 +131,7 @@ SMESHGUI_RemoveNodesDlg GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx index 992620883..bee0c48e7 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx @@ -135,7 +135,7 @@ SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const int GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 037a355b0..b780afd4a 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -245,7 +245,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index 6356d73d6..f564198de 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -224,7 +224,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index 7da9fcf76..62a4803cd 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -215,7 +215,7 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx index 2f87dfd75..40ff7e118 100644 --- a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx @@ -306,8 +306,9 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() if (aListId.count() == 1) { int elemID = (aListId.first()).toInt(); - myGeomObj = SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement - ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().data()); + myGeomObj = GEOM::GEOM_Object::_duplicate( + SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement + ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) ); } else { diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx index c6710d6cd..4856f9ea2 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx @@ -62,31 +62,20 @@ #define MARGIN 11 /*! - * Class : SMESHGUI_DiagValidator - * Description : validate munual input of edge like "id1-id2" - */ -class SMESHGUI_DiagValidator: public QValidator + \class BusyLocker + \brief Simple 'busy state' flag locker. + \internal +*/ + +class BusyLocker { public: - SMESHGUI_DiagValidator (QWidget* parent): - QValidator(parent) {} - - State validate (QString& text, int& pos) const - { - text = text.trimmed(); - text.replace(QRegExp("[^0-9]+"), "-"); - if (text == "-") - text = ""; - int ind = text.indexOf(QRegExp("-[0-9]+-")); - if (ind > 0) { // leave only two ids - ind = text.indexOf('-', ind + 1); - if (ind > 0) - text.truncate(ind); - } - if (pos > text.length()) - pos = text.length(); - return Acceptable; - } + //! Constructor. Sets passed boolean flag to \c true. + BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; } + //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false. + ~BusyLocker() { myBusy = false; } +private: + bool& myBusy; //! External 'busy state' boolean flag }; /*! @@ -138,7 +127,7 @@ QWidget* SMESHGUI_SingleEditDlg::createMainFrame (QWidget* theParent) QPushButton* aBtn = new QPushButton(aMainGrp); aBtn->setIcon(aPix); myEdge = new QLineEdit(aMainGrp); - myEdge->setValidator(new SMESHGUI_DiagValidator(this)); + myEdge->setValidator(new QRegExpValidator(QRegExp("[\\d]*-[\\d]*"), this)); aLay->addWidget(aLab); aLay->addWidget(aBtn); @@ -155,7 +144,7 @@ QWidget* SMESHGUI_SingleEditDlg::createButtonFrame (QWidget* theParent) { QGroupBox* aFrame = new QGroupBox(theParent); - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); + myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); @@ -339,6 +328,7 @@ static bool findTriangles (const SMDS_MeshNode * theNode1, void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) { if (myBusy) return; + BusyLocker lock(myBusy); myOkBtn->setEnabled(false); myApplyBtn->setEnabled(false); @@ -346,7 +336,6 @@ void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) // hilight entered edge if(myActor){ if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){ - myBusy = true; // block onSelectionDone() Handle(SALOME_InteractiveObject) anIO = myActor->getIO(); SALOME_ListIO aList; aList.Append(anIO); @@ -355,42 +344,34 @@ void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; mySelector->GetIndex(anIO,selectedIndices); - myBusy = false; - QStringList aListId = theNewText.split("-", QString::SkipEmptyParts); - if (aListId.count() != 2) + int id1, id2; + if ( !getNodeIds(myEdge->text(), id1, id2) ) return; - int i; - bool allOk = true; - const SMDS_MeshNode* a2Nodes[2]; - for (i = 0; i < aListId.count(); i++) { - if(const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[ i ].toInt())) - a2Nodes[ i ] = aNode; - else - allOk = false; - } - - // find a triangle and an edge nb - const SMDS_MeshElement* tria[2]; - allOk &= a2Nodes[0] != a2Nodes[1] && findTriangles(a2Nodes[0],a2Nodes[1],tria[0],tria[1]); - myBusy = true; // block onSelectionDone() - if(allOk) + const SMDS_MeshNode* aNode1 = aMesh->FindNode( id1 ); + const SMDS_MeshNode* aNode2 = aMesh->FindNode( id2 ); + + if ( !aNode1 || !aNode2 || aNode1 == aNode2 ) + return; + + // find a triangle and an edge index + const SMDS_MeshElement* tria1; + const SMDS_MeshElement* tria2; + + if ( findTriangles(aNode1,aNode2,tria1,tria2) ) { - newIndices.Add(tria[0]->GetID()); + newIndices.Add(tria1->GetID()); - const SMDS_MeshNode* a3Nodes [3]; + const SMDS_MeshNode* a3Nodes[3]; SMDS_ElemIteratorPtr it; - int edgeInd = 2; - for (i = 0, it = tria[0]->nodesIterator(); it->more(); i++) { + int edgeInd = 2, i; + for (i = 0, it = tria1->nodesIterator(); it->more(); i++) { a3Nodes[ i ] = static_cast(it->next()); - if (i > 0) { - allOk = (a3Nodes[ i ] == a2Nodes[ 0 ] && a3Nodes[ i - 1] == a2Nodes[ 1 ]) || - (a3Nodes[ i ] == a2Nodes[ 1 ] && a3Nodes[ i - 1] == a2Nodes[ 0 ]); - if (allOk) { - edgeInd = i - 1; - break; - } + if (i > 0 && ( a3Nodes[ i ] == aNode1 && a3Nodes[ i - 1] == aNode2 || + a3Nodes[ i ] == aNode2 && a3Nodes[ i - 1] == aNode1 ) ) { + edgeInd = i - 1; + break; } } newIndices.Add(-edgeInd-1); @@ -400,8 +381,6 @@ void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) } mySelector->AddOrRemoveIndex(anIO,newIndices, false); SMESH::GetViewWindow(mySMESHGUI)->highlight( anIO, true, true ); - - myBusy = false; } } } @@ -413,6 +392,7 @@ void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) void SMESHGUI_SingleEditDlg::onSelectionDone() { if (myBusy) return; + BusyLocker lock(myBusy); int anId1 = 0, anId2 = 0; @@ -438,9 +418,7 @@ void SMESHGUI_SingleEditDlg::onSelectionDone() findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1] ) ) { QString aText = QString("%1-%2").arg(anId1).arg(anId2); - myBusy = true; myEdge->setText(aText); - myBusy = false; myOkBtn->setEnabled(true); myApplyBtn->setEnabled(true); diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index f284df459..8090b5455 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -185,7 +185,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); @@ -311,8 +311,7 @@ void SMESHGUI_SmoothingDlg::ClickOnApply() if (mySMESHGUI->isActiveStudyLocked()) return; - if (myNbOkElements && - (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { + if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); QStringList aListNodesId = LineEditNodes->text().split(" ", QString::SkipEmptyParts); @@ -323,7 +322,7 @@ void SMESHGUI_SmoothingDlg::ClickOnApply() for (int i = 0; i < aListElementsId.count(); i++) anElementsId[i] = aListElementsId[i].toInt(); - if (myNbOkNodes) { + if ( myNbOkNodes && aListNodesId.count() > 0 ) { aNodesId->length(aListNodesId.count()); for (int i = 0; i < aListNodesId.count(); i++) aNodesId[i] = aListNodesId[i].toInt(); @@ -492,7 +491,6 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() if (myBusy) return; // clear - myActor = 0; QString aString = ""; myBusy = true; @@ -501,6 +499,7 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() myNbOkElements = 0; buttonOk->setEnabled(false); buttonApply->setEnabled(false); + myActor = 0; } myBusy = false; @@ -593,7 +592,7 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument() else if (myEditCurrentArgument == LineEditNodes) myNbOkNodes = true; - if (myNbOkElements) { + if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { buttonOk->setEnabled(true); buttonApply->setEnabled(true); } @@ -618,17 +617,21 @@ void SMESHGUI_SmoothingDlg::SetEditCurrentArgument() myEditCurrentArgument = LineEditElements; SMESH::SetPointRepresentation(false); if (CheckBoxMesh->isChecked()) { - mySelectionMgr->setSelectionModes(ActorSelection); - mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); + // mySelectionMgr->setSelectionModes(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); } else { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(CellSelection); + aViewWindow->SetSelectionMode(FaceSelection); } - } else if (send == SelectNodesButton) { + } else if (send == SelectNodesButton) { + LineEditNodes->clear(); myEditCurrentArgument = LineEditNodes; SMESH::SetPointRepresentation(true); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) { aViewWindow->SetSelectionMode(NodeSelection); + } } myEditCurrentArgument->setFocus(); @@ -668,7 +671,7 @@ void SMESHGUI_SmoothingDlg::ActivateThisDialog() mySMESHGUI->SetActiveDialogBox(this); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(CellSelection); + aViewWindow->SetSelectionMode(FaceSelection); SelectionIntoArgument(); } @@ -722,13 +725,15 @@ void SMESHGUI_SmoothingDlg::onSelectMesh (bool toSelectMesh) SMESH::SetPointRepresentation(false); if (toSelectMesh) { - mySelectionMgr->setSelectionModes(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); + // mySelectionMgr->setSelectionModes(ActorSelection); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); LineEditElements->setReadOnly(true); LineEditElements->setValidator(0); } else { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(CellSelection); + aViewWindow->SetSelectionMode(FaceSelection); LineEditElements->setReadOnly(false); LineEditElements->setValidator(myIdValidator); onTextChange(LineEditElements->text()); diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index e8e6d89db..214cca5e0 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -231,7 +231,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index c1ba6198b..0b0a48889 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -219,7 +219,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); - buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons); buttonOk->setAutoDefault(true); buttonOk->setDefault(true); buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 3cfbaf354..62e11422d 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -230,8 +230,8 @@ namespace SMESH QObject::tr("SMESH_VISU_PROBLEM")); } catch (...) { // no more memory at all: last resort - cout<< "SMESHGUI_VTKUtils::OnVisuException(), exception even at showing a message!!!" <GetUnstructuredGrid()->GetActualMemorySize() / 1024; if ( freeMB > 0 && usedMB * 30 > freeMB ) { #ifdef _DEBUG_ - cout << "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB - << ", usedMB=" << usedMB<< endl; + MESSAGE ( "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB + << ", usedMB=" << usedMB ); #endif bool continu = false; if ( usedMB * 10 > freeMB ) @@ -451,7 +451,7 @@ namespace SMESH } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" ); #endif OnVisuException(); } @@ -469,7 +469,7 @@ namespace SMESH } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow)" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow*)" ); #endif OnVisuException(); } @@ -486,7 +486,7 @@ namespace SMESH } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow)" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow*)" ); #endif OnVisuException(); } @@ -503,7 +503,7 @@ namespace SMESH } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::FitAll()" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::FitAll()" ); #endif OnVisuException(); } @@ -609,7 +609,7 @@ namespace SMESH } catch (...) { #ifdef _DEBUG_ - cout << "Exception in SMESHGUI_VTKUtils::DisplayActor()" << endl; + MESSAGE ( "Exception in SMESHGUI_VTKUtils::DisplayActor()" ); #endif OnVisuException(); } diff --git a/src/SMESHGUI/SMESH_icons.po b/src/SMESHGUI/SMESH_icons.po deleted file mode 100644 index 42316eac3..000000000 --- a/src/SMESHGUI/SMESH_icons.po +++ /dev/null @@ -1,267 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" -# would be translated to "Pub", not "Foo::Pub". -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - - -#----------------------------------------------------------- -# Divers Mesh -#----------------------------------------------------------- - -#ObjectBrowser Icon -msgid "ICON_OBJBROWSER_SMESH" -msgstr "mesh.png" - -#Select Icon -msgid "ICON_SELECT" -msgstr "select1.png" - -#Mesh Init -msgid "ICON_DLG_INIT_MESH" -msgstr "mesh_init.png" - -# -msgid "ICON_DLG_ADD_SUBMESH" -msgstr "mesh_add_sub.png" - -#Move Node -msgid "ICON_DLG_MOVE_NODE" -msgstr "mesh_move_node.png" - -#Remove Node -msgid "ICON_DLG_REM_NODE" -msgstr "mesh_rem_node.png" - -#Remove Element -msgid "ICON_DLG_REM_ELEMENT" -msgstr "mesh_rem_element.png" - -#Orientation -msgid "ICON_DLG_MESH_ORIENTATION" -msgstr "mesh_orientation.png" - -# -msgid "ICON_DLG_MESH_DIAGONAL" -msgstr "mesh_diagonal.png" - -#Connectivity -msgid "ICON_DLG_CONNECTIVITY" -msgstr "mesh_connectivity.png" - -#Smoothing -msgid "ICON_DLG_SMOOTHING" -msgstr "mesh_smoothing.png" - -#Renumbering nodes -msgid "ICON_DLG_RENUMBERING_NODES" -msgstr "mesh_renumbering_nodes.png" - -#Renumbering elements -msgid "ICON_DLG_RENUMBERING_ELEMENTS" -msgstr "mesh_renumbering_elements.png" - -#Rotation -msgid "ICON_DLG_MESH_ROTATION" -msgstr "mesh_rotation.png" - -#Translation by vector -msgid "ICON_SMESH_TRANSLATION_VECTOR" -msgstr "mesh_translation_vector.png" - -#Translation by two points -msgid "ICON_SMESH_TRANSLATION_POINTS" -msgstr "mesh_translation_points.png" - -#Symmetry by point -msgid "ICON_SMESH_SYMMETRY_POINT" -msgstr "mesh_symmetry_point.png" - -#Symmetry by axis -msgid "ICON_SMESH_SYMMETRY_AXIS" -msgstr "mesh_symmetry_axis.png" - -#Symmetry by plane -msgid "ICON_SMESH_SYMMETRY_PLANE" -msgstr "mesh_symmetry_plane.png" - -#Sew free borders -msgid "ICON_SMESH_SEWING_FREEBORDERS" -msgstr "mesh_sew_freeborders.png" - -#Sew conform free borders -msgid "ICON_SMESH_SEWING_CONFORM_FREEBORDERS" -msgstr "mesh_sew_conform_freeborders.png" - -#Sew border to side -msgid "ICON_SMESH_SEWING_BORDERTOSIDE" -msgstr "mesh_sew_bordertoside.png" - -#Sew side elements -msgid "ICON_SMESH_SEWING_SIDEELEMENTS" -msgstr "mesh_sew_sideelements.png" - -#Merge nodes -msgid "ICON_SMESH_MERGE_NODES" -msgstr "mesh_merge_nodes.png" - -#----------------------------------------------------------- -# Hypothesis -#----------------------------------------------------------- - -#Set Algo -msgid "ICON_DLG_ADD_ALGORITHM" -msgstr "mesh_set_algo.png" - -#Set Hypo -msgid "ICON_DLG_ADD_HYPOTHESIS" -msgstr "mesh_set_hypo.png" - -#Edit Hypo. -msgid "ICON_DLG_EDIT_MESH" -msgstr "mesh_edit.png" - - -#----------------------------------------------------------- -# Elements -#----------------------------------------------------------- - -#Vertex -msgid "ICON_DLG_NODE" -msgstr "mesh_vertex.png" - -#Line -msgid "ICON_DLG_EDGE" -msgstr "mesh_line.png" - -#triangle -msgid "ICON_DLG_TRIANGLE" -msgstr "mesh_triangle.png" - -#Quadrangle -msgid "ICON_DLG_QUADRANGLE" -msgstr "mesh_quad.png" - -#triangle -msgid "ICON_DLG_TETRAS" -msgstr "mesh_tetra.png" - -#Quadrangle -msgid "ICON_DLG_HEXAS" -msgstr "mesh_hexa.png" - -#Quadratic Edge -msgid "ICON_DLG_QUADRATIC_EDGE" -msgstr "mesh_quad_edge.png" - -#Quadratic Triangle -msgid "ICON_DLG_QUADRATIC_TRIANGLE" -msgstr "mesh_quad_triangle.png" - -#Quadratic Quadrangle -msgid "ICON_DLG_QUADRATIC_QUADRANGLE" -msgstr "mesh_quad_quadrangle.png" - -#Quadratic Tetrahedron -msgid "ICON_DLG_QUADRATIC_TETRAHEDRON" -msgstr "mesh_quad_tetrahedron.png" - -#Quadratic Pyramid -msgid "ICON_DLG_QUADRATIC_PYRAMID" -msgstr "mesh_quad_pyramid.png" - -#Quadratic Pentahedron -msgid "ICON_DLG_QUADRATIC_PENTAHEDRON" -msgstr "mesh_quad_pentahedron.png" - -#Quadratic Hexahedron -msgid "ICON_DLG_QUADRATIC_HEXAHEDRON" -msgstr "mesh_quad_hexahedron.png" -#----------------------------------------------------------- -# ObjectBrowser -#----------------------------------------------------------- - -#mesh_tree_mesh -msgid "ICON_SMESH_TREE_MESH" -msgstr "mesh_tree_mesh.png" - -#mesh_tree_group -msgid "ICON_SMESH_TREE_GROUP" -msgstr "mesh_tree_group.png" - -#mesh_tree_algo -msgid "ICON_SMESH_TREE_ALGO" -msgstr "mesh_tree_algo.png" - -#mesh_tree_hypo -msgid "ICON_SMESH_TREE_HYPO" -msgstr "mesh_tree_hypo.png" - -#mesh_tree_mesh_warn -msgid "ICON_SMESH_TREE_MESH_WARN" -msgstr "mesh_tree_mesh_warn.png" - -#mesh_tree_mesh -msgid "ICON_SMESH_TREE_MESH_IMPORTED" -msgstr "mesh_tree_importedmesh.png" - - -#----------------------------------------------------------- -# Group -#----------------------------------------------------------- - -msgid "ICON_EDIT_GROUP" -msgstr "mesh_edit_group.png" - -msgid "ICON_CONSTRUCT_GROUP" -msgstr "mesh_make_group.png" - -#----------------------------------------------------------- -# Mesh pattern -#----------------------------------------------------------- - -msgid "ICON_PATTERN_2d" -msgstr "mesh_algo_mefisto.png" - -msgid "ICON_PATTERN_3d" -msgstr "mesh_algo_hexa.png" - -msgid "ICON_PATTERN_SAMPLE_2D" -msgstr "pattern_sample_2d.png" - -msgid "ICON_PATTERN_SAMPLE_3D" -msgstr "pattern_sample_3D.png" - -#----------------------------------------------------------- -# Add/Remove buttons -#----------------------------------------------------------- - -msgid "ICON_APPEND" -msgstr "mesh_add.png" - -msgid "ICON_REMOVE" -msgstr "mesh_remove.png" \ No newline at end of file diff --git a/src/SMESHGUI/SMESH_icons.ts b/src/SMESHGUI/SMESH_icons.ts deleted file mode 100644 index 3da8c468a..000000000 --- a/src/SMESHGUI/SMESH_icons.ts +++ /dev/null @@ -1,214 +0,0 @@ - - - - @default - - ICON_APPEND - mesh_add.png - - - ICON_CREATE_GROUP - mesh_group.png - - - ICON_CONSTRUCT_GROUP - mesh_make_group.png - - - ICON_DLG_ADD_SUBMESH - mesh_add_sub.png - - - ICON_DLG_EDGE - mesh_line.png - - - ICON_DLG_EDIT_MESH - mesh_edit.png - - - ICON_DLG_HEXAS - mesh_hexa.png - - - ICON_DLG_INIT_MESH - mesh_init.png - - - ICON_DLG_MESH_DIAGONAL - mesh_diagonal.png - - - ICON_DLG_MESH_ORIENTATION - mesh_orientation.png - - - ICON_DLG_MESH_ROTATION - mesh_rotation.png - - - ICON_DLG_MOVE_NODE - mesh_move_node.png - - - ICON_DLG_NODE - mesh_vertex.png - - - ICON_DLG_QUADRANGLE - mesh_quad.png - - - ICON_DLG_QUADRATIC_EDGE - mesh_quad_edge.png - - - ICON_DLG_QUADRATIC_HEXAHEDRON - mesh_quad_hexahedron.png - - - ICON_DLG_QUADRATIC_PENTAHEDRON - mesh_quad_pentahedron.png - - - ICON_DLG_QUADRATIC_PYRAMID - mesh_quad_pyramid.png - - - ICON_DLG_QUADRATIC_QUADRANGLE - mesh_quad_quadrangle.png - - - ICON_DLG_QUADRATIC_TETRAHEDRON - mesh_quad_tetrahedron.png - - - ICON_DLG_QUADRATIC_TRIANGLE - mesh_quad_triangle.png - - - ICON_DLG_REM_ELEMENT - mesh_rem_element.png - - - ICON_DLG_REM_NODE - mesh_rem_node.png - - - ICON_DLG_RENUMBERING_ELEMENTS - mesh_renumbering_elements.png - - - ICON_DLG_RENUMBERING_NODES - mesh_renumbering_nodes.png - - - ICON_DLG_SMOOTHING - mesh_smoothing.png - - - ICON_DLG_TETRAS - mesh_tetra.png - - - ICON_DLG_TRIANGLE - mesh_triangle.png - - - ICON_EDIT_GROUP - mesh_edit_group.png - - - ICON_OBJBROWSER_SMESH - mesh.png - - - ICON_PATTERN_2d - mesh_algo_mefisto.png - - - ICON_PATTERN_3d - mesh_algo_hexa.png - - - ICON_PATTERN_SAMPLE_2D - pattern_sample_2d.png - - - ICON_PATTERN_SAMPLE_3D - pattern_sample_3D.png - - - ICON_REMOVE - mesh_remove.png - - - ICON_SELECT - select1.png - - - ICON_SMESH_MERGE_NODES - mesh_merge_nodes.png - - - ICON_SMESH_SEWING_BORDERTOSIDE - mesh_sew_bordertoside.png - - - ICON_SMESH_SEWING_CONFORM_FREEBORDERS - mesh_sew_conform_freeborders.png - - - ICON_SMESH_SEWING_FREEBORDERS - mesh_sew_freeborders.png - - - ICON_SMESH_SEWING_SIDEELEMENTS - mesh_sew_sideelements.png - - - ICON_SMESH_SYMMETRY_AXIS - mesh_symmetry_axis.png - - - ICON_SMESH_SYMMETRY_PLANE - mesh_symmetry_plane.png - - - ICON_SMESH_SYMMETRY_POINT - mesh_symmetry_point.png - - - ICON_SMESH_TRANSLATION_POINTS - mesh_translation_points.png - - - ICON_SMESH_TRANSLATION_VECTOR - mesh_translation_vector.png - - - ICON_SMESH_TREE_ALGO - mesh_tree_algo.png - - - ICON_SMESH_TREE_GROUP - mesh_tree_group.png - - - ICON_SMESH_TREE_HYPO - mesh_tree_hypo.png - - - ICON_SMESH_TREE_MESH - mesh_tree_mesh.png - - - ICON_SMESH_TREE_MESH_IMPORTED - mesh_tree_importedmesh.png - - - ICON_SMESH_TREE_MESH_WARN - mesh_tree_mesh_warn.png - - - diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 5bdc07c0d..37a420137 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -394,5 +394,9 @@ ICON_WIRE mesh_wireframe.png + + ICON_CLEAR_MESH + mesh_clear.png + diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 80b0c6106..6c8904091 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -845,6 +845,10 @@ Please enter correct values and try again SMESH_BUT_OK &Ok + + SMESH_BUT_APPLY_AND_CLOSE + A&pply and Close + SMESH_BUT_REMOVE &Remove @@ -950,8 +954,7 @@ so that the application may crash. Do you wish to continue visualization? SMESH_DRS_2 - MED file has overlapped ranges of element numbers, - the numbers from the file are ignored + MED file has overlapped ranges of element numbers, the numbers from the file are ignored SMESH_DRS_3 @@ -959,13 +962,11 @@ so that the application may crash. Do you wish to continue visualization? SMESH_DRS_4 - The file is incorrect, -some information will be missed + The file is incorrect, some data is missed SMESH_DRS_EMPTY - The file is empty, -there is nothing to be published + The file is empty, there is nothing to be published SMESH_DX @@ -1160,6 +1161,10 @@ Are you sure want to export to MED 2.1 ? SMESH_HYP_12 Geomerty mismatches algorithm's expectation + + SMESH_HYP_13 + Algorithm can't work without shape + SMESH_HYP_2 There are concurrent hypotheses on a shape @@ -2731,6 +2736,42 @@ Consider saving your work before application crash MEN_FILE_INFO MED file information + + SMESH_WRN_NO_APPROPRIATE_SELECTION + No appropriate objects selected + + + MEN_CLEAR_MESH + Clear Mesh Data + + + TOP_CLEAR_MESH + Clear Mesh Data + + + STB_CLEAR_MESH + Clear Mesh Data + + + SMESH_IMPORT_MESH + Import mesh data from files + + + SMESH_ERR_NOT_SUPPORTED_FORMAT + Unsupported file format + + + SMESH_ERR_UNKNOWN_IMPORT_ERROR + Unknown error + + + SMESH_IMPORT_ERRORS + Import operation has finished with errors: + + + SMESH_DRS_SOME_EMPTY + One or more mesh files were empty, data has not been published + SMESHGUI @@ -2991,6 +3032,10 @@ Please, create VTK viewer and try again SHOW_SHAPE Show SubShape + + SHOW_BAD_MESH + Show bad Mesh + SMESHGUI_ConvToQuadDlg diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index c9d70e0bf..a24d8dcbe 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -136,7 +136,7 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript, // finish conversion theGen->Flush(); #ifdef DUMP_CONVERSION - cout << endl << " ######## RESULT ######## " << endl<< endl; + MESSAGE_BEGIN ( std::endl << " ######## RESULT ######## " << std::endl<< std::endl ); #endif // reorder commands after conversion list< Handle(_pyCommand) >::iterator cmd; @@ -153,7 +153,7 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript, for ( cmd = theGen->GetCommands().begin(); cmd != theGen->GetCommands().end(); ++cmd ) { #ifdef DUMP_CONVERSION - cout << "## COM " << (*cmd)->GetOrderNb() << ": "<< (*cmd)->GetString() << endl; + MESSAGE_ADD ( "## COM " << (*cmd)->GetOrderNb() << ": "<< (*cmd)->GetString() << std::endl ); #endif if ( !(*cmd)->IsEmpty() ) { aScript += "\n"; @@ -208,7 +208,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand Handle(_pyCommand) aCommand = myCommands.back(); #ifdef DUMP_CONVERSION - cout << "## COM " << myNbCommands << ": "<< aCommand->GetString() << endl; + MESSAGE ( "## COM " << myNbCommands << ": "<< aCommand->GetString() ); #endif _pyID objID = aCommand->GetObject(); @@ -753,7 +753,8 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) "GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes", "GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces", "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor", - "" }; // <- mark of end + "Clear" + ,"" }; // <- mark of end sameMethods.Insert( names ); } @@ -887,11 +888,10 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) "SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes", "GetLastCreatedElems", "MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh", - "TranslateObjectMakeMesh","RotateMakeMesh","RotateObjectMakeMesh", - "" }; // <- mark of the end + "TranslateObjectMakeMesh","RotateMakeMesh","RotateObjectMakeMesh" + ,"" }; // <- mark of the end sameMethods.Insert( names ); } - //theGen->AddMeshAccessorMethod( theCommand ); // for *Object() if ( sameMethods.Contains( theCommand->GetMethod() )) { theCommand->SetObject( myMesh ); @@ -903,6 +903,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) } else { // editor creation command is needed only if any editor function is called + theGen->AddMeshAccessorMethod( theCommand ); // for *Object() if ( !myCreationCmdStr.IsEmpty() ) { GetCreationCmd()->GetString() = myCreationCmdStr; myCreationCmdStr.Clear(); diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index bfb52b218..f03eef26d 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -2060,13 +2060,13 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria TPythonDump pd; pd << "aCriterion = SMESH.Filter.Criterion(" << aCriterion << "," << aCompare << "," << aThreshold << ",'" << aThresholdStr; - if (strlen(aThresholdID) > 0) - pd << "',salome.ObjectToID(" << aThresholdID - << ")," << aUnary << "," << aBinary << "," << aTolerance - << "," << aTypeOfElem << "," << aPrecision << ")"; + if (aThresholdID) + pd << "',salome.ObjectToID(" << aThresholdID + << ")," << aUnary << "," << aBinary << "," << aTolerance + << "," << aTypeOfElem << "," << aPrecision << ")"; else - pd << "',''," << aUnary << "," << aBinary << "," << aTolerance - << "," << aTypeOfElem << "," << aPrecision << ")"; + pd << "',''," << aUnary << "," << aBinary << "," << aTolerance + << "," << aTypeOfElem << "," << aPrecision << ")"; } SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil(); diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index a27316fa3..d3fd318f5 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -97,6 +97,7 @@ #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_Filter) +#include CORBA_SERVER_HEADER(SMESH_MeshEditor) #include "DriverMED_W_SMESHDS_Mesh.h" #include "DriverMED_R_SMESHDS_Mesh.h" @@ -1069,9 +1070,10 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr errStruct.subShapeID = sm->GetId(); SALOMEDS::SObject_var algoSO = GetAlgoSO( error->myAlgo ); if ( !algoSO->_is_nil() ) - errStruct.algoName = algoSO->GetName(); + errStruct.algoName = algoSO->GetName(); else - errStruct.algoName = error->myAlgo->GetName(); + errStruct.algoName = error->myAlgo->GetName(); + errStruct.hasBadMesh = !error->myBadElements.empty(); } } error_array->length( nbErr ); @@ -1084,12 +1086,98 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr return error_array._retn(); } +// +//================================================================================ +/*! + * \brief Return mesh elements preventing computation of a subshape + */ +//================================================================================ + +SMESH::MeshPreviewStruct* +SMESH_Gen_i::GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh, + CORBA::Short theSubShapeID ) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetBadInputElements()" ); + + if ( CORBA::is_nil( theMesh ) ) + THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference",SALOME::BAD_PARAM ); + + SMESH::MeshPreviewStruct_var result = new SMESH::MeshPreviewStruct; + try { + // mesh servant + if ( SMESH_Mesh_i* meshServant = SMESH::DownCast( theMesh )) + { + // mesh implementation + ::SMESH_Mesh& mesh = meshServant->GetImpl(); + // submesh by subshape id + if ( SMESH_subMesh * sm = mesh.GetSubMeshContaining( theSubShapeID )) + { + // compute error + SMESH_ComputeErrorPtr error = sm->GetComputeError(); + if ( error && !error->myBadElements.empty()) + { + typedef map TNode2LocalIDMap; + typedef TNode2LocalIDMap::iterator TNodeLocalID; + + // get nodes of elements and count elements + TNode2LocalIDMap mapNode2LocalID; + list< TNodeLocalID > connectivity; + int i, nbElements = 0, nbConnNodes = 0; + + list::iterator elemIt = error->myBadElements.begin(); + list::iterator elemEnd = error->myBadElements.end(); + for ( ; elemIt != elemEnd; ++elemIt, ++nbElements ) + { + SMDS_ElemIteratorPtr nIt = (*elemIt)->nodesIterator(); + while ( nIt->more() ) + connectivity.push_back + ( mapNode2LocalID.insert( make_pair( nIt->next(), ++nbConnNodes)).first ); + } + // fill node coords and assign local ids to the nodes + int nbNodes = mapNode2LocalID.size(); + result->nodesXYZ.length( nbNodes ); + TNodeLocalID node2ID = mapNode2LocalID.begin(); + for ( i = 0; i < nbNodes; ++i, ++node2ID ) { + node2ID->second = i; + const SMDS_MeshNode* node = (const SMDS_MeshNode*) node2ID->first; + result->nodesXYZ[i].x = node->X(); + result->nodesXYZ[i].y = node->Y(); + result->nodesXYZ[i].z = node->Z(); + } + // fill connectivity + result->elementConnectivities.length( nbConnNodes ); + list< TNodeLocalID >::iterator connIt = connectivity.begin(); + for ( i = 0; i < nbConnNodes; ++i, ++connIt ) { + result->elementConnectivities[i] = (*connIt)->second; + } + // fill element types + result->elementTypes.length( nbElements ); + for ( i = 0, elemIt = error->myBadElements.begin(); i elementTypes[i].SMDS_ElementType = (SMESH::ElementType) elem->GetType(); + result->elementTypes[i].isPoly = elem->IsPoly(); + result->elementTypes[i].nbNodesInElement = elem->NbNodes(); + } + } + } + } + } + catch ( SALOME_Exception& S_ex ) { + INFOS( "catch exception "<< S_ex.what() ); + } + + return result._retn(); +} + //================================================================================ /*! * \brief Returns errors of hypotheses definintion - * \param theMesh - the mesh - * \param theSubObject - the main or sub- shape - * \retval SMESH::algo_error_array* - sequence of errors + * \param theMesh - the mesh + * \param theSubObject - the main or sub- shape + * \retval SMESH::algo_error_array* - sequence of errors */ //================================================================================ diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index f8d43bb9b..ae64c1175 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -243,6 +243,11 @@ public: GEOM::GEOM_Object_ptr theSubObject ) throw ( SALOME::SALOME_Exception ); + // Return mesh elements preventing computation of a subshape + SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh, + CORBA::Short theSubShapeID ) + throw ( SALOME::SALOME_Exception ); + // Get sub-shapes unique ID's list SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject, const SMESH::object_array& theListOfSubShape ) diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index 515de4218..3d87ad4f6 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -714,6 +714,10 @@ SALOMEDS::SObject_ptr // Add New Hypothesis string aPmName = isAlgo ? "ICON_SMESH_TREE_ALGO_" : "ICON_SMESH_TREE_HYPO_"; aPmName += theHyp->GetName(); + // prepend plugin name to pixmap name + string pluginName = myHypCreatorMap[string(theHyp->GetName())]->GetModuleName(); + if ( pluginName != "StdMeshers" ) + aPmName = pluginName + "::" + aPmName; aHypSO = publish( theStudy, theHyp, aRootSO, 0, aPmName.c_str() ); } diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx index 9f4c705f3..35276984d 100644 --- a/src/SMESH_I/SMESH_Group_i.cxx +++ b/src/SMESH_I/SMESH_Group_i.cxx @@ -61,14 +61,14 @@ SMESH_Group_i::SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theM : SALOME::GenericObj_i( thePOA ), SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID ) { - MESSAGE("SMESH_Group_i; this = "< #include #include +#include #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -175,7 +176,7 @@ CORBA::Boolean SMESH_Mesh_i::HasShapeToMesh() //======================================================================= GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh() - throw (SALOME::SALOME_Exception) + throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Object_var aShapeObj; @@ -190,6 +191,24 @@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh() return aShapeObj._retn(); } +//================================================================================ +/*! + * \brief Remove all nodes and elements + */ +//================================================================================ + +void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception) +{ + Unexpect aCatch(SALOME_SalomeException); + try { + _impl->Clear(); + } + catch(SALOME_Exception & S_ex) { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + TPythonDump() << _this() << ".Clear()"; +} + //============================================================================= /*! * @@ -240,9 +259,26 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName ) THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM); } - myFile = theFileName; CreateGroupServants(); + int major, minor, release; + if( !MED::getMEDVersion( theFileName, major, minor, release ) ) + major = minor = release = -1; + myFileInfo = new SALOME_MED::MedFileInfo(); + myFileInfo->fileName = theFileName; + myFileInfo->fileSize = 0; +#ifdef WIN32 + struct _stati64 d; + if ( ::_stati64( theFileName, &d ) != -1 ) +#else + struct stat64 d; + if ( ::stat64( theFileName, &d ) != -1 ) +#endif + myFileInfo->fileSize = d.st_size; + myFileInfo->major = major; + myFileInfo->minor = minor; + myFileInfo->release = release; + return ConvertDriverMEDReadStatus(status); } @@ -336,6 +372,7 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::ConvertHypothesisStatus RETURNCASE( HYP_BAD_DIM ); RETURNCASE( HYP_BAD_SUBSHAPE ); RETURNCASE( HYP_BAD_GEOMETRY ); + RETURNCASE( HYP_NEED_SHAPE ); default:; } return SMESH::HYP_UNKNOWN_FATAL; @@ -725,7 +762,7 @@ void SMESH_Mesh_i::RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup ) TPythonDump() << _this() << ".RemoveGroup( " << aGroupSO << " )"; // Remove group's SObject - aStudy->NewBuilder()->RemoveObject( aGroupSO ); + aStudy->NewBuilder()->RemoveObjectWithChildren( aGroupSO ); } } @@ -1438,7 +1475,7 @@ CORBA::Boolean SMESH_Mesh_i::HasDuplicatedGroupNamesMED() return _impl->HasDuplicatedGroupNamesMED(); } -static void PrepareForWriting (const char* file) +void SMESH_Mesh_i::PrepareForWriting (const char* file) { TCollection_AsciiString aFullName ((char*)file); OSD_Path aPath (aFullName); @@ -2009,7 +2046,8 @@ SMESH::ElementType SMESH_Mesh_i::GetSubMeshElementType(const CORBA::Long ShapeID CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() { CORBA::LongLong pointeur = CORBA::LongLong(_impl); - cerr << "CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() " << pointeur << endl; + if ( MYDEBUG ) + MESSAGE("CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() "<& groupIDs) const * \brief Return information about imported file */ //============================================================================= + SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo() { - SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo(); - - const char* name = myFile.c_str(); - res->fileName = name; - res->fileSize = 0;//myFileInfo.size(); - int major, minor, release; - if( !MED::getMEDVersion( name, major, minor, release ) ) - { - major = -1; - minor = -1; - release = -1; + SALOME_MED::MedFileInfo_var res( myFileInfo ); + if ( !res.operator->() ) { + res = new SALOME_MED::MedFileInfo; + res->fileName = ""; + res->fileSize = res->major = res->minor = res->release = -1; } - res->major = major; - res->minor = minor; - res->release = release; return res._retn(); } diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index c4d4a7277..6d0f5e47f 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -74,6 +74,9 @@ public: GEOM::GEOM_Object_ptr GetShapeToMesh() throw (SALOME::SALOME_Exception); + void Clear() + throw (SALOME::SALOME_Exception); + SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject, SMESH::SMESH_Hypothesis_ptr anHyp) throw (SALOME::SALOME_Exception); @@ -310,6 +313,8 @@ public: static SMESH::Hypothesis_Status ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus); + static void PrepareForWriting (const char* file); + //int importMEDFile( const char* theFileName, const char* theMeshName ); SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject ); @@ -454,7 +459,7 @@ private: std::map _mapSubMeshIor; std::map _mapGroups; std::map _mapHypo; - string myFile; + SALOME_MED::MedFileInfo_var myFileInfo; }; #endif diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index a5560ba04..9b77ceaa5 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -26,18 +26,71 @@ \brief Module smesh """ -## \package smeshDC -# To get started, please look at smeshDC::smeshDC documentation for general services of smesh package. -# You can find the smeshDC::smeshDC documentation also by the first -# item in the Data Structures list on this page. -# See also the list of Data Structures and the list of Functions -# for other classes and methods of smesh python interface. - +## @defgroup l1_auxiliary Auxiliary methods and structures +## @defgroup l1_creating Creating meshes +## @{ +## @defgroup l2_impexp Importing and exporting meshes +## @defgroup l2_construct Constructing meshes +## @defgroup l2_algorithms Defining Algorithms +## @{ +## @defgroup l3_algos_basic Basic meshing algorithms +## @defgroup l3_algos_proj Projection Algorithms +## @defgroup l3_algos_radialp Radial Prism +## @defgroup l3_algos_segmarv Segments around Vertex +## @defgroup l3_algos_3dextr 3D extrusion meshing algorithm + +## @} +## @defgroup l2_hypotheses Defining hypotheses +## @{ +## @defgroup l3_hypos_1dhyps 1D Meshing Hypotheses +## @defgroup l3_hypos_2dhyps 2D Meshing Hypotheses +## @defgroup l3_hypos_maxvol Max Element Volume hypothesis +## @defgroup l3_hypos_netgen Netgen 2D and 3D hypotheses +## @defgroup l3_hypos_ghs3dh GHS3D Parameters hypothesis +## @defgroup l3_hypos_blsurf BLSURF Parameters hypothesis +## @defgroup l3_hypos_hexotic Hexotic Parameters hypothesis +## @defgroup l3_hypos_additi Additional Hypotheses + +## @} +## @defgroup l2_submeshes Constructing submeshes +## @defgroup l2_compounds Building Compounds +## @defgroup l2_editing Editing Meshes + +## @} +## @defgroup l1_meshinfo Mesh Information +## @defgroup l1_controls Quality controls and Filtering +## @defgroup l1_grouping Grouping elements +## @{ +## @defgroup l2_grps_create Creating groups +## @defgroup l2_grps_edit Editing groups +## @defgroup l2_grps_operon Using operations on groups +## @defgroup l2_grps_delete Deleting Groups + +## @} +## @defgroup l1_modifying Modifying meshes +## @{ +## @defgroup l2_modif_add Adding nodes and elements +## @defgroup l2_modif_del Removing nodes and elements +## @defgroup l2_modif_edit Modifying nodes and elements +## @defgroup l2_modif_renumber Renumbering nodes and elements +## @defgroup l2_modif_trsf Transforming meshes (Translation, Rotation, Symmetry, Sewing, Merging) +## @defgroup l2_modif_movenode Moving nodes +## @defgroup l2_modif_throughp Mesh through point +## @defgroup l2_modif_invdiag Diagonal inversion of elements +## @defgroup l2_modif_unitetri Uniting triangles +## @defgroup l2_modif_changori Changing orientation of elements +## @defgroup l2_modif_cutquadr Cutting quadrangles +## @defgroup l2_modif_smooth Smoothing +## @defgroup l2_modif_extrurev Extrusion and Revolution +## @defgroup l2_modif_patterns Pattern mapping +## @defgroup l2_modif_tofromqu Convert to/from Quadratic Mesh + +## @} import salome import geompyDC -import SMESH # necessary for back compatibility +import SMESH # This is necessary for back compatibility from SMESH import * import StdMeshers @@ -52,7 +105,10 @@ except ImportError: noNETGENPlugin = 1 pass -# Types of algo +## @addtogroup l1_auxiliary +## @{ + +# Types of algorithms REGULAR = 1 PYTHON = 2 COMPOSITE = 3 @@ -78,13 +134,22 @@ PLANE = SMESH_MeshEditor.PLANE LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH -# Fineness enumeration(for NETGEN) +# Fineness enumeration (for NETGEN) VeryCoarse = 0 -Coarse = 1 -Moderate = 2 -Fine = 3 -VeryFine = 4 -Custom = 5 +Coarse = 1 +Moderate = 2 +Fine = 3 +VeryFine = 4 +Custom = 5 + +# Optimization level of GHS3D +None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3 + +# Topology treatment way of BLSURF +FromCAD, PreProcess, PreProcessPlus = 0,1,2 + +# Element size flag of BLSURF +DefaultSize, DefaultGeom, Custom = 0,0,1 PrecisionConfusion = 1e-07 @@ -105,7 +170,7 @@ def GetName(obj): attr = sobj.FindAttribute("AttributeName")[1] return attr.Value() -## Sets name to object +## Sets a name to the object def SetName(obj, name): ior = salome.orb.object_to_string(obj) sobj = salome.myStudy.FindObjectIOR(ior) @@ -113,7 +178,7 @@ def SetName(obj, name): attr = sobj.FindAttribute("AttributeName")[1] attr.SetValue(name) -## Print error message if a hypothesis was not assigned. +## Prints error message if a hypothesis was not assigned. def TreatHypoStatus(status, hypName, geomName, isAlgo): if isAlgo: hypType = "algorithm" @@ -123,23 +188,25 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo): if status == HYP_UNKNOWN_FATAL : reason = "for unknown reason" elif status == HYP_INCOMPATIBLE : - reason = "this hypothesis mismatches algorithm" + reason = "this hypothesis mismatches the algorithm" elif status == HYP_NOTCONFORM : - reason = "not conform mesh would be built" + reason = "a non-conform mesh would be built" elif status == HYP_ALREADY_EXIST : - reason = hypType + " of the same dimension already assigned to this shape" + reason = hypType + " of the same dimension is already assigned to this shape" elif status == HYP_BAD_DIM : - reason = hypType + " mismatches shape" + reason = hypType + " mismatches the shape" elif status == HYP_CONCURENT : reason = "there are concurrent hypotheses on sub-shapes" elif status == HYP_BAD_SUBSHAPE : - reason = "shape is neither the main one, nor its subshape, nor a valid group" + reason = "the shape is neither the main one, nor its subshape, nor a valid group" elif status == HYP_BAD_GEOMETRY: - reason = "geometry mismatches algorithm's expectation" + reason = "geometry mismatches the expectation of the algorithm" elif status == HYP_HIDDEN_ALGO: - reason = "it is hidden by an algorithm of upper dimension generating all-dimensions elements" + reason = "it is hidden by an algorithm of an upper dimension, which generates elements of all dimensions" elif status == HYP_HIDING_ALGO: - reason = "it hides algorithm(s) of lower dimension by generating all-dimensions elements" + reason = "it hides algorithms of lower dimensions by generating elements of all dimensions" + elif status == HYP_NEED_SHAPE: + reason = "Algorithm can't work without shape" else: return hypName = '"' + hypName + '"' @@ -150,48 +217,51 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo): print hypName, "was not assigned to",geomName,":", reason pass -## Convert angle in degrees to radians +## Converts an angle from degrees to radians def DegreesToRadians(AngleInDegrees): from math import pi return AngleInDegrees * pi / 180.0 -## Methods of package smesh.py: general services of MESH component. -# -# This class has been designed to provide general services of the MESH component. -# All methods of this class are accessible directly from the smesh.py package. -# Use these methods to create an empty mesh, to import mesh from a file, -# and also to create patterns and filtering criteria. +# end of l1_auxiliary +## @} + +# All methods of this class are accessible directly from the smesh.py package. class smeshDC(SMESH._objref_SMESH_Gen): - ## To set current study and Geometry component + ## Sets the current study and Geometry component + # @ingroup l1_auxiliary def init_smesh(self,theStudy,geompyD): self.geompyD=geompyD self.SetGeomEngine(geompyD) self.SetCurrentStudy(theStudy) - ## Create an empty Mesh. This mesh can have underlying geometry. - # @param obj Geometrical object to build the mesh on. If not defined, - # the mesh will not have underlying geometry. - # @param name A name for the new mesh. - # @return instance of Mesh class. + ## Creates an empty Mesh. This mesh can have an underlying geometry. + # @param obj the Geometrical object on which the mesh is built. If not defined, + # the mesh will have no underlying geometry. + # @param name the name for the new mesh. + # @return an instance of Mesh class. + # @ingroup l2_construct def Mesh(self, obj=0, name=0): return Mesh(self,self.geompyD,obj,name) - ## Returns long value from enumeration - # To be used for SMESH.FunctorType enumeration + ## Returns a long value from enumeration + # Should be used for SMESH.FunctorType enumeration + # @ingroup l1_controls def EnumToLong(self,theItem): return theItem._v - ## Get PointStruct from vertex - # @param theVertex is GEOM object(vertex) + ## Gets PointStruct from vertex + # @param theVertex a GEOM object(vertex) # @return SMESH.PointStruct + # @ingroup l1_auxiliary def GetPointStruct(self,theVertex): [x, y, z] = self.geompyD.PointCoordinates(theVertex) return PointStruct(x,y,z) - ## Get DirStruct from vector - # @param theVector is GEOM object(vector) + ## Gets DirStruct from vector + # @param theVector a GEOM object(vector) # @return SMESH.DirStruct + # @ingroup l1_auxiliary def GetDirStruct(self,theVector): vertices = self.geompyD.SubShapeAll( theVector, geompyDC.ShapeType["VERTEX"] ) if(len(vertices) != 2): @@ -203,16 +273,18 @@ class smeshDC(SMESH._objref_SMESH_Gen): dirst = DirStruct(pnt) return dirst - ## Make DirStruct from a triplet - # @param x,y,z are vector components + ## Makes DirStruct from a triplet + # @param x,y,z vector components # @return SMESH.DirStruct + # @ingroup l1_auxiliary def MakeDirStruct(self,x,y,z): pnt = PointStruct(x,y,z) return DirStruct(pnt) ## Get AxisStruct from object - # @param theObj is GEOM object(line or plane) + # @param theObj a GEOM object (line or plane) # @return SMESH.AxisStruct + # @ingroup l1_auxiliary def GetAxisStruct(self,theObj): edges = self.geompyD.SubShapeAll( theObj, geompyDC.ShapeType["EDGE"] ) if len(edges) > 1: @@ -238,35 +310,41 @@ class smeshDC(SMESH._objref_SMESH_Gen): # From SMESH_Gen interface: # ------------------------ - ## Set the current mode + ## Sets the current mode + # @ingroup l1_auxiliary def SetEmbeddedMode( self,theMode ): #self.SetEmbeddedMode(theMode) SMESH._objref_SMESH_Gen.SetEmbeddedMode(self,theMode) - ## Get the current mode + ## Gets the current mode + # @ingroup l1_auxiliary def IsEmbeddedMode(self): #return self.IsEmbeddedMode() return SMESH._objref_SMESH_Gen.IsEmbeddedMode(self) - ## Set the current study + ## Sets the current study + # @ingroup l1_auxiliary def SetCurrentStudy( self, theStudy ): #self.SetCurrentStudy(theStudy) SMESH._objref_SMESH_Gen.SetCurrentStudy(self,theStudy) - ## Get the current study + ## Gets the current study + # @ingroup l1_auxiliary def GetCurrentStudy(self): #return self.GetCurrentStudy() return SMESH._objref_SMESH_Gen.GetCurrentStudy(self) - ## Create Mesh object importing data from given UNV file + ## Creates a Mesh object importing data from the given UNV file # @return an instance of Mesh class + # @ingroup l2_impexp def CreateMeshesFromUNV( self,theFileName ): aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromUNV(self,theFileName) aMesh = Mesh(self, self.geompyD, aSmeshMesh) return aMesh - ## Create Mesh object(s) importing data from given MED file + ## Creates a Mesh object(s) importing data from the given MED file # @return a list of Mesh class instances + # @ingroup l2_impexp def CreateMeshesFromMED( self,theFileName ): aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromMED(self,theFileName) aMeshes = [] @@ -275,20 +353,25 @@ class smeshDC(SMESH._objref_SMESH_Gen): aMeshes.append(aMesh) return aMeshes, aStatus - ## Create Mesh object importing data from given STL file + ## Creates a Mesh object importing data from the given STL file # @return an instance of Mesh class + # @ingroup l2_impexp def CreateMeshesFromSTL( self, theFileName ): aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromSTL(self,theFileName) aMesh = Mesh(self, self.geompyD, aSmeshMesh) return aMesh ## From SMESH_Gen interface - # @return list of integer values + # @return the list of integer values + # @ingroup l1_auxiliary def GetSubShapesId( self, theMainObject, theListOfSubObjects ): return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects) - ## From SMESH_Gen interface. Creates pattern - # @return an instance of SMESH_Pattern + ## From SMESH_Gen interface. Creates a pattern + # @return an instance of SMESH_Pattern + # + # Example of Patterns usage + # @ingroup l2_modif_patterns def GetPattern(self): return SMESH._objref_SMESH_Gen.GetPattern(self) @@ -298,6 +381,7 @@ class smeshDC(SMESH._objref_SMESH_Gen): ## Creates an empty criterion # @return SMESH.Filter.Criterion + # @ingroup l1_controls def GetEmptyCriterion(self): Type = self.EnumToLong(FT_Undefined) Compare = self.EnumToLong(FT_Undefined) @@ -312,15 +396,16 @@ class smeshDC(SMESH._objref_SMESH_Gen): return Filter.Criterion(Type, Compare, Threshold, ThresholdStr, ThresholdID, UnaryOp, BinaryOp, Tolerance, TypeOfElement, Precision) - ## Creates a criterion by given parameters - # @param elementType is the type of elements(NODE, EDGE, FACE, VOLUME) - # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) - # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo} - # @param Treshold is threshold value (range of ids as string, shape, numeric) - # @param UnaryOp is FT_LogicalNOT or FT_Undefined - # @param BinaryOp is binary logical operation FT_LogicalAND, FT_LogicalOR or - # FT_Undefined(must be for the last criterion in criteria) + ## Creates a criterion by the given parameters + # @param elementType the type of elements(NODE, EDGE, FACE, VOLUME) + # @param CritType the type of criterion (FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc.) + # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} + # @param Treshold the threshold value (range of ids as string, shape, numeric) + # @param UnaryOp FT_LogicalNOT or FT_Undefined + # @param BinaryOp a binary logical operation FT_LogicalAND, FT_LogicalOR or + # FT_Undefined (must be for the last criterion of all criteria) # @return SMESH.Filter.Criterion + # @ingroup l1_controls def GetCriterion(self,elementType, CritType, Compare = FT_EqualTo, @@ -347,22 +432,22 @@ class smeshDC(SMESH._objref_SMESH_Gen): if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface, FT_BelongToCylinder, FT_LyingOnGeom]: - # Check treshold + # Checks the treshold if isinstance(aTreshold, geompyDC.GEOM._objref_GEOM_Object): aCriterion.ThresholdStr = GetName(aTreshold) aCriterion.ThresholdID = salome.ObjectToID(aTreshold) else: - print "Error: Treshold should be a shape." + print "Error: The treshold should be a shape." return None elif CritType == FT_RangeOfIds: - # Check treshold + # Checks the treshold if isinstance(aTreshold, str): aCriterion.ThresholdStr = aTreshold else: - print "Error: Treshold should be a string." + print "Error: The treshold should be a string." return None elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume]: - # Here we do not need treshold + # At this point the treshold is unnecessary if aTreshold == FT_LogicalNOT: aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT) elif aTreshold in [FT_LogicalAND, FT_LogicalOR]: @@ -373,7 +458,7 @@ class smeshDC(SMESH._objref_SMESH_Gen): aTreshold = float(aTreshold) aCriterion.Threshold = aTreshold except: - print "Error: Treshold should be a number." + print "Error: The treshold should be a number." return None if Treshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT: @@ -390,13 +475,14 @@ class smeshDC(SMESH._objref_SMESH_Gen): return aCriterion - ## Creates filter by given parameters of criterion - # @param elementType is the type of elements in the group - # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) - # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo} - # @param Treshold is threshold value (range of id ids as string, shape, numeric) - # @param UnaryOp is FT_LogicalNOT or FT_Undefined + ## Creates a filter with the given parameters + # @param elementType the type of elements in the group + # @param CritType the type of criterion ( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) + # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} + # @param Treshold the threshold value (range of id ids as string, shape, numeric) + # @param UnaryOp FT_LogicalNOT or FT_Undefined # @return SMESH_Filter + # @ingroup l1_controls def GetFilter(self,elementType, CritType=FT_Undefined, Compare=FT_EqualTo, @@ -410,9 +496,10 @@ class smeshDC(SMESH._objref_SMESH_Gen): aFilter.SetCriteria(aCriteria) return aFilter - ## Creates numerical functor by its type - # @param theCrierion is FT_...; functor type + ## Creates a numerical functor by its type + # @param theCriterion FT_...; functor type # @return SMESH_NumericalFunctor + # @ingroup l1_controls def GetFunctor(self,theCriterion): aFilterMgr = self.CreateFilterManager() if theCriterion == FT_AspectRatio: @@ -442,20 +529,19 @@ class smeshDC(SMESH._objref_SMESH_Gen): else: print "Error: given parameter is not numerucal functor type." + import omniORB -#Register the new proxy for SMESH_Gen +#Registering the new proxy for SMESH_Gen omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC) # Public class: Mesh # ================== -## Class to define a mesh -# -# This class allows to define and manage a mesh. -# It has a set of methods to build a mesh on the given geometry, including definition of sub-meshes. -# Also it has methods to define groups of mesh elements, to modify a mesh (by addition of -# new nodes and elements and by changind of existing entities), to take information +## This class allows defining and managing a mesh. +# It has a set of methods to build a mesh on the given geometry, including the definition of sub-meshes. +# It also has methods to define groups of mesh elements, to modify a mesh (by addition of +# new nodes and elements and by changing the existing entities), to get information # about a mesh and to export a mesh into different formats. class Mesh: @@ -465,10 +551,13 @@ class Mesh: ## Constructor # - # Creates mesh on the shape \a obj (or the empty mesh if obj is equal to 0), - # sets GUI name of this mesh to \a name. + # Creates a mesh on the shape \a obj (or an empty mesh if \a obj is equal to 0) and + # sets the GUI name of this mesh to \a name. + # @param smeshpyD an instance of smeshDC class + # @param geompyD an instance of geompyDC class # @param obj Shape to be meshed or SMESH_Mesh object # @param name Study name of the mesh + # @ingroup l2_construct def __init__(self, smeshpyD, geompyD, obj=0, name=0): self.smeshpyD=smeshpyD self.geompyD=geompyD @@ -487,72 +576,87 @@ class Mesh: elif obj != 0: SetName(self.mesh, GetName(obj)) + if not self.geom: + self.geom = self.mesh.GetShapeToMesh() + self.editor = self.mesh.GetMeshEditor() - ## Method that inits the Mesh object from instance of SMESH_Mesh interface - # @param theMesh is SMESH_Mesh object + ## Initializes the Mesh object from an instance of SMESH_Mesh interface + # @param theMesh a SMESH_Mesh object + # @ingroup l2_construct def SetMesh(self, theMesh): self.mesh = theMesh self.geom = self.mesh.GetShapeToMesh() - ## Method that returns the mesh, that is instance of SMESH_Mesh interface - # @return SMESH_Mesh object + ## Returns the mesh, that is an instance of SMESH_Mesh interface + # @return a SMESH_Mesh object + # @ingroup l2_construct def GetMesh(self): return self.mesh - ## Get mesh name - # @return name of the mesh as a string + ## Gets the name of the mesh + # @return the name of the mesh as a string + # @ingroup l2_construct def GetName(self): name = GetName(self.GetMesh()) return name - ## Set name to mesh - # @param name a new name for the mesh + ## Sets a name to the mesh + # @param name a new name of the mesh + # @ingroup l2_construct def SetName(self, name): SetName(self.GetMesh(), name) - ## Get the subMesh object associated to \a theSubObject geometrical object. - # The subMesh object gives access to nodes and elements IDs. - # @param theSubObject A geometrical object (shape) - # @return object of type SMESH_SubMesh, representing part of mesh, which lays on the given shape - def GetSubMesh(self, theSubObject, name): - submesh = self.mesh.GetSubMesh(theSubObject, name) + ## Gets the subMesh object associated to a \a theSubObject geometrical object. + # The subMesh object gives access to the IDs of nodes and elements. + # @param theSubObject a geometrical object (shape) + # @param theName a name for the submesh + # @return an object of type SMESH_SubMesh, representing a part of mesh, which lies on the given shape + # @ingroup l2_submeshes + def GetSubMesh(self, theSubObject, theName): + submesh = self.mesh.GetSubMesh(theSubObject, theName) return submesh - ## Method that returns the shape associated to the mesh - # @return GEOM_Object + ## Returns the shape associated to the mesh + # @return a GEOM_Object + # @ingroup l2_construct def GetShape(self): return self.geom - ## Method that associates given shape to the mesh(entails the mesh recreation) - # @param geom shape to be meshed (GEOM_Object) + ## Associates the given shape to the mesh (entails the recreation of the mesh) + # @param geom the shape to be meshed (GEOM_Object) + # @ingroup l2_construct def SetShape(self, geom): self.mesh = self.smeshpyD.CreateMesh(geom) - ## Return true if hypotheses are defined well - # @param theSubObject subshape of a mesh shape + ## Returns true if the hypotheses are defined well + # @param theSubObject a subshape of a mesh shape # @return True or False + # @ingroup l2_construct def IsReadyToCompute(self, theSubObject): return self.smeshpyD.IsReadyToCompute(self.mesh, theSubObject) - ## Return errors of hypotheses definition. - # Errors list is empty if everything is OK. - # @param theSubObject subshape of a mesh shape + ## Returns errors of hypotheses definition. + # The list of errors is empty if everything is OK. + # @param theSubObject a subshape of a mesh shape # @return a list of errors + # @ingroup l2_construct def GetAlgoState(self, theSubObject): return self.smeshpyD.GetAlgoState(self.mesh, theSubObject) - ## Return geometrical object the given element is built on. + ## Returns a geometrical object on which the given element was built. # The returned geometrical object, if not nil, is either found in the - # study or is published by this method with the given name - # @param theElementID an id of the mesh element - # @param theGeomName user defined name of geometrical object + # study or published by this method with the given name + # @param theElementID the id of the mesh element + # @param theGeomName the user-defined name of the geometrical object # @return GEOM::GEOM_Object instance + # @ingroup l2_construct def GetGeometryByMeshElement(self, theElementID, theGeomName): return self.smeshpyD.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName ) - ## Returns mesh dimension depending on that of the underlying shape + ## Returns the mesh dimension depending on the dimension of the underlying shape # @return mesh dimension as an integer value [0,3] + # @ingroup l1_auxiliary def MeshDimension(self): shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] ) if len( shells ) > 0 : @@ -568,13 +672,14 @@ class Mesh: ## Creates a segment discretization 1D algorithm. # If the optional \a algo parameter is not set, this algorithm is REGULAR. # \n If the optional \a geom parameter is not set, this algorithm is global. - # Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param algo type of desired algorithm. Possible values are: + # Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param algo the type of the required algorithm. Possible values are: # - smesh.REGULAR, - # - smesh.PYTHON for discretization via python function, + # - smesh.PYTHON for discretization via a python function, # - smesh.COMPOSITE for meshing a set of edges on one face side as a whole. - # @param geom If defined, subshape to be meshed - # @return instance of Mesh_Segment or Mesh_Segment_Python, or Mesh_CompositeSegment class + # @param geom If defined is the subshape to be meshed + # @return an instance of Mesh_Segment or Mesh_Segment_Python, or Mesh_CompositeSegment class + # @ingroup l3_algos_basic def Segment(self, algo=REGULAR, geom=0): ## if Segment(geom) is called by mistake if isinstance( algo, geompyDC.GEOM._objref_GEOM_Object): @@ -590,34 +695,37 @@ class Mesh: else: return Mesh_Segment(self, geom) - ## Enable creation of nodes and segments usable by 2D algoritms. - # Added nodes and segments must be bound to edges and vertices by + ## Enables creation of nodes and segments usable by 2D algoritms. + # The added nodes and segments must be bound to edges and vertices by # SetNodeOnVertex(), SetNodeOnEdge() and SetMeshElementOnShape() - # If the optional \a geom parameter is not sets, this algorithm is global. - # \n Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom subshape to be manually meshed + # If the optional \a geom parameter is not set, this algorithm is global. + # \n Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param geom the subshape to be manually meshed # @return StdMeshers_UseExisting_1D algorithm that generates nothing + # @ingroup l3_algos_basic def UseExistingSegments(self, geom=0): algo = Mesh_UseExisting(1,self,geom) return algo.GetAlgorithm() - ## Enable creation of nodes and faces usable by 3D algoritms. - # Added nodes and faces must be bound to geom faces by SetNodeOnFace() + ## Enables creation of nodes and faces usable by 3D algoritms. + # The added nodes and faces must be bound to geom faces by SetNodeOnFace() # and SetMeshElementOnShape() - # If the optional \a geom parameter is not sets, this algorithm is global. - # \n Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom subshape to be manually meshed + # If the optional \a geom parameter is not set, this algorithm is global. + # \n Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param geom the subshape to be manually meshed # @return StdMeshers_UseExisting_2D algorithm that generates nothing + # @ingroup l3_algos_basic def UseExistingFaces(self, geom=0): algo = Mesh_UseExisting(2,self,geom) return algo.GetAlgorithm() ## Creates a triangle 2D algorithm for faces. - # If the optional \a geom parameter is not sets, this algorithm is global. - # \n Otherwise, this algorithm define a submesh based on \a geom subshape. + # If the optional \a geom parameter is not set, this algorithm is global. + # \n Otherwise, this algorithm defines a submesh based on \a geom subshape. # @param algo values are: smesh.MEFISTO || smesh.NETGEN_1D2D || smesh.NETGEN_2D || smesh.BLSURF - # @param geom If defined, subshape to be meshed (GEOM_Object) + # @param geom If defined, the subshape to be meshed (GEOM_Object) # @return an instance of Mesh_Triangle algorithm + # @ingroup l3_algos_basic def Triangle(self, algo=MEFISTO, geom=0): ## if Triangle(geom) is called by mistake if (isinstance(algo, geompyDC.GEOM._objref_GEOM_Object)): @@ -627,20 +735,22 @@ class Mesh: return Mesh_Triangle(self, algo, geom) ## Creates a quadrangle 2D algorithm for faces. - # If the optional \a geom parameter is not sets, this algorithm is global. - # \n Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom If defined, subshape to be meshed (GEOM_Object) + # If the optional \a geom parameter is not set, this algorithm is global. + # \n Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param geom If defined, the subshape to be meshed (GEOM_Object) # @return an instance of Mesh_Quadrangle algorithm + # @ingroup l3_algos_basic def Quadrangle(self, geom=0): return Mesh_Quadrangle(self, geom) ## Creates a tetrahedron 3D algorithm for solids. - # The parameter \a algo permits to choice the algorithm: NETGEN or GHS3D - # If the optional \a geom parameter is not sets, this algorithm is global. - # \n Otherwise, this algorithm define a submesh based on \a geom subshape. + # The parameter \a algo permits to choose the algorithm: NETGEN or GHS3D + # If the optional \a geom parameter is not set, this algorithm is global. + # \n Otherwise, this algorithm defines a submesh based on \a geom subshape. # @param algo values are: smesh.NETGEN, smesh.GHS3D, smesh.FULL_NETGEN - # @param geom If defined, subshape to be meshed (GEOM_Object) + # @param geom If defined, the subshape to be meshed (GEOM_Object) # @return an instance of Mesh_Tetrahedron algorithm + # @ingroup l3_algos_basic def Tetrahedron(self, algo=NETGEN, geom=0): ## if Tetrahedron(geom) is called by mistake if ( isinstance( algo, geompyDC.GEOM._objref_GEOM_Object)): @@ -650,11 +760,12 @@ class Mesh: return Mesh_Tetrahedron(self, algo, geom) ## Creates a hexahedron 3D algorithm for solids. - # If the optional \a geom parameter is not sets, this algorithm is global. - # \n Otherwise, this algorithm define a submesh based on \a geom subshape. + # If the optional \a geom parameter is not set, this algorithm is global. + # \n Otherwise, this algorithm defines a submesh based on \a geom subshape. # @param algo possible values are: smesh.Hexa, smesh.Hexotic - # @param geom If defined, subshape to be meshed (GEOM_Object) + # @param geom If defined, the subshape to be meshed (GEOM_Object) # @return an instance of Mesh_Hexahedron algorithm + # @ingroup l3_algos_basic def Hexahedron(self, algo=Hexa, geom=0): ## if Hexahedron(geom, algo) or Hexahedron(geom) is called by mistake if ( isinstance(algo, geompyDC.GEOM._objref_GEOM_Object) ): @@ -662,40 +773,45 @@ class Mesh: elif geom == 0: algo, geom = Hexa, algo return Mesh_Hexahedron(self, algo, geom) - ## Deprecated, only for compatibility! + ## Deprecated, used only for compatibility! # @return an instance of Mesh_Netgen algorithm + # @ingroup l3_algos_basic def Netgen(self, is3D, geom=0): return Mesh_Netgen(self, is3D, geom) ## Creates a projection 1D algorithm for edges. - # If the optional \a geom parameter is not sets, this algorithm is global. - # Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom If defined, subshape to be meshed + # If the optional \a geom parameter is not set, this algorithm is global. + # Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param geom If defined, the subshape to be meshed # @return an instance of Mesh_Projection1D algorithm + # @ingroup l3_algos_proj def Projection1D(self, geom=0): return Mesh_Projection1D(self, geom) ## Creates a projection 2D algorithm for faces. - # If the optional \a geom parameter is not sets, this algorithm is global. - # Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom If defined, subshape to be meshed + # If the optional \a geom parameter is not set, this algorithm is global. + # Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param geom If defined, the subshape to be meshed # @return an instance of Mesh_Projection2D algorithm + # @ingroup l3_algos_proj def Projection2D(self, geom=0): return Mesh_Projection2D(self, geom) ## Creates a projection 3D algorithm for solids. - # If the optional \a geom parameter is not sets, this algorithm is global. - # Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom If defined, subshape to be meshed + # If the optional \a geom parameter is not set, this algorithm is global. + # Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param geom If defined, the subshape to be meshed # @return an instance of Mesh_Projection3D algorithm + # @ingroup l3_algos_proj def Projection3D(self, geom=0): return Mesh_Projection3D(self, geom) ## Creates a 3D extrusion (Prism 3D) or RadialPrism 3D algorithm for solids. - # If the optional \a geom parameter is not sets, this algorithm is global. - # Otherwise, this algorithm define a submesh based on \a geom subshape. - # @param geom If defined, subshape to be meshed + # If the optional \a geom parameter is not set, this algorithm is global. + # Otherwise, this algorithm defines a submesh based on \a geom subshape. + # @param geom If defined, the subshape to be meshed # @return an instance of Mesh_Prism3D or Mesh_RadialPrism3D algorithm + # @ingroup l3_algos_radialp l3_algos_3dextr def Prism(self, geom=0): shape = geom if shape==0: @@ -706,13 +822,13 @@ class Mesh: return Mesh_Prism3D(self, geom) return Mesh_RadialPrism3D(self, geom) - ## Compute the mesh and return the status of the computation + ## Computes the mesh and returns the status of the computation # @return True or False + # @ingroup l2_construct def Compute(self, geom=0): if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object): if self.geom == 0: - print "Compute impossible: mesh is not constructed on geom shape." - return 0 + geom = self.mesh.GetShapeToMesh() else: geom = self.geom ok = False @@ -725,7 +841,7 @@ class Mesh: import traceback print "Mesh computation failed, exception caught:" traceback.print_exc() - if not ok: + if True:#not ok: errors = self.smeshpyD.GetAlgoState( self.mesh, geom ) allReasons = "" for err in errors: @@ -747,8 +863,8 @@ class Mesh: reason = ('Hypothesis of %s %sD algorithm "%s" has a bad parameter value' % ( glob, dim, name )) elif err.state == HYP_BAD_GEOMETRY: - reason = ('%s %sD algorithm "%s" is assigned to geometry mismatching' - 'its expectation' % ( glob, dim, name )) + reason = ('%s %sD algorithm "%s" is assigned to mismatching' + 'geometry' % ( glob, dim, name )) else: reason = "For unknown reason."+\ " Revise Mesh.Compute() implementation in smeshDC.py!" @@ -761,7 +877,8 @@ class Mesh: if allReasons != "": print '"' + GetName(self.mesh) + '"',"has not been computed:" print allReasons - else: + ok = False + elif not ok: print '"' + GetName(self.mesh) + '"',"has not been computed." pass pass @@ -773,9 +890,20 @@ class Mesh: pass return ok - ## Compute tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN - # The parameter \a fineness [0,-1] defines mesh fineness + ## Removes all nodes and elements + # @ingroup l2_construct + def Clear(self): + self.mesh.Clear() + if salome.sg.hasDesktop(): + smeshgui = salome.ImportComponentGUI("SMESH") + smeshgui.Init(salome.myStudyId) + smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True ) + salome.sg.updateObjBrowser(1) + + ## Computes a tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN + # @param fineness [0,-1] defines mesh fineness # @return True or False + # @ingroup l3_algos_basic def AutomaticTetrahedralization(self, fineness=0): dim = self.MeshDimension() # assign hypotheses @@ -789,12 +917,13 @@ class Mesh: pass return self.Compute() - ## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron - # The parameter \a fineness [0,-1] defines mesh fineness + ## Computes an hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron + # @param fineness [0,-1] defines mesh fineness # @return True or False + # @ingroup l3_algos_basic def AutomaticHexahedralization(self, fineness=0): dim = self.MeshDimension() - # assign hypotheses + # assign the hypotheses self.RemoveGlobalHypotheses() self.Segment().AutomaticLength(fineness) if dim > 1 : @@ -805,26 +934,30 @@ class Mesh: pass return self.Compute() - ## Assign hypothesis - # @param hyp is a hypothesis to assign - # @param geom is subhape of mesh geometry + ## Assigns a hypothesis + # @param hyp a hypothesis to assign + # @param geom a subhape of mesh geometry # @return SMESH.Hypothesis_Status + # @ingroup l2_hypotheses def AddHypothesis(self, hyp, geom=0): if isinstance( hyp, Mesh_Algorithm ): hyp = hyp.GetAlgorithm() pass if not geom: geom = self.geom + if not geom: + geom = self.mesh.GetShapeToMesh() pass status = self.mesh.AddHypothesis(geom, hyp) isAlgo = hyp._narrow( SMESH_Algo ) TreatHypoStatus( status, GetName( hyp ), GetName( geom ), isAlgo ) return status - ## Unassign hypothesis - # @param hyp is a hypothesis to unassign - # @param geom is subhape of mesh geometry + ## Unassigns a hypothesis + # @param hyp a hypothesis to unassign + # @param geom a subshape of mesh geometry # @return SMESH.Hypothesis_Status + # @ingroup l2_hypotheses def RemoveHypothesis(self, hyp, geom=0): if isinstance( hyp, Mesh_Algorithm ): hyp = hyp.GetAlgorithm() @@ -835,13 +968,15 @@ class Mesh: status = self.mesh.RemoveHypothesis(geom, hyp) return status - ## Get the list of hypothesis added on a geom - # @param geom is subhape of mesh geometry - # @return sequence of SMESH_Hypothesis + ## Gets the list of hypotheses added on a geometry + # @param geom a subshape of mesh geometry + # @return the sequence of SMESH_Hypothesis + # @ingroup l2_hypotheses def GetHypothesisList(self, geom): return self.mesh.GetHypothesisList( geom ) ## Removes all global hypotheses + # @ingroup l2_hypotheses def RemoveGlobalHypotheses(self): current_hyps = self.mesh.GetHypothesisList( self.geom ) for hyp in current_hyps: @@ -849,45 +984,51 @@ class Mesh: pass pass - ## Create a mesh group based on geometric object \a grp - # and give a \a name, \n if this parameter is not defined + ## Creates a mesh group based on the geometric object \a grp + # and gives a \a name, \n if this parameter is not defined # the name is the same as the geometric group name \n # Note: Works like GroupOnGeom(). - # @param grp is a geometric group, a vertex, an edge, a face or a solid - # @param name is the name of the mesh group + # @param grp a geometric group, a vertex, an edge, a face or a solid + # @param name the name of the mesh group # @return SMESH_GroupOnGeom + # @ingroup l2_grps_create def Group(self, grp, name=""): return self.GroupOnGeom(grp, name) - ## Deprecated, only for compatibility! Please, use ExportMED() method instead. - # Export the mesh in a file with the MED format and choice the \a version of MED format - # @param f is the file name + ## Deprecated, used only for compatibility! Please, use ExportMED() method instead. + # Exports the mesh in a file in MED format and chooses the \a version of MED format + # @param f the file name # @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2 + # @ingroup l2_impexp def ExportToMED(self, f, version, opt=0): self.mesh.ExportToMED(f, opt, version) - ## Export the mesh in a file with the MED format + ## Exports the mesh in a file in MED format # @param f is the file name # @param auto_groups boolean parameter for creating/not creating # the groups Group_On_All_Nodes, Group_On_All_Faces, ... ; # the typical use is auto_groups=false. # @param version MED format version(MED_V2_1 or MED_V2_2) + # @ingroup l2_impexp def ExportMED(self, f, auto_groups=0, version=MED_V2_2): self.mesh.ExportToMED(f, auto_groups, version) - ## Export the mesh in a file with the DAT format - # @param f is the file name + ## Exports the mesh in a file in DAT format + # @param f the file name + # @ingroup l2_impexp def ExportDAT(self, f): self.mesh.ExportDAT(f) - ## Export the mesh in a file with the UNV format - # @param f is the file name + ## Exports the mesh in a file in UNV format + # @param f the file name + # @ingroup l2_impexp def ExportUNV(self, f): self.mesh.ExportUNV(f) - ## Export the mesh in a file with the STL format - # @param f is the file name - # @param ascii defined the kind of file contents + ## Export the mesh in a file in STL format + # @param f the file name + # @param ascii defines the file encoding + # @ingroup l2_impexp def ExportSTL(self, f, ascii=1): self.mesh.ExportSTL(f, ascii) @@ -896,18 +1037,22 @@ class Mesh: # ---------------------- ## Creates an empty mesh group - # @param elementType is the type of elements in the group - # @param name is the name of the mesh group + # @param elementType the type of elements in the group + # @param name the name of the mesh group # @return SMESH_Group + # @ingroup l2_grps_create def CreateEmptyGroup(self, elementType, name): return self.mesh.CreateGroup(elementType, name) - ## Creates a mesh group based on geometric object \a grp - # and give a \a name, \n if this parameter is not defined - # the name is the same as the geometric group name - # @param grp is a geometric group, a vertex, an edge, a face or a solid - # @param name is the name of the mesh group + ## Creates a mesh group based on the geometrical object \a grp + # and gives a \a name, \n if this parameter is not defined + # the name is the same as the geometrical group name + # @param grp a geometrical group, a vertex, an edge, a face or a solid + # @param name the name of the mesh group + # @param typ the type of elements in the group. If not set, it is + # automatically detected by the type of the geometry # @return SMESH_GroupOnGeom + # @ingroup l2_grps_create def GroupOnGeom(self, grp, name="", typ=None): if name == "": name = grp.GetName() @@ -944,24 +1089,26 @@ class Mesh: else: return self.mesh.CreateGroupFromGEOM(typ, name, grp) - ## Create a mesh group by the given ids of elements - # @param groupName is the name of the mesh group - # @param elementType is the type of elements in the group - # @param elemIDs is the list of ids + ## Creates a mesh group by the given ids of elements + # @param groupName the name of the mesh group + # @param elementType the type of elements in the group + # @param elemIDs the list of ids # @return SMESH_Group + # @ingroup l2_grps_create def MakeGroupByIds(self, groupName, elementType, elemIDs): group = self.mesh.CreateGroup(elementType, groupName) group.Add(elemIDs) return group - ## Create a mesh group by the given conditions - # @param groupName is the name of the mesh group - # @param elementType is the type of elements in the group - # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) - # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo} - # @param Treshold is threshold value (range of id ids as string, shape, numeric) - # @param UnaryOp is FT_LogicalNOT or FT_Undefined + ## Creates a mesh group by the given conditions + # @param groupName the name of the mesh group + # @param elementType the type of elements in the group + # @param CritType the type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) + # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} + # @param Treshold the threshold value (range of id ids as string, shape, numeric) + # @param UnaryOp FT_LogicalNOT or FT_Undefined # @return SMESH_Group + # @ingroup l2_grps_create def MakeGroup(self, groupName, elementType, @@ -973,10 +1120,11 @@ class Mesh: group = self.MakeGroupByCriterion(groupName, aCriterion) return group - ## Create a mesh group by the given criterion - # @param groupName is the name of the mesh group - # @param Criterion is the instance of Criterion class + ## Creates a mesh group by the given criterion + # @param groupName the name of the mesh group + # @param Criterion the instance of Criterion class # @return SMESH_Group + # @ingroup l2_grps_create def MakeGroupByCriterion(self, groupName, Criterion): aFilterMgr = self.smeshpyD.CreateFilterManager() aFilter = aFilterMgr.CreateFilter() @@ -986,10 +1134,11 @@ class Mesh: group = self.MakeGroupByFilter(groupName, aFilter) return group - ## Create a mesh group by the given criteria(list of criterions) - # @param groupName is the name of the mesh group - # @param Criteria is the list of criterions + ## Creates a mesh group by the given criteria (list of criteria) + # @param groupName the name of the mesh group + # @param theCriteria the list of criteria # @return SMESH_Group + # @ingroup l2_grps_create def MakeGroupByCriteria(self, groupName, theCriteria): aFilterMgr = self.smeshpyD.CreateFilterManager() aFilter = aFilterMgr.CreateFilter() @@ -997,25 +1146,28 @@ class Mesh: group = self.MakeGroupByFilter(groupName, aFilter) return group - ## Create a mesh group by the given filter - # @param groupName is the name of the mesh group - # @param Criterion is the instance of Filter class + ## Creates a mesh group by the given filter + # @param groupName the name of the mesh group + # @param theFilter the instance of Filter class # @return SMESH_Group + # @ingroup l2_grps_create def MakeGroupByFilter(self, groupName, theFilter): anIds = theFilter.GetElementsId(self.mesh) anElemType = theFilter.GetElementType() group = self.MakeGroupByIds(groupName, anElemType, anIds) return group - ## Pass mesh elements through the given filter and return ids - # @param theFilter is SMESH_Filter - # @return list of ids + ## Passes mesh elements through the given filter and return IDs of fitting elements + # @param theFilter SMESH_Filter + # @return a list of ids + # @ingroup l1_controls def GetIdsFromFilter(self, theFilter): return theFilter.GetElementsId(self.mesh) - ## Verify whether 2D mesh element has free edges(edges connected to one face only)\n - # Returns list of special structures(borders). - # @return list of SMESH.FreeEdges.Border structure: edge id and two its nodes ids. + ## Verifies whether a 2D mesh element has free edges (edges connected to one face only)\n + # Returns a list of special structures (borders). + # @return a list of SMESH.FreeEdges.Border structure: edge id and ids of two its nodes. + # @ingroup l1_controls def GetFreeBorders(self): aFilterMgr = self.smeshpyD.CreateFilterManager() aPredicate = aFilterMgr.CreateFreeEdges() @@ -1023,26 +1175,31 @@ class Mesh: aBorders = aPredicate.GetBorders() return aBorders - ## Remove a group + ## Removes a group + # @ingroup l2_grps_delete def RemoveGroup(self, group): self.mesh.RemoveGroup(group) - ## Remove group with its contents + ## Removes a group with its contents + # @ingroup l2_grps_delete def RemoveGroupWithContents(self, group): self.mesh.RemoveGroupWithContents(group) - ## Get the list of groups existing in the mesh - # @return sequence of SMESH_GroupBase + ## Gets the list of groups existing in the mesh + # @return a sequence of SMESH_GroupBase + # @ingroup l2_grps_create def GetGroups(self): return self.mesh.GetGroups() - ## Get number of groups existing in the mesh - # @return quantity of groups as an integer value + ## Gets the number of groups existing in the mesh + # @return the quantity of groups as an integer value + # @ingroup l2_grps_create def NbGroups(self): return self.mesh.NbGroups() - ## Get the list of names of groups existing in the mesh + ## Gets the list of names of groups existing in the mesh # @return list of strings + # @ingroup l2_grps_create def GetGroupNames(self): groups = self.GetGroups() names = [] @@ -1050,24 +1207,27 @@ class Mesh: names.append(group.GetName()) return names - ## Union of two groups - # New group is created. All mesh elements that are - # present in initial groups are added to the new one + ## Produces a union of two groups + # A new group is created. All mesh elements that are + # present in the initial groups are added to the new one # @return an instance of SMESH_Group + # @ingroup l2_grps_operon def UnionGroups(self, group1, group2, name): return self.mesh.UnionGroups(group1, group2, name) - ## Intersection of two groups - # New group is created. All mesh elements that are - # present in both initial groups are added to the new one. + ## Prodices an intersection of two groups + # A new group is created. All mesh elements that are common + # for the two initial groups are added to the new one. # @return an instance of SMESH_Group + # @ingroup l2_grps_operon def IntersectGroups(self, group1, group2, name): return self.mesh.IntersectGroups(group1, group2, name) - ## Cut of two groups - # New group is created. All mesh elements that are present in - # main group but do not present in tool group are added to the new one + ## Produces a cut of two groups + # A new group is created. All mesh elements that are present in + # the main group but are not present in the tool group are added to the new one # @return an instance of SMESH_Group + # @ingroup l2_grps_operon def CutGroups(self, mainGroup, toolGroup, name): return self.mesh.CutGroups(mainGroup, toolGroup, name) @@ -1075,55 +1235,64 @@ class Mesh: # Get some info about mesh: # ------------------------ - ## Get the log of nodes and elements added or removed since previous - # clear of the log. + ## Returns the log of nodes and elements added or removed + # since the previous clear of the log. # @param clearAfterGet log is emptied after Get (safe if concurrents access) # @return list of log_block structures: # commandType # number # coords # indexes + # @ingroup l1_auxiliary def GetLog(self, clearAfterGet): return self.mesh.GetLog(clearAfterGet) - ## Clear the log of nodes and elements added or removed since previous + ## Clears the log of nodes and elements added or removed since the previous # clear. Must be used immediately after GetLog if clearAfterGet is false. + # @ingroup l1_auxiliary def ClearLog(self): self.mesh.ClearLog() - ## Toggle auto color mode on the object. - # @param theAutoColor flag which toggles auto color mode. + ## Toggles auto color mode on the object. + # @param theAutoColor the flag which toggles auto color mode. + # @ingroup l1_auxiliary def SetAutoColor(self, theAutoColor): self.mesh.SetAutoColor(theAutoColor) - ## Get flag of object auto color mode. + ## Gets flag of object auto color mode. # @return True or False + # @ingroup l1_auxiliary def GetAutoColor(self): return self.mesh.GetAutoColor() - ## Get the internal Id + ## Gets the internal ID # @return integer value, which is the internal Id of the mesh + # @ingroup l1_auxiliary def GetId(self): return self.mesh.GetId() ## Get the study Id # @return integer value, which is the study Id of the mesh + # @ingroup l1_auxiliary def GetStudyId(self): return self.mesh.GetStudyId() - ## Check group names for duplications. - # Consider maximum group name length stored in MED file. + ## Checks the group names for duplications. + # Consider the maximum group name length stored in MED file. # @return True or False + # @ingroup l1_auxiliary def HasDuplicatedGroupNamesMED(self): return self.mesh.HasDuplicatedGroupNamesMED() - ## Obtain mesh editor tool + ## Obtains the mesh editor tool # @return an instance of SMESH_MeshEditor + # @ingroup l1_modifying def GetMeshEditor(self): return self.mesh.GetMeshEditor() - ## Get MED Mesh + ## Gets MED Mesh # @return an instance of SALOME_MED::MESH + # @ingroup l1_auxiliary def GetMEDMesh(self): return self.mesh.GetMEDMesh() @@ -1131,167 +1300,195 @@ class Mesh: # Get informations about mesh contents: # ------------------------------------ - ## Returns number of nodes in mesh + ## Returns the number of nodes in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbNodes(self): return self.mesh.NbNodes() - ## Returns number of elements in mesh + ## Returns the number of elements in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbElements(self): return self.mesh.NbElements() - ## Returns number of edges in mesh + ## Returns the number of edges in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbEdges(self): return self.mesh.NbEdges() - ## Returns number of edges with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of edges with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbEdgesOfOrder(self, elementOrder): return self.mesh.NbEdgesOfOrder(elementOrder) - ## Returns number of faces in mesh + ## Returns the number of faces in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbFaces(self): return self.mesh.NbFaces() - ## Returns number of faces with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of faces with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbFacesOfOrder(self, elementOrder): return self.mesh.NbFacesOfOrder(elementOrder) - ## Returns number of triangles in mesh + ## Returns the number of triangles in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbTriangles(self): return self.mesh.NbTriangles() - ## Returns number of triangles with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of triangles with the given order in the mesh + # @param elementOrder is the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbTrianglesOfOrder(self, elementOrder): return self.mesh.NbTrianglesOfOrder(elementOrder) - ## Returns number of quadrangles in mesh + ## Returns the number of quadrangles in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbQuadrangles(self): return self.mesh.NbQuadrangles() - ## Returns number of quadrangles with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of quadrangles with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbQuadranglesOfOrder(self, elementOrder): return self.mesh.NbQuadranglesOfOrder(elementOrder) - ## Returns number of polygons in mesh + ## Returns the number of polygons in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbPolygons(self): return self.mesh.NbPolygons() - ## Returns number of volumes in mesh + ## Returns the number of volumes in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbVolumes(self): return self.mesh.NbVolumes() - ## Returns number of volumes with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of volumes with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbVolumesOfOrder(self, elementOrder): return self.mesh.NbVolumesOfOrder(elementOrder) - ## Returns number of tetrahedrons in mesh + ## Returns the number of tetrahedrons in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbTetras(self): return self.mesh.NbTetras() - ## Returns number of tetrahedrons with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of tetrahedrons with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbTetrasOfOrder(self, elementOrder): return self.mesh.NbTetrasOfOrder(elementOrder) - ## Returns number of hexahedrons in mesh + ## Returns the number of hexahedrons in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbHexas(self): return self.mesh.NbHexas() - ## Returns number of hexahedrons with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of hexahedrons with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbHexasOfOrder(self, elementOrder): return self.mesh.NbHexasOfOrder(elementOrder) - ## Returns number of pyramids in mesh + ## Returns the number of pyramids in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbPyramids(self): return self.mesh.NbPyramids() - ## Returns number of pyramids with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of pyramids with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbPyramidsOfOrder(self, elementOrder): return self.mesh.NbPyramidsOfOrder(elementOrder) - ## Returns number of prisms in mesh + ## Returns the number of prisms in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbPrisms(self): return self.mesh.NbPrisms() - ## Returns number of prisms with given order in mesh - # @param elementOrder is order of elements: + ## Returns the number of prisms with the given order in the mesh + # @param elementOrder the order of elements: # ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC # @return an integer value + # @ingroup l1_meshinfo def NbPrismsOfOrder(self, elementOrder): return self.mesh.NbPrismsOfOrder(elementOrder) - ## Returns number of polyhedrons in mesh + ## Returns the number of polyhedrons in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbPolyhedrons(self): return self.mesh.NbPolyhedrons() - ## Returns number of submeshes in mesh + ## Returns the number of submeshes in the mesh # @return an integer value + # @ingroup l1_meshinfo def NbSubMesh(self): return self.mesh.NbSubMesh() - ## Returns list of mesh elements ids - # @return list of integer values + ## Returns the list of mesh elements IDs + # @return the list of integer values + # @ingroup l1_meshinfo def GetElementsId(self): return self.mesh.GetElementsId() - ## Returns list of ids of mesh elements with given type - # @param elementType is required type of elements + ## Returns the list of IDs of mesh elements with the given type + # @param elementType the required type of elements # @return list of integer values + # @ingroup l1_meshinfo def GetElementsByType(self, elementType): return self.mesh.GetElementsByType(elementType) - ## Returns list of mesh nodes ids - # @return list of integer values + ## Returns the list of mesh nodes IDs + # @return the list of integer values + # @ingroup l1_meshinfo def GetNodesId(self): return self.mesh.GetNodesId() - # Get informations about mesh elements: + # Get the information about mesh elements: # ------------------------------------ - ## Returns type of mesh element - # @return value from SMESH::ElementType enumeration + ## Returns the type of mesh element + # @return the value from SMESH::ElementType enumeration + # @ingroup l1_meshinfo def GetElementType(self, id, iselem): return self.mesh.GetElementType(id, iselem) - ## Returns list of submesh elements ids - # @param Shape is geom object(subshape) IOR - # Shape must be subshape of a ShapeToMesh() - # @return list of integer values + ## Returns the list of submesh elements IDs + # @param Shape a geom object(subshape) IOR + # Shape must be the subshape of a ShapeToMesh() + # @return the list of integer values + # @ingroup l1_meshinfo def GetSubMeshElementsId(self, Shape): if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] @@ -1299,10 +1496,12 @@ class Mesh: ShapeID = Shape return self.mesh.GetSubMeshElementsId(ShapeID) - ## Returns list of submesh nodes ids - # @param Shape is geom object(subshape) IOR - # Shape must be subshape of a ShapeToMesh() - # @return list of integer values + ## Returns the list of submesh nodes IDs + # @param Shape a geom object(subshape) IOR + # Shape must be the subshape of a ShapeToMesh() + # @param all If true, gives all nodes of submesh elements, otherwise gives only submesh nodes + # @return the list of integer values + # @ingroup l1_meshinfo def GetSubMeshNodesId(self, Shape, all): if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] @@ -1310,10 +1509,11 @@ class Mesh: ShapeID = Shape return self.mesh.GetSubMeshNodesId(ShapeID, all) - ## Returns list of ids of submesh elements with given type - # @param Shape is geom object(subshape) IOR - # Shape must be subshape of a ShapeToMesh() - # @return list of integer values + ## Returns the list of IDs of submesh elements with the given type + # @param Shape a geom object(subshape) IOR + # Shape must be a subshape of a ShapeToMesh() + # @return the list of integer values + # @ingroup l1_meshinfo def GetSubMeshElementType(self, Shape): if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] @@ -1321,90 +1521,106 @@ class Mesh: ShapeID = Shape return self.mesh.GetSubMeshElementType(ShapeID) - ## Get mesh description + ## Gets the mesh description # @return string value + # @ingroup l1_meshinfo def Dump(self): return self.mesh.Dump() - # Get information about nodes and elements of mesh by its ids: + # Get the information about nodes and elements of a mesh by its IDs: # ----------------------------------------------------------- - ## Get XYZ coordinates of node - # \n If there is not node for given ID - returns empty list + ## Gets XYZ coordinates of a node + # \n If there is no nodes for the given ID - returns an empty list # @return a list of double precision values + # @ingroup l1_meshinfo def GetNodeXYZ(self, id): return self.mesh.GetNodeXYZ(id) - ## For given node returns list of IDs of inverse elements - # \n If there is not node for given ID - returns empty list - # @return list of integer values + ## Returns list of IDs of inverse elements for the given node + # \n If there is no node for the given ID - returns an empty list + # @return a list of integer values + # @ingroup l1_meshinfo def GetNodeInverseElements(self, id): return self.mesh.GetNodeInverseElements(id) - ## @brief Return position of a node on shape + ## @brief Returns the position of a node on the shape # @return SMESH::NodePosition + # @ingroup l1_meshinfo def GetNodePosition(self,NodeID): return self.mesh.GetNodePosition(NodeID) - ## If given element is node returns IDs of shape from position - # \n If there is not node for given ID - returns -1 - # @return integer value + ## If the given element is a node, returns the ID of shape + # \n If there is no node for the given ID - returns -1 + # @return an integer value + # @ingroup l1_meshinfo def GetShapeID(self, id): return self.mesh.GetShapeID(id) - ## For given element returns ID of result shape after - # FindShape() from SMESH_MeshEditor - # \n If there is not element for given ID - returns -1 - # @return integer value + ## Returns the ID of the result shape after + # FindShape() from SMESH_MeshEditor for the given element + # \n If there is no element for the given ID - returns -1 + # @return an integer value + # @ingroup l1_meshinfo def GetShapeIDForElem(self,id): return self.mesh.GetShapeIDForElem(id) - ## Returns number of nodes for given element - # \n If there is not element for given ID - returns -1 - # @return integer value + ## Returns the number of nodes for the given element + # \n If there is no element for the given ID - returns -1 + # @return an integer value + # @ingroup l1_meshinfo def GetElemNbNodes(self, id): return self.mesh.GetElemNbNodes(id) - ## Returns ID of node by given index for given element - # \n If there is not element for given ID - returns -1 - # \n If there is not node for given index - returns -2 - # @return integer value + ## Returns the node ID the given index for the given element + # \n If there is no element for the given ID - returns -1 + # \n If there is no node for the given index - returns -2 + # @return an integer value + # @ingroup l1_meshinfo def GetElemNode(self, id, index): return self.mesh.GetElemNode(id, index) - ## Returns IDs of nodes of given element - # @return list of integer values + ## Returns the IDs of nodes of the given element + # @return a list of integer values + # @ingroup l1_meshinfo def GetElemNodes(self, id): return self.mesh.GetElemNodes(id) - ## Returns true if given node is medium node in given quadratic element + ## Returns true if the given node is the medium node in the given quadratic element + # @ingroup l1_meshinfo def IsMediumNode(self, elementID, nodeID): return self.mesh.IsMediumNode(elementID, nodeID) - ## Returns true if given node is medium node in one of quadratic elements + ## Returns true if the given node is the medium node in one of quadratic elements + # @ingroup l1_meshinfo def IsMediumNodeOfAnyElem(self, nodeID, elementType): return self.mesh.IsMediumNodeOfAnyElem(nodeID, elementType) - ## Returns number of edges for given element + ## Returns the number of edges for the given element + # @ingroup l1_meshinfo def ElemNbEdges(self, id): return self.mesh.ElemNbEdges(id) - ## Returns number of faces for given element + ## Returns the number of faces for the given element + # @ingroup l1_meshinfo def ElemNbFaces(self, id): return self.mesh.ElemNbFaces(id) - ## Returns true if given element is polygon + ## Returns true if the given element is a polygon + # @ingroup l1_meshinfo def IsPoly(self, id): return self.mesh.IsPoly(id) - ## Returns true if given element is quadratic + ## Returns true if the given element is quadratic + # @ingroup l1_meshinfo def IsQuadratic(self, id): return self.mesh.IsQuadratic(id) - ## Returns XYZ coordinates of bary center for given element - # \n If there is not element for given ID - returns empty list + ## Returns XYZ coordinates of the barycenter of the given element + # \n If there is no element for the given ID - returns an empty list # @return a list of three double values + # @ingroup l1_meshinfo def BaryCenter(self, id): return self.mesh.BaryCenter(id) @@ -1412,81 +1628,91 @@ class Mesh: # Mesh edition (SMESH_MeshEditor functionality): # --------------------------------------------- - ## Removes elements from mesh by ids - # @param IDsOfElements is list of ids of elements to remove + ## Removes the elements from the mesh by ids + # @param IDsOfElements is a list of ids of elements to remove # @return True or False + # @ingroup l2_modif_del def RemoveElements(self, IDsOfElements): return self.editor.RemoveElements(IDsOfElements) ## Removes nodes from mesh by ids - # @param IDsOfNodes is list of ids of nodes to remove + # @param IDsOfNodes is a list of ids of nodes to remove # @return True or False + # @ingroup l2_modif_del def RemoveNodes(self, IDsOfNodes): return self.editor.RemoveNodes(IDsOfNodes) - ## Add node to mesh by coordinates + ## Add a node to the mesh by coordinates # @return Id of the new node + # @ingroup l2_modif_add def AddNode(self, x, y, z): return self.editor.AddNode( x, y, z) - - ## Create edge either linear or quadratic (this is determined - # by number of given nodes). - # @param IdsOfNodes List of node IDs for creation of element. - # Needed order of nodes in this list corresponds to description + ## Creates a linear or quadratic edge (this is determined + # by the number of given nodes). + # @param IDsOfNodes the list of node IDs for creation of the element. + # The order of nodes in this list should correspond to the description # of MED. \n This description is located by the following link: # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3. - # @return Id of the new edge + # @return the Id of the new edge + # @ingroup l2_modif_add def AddEdge(self, IDsOfNodes): return self.editor.AddEdge(IDsOfNodes) - ## Create face either linear or quadratic (this is determined - # by number of given nodes). - # @param IdsOfNodes List of node IDs for creation of element. - # Needed order of nodes in this list corresponds to description + ## Creates a linear or quadratic face (this is determined + # by the number of given nodes). + # @param IDsOfNodes the list of node IDs for creation of the element. + # The order of nodes in this list should correspond to the description # of MED. \n This description is located by the following link: # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3. - # @return Id of the new face + # @return the Id of the new face + # @ingroup l2_modif_add def AddFace(self, IDsOfNodes): return self.editor.AddFace(IDsOfNodes) - ## Add polygonal face to mesh by list of nodes ids - # @return Id of the new face + ## Adds a polygonal face to the mesh by the list of node IDs + # @param IdsOfNodes the list of node IDs for creation of the element. + # @return the Id of the new face + # @ingroup l2_modif_add def AddPolygonalFace(self, IdsOfNodes): return self.editor.AddPolygonalFace(IdsOfNodes) - ## Create volume both similar and quadratic (this is determed - # by number of given nodes). - # @param IdsOfNodes List of node IDs for creation of element. - # Needed order of nodes in this list corresponds to description + ## Creates both simple and quadratic volume (this is determined + # by the number of given nodes). + # @param IDsOfNodes the list of node IDs for creation of the element. + # The order of nodes in this list should correspond to the description # of MED. \n This description is located by the following link: # http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3. - # @return Id of the new volumic element + # @return the Id of the new volumic element + # @ingroup l2_modif_add def AddVolume(self, IDsOfNodes): return self.editor.AddVolume(IDsOfNodes) - ## Create volume of many faces, giving nodes for each face. - # @param IdsOfNodes List of node IDs for volume creation face by face. - # @param Quantities List of integer values, Quantities[i] - # gives quantity of nodes in face number i. - # @return Id of the new volumic element + ## Creates a volume of many faces, giving nodes for each face. + # @param IdsOfNodes the list of node IDs for volume creation face by face. + # @param Quantities the list of integer values, Quantities[i] + # gives the quantity of nodes in face number i. + # @return the Id of the new volumic element + # @ingroup l2_modif_add def AddPolyhedralVolume (self, IdsOfNodes, Quantities): return self.editor.AddPolyhedralVolume(IdsOfNodes, Quantities) - ## Create volume of many faces, giving IDs of existing faces. - # @param IdsOfFaces List of face IDs for volume creation. + ## Creates a volume of many faces, giving the IDs of the existing faces. + # @param IdsOfFaces the list of face IDs for volume creation. # - # Note: The created volume will refer only to nodes - # of the given faces, not to the faces itself. - # @return Id of the new volumic element + # Note: The created volume will refer only to the nodes + # of the given faces, not to the faces themselves. + # @return the Id of the new volumic element + # @ingroup l2_modif_add def AddPolyhedralVolumeByFaces (self, IdsOfFaces): return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces) - ## @brief Bind a node to a vertex - # @param NodeID - node ID - # @param Vertex - vertex or vertex ID - # @return True if succeed else raise an exception + ## @brief Binds a node to a vertex + # @param NodeID a node ID + # @param Vertex a vertex or vertex ID + # @return True if succeed else raises an exception + # @ingroup l2_modif_add def SetNodeOnVertex(self, NodeID, Vertex): if ( isinstance( Vertex, geompyDC.GEOM._objref_GEOM_Object)): VertexID = Vertex.GetSubShapeIndices()[0] @@ -1499,11 +1725,12 @@ class Mesh: return True - ## @brief Store node position on an edge - # @param NodeID - node ID - # @param Edge - edge or edge ID - # @param paramOnEdge - parameter on edge where the node is located - # @return True if succeed else raise an exception + ## @brief Stores the node position on an edge + # @param NodeID a node ID + # @param Edge an edge or edge ID + # @param paramOnEdge a parameter on the edge where the node is located + # @return True if succeed else raises an exception + # @ingroup l2_modif_add def SetNodeOnEdge(self, NodeID, Edge, paramOnEdge): if ( isinstance( Edge, geompyDC.GEOM._objref_GEOM_Object)): EdgeID = Edge.GetSubShapeIndices()[0] @@ -1515,12 +1742,13 @@ class Mesh: raise ValueError, inst.details.text return True - ## @brief Store node position on a face - # @param NodeID - node ID - # @param Face - face or face ID - # @param u - U parameter on face where the node is located - # @param v - V parameter on face where the node is located - # @return True if succeed else raise an exception + ## @brief Stores node position on a face + # @param NodeID a node ID + # @param Face a face or face ID + # @param u U parameter on the face where the node is located + # @param v V parameter on the face where the node is located + # @return True if succeed else raises an exception + # @ingroup l2_modif_add def SetNodeOnFace(self, NodeID, Face, u, v): if ( isinstance( Face, geompyDC.GEOM._objref_GEOM_Object)): FaceID = Face.GetSubShapeIndices()[0] @@ -1532,10 +1760,11 @@ class Mesh: raise ValueError, inst.details.text return True - ## @brief Bind a node to a solid - # @param NodeID - node ID - # @param Solid - solid or solid ID - # @return True if succeed else raise an exception + ## @brief Binds a node to a solid + # @param NodeID a node ID + # @param Solid a solid or solid ID + # @return True if succeed else raises an exception + # @ingroup l2_modif_add def SetNodeInVolume(self, NodeID, Solid): if ( isinstance( Solid, geompyDC.GEOM._objref_GEOM_Object)): SolidID = Solid.GetSubShapeIndices()[0] @@ -1548,9 +1777,10 @@ class Mesh: return True ## @brief Bind an element to a shape - # @param ElementID - element ID - # @param Shape - shape or shape ID - # @return True if succeed else raise an exception + # @param ElementID an element ID + # @param Shape a shape or shape ID + # @return True if succeed else raises an exception + # @ingroup l2_modif_add def SetMeshElementOnShape(self, ElementID, Shape): if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)): ShapeID = Shape.GetSubShapeIndices()[0] @@ -1563,131 +1793,147 @@ class Mesh: return True - ## Move node with given id - # @param NodeID id of the node - # @param x new X coordinate - # @param y new Y coordinate - # @param z new Z coordinate + ## Moves the node with the given id + # @param NodeID the id of the node + # @param x a new X coordinate + # @param y a new Y coordinate + # @param z a new Z coordinate # @return True if succeed else False + # @ingroup l2_modif_movenode def MoveNode(self, NodeID, x, y, z): return self.editor.MoveNode(NodeID, x, y, z) - ## Find a node closest to a point - # @param x X coordinate of a point - # @param y Y coordinate of a point - # @param z Z coordinate of a point - # @return id of a node + ## Finds the node closest to a point + # @param x the X coordinate of a point + # @param y the Y coordinate of a point + # @param z the Z coordinate of a point + # @return the ID of a node + # @ingroup l2_modif_throughp def FindNodeClosestTo(self, x, y, z): preview = self.mesh.GetMeshEditPreviewer() return preview.MoveClosestNodeToPoint(x, y, z, -1) - ## Find a node closest to a point and move it to a point location - # @param x X coordinate of a point - # @param y Y coordinate of a point - # @param z Z coordinate of a point - # @return id of a moved node + ## Finds the node closest to a point and moves it to a point location + # @param x the X coordinate of a point + # @param y the Y coordinate of a point + # @param z the Z coordinate of a point + # @return the ID of a moved node + # @ingroup l2_modif_throughp def MeshToPassThroughAPoint(self, x, y, z): return self.editor.MoveClosestNodeToPoint(x, y, z, -1) - ## Replace two neighbour triangles sharing Node1-Node2 link - # with ones built on the same 4 nodes but having other common link. - # @param NodeID1 first node id - # @param NodeID2 second node id - # @return false if proper faces not found + ## Replaces two neighbour triangles sharing Node1-Node2 link + # with the triangles built on the same 4 nodes but having other common link. + # @param NodeID1 the ID of the first node + # @param NodeID2 the ID of the second node + # @return false if proper faces were not found + # @ingroup l2_modif_invdiag def InverseDiag(self, NodeID1, NodeID2): return self.editor.InverseDiag(NodeID1, NodeID2) - ## Replace two neighbour triangles sharing Node1-Node2 link + ## Replaces two neighbour triangles sharing Node1-Node2 link # with a quadrangle built on the same 4 nodes. - # @param NodeID1 first node id - # @param NodeID2 second node id - # @return false if proper faces not found + # @param NodeID1 the ID of the first node + # @param NodeID2 the ID of the second node + # @return false if proper faces were not found + # @ingroup l2_modif_unitetri def DeleteDiag(self, NodeID1, NodeID2): return self.editor.DeleteDiag(NodeID1, NodeID2) - ## Reorient elements by ids - # @param IDsOfElements if undefined reorient all mesh elements + ## Reorients elements by ids + # @param IDsOfElements if undefined reorients all mesh elements # @return True if succeed else False + # @ingroup l2_modif_changori def Reorient(self, IDsOfElements=None): if IDsOfElements == None: IDsOfElements = self.GetElementsId() return self.editor.Reorient(IDsOfElements) - ## Reorient all elements of the object - # @param theObject is mesh, submesh or group + ## Reorients all elements of the object + # @param theObject mesh, submesh or group # @return True if succeed else False + # @ingroup l2_modif_changori def ReorientObject(self, theObject): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() return self.editor.ReorientObject(theObject) - ## Fuse neighbour triangles into quadrangles. + ## Fuses the neighbouring triangles into quadrangles. # @param IDsOfElements The triangles to be fused, - # @param theCriterion is FT_...; used to choose a neighbour to fuse with. - # @param MaxAngle is a max angle between element normals at which fusion + # @param theCriterion is FT_...; used to choose a neighbour to fuse with. + # @param MaxAngle is the maximum angle between element normals at which the fusion # is still performed; theMaxAngle is mesured in radians. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_unitetri def TriToQuad(self, IDsOfElements, theCriterion, MaxAngle): if IDsOfElements == []: IDsOfElements = self.GetElementsId() return self.editor.TriToQuad(IDsOfElements, self.smeshpyD.GetFunctor(theCriterion), MaxAngle) - ## Fuse neighbour triangles of the object into quadrangles + ## Fuses the neighbouring triangles of the object into quadrangles # @param theObject is mesh, submesh or group # @param theCriterion is FT_...; used to choose a neighbour to fuse with. - # @param MaxAngle is a max angle between element normals at which fusion + # @param MaxAngle a max angle between element normals at which the fusion # is still performed; theMaxAngle is mesured in radians. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_unitetri def TriToQuadObject (self, theObject, theCriterion, MaxAngle): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() return self.editor.TriToQuadObject(theObject, self.smeshpyD.GetFunctor(theCriterion), MaxAngle) - ## Split quadrangles into triangles. + ## Splits quadrangles into triangles. # @param IDsOfElements the faces to be splitted. - # @param theCriterion is FT_...; used to choose a diagonal for splitting. + # @param theCriterion FT_...; used to choose a diagonal for splitting. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_cutquadr def QuadToTri (self, IDsOfElements, theCriterion): if IDsOfElements == []: IDsOfElements = self.GetElementsId() return self.editor.QuadToTri(IDsOfElements, self.smeshpyD.GetFunctor(theCriterion)) - ## Split quadrangles into triangles. - # @param theObject object to taking list of elements from, is mesh, submesh or group - # @param theCriterion is FT_...; used to choose a diagonal for splitting. + ## Splits quadrangles into triangles. + # @param theObject the object from which the list of elements is taken, this is mesh, submesh or group + # @param theCriterion FT_...; used to choose a diagonal for splitting. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_cutquadr def QuadToTriObject (self, theObject, theCriterion): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() return self.editor.QuadToTriObject(theObject, self.smeshpyD.GetFunctor(theCriterion)) - ## Split quadrangles into triangles. - # @param theElems The faces to be splitted - # @param the13Diag is used to choose a diagonal for splitting. + ## Splits quadrangles into triangles. + # @param IDsOfElements the faces to be splitted + # @param Diag13 is used to choose a diagonal for splitting. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_cutquadr def SplitQuad (self, IDsOfElements, Diag13): if IDsOfElements == []: IDsOfElements = self.GetElementsId() return self.editor.SplitQuad(IDsOfElements, Diag13) - ## Split quadrangles into triangles. - # @param theObject is object to taking list of elements from, is mesh, submesh or group + ## Splits quadrangles into triangles. + # @param theObject the object from which the list of elements is taken, this is mesh, submesh or group + # @param Diag13 is used to choose a diagonal for splitting. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_cutquadr def SplitQuadObject (self, theObject, Diag13): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() return self.editor.SplitQuadObject(theObject, Diag13) - ## Find better splitting of the given quadrangle. - # @param IDOfQuad ID of the quadrangle to be splitted. - # @param theCriterion is FT_...; a criterion to choose a diagonal for splitting. + ## Finds a better splitting of the given quadrangle. + # @param IDOfQuad the ID of the quadrangle to be splitted. + # @param theCriterion FT_...; a criterion to choose a diagonal for splitting. # @return 1 if 1-3 diagonal is better, 2 if 2-4 # diagonal is better, 0 if error occurs. + # @ingroup l2_modif_cutquadr def BestSplit (self, IDOfQuad, theCriterion): return self.editor.BestSplit(IDOfQuad, self.smeshpyD.GetFunctor(theCriterion)) - ## Split quadrangle faces near triangular facets of volumes + ## Splits quadrangle faces near triangular facets of volumes # + # @ingroup l1_auxiliary def SplitQuadsNearTriangularFacets(self): faces_array = self.GetElementsByType(SMESH.FACE) for face_id in faces_array: @@ -1715,16 +1961,17 @@ class Mesh: isVolumeFound = True self.SplitQuad([face_id], True) # diagonal 1-3 - ## @brief Split hexahedrons into tetrahedrons. + ## @brief Splits hexahedrons into tetrahedrons. # - # Use pattern mapping functionality for splitting. - # @param theObject object to take list of hexahedrons from; is mesh, submesh or group. - # @param theNode000,theNode001 is in range [0,7]; give an orientation of the - # pattern relatively each hexahedron: the (0,0,0) key-point of pattern - # will be mapped into -th node of each volume, the (0,0,1) - # key-point will be mapped into -th node of each volume. - # The (0,0,0) key-point of used pattern corresponds to not split corner. + # This operation uses pattern mapping functionality for splitting. + # @param theObject the object from which the list of hexahedrons is taken; this is mesh, submesh or group. + # @param theNode000,theNode001 within the range [0,7]; gives the orientation of the + # pattern relatively each hexahedron: the (0,0,0) key-point of the pattern + # will be mapped into theNode000-th node of each volume, the (0,0,1) + # key-point will be mapped into theNode001-th node of each volume. + # The (0,0,0) key-point of the used pattern corresponds to a non-split corner. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l1_auxiliary def SplitHexaToTetras (self, theObject, theNode000, theNode001): # Pattern: 5.---------.6 # /|#* /| @@ -1774,14 +2021,15 @@ class Mesh: ## @brief Split hexahedrons into prisms. # - # Use pattern mapping functionality for splitting. - # @param theObject object to take list of hexahedrons from; is mesh, submesh or group. - # @param theNode000,theNode001 is in range [0,7]; give an orientation of the - # pattern relatively each hexahedron: the (0,0,0) key-point of pattern - # will be mapped into -th node of each volume, the (0,0,1) - # key-point will be mapped into -th node of each volume. - # The edge (0,0,0)-(0,0,1) of used pattern connects two not split corners. + # Uses the pattern mapping functionality for splitting. + # @param theObject the object (mesh, submesh or group) from where the list of hexahedrons is taken; + # @param theNode000,theNode001 (within the range [0,7]) gives the orientation of the + # pattern relatively each hexahedron: keypoint (0,0,0) of the pattern + # will be mapped into the theNode000-th node of each volume, keypoint (0,0,1) + # will be mapped into the theNode001-th node of each volume. + # Edge (0,0,0)-(0,0,1) of used pattern connects two not split corners. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l1_auxiliary def SplitHexaToPrisms (self, theObject, theNode000, theNode001): # Pattern: 5.---------.6 # /|# /| @@ -1820,19 +2068,20 @@ class Mesh: isDone = pattern.MakeMesh(self.mesh, False, False) if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode() - # split quafrangle faces near triangular facets of volumes + # Splits quafrangle faces near triangular facets of volumes self.SplitQuadsNearTriangularFacets() return isDone - ## Smooth elements - # @param IDsOfElements list if ids of elements to smooth - # @param IDsOfFixedNodes list of ids of fixed nodes. + ## Smoothes elements + # @param IDsOfElements the list if ids of elements to smooth + # @param IDsOfFixedNodes the list of ids of fixed nodes. # Note that nodes built on edges and boundary nodes are always fixed. - # @param MaxNbOfIterations maximum number of iterations + # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_smooth def Smooth(self, IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method): if IDsOfElements == []: @@ -1840,29 +2089,31 @@ class Mesh: return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method) - ## Smooth elements belong to given object - # @param theObject object to smooth - # @param IDsOfFixedNodes list of ids of fixed nodes. + ## Smoothes elements which belong to the given object + # @param theObject the object to smooth + # @param IDsOfFixedNodes the list of ids of fixed nodes. # Note that nodes built on edges and boundary nodes are always fixed. - # @param MaxNbOfIterations maximum number of iterations + # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_smooth def SmoothObject(self, theObject, IDsOfFixedNodes, - MaxNbOfIterations, MaxxAspectRatio, Method): + MaxNbOfIterations, MaxAspectRatio, Method): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() return self.editor.SmoothObject(theObject, IDsOfFixedNodes, - MaxNbOfIterations, MaxxAspectRatio, Method) + MaxNbOfIterations, MaxAspectRatio, Method) - ## Parametric smooth the given elements - # @param IDsOfElements list if ids of elements to smooth - # @param IDsOfFixedNodes list of ids of fixed nodes. + ## Parametrically smoothes the given elements + # @param IDsOfElements the list if ids of elements to smooth + # @param IDsOfFixedNodes the list of ids of fixed nodes. # Note that nodes built on edges and boundary nodes are always fixed. - # @param MaxNbOfIterations maximum number of iterations + # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_smooth def SmoothParametric(self, IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method): if IDsOfElements == []: @@ -1870,14 +2121,15 @@ class Mesh: return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method) - ## Parametric smooth elements belong to given object - # @param theObject object to smooth - # @param IDsOfFixedNodes list of ids of fixed nodes. + ## Parametrically smoothes the elements which belong to the given object + # @param theObject the object to smooth + # @param IDsOfFixedNodes the list of ids of fixed nodes. # Note that nodes built on edges and boundary nodes are always fixed. - # @param MaxNbOfIterations maximum number of iterations + # @param MaxNbOfIterations the maximum number of iterations # @param MaxAspectRatio varies in range [1.0, inf] - # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) + # @param Method Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH) # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_smooth def SmoothParametricObject(self, theObject, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method): if ( isinstance( theObject, Mesh )): @@ -1885,80 +2137,87 @@ class Mesh: return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method) - ## Converts all mesh to quadratic one, deletes old elements, replacing - # them with quadratic ones with the same id. + ## Converts the mesh to quadratic, deletes old elements, replacing + # them with quadratic with the same id. + # @ingroup l2_modif_tofromqu def ConvertToQuadratic(self, theForce3d): self.editor.ConvertToQuadratic(theForce3d) - ## Converts all mesh from quadratic to ordinary ones, + ## Converts the mesh from quadratic to ordinary, # deletes old quadratic elements, \n replacing # them with ordinary mesh elements with the same id. # @return TRUE in case of success, FALSE otherwise. + # @ingroup l2_modif_tofromqu def ConvertFromQuadratic(self): return self.editor.ConvertFromQuadratic() ## Renumber mesh nodes + # @ingroup l2_modif_renumber def RenumberNodes(self): self.editor.RenumberNodes() ## Renumber mesh elements + # @ingroup l2_modif_renumber def RenumberElements(self): self.editor.RenumberElements() - ## Generate new elements by rotation of the elements around the axis - # @param IDsOfElements list of ids of elements to sweep - # @param Axix axis of rotation, AxisStruct or line(geom object) - # @param AngleInRadians angle of Rotation - # @param NbOfSteps number of steps + ## Generates new elements by rotation of the elements around the axis + # @param IDsOfElements the list of ids of elements to sweep + # @param Axis the axis of rotation, AxisStruct or line(geom object) + # @param AngleInRadians the angle of Rotation + # @param NbOfSteps the number of steps # @param Tolerance tolerance - # @param MakeGroups to generate new groups from existing ones - # @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size - # of all steps, else - size of each step - # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise - def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance, + # @param MakeGroups forces the generation of new groups from existing ones + # @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size + # of all steps, else - size of each step + # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_extrurev + def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False, TotalAngle=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() - if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)): - Axix = self.smeshpyD.GetAxisStruct(Axix) + if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + Axis = self.smeshpyD.GetAxisStruct(Axis) if TotalAngle and NbOfSteps: AngleInRadians /= NbOfSteps if MakeGroups: - return self.editor.RotationSweepMakeGroups(IDsOfElements, Axix, + return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance) - self.editor.RotationSweep(IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance) + self.editor.RotationSweep(IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance) return [] - ## Generate new elements by rotation of the elements of object around the axis - # @param theObject object wich elements should be sweeped - # @param Axix axis of rotation, AxisStruct or line(geom object) - # @param AngleInRadians angle of Rotation + ## Generates new elements by rotation of the elements of object around the axis + # @param theObject object which elements should be sweeped + # @param Axis the axis of rotation, AxisStruct or line(geom object) + # @param AngleInRadians the angle of Rotation # @param NbOfSteps number of steps # @param Tolerance tolerance - # @param MakeGroups to generate new groups from existing ones - # @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size - # of all steps, else - size of each step - # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise - def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance, + # @param MakeGroups forces the generation of new groups from existing ones + # @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size + # of all steps, else - size of each step + # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_extrurev + def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False, TotalAngle=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() - if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)): - Axix = self.smeshpyD.GetAxisStruct(Axix) + if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)): + Axis = self.smeshpyD.GetAxisStruct(Axis) if TotalAngle and NbOfSteps: AngleInRadians /= NbOfSteps if MakeGroups: - return self.editor.RotationSweepObjectMakeGroups(theObject, Axix, AngleInRadians, + return self.editor.RotationSweepObjectMakeGroups(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance) - self.editor.RotationSweepObject(theObject, Axix, AngleInRadians, NbOfSteps, Tolerance) + self.editor.RotationSweepObject(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance) return [] - ## Generate new elements by extrusion of the elements with given ids - # @param IDsOfElements list of elements ids for extrusion + ## Generates new elements by extrusion of the elements with given ids + # @param IDsOfElements the list of elements ids for extrusion # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps - # @param MakeGroups to generate new groups from existing ones - # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @param MakeGroups forces the generation of new groups from existing ones + # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_extrurev def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -1969,16 +2228,18 @@ class Mesh: self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps) return [] - ## Generate new elements by extrusion of the elements with given ids + ## Generates new elements by extrusion of the elements with given ids # @param IDsOfElements is ids of elements # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps - # @param ExtrFlags set flags for performing extrusion + # @param ExtrFlags sets flags for extrusion # @param SewTolerance uses for comparing locations of nodes if flag # EXTRUSION_FLAG_SEW is set - # @param MakeGroups to generate new groups from existing ones + # @param MakeGroups forces the generation of new groups from existing ones # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise - def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance, MakeGroups=False): + # @ingroup l2_modif_extrurev + def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, + ExtrFlags, SewTolerance, MakeGroups=False): if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)): StepVector = self.smeshpyD.GetDirStruct(StepVector) if MakeGroups: @@ -1988,12 +2249,13 @@ class Mesh: ExtrFlags, SewTolerance) return [] - ## Generate new elements by extrusion of the elements belong to object - # @param theObject object wich elements should be processed + ## Generates new elements by extrusion of the elements which belong to the object + # @param theObject the object which elements should be processed # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps - # @param MakeGroups to generate new groups from existing ones + # @param MakeGroups forces the generation of new groups from existing ones # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_extrurev def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2004,12 +2266,13 @@ class Mesh: self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps) return [] - ## Generate new elements by extrusion of the elements belong to object - # @param theObject object wich elements should be processed + ## Generates new elements by extrusion of the elements which belong to the object + # @param theObject object which elements should be processed # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps # @param MakeGroups to generate new groups from existing ones # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_extrurev def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2020,12 +2283,13 @@ class Mesh: self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps) return [] - ## Generate new elements by extrusion of the elements belong to object - # @param theObject object wich elements should be processed + ## Generates new elements by extrusion of the elements which belong to the object + # @param theObject object which elements should be processed # @param StepVector vector, defining the direction and value of extrusion # @param NbOfSteps the number of steps - # @param MakeGroups to generate new groups from existing ones + # @param MakeGroups forces the generation of new groups from existing ones # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_extrurev def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2036,21 +2300,24 @@ class Mesh: self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps) return [] - ## Generate new elements by extrusion of the given elements - # A path of extrusion must be a meshed edge. - # @param IDsOfElements is ids of elements + ## Generates new elements by extrusion of the given elements + # The path of extrusion must be a meshed edge. + # @param IDsOfElements ids of elements # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion - # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path - # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion - # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion + # @param PathShape shape(edge) defines the sub-mesh for the path + # @param NodeStart the first or the last node on the edge. Defines the direction of extrusion + # @param HasAngles allows the shape to be rotated around the path + # to get the resulting mesh in a helical fashion # @param Angles list of angles - # @param HasRefPoint allows to use base point - # @param RefPoint point around which the shape is rotated(the mass center of the shape by default). - # User can specify any point as the Base Point and the shape will be rotated with respect to this point. - # @param MakeGroups to generate new groups from existing ones - # @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps + # @param HasRefPoint allows using the reference point + # @param RefPoint the point around which the shape is rotated (the mass center of the shape by default). + # The User can specify any point as the Reference Point. + # @param MakeGroups forces the generation of new groups from existing ones + # @param LinearVariation forces the computation of rotation angles as linear + # variation of the given Angles along path steps # @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True, # only SMESH::Extrusion_Error otherwise + # @ingroup l2_modif_extrurev def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint, MakeGroups=False, LinearVariation=False): @@ -2071,21 +2338,24 @@ class Mesh: return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint) - ## Generate new elements by extrusion of the elements belong to object - # A path of extrusion must be a meshed edge. - # @param IDsOfElements is ids of elements - # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion - # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path - # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion - # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion + ## Generates new elements by extrusion of the elements which belong to the object + # The path of extrusion must be a meshed edge. + # @param theObject the object which elements should be processed + # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds + # @param PathShape shape(edge) defines the sub-mesh for the path + # @param NodeStart the first or the last node on the edge. Defines the direction of extrusion + # @param HasAngles allows the shape to be rotated around the path + # to get the resulting mesh in a helical fashion # @param Angles list of angles - # @param HasRefPoint allows to use base point - # @param RefPoint point around which the shape is rotated(the mass center of the shape by default). - # User can specify any point as the Base Point and the shape will be rotated with respect to this point. - # @param MakeGroups to generate new groups from existing ones - # @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps + # @param HasRefPoint allows using the reference point + # @param RefPoint the point around which the shape is rotated (the mass center of the shape by default). + # The User can specify any point as the Reference Point. + # @param MakeGroups forces the generation of new groups from existing ones + # @param LinearVariation forces the computation of rotation angles as linear + # variation of the given Angles along path steps # @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True, # only SMESH::Extrusion_Error otherwise + # @ingroup l2_modif_extrurev def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart, HasAngles, Angles, HasRefPoint, RefPoint, MakeGroups=False, LinearVariation=False): @@ -2106,14 +2376,15 @@ class Mesh: NodeStart, HasAngles, Angles, HasRefPoint, RefPoint) - ## Symmetrical copy of mesh elements + ## Creates a symmetrical copy of mesh elements # @param IDsOfElements list of elements ids # @param Mirror is AxisStruct or geom object(point, line, plane) # @param theMirrorType is POINT, AXIS or PLANE - # If the Mirror is geom object this parameter is unnecessary - # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0) - # @param MakeGroups to generate new groups from existing ones (if Copy) + # If the Mirror is a geom object this parameter is unnecessary + # @param Copy allows to copy element (Copy is 1) or to replace with its mirroring (Copy is 0) + # @param MakeGroups forces the generation of new groups from existing ones (if Copy) # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_trsf def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2124,14 +2395,15 @@ class Mesh: self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy) return [] - ## Create a new mesh by symmetrical copy of mesh elements - # @param IDsOfElements list of elements ids - # @param Mirror is AxisStruct or geom object(point, line, plane) + ## Creates a new mesh by a symmetrical copy of mesh elements + # @param IDsOfElements the list of elements ids + # @param Mirror is AxisStruct or geom object (point, line, plane) # @param theMirrorType is POINT, AXIS or PLANE - # If the Mirror is geom object this parameter is unnecessary + # If the Mirror is a geom object this parameter is unnecessary # @param MakeGroups to generate new groups from existing ones - # @param NewMeshName is a name of new mesh to create + # @param NewMeshName a name of the new mesh to create # @return instance of Mesh class + # @ingroup l2_modif_trsf def MirrorMakeMesh(self, IDsOfElements, Mirror, theMirrorType, MakeGroups=0, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2141,14 +2413,15 @@ class Mesh: MakeGroups, NewMeshName) return Mesh(self.smeshpyD,self.geompyD,mesh) - ## Symmetrical copy of object + ## Creates a symmetrical copy of the object # @param theObject mesh, submesh or group - # @param Mirror is AxisStruct or geom object(point, line, plane) + # @param Mirror AxisStruct or geom object (point, line, plane) # @param theMirrorType is POINT, AXIS or PLANE - # If the Mirror is geom object this parameter is unnecessary - # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0) - # @param MakeGroups to generate new groups from existing ones (if Copy) + # If the Mirror is a geom object this parameter is unnecessary + # @param Copy allows copying the element (Copy is 1) or replacing it with its mirror (Copy is 0) + # @param MakeGroups forces the generation of new groups from existing ones (if Copy) # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_trsf def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2159,14 +2432,15 @@ class Mesh: self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy) return [] - ## Create a new mesh by symmetrical copy of object + ## Creates a new mesh by a symmetrical copy of the object # @param theObject mesh, submesh or group - # @param Mirror is AxisStruct or geom object(point, line, plane) - # @param theMirrorType is POINT, AXIS or PLANE - # If the Mirror is geom object this parameter is unnecessary - # @param MakeGroups to generate new groups from existing ones - # @param NewMeshName is a name of new mesh to create + # @param Mirror AxisStruct or geom object (point, line, plane) + # @param theMirrorType POINT, AXIS or PLANE + # If the Mirror is a geom object this parameter is unnecessary + # @param MakeGroups forces the generation of new groups from existing ones + # @param NewMeshName the name of the new mesh to create # @return instance of Mesh class + # @ingroup l2_modif_trsf def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2178,10 +2452,11 @@ class Mesh: ## Translates the elements # @param IDsOfElements list of elements ids - # @param Vector direction of translation(DirStruct or vector) - # @param Copy allows to copy the translated elements - # @param MakeGroups to generate new groups from existing ones (if Copy) + # @param Vector the direction of translation (DirStruct or vector) + # @param Copy allows copying the translated elements + # @param MakeGroups forces the generation of new groups from existing ones (if Copy) # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_trsf def Translate(self, IDsOfElements, Vector, Copy, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2192,12 +2467,13 @@ class Mesh: self.editor.Translate(IDsOfElements, Vector, Copy) return [] - ## Create a new mesh of translated elements + ## Creates a new mesh of translated elements # @param IDsOfElements list of elements ids - # @param Vector direction of translation(DirStruct or vector) - # @param MakeGroups to generate new groups from existing ones - # @param NewMeshName is a name of new mesh to create + # @param Vector the direction of translation (DirStruct or vector) + # @param MakeGroups forces the generation of new groups from existing ones + # @param NewMeshName the name of the newly created mesh # @return instance of Mesh class + # @ingroup l2_modif_trsf def TranslateMakeMesh(self, IDsOfElements, Vector, MakeGroups=False, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2207,11 +2483,12 @@ class Mesh: return Mesh ( self.smeshpyD, self.geompyD, mesh ) ## Translates the object - # @param theObject object to translate(mesh, submesh, or group) - # @param Vector direction of translation(DirStruct or geom vector) - # @param Copy allows to copy the translated elements - # @param MakeGroups to generate new groups from existing ones (if Copy) + # @param theObject the object to translate (mesh, submesh, or group) + # @param Vector direction of translation (DirStruct or geom vector) + # @param Copy allows copying the translated elements + # @param MakeGroups forces the generation of new groups from existing ones (if Copy) # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_trsf def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False): if ( isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2222,12 +2499,13 @@ class Mesh: self.editor.TranslateObject(theObject, Vector, Copy) return [] - ## Create a new mesh from translated object - # @param theObject object to translate(mesh, submesh, or group) - # @param Vector direction of translation(DirStruct or geom vector) - # @param MakeGroups to generate new groups from existing ones - # @param NewMeshName is a name of new mesh to create + ## Creates a new mesh from the translated object + # @param theObject the object to translate (mesh, submesh, or group) + # @param Vector the direction of translation (DirStruct or geom vector) + # @param MakeGroups forces the generation of new groups from existing ones + # @param NewMeshName the name of the newly created mesh # @return instance of Mesh class + # @ingroup l2_modif_trsf def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""): if (isinstance(theObject, Mesh)): theObject = theObject.GetMesh() @@ -2238,11 +2516,12 @@ class Mesh: ## Rotates the elements # @param IDsOfElements list of elements ids - # @param Axis axis of rotation(AxisStruct or geom line) - # @param AngleInRadians angle of rotation(in radians) - # @param Copy allows to copy the rotated elements - # @param MakeGroups to generate new groups from existing ones (if Copy) + # @param Axis the axis of rotation (AxisStruct or geom line) + # @param AngleInRadians the angle of rotation (in radians) + # @param Copy allows copying the rotated elements + # @param MakeGroups forces the generation of new groups from existing ones (if Copy) # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_trsf def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy, MakeGroups=False): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2253,13 +2532,14 @@ class Mesh: self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy) return [] - ## Create a new mesh of rotated elements + ## Creates a new mesh of rotated elements # @param IDsOfElements list of element ids - # @param Axis axis of rotation(AxisStruct or geom line) - # @param AngleInRadians angle of rotation(in radians) - # @param MakeGroups to generate new groups from existing ones - # @param NewMeshName is a name of new mesh to create + # @param Axis the axis of rotation (AxisStruct or geom line) + # @param AngleInRadians the angle of rotation (in radians) + # @param MakeGroups forces the generation of new groups from existing ones + # @param NewMeshName the name of the newly created mesh # @return instance of Mesh class + # @ingroup l2_modif_trsf def RotateMakeMesh (self, IDsOfElements, Axis, AngleInRadians, MakeGroups=0, NewMeshName=""): if IDsOfElements == []: IDsOfElements = self.GetElementsId() @@ -2270,12 +2550,13 @@ class Mesh: return Mesh( self.smeshpyD, self.geompyD, mesh ) ## Rotates the object - # @param theObject object to rotate(mesh, submesh, or group) - # @param Axis axis of rotation(AxisStruct or geom line) - # @param AngleInRadians angle of rotation(in radians) - # @param Copy allows to copy the rotated elements - # @param MakeGroups to generate new groups from existing ones (if Copy) + # @param theObject the object to rotate( mesh, submesh, or group) + # @param Axis the axis of rotation (AxisStruct or geom line) + # @param AngleInRadians the angle of rotation (in radians) + # @param Copy allows copying the rotated elements + # @param MakeGroups forces the generation of new groups from existing ones (if Copy) # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise + # @ingroup l2_modif_trsf def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False): if (isinstance(theObject, Mesh)): theObject = theObject.GetMesh() @@ -2286,13 +2567,14 @@ class Mesh: self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy) return [] - ## Create a new mesh from a rotated object - # @param theObject object to rotate (mesh, submesh, or group) - # @param Axis axis of rotation(AxisStruct or geom line) - # @param AngleInRadians angle of rotation(in radians) - # @param MakeGroups to generate new groups from existing ones - # @param NewMeshName is a name of new mesh to create + ## Creates a new mesh from the rotated object + # @param theObject the object to rotate (mesh, submesh, or group) + # @param Axis the axis of rotation (AxisStruct or geom line) + # @param AngleInRadians the angle of rotation (in radians) + # @param MakeGroups forces the generation of new groups from existing ones + # @param NewMeshName the name of the newly created mesh # @return instance of Mesh class + # @ingroup l2_modif_trsf def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""): if (isinstance( theObject, Mesh )): theObject = theObject.GetMesh() @@ -2302,41 +2584,48 @@ class Mesh: MakeGroups, NewMeshName) return Mesh( self.smeshpyD, self.geompyD, mesh ) - ## Find group of nodes close to each other within Tolerance. - # @param Tolerance tolerance value - # @return list of group of nodes + ## Finds groups of ajacent nodes within Tolerance. + # @param Tolerance the value of tolerance + # @return the list of groups of nodes + # @ingroup l2_modif_trsf def FindCoincidentNodes (self, Tolerance): return self.editor.FindCoincidentNodes(Tolerance) - ## Find group of nodes close to each other within Tolerance. - # @param Tolerance tolerance value + ## Finds groups of ajacent nodes within Tolerance. + # @param Tolerance the value of tolerance # @param SubMeshOrGroup SubMesh or Group - # @return list of group of nodes + # @return the list of groups of nodes + # @ingroup l2_modif_trsf def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance): return self.editor.FindCoincidentNodesOnPart(SubMeshOrGroup, Tolerance) - ## Merge nodes - # @param GroupsOfNodes list of group of nodes + ## Merges nodes + # @param GroupsOfNodes the list of groups of nodes + # @ingroup l2_modif_trsf def MergeNodes (self, GroupsOfNodes): self.editor.MergeNodes(GroupsOfNodes) - ## Find 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 # @return a list of groups of equal elements + # @ingroup l2_modif_trsf def FindEqualElements (self, MeshOrSubMeshOrGroup): return self.editor.FindEqualElements(MeshOrSubMeshOrGroup) - ## Merge elements in each given group. + ## Merges elements in each given group. # @param GroupsOfElementsID groups of elements for merging + # @ingroup l2_modif_trsf def MergeElements(self, GroupsOfElementsID): self.editor.MergeElements(GroupsOfElementsID) - ## Remove all but one of elements built on the same nodes. + ## Leaves one element and removes all other elements built on the same nodes. + # @ingroup l2_modif_trsf def MergeEqualElements(self): self.editor.MergeEqualElements() - ## Sew free borders + ## Sews free borders # @return SMESH::Sew_Error + # @ingroup l2_modif_trsf def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2, LastNodeID2, CreatePolygons, CreatePolyedrs): @@ -2344,27 +2633,30 @@ class Mesh: FirstNodeID2, SecondNodeID2, LastNodeID2, CreatePolygons, CreatePolyedrs) - ## Sew conform free borders + ## Sews conform free borders # @return SMESH::Sew_Error + # @ingroup l2_modif_trsf def SewConformFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2): return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2) - ## Sew border to side + ## Sews border to side # @return SMESH::Sew_Error + # @ingroup l2_modif_trsf def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs): return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs) - ## Sew two sides of a mesh. Nodes belonging to Side1 are - # merged with nodes of elements of Side2. - # Number of elements in theSide1 and in theSide2 must be - # equal and they should have similar node connectivity. - # The nodes to merge should belong to sides borders and + ## Sews two sides of a mesh. The nodes belonging to Side1 are + # merged with the nodes of elements of Side2. + # The number of elements in theSide1 and in theSide2 must be + # equal and they should have similar nodal connectivity. + # The nodes to merge should belong to side borders and # the first node should be linked to the second. # @return SMESH::Sew_Error + # @ingroup l2_modif_trsf def SewSideElements (self, IDsOfSide1Elements, IDsOfSide2Elements, NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge): @@ -2372,30 +2664,34 @@ class Mesh: NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge) - ## Set new nodes for given element. + ## Sets new nodes for the given element. # @param ide the element id # @param newIDs nodes ids - # @return If number of nodes is not corresponded to type of element - returns false + # @return If the number of nodes does not correspond to the type of element - returns false + # @ingroup l2_modif_edit def ChangeElemNodes(self, ide, newIDs): return self.editor.ChangeElemNodes(ide, newIDs) - ## If during last operation of MeshEditor some nodes were - # created this method returns list of its IDs, \n - # if new nodes not created - returns empty list - # @return list of integer values (can be empty) + ## If during the last operation of MeshEditor some nodes were + # created, this method returns the list of their IDs, \n + # if new nodes were not created - returns empty list + # @return the list of integer values (can be empty) + # @ingroup l1_auxiliary def GetLastCreatedNodes(self): return self.editor.GetLastCreatedNodes() - ## If during last operation of MeshEditor some elements were - # created this method returns list of its IDs, \n - # if new elements not creared - returns empty list - # @return list of integer values (can be empty) + ## If during the last operation of MeshEditor some elements were + # created this method returns the list of their IDs, \n + # if new elements were not created - returns empty list + # @return the list of integer values (can be empty) + # @ingroup l1_auxiliary def GetLastCreatedElems(self): return self.editor.GetLastCreatedElems() -## Mother class to define algorithm, recommended to do not use directly. +## The mother class to define algorithm, it is not recommended to use it directly. # # More details. +# @ingroup l2_algorithms class Mesh_Algorithm: # @class Mesh_Algorithm # @brief Class Mesh_Algorithm @@ -2408,8 +2704,8 @@ class Mesh_Algorithm: self.subm = None self.algo = None - ## Find hypothesis in study by its type name and parameters. - # Find only those hypothesis, which was created in smeshpyD engine. + ## Finds a hypothesis in the study by its type name and parameters. + # Finds only the hypotheses created in smeshpyD engine. # @return SMESH.SMESH_Hypothesis def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD): study = smeshpyD.GetCurrentStudy() @@ -2417,10 +2713,10 @@ class Mesh_Algorithm: scomp = study.FindComponent(smeshpyD.ComponentDataType()) if scomp is not None: res,hypRoot = scomp.FindSubObject(SMESH.Tag_HypothesisRoot) - # is hypotheses root label exists? + # Check if the root label of the hypotheses exists if res and hypRoot is not None: iter = study.NewChildIterator(hypRoot) - # check all published hypotheses + # Check all published hypotheses while iter.More(): hypo_so_i = iter.Value() attr = hypo_so_i.FindAttribute("AttributeIOR")[1] @@ -2428,14 +2724,14 @@ class Mesh_Algorithm: anIOR = attr.Value() hypo_o_i = salome.orb.string_to_object(anIOR) if hypo_o_i is not None: - # is hypothesis? + # Check if this is a hypothesis hypo_i = hypo_o_i._narrow(SMESH.SMESH_Hypothesis) if hypo_i is not None: - # belongs to this engine? + # Check if the hypothesis belongs to current engine if smeshpyD.GetObjectId(hypo_i) > 0: - # is it the needed hypothesis? + # Check if this is the required hypothesis if hypo_i.GetName() == hypname: - # check args + # Check arguments if CompareMethod(hypo_i, args): # found!!! return hypo_i @@ -2450,8 +2746,8 @@ class Mesh_Algorithm: pass return None - ## Find algorithm in study by its type name. - # Find only those algorithm, which was created in smeshpyD engine. + ## Finds the algorithm in the study by its type name. + # Finds only the algorithms, which have been created in smeshpyD engine. # @return SMESH.SMESH_Algo def FindAlgorithm (self, algoname, smeshpyD): study = smeshpyD.GetCurrentStudy() @@ -2459,10 +2755,10 @@ class Mesh_Algorithm: scomp = study.FindComponent(smeshpyD.ComponentDataType()) if scomp is not None: res,hypRoot = scomp.FindSubObject(SMESH.Tag_AlgorithmsRoot) - # is algorithms root label exists? + # Check if the root label of the algorithms exists if res and hypRoot is not None: iter = study.NewChildIterator(hypRoot) - # check all published algorithms + # Check all published algorithms while iter.More(): algo_so_i = iter.Value() attr = algo_so_i.FindAttribute("AttributeIOR")[1] @@ -2470,12 +2766,12 @@ class Mesh_Algorithm: anIOR = attr.Value() algo_o_i = salome.orb.string_to_object(anIOR) if algo_o_i is not None: - # is algorithm? + # Check if this is an algorithm algo_i = algo_o_i._narrow(SMESH.SMESH_Algo) if algo_i is not None: - # belongs to this engine? + # Checks if the algorithm belongs to the current engine if smeshpyD.GetObjectId(algo_i) > 0: - # is it the needed algorithm? + # Check if this is the required algorithm if algo_i.GetName() == algoname: # found!!! return algo_i @@ -2489,31 +2785,31 @@ class Mesh_Algorithm: pass return None - ## If the algorithm is global, return 0; \n - # else return the submesh associated to this algorithm. + ## If the algorithm is global, returns 0; \n + # else returns the submesh associated to this algorithm. def GetSubMesh(self): return self.subm - ## Return the wrapped mesher. + ## Returns the wrapped mesher. def GetAlgorithm(self): return self.algo - ## Get list of hypothesis that can be used with this algorithm + ## Gets the list of hypothesis that can be used with this algorithm def GetCompatibleHypothesis(self): mylist = [] if self.algo: mylist = self.algo.GetCompatibleHypothesis() return mylist - ## Get name of algo + ## Gets the name of the algorithm def GetName(self): GetName(self.algo) - ## Set name to algo + ## Sets the name to the algorithm def SetName(self, name): SetName(self.algo, name) - ## Get id of algo + ## Gets the id of the algorithm def GetId(self): return self.algo.GetId() @@ -2587,6 +2883,7 @@ class Mesh_Algorithm: ## Class to define a segment 1D algorithm for discretization # # More details. +# @ingroup l3_algos_basic class Mesh_Segment(Mesh_Algorithm): ## Private constructor. @@ -2594,13 +2891,13 @@ class Mesh_Segment(Mesh_Algorithm): Mesh_Algorithm.__init__(self) self.Create(mesh, geom, "Regular_1D") - ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length + ## Defines "LocalLength" hypothesis to cut an edge in several segments with the same length # @param l for the length of segments that cut an edge - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new - # @param p precision, used for number of segments calculation. - # It must be pozitive, meaningfull values are in range [0,1]. - # In general, number of segments is calculated with formula: + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - creates a new one + # @param p precision, used for calculation of the number of segments. + # The precision should be a positive, meaningful value within the range [0,1]. + # In general, the number of segments is calculated with the formula: # nb = ceil((edge_length / l) - p) # Function ceil rounds its argument to the higher integer. # So, p=0 means rounding of (edge_length / l) to the higher integer, @@ -2608,6 +2905,7 @@ class Mesh_Segment(Mesh_Algorithm): # p=1 means rounding of (edge_length / l) to the lower integer. # Default value is 1e-07. # @return an instance of StdMeshers_LocalLength hypothesis + # @ingroup l3_hypos_1dhyps def LocalLength(self, l, UseExisting=0, p=1e-07): hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting, CompareMethod=self.CompareLocalLength) @@ -2616,18 +2914,19 @@ class Mesh_Segment(Mesh_Algorithm): return hyp ## Private method - ## Check if the given "LocalLength" hypothesis has the same parameters as given arguments + ## Checks if the given "LocalLength" hypothesis has the same parameters as the given arguments def CompareLocalLength(self, hyp, args): if IsEqual(hyp.GetLength(), args[0]): return IsEqual(hyp.GetPrecision(), args[1]) return False - ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments + ## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments # @param n for the number of segments that cut an edge # @param s for the scale factor (optional) - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - create a new one # @return an instance of StdMeshers_NumberOfSegments hypothesis + # @ingroup l3_hypos_1dhyps def NumberOfSegments(self, n, s=[], UseExisting=0): if s == []: hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting, @@ -2641,7 +2940,7 @@ class Mesh_Segment(Mesh_Algorithm): return hyp ## Private method - ## Check if the given "NumberOfSegments" hypothesis has the same parameters as given arguments + ## Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments def CompareNumberOfSegments(self, hyp, args): if hyp.GetNumberOfSegments() == args[0]: if len(args) == 1: @@ -2652,12 +2951,13 @@ class Mesh_Segment(Mesh_Algorithm): return True return False - ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing - # @param start for the length of the first segment - # @param end for the length of the last segment - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length + # @param start defines the length of the first segment + # @param end defines the length of the last segment + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - creates a new one # @return an instance of StdMeshers_Arithmetic1D hypothesis + # @ingroup l3_hypos_1dhyps def Arithmetic1D(self, start, end, UseExisting=0): hyp = self.Hypothesis("Arithmetic1D", [start, end], UseExisting=UseExisting, CompareMethod=self.CompareArithmetic1D) @@ -2666,19 +2966,20 @@ class Mesh_Segment(Mesh_Algorithm): return hyp ## Private method - ## Check if the given "Arithmetic1D" hypothesis has the same parameters as given arguments + ## Check if the given "Arithmetic1D" hypothesis has the same parameters as the given arguments def CompareArithmetic1D(self, hyp, args): if IsEqual(hyp.GetLength(1), args[0]): if IsEqual(hyp.GetLength(0), args[1]): return True return False - ## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing - # @param start for the length of the first segment - # @param end for the length of the last segment - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + ## Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length + # @param start defines the length of the first segment + # @param end defines the length of the last segment + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - creates a new one # @return an instance of StdMeshers_StartEndLength hypothesis + # @ingroup l3_hypos_1dhyps def StartEndLength(self, start, end, UseExisting=0): hyp = self.Hypothesis("StartEndLength", [start, end], UseExisting=UseExisting, CompareMethod=self.CompareStartEndLength) @@ -2686,53 +2987,57 @@ class Mesh_Segment(Mesh_Algorithm): hyp.SetLength(end , 0) return hyp - ## Check if the given "StartEndLength" hypothesis has the same parameters as given arguments + ## Check if the given "StartEndLength" hypothesis has the same parameters as the given arguments def CompareStartEndLength(self, hyp, args): if IsEqual(hyp.GetLength(1), args[0]): if IsEqual(hyp.GetLength(0), args[1]): return True return False - ## Define "Deflection1D" hypothesis + ## Defines "Deflection1D" hypothesis # @param d for the deflection - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - create a new one + # @ingroup l3_hypos_1dhyps def Deflection1D(self, d, UseExisting=0): hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting, CompareMethod=self.CompareDeflection1D) hyp.SetDeflection(d) return hyp - ## Check if the given "Deflection1D" hypothesis has the same parameters as given arguments + ## Check if the given "Deflection1D" hypothesis has the same parameters as the given arguments def CompareDeflection1D(self, hyp, args): return IsEqual(hyp.GetDeflection(), args[0]) - ## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in - # the opposite side in the case of quadrangular faces + ## Defines "Propagation" hypothesis that propagates all other hypotheses on all other edges that are at + # the opposite side in case of quadrangular faces + # @ingroup l3_hypos_additi def Propagation(self): return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp) - ## Define "AutomaticLength" hypothesis + ## Defines "AutomaticLength" hypothesis # @param fineness for the fineness [0-1] - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param UseExisting if ==true - searches for an existing hypothesis created with the + # same parameters, else (default) - create a new one + # @ingroup l3_hypos_1dhyps def AutomaticLength(self, fineness=0, UseExisting=0): hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting, CompareMethod=self.CompareAutomaticLength) hyp.SetFineness( fineness ) return hyp - ## Check if the given "AutomaticLength" hypothesis has the same parameters as given arguments + ## Checks if the given "AutomaticLength" hypothesis has the same parameters as the given arguments def CompareAutomaticLength(self, hyp, args): return IsEqual(hyp.GetFineness(), args[0]) - ## Define "SegmentLengthAroundVertex" hypothesis + ## Defines "SegmentLengthAroundVertex" hypothesis # @param length for the segment length - # @param vertex for the length localization: vertex index [0,1] | vertex object. - # Any other integer value means what hypo will be set on the + # @param vertex for the length localization: the vertex index [0,1] | vertex object. + # Any other integer value means that the hypothesis will be set on the # whole 1D shape, where Mesh_Segment algorithm is assigned. - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - creates a new one + # @ingroup l3_algos_segmarv def LengthNearVertex(self, length, vertex=0, UseExisting=0): import types store_geom = self.geom @@ -2766,16 +3071,19 @@ class Mesh_Segment(Mesh_Algorithm): hyp.SetLength( length ) return hyp - ## Check if the given "LengthNearVertex" hypothesis has the same parameters as given arguments + ## Checks if the given "LengthNearVertex" hypothesis has the same parameters as the given arguments + # @ingroup l3_algos_segmarv def CompareLengthNearVertex(self, hyp, args): return IsEqual(hyp.GetLength(), args[0]) - ## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges. - # If the 2D mesher sees that all boundary edges are quadratic ones, + ## Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges. + # If the 2D mesher sees that all boundary edges are quadratic, # it generates quadratic faces, else it generates linear faces using - # medium nodes as if they were vertex ones. + # medium nodes as if they are vertices. # The 3D mesher generates quadratic volumes only if all boundary faces - # are quadratic ones, else it fails. + # are quadratic, else it fails. + # + # @ingroup l3_hypos_additi def QuadraticMesh(self): hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp) return hyp @@ -2783,9 +3091,9 @@ class Mesh_Segment(Mesh_Algorithm): # Public class: Mesh_CompositeSegment # -------------------------- -## Class to define a segment 1D algorithm for discretization -# -# More details. +## Defines a segment 1D algorithm for discretization +# +# @ingroup l3_algos_basic class Mesh_CompositeSegment(Mesh_Segment): ## Private constructor. @@ -2796,9 +3104,9 @@ class Mesh_CompositeSegment(Mesh_Segment): # Public class: Mesh_Segment_Python # --------------------------------- -## Class to define a segment 1D algorithm for discretization with python function +## Defines a segment 1D algorithm for discretization with python function # -# More details. +# @ingroup l3_algos_basic class Mesh_Segment_Python(Mesh_Segment): ## Private constructor. @@ -2806,11 +3114,12 @@ class Mesh_Segment_Python(Mesh_Segment): import Python1dPlugin self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so") - ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality + ## Defines "PythonSplit1D" hypothesis # @param n for the number of segments that cut an edge - # @param func for the python function that calculate the length of all segments - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param func for the python function that calculates the length of all segments + # @param UseExisting if ==true - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one + # @ingroup l3_hypos_1dhyps def PythonSplit1D(self, n, func, UseExisting=0): hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so", UseExisting=UseExisting, CompareMethod=self.ComparePythonSplit1D) @@ -2818,7 +3127,7 @@ class Mesh_Segment_Python(Mesh_Segment): hyp.SetPythonLog10RatioFunction(func) return hyp - ## Check if the given "PythonSplit1D" hypothesis has the same parameters as given arguments + ## Checks if the given "PythonSplit1D" hypothesis has the same parameters as the given arguments def ComparePythonSplit1D(self, hyp, args): #if hyp.GetNumberOfSegments() == args[0]: # if hyp.GetPythonLog10RatioFunction() == args[1]: @@ -2828,9 +3137,9 @@ class Mesh_Segment_Python(Mesh_Segment): # Public class: Mesh_Triangle # --------------------------- -## Class to define a triangle 2D algorithm +## Defines a triangle 2D algorithm # -# More details. +# @ingroup l3_algos_basic class Mesh_Triangle(Mesh_Algorithm): # default values @@ -2851,7 +3160,7 @@ class Mesh_Triangle(Mesh_Algorithm): elif algoType == BLSURF: import BLSURFPlugin self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so") - self.SetPhysicalMesh() + #self.SetPhysicalMesh() - PAL19680 elif algoType == NETGEN: if noNETGENPlugin: print "Warning: NETGENPlugin module unavailable" @@ -2865,12 +3174,13 @@ class Mesh_Triangle(Mesh_Algorithm): self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so") pass - ## Define "MaxElementArea" hypothesis to give the maximum area of each triangle + ## Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle # @param area for the maximum area of each triangle - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param UseExisting if ==true - searches for an existing hypothesis created with the + # same parameters, else (default) - creates a new one # # Only for algoType == MEFISTO || NETGEN_2D + # @ingroup l3_hypos_2dhyps def MaxElementArea(self, area, UseExisting=0): if self.algoType == MEFISTO or self.algoType == NETGEN_2D: hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting, @@ -2881,14 +3191,15 @@ class Mesh_Triangle(Mesh_Algorithm): print "Netgen 1D-2D algo doesn't support this hypothesis" return None - ## Check if the given "MaxElementArea" hypothesis has the same parameters as given arguments + ## Checks if the given "MaxElementArea" hypothesis has the same parameters as the given arguments def CompareMaxElementArea(self, hyp, args): return IsEqual(hyp.GetMaxElementArea(), args[0]) - ## Define "LengthFromEdges" hypothesis to build triangles + ## Defines "LengthFromEdges" hypothesis to build triangles # based on the length of the edges taken from the wire # # Only for algoType == MEFISTO || NETGEN_2D + # @ingroup l3_hypos_2dhyps def LengthFromEdges(self): if self.algoType == MEFISTO or self.algoType == NETGEN_2D: hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp) @@ -2897,46 +3208,102 @@ class Mesh_Triangle(Mesh_Algorithm): print "Netgen 1D-2D algo doesn't support this hypothesis" return None - ## Set PhysicalMesh - # @param thePhysicalMesh is: - # DefaultSize or Custom - def SetPhysicalMesh(self, thePhysicalMesh=1): - if self.params == 0: - self.Parameters() - self.params.SetPhysicalMesh(thePhysicalMesh) + ## Sets a way to define size of mesh elements to generate. + # @param thePhysicalMesh is: DefaultSize or Custom. + # @ingroup l3_hypos_blsurf + def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize): + # Parameter of BLSURF algo + self.Parameters().SetPhysicalMesh(thePhysicalMesh) - ## Set PhySize flag + ## Sets size of mesh elements to generate. + # @ingroup l3_hypos_blsurf def SetPhySize(self, theVal): - if self.params == 0: - self.Parameters() - self.params.SetPhySize(theVal) - - ## Set GeometricMesh - # @param theGeometricMesh is: - # DefaultGeom or Custom + # Parameter of BLSURF algo + self.Parameters().SetPhySize(theVal) + + ## Sets lower boundary of mesh element size (PhySize). + # @ingroup l3_hypos_blsurf + def SetPhyMin(self, theVal=-1): + # Parameter of BLSURF algo + self.Parameters().SetPhyMin(theVal) + + ## Sets upper boundary of mesh element size (PhySize). + # @ingroup l3_hypos_blsurf + def SetPhyMax(self, theVal=-1): + # Parameter of BLSURF algo + self.Parameters().SetPhyMax(theVal) + + ## Sets a way to define maximum angular deflection of mesh from CAD model. + # @param theGeometricMesh is: DefaultGeom or Custom + # @ingroup l3_hypos_blsurf def SetGeometricMesh(self, theGeometricMesh=0): - if self.params == 0: - self.Parameters() - if self.params.GetPhysicalMesh() == 0: theGeometricMesh = 1 + # Parameter of BLSURF algo + if self.Parameters().GetPhysicalMesh() == 0: theGeometricMesh = 1 self.params.SetGeometricMesh(theGeometricMesh) - ## Set AngleMeshS flag + ## Sets angular deflection (in degrees) of a mesh face from CAD surface. + # @ingroup l3_hypos_blsurf def SetAngleMeshS(self, theVal=_angleMeshS): - if self.params == 0: - self.Parameters() - if self.params.GetGeometricMesh() == 0: theVal = self._angleMeshS + # Parameter of BLSURF algo + if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS self.params.SetAngleMeshS(theVal) - ## Set Gradation flag + ## Sets angular deflection (in degrees) of a mesh edge from CAD curve. + # @ingroup l3_hypos_blsurf + def SetAngleMeshC(self, theVal=_angleMeshS): + # Parameter of BLSURF algo + if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS + self.params.SetAngleMeshC(theVal) + + ## Sets lower boundary of mesh element size computed to respect angular deflection. + # @ingroup l3_hypos_blsurf + def SetGeoMin(self, theVal=-1): + # Parameter of BLSURF algo + self.Parameters().SetGeoMin(theVal) + + ## Sets upper boundary of mesh element size computed to respect angular deflection. + # @ingroup l3_hypos_blsurf + def SetGeoMax(self, theVal=-1): + # Parameter of BLSURF algo + self.Parameters().SetGeoMax(theVal) + + ## Sets maximal allowed ratio between the lengths of two adjacent edges. + # @ingroup l3_hypos_blsurf def SetGradation(self, theVal=_gradation): - if self.params == 0: - self.Parameters() - if self.params.GetGeometricMesh() == 0: theVal = self._gradation + # Parameter of BLSURF algo + if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation self.params.SetGradation(theVal) - ## Set QuadAllowed flag - # - # Only for algoType == NETGEN || NETGEN_2D + ## Sets topology usage way. + # @param way defines how mesh conformity is assured
      + #
    • FromCAD - mesh conformity is assured by conformity of a shape
    • + #
    • PreProcess or PreProcessPlus - by pre-processing a CAD model
    + # @ingroup l3_hypos_blsurf + def SetTopology(self, way): + # Parameter of BLSURF algo + self.Parameters().SetTopology(way) + + ## To respect geometrical edges or not. + # @ingroup l3_hypos_blsurf + def SetDecimesh(self, toIgnoreEdges=False): + # Parameter of BLSURF algo + self.Parameters().SetDecimesh(toIgnoreEdges) + + ## Sets verbosity level in the range 0 to 100. + # @ingroup l3_hypos_blsurf + def SetVerbosity(self, level): + # Parameter of BLSURF algo + self.Parameters().SetVerbosity(level) + + ## Sets advanced option value. + # @ingroup l3_hypos_blsurf + def SetOptionValue(self, optionName, level): + # Parameter of BLSURF algo + self.Parameters().SetOptionValue(optionName,level) + + ## Sets QuadAllowed flag. + # Only for algoType == NETGEN || NETGEN_2D || BLSURF + # @ingroup l3_hypos_netgen l3_hypos_blsurf def SetQuadAllowed(self, toAllow=True): if self.algoType == NETGEN_2D: if toAllow: # add QuadranglePreference @@ -2949,16 +3316,17 @@ class Mesh_Triangle(Mesh_Algorithm): pass pass return - if self.params == 0: - self.Parameters() - if self.params: + if self.Parameters(): self.params.SetQuadAllowed(toAllow) return - ## Define "Netgen 2D Parameters" hypothesis + ## Defines "Netgen 2D Parameters" hypothesis # - # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def Parameters(self): + # Only for algoType == NETGEN + if self.params: + return self.params if self.algoType == NETGEN: self.params = self.Hypothesis("NETGEN_Parameters_2D", [], "libNETGENEngine.so", UseExisting=0) @@ -2976,86 +3344,73 @@ class Mesh_Triangle(Mesh_Algorithm): return self.params return None - ## Set MaxSize + ## Sets MaxSize # # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def SetMaxSize(self, theSize): - if self.params == 0: - self.Parameters() - if self.params is not None: + if self.Parameters(): self.params.SetMaxSize(theSize) - ## Set SecondOrder flag + ## Sets SecondOrder flag # # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def SetSecondOrder(self, theVal): - if self.params == 0: - self.Parameters() - if self.params is not None: + if self.Parameters(): self.params.SetSecondOrder(theVal) - ## Set Optimize flag + ## Sets Optimize flag # # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def SetOptimize(self, theVal): - if self.params == 0: - self.Parameters() - if self.params is not None: + if self.Parameters(): self.params.SetOptimize(theVal) - ## Set Fineness + ## Sets Fineness # @param theFineness is: # VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom # # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def SetFineness(self, theFineness): - if self.params == 0: - self.Parameters() - if self.params is not None: + if self.Parameters(): self.params.SetFineness(theFineness) - ## Set GrowthRate + ## Sets GrowthRate # # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def SetGrowthRate(self, theRate): - if self.params == 0: - self.Parameters() - if self.params is not None: + if self.Parameters(): self.params.SetGrowthRate(theRate) - ## Set NbSegPerEdge + ## Sets NbSegPerEdge # # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def SetNbSegPerEdge(self, theVal): - if self.params == 0: - self.Parameters() - if self.params is not None: + if self.Parameters(): self.params.SetNbSegPerEdge(theVal) - ## Set NbSegPerRadius + ## Sets NbSegPerRadius # # Only for algoType == NETGEN + # @ingroup l3_hypos_netgen def SetNbSegPerRadius(self, theVal): - if self.params == 0: - self.Parameters() - if self.params is not None: + if self.Parameters(): self.params.SetNbSegPerRadius(theVal) - ## Set Decimesh flag - def SetDecimesh(self, toAllow=False): - if self.params == 0: - self.Parameters() - self.params.SetDecimesh(toAllow) - pass # Public class: Mesh_Quadrangle # ----------------------------- -## Class to define a quadrangle 2D algorithm +## Defines a quadrangle 2D algorithm # -# More details. +# @ingroup l3_algos_basic class Mesh_Quadrangle(Mesh_Algorithm): ## Private constructor. @@ -3063,9 +3418,11 @@ class Mesh_Quadrangle(Mesh_Algorithm): Mesh_Algorithm.__init__(self) self.Create(mesh, geom, "Quadrangle_2D") - ## Define "QuadranglePreference" hypothesis, forcing construction - # of quadrangles if the number of nodes on opposite edges is not the same - # in the case where the global number of nodes on edges is even + ## Defines "QuadranglePreference" hypothesis, forcing construction + # of quadrangles if the number of nodes on the opposite edges is not the same + # while the total number of nodes on edges is even + # + # @ingroup l3_hypos_additi def QuadranglePreference(self): hyp = self.Hypothesis("QuadranglePreference", UseExisting=1, CompareMethod=self.CompareEqualHyp) @@ -3074,9 +3431,9 @@ class Mesh_Quadrangle(Mesh_Algorithm): # Public class: Mesh_Tetrahedron # ------------------------------ -## Class to define a tetrahedron 3D algorithm +## Defines a tetrahedron 3D algorithm # -# More details. +# @ingroup l3_algos_basic class Mesh_Tetrahedron(Mesh_Algorithm): params = 0 @@ -3090,93 +3447,172 @@ class Mesh_Tetrahedron(Mesh_Algorithm): self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so") pass - elif algoType == GHS3D: - import GHS3DPlugin - self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so") - pass - elif algoType == FULL_NETGEN: if noNETGENPlugin: print "Warning: NETGENPlugin module has not been imported." self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so") pass + elif algoType == GHS3D: + import GHS3DPlugin + self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so") + pass + self.algoType = algoType - ## Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral - # @param vol for the maximum volume of each tetrahedral - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + ## Defines "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedron + # @param vol for the maximum volume of each tetrahedron + # @param UseExisting if ==true - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one + # @ingroup l3_hypos_maxvol def MaxElementVolume(self, vol, UseExisting=0): hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting, CompareMethod=self.CompareMaxElementVolume) hyp.SetMaxElementVolume(vol) return hyp - ## Check if the given "MaxElementVolume" hypothesis has the same parameters as given arguments + ## Checks if the given "MaxElementVolume" hypothesis has the same parameters as the given arguments def CompareMaxElementVolume(self, hyp, args): return IsEqual(hyp.GetMaxElementVolume(), args[0]) - ## Define "Netgen 3D Parameters" hypothesis + ## Defines "Netgen 3D Parameters" hypothesis + # @ingroup l3_hypos_netgen def Parameters(self): + if self.params: + return self.params if (self.algoType == FULL_NETGEN): self.params = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so", UseExisting=0) return self.params - else: - print "Algo doesn't support this hypothesis" - return None + if (self.algoType == GHS3D): + self.params = self.Hypothesis("GHS3D_Parameters", [], + "libGHS3DEngine.so", UseExisting=0) + return self.params + + print "Algo doesn't support this hypothesis" + return None - ## Set MaxSize + ## Sets MaxSize + # Parameter of FULL_NETGEN + # @ingroup l3_hypos_netgen def SetMaxSize(self, theSize): - if self.params == 0: - self.Parameters() - self.params.SetMaxSize(theSize) + self.Parameters().SetMaxSize(theSize) - ## Set SecondOrder flag + ## Sets SecondOrder flag + # Parameter of FULL_NETGEN + # @ingroup l3_hypos_netgen def SetSecondOrder(self, theVal): - if self.params == 0: - self.Parameters() - self.params.SetSecondOrder(theVal) + self.Parameters().SetSecondOrder(theVal) - ## Set Optimize flag + ## Sets Optimize flag + # Parameter of FULL_NETGEN + # @ingroup l3_hypos_netgen def SetOptimize(self, theVal): - if self.params == 0: - self.Parameters() - self.params.SetOptimize(theVal) + self.Parameters().SetOptimize(theVal) - ## Set Fineness + ## Sets Fineness # @param theFineness is: # VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom + # Parameter of FULL_NETGEN + # @ingroup l3_hypos_netgen def SetFineness(self, theFineness): - if self.params == 0: - self.Parameters() - self.params.SetFineness(theFineness) + self.Parameters().SetFineness(theFineness) - ## Set GrowthRate + ## Sets GrowthRate + # Parameter of FULL_NETGEN + # @ingroup l3_hypos_netgen def SetGrowthRate(self, theRate): - if self.params == 0: - self.Parameters() - self.params.SetGrowthRate(theRate) + self.Parameters().SetGrowthRate(theRate) - ## Set NbSegPerEdge + ## Sets NbSegPerEdge + # Parameter of FULL_NETGEN + # @ingroup l3_hypos_netgen def SetNbSegPerEdge(self, theVal): - if self.params == 0: - self.Parameters() - self.params.SetNbSegPerEdge(theVal) + self.Parameters().SetNbSegPerEdge(theVal) - ## Set NbSegPerRadius + ## Sets NbSegPerRadius + # Parameter of FULL_NETGEN + # @ingroup l3_hypos_netgen def SetNbSegPerRadius(self, theVal): - if self.params == 0: - self.Parameters() - self.params.SetNbSegPerRadius(theVal) + self.Parameters().SetNbSegPerRadius(theVal) + + ## To mesh "holes" in a solid or not. Default is to mesh. + # @ingroup l3_hypos_ghs3dh + def SetToMeshHoles(self, toMesh): + # Parameter of GHS3D + self.Parameters().SetToMeshHoles(toMesh) + + ## Set Optimization level: + # None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization. + # Default is Medium_Optimization + # @ingroup l3_hypos_ghs3dh + def SetOptimizationLevel(self, level): + # Parameter of GHS3D + self.Parameters().SetOptimizationLevel(level) + + ## Maximal size of memory to be used by the algorithm (in Megabytes). + # @ingroup l3_hypos_ghs3dh + def SetMaximumMemory(self, MB): + # Advanced parameter of GHS3D + self.Parameters().SetMaximumMemory(MB) + + ## Initial size of memory to be used by the algorithm (in Megabytes) in + # automatic memory adjustment mode. + # @ingroup l3_hypos_ghs3dh + def SetInitialMemory(self, MB): + # Advanced parameter of GHS3D + self.Parameters().SetInitialMemory(MB) + + ## Path to working directory. + # @ingroup l3_hypos_ghs3dh + def SetWorkingDirectory(self, path): + # Advanced parameter of GHS3D + self.Parameters().SetWorkingDirectory(path) + + ## To keep working files or remove them. Log file remains in case of errors anyway. + # @ingroup l3_hypos_ghs3dh + def SetKeepFiles(self, toKeep): + # Advanced parameter of GHS3D + self.Parameters().SetKeepFiles(toKeep) + + ## To set verbose level [0-10].
      + #
    • 0 - no standard output, + #
    • 2 - prints the data, quality statistics of the skin and final meshes and + # indicates when the final mesh is being saved. In addition the software + # gives indication regarding the CPU time. + #
    • 10 - same as 2 plus the main steps in the computation, quality statistics + # histogram of the skin mesh, quality statistics histogram together with + # the characteristics of the final mesh.
    + # @ingroup l3_hypos_ghs3dh + def SetVerboseLevel(self, level): + # Advanced parameter of GHS3D + self.Parameters().SetVerboseLevel(level) + + ## To create new nodes. + # @ingroup l3_hypos_ghs3dh + def SetToCreateNewNodes(self, toCreate): + # Advanced parameter of GHS3D + self.Parameters().SetToCreateNewNodes(toCreate) + + ## To use boundary recovery version which tries to create mesh on a very poor + # quality surface mesh. + # @ingroup l3_hypos_ghs3dh + def SetToUseBoundaryRecoveryVersion(self, toUse): + # Advanced parameter of GHS3D + self.Parameters().SetToUseBoundaryRecoveryVersion(toUse) + + ## Sets command line option as text. + # @ingroup l3_hypos_ghs3dh + def SetTextOption(self, option): + # Advanced parameter of GHS3D + self.Parameters().SetTextOption(option) # Public class: Mesh_Hexahedron # ------------------------------ -## Class to define a hexahedron 3D algorithm +## Defines a hexahedron 3D algorithm # -# More details. +# @ingroup l3_algos_basic class Mesh_Hexahedron(Mesh_Algorithm): params = 0 @@ -3197,7 +3633,8 @@ class Mesh_Hexahedron(Mesh_Algorithm): self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so") pass - ## Define "MinMaxQuad" hypothesis to give the three hexotic parameters + ## Defines "MinMaxQuad" hypothesis to give three hexotic parameters + # @ingroup l3_hypos_hexotic def MinMaxQuad(self, min=3, max=8, quad=True): self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so", UseExisting=0) @@ -3210,12 +3647,13 @@ class Mesh_Hexahedron(Mesh_Algorithm): # Public class: Mesh_Netgen # ------------------------------ -## Class to define a NETGEN-based 2D or 3D algorithm -# that need no discrete boundary (i.e. independent) +## Defines a NETGEN-based 2D or 3D algorithm +# that needs no discrete boundary (i.e. independent) # # This class is deprecated, only for compatibility! # # More details. +# @ingroup l3_algos_basic class Mesh_Netgen(Mesh_Algorithm): is3D = 0 @@ -3236,7 +3674,7 @@ class Mesh_Netgen(Mesh_Algorithm): self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so") pass - ## Define hypothesis containing parameters of the algorithm + ## Defines the hypothesis containing parameters of the algorithm def Parameters(self): if self.is3D: hyp = self.Hypothesis("NETGEN_Parameters", [], @@ -3249,25 +3687,26 @@ class Mesh_Netgen(Mesh_Algorithm): # Public class: Mesh_Projection1D # ------------------------------ -## Class to define a projection 1D algorithm +## Defines a projection 1D algorithm +# @ingroup l3_algos_proj # -# More details. class Mesh_Projection1D(Mesh_Algorithm): + ## Private constructor. def __init__(self, mesh, geom=0): Mesh_Algorithm.__init__(self) self.Create(mesh, geom, "Projection_1D") - ## Define "Source Edge" hypothesis, specifying a meshed edge to - # take a mesh pattern from, and optionally association of vertices - # between the source edge and a target one (where a hipothesis is assigned to) - # @param edge to take nodes distribution from - # @param mesh to take nodes distribution from (optional) - # @param srcV is vertex of \a edge to associate with \a tgtV (optional) - # @param tgtV is vertex of \a the edge where the algorithm is assigned, + ## Defines "Source Edge" hypothesis, specifying a meshed edge, from where + # a mesh pattern is taken, and, optionally, the association of vertices + # between the source edge and a target edge (to which a hypothesis is assigned) + # @param edge from which nodes distribution is taken + # @param mesh from which nodes distribution is taken (optional) + # @param srcV a vertex of \a edge to associate with \a tgtV (optional) + # @param tgtV a vertex of \a the edge to which the algorithm is assigned, # to associate with \a srcV (optional) - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param UseExisting if ==true - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0): hyp = self.Hypothesis("ProjectionSource1D", [edge,mesh,srcV,tgtV], UseExisting=0) @@ -3279,39 +3718,40 @@ class Mesh_Projection1D(Mesh_Algorithm): hyp.SetVertexAssociation( srcV, tgtV ) return hyp - ## Check if the given "SourceEdge" hypothesis has the same parameters as given arguments + ## Checks if the given "SourceEdge" hypothesis has the same parameters as the given arguments #def CompareSourceEdge(self, hyp, args): - # # seems to be not really useful to reuse existing "SourceEdge" hypothesis + # # it does not seem to be useful to reuse the existing "SourceEdge" hypothesis # return False # Public class: Mesh_Projection2D # ------------------------------ -## Class to define a projection 2D algorithm +## Defines a projection 2D algorithm +# @ingroup l3_algos_proj # -# More details. class Mesh_Projection2D(Mesh_Algorithm): ## Private constructor. def __init__(self, mesh, geom=0): Mesh_Algorithm.__init__(self) self.Create(mesh, geom, "Projection_2D") - ## Define "Source Face" hypothesis, specifying a meshed face to - # take a mesh pattern from, and optionally association of vertices - # between the source face and a target one (where a hipothesis is assigned to) - # @param face to take mesh pattern from - # @param mesh to take mesh pattern from (optional) - # @param srcV1 is vertex of \a face to associate with \a tgtV1 (optional) - # @param tgtV1 is vertex of \a the face where the algorithm is assigned, - # to associate with \a srcV1 (optional) - # @param srcV2 is vertex of \a face to associate with \a tgtV1 (optional) - # @param tgtV2 is vertex of \a the face where the algorithm is assigned, - # to associate with \a srcV2 (optional) - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + + ## Defines "Source Face" hypothesis, specifying a meshed face, from where + # a mesh pattern is taken, and, optionally, the association of vertices + # between the source face and the target face (to which a hypothesis is assigned) + # @param face from which the mesh pattern is taken + # @param mesh from which the mesh pattern is taken (optional) + # @param srcV1 a vertex of \a face to associate with \a tgtV1 (optional) + # @param tgtV1 a vertex of \a the face to which the algorithm is assigned, + # to associate with \a srcV1 (optional) + # @param srcV2 a vertex of \a face to associate with \a tgtV1 (optional) + # @param tgtV2 a vertex of \a the face to which the algorithm is assigned, + # to associate with \a srcV2 (optional) + # @param UseExisting if ==true - forces the search for the existing hypothesis created with + # the same parameters, else (default) - forces the creation a new one # - # Note: association vertices must belong to one edge of a face + # Note: all association vertices must belong to one edge of a face def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None, srcV2=None, tgtV2=None, UseExisting=0): hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2], @@ -3324,17 +3764,17 @@ class Mesh_Projection2D(Mesh_Algorithm): hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 ) return hyp - ## Check if the given "SourceFace" hypothesis has the same parameters as given arguments + ## Checks if the given "SourceFace" hypothesis has the same parameters as the given arguments #def CompareSourceFace(self, hyp, args): - # # seems to be not really useful to reuse existing "SourceFace" hypothesis + # # it does not seem to be useful to reuse the existing "SourceFace" hypothesis # return False # Public class: Mesh_Projection3D # ------------------------------ -## Class to define a projection 3D algorithm +## Defines a projection 3D algorithm +# @ingroup l3_algos_proj # -# More details. class Mesh_Projection3D(Mesh_Algorithm): ## Private constructor. @@ -3342,19 +3782,19 @@ class Mesh_Projection3D(Mesh_Algorithm): Mesh_Algorithm.__init__(self) self.Create(mesh, geom, "Projection_3D") - ## Define "Source Shape 3D" hypothesis, specifying a meshed solid to - # take a mesh pattern from, and optionally association of vertices - # between the source solid and a target one (where a hipothesis is assigned to) - # @param solid to take mesh pattern from - # @param mesh to take mesh pattern from (optional) - # @param srcV1 is vertex of \a solid to associate with \a tgtV1 (optional) - # @param tgtV1 is vertex of \a the solid where the algorithm is assigned, + ## Defines the "Source Shape 3D" hypothesis, specifying a meshed solid, from where + # the mesh pattern is taken, and, optionally, the association of vertices + # between the source and the target solid (to which a hipothesis is assigned) + # @param solid from where the mesh pattern is taken + # @param mesh from where the mesh pattern is taken (optional) + # @param srcV1 a vertex of \a solid to associate with \a tgtV1 (optional) + # @param tgtV1 a vertex of \a the solid where the algorithm is assigned, # to associate with \a srcV1 (optional) - # @param srcV2 is vertex of \a solid to associate with \a tgtV1 (optional) - # @param tgtV2 is vertex of \a the solid where the algorithm is assigned, + # @param srcV2 a vertex of \a solid to associate with \a tgtV1 (optional) + # @param tgtV2 a vertex of \a the solid to which the algorithm is assigned, # to associate with \a srcV2 (optional) - # @param UseExisting - if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param UseExisting - if ==true - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one # # Note: association vertices must belong to one edge of a solid def SourceShape3D(self, solid, mesh=0, srcV1=0, tgtV1=0, @@ -3370,7 +3810,7 @@ class Mesh_Projection3D(Mesh_Algorithm): hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 ) return hyp - ## Check if the given "SourceShape3D" hypothesis has the same parameters as given arguments + ## Checks if the given "SourceShape3D" hypothesis has the same parameters as given arguments #def CompareSourceShape3D(self, hyp, args): # # seems to be not really useful to reuse existing "SourceShape3D" hypothesis # return False @@ -3379,9 +3819,9 @@ class Mesh_Projection3D(Mesh_Algorithm): # Public class: Mesh_Prism # ------------------------ -## Class to define a 3D extrusion algorithm +## Defines a 3D extrusion algorithm +# @ingroup l3_algos_3dextr # -# More details. class Mesh_Prism3D(Mesh_Algorithm): ## Private constructor. @@ -3392,9 +3832,9 @@ class Mesh_Prism3D(Mesh_Algorithm): # Public class: Mesh_RadialPrism # ------------------------------- -## Class to define a Radial Prism 3D algorithm +## Defines a Radial Prism 3D algorithm +# @ingroup l3_algos_radialp # -# More details. class Mesh_RadialPrism3D(Mesh_Algorithm): ## Private constructor. @@ -3409,23 +3849,24 @@ class Mesh_RadialPrism3D(Mesh_Algorithm): def Get3DHypothesis(self): return self.distribHyp - ## Private method creating 1D hypothes and storing it in the LayerDistribution - # hypothes. Returns the created hypothes + ## Private method creating a 1D hypothesis and storing it in the LayerDistribution + # hypothesis. Returns the created hypothesis def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"): #print "OwnHypothesis",hypType if not self.nbLayers is None: self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers ) self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp ) - study = self.mesh.smeshpyD.GetCurrentStudy() # prevent publishing of own 1D hypothesis + study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so) - self.mesh.smeshpyD.SetCurrentStudy( study ) # anable publishing + self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing self.distribHyp.SetLayerDistribution( hyp ) return hyp - ## Define "NumberOfLayers" hypothesis, specifying a number of layers of + ## Defines "NumberOfLayers" hypothesis, specifying the number of layers of # prisms to build between the inner and outer shells - # @param UseExisting if ==true - search existing hypothesis created with - # same parameters, else (default) - create new + # @param n number of layers + # @param UseExisting if ==true - searches for the existing hypothesis created with + # the same parameters, else (default) - creates a new one def NumberOfLayers(self, n, UseExisting=0): self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp ) self.nbLayers = self.Hypothesis("NumberOfLayers", [n], UseExisting=UseExisting, @@ -3433,24 +3874,24 @@ class Mesh_RadialPrism3D(Mesh_Algorithm): self.nbLayers.SetNumberOfLayers( n ) return self.nbLayers - ## Check if the given "NumberOfLayers" hypothesis has the same parameters as given arguments + ## Checks if the given "NumberOfLayers" hypothesis has the same parameters as the given arguments def CompareNumberOfLayers(self, hyp, args): return IsEqual(hyp.GetNumberOfLayers(), args[0]) - ## Define "LocalLength" hypothesis, specifying segment length - # to build between the inner and outer shells - # @param l for the length of segments - # @param p for the precision of rounding + ## Defines "LocalLength" hypothesis, specifying the segment length + # to build between the inner and the outer shells + # @param l the length of segments + # @param p the precision of rounding def LocalLength(self, l, p=1e-07): hyp = self.OwnHypothesis("LocalLength", [l,p]) hyp.SetLength(l) hyp.SetPrecision(p) return hyp - ## Define "NumberOfSegments" hypothesis, specifying a number of layers of - # prisms to build between the inner and outer shells - # @param n for the number of segments - # @param s for the scale factor (optional) + ## Defines "NumberOfSegments" hypothesis, specifying the number of layers of + # prisms to build between the inner and the outer shells. + # @param n the number of layers + # @param s the scale factor (optional) def NumberOfSegments(self, n, s=[]): if s == []: hyp = self.OwnHypothesis("NumberOfSegments", [n]) @@ -3461,18 +3902,18 @@ class Mesh_RadialPrism3D(Mesh_Algorithm): hyp.SetNumberOfSegments(n) return hyp - ## Define "Arithmetic1D" hypothesis, specifying distribution of segments - # to build between the inner and outer shells as arithmetic length increasing - # @param start for the length of the first segment - # @param end for the length of the last segment + ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments + # to build between the inner and the outer shells with a length that changes in arithmetic progression + # @param start the length of the first segment + # @param end the length of the last segment def Arithmetic1D(self, start, end ): hyp = self.OwnHypothesis("Arithmetic1D", [start, end]) hyp.SetLength(start, 1) hyp.SetLength(end , 0) return hyp - ## Define "StartEndLength" hypothesis, specifying distribution of segments - # to build between the inner and outer shells as geometric length increasing + ## Defines "StartEndLength" hypothesis, specifying distribution of segments + # to build between the inner and the outer shells as geometric length increasing # @param start for the length of the first segment # @param end for the length of the last segment def StartEndLength(self, start, end): @@ -3481,9 +3922,9 @@ class Mesh_RadialPrism3D(Mesh_Algorithm): hyp.SetLength(end , 0) return hyp - ## Define "AutomaticLength" hypothesis, specifying number of segments + ## Defines "AutomaticLength" hypothesis, specifying the number of segments # to build between the inner and outer shells - # @param fineness for the fineness [0-1] + # @param fineness defines the quality of the mesh within the range [0-1] def AutomaticLength(self, fineness=0): hyp = self.OwnHypothesis("AutomaticLength") hyp.SetFineness( fineness ) diff --git a/src/StdMeshers/Makefile.am b/src/StdMeshers/Makefile.am index 74d632a6f..bc886b5df 100644 --- a/src/StdMeshers/Makefile.am +++ b/src/StdMeshers/Makefile.am @@ -63,6 +63,7 @@ salomeinclude_HEADERS = \ StdMeshers_FaceSide.hxx \ StdMeshers_CompositeSegment_1D.hxx \ StdMeshers_UseExisting_1D2D.hxx \ + StdMeshers_QuadToTriaAdaptor.hxx \ SMESH_StdMeshers.hxx # Libraries targets @@ -104,7 +105,8 @@ dist_libStdMeshers_la_SOURCES = \ StdMeshers_SegmentLengthAroundVertex.cxx \ StdMeshers_FaceSide.cxx \ StdMeshers_CompositeSegment_1D.cxx \ - StdMeshers_UseExisting_1D2D.cxx + StdMeshers_UseExisting_1D2D.cxx \ + StdMeshers_QuadToTriaAdaptor.cxx # additionnal information to compil and link file diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index eccc3f5af..d0ec9bcb5 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -217,9 +217,9 @@ const vector& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst, #ifdef _DEBUG_ if ( normPar > 1 || normPar < 0) { dump("DEBUG"); - cout << "WRONG normPar: "<()<() - << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() << endl; + MESSAGE_ADD ( "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->() + << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() ); + } + MESSAGE_ADD ( "\tC2d: "); + + if (myC2d[i].IsNull()) { + MESSAGE_ADD ( "NULL" ); + } + else { + MESSAGE_ADD ( myC2d[i].operator->() ); } - cout << "\tC2d: "; - if (myC2d[i].IsNull()) cout<<"NULL"<()<uv_grid[ij].u, quad->uv_grid[ij].v ); + double dist = uv.SquareDistance( uv2 ); + if ( dist < minDist ) { + minDist = dist; + return true; + } + return false; +} + //======================================================================= //function : findIJ //purpose : return i,j of the node @@ -136,26 +155,41 @@ bool StdMeshers_Hexa_3D::CheckHypothesis static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int& I, int& J) { - I = J = 0; const SMDS_FacePosition* fpos = static_cast(node->GetPosition().get()); if ( ! fpos ) return false; gp_Pnt2d uv( fpos->GetUParameter(), fpos->GetVParameter() ); double minDist = DBL_MAX; - int nbhoriz = Min(quad->side[0]->NbPoints(), quad->side[2]->NbPoints()); - int nbvertic = Min(quad->side[1]->NbPoints(), quad->side[3]->NbPoints()); - for (int i = 1; i < nbhoriz - 1; i++) { - for (int j = 1; j < nbvertic - 1; j++) { - int ij = j * nbhoriz + i; - gp_Pnt2d uv2( quad->uv_grid[ij].u, quad->uv_grid[ij].v ); - double dist = uv.SquareDistance( uv2 ); - if ( dist < minDist ) { - minDist = dist; - I = i; - J = j; - } - } + const int nbhoriz = quad->side[0]->NbPoints(); + const int nbvertic = quad->side[1]->NbPoints(); + I = nbhoriz/2; J = nbvertic/2; + int oldI, oldJ; + do { + oldI = I; oldJ = J; + while ( I + 2 < nbhoriz && isCloser( I + 1, J, nbhoriz, quad, uv, minDist )) + I += 1; + if ( I == oldI ) + while ( I - 1 > 0 && isCloser( I - 1, J, nbhoriz, quad, uv, minDist )) + I -= 1; + if ( minDist < DBL_MIN ) + break; + + while ( J + 2 < nbvertic && isCloser( I, J + 1, nbhoriz, quad, uv, minDist )) + J += 1; + if ( J == oldJ ) + while ( J - 1 > 0 && isCloser( I, J - 1, nbhoriz, quad, uv, minDist )) + J -= 1; + if ( minDist < DBL_MIN ) + break; + + } while ( I != oldI || J != oldJ ); + + if ( minDist > DBL_MIN ) { + for (int i = 1; i < nbhoriz - 1; i++) + for (int j = 1; j < nbvertic - 1; j++) + if ( isCloser( i, j, nbhoriz, quad, uv, minDist )) + I = i, J = j; } return true; } diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index 6307f167e..18a60adbc 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -500,7 +500,8 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector & wires, const vector& uvPtVec = wires[ iW ]->GetUVPtStruct(); if ( uvPtVec.size() != wires[ iW ]->NbPoints() ) { return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Unexpected nb of points on wire ") - << iW << uvPtVec.size()<<" != "<NbPoints()); + << iW << ": " << uvPtVec.size()<<" != "<NbPoints() + << ", probably because of invalid node parameters on geom edges"); } if ( m + uvPtVec.size()-1 > mefistoToDS.size() ) { MESSAGE("Wrong mefistoToDS.size: "<GetAncestors(E); + TopTools_ListIteratorOfListOfShape itea(EAncestors); + for(; itea.More(); itea.Next()) { + if( itea.Value().ShapeType() != TopAbs_FACE ) continue; + TopoDS_Face face = TopoDS::Face(itea.Value()); + for(TopExp_Explorer expf(theShape1, TopAbs_FACE); expf.More(); expf.Next() ) { + if(face.IsSame(expf.Current())) { + NbFacesFromShape1++; + break; + } + } + } + if(NbFacesFromShape1==1) break; + } + // find association for vertices of edge E + TopoDS_Vertex VV1[2], VV2[2]; + for(TopExp_Explorer eexp(E, TopAbs_VERTEX); eexp.More(); eexp.Next()) { + TopoDS_Vertex V1 = TopoDS::Vertex( eexp.Current() ); + // look for an edge ending in E whose one vertex is in theShape1 + // and the other, in theShape2 + const TopTools_ListOfShape& Ancestors = theMesh1->GetAncestors(V1); + TopTools_ListIteratorOfListOfShape ita(Ancestors); + for(; ita.More(); ita.Next()) { + if( ita.Value().ShapeType() != TopAbs_EDGE ) continue; + TopoDS_Edge edge = TopoDS::Edge(ita.Value()); + bool FromShape1 = false; + for(TopExp_Explorer expe(theShape1, TopAbs_EDGE); expe.More(); expe.Next() ) { + if(edge.IsSame(expe.Current())) { + FromShape1 = true; + break; + } + } + if(!FromShape1) { + // is it an edge between theShape1 and theShape2? + TopExp_Explorer expv(edge, TopAbs_VERTEX); + TopoDS_Vertex V2 = TopoDS::Vertex( expv.Current() ); + if(V2.IsSame(V1)) { + expv.Next(); + V2 = TopoDS::Vertex( expv.Current() ); + } + bool FromShape2 = false; + for ( expv.Init( theShape2, TopAbs_VERTEX ); expv.More(); expv.Next()) { + if ( V2.IsSame( expv.Current() )) { + FromShape2 = true; + break; + } + } + if ( FromShape2 ) { + if ( VV1[0].IsNull() ) + VV1[0] = V1, VV2[0] = V2; + else + VV1[1] = V1, VV2[1] = V2; + break; // from loop on ancestors of V1 + } + } + } + } + if ( !VV1[1].IsNull() ) { + InsertAssociation( VV1[0], VV2[0], theMap, bidirect); + InsertAssociation( VV1[1], VV2[1], theMap, bidirect); + return FindSubShapeAssociation( theShape1, theMesh1, theShape2, theMesh2, theMap); + } + } + break; // try by vertex closeness + } default:; } diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 0ac6f9ea4..a31487eef 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -47,6 +47,7 @@ #include "utilities.h" #include +#include #include #include #include @@ -369,7 +370,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& if ( !_sourceHypo ) return false; - SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh(); + SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh(); SMESH_Mesh * tgtMesh = & theMesh; if ( !srcMesh ) srcMesh = tgtMesh; @@ -412,9 +413,28 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& // Prepare to mapping // -------------------- + SMESH_MesherHelper helper( theMesh ); + helper.SetSubShape( tgtFace ); + + // Check if node projection to a face is needed + Bnd_B2d uvBox; + SMDS_ElemIteratorPtr faceIt = srcSubMesh->GetSubMeshDS()->GetElements(); + for ( int nbN = 0; nbN < 3 && faceIt->more(); ) { + const SMDS_MeshElement* face = faceIt->next(); + SMDS_ElemIteratorPtr nodeIt = face->nodesIterator(); + while ( nodeIt->more() ) { + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) { + nbN++; + uvBox.Add( helper.GetNodeUV( srcFace, node )); + } + } + } + const bool toProjectNodes = ( uvBox.IsVoid() || uvBox.SquareExtent() < DBL_MIN ); + // Load pattern from the source face SMESH_Pattern mapper; - mapper.Load( srcMesh, srcFace ); + mapper.Load( srcMesh, srcFace, toProjectNodes ); if ( mapper.GetErrorCode() != SMESH_Pattern::ERR_OK ) return error(COMPERR_BAD_INPUT_MESH,"Can't load mesh pattern from the source face"); @@ -484,9 +504,6 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& SMESH_MeshEditor editor( tgtMesh ); SMESH_MeshEditor::TListOfListOfNodes groupsOfNodes; - SMESH_MesherHelper helper( theMesh ); - helper.SetSubShape( tgtFace ); - // Make groups of nodes to merge // loop on edge and vertex submeshes of a target face @@ -571,7 +588,11 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& // Merge + int nbFaceBeforeMerge = tgtSubMesh->GetSubMeshDS()->NbElements(); editor.MergeNodes( groupsOfNodes ); + int nbFaceAtferMerge = tgtSubMesh->GetSubMeshDS()->NbElements(); + if ( nbFaceBeforeMerge != nbFaceAtferMerge ) + return error(COMPERR_BAD_INPUT_MESH, "Probably invalid node parameters on geom faces"); // --------------------------- // Check elements orientation diff --git a/src/StdMeshers/StdMeshers_Propagation.cxx b/src/StdMeshers/StdMeshers_Propagation.cxx index 64ff66f35..b442e6d79 100644 --- a/src/StdMeshers/StdMeshers_Propagation.cxx +++ b/src/StdMeshers/StdMeshers_Propagation.cxx @@ -543,8 +543,9 @@ namespace { // clear propagation chain clearPropagationChain( subMesh ); } - return; - case SMESH_subMesh::MODIF_HYP: // hyp modif + // return; -- hyp is modified any way + default: + //case SMESH_subMesh::MODIF_HYP: // hyp modif // clear mesh in a chain DBGMSG( "MODIF_HYP on HAS_PROPAG_HYP " << subMesh->GetId() ); SMESH_subMeshIteratorPtr smIt = data->GetChain(); diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx new file mode 100644 index 000000000..3892ddc9b --- /dev/null +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -0,0 +1,1164 @@ +// SMESH SMESH : implementaion of SMESH idl descriptions +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : StdMeshers_QuadToTriaAdaptor.cxx +// Module : SMESH +// Created : Wen May 07 16:37:07 2008 +// Author : Sergey KUUL (skl) + + +#include "StdMeshers_QuadToTriaAdaptor.hxx" + +//#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +typedef NCollection_Array1 StdMeshers_Array1OfSequenceOfInteger; + + +//======================================================================= +//function : StdMeshers_QuadToTriaAdaptor +//purpose : +//======================================================================= + +StdMeshers_QuadToTriaAdaptor::StdMeshers_QuadToTriaAdaptor() +{ +} + + +//================================================================================ +/*! + * \brief Destructor + */ +//================================================================================ + +StdMeshers_QuadToTriaAdaptor::~StdMeshers_QuadToTriaAdaptor() +{} + + +//======================================================================= +//function : FindBestPoint +//purpose : Auxilare for Compute() +// V - normal to (P1,P2,PC) +//======================================================================= +static gp_Pnt FindBestPoint(const gp_Pnt& P1, const gp_Pnt& P2, + const gp_Pnt& PC, const gp_Vec& V) +{ + double a = P1.Distance(P2); + double b = P1.Distance(PC); + double c = P2.Distance(PC); + if( a < (b+c)/2 ) + return PC; + else { + // find shift along V in order to a became equal to (b+c)/2 + double shift = sqrt( a*a + (b*b-c*c)*(b*b-c*c)/16/a/a - (b*b+c*c)/2 ); + gp_Dir aDir(V); + gp_Pnt Pbest( PC.X() + aDir.X()*shift, PC.Y() + aDir.Y()*shift, + PC.Z() + aDir.Z()*shift ); + return Pbest; + } +} + + +//======================================================================= +//function : HasIntersection3 +//purpose : Auxilare for HasIntersection() +// find intersection point between triangle (P1,P2,P3) +// and segment [PC,P] +//======================================================================= +static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint, + const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3) +{ + //cout<<"HasIntersection3"< preci ) || + ( (PC.Y()-PIn.Y())*(P.Y()-PIn.Y()) > preci ) || + ( (PC.Z()-PIn.Z())*(P.Z()-PIn.Z()) > preci ); + if(IsExternal) { + return false; + } + // check if this point is internal for triangle (P1,P2,P3) + gp_Vec V1(PIn,P1); + gp_Vec V2(PIn,P2); + gp_Vec V3(PIn,P3); + if( V1.Magnitude()Length()==3) { + return HasIntersection3( P, PC, Pint, aContour->Value(1), + aContour->Value(2), aContour->Value(3) ); + } + else { + bool check = false; + if( (aContour->Value(1).Distance(aContour->Value(2)) > 1.e-6) && + (aContour->Value(1).Distance(aContour->Value(3)) > 1.e-6) && + (aContour->Value(2).Distance(aContour->Value(3)) > 1.e-6) ) { + check = HasIntersection3( P, PC, Pint, aContour->Value(1), + aContour->Value(2), aContour->Value(3) ); + } + if(check) return true; + if( (aContour->Value(1).Distance(aContour->Value(4)) > 1.e-6) && + (aContour->Value(1).Distance(aContour->Value(3)) > 1.e-6) && + (aContour->Value(4).Distance(aContour->Value(3)) > 1.e-6) ) { + check = HasIntersection3( P, PC, Pint, aContour->Value(1), + aContour->Value(3), aContour->Value(4) ); + } + if(check) return true; + } + + return false; +} + + +//======================================================================= +//function : CheckIntersection +//purpose : Auxilare for Compute() +// NotCheckedFace - for optimization +//======================================================================= +bool StdMeshers_QuadToTriaAdaptor::CheckIntersection + (const gp_Pnt& P, const gp_Pnt& PC, + gp_Pnt& Pint, SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + const TopoDS_Shape& NotCheckedFace) +{ + SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); + //cout<<" CheckIntersection: meshDS->NbFaces() = "<NbFaces()<MeshElements(aShapeFace); + if ( aSubMeshDSFace ) { + SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); + while ( iteratorElem->more() ) { // loop on elements on a face + const SMDS_MeshElement* face = iteratorElem->next(); + Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt; + SMDS_ElemIteratorPtr nodeIt = face->nodesIterator(); + if( !face->IsQuadratic() ) { + while ( nodeIt->more() ) { + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); + } + } + else { + int nn = 0; + while ( nodeIt->more() ) { + nn++; + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); + if(nn==face->NbNodes()/2) break; + } + } + if( HasIntersection(P, PC, Pres, aContour) ) { + res = true; + double tmp = PC.Distance(Pres); + if(tmpnodesIterator(); + const SMDS_MeshNode* Ns1[3]; + int k = 0; + while( nIt->more() ) { + Ns1[k] = static_cast( nIt->next() ); + k++; + } + nIt = F2->nodesIterator(); + const SMDS_MeshNode* Ns2[3]; + k = 0; + while( nIt->more() ) { + Ns2[k] = static_cast( nIt->next() ); + k++; + } + if( ( Ns1[1]==Ns2[1] && Ns1[2]==Ns2[2] ) || + ( Ns1[1]==Ns2[2] && Ns1[2]==Ns2[1] ) ) + return true; + return false; +} + + +//======================================================================= +//function : IsDegenarate +//purpose : Auxilare for Preparation() +//======================================================================= +static int IsDegenarate(const Handle(TColgp_HArray1OfPnt)& PN) +{ + int i = 1; + for(; i<4; i++) { + int j = i+1; + for(; j<=4; j++) { + if( PN->Value(i).Distance(PN->Value(j)) < 1.e-6 ) + return j; + } + } + return 0; +} + + +//======================================================================= +//function : Preparation +//purpose : Auxilare for Compute() +// : Return 0 if given face is not quad, +// 1 if given face is quad, +// 2 if given face is degenerate quad (two nodes are coincided) +//======================================================================= +int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face, + Handle(TColgp_HArray1OfPnt) PN, + Handle(TColgp_HArray1OfVec) VN, + std::vector& FNodes, + gp_Pnt& PC, gp_Vec& VNorm) +{ + int i = 0; + double xc=0., yc=0., zc=0.; + SMDS_ElemIteratorPtr nodeIt = face->nodesIterator(); + if( !face->IsQuadratic() ) { + if( face->NbNodes() != 4 ) + return 0; + while ( nodeIt->more() ) { + i++; + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + FNodes[i-1] = node; + PN->SetValue( i, gp_Pnt(node->X(), node->Y(), node->Z()) ); + xc += node->X(); + yc += node->Y(); + zc += node->Z(); + } + } + else { + if( face->NbNodes() != 8) + return 0; + while ( nodeIt->more() ) { + i++; + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + FNodes[i-1] = node; + PN->SetValue( i, gp_Pnt(node->X(), node->Y(), node->Z()) ); + xc += node->X(); + yc += node->Y(); + zc += node->Z(); + if(i==4) break; + } + } + + int nbp = 4; + + int j = 0; + for(i=1; i<4; i++) { + j = i+1; + for(; j<=4; j++) { + if( PN->Value(i).Distance(PN->Value(j)) < 1.e-6 ) + break; + } + if(j<=4) break; + } + //int deg_num = IsDegenarate(PN); + //if(deg_num>0) { + bool hasdeg = false; + if(i<4) { + //cout<<"find degeneration"<Value(i); + + std::list< const SMDS_MeshNode* >::iterator itdg = myDegNodes.begin(); + const SMDS_MeshNode* DegNode = 0; + for(; itdg!=myDegNodes.end(); itdg++) { + const SMDS_MeshNode* N = (*itdg); + gp_Pnt Ptmp(N->X(),N->Y(),N->Z()); + if(Pdeg.Distance(Ptmp)<1.e-6) { + DegNode = N; + //DegNode = const_cast(N); + break; + } + } + if(!DegNode) { + DegNode = FNodes[i-1]; + myDegNodes.push_back(DegNode); + } + else { + FNodes[i-1] = DegNode; + } + for(i=j; i<4; i++) { + PN->SetValue(i,PN->Value(i+1)); + FNodes[i-1] = FNodes[i]; + } + nbp = 3; + //PC = gp_Pnt( PN->Value(1).X() + PN.Value + } + + PC = gp_Pnt(xc/4., yc/4., zc/4.); + //cout<<" PC("<SetValue(5,PN->Value(1)); + PN->SetValue(nbp+1,PN->Value(1)); + //FNodes[4] = FNodes[0]; + FNodes[nbp] = FNodes[0]; + // find normal direction + //gp_Vec V1(PC,PN->Value(4)); + gp_Vec V1(PC,PN->Value(nbp)); + gp_Vec V2(PC,PN->Value(1)); + VNorm = V1.Crossed(V2); + //VN->SetValue(4,VNorm); + VN->SetValue(nbp,VNorm); + //for(i=1; i<4; i++) { + for(i=1; iValue(i)); + V2 = gp_Vec(PC,PN->Value(i+1)); + gp_Vec Vtmp = V1.Crossed(V2); + VN->SetValue(i,Vtmp); + VNorm += Vtmp; + } + //cout<<" VNorm("<MeshElements( aShapeFace ); + if ( aSubMeshDSFace ) { + bool isRev = SMESH_Algo::IsReversedSubMesh( TopoDS::Face(aShapeFace), meshDS ); + + SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); + while ( iteratorElem->more() ) { // loop on elements on a face + const SMDS_MeshElement* face = iteratorElem->next(); + //cout<GetID() = "<GetID()< FNodes(5); + gp_Pnt PC; + gp_Vec VNorm; + int stat = Preparation(face, PN, VN, FNodes, PC, VNorm); + if(stat==0) + continue; + + if(stat==2) { + // degenerate face + // add triangles to result map + std::list aList; + SMDS_FaceOfNodes* NewFace; + if(!isRev) + NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[1], FNodes[2] ); + else + NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[2], FNodes[1] ); + aList.push_back(NewFace); + myResMap.insert(make_pair(face,aList)); + continue; + } + + if(!isRev) VNorm.Reverse(); + double xc = 0., yc = 0., zc = 0.; + int i = 1; + for(; i<=4; i++) { + gp_Pnt Pbest; + if(!isRev) + Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i).Reversed()); + else + Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i)); + xc += Pbest.X(); + yc += Pbest.Y(); + zc += Pbest.Z(); + } + gp_Pnt PCbest(xc/4., yc/4., zc/4.); + + // check PCbest + double height = PCbest.Distance(PC); + if(height<1.e-6) { + // create new PCbest using a bit shift along VNorm + PCbest = gp_Pnt( PC.X() + VNorm.X()*0.001, + PC.Y() + VNorm.Y()*0.001, + PC.Z() + VNorm.Z()*0.001); + } + else { + // check possible intersection with other faces + gp_Pnt Pint; + bool check = CheckIntersection(PCbest, PC, Pint, aMesh, aShape, aShapeFace); + if(check) { + //cout<<"--PC("<AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() ); + // add triangles to result map + std::list aList; + for(i=0; i<4; i++) { + SMDS_FaceOfNodes* NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] ); + aList.push_back(NewFace); + } + myResMap.insert(make_pair(face,aList)); + // create pyramid + SMDS_MeshVolume* aPyram = + meshDS->AddVolume( FNodes[0], FNodes[1], FNodes[2], FNodes[3], NewNode ); + myMapFPyram.insert(make_pair(face,aPyram)); + } // end loop on elements on a face + } + } // end for(TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) { + + return Compute2ndPart(aMesh); +} + + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= + +bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh) +{ + myResMap.clear(); + myMapFPyram.clear(); + + SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); + + SMDS_FaceIteratorPtr itFace = meshDS->facesIterator(); + + while(itFace->more()) { + const SMDS_MeshElement* face = itFace->next(); + if ( !face ) continue; + //cout<GetID() = "<GetID()< FNodes(5); + gp_Pnt PC; + gp_Vec VNorm; + + int stat = Preparation(face, PN, VN, FNodes, PC, VNorm); + if(stat==0) + continue; + + if(stat==2) { + // degenerate face + // add triangles to result map + std::list aList; + SMDS_FaceOfNodes* NewFace; + // check orientation + + double tmp = PN->Value(1).Distance(PN->Value(2)) + + PN->Value(2).Distance(PN->Value(3)); + gp_Dir tmpDir(VNorm); + gp_Pnt Ptmp1( PC.X() + tmpDir.X()*tmp*1.e6, + PC.Y() + tmpDir.Y()*tmp*1.e6, + PC.Z() + tmpDir.Z()*tmp*1.e6 ); + gp_Pnt Ptmp2( PC.X() + tmpDir.Reversed().X()*tmp*1.e6, + PC.Y() + tmpDir.Reversed().Y()*tmp*1.e6, + PC.Z() + tmpDir.Reversed().Z()*tmp*1.e6 ); + // check intersection for Ptmp1 and Ptmp2 + bool IsRev = false; + bool IsOK1 = false; + bool IsOK2 = false; + double dist1 = RealLast(); + double dist2 = RealLast(); + gp_Pnt Pres1,Pres2; + SMDS_FaceIteratorPtr itf = meshDS->facesIterator(); + while(itf->more()) { + const SMDS_MeshElement* F = itf->next(); + if(F==face) continue; + Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt; + SMDS_ElemIteratorPtr nodeIt = F->nodesIterator(); + if( !F->IsQuadratic() ) { + while ( nodeIt->more() ) { + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); + } + } + else { + int nn = 0; + while ( nodeIt->more() ) { + nn++; + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); + if(nn==face->NbNodes()/2) break; + } + } + gp_Pnt PPP; + if( HasIntersection(Ptmp1, PC, PPP, aContour) ) { + IsOK1 = true; + double tmp = PC.Distance(PPP); + if(tmpValue(i), PN->Value(i+1), PC, VN->Value(i)); + xc += Pbest.X(); + yc += Pbest.Y(); + zc += Pbest.Z(); + } + gp_Pnt PCbest(xc/4., yc/4., zc/4.); + double height = PCbest.Distance(PC); + if(height<1.e-6) { + // create new PCbest using a bit shift along VNorm + PCbest = gp_Pnt( PC.X() + VNorm.X()*0.001, + PC.Y() + VNorm.Y()*0.001, + PC.Z() + VNorm.Z()*0.001); + height = PCbest.Distance(PC); + } + //cout<<" PCbest("<Value(1).Distance(PN->Value(3)) + + PN->Value(2).Distance(PN->Value(4)); + gp_Dir tmpDir(V1); + gp_Pnt Ptmp1( PC.X() + tmpDir.X()*tmp*1.e6, + PC.Y() + tmpDir.Y()*tmp*1.e6, + PC.Z() + tmpDir.Z()*tmp*1.e6 ); + gp_Pnt Ptmp2( PC.X() + tmpDir.Reversed().X()*tmp*1.e6, + PC.Y() + tmpDir.Reversed().Y()*tmp*1.e6, + PC.Z() + tmpDir.Reversed().Z()*tmp*1.e6 ); + // check intersection for Ptmp1 and Ptmp2 + bool IsRev = false; + bool IsOK1 = false; + bool IsOK2 = false; + double dist1 = RealLast(); + double dist2 = RealLast(); + gp_Pnt Pres1,Pres2; + SMDS_FaceIteratorPtr itf = meshDS->facesIterator(); + while(itf->more()) { + const SMDS_MeshElement* F = itf->next(); + if(F==face) continue; + Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt; + SMDS_ElemIteratorPtr nodeIt = F->nodesIterator(); + if( !F->IsQuadratic() ) { + while ( nodeIt->more() ) { + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); + } + } + else { + int nn = 0; + while ( nodeIt->more() ) { + nn++; + const SMDS_MeshNode* node = static_cast( nodeIt->next() ); + aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z())); + if(nn==face->NbNodes()/2) break; + } + } + gp_Pnt PPP; + if( HasIntersection(Ptmp1, PC, PPP, aContour) ) { + IsOK1 = true; + double tmp = PC.Distance(PPP); + if(tmp tmp ) { + height = tmp; + PCbest = gp_Pnt( PC.X() + tmpDir.X()*height, + PC.Y() + tmpDir.Y()*height, + PC.Z() + tmpDir.Z()*height ); + } + } + else if( !IsOK1 && IsOK2 ) { + // using opposite direction + IsRev = true; + double tmp = PC.Distance(Pres2)/3.; + if( height > tmp ) height = tmp; + PCbest = gp_Pnt( PC.X() + tmpDir.Reversed().X()*height, + PC.Y() + tmpDir.Reversed().Y()*height, + PC.Z() + tmpDir.Reversed().Z()*height ); + } + else { // IsOK1 && IsOK2 + double tmp1 = PC.Distance(Pres1)/3.; + double tmp2 = PC.Distance(Pres2)/3.; + if(tmp1 tmp1 ) { + height = tmp1; + PCbest = gp_Pnt( PC.X() + tmpDir.X()*height, + PC.Y() + tmpDir.Y()*height, + PC.Z() + tmpDir.Z()*height ); + } + } + else { + // using opposite direction + IsRev = true; + if( height > tmp2 ) height = tmp2; + PCbest = gp_Pnt( PC.X() + tmpDir.Reversed().X()*height, + PC.Y() + tmpDir.Reversed().Y()*height, + PC.Z() + tmpDir.Reversed().Z()*height ); + } + } + + // create node for PCbest + SMDS_MeshNode* NewNode = meshDS->AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() ); + // add triangles to result map + std::list aList; + for(i=0; i<4; i++) { + SMDS_FaceOfNodes* NewFace; + if(IsRev) + NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] ); + else + NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i+1], FNodes[i] ); + aList.push_back(NewFace); + } + myResMap.insert(make_pair(face,aList)); + // create pyramid + SMDS_MeshVolume* aPyram; + if(IsRev) + aPyram = meshDS->AddVolume( FNodes[0], FNodes[1], FNodes[2], FNodes[3], NewNode ); + else + aPyram = meshDS->AddVolume( FNodes[0], FNodes[3], FNodes[2], FNodes[1], NewNode ); + myMapFPyram.insert(make_pair(face,aPyram)); + } // end loop on elements on a face + + return Compute2ndPart(aMesh); +} + + +//======================================================================= +//function : Compute2ndPart +//purpose : +//======================================================================= + +bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh) +{ + SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); + + // check intersections between created pyramids + int NbPyram = myMapFPyram.size(); + //cout<<"NbPyram = "< Pyrams(NbPyram); + std::vector< const SMDS_MeshElement* > Faces(NbPyram); + std::map< const SMDS_MeshElement*, + const SMDS_MeshElement* >::iterator itp = myMapFPyram.begin(); + int i = 0; + for(; itp!=myMapFPyram.end(); itp++, i++) { + Faces[i] = (*itp).first; + Pyrams[i] = (*itp).second; + } + StdMeshers_Array1OfSequenceOfInteger MergesInfo(0,NbPyram-1); + for(i=0; inodesIterator(); + std::vector Ps1(5); + const SMDS_MeshNode* Ns1[5]; + int k = 0; + while( nIt->more() ) { + const SMDS_MeshNode* node = static_cast( nIt->next() ); + Ns1[k] = node; + Ps1[k] = gp_Pnt(node->X(), node->Y(), node->Z()); + k++; + } + bool NeedMove = false; + for(int j=i+1; jChangeElementNodes(Prm2, Ns2, 5); + // update pyramids for J + for(k=2; k<=nbJ; k++) { + const SMDS_MeshElement* tmpPrm = Pyrams[aMergesJ.Value(k)]; + SMDS_ElemIteratorPtr tmpIt = tmpPrm->nodesIterator(); + const SMDS_MeshNode* Ns[5]; + int m = 0; + while( tmpIt->more() ) { + Ns[m] = static_cast( tmpIt->next() ); + m++; + } + Ns[4] = CommonNode; + meshDS->ChangeElementNodes(tmpPrm, Ns, 5); + } + + // update MergesInfo + for(k=1; k<=nbI; k++) { + int num = aMergesI.Value(k); + const TColStd_SequenceOfInteger& aSeq = MergesInfo.Value(num); + TColStd_SequenceOfInteger tmpSeq; + int m = 1; + for(; m<=aSeq.Length(); m++) { + tmpSeq.Append(aSeq.Value(m)); + } + for(m=1; m<=nbJ; m++) { + tmpSeq.Append(aMergesJ.Value(m)); + } + MergesInfo.SetValue(num,tmpSeq); + } + for(k=1; k<=nbJ; k++) { + int num = aMergesJ.Value(k); + const TColStd_SequenceOfInteger& aSeq = MergesInfo.Value(num); + TColStd_SequenceOfInteger tmpSeq; + int m = 1; + for(; m<=aSeq.Length(); m++) { + tmpSeq.Append(aSeq.Value(m)); + } + for(m=1; m<=nbI; m++) { + tmpSeq.Append(aMergesI.Value(m)); + } + MergesInfo.SetValue(num,tmpSeq); + } + + // update triangles for aMergesJ + for(k=1; k<=nbJ; k++) { + std::list< std::list< const SMDS_MeshNode* > > aFNodes; + std::list< const SMDS_MeshElement* > aFFaces; + int num = aMergesJ.Value(k); + std::map< const SMDS_MeshElement*, + std::list >::iterator itrm = myResMap.find(Faces[num]); + std::list trias = (*itrm).second; + std::list::iterator itt = trias.begin(); + for(; itt!=trias.end(); itt++) { + int nn = -1; + SMDS_ElemIteratorPtr nodeIt = (*itt)->nodesIterator(); + const SMDS_MeshNode* NF[3]; + while ( nodeIt->more() ) { + nn++; + NF[nn] = static_cast( nodeIt->next() ); + } + NF[0] = CommonNode; + SMDS_FaceOfNodes* Ftria = const_cast< SMDS_FaceOfNodes*>( (*itt) ); + Ftria->ChangeNodes(NF, 3); + } + } + + // check and remove coincided faces + TColStd_SequenceOfInteger IdRemovedTrias; + int i1 = 1; + for(; i1<=nbI; i1++) { + int numI = aMergesI.Value(i1); + std::map< const SMDS_MeshElement*, + std::list >::iterator itrmI = myResMap.find(Faces[numI]); + std::list triasI = (*itrmI).second; + std::list::iterator ittI = triasI.begin(); + int nbfI = triasI.size(); + const SMDS_FaceOfNodes* FsI[nbfI]; + k = 0; + for(; ittI!=triasI.end(); ittI++) { + FsI[k] = (*ittI); + k++; + } + int i2 = 0; + for(; i2 >::iterator itrmJ = myResMap.find(Faces[numJ]); + std::list triasJ = (*itrmJ).second; + std::list::iterator ittJ = triasJ.begin(); + int nbfJ = triasJ.size(); + const SMDS_FaceOfNodes* FsJ[nbfJ]; + k = 0; + for(; ittJ!=triasJ.end(); ittJ++) { + FsJ[k] = (*ittJ); + k++; + } + int j2 = 0; + for(; j2GetID() ); + IdRemovedTrias.Append( FJ->GetID() ); + FsI[i2] = 0; + FsJ[j2] = 0; + std::list new_triasI; + for(k=0; k new_triasJ; + for(k=0; kRemoveNode(Nrem); + } + else { // nbc==0 + //cout<<"decrease height of pyramids"<PI/3.) + h1 = VI1.Magnitude()/2; + else + h1 = VI1.Magnitude()*cos(ang1); + if(ang2>PI/3.) + h2 = VI2.Magnitude()/2; + else + h2 = VI2.Magnitude()*cos(ang2); + double coef1 = 0.5; + if(ang1(Ns1[4]); + VN1.Scale(coef1); + aNode1->setXYZ( PC1.X()+VN1.X(), PC1.Y()+VN1.Y(), PC1.Z()+VN1.Z() ); + SMDS_MeshNode* aNode2 = const_cast(Ns2[4]); + VN2.Scale(coef2); + aNode2->setXYZ( PC2.X()+VN2.X(), PC2.Y()+VN2.Y(), PC2.Z()+VN2.Z() ); + NeedMove = true; + } + } // end if(hasInt) + else { + //cout<<" no intersec for i="<side[i]->NbEdges(); ++e ) - cout << myTool->GetMeshDS()->ShapeToIndex( quad->side[i]->Edge( e )) << " "; - cout << ")"; + MESSAGE ( myTool->GetMeshDS()->ShapeToIndex( quad->side[i]->Edge( e )) << " " ); + MESSAGE ( ")\n" ); } - cout << endl; + //cout << endl; #endif if ( !nbSides ) nbSides = nbEdgesInWire.front(); diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index b2a507433..fe7f869d3 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -624,7 +624,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, double scale = _value[ SCALE_FACTOR_IND ]; if (fabs(scale - 1.0) < Precision::Confusion()) { - // special case to avoid division on zero + // special case to avoid division by zero for (int i = 1; i < NbSegm; i++) { double param = f + (l - f) * i / NbSegm; theParams.push_back( param ); diff --git a/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx b/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx index 0ce7773ac..386b94bf9 100644 --- a/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_UseExisting_1D2D.cxx @@ -40,6 +40,7 @@ StdMeshers_UseExisting_1D::StdMeshers_UseExisting_1D { _name = "UseExisting_1D"; _shapeType = (1 << TopAbs_EDGE); // 1 bit per shape type + _requireShape = false; } //======================================================================= @@ -76,6 +77,7 @@ StdMeshers_UseExisting_2D::StdMeshers_UseExisting_2D { _name = "UseExisting_2D"; _shapeType = (1 << TopAbs_FACE); // 1 bit per shape type + _requireShape = false; } //=======================================================================