From 2daa321efae3d0c6ce41199fa5a2482630d505d9 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 8 Dec 2009 13:11:42 +0000 Subject: [PATCH] Merge from V5_1_3_BR branch (07/12/09) --- adm_local/unix/config_files/check_qwt.m4 | 15 +- .../gui/SMESH/images/hypo_quad_params_2.png | Bin 0 -> 2115 bytes .../SMESH/images/hypo_quad_params_res_2.png | Bin 0 -> 9391 bytes .../gui/SMESH/input/1d_meshing_hypo.doc | 38 +- .../gui/SMESH/input/2d_meshing_hypo.doc | 14 + doc/salome/gui/SMESH/input/about_hypo.doc | 1 + .../gui/SMESH/input/basic_meshing_algos.doc | 2 +- doc/salome/gui/SMESH/input/blsurf_hypo.doc | 38 +- .../gui/SMESH/input/building_compounds.doc | 2 + .../gui/SMESH/input/constructing_meshes.doc | 2 +- .../input/convert_to_from_quadratic_mesh.doc | 4 +- doc/salome/gui/SMESH/input/editing_groups.doc | 12 +- doc/salome/gui/SMESH/input/free_faces.doc | 9 +- doc/salome/gui/SMESH/input/free_nodes.doc | 9 +- doc/salome/gui/SMESH/input/ghs3d_hypo.doc | 38 +- .../gui/SMESH/input/grouping_elements.doc | 8 +- .../gui/SMESH/input/make_2dmesh_from_3d.doc | 16 +- doc/salome/gui/SMESH/input/mesh_infos.doc | 8 +- .../gui/SMESH/input/netgen_2d_3d_hypo.doc | 92 +- doc/salome/gui/SMESH/input/prism_3d_algo.doc | 12 +- .../input/radial_quadrangle_1D2D_algo.doc | 24 +- .../gui/SMESH/input/smeshpy_interface.doc | 207 +-- doc/salome/gui/SMESH/input/translation.doc | 8 +- .../gui/SMESH/input/tui_creating_meshes.doc | 2 +- .../SMESH/input/tui_defining_hypotheses.doc | 74 + .../gui/SMESH/input/tui_grouping_elements.doc | 8 +- .../gui/SMESH/input/tui_modifying_meshes.doc | 46 +- .../gui/SMESH/input/tui_viewing_meshes.doc | 43 +- .../SMESH/input/viewing_meshes_overview.doc | 2 +- idl/SMESH_Mesh.idl | 4 +- idl/SMESH_MeshEditor.idl | 75 +- src/Controls/SMESH_Controls.cxx | 306 ++-- src/Controls/SMESH_ControlsDef.hxx | 32 +- src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx | 3 + src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx | 3 + src/DriverDAT/Makefile.am | 1 + src/DriverMED/DriverMED_Family.cxx | 50 +- src/DriverMED/DriverMED_Family.h | 19 +- src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx | 463 +++--- src/DriverMED/DriverMED_R_SMESHDS_Mesh.h | 2 +- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 98 +- src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx | 3 + src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx | 3 + src/DriverUNV/Makefile.am | 1 + src/OBJECT/SMESH_Actor.cxx | 123 +- src/OBJECT/SMESH_Actor.h | 8 +- src/OBJECT/SMESH_ActorDef.h | 6 +- src/OBJECT/SMESH_ActorUtils.cxx | 34 +- src/OBJECT/SMESH_ActorUtils.h | 32 +- src/OBJECT/SMESH_DeviceActor.cxx | 98 +- src/OBJECT/SMESH_DeviceActor.h | 12 +- src/OBJECT/SMESH_ExtractGeometry.cxx | 6 +- src/OBJECT/SMESH_FaceOrientationFilter.cxx | 6 +- src/OBJECT/SMESH_Object.cxx | 123 +- src/OBJECT/SMESH_Object.h | 7 +- src/OBJECT/SMESH_ObjectDef.h | 2 + src/OBJECT/SMESH_PreviewActorsCollection.cxx | 38 +- src/SMESH/SMESH_Block.cxx | 3 +- src/SMESH/SMESH_Gen.cxx | 82 +- src/SMESH/SMESH_Gen.hxx | 24 +- src/SMESH/SMESH_MeshEditor.cxx | 106 +- src/SMESH/SMESH_MeshEditor.hxx | 5 +- src/SMESH/SMESH_MesherHelper.cxx | 7 +- src/SMESH/SMESH_subMesh.hxx | 1 - src/SMESHDS/SMESHDS_CommandType.hxx | 5 +- src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx | 15 +- src/SMESHGUI/SMESHGUI_ClippingDlg.cxx | 5 +- src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx | 6 +- src/SMESHGUI/SMESHGUI_FilterDlg.cxx | 8 +- src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 10 +- src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 7 +- src/SMESHGUI/SMESHGUI_VTKUtils.cxx | 3 +- src/SMESH_I/SMESH_2smeshpy.cxx | 62 +- src/SMESH_I/SMESH_2smeshpy.hxx | 2 +- src/SMESH_I/SMESH_DumpPython.cxx | 12 +- src/SMESH_I/SMESH_Filter_i.cxx | 12 +- src/SMESH_I/SMESH_Filter_i.hxx | 98 +- src/SMESH_I/SMESH_Gen_i.cxx | 21 +- src/SMESH_I/SMESH_Gen_i.hxx | 78 +- src/SMESH_I/SMESH_Group_i.cxx | 6 +- src/SMESH_I/SMESH_MEDFamily_i.cxx | 32 +- src/SMESH_I/SMESH_MEDFamily_i.hxx | 2 +- src/SMESH_I/SMESH_MEDMesh_i.cxx | 1265 +++++++++-------- src/SMESH_I/SMESH_MEDMesh_i.hxx | 36 +- src/SMESH_I/SMESH_MEDSupport_i.cxx | 302 ++-- src/SMESH_I/SMESH_MEDSupport_i.hxx | 78 +- src/SMESH_I/SMESH_MeshEditor_i.cxx | 177 ++- src/SMESH_I/SMESH_MeshEditor_i.hxx | 49 +- src/SMESH_I/SMESH_Mesh_i.cxx | 104 +- src/SMESH_I/SMESH_NoteBook.cxx | 382 ++--- src/SMESH_I/SMESH_Pattern_i.cxx | 10 +- src/SMESH_I/SMESH_PythonDump.hxx | 2 +- src/SMESH_I/SMESH_subMesh_i.cxx | 16 +- src/SMESH_I/SMESH_subMesh_i.hxx | 4 +- src/SMESH_SWIG/SMESH_test.py | 2 +- src/SMESH_SWIG/smeshDC.py | 432 ++++-- .../StdMeshers_CompositeHexa_3D.cxx | 30 +- src/StdMeshers/StdMeshers_FaceSide.cxx | 14 +- src/StdMeshers/StdMeshers_FaceSide.hxx | 2 +- src/StdMeshers/StdMeshers_Hexa_3D.cxx | 470 +++--- .../StdMeshers_NumberOfSegments.cxx | 33 +- src/StdMeshers/StdMeshers_Quadrangle_2D.cxx | 236 +-- .../StdMeshers_RadialQuadrangle_1D2D.cxx | 836 ++++++----- .../StdMeshers_RadialQuadrangle_1D2D.hxx | 9 +- src/StdMeshers/StdMeshers_Regular_1D.cxx | 5 +- src/StdMeshersGUI/Makefile.am | 3 +- .../StdMeshersGUI_DistrPreview.cxx | 5 + .../StdMeshersGUI_StdHypothesisCreator.cxx | 16 +- .../StdMeshersGUI_SubShapeSelectorWdg.cxx | 11 +- .../StdMeshersGUI_SubShapeSelectorWdg.h | 2 + src/StdMeshersGUI/StdMeshers_images.ts | 4 + src/StdMeshersGUI/StdMeshers_msg_en.ts | 8 + 112 files changed, 4138 insertions(+), 3309 deletions(-) create mode 100644 doc/salome/gui/SMESH/images/hypo_quad_params_2.png create mode 100644 doc/salome/gui/SMESH/images/hypo_quad_params_res_2.png diff --git a/adm_local/unix/config_files/check_qwt.m4 b/adm_local/unix/config_files/check_qwt.m4 index d80642511..bae22ac31 100644 --- a/adm_local/unix/config_files/check_qwt.m4 +++ b/adm_local/unix/config_files/check_qwt.m4 @@ -47,16 +47,18 @@ AC_ARG_WITH(qwt_inc, libqwt_name=qwt if test -z $QWTHOME; then AC_MSG_RESULT(QWTHOME not defined) + AC_MSG_NOTICE(Trying native Qwt...) exist_ok=no if test "x$exist_ok" = "xno"; then for d in /usr /usr/local ; do - for extension in qwt qwt-qt4; do + for extension in qwt-qt4 qwt; do AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/lib${extension}.so,exist_ok=yes,exist_ok=no) if test "x$exist_ok" = "xyes"; then QWTHOME=$d AC_MSG_RESULT(lib${extension}.so detected in $d/lib) libqwt_name=${extension} - dnl No break here, libqwt-qt4.so is choosen even if libqwt.so is present: if 2 are present, in most of cases, libqwt.so is Qt3 version. + dnl break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version. + break fi done if test "x$exist_ok" = "xyes"; then @@ -77,21 +79,22 @@ if test -z $QWTHOME; then fi if test "x$exist_ok" = "xyes"; then if test -z $QWT_INCDIR; then - QWT_INCDIR=$QWTHOME"/include/qwt" + QWT_INCDIR=$QWTHOME"/include/qwt-qt4" if test ! -f $QWT_INCDIR/qwt.h ; then - QWT_INCDIR=$QWTHOME"/include" + QWT_INCDIR=/usr/include/qwt fi if test ! -f $QWT_INCDIR/qwt.h ; then - QWT_INCDIR=/usr/lib/qt4/include/qwt + QWT_INCDIR=$QWTHOME"/include" fi if test ! -f $QWT_INCDIR/qwt.h ; then - QWT_INCDIR=/usr/include/qwt-qt4 + QWT_INCDIR=/usr/lib/qt4/include/qwt fi fi else qwt_ok=no fi else + AC_MSG_NOTICE(Trying Qwt from $QWTHOME ...) if test -z $QWT_INCDIR; then QWT_INCDIR="$QWTHOME/include" fi diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_2.png b/doc/salome/gui/SMESH/images/hypo_quad_params_2.png new file mode 100644 index 0000000000000000000000000000000000000000..9f6fa251ebdac0d3f77c1e3605659a573749d38a GIT binary patch literal 2115 zcma);X;@QN8plJd$TgM5=m=y)MGcFJpj6pW0tkdHY_fzU6d^^>kqUxrfzAc1Odx0o zAQnnlEKdRi*)mWFTm-=)t1KPJ!$gD>kYxnIVj^==+L;eCANoA+%{~9$dEfs%_sw~7 za-ZyMyKgUkFA9a)XK!cihC(TvkzYz^KqN=ij)NO?%g*OEm>-p23PkPvSQKi{n!UB9 zN9>b@3G=TGit%Y8l^pihC)odF=H9^0d1Q4tBtQ4Wp1P(-gRD*B2O!@gj5LL?D?_q` zOQW71)c$d?Qlhdc&iTu1{8U?8XT}DL-EG(^jc{>+?^@OJZ&5)C=kS7@zMgu-2nhITU#^-zckCHoE7 zWK`J8D8j+Zz6M?ZD>``)F(pp!tbPq9n-NI7cNuRO3%G>g2RNpk-H)E_$R*TXHaSm) zbeS!Gy9%(WRW`r_Msj??4&WpP8Q^eX4#57C04w%K0(@@Omx#Hh>JLoR?CEkm6aodE z{5G4csOI7VblPhtkmkDP3eu=T7WT@pB^1J}t_uJehDwhjR{ z+G)-B4{%26r}NQ!5I5pCJ00XLkbd#*N)AXoc4jASycRC7Q+r7$u=&ld{%nz!n_^@U zZD6N}cNsFz8f^Z_Je`dr`pr0Mr$xQ{UQJ#NUd@{es%HmF3+2^k?`j^jGN~ad%E!{V zA5;e!(dWHMN|BoaEil3J{dFP`!CB!OLgnMi`#84hAUE4Uo>al&J!dLb6t-QjfbZB@ zUG$+|@FeDfy?Ewa$$m-*4>auY>7e@>k$(>5J=QH!$JH#LIj?Yt2VNJ@{rNN=Uav^~ zS^0A`XBvl`e0&zrd?wbiY299X}km*o9Lm(Ayo+U9EEJ6)XG+Sa*h7-Ra@k)g{o(G?-e#y;^FZju9^ zXXV`g7R{NL`>2FPrwqr-eGKpc)O}_AG~#y&o2-+s0v`yBTjo>Z==IE3`7d1hhJhb+;S5Cmi1vv z@x9hv?oXi4jE+lge7C7vc3PBiQbOaR7JIxAb^CYS->gu2C}0#J{7zvauMswVI96FC zZXhGJ569R8yZFVhiPli_>I7X4g@Upr-Oiz~!NY6ghNGsT&TnR; z!iUW0N65(JzoHtmx(hCSW^}-!@1WP`>(WD{4Y#t`pqX_&f*C_6AbHcg6c+1u801Z! zBgM98xt|G_*3kolB=*rPT+7Jf0SDDgW{V0LN#EaTI~cQ<@FTBXf5b7owz)=Iofk9_j9nke<+xw*%Uzn;J}!HoP=UfemH-_LI=q+DOC VeC1!&0sa-B>}{N_D~Z&v{|yi6z`Ote literal 0 HcmV?d00001 diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_res_2.png b/doc/salome/gui/SMESH/images/hypo_quad_params_res_2.png new file mode 100644 index 0000000000000000000000000000000000000000..6dc37e2985484626a1aa80a7aa496fb040e76c8d GIT binary patch literal 9391 zcmaKS1yodB6s{67fWQnOEii*fNJ;lF!$=E5N{WP(K`PR}Fu>4Ahs00tm4e#Q5>#g_Rdh4xq;Lbf~-+j)G^PPS7-63dAWePGTvKu#UP^hY)bZ*=rFuZZ& zCLf3Z=!rHrZU!!-PAW#O!1&1Z-%TWU>N}v5#7*__Ba$(43Q}eg)Z`1f8#mZ*sG<;h z@5VRMJfii7(%Q5fv+(SqWhIr})L?8R)=tCpq0%4^$NhqPR+gNM#llIdg-T_5yvbeQ zB5RwhWWM+uVO5Riw^+K9@-Ym~kMxuhUW;$on7;(46u*DX^lq;$AaTiLv+k(DtM??$ zReol*HWxoBzjb&qy|v}qQ?rz>$D12B*ZzS+Ig;f)S>?CTBGO;rN34>yTJ9Jqd2A$^YBykbbmGGmttQ&baR`Sj^UN)m|bm zda|c(0{eFIG4>PP<#zJ)lpNbdu!)S<5Kpdy<|p5?`Cp2ZckAZWt60|u9u$(iDEE=v z#3@&Yl(HSF5BfHvuq1c!?yO!1wFfeE-3(2>E#IHYadB;|CY4#4kB2m9rl0=m&A8jw zSF;?tBg1?e`2xOO@SK_Hh_(JoWMmo|3-&dYai08SzE&aE$er&y8Xw!HWHqL@j% zj``WB{vN%6NuT83Bijb^UA>FQjN>7##6kD8ycjSlWK@d_u7I>a$i;J+9zl zHqAVxVZ+~d1wJO4b5+G^?t7AVC?UYaw2}%xo2xC|Vr@K1Uo*c8m%XThH@ywjSuId! zS`sv^w0bu4Nx=TLN1@kKLz#VipI4*M+7(kUcW!#pw5Z>ovXD9%GT+*Y`PX)1!=IP* z+|3@>vV0t>=ik6bXE^_T-y`K}TSd8%A@yod+>vE^d!9M3+pKK$L^b>HEl2YPp{Ba7E17y{$d6CynAj%I}Tt-mruqi_3ET(~GFLpRWFX z%d=1`@YlS3xwtm`dPcGyYNeQ~S9omtc~;k~&UYyYLSfIGcd$${E#Wn^Xld(ZGd?;o zJ?YjRl%}2+sjb#+=Vkl7?~CoUpT%)+wP#o6OXh?=o7_P`xadg$v%BwJ$OvVId(W4f z2QwKyMq{iP5a2um4sa~qL(Xk&|AahI?xJC)ielx;c;GAi>3FsCJH^wI)=e4NKWT)5 zKDOFDaQo%;PPo>#MAZ7S_uI~-=*ML8Ls-HzKi{naaVjbJ?8_1{inV$V zQi_$mh8nypS#Iw!x{L1@f9+N)7#Px@sa`9DpRdJUM7^2unR(pSQ@}qF@Xyf38`p+z zGL`jQ7;ToQe3@EWa1nXuRfcippSmiu%NY?a?%YBhhm&fHs}o#@)Rnbk(=_qxnD35} z`-P8lGE8(neg2%Fad)pzVtlpEQ*+S3yy^8>e@C`(z>bCQaK~z);kfMH#?;U!U9|$| z4U#7ji~yRf+Xi2-BiRPE{WgCj)6n&N#DA(=s)An*`1sjt$~Y@4`fP2+uE+<)kX6yu)w~Y3pLFFu#)N$`I}Uj=Qw!iukLwyRd%FC@Lz)ATgekxT z%Rb7DyIq}$_apPw3a%k;H_t-m)**lI|1P#~n-+`w*2jH6whjHN=jbL266t}fv-P-# zNAe@G*~J$Jc}?PFWL2HO&FxX0j9y1CcFM4iYyt$qRU4^UIC*nkYtwUC~HdxVq*H-B%mccJgj+CEMuZY;te(MGlvPa+0um5DP zII2faO>Sq)?|kV|iSOaG(I>?cwGSJ0DKFW?C!ItjN{0^BdtusY2ZO_1ql3PG>Vkcp zH)wMQzxR9@`&?DTB4hnzc-vxTo=fxN#pT&$f4v3jCwZ(={P`j@II7!WtkGsavumJ< z_e~JZman~!*Ok0q`sv7Y&#W$mjN5)|!o~xp;7wMiMaQQ4cMHddgvkkiKR5VgOw3Hm zF1PRWokiVVUr)cP649~UI#bDbn4SOXi+tK?l)2!>z?AEZ+(?s<{a~77#nak@DY)rd zZQi*op|cD#Qz7!5OhV5cnJ@tHSiO&rA9+zt)nvUoEacZR8&7K78IG)-1@?%~?odPk z6&v&DnAn@MMwuDAi^VPTvjs8wrJ3C3nflj%i2(Z~E^#<$yc1L*;;6wgR99Okh>QAN`(XQ`>4X|iI4*?Z*bCim-IpM5Xg zyup?3+*#P2eZ=N*8q>O7Gx~Jpmx9*K!w*J70XCW@c_$ zwwgjA(+eMNs50M5oR-)%f8AutBX&6T)7)z}f=A}?U}aO=)?AYc0JO*+k__XAz>ag% zAL=X(pq~`KSlPO8e5<}I_T^%B9)6syv%2Z!*cp-mcwn*0tMux+d3U&Rz4dBRiSIgL zvWU0)p9keBRX%f3#LO62WXlT>z&ns2 zJ2&&^5I1Yf3k94JRoNL)Wkv6IN*ZXBUAyG z^&>0n9>H^u-q?c-cH~<9q7%_+%`y`(xz2ke<{iH#|bgM#o0vHOPnoDsDW}JOZQX zi54d24I+dh0lCTI0s?&VGT|uh3<6bzBMxs4qm@zbW|QdWStSJ&BH%IH;Xl-N0ZPv2 zuiwUi(stM(%Rv$iDPpUa#@QN!2_XUUpE6zCinTk!ApH?o%WN4X8`*lLAZd zIVX}E3@8<+VAFCVFr6Ao%MB;~z>ESB!vIf;OA!qcrh!#_0LK6MT<(2-HWF3DXJBRj zJW|a55f66#ng_RASC0S~N^4h_ov-u?itM1xH{@eJQ3V9el~f@cSHW2Fpi2$K(SSOU z?+^3X%OXLHl&G7-Z!^Dqb1c?|;d4W&dB$EuP`}U547{5z#_MxLDviAR9iby63$c`V zppn>PmGRq%1lh*~)9{M%A6%tH82}S9e0%6?14Y^83ForEDF{UghX|$lBL(B`4eSs( zk&->4fikz%VFGe8`B6!Y4bRKyBM__*pig->=bRQ*3AT94qPDyrE6xG}Ns|W70Tv4% z=Y7!1^&Jt072=|NJayIY-R2bv#tqZb-Vqn(LHio1eahcJB}D~|s|nb(?eWLaQ4PpYtk+|h=N+JW*v5g#oTEPfkYTVxg-+9kp z$k}iPjinlrz)krNb`m_aAW9@AegMZTA?1UcM&j6Ew;3{2EGZ>ulkCV~RUu!gy~yf2 zZX#su+I%q&HH`xZ#1ezs^AxS;$_E`yhWk3L}(OeNX1>z9w5Gf&UnjYMg1e~KVB%(q!mQS zl5*l`M9)Hos-&@q94KOrbt<9F)un~;E#lY9wBpXdXv406q2UNEBDYxT_ouqxU+S31 z7TK`-r~D6CA#^krluXp`vv?6ikj2!&+1d~kdlUgVR!ATf@;=W&P6zJ*EAsBNdnYPd z_8KOf6u67S6T`YjHHPEgq!FwDxbo8}sX#JEkk&&Pb7H4L)K5bIQ9HEnSLdRBuYij} zCGo&1D0|Lm-n)e&F~YwMPLUsqQAsVwm_@$*(0>f9lz&zmXb};;N0x-3wHj7Dh;Gd+ zgJ4BMl&^>oQjV&yx)5|(GxqxpmU{r;&c}Z?V(zC{yG2{8fswkU{^LfY$A6mITp{S6 zbu`)!MxuknUMT8-Vf$I5x4$Ux>~B+{?06|7CZdD?Q%5g@AVD=eRxH8bgCC6$fS(x* z`Nx^NJ1FkQLwQwpWGWuLn<55+RaA)c|NPqes=Z~f69A`2)20C*eM_q^8MLAVWiTBXo7FIDq>iT!a#h<{_U!;dz9+_>^#e|w6zMDhr=(B z2I?_2HWZQ|NN9xOA1XQ`$Su{uV@&g_2i8jL*Ko-1oYW#fmy-!cFP|~sSaru#{%Kk~ z%VMGDIT|>$n8f}I+NIyRMPkN@tjh~`a1sdc_eDZch84^xExJxoR)CAedQd-O@B$9X z&i&^-Aw-Q&D0c1soe4t4Px)}v@>kdFltfxl5CFOR<02uib;87jiAbQxrTJ(Cf;5W0 z{Gdt|R$=E2`@$E;_HXtttriNLkICi`tso9-i!oa4;t zhaf~PcO9b+qY1Mq0Rvke^M8_2{^5V7fI|Ssw3TaPt^ffbQ(Ri)a}9Fk5c$O2CDCd{ zOts4RR8Tz(3I7xx6!$(wA2Zvcwi!hfCJ zh_AU4-AA&MqOdVS!bZ#gk??aMJFIp+@j}zpoLB5fy{`5@5lVF9pg-%yJ-zS^;Nl*mp}^r4WS@EIwjR zM};LO(D}|BQr3z#bKFMz;PqhA(?PdX4XF@zq@V0EFKuB_Y1BEBL~P*W z)Rof&{~!ZuTx@c4V^f@vwQ>6jn8%Wj2%$*Qsdu?9ZZntx?Y14bQ6 zEo<0)jB&30=BcdsR|?YKz!n{8L7xqUK#?!0n663XxWk!(pJmOXuvrPwAXvDzTSrp& zkKLljFeE0S`J=cDkh&XtF}>^Qqk_WX%Wj8_XtqF6Se6G8*_%fuLJ-nNSUg9zKaj0) z5w?5~qA2u`lP!h!B<7Hq`1|;CSyMT-{`Ze+*}1JwVFUW47916j zyW$tN3FmY)^yN>G_k5cOGQ>-xXig-RmK8#U z0$NF6e>wHopuF?1#mT(v6X+a+smaz2!|C?P5SA}DtI z`;%jim{xhYrU5doBt{0cI1oPrM~=FXlvRt@t6!A7AhwKW;oxKncq!F{hF5Ff_zkM1 zcU=q!EE4TtUUNdPq=I1CbwTbK^Qh z&=W#W(bmODQP0ZNClkWDDSWKZ} zE9kN3{lnDW^=D83YW;l{#wr7m2k!Rrt1HqjJAJ~ z)`fsCKYyII3`RPk2`E>g$Xe?xrnX~dN~Rzx&YWio=5{@IR4N4a!$1e;a~xB3Hs#l` zqIRU~qwc>NuaEKTd$_;YXFZ)p(sJA>panSF?=MqXK?d!Pl=A$N+(aaItS|(!se~2; z#Sllog0Wshm$aJmc=s3q069bx{BGT(1lT=%`LI`Q`cgVUQdFi?wt7Ko-rv&+O#_jZ zl81QB_)r@eu78}(WC186o|(7Tf3T;Ka%5|L(P7DxkAq=AzaPdoOR!~KF6S8005q>! z8n>q*siF%MY^&}@?Y1_)WGTDs=2=bmD135eGr3s?6)@=vXhbsoj%RwPt$;cudbK|cKr84|IlqbRmQARdM1 zq746>)7O>ZXPIUI7KTD6dcq|OqYQ9l+1M(pcDZEIeDmr{w$O%@m6F1?9&df$^82eq zD}0vuX|vB5U~zcPSZCA9mEB^lKSA`*Yxg<(hgq3*(R!%>qyyhpp6o^O@s*^_X8OWJ z*S?)^$NK$L7cr}qQQ}1Y+vhkhQX)zRjvwzzdqY{M zlLAA;I}W9?bQUkvIDYu2YwY&~k*kYSv$#cpe*csYE5nnBRtzQ)+jb|VF(u3v^{LF$ zG{>43`I=3IdgP2Vkx~Y6{dmVl@w8!@%ju$gH1*!qCDj-YZ+E~gtkC&vMuutro)XWn ziW3k6hv)VV=-j6nWuqC1|Ip-bd`!pGhIsA}{}R{8c9f~#!u0zCPS4(Q;z$`y_}85Nz2CBhdmm5Qsl9AtdfSeAgxJw zYn=63;O!NRG3$RhA)W@5l!d4^Q0!)`b6wQn@m$1grZcdfPk3eCLPl+7gBmtMX^}7= zPHX9qGX~p}FT7`0^PUR#8g4%7PZaChBl&2$w4sCdeQ1NzV2RU>uI%&2q4`xO+%D+n^H%%XXN;NKxRyDJWe-P1)$T*?1F0RKoUx<&J5xEo z`Z(8dHJpMC~YcTwhKnn~t|ugfFoZe^JAgjCQU=<4=&av`ORR3r+10(qa9 zK(~jaj>`mt% zKnH;u85VJlGtE1Y8NUzcJf=Lb#=WrtH>&ZXROnhqspTS^hlJ^T1Y&_(m=l^3m`RCg zzH2>c)&kifX_pQHV!u1v9?d}BAewJ*lEL;oW?A~fQ-HtSyifKYsRdF>H4bDM+Qdq> zfN5bqlNMOT)GX2oPXYWOWTJWE#Uc_mB*~2h82#m2+WzqaY>t-Xh4#pzR}9Pb1>d@2IWy+8Q*lD?%*FA$H^ z!tQ2j!h`nX@`D}klPgv#yZ#Q760H$83=NQCE$TkB81N5HJ4%n{i_1tPzWe-4_TdSN zyE&l03~e03D4$C6%9SBFE1I>a^U_bsVmjsPQH;2L$DVpvw70JPgLiU({q-j5N&eE{ z#NlM6uj)5Kj#?99J)}T(Jd}&?z8ctwsj(GwjVd-mpr(dTy*giia_Vs{plK(7xuuf7 znbu(P*6(QBp&=>eKvoOscp(o{=*XY+{rN*iIgS84_EG-QIV}(?3h<4w>U*!_JDO$b zhbib~Uc>>fOI{CsH5{GMM#8||?V0qK@I{7!6Q({T7QG*~5z-lf3m1GgSOmrzckT3cI-2tKq`{oTk@Qm=-oiN2fa&gc*`qt*$& z+caKpCk=5WP^-}0Ckaq;RYVoM$OpA-NLLH-qRpA6h8n5p+saUmt6^SS<8&h1o+gol zD5VvE8672DPh)FOSuMooY5K`D*vg{)2XDe?lLAvr=1f!*_dJSQ5p^N>RlfZ;@n*uT z*-Q}>H$S-;y~Sh);AYsakx#F0_51(5af1kXT?-JdW%wAARfbM=z0g1;IssXPd*u9q z$WS}35PTKi{dYYJE2(g*c<8cHw@ZnXTT`q|}W80BoH3<^X)9v?WH zIe}VMq?2yicw6e8l6LeASf4d6BJzzrkQ#@%$&lYwZ!SwLaUmoz<3K(r!`m`+cD*1W z@nJ_kDaWreOWrv6QIB6Q^Z-Vy(bc5Q2;i-#fv=(77ITsVRvqnGUmie&R}7P8xSh zQyxI&!+Z*O+?x`nK=S9q>Dv{KsO1~^29^+gcNd`5NHvejB(vbF{F}~R7&EXpAYQ!Mx z=V^Mb-L~}&o55=n31LCkyOTc=3+D_t1%Z93!=gGnFpkQU!HF%w*;Uw!29`s~zsk}b zGepvs)vi!4^fBProuJ84}2)!6A z<#Q{W=RCjT+8_F~o9P>je6L~AYwLmqs8!gt9M0e2l^7N;fMQ8M4u z?1gC2(Y<12<3E9C~}&2{~lz)K*g(!ks*kEY#c1R}e=H{3`t z&Ilgk4}xh7d%Y`i;dWyN`pb>5ihF`8J&9B$JIBYY7STudy8qlKmpd_gcgc!F0Q4tA zK^g98pSA$-q;tkSnWuS&PGuWY9h?{q0AP;@GN*i``}J9yusbcv?z@*;J-QT$At=Yo zS^0Z{p{7_bU~S9VWR@%d#M{mqG-dw&|NIKvmk0Yhb>kU@xO>&E*Koi`jrVF zFp=q>z$CoAQFo+2SVDlr&bRn$dMw*-6-0OdAh1a}_y~#No{4JaQDGzX2R$Fc#apv( z27%X#`zspP7&UYkT{Fixed points 1D hypothesis -Fixed points 1D hypothesis allows to split edges into segments -using set of fixed points given by normalized parameters on edge and -set of numbers of segments for splitting each sub-segment between -fixed points. Optionally it is possible to set flag -Same Nb. Segments for all intervals and -only one value for mentioned number of segments. - -The direction of the splitting is defined by the orientation of the +Fixed points 1D hypothesis allows splitting edges through a +set of points parameterized on the edge (from 1 to 0) and a number of segments for each +interval limited by the points. + +\image html hypo_fixedpnt_dlg.png + +It is possible to check in Same Nb. Segments for all intervals +option and to define one value for all intervals. + +The splitting direction is defined by the orientation of the underlying geometrical edge. "Reverse Edges" list box allows to specify the edges for which the splitting should be made in the -direction opposing to their orientation. This list box is enabled only -if the geometry object is selected for the meshing. In this case the -user can select edges to be reversed either directly picking them in -the 3D viewer or by selecting the edges or groups of edges in the +direction opposite to their orientation. This list box is enabled only +if the geometrical object is selected for meshing. In this case it is +possible to select the edges to be reversed either directly picking them in +the 3D viewer or selecting the edges or groups of edges in the Object browser. -Using of this hypothesis for quadrangle face where main mesh is -created using Quadrangle(Mapping) and NumberOfSegments -hypothesises. Creation hypothesis FixedPoint_1D for submesh on -one edge: +\image html mesh_fixedpnt.png "Example of a submesh on the edge built using Fixed points 1D hypothesis" -\image html hypo_fixedpnt_dlg.png - -Resulting 2D mesh: - -\image html mesh_fixedpnt.png +See Also a sample TUI Script of a +\ref tui_fixed_points "Defining Fixed Points" hypothesis operation. */ diff --git a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc index c912c568f..dd42e9962 100644 --- a/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/2d_meshing_hypo.doc @@ -23,6 +23,8 @@ which will compose the mesh of these 2D faces. \image html a-maxelarea.png +\n + \image html max_el_area.png "In this example, Max. element area is very small compared to the 1D hypothesis" See Also a sample TUI Script of a @@ -52,6 +54,18 @@ used as a degenerated edge. \image html hypo_quad_params_res.png "The resulting mesh" +This hypothesis can be also used to mesh a segment of a circular face. +Please, consider that there is a limitation on the selectiion of the degenerated +vertex for the faces built with the angle > 180 degrees (see the picture). + +\image html hypo_quad_params_2.png "3/4 of a circular face" + +In this case, selection of a wrong vertex for the Quadrangle parameters +hypothesis will generate a wrong mesh. The picture below +shows the good (left) and the bad (right) results of meshing. + +\image html hypo_quad_params_res_2.png "The resulting meshes" +
\anchor quadrangle_preference_anchor

Quadrangle Preference

diff --git a/doc/salome/gui/SMESH/input/about_hypo.doc b/doc/salome/gui/SMESH/input/about_hypo.doc index 578823bd6..cc8f5fd52 100644 --- a/doc/salome/gui/SMESH/input/about_hypo.doc +++ b/doc/salome/gui/SMESH/input/about_hypo.doc @@ -28,6 +28,7 @@ them, you operate numerical values):
  • \ref max_element_area_anchor "Max Element Area"
  • \ref length_from_edges_anchor "Length from Edges"
  • +
  • \ref hypo_quad_params_anchor "Quadrangle Parameters"
  • \ref quadrangle_preference_anchor "Quadrangle Preference"
  • \ref triangle_preference_anchor "Triangle Preference"
diff --git a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc index 9a0fd91f5..a83a64f9f 100644 --- a/doc/salome/gui/SMESH/input/basic_meshing_algos.doc +++ b/doc/salome/gui/SMESH/input/basic_meshing_algos.doc @@ -47,7 +47,7 @@ tetrahedral (pyramidal) elements. \image html image126.gif "Example of a hexahedral 3D mesh" -\Note that BLSURF and GHS3D are commercial meshers and require a +\note BLSURF and GHS3D are commercial meshers and require a license to be used within the Mesh module. There is also a number of more specific algorithms: diff --git a/doc/salome/gui/SMESH/input/blsurf_hypo.doc b/doc/salome/gui/SMESH/input/blsurf_hypo.doc index ed1843097..03c0fc594 100644 --- a/doc/salome/gui/SMESH/input/blsurf_hypo.doc +++ b/doc/salome/gui/SMESH/input/blsurf_hypo.doc @@ -207,22 +207,33 @@ String variables: \image html blsurf_parameters_sizemap.png -It is possible to define user sizes on faces, edges or verteces. +User sizes can be defined on faces, edges or vertices.
    -
  • Those faces, edges and verteces must be sub-shapes (from explode command) of the meshed geometry object.
  • -
  • Groups of faces, edges and verteces are also handled.
  • -
  • Multi-selection is possible.
  • -
  • The sizes are constant values.
  • +
  • The faces, edges and vertices can belong to the meshed geometrical +object or to its sub-shapes (created using Explode command).
  • +
  • Groups of faces, edges and vertices are also handled.
  • +
  • It is possible to attribute the same size to several geometries using multi-selection.
  • +
  • The sizes are constant values or python functions.
  • +
  • In case of a python function, the following rules must be respected: +
      +
    • The name of the function is f.
    • +
    • If geometry is a face or a group of faces, the function is f(u,v).
    • +
    • If geometry is an edge or a group of edges, the function is f(t).
    • +
    • If geometry is a vertex or a group of vertices, the function is f().
    • +
    • The function must return a double.
    • +

See Also a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including size map. \anchor blsurf_sizemap_computation

Computation of the physical size

-Here is the detail on the calculation of the size (from BLSurf documentation). \n -The size is obtained by querying sizemap functions associated to the input CAD object for surfaces, curves and points. -Each function can either return a value h (which is then trimmed between the two bounds hphymin and hphymax), or "no answer" (by not assigning a value to h), thus providing great flexibility in the specification of the sizes. The computation depends whether point P is internal to a surface, internal to a curve, or at the end of several curves: +The physical size is obtained by querying sizemap functions associated to the input CAD object for surfaces, curves and points. +Each function can either return a value h (which is then trimmed +between the two bounds hphymin and hphymax), or "no answer" (by not +assigning a value to h), thus providing great flexibility in the +specification of the sizes. The computation depends on whether point P is internal to a surface, internal to a curve, or at the end of several curves:
  • If point P is internal to a surface, the CAD surface size function is queried. If no answer is returned, one interpolates with the values at the vertices of the discretized interface curves.
  • If point P is internal to a curve, the CAD curve size function is queried first. If no answer is returned, the surface size function is queried for every adjacent surface and the mean value of the returned values is computed. If no answer is returned, sizes h1 and h2 at both ends of the curve are considered (see next item) and the interpolated value is computed.
  • @@ -235,12 +246,13 @@ In order to compute the mean of several values, the arithmetic mean is used by d \image html blsurf_parameters_enforced_vertices.png -It is possible to define some enforced vertices to BLSurf algorithm without any vertex creation into the CAD. +It is possible to define some enforced vertices to BLSurf algorithm +without creating any vertices by CAD algorithms.
      -
    • Enforced vertices are the projection of a given point defines by its (x,y,z) coordinates on the concerned face.
    • -
    • It is possible to define several enforced vertices on 1 face.
    • -
    • Group of faces are also handled.
    • -
    • If the projection point is on the boundary or outside the face, then it will be ignored.
    • +
    • The enforced vertex is the projection of a point defined by its +(x,y,z) coordinates on the selected face.
    • +
    • It is possible to define several enforced vertices on a face or a group of faces.
    • +
    • If the projected point is on the boundary or outside of the face, it will be ignored.

    See Also a sample TUI Script of the \ref tui_blsurf "creation of a BLSurf hypothesis", including enforced vertices. diff --git a/doc/salome/gui/SMESH/input/building_compounds.doc b/doc/salome/gui/SMESH/input/building_compounds.doc index faf636b82..98a20c470 100644 --- a/doc/salome/gui/SMESH/input/building_compounds.doc +++ b/doc/salome/gui/SMESH/input/building_compounds.doc @@ -47,4 +47,6 @@ for this operation. \image html image160.gif "Example of a compound of two meshed cubes" +See Also a sample +\ref tui_building_compound "TUI Example of building compounds." */ diff --git a/doc/salome/gui/SMESH/input/constructing_meshes.doc b/doc/salome/gui/SMESH/input/constructing_meshes.doc index be7def6a8..625cff3bd 100644 --- a/doc/salome/gui/SMESH/input/constructing_meshes.doc +++ b/doc/salome/gui/SMESH/input/constructing_meshes.doc @@ -126,7 +126,7 @@ visualizing the geometrical entity that causes it. \image html failed_computation.png "Example of the invalid input mesh" -\Note Mesh Computation Information box does not appear if you set +\note Mesh Computation Information box does not appear if you set "Mesh computation/Show a computation result notification" preference to the "Never" value. This option gives the possibility to control mesh computation reporting. There are the following possibilities: always diff --git a/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc b/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc index 072a91f7a..5409f487e 100644 --- a/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc +++ b/doc/salome/gui/SMESH/input/convert_to_from_quadratic_mesh.doc @@ -37,4 +37,6 @@ The following dialog box will appear:
  • Click the \b Apply or \b OK button.
  • -*/ \ No newline at end of file +
    See Also a sample TUI Script of a \ref tui_quadratic "Convert to/from quadratic" operation. + +*/ diff --git a/doc/salome/gui/SMESH/input/editing_groups.doc b/doc/salome/gui/SMESH/input/editing_groups.doc index b5031468a..6cbe5ceb4 100644 --- a/doc/salome/gui/SMESH/input/editing_groups.doc +++ b/doc/salome/gui/SMESH/input/editing_groups.doc @@ -2,7 +2,7 @@ \page editing_groups_page Editing groups -\n To edit an existing group of elements: +To edit an existing group of elements:
    1. Select your group in the Object Browser and in the \b Mesh menu click the Edit Group item or "Edit Group" button in the toolbar.
    2. @@ -17,11 +17,12 @@ 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. +
    3. Click the \b Apply or Apply and Close button to confirm modification of the group.
    -\n To convert an existing group on geometry into standalone group +To convert an existing group on geometry into standalone group of elements and modify:
    1. Select your group on geometry in the Object Browser and in the \b Mesh menu click @@ -31,11 +32,12 @@ the Edit Group as Standalone item.
    2. "Edit Group as Standalone" button
      The group on geometry will be converted into standalone group and can -be modified as group of elements +be modified as group of elements. +
    3. Click the \b Apply or Apply and Close button to confirm modification of the group.
    4. +
    -
    See Also a sample TUI Script of an -\ref tui_edit_group "Edit Group" operation. +\sa A sample TUI Script of an \ref tui_edit_group "Edit Group" operation. */ diff --git a/doc/salome/gui/SMESH/input/free_faces.doc b/doc/salome/gui/SMESH/input/free_faces.doc index 0c852f32c..d35caa9ac 100644 --- a/doc/salome/gui/SMESH/input/free_faces.doc +++ b/doc/salome/gui/SMESH/input/free_faces.doc @@ -2,16 +2,17 @@ \page free_faces_page Free faces -\n This mesh quality control highlights the faces connected to +This mesh quality control highlights the faces connected to less than two mesh volume elements. The free faces are shown with a color different from the color of shared faces. \image html free_faces.png -
    In this picture some volume mesh elements have been removed, as + +In this picture some volume mesh elements have been removed, as a result some faces became connected only to one volume. i.e. became free. -
    See Also a sample TUI Script of a -\ref tui_free_faces "Free Faces quality control" operation. +\sa A sample TUI Script of a \ref tui_free_faces "Free Faces quality control" +operation. */ diff --git a/doc/salome/gui/SMESH/input/free_nodes.doc b/doc/salome/gui/SMESH/input/free_nodes.doc index 1caaf9e4b..8a06fe3de 100644 --- a/doc/salome/gui/SMESH/input/free_nodes.doc +++ b/doc/salome/gui/SMESH/input/free_nodes.doc @@ -2,14 +2,15 @@ \page free_nodes_page Free nodes -\n This mesh quality control highlights the nodes which are not connected +This mesh quality control highlights the nodes which are not connected to any mesh element. \image html free_nodes.png -
    In this picture some nodes are not connected to any mesh + +In this picture some nodes are not connected to any mesh element after deleting some elements and adding several isolated nodes. -
    See Also a sample TUI Script of a -\ref tui_free_nodes "Free Nodes quality control" operation. +\sa A sample TUI Script of a \ref tui_free_nodes "Free Nodes quality control" +operation. */ diff --git a/doc/salome/gui/SMESH/input/ghs3d_hypo.doc b/doc/salome/gui/SMESH/input/ghs3d_hypo.doc index 230929ce7..eb4b981b6 100644 --- a/doc/salome/gui/SMESH/input/ghs3d_hypo.doc +++ b/doc/salome/gui/SMESH/input/ghs3d_hypo.doc @@ -56,16 +56,18 @@ together with the characteristics of the final mesh.
  • To create new nodes - if this option is checked off, ghs3d tries to create tetrahedrons using only the nodes of the 2D mesh.
  • -
  • To remove initial central point - TetMesh-GHS3D adds an internal point -at the centre of gravity of the bounding box in order to speed up and to simplify -the meshing process. It is however possible for TetMesh-GHS3D to refrain from creating +
  • To remove the initial central point TetMesh-GHS3D adds an internal point +at the gravity centre of the bounding box to speed up and to simplify +the meshing process. However, it is possible to refrain from creating this point by using the command line option -no initial central point. This can be -particularly useful to generate a volume mesh without internal points at all, and in some rare cases, -to help the boundary regeneration phase when it failed with the standard options (for example when -one dimension of the domain is large compared to the other two, with a ratio of 20 or more). -Use this option when the boundary regeneration failed with the standard parameters and before using +particularly useful to generate a volume mesh without internal points at all and in some rare cases +at the boundary regeneration phase when it is impossible to proceed +with the standard options +(for example, when one dimension of the domain is more than 20 times greater than the other two). +Use this option if the boundary regeneration has failed with the standard parameters and before using the recovery version (command line option -C). -Note: when using this option, the speed of the meshing process may decrease, and quality may change. +Note: when using this option, the speed of the meshing process may +decrease, and the quality may change. Note: the boundary regeneration may fail with this option, in some rare cases.
  • To use boundary recovery version - enables using a @@ -78,18 +80,18 @@ quality (poor aspect ratio of elements, tetrahedra with a very small positive volume).
  • To use FEM correction - Applies finite-element correction by -replacing overconstrained elements where it is possible. The process is -first slicing the overconstrained edges and second the overconstrained -facets. This ensures that no edges have two boundary vertices and that -no facets have three boundary vertices. TetMesh-GHS3D gives the initial +replacing overconstrained elements where it is possible. At first the process +slices the overconstrained edges and at second the overconstrained +facets. This ensures that there are no edges with two boundary +vertices and that there are no facets with three boundary vertices. TetMesh-GHS3D gives the initial and final overconstrained edges and facets. It also gives the facets which have three edges on the boundary. Note: when using this option, the speed of the meshing process may decrease, quality may change, and the smallest volume may be smaller. -The default is no correction.
  • +By default, the FEM correction is not used. -
  • Option as text - allows input of any text as command line -for ghs3d. This allows the input of advanced options in a free from.
  • +
  • Option as text - allows to input in the command line any text +for ghs3d, for example, advanced options.
@@ -98,9 +100,9 @@ for ghs3d. This allows the input of advanced options in a free from. \image html ghs3d_enforced_vertices.png -GHS3D algorithm can locally raffine the mesh. It is possible to define enforced vertices in the volume where the mesh will be raffined. +GHS3D algorithm can locally make the mesh finer. It is possible to define enforced vertices in the volume where the mesh will be detailed. -A node will be created at the enforced vertex coordinates. There is no need to create a vertex in the CAD. +A node will be created at the enforced vertex coordinates. There is no need to create a vertex in CAD. An enforced vertex is defined by:
    @@ -111,4 +113,4 @@ An enforced vertex is defined by:
    See Also a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices. -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/grouping_elements.doc b/doc/salome/gui/SMESH/input/grouping_elements.doc index f5c7fed67..638d70112 100644 --- a/doc/salome/gui/SMESH/input/grouping_elements.doc +++ b/doc/salome/gui/SMESH/input/grouping_elements.doc @@ -12,19 +12,15 @@ dialog.
  • by creating a group of elements of the selected type from all such elements of the chosen geometrical object - Group on geometry tab of \ref creating_groups_page "Create group" dialog.
  • -
  • by creating a group including all types of elements from an existing geometrical object - using \subpage create_groups_from_geometry_page "Create Groups from Geometry" dialog.
  • -
  • by creating several groups of elements (nodes, edges, faces and volumes) from the chosen submesh - using Mesh -> Construct Group Menu item. In this case groups of elements are created automatically.
  • -
  • by creating groups of entities from existing groups of superior dimensions - using \subpage group_of_underlying_elements_page "Create Group of Underlying Elements" dialog.
  • -
@@ -32,12 +28,12 @@ The created groups can be later:
  • \subpage editing_groups_page "Edited"
  • -
  • \subpage using_operations_on_groups_page "Subjected to Boolean operations", or
  • +
  • \subpage using_operations_on_groups_page "Subjected to Boolean operations"
  • \subpage deleting_groups_page "Deleted"
An important tool, providing filters for creation of \b Standalone -groups is \subpage selection_filter_library_page. +groups is \subpage selection_filter_library_page. */ diff --git a/doc/salome/gui/SMESH/input/make_2dmesh_from_3d.doc b/doc/salome/gui/SMESH/input/make_2dmesh_from_3d.doc index 5f07f993c..f4b5b2ba5 100644 --- a/doc/salome/gui/SMESH/input/make_2dmesh_from_3d.doc +++ b/doc/salome/gui/SMESH/input/make_2dmesh_from_3d.doc @@ -2,21 +2,21 @@ \page make_2dmesh_from_3d_page Generate the skin elements (2D) of a mesh having 3D elements -\n This functionality allows you to generate 2D mesh elements as skin -on existing 3D mesh elements +\n This functionality allows to generate 2D mesh elements as a skin +on the existing 3D mesh elements. To generate 2D mesh:
    -
  1. From the Modification menu choose the "Create 2D mesh from 3D" -Mesh item, or invoke from popup menu. +
  2. From the Modification menu choose "Create 2D mesh from 3D" +item, or choose from the popup menu. \image html 2d_from_3d_menu.png The algorithm detects boundary volume faces without connections to -other volumes and create 2D mesh elements on face nodes. If mesh -already contains 2D elements on detected nodes - no new element -created. The result dialog shows mesh information statistic about new -created 2D mesh elements. +other volumes and creates 2D mesh elements on face nodes. If the mesh +already contains 2D elements on the detected nodes, new elements are not +created. The the resulting dialog shows mesh information statistics +about the newly created 2D mesh elements.
*/ diff --git a/doc/salome/gui/SMESH/input/mesh_infos.doc b/doc/salome/gui/SMESH/input/mesh_infos.doc index 75b934c2e..7b855c42c 100644 --- a/doc/salome/gui/SMESH/input/mesh_infos.doc +++ b/doc/salome/gui/SMESH/input/mesh_infos.doc @@ -44,11 +44,6 @@ The following information will be displayed: \image html advanced_mesh_infos.png -In case you get Mesh Infos via a \ref tui_viewing_mesh_infos "TUI script", -the information is displayed in Python Console. - -\image html b-mesh_infos.png -
\anchor mesh_element_info_anchor

Mesh Element Info

@@ -61,4 +56,7 @@ the Viewer. \image html eleminfo2.png +In case you get Mesh Infos via a TUI script the information is displayed in Python Console. +See the \ref tui_viewing_mesh_infos "TUI Example", + */ \ No newline at end of file diff --git a/doc/salome/gui/SMESH/input/netgen_2d_3d_hypo.doc b/doc/salome/gui/SMESH/input/netgen_2d_3d_hypo.doc index 0c872d32b..bbb7c59ff 100644 --- a/doc/salome/gui/SMESH/input/netgen_2d_3d_hypo.doc +++ b/doc/salome/gui/SMESH/input/netgen_2d_3d_hypo.doc @@ -2,7 +2,7 @@ \page netgen_2d_3d_hypo_page Netgen 2D and 3D hypotheses -\n Netgen 2D and Netgen 3D hypotheses work only with Netgen 1D-2D and +Netgen 2D and Netgen 3D hypotheses work only with Netgen 1D-2D and Netgen 1D-2D-3D algorithms. These algorithms do not require definition of lower-level hypotheses and algorithms (2D and 1D for meshing 3D objects and 1D for meshing 2D objects). They prove to be @@ -11,68 +11,64 @@ of the meshed object. \image html netgen2d.png -
    -
  • Name - allows to define the name for the algorithm (Netgen -2D (or 3D) Parameters by default).
  • -
  • Max Size - maximum linear dimensions for mesh cells.
  • -
  • Second Order - if this box is checked in, the algorithm will +- Name - allows to define the name for the algorithm (Netgen +2D (or 3D) Parameters by default). +- Max Size - maximum linear dimensions for mesh cells. +- Second Order - if this box is checked in, the algorithm will create second order nodes on the mesh, which actually will become -\ref adding_quadratic_elements_page "Quadratic".
  • -
  • Fineness - ranging from Very Coarse to Very Fine allows to set the +\ref adding_quadratic_elements_page "Quadratic". +- Fineness - ranging from Very Coarse to Very Fine allows to set the level of meshing detalization using the three parameters below. You -can select Custom to define them manually.
  • -
  • Growth rate - allows to define how much the linear dimensions of -two adjacent cells can differ (i.e. 0.3 means 30%).
  • -
  • Nb. Segs per Edge and Nb Segs per Radius - allows to define the +can select Custom to define them manually. +- Growth rate - allows to define how much the linear dimensions of +two adjacent cells can differ (i.e. 0.3 means 30%). +- Nb. Segs per Edge and Nb Segs per Radius - allows to define the minimum number of mesh segments in which edges and radiuses will be -split.
  • -
  • Allow Quadrangles - allows to use quadrangle elements in a +split. +- Allow Quadrangles - allows to use quadrangle elements in a triangle 2D mesh. This checkbox is not present in Netgen 3D parameters because currently building a tetrahedral mesh with quadrangle faces is -not possible.
  • -
  • Optimize - if this box is checked in, the algorithm will try to -create regular (possessing even sides) elements.
  • -
+not possible. +- Optimize - if this box is checked in, the algorithm will try to +create regular (possessing even sides) elements. \image html netgen3d_simple.png -Netgen 2D simple parameters and Netgen 3D simple parameters allow defining the size of elements for each dimension.
+Netgen 2D simple parameters and Netgen 3D simple +parameters allow defining the size of elements for each +dimension. \b 1D group allows defining the size of 1D elements in either of two ways: -
    -
  • Number of Segments has the same sense as \ref +- Number of Segments has the same sense as \ref number_of_segments_anchor "Number of segments" hypothesis with -equidistant distribution.
  • -
  • Average Length has the same sense as \ref -average_length_anchor "Average Length" hypothesis.
  • -
+equidistant distribution. +- Average Length has the same sense as \ref +average_length_anchor "Average Length" hypothesis. \b 2D group allows defining the size of 2D elements -
    -
  • Length from edges if checked in, acts like \ref -length_from_edges_anchor "Length from Edges" hypothesis, else
  • -
  • Max. Element Area defines the maximum element area like \ref -max_element_area_anchor "Max Element Area" hypothesis.
  • -
+- Length from edges if checked in, acts like \ref +length_from_edges_anchor "Length from Edges" hypothesis, else +- Max. Element Area defines the maximum element area like \ref +max_element_area_anchor "Max Element Area" hypothesis. \b 3D groups allows defining the size of 3D elements. -
    -
  • Length from faces if checked in, the area of sides of -volumic elements will be equal to an average area of 2D elements, else
  • -
  • Max. Element Volume defines the maximum element volume like +- Length from faces if checked in, the area of sides of +volumic elements will be equal to an average area of 2D elements, else +- Max. Element Volume defines the maximum element volume like \ref max_element_volume_hypo_page "Max Element Volume" -hypothesis.
  • -
      +hypothesis. -\n Note that Netgen algorithm does not strictly follow the input -parameters. The actual mesh can be more or less dense than required. There are several factors in it: -
        -
      1. NETGEN does not actually use "NbOfSegments" parameter for discretization of -edge. This parameter is used only to define the local element size (size at the given point), so local sizes of adjacent edges influence each other.
      2. -
      3. NETGEN additionally restricts the element size according to edge curvature.
      4. -
      5. The local size of edges influences the size of close triangles.
      6. -
      7. The order of elements and their size in the 1D mesh generated by +\note Netgen algorithm does not strictly follow the input +parameters. The actual mesh can be more or less dense than +required. There are several factors in it: +- NETGEN does not actually use "NbOfSegments" parameter for discretization of +edge. This parameter is used only to define the local element size +(size at the given point), so local sizes of adjacent edges influence +each other. +- NETGEN additionally restricts the element size according to edge curvature. +- The local size of edges influences the size of close triangles. +- The order of elements and their size in the 1D mesh generated by NETGEN differ from those in the 1D mesh generated by Regular_1D -algorithm, resulting in different 2D and 3D meshes.
      8. -
      -*/ \ No newline at end of file +algorithm, resulting in different 2D and 3D meshes. + +*/ diff --git a/doc/salome/gui/SMESH/input/prism_3d_algo.doc b/doc/salome/gui/SMESH/input/prism_3d_algo.doc index 837923ac1..5589ba3a7 100644 --- a/doc/salome/gui/SMESH/input/prism_3d_algo.doc +++ b/doc/salome/gui/SMESH/input/prism_3d_algo.doc @@ -4,9 +4,9 @@ 3D extrusion algorithm can be used for meshing prisms, i.e. 3D Shapes defined by two opposing faces having the same number of vertices and -edges and meshed using the \ref projection_algos_page "2D Projection" -algorithm. These two faces should be connected by quadrangle "side" -faces. +edges and meshed using, for example, the \ref projection_algos_page +"2D Projection" algorithm. These two faces should be connected by +quadrangle "side" faces. The opposing faces can be meshed with either quadrangles or triangles, while the side faces should be meshed with quadrangles only. @@ -17,4 +17,8 @@ As you can see, the 3D extrusion algorithm permits to build and to have in the same 3D mesh such elements as hexahedrons, prisms and polyhedrons. -*/ \ No newline at end of file +\note This algorithm works correctly only if the opposing faces have +the same (or similar) meshing topography. Otherwise, 3D extrusion +algorithm can fail to build mesh volumes. + +*/ diff --git a/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc index 4436e092b..9f54f3eef 100644 --- a/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc +++ b/doc/salome/gui/SMESH/input/radial_quadrangle_1D2D_algo.doc @@ -2,27 +2,21 @@ \page radial_quadrangle_1D2D_algo_page Radial Quadrangle 1D2D -\n This algorithm applies to the meshing of a 2D shapes. -Required conditions: Face must be a full circle or part of circle -(i.e. number of edges <= 3 and one of them must be a circle curve). -The resulting mesh consists of triangles (near center point) and +\n This algorithm applies to the meshing of 2D shapes under the +following conditions: the face must be a full circle or a part of circle +(i.e. the number of edges is less or equal to 3 and one of them is a circle curve). +The resulting mesh consists of triangles (near the center point) and quadrangles. -This algorithm also requires the information concerning the number and -distribution of mesh layers alond a radius of circle. Distribution of -layers can be set with any of 1D Hypotheses. - -Creation hypothesis: +This algorithm requires the hypothesis indicating the number +of mesh layers along the radius. The distribution of layers can be set with any 1D Hypothesis. \image html hypo_radquad_dlg.png -Resulting 3D mesh for the cylinder with RadialQuadrangle_1D2D -hypothesis for top and bottom faces: - -\image html mesh_radquad_01.png +\image html mesh_radquad_01.png "Radial Quadrangle 2D mesh on the top and the bottom faces of a cylinder" -Resulting 2D mesh for the part of circle: +\image html mesh_radquad_02.png "Radial Quadrangle 2D mesh on a part of circle" -\image html mesh_radquad_02.png +\sa A sample \ref tui_radial_quadrangle "TUI Script". */ diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index efbafc617..e0fe78ec9 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -2,129 +2,140 @@ \page smeshpy_interface_page Python interface -\n Python package smesh defines several classes, destined for easy and +Python package smesh defines several classes, destined for easy and clear mesh creation and edition. -\n Documentation for smesh package is available in two forms: - -\n The structured - documentation for smesh package, where all methods and - classes are grouped by their functionality, like it is done in the GUI documentation -\n and the \ref smeshDC "linear documentation for smesh package" - grouped only by classes, declared in the smesh.py file. - -\n 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 list of data structures (\ref smeshDC::smeshDC "class smesh") - also represents documentation for the methods of the package smesh.py itself. - -\n The package smesh.py provides an interface to create and handle - meshes. Use it to create an empty mesh or to import it from the data file. - -\n Once a mesh has been created, it is possible to manage it via its own - methods, described at \ref smeshDC::Mesh "class Mesh" documentation - (it is also accessible by the second item "class Mesh" in the list of data structures). - -\n Class Mesh allows assigning algorithms to a mesh. -\n Please note, that some algorithms, - included in the standard Salome installation are always available: - - REGULAR(1D), COMPOSITE(1D), MEFISTO(2D), Quadrangle(2D), Hexa(3D), etc. - -\n There are also some algorithms, which can be installed optionally, -\n some of them are based on open-source meshers: - - NETGEN(1D-2D,2D,1D-2D-3D,3D), - -\n others are based on commercial meshers: - - GHS3D(3D), BLSURF(2D). - -\n To add hypotheses, use the interfaces, provided by the assigned +Documentation for smesh package is available in two forms: + +The structured +documentation for smesh package, where all methods and +classes are grouped by their functionality, like it is done in the GUI documentation +and the \ref smeshDC "linear documentation for smesh package" +grouped only by classes, declared in the smesh.py file. + +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 list of data structures (\ref smeshDC::smeshDC "class smesh") +also represents documentation for the methods of the package smesh.py itself. + +The package smesh.py provides an interface to create and handle +meshes. Use it to create an empty mesh or to import it from the data file. + +Once a mesh has been created, it is possible to manage it via its own +methods, described at \ref smeshDC::Mesh "class Mesh" documentation +(it is also accessible by the second item "class Mesh" in the list of data structures). + +Class \b Mesh allows assigning algorithms to a mesh. +Please note, that some algorithms, included in the standard SALOME +distribution are always available: +- REGULAR (1D) +- COMPOSITE (1D) +- MEFISTO (2D) +- Quadrangle (2D) +- Hexa(3D) +- etc... + +There are also some algorithms, which can be installed optionally, +some of them are based on open-source meshers: +- NETGEN (1D-2D, 2D, 1D-2D-3D, 3D) + +... and others are based on commercial meshers: +- GHS3D (3D) +- BLSURF (2D) + +To add hypotheses, use the interfaces, provided by the assigned algorithms. -\n Below you can see an example of usage of the package smesh for 3d mesh generation. +Below you can see an example of usage of the package smesh for 3d mesh generation. +\anchor example_3d_mesh

      Example of 3d mesh generation with NETGEN:

      -\n from geompy import * -\n import smesh +\code +from geompy import * +import smesh -# Geometry -\n # an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral. +### +# Geometry: an assembly of a box, a cylinder and a truncated cone +# meshed with tetrahedral +### -# Define values -\n name = "ex21_lamp" -\n cote = 60 -\n section = 20 -\n size = 200 -\n radius_1 = 80 -\n radius_2 = 40 -\n height = 100 +# Define values +name = "ex21_lamp" +cote = 60 +section = 20 +size = 200 +radius_1 = 80 +radius_2 = 40 +height = 100 -# Build a box -\n box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote) +# Build a box +box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote) -# Build a cylinder -\n pt1 = MakeVertex(0, 0, cote/3) -\n di1 = MakeVectorDXDYDZ(0, 0, 1) -\n cyl = MakeCylinder(pt1, di1, section, size) +# Build a cylinder +pt1 = MakeVertex(0, 0, cote/3) +di1 = MakeVectorDXDYDZ(0, 0, 1) +cyl = MakeCylinder(pt1, di1, section, size) -# Build a truncated cone -\n pt2 = MakeVertex(0, 0, size) -\n cone = MakeCone(pt2, di1, radius_1, radius_2, height) +# Build a truncated cone +pt2 = MakeVertex(0, 0, size) +cone = MakeCone(pt2, di1, radius_1, radius_2, height) -# Fuse -\n box_cyl = MakeFuse(box, cyl) -\n piece = MakeFuse(box_cyl, cone) +# Fuse +box_cyl = MakeFuse(box, cyl) +piece = MakeFuse(box_cyl, cone) -# Add in study -\n addToStudy(piece, name) +# Add to the study +addToStudy(piece, name) -# Create a group of faces -\n group = CreateGroup(piece, ShapeType["FACE"]) -\n group_name = name + "_grp" -\n addToStudy(group, group_name) -\n group.SetName(group_name) +# Create a group of faces +group = CreateGroup(piece, ShapeType["FACE"]) +group_name = name + "_grp" +addToStudy(group, group_name) +group.SetName(group_name) -# Add faces in the group -\n faces = SubShapeAllIDs(piece, ShapeType["FACE"]) -\n UnionIDs(group, faces) +# Add faces to the group +faces = SubShapeAllIDs(piece, ShapeType["FACE"]) +UnionIDs(group, faces) -# Create a mesh +### +# Create a mesh +### -# Define a mesh on a geometry -\n tetra = smesh.Mesh(piece, name) +# Define a mesh on a geometry +tetra = smesh.Mesh(piece, name) -# Define 1D hypothesis -\n algo1d = tetra.Segment() -\n algo1d.LocalLength(10) +# Define 1D hypothesis +algo1d = tetra.Segment() +algo1d.LocalLength(10) -# Define 2D hypothesis -\n algo2d = tetra.Triangle() -\n algo2d.LengthFromEdges() +# Define 2D hypothesis +algo2d = tetra.Triangle() +algo2d.LengthFromEdges() -# Define 3D hypothesis -\n algo3d = tetra.Tetrahedron(smesh.NETGEN) -\n algo3d.MaxElementVolume(100) +# Define 3D hypothesis +algo3d = tetra.Tetrahedron(smesh.NETGEN) +algo3d.MaxElementVolume(100) -# Compute the mesh -\n tetra.Compute() +# Compute the mesh +tetra.Compute() -# Create a groupe of faces -\n tetra.Group(group) +# Create a groupe of faces +tetra.Group(group) -\n Examples of Python scripts for all Mesh operations are available by -the following links: +\endcode -
        -
      • \subpage tui_creating_meshes_page
      • -
      • \subpage tui_viewing_meshes_page
      • -
      • \subpage tui_defining_hypotheses_page
      • -
      • \subpage tui_quality_controls_page
      • -
      • \subpage tui_grouping_elements_page
      • -
      • \subpage tui_modifying_meshes_page
      • -
      • \subpage tui_transforming_meshes_page
      • -
      • \subpage tui_notebook_smesh_page
      • -
      +Examples of Python scripts for all Mesh operations are available by +the following links: +- \subpage tui_creating_meshes_page +- \subpage tui_viewing_meshes_page +- \subpage tui_defining_hypotheses_page +- \subpage tui_quality_controls_page +- \subpage tui_grouping_elements_page +- \subpage tui_modifying_meshes_page +- \subpage tui_transforming_meshes_page +- \subpage tui_notebook_smesh_page */ diff --git a/doc/salome/gui/SMESH/input/translation.doc b/doc/salome/gui/SMESH/input/translation.doc index e4589b5a6..2f0f0743e 100644 --- a/doc/salome/gui/SMESH/input/translation.doc +++ b/doc/salome/gui/SMESH/input/translation.doc @@ -64,13 +64,9 @@ name in the adjacent box);
    -
  • Click \b Apply or Apply and Close button to confirm the -operation.
  • - +
  • Click \b Apply or Apply and Close button to confirm the operation.
  • - -
    See Also a sample TUI Script of a -\ref tui_translation "Translation" operation. +
    See Also a sample TUI Script of a \ref tui_translation "Translation" operation. */ diff --git a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc index 9048afef1..87f740e98 100644 --- a/doc/salome/gui/SMESH/input/tui_creating_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_creating_meshes.doc @@ -2,7 +2,7 @@ \page tui_creating_meshes_page Creating Meshes -\n First of all see \ref introduction_to_mesh_python_page "Example of 3d mesh generation", +\n First of all see \ref example_3d_mesh "Example of 3d mesh generation", which is an example of good python script style for Mesh module.
    diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc index 8c93ca2e3..04725fdc6 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc @@ -468,9 +468,83 @@ src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False) \endcode +
    + +\anchor tui_fixed_points + +

    1D Mesh with Fixed Points example

    + +\code +import salome +import geompy +import smesh +import StdMeshers + +# Create face and explode it on edges +face = geompy.MakeFaceHW(100, 100, 1) +edges = geompy.SubShapeAllSorted(face, geompy.ShapeType["EDGE"]) +geompy.addToStudy( face, "Face" ) + +# get the first edge from exploded result +edge1 = geompy.GetSubShapeID(face, edges[0]) + +# Define Mesh on previously created face +Mesh_1 = smesh.Mesh(face) + +# Create Fixed Point 1D hypothesis and define parameters. +# Note: values greater than 1.0 and less than 0.0 are not taken into account; +# duplicated values are removed. Also, if not specified explicitly, values 0.0 and 1.0 +# add added automatically. +# The number of segments should correspond to the number of points (NbSeg = NbPnt-1); +# extra values of segments splitting parameter are not taken into account, +# while missing values are considered to be equal to 1. +Fixed_points_1D_1 = smesh.CreateHypothesis('FixedPoints1D') +Fixed_points_1D_1.SetPoints( [ 1.1, 0.9, 0.5, 0.0, 0.5, -0.3 ] ) +Fixed_points_1D_1.SetNbSegments( [ 3, 1, 2 ] ) +Fixed_points_1D_1.SetReversedEdges( [edge1] ) + +# Add hypothesis to mesh and define 2D parameters +Mesh_1.AddHypothesis(Fixed_points_1D_1) +Regular_1D = Mesh_1.Segment() +Quadrangle_2D = Mesh_1.Quadrangle() +# Compute mesh +Mesh_1.Compute() +\endcode + +\anchor tui_radial_quadrangle +

    Radial Quadrangle 1D2D example

    +\code +import salome +import geompy +import smesh +import StdMeshers + +# Create face from the wire and add to study +WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WW", [0, 0, 0, 1, 0, 0, 0, 0, 1]) +Face = geompy.MakeFace(WirePath,1) +geompy.addToStudy(Face,"Face") + +# Define geometry for mesh, and 1D parameters +mesh = smesh.Mesh(Face) +Wire_discretisation = mesh.Segment() +Nb_Segments = Wire_discretisation.NumberOfSegments(5) +Nb_Segments.SetDistrType( 0 ) + +# Define 2D parameters and Radial Quadrange hypothesis +Number_of_Layers = smesh.CreateHypothesis('NumberOfLayers2D') +Number_of_Layers.SetNumberOfLayers( 4 ) +mesh.AddHypothesis(Number_of_Layers) +RadialQuadrangle_1D2D = smesh.CreateHypothesis('RadialQuadrangle_1D2D') +mesh.AddHypothesis(RadialQuadrangle_1D2D) + +mesh.Compute() +\endcode + + \n Other meshing algorithms:
    • \subpage tui_defining_blsurf_hypotheses_page
    • +
    • \subpage tui_defining_ghs3d_hypotheses_page
    */ diff --git a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc index e03433f1c..b77edd21e 100644 --- a/doc/salome/gui/SMESH/input/tui_grouping_elements.doc +++ b/doc/salome/gui/SMESH/input/tui_grouping_elements.doc @@ -1,4 +1,4 @@ -/*! + /*! \page tui_grouping_elements_page Grouping Elements @@ -318,13 +318,13 @@ salome.sg.updateObjBrowser(1) \endcode \image html dimgroup_tui1.png -
    Source groups of faces<\center> +
    Source groups of faces
    \image html dimgroup_tui2.png -
    Result groups of edges and nodes<\center> +
    Result groups of edges and nodes
    -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc index bc7b78c89..66b6361fa 100644 --- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc @@ -815,4 +815,48 @@ isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0) if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode() \endcode -*/ \ No newline at end of file +
    +\anchor tui_quadratic +

    Convert mesh to/from quadratic

    + +\code +import geompy +import smesh + +# create sphere of radius 100 + +Sphere = geompy.MakeSphereR( 100 ) +geompy.addToStudy( Sphere, "Sphere" ) + +# create simple trihedral mesh + +Mesh = smesh.Mesh(Sphere) +Regular_1D = Mesh.Segment() +Nb_Segments = Regular_1D.NumberOfSegments(5) +MEFISTO_2D = Mesh.Triangle() +Tetrahedron_Netgen = Mesh.Tetrahedron(algo=smesh.NETGEN) + +# compute mesh + +isDone = Mesh.Compute() + +# convert to quadratic +# theForce3d = 1; this results in the medium node lying at the +# middle of the line segments connecting start and end node of a mesh +# element + +Mesh.ConvertToQuadratic( theForce3d=1 ) + +# revert back to the non-quadratic mesh + +Mesh.ConvertFromQuadratic() + +# convert to quadratic +# theForce3d = 0; this results in the medium node lying at the +# geometrical edge from which the mesh element is built + +Mesh.ConvertToQuadratic( theForce3d=0 ) + +\endcode + +*/ diff --git a/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc b/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc index 59681c16b..862cb302e 100644 --- a/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_viewing_meshes.doc @@ -9,10 +9,12 @@ \code import geompy import smesh +import SMESH # create a box box = geompy.MakeBox(0., 0., 0., 20., 20., 20.) geompy.addToStudy(box, "box") +[Face_1,Face_2,Face_3,Face_4,Face_5,Face_5] = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) # create a mesh tetra = smesh.Mesh(box, "MeshBox") @@ -26,10 +28,22 @@ algo2D.MaxElementArea(10.) algo3D = tetra.Tetrahedron(smesh.NETGEN) algo3D.MaxElementVolume(900.) +# Creation of SubMesh +Regular_1D_1_1 = tetra.Segment(geom=Face_1) +Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5) +Nb_Segments_1.SetDistrType( 0 ) +Quadrangle_2D = tetra.Quadrangle(geom=Face_1) +isDone = tetra.Compute() +submesh = Regular_1D_1_1.GetSubMesh() + # compute the mesh tetra.Compute() -# print information about the mesh +# Creation of group +group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' ) +nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] ) + +# Print information about the mesh print "Information about mesh:" print "Number of nodes : ", tetra.NbNodes() print "Number of edges : ", tetra.NbEdges() @@ -43,5 +57,30 @@ print " hexahedrons : ", tetra.NbHexas() print " prisms : ", tetra.NbPrisms() print " pyramids : ", tetra.NbPyramids() print " polyhedrons : ", tetra.NbPolyhedrons() + +# Get Information About Mesh by GetMeshInfo +print "\nInformation about mesh by GetMeshInfo:" +info = smesh.GetMeshInfo(tetra) +keys = info.keys(); keys.sort() +for i in keys: + print " %s : %d" % ( i, info[i] ) + pass + +# Get Information About Group by GetMeshInfo +print "\nInformation about group by GetMeshInfo:" +info = smesh.GetMeshInfo(group) +keys = info.keys(); keys.sort() +for i in keys: + print " %s : %d" % ( i, info[i] ) + pass + +# Get Information About SubMesh by GetMeshInfo +print "\nInformation about Submesh by GetMeshInfo:" +info = smesh.GetMeshInfo(submesh) +keys = info.keys(); keys.sort() +for i in keys: + print " %s : %d" % ( i, info[i] ) + pass \endcode -*/ \ No newline at end of file + +*/ diff --git a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc index 01a272de2..ee4c6dd4a 100644 --- a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc +++ b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc @@ -38,7 +38,7 @@ meshes.
  • \subpage transparency_page "Transparency" - allows to change the transparency of mesh elements.
  • \subpage clipping_page "Clipping" - allows to create cross-sections of the selected objects.
  • -
  • \ref about_quality_controls_page "Controls" - graphically +
  • \ref quality_page "Controls" - graphically presents various information about meshes.
  • Hide - allows to hide the selected mesh from the viewer.
  • Show Only -allows to display only the selected mesh, hiding all other from the viewer.
  • diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index fff0c5120..8a5c37daa 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -46,7 +46,6 @@ module SMESH enum log_command { ADD_NODE, - ADD_ELEM0D, ADD_EDGE, ADD_TRIANGLE, ADD_QUADRANGLE, @@ -69,7 +68,8 @@ module SMESH ADD_QUADTETRAHEDRON, ADD_QUADPYRAMID, ADD_QUADPENTAHEDRON, - ADD_QUADHEXAHEDRON + ADD_QUADHEXAHEDRON, + ADD_ELEM0D }; struct log_block diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index b077a164d..62623567a 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -696,6 +696,49 @@ module SMESH * not creared - returns empty list */ long_array GetLastCreatedElems(); + + /*! + * \brief Creates a hole in a mesh by doubling the nodes of some particular elements + * \param theNodes - identifiers of nodes to be doubled + * \param theModifiedElems - identifiers of elements to be updated by the new (doubled) + * nodes. If list of element identifiers is empty then nodes are doubled but + * they not assigned to elements + * \return TRUE if operation has been completed successfully, FALSE otherwise + * \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups() + */ + boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems ); + + /*! + * \brief Creates a hole in a mesh by doubling the nodes of some particular elements + * This method provided for convenience works as DoubleNodes() described above. + * \param theNodeId - identifier of node to be doubled. + * \param theModifiedElems - identifiers of elements to be updated. + * \return TRUE if operation has been completed successfully, FALSE otherwise + * \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups() + */ + boolean DoubleNode( in long theNodeId, in long_array theModifiedElems ); + + /*! + * \brief Creates a hole in a mesh by doubling the nodes of some particular elements + * This method provided for convenience works as DoubleNodes() described above. + * \param theNodes - group of nodes to be doubled. + * \param theModifiedElems - group of elements to be updated. + * \return TRUE if operation has been completed successfully, FALSE otherwise + * \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups() + */ + boolean DoubleNodeGroup( in SMESH_GroupBase theNodes, + in SMESH_GroupBase theModifiedElems ); + + /*! + \brief Creates a hole in a mesh by doubling the nodes of some particular elements + This method provided for convenience works as DoubleNodes() described above. + \param theNodes - list of groups of nodes to be doubled + \param theModifiedElems - list of groups of elements to be updated. + \return TRUE if operation has been completed successfully, FALSE otherwise + \sa DoubleNode(), DoubleNodeGroup(), DoubleNodes() + */ + boolean DoubleNodeGroups( in ListOfGroups theNodes, + in ListOfGroups theModifiedElems ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -707,9 +750,9 @@ module SMESH * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroup(), DoubleNodeGroups() */ - boolean DoubleNodes( in long_array theElems, - in long_array theNodesNot, - in long_array theAffectedElems ); + boolean DoubleNodeElem( in long_array theElems, + in long_array theNodesNot, + in long_array theAffectedElems ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -722,9 +765,9 @@ module SMESH * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion() */ - boolean DoubleNodesInRegion( in long_array theElems, - in long_array theNodesNot, - in GEOM::GEOM_Object theShape ); + boolean DoubleNodeElemInRegion( in long_array theElems, + in long_array theNodesNot, + in GEOM::GEOM_Object theShape ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -736,9 +779,9 @@ module SMESH * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodes(), DoubleNodeGroups() */ - boolean DoubleNodeGroup( in SMESH_GroupBase theElems, - in SMESH_GroupBase theNodesNot, - in SMESH_GroupBase theAffectedElems ); + boolean DoubleNodeElemGroup( in SMESH_GroupBase theElems, + in SMESH_GroupBase theNodesNot, + in SMESH_GroupBase theAffectedElems ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -751,7 +794,7 @@ module SMESH * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion() */ - boolean DoubleNodeGroupInRegion( in SMESH_GroupBase theElems, + boolean DoubleNodeElemGroupInRegion( in SMESH_GroupBase theElems, in SMESH_GroupBase theNodesNot, in GEOM::GEOM_Object theShape ); @@ -765,9 +808,9 @@ module SMESH * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroup(), DoubleNodes() */ - boolean DoubleNodeGroups( in ListOfGroups theElems, - in ListOfGroups theNodesNot, - in ListOfGroups theAffectedElems ); + boolean DoubleNodeElemGroups( in ListOfGroups theElems, + in ListOfGroups theNodesNot, + in ListOfGroups theAffectedElems ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -780,9 +823,9 @@ module SMESH * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion() */ - boolean DoubleNodeGroupsInRegion( in ListOfGroups theElems, - in ListOfGroups theNodesNot, - in GEOM::GEOM_Object theShape ); + boolean DoubleNodeElemGroupsInRegion( in ListOfGroups theElems, + in ListOfGroups theNodesNot, + in GEOM::GEOM_Object theShape ); /*! * \brief Generated skin mesh (containing 2D cells) from 3D mesh diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 7a6e5428c..a9a3df7f8 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -149,21 +149,21 @@ namespace{ // SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator(); // if ( anIter != 0 ) { // while( anIter->more() ) { -// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); -// if ( aNode == 0 ) -// return 0; -// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator(); -// while( anElemIter->more() ) { -// const SMDS_MeshElement* anElem = anElemIter->next(); -// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) { -// int anId = anElem->GetID(); - -// if ( anIter->more() ) // i.e. first node -// aMap.Add( anId ); -// else if ( aMap.Contains( anId ) ) -// aResult++; -// } -// } +// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); +// if ( aNode == 0 ) +// return 0; +// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator(); +// while( anElemIter->more() ) { +// const SMDS_MeshElement* anElem = anElemIter->next(); +// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) { +// int anId = anElem->GetID(); + +// if ( anIter->more() ) // i.e. first node +// aMap.Add( anId ); +// else if ( aMap.Contains( anId ) ) +// aResult++; +// } +// } // } // } @@ -476,9 +476,9 @@ namespace{ inline double getArea(double theHalfPerim, double theTria[3]){ return sqrt(theHalfPerim* - (theHalfPerim-theTria[0])* - (theHalfPerim-theTria[1])* - (theHalfPerim-theTria[2])); + (theHalfPerim-theTria[0])* + (theHalfPerim-theTria[1])* + (theHalfPerim-theTria[2])); } inline double getVolume(double theLen[6]){ @@ -1036,160 +1036,160 @@ double Length2D::GetValue( long theElementId) case SMDSAbs_Node: case SMDSAbs_Edge: if (len == 2){ - aVal = getDistance( P( 1 ), P( 2 ) ); + aVal = getDistance( P( 1 ), P( 2 ) ); break; } else if (len == 3){ // quadratic edge - aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 )); + aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 )); break; } case SMDSAbs_Face: if (len == 3){ // triangles - double L1 = getDistance(P( 1 ),P( 2 )); - double L2 = getDistance(P( 2 ),P( 3 )); - double L3 = getDistance(P( 3 ),P( 1 )); - aVal = Max(L1,Max(L2,L3)); - break; + double L1 = getDistance(P( 1 ),P( 2 )); + double L2 = getDistance(P( 2 ),P( 3 )); + double L3 = getDistance(P( 3 ),P( 1 )); + aVal = Max(L1,Max(L2,L3)); + break; } else if (len == 4){ // quadrangles - double L1 = getDistance(P( 1 ),P( 2 )); - double L2 = getDistance(P( 2 ),P( 3 )); - double L3 = getDistance(P( 3 ),P( 4 )); - double L4 = getDistance(P( 4 ),P( 1 )); - aVal = Max(Max(L1,L2),Max(L3,L4)); - break; + double L1 = getDistance(P( 1 ),P( 2 )); + double L2 = getDistance(P( 2 ),P( 3 )); + double L3 = getDistance(P( 3 ),P( 4 )); + double L4 = getDistance(P( 4 ),P( 1 )); + aVal = Max(Max(L1,L2),Max(L3,L4)); + break; } if (len == 6){ // quadratic triangles - double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 )); - double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 )); - double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 )); - aVal = Max(L1,Max(L2,L3)); + double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 )); + double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 )); + double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 )); + aVal = Max(L1,Max(L2,L3)); //cout<<"L1="< + using namespace std; Driver_Mesh::Status DriverDAT_R_SMDS_Mesh::Perform() { + Kernel_Utils::Localizer loc; Status aResult = DRS_OK; int i, j; diff --git a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx index 91b06d6b1..54741eac3 100644 --- a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx +++ b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx @@ -27,10 +27,13 @@ #include "utilities.h" +#include + using namespace std; Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform() { + Kernel_Utils::Localizer loc; Status aResult = DRS_OK; int nbNodes, nbCells; diff --git a/src/DriverDAT/Makefile.am b/src/DriverDAT/Makefile.am index 2a9973796..d0307a593 100644 --- a/src/DriverDAT/Makefile.am +++ b/src/DriverDAT/Makefile.am @@ -65,6 +65,7 @@ libMeshDriverDAT_la_CPPFLAGS = \ libMeshDriverDAT_la_LDFLAGS = \ ../Driver/libMeshDriver.la \ + $(KERNEL_LDFLAGS) -lSALOMEBasics \ $(CAS_KERNEL) DAT_Test_CPPFLAGS = \ diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index 84fbf8937..31a69cfc1 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -23,12 +23,11 @@ // File : DriverMED_Family.cxx // Author : Julia DOROVSKIKH // Module : SMESH -// $Header$ // #include "DriverMED_Family.h" #include "MED_Factory.hxx" -#include +#include using namespace std; @@ -83,7 +82,7 @@ void DriverMED_Family ::SetType(const SMDSAbs_ElementType theType) { - myType = theType; + myTypes.insert( myType = theType ); } SMDSAbs_ElementType @@ -93,6 +92,13 @@ DriverMED_Family return myType; } +const std::set< SMDSAbs_ElementType >& +DriverMED_Family +::GetTypes() const +{ + return myTypes; +} + bool DriverMED_Family ::MemberOf(std::string theGroupName) const @@ -139,11 +145,11 @@ DriverMED_Family DriverMED_FamilyPtrList DriverMED_Family ::MakeFamilies(const SMESHDS_SubMeshPtrMap& theSubMeshes, - const SMESHDS_GroupBasePtrList& theGroups, - const bool doGroupOfNodes, - const bool doGroupOfEdges, - const bool doGroupOfFaces, - const bool doGroupOfVolumes) + const SMESHDS_GroupBasePtrList& theGroups, + const bool doGroupOfNodes, + const bool doGroupOfEdges, + const bool doGroupOfFaces, + const bool doGroupOfVolumes) { DriverMED_FamilyPtrList aFamilies; @@ -189,7 +195,7 @@ DriverMED_Family aFamilies.erase(aCurrIter); } if (aFam2->IsEmpty()) - break; + break; } } // The rest elements of family @@ -218,7 +224,7 @@ DriverMED_Family aFam1->Split(aFam2, aCommon); if (!aCommon->IsEmpty()) { - aCommon->SetGroupAttributVal(0); + aCommon->SetGroupAttributVal(0); aFamilies.push_back(aCommon); } if (aFam1->IsEmpty()) @@ -226,7 +232,7 @@ DriverMED_Family aFamilies.erase(aCurrIter); } if (aFam2->IsEmpty()) - break; + break; } } // The rest elements of group @@ -310,7 +316,7 @@ DriverMED_Family //============================================================================= MED::PFamilyInfo DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper, - const MED::PMeshInfo& theMeshInfo) const + const MED::PMeshInfo& theMeshInfo) const { ostringstream aStr; aStr << "FAM_" << myId; @@ -332,20 +338,20 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper, MED::PFamilyInfo anInfo; if(myId == 0 || myGroupAttributVal == 0){ anInfo = theWrapper->CrFamilyInfo(theMeshInfo, - aValue, - myId, - myGroupNames); + aValue, + myId, + myGroupNames); }else{ MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description, MED::TIntVector anAttrIds (1, myId); // Id=0, MED::TIntVector anAttrVals (1, myGroupAttributVal); anInfo = theWrapper->CrFamilyInfo(theMeshInfo, - aValue, - myId, - myGroupNames, - anAttrDescs, - anAttrIds, - anAttrVals); + aValue, + myId, + myGroupNames, + anAttrDescs, + anAttrIds, + anAttrVals); } // cout << endl; @@ -413,7 +419,7 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup) DriverMED_FamilyPtrList DriverMED_Family ::SplitByType (SMESHDS_SubMesh* theSubMesh, - const int theId) + const int theId) { DriverMED_FamilyPtrList aFamilies; DriverMED_FamilyPtr aNodesFamily (new DriverMED_Family); diff --git a/src/DriverMED/DriverMED_Family.h b/src/DriverMED/DriverMED_Family.h index 6ec769bba..f91693a88 100644 --- a/src/DriverMED/DriverMED_Family.h +++ b/src/DriverMED/DriverMED_Family.h @@ -23,7 +23,6 @@ // File : DriverMED_Family.hxx // Author : Julia DOROVSKIKH // Module : SMESH -// $Header$ // #ifndef _INCLUDE_DRIVERMED_FAMILY #define _INCLUDE_DRIVERMED_FAMILY @@ -68,16 +67,16 @@ class MESHDRIVERMED_EXPORT DriverMED_Family static DriverMED_FamilyPtrList MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes, - const SMESHDS_GroupBasePtrList& theGroups, - const bool doGroupOfNodes, - const bool doGroupOfEdges, - const bool doGroupOfFaces, - const bool doGroupOfVolumes); + const SMESHDS_GroupBasePtrList& theGroups, + const bool doGroupOfNodes, + const bool doGroupOfEdges, + const bool doGroupOfFaces, + const bool doGroupOfVolumes); //! Create TFamilyInfo for this family MED::PFamilyInfo GetFamilyInfo (const MED::PWrapper& theWrapper, - const MED::PMeshInfo& theMeshInfo) const; + const MED::PMeshInfo& theMeshInfo) const; //! Returns elements of this family const ElementsSet& GetElements () const; @@ -99,6 +98,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family void SetType(const SMDSAbs_ElementType theType); SMDSAbs_ElementType GetType(); + const std::set< SMDSAbs_ElementType >& GetTypes() const; bool MemberOf(std::string theGroupName) const; @@ -113,7 +113,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family static DriverMED_FamilyPtrList SplitByType(SMESHDS_SubMesh* theSubMesh, - const int theId); + const int theId); /*! Remove from elements, common with , @@ -121,7 +121,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family Create family from common elements, with combined groups list. */ void Split (DriverMED_FamilyPtr by, - DriverMED_FamilyPtr common); + DriverMED_FamilyPtr common); //! Check, if this family has empty list of elements bool IsEmpty () const; @@ -133,6 +133,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family ElementsSet myElements; MED::TStringSet myGroupNames; int myGroupAttributVal; + std::set myTypes; // Issue 0020576 }; #endif diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 145a13c93..af538f52f 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -48,10 +48,11 @@ static int MYDEBUG = 0; #define _EDF_NODE_IDS_ using namespace MED; +using namespace std; void DriverMED_R_SMESHDS_Mesh -::SetMeshName(std::string theMeshName) +::SetMeshName(string theMeshName) { myMeshName = theMeshName; } @@ -60,7 +61,7 @@ static const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, TInt theId){ const SMDS_MeshNode* aNode = theMesh->FindNode(theId); if(aNode) return aNode; - EXCEPTION(std::runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<GetName()); - if(aMeshName != aMeshInfo->GetName()) continue; + if(MYDEBUG) MESSAGE("Perform - aMeshName : "<GetName()); + if(aMeshName != aMeshInfo->GetName()) continue; aResult = DRS_OK; - //TInt aMeshDim = aMeshInfo->GetDim(); - + //TInt aMeshDim = aMeshInfo->GetDim(); + // Reading MED families to the temporary structure - //------------------------------------------------ - TErr anErr; - TInt aNbFams = aMed->GetNbFamilies(aMeshInfo); + //------------------------------------------------ + TErr anErr; + TInt aNbFams = aMed->GetNbFamilies(aMeshInfo); if(MYDEBUG) MESSAGE("Read " << aNbFams << " families"); for (TInt iFam = 0; iFam < aNbFams; iFam++) { - PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr); - if(anErr >= 0){ - TInt aFamId = aFamilyInfo->GetId(); - if(MYDEBUG) MESSAGE("Family " << aFamId << " :"); - + PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo,iFam+1,&anErr); + if(anErr >= 0){ + TInt aFamId = aFamilyInfo->GetId(); + if(MYDEBUG) MESSAGE("Family " << aFamId << " :"); + DriverMED_FamilyPtr aFamily (new DriverMED_Family); - + TInt aNbGrp = aFamilyInfo->GetNbGroup(); if(MYDEBUG) MESSAGE("belong to " << aNbGrp << " groups"); - bool isAttrOk = false; - if(aFamilyInfo->GetNbAttr() == aNbGrp) - isAttrOk = true; + bool isAttrOk = false; + if(aFamilyInfo->GetNbAttr() == aNbGrp) + isAttrOk = true; for (TInt iGr = 0; iGr < aNbGrp; iGr++) { - std::string aGroupName = aFamilyInfo->GetGroupName(iGr); + string aGroupName = aFamilyInfo->GetGroupName(iGr); if(isAttrOk){ - TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr); - aFamily->SetGroupAttributVal(anAttrVal); - } - + TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr); + aFamily->SetGroupAttributVal(anAttrVal); + } + if(MYDEBUG) MESSAGE(aGroupName); aFamily->AddGroupName(aGroupName); - + } aFamily->SetId( aFamId ); myFamilies[aFamId] = aFamily; - } + } } - if (aMeshInfo->GetType() == MED::eSTRUCTURE){ - /*bool aRes = */buildMeshGrille(aMed,aMeshInfo); - continue; - } + if (aMeshInfo->GetType() == MED::eSTRUCTURE){ + /*bool aRes = */buildMeshGrille(aMed,aMeshInfo); + continue; + } // Reading MED nodes to the corresponding SMDS structure - //------------------------------------------------------ + //------------------------------------------------------ PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); - if (!aNodeInfo) { + if (!aNodeInfo) { aResult = DRS_FAIL; - continue; + continue; } - PCoordHelper aCoordHelper = GetCoordHelper(aNodeInfo); + PCoordHelper aCoordHelper = GetCoordHelper(aNodeInfo); - EBooleen anIsNodeNum = aNodeInfo->IsElemNum(); - TInt aNbElems = aNodeInfo->GetNbElem(); - if(MYDEBUG) MESSAGE("Perform - aNodeInfo->GetNbElem() = "<GetNbElem() = "<X()<<", "<Y()<<", "<Z()< TNodeIds; + // Reading pre information about all MED cells + //-------------------------------------------- + typedef MED::TVector TNodeIds; bool takeNumbers = true; // initially we trust the numbers from file - MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo); - MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin(); - for(; anEntityIter != aEntityInfo.end(); anEntityIter++){ - const EEntiteMaillage& anEntity = anEntityIter->first; - if(anEntity == eNOEUD) continue; - // Reading MED cells to the corresponding SMDS structure - //------------------------------------------------------ - const MED::TGeom2Size& aGeom2Size = anEntityIter->second; - MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin(); - for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ - const EGeometrieElement& aGeom = aGeom2SizeIter->first; - - switch(aGeom) { -// case ePOINT1: ## PAL16410 -// break; - case ePOLYGONE: { + MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo); + MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin(); + for(; anEntityIter != aEntityInfo.end(); anEntityIter++){ + const EEntiteMaillage& anEntity = anEntityIter->first; + if(anEntity == eNOEUD) continue; + // Reading MED cells to the corresponding SMDS structure + //------------------------------------------------------ + const MED::TGeom2Size& aGeom2Size = anEntityIter->second; + MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin(); + for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ + const EGeometrieElement& aGeom = aGeom2SizeIter->first; + + switch(aGeom) { +// case ePOINT1: ## PAL16410 +// break; + case ePOLYGONE: { PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom); EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX; - - TInt aNbElem = aPolygoneInfo->GetNbElem(); - for(TInt iElem = 0; iElem < aNbElem; iElem++){ - MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem); - TInt aNbConn = aPolygoneInfo->GetNbConn(iElem); - TNodeIds aNodeIds(aNbConn); + + TInt aNbElem = aPolygoneInfo->GetNbElem(); + for(TInt iElem = 0; iElem < aNbElem; iElem++){ + MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem); + TInt aNbConn = aPolygoneInfo->GetNbConn(iElem); + TNodeIds aNodeIds(aNbConn); #ifdef _EDF_NODE_IDS_ - if(anIsNodeNum) - for(TInt iConn = 0; iConn < aNbConn; iConn++) - aNodeIds[iConn] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1); - else - for(TInt iConn = 0; iConn < aNbConn; iConn++) - aNodeIds[iConn] = aConnSlice[iConn]; + if(anIsNodeNum) + for(TInt iConn = 0; iConn < aNbConn; iConn++) + aNodeIds[iConn] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1); + else + for(TInt iConn = 0; iConn < aNbConn; iConn++) + aNodeIds[iConn] = aConnSlice[iConn]; #else - for(TInt iConn = 0; iConn < aNbConn; iConn++) - aNodeIds[iConn] = aConnSlice[iConn]; + for(TInt iConn = 0; iConn < aNbConn; iConn++) + aNodeIds[iConn] = aConnSlice[iConn]; #endif bool isRenum = false; SMDS_MeshElement* anElement = NULL; @@ -221,12 +222,12 @@ DriverMED_R_SMESHDS_Mesh try{ #endif if(anIsElemNum){ - TInt anElemId = aPolygoneInfo->GetElemNum(iElem); + TInt anElemId = aPolygoneInfo->GetElemNum(iElem); anElement = myMesh->AddPolygonalFaceWithID(aNodeIds,anElemId); - } + } if(!anElement){ - std::vector aNodes(aNbConn); - for(TInt iConn = 0; iConn < aNbConn; iConn++) + vector aNodes(aNbConn); + for(TInt iConn = 0; iConn < aNbConn; iConn++) aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]); anElement = myMesh->AddPolygonalFace(aNodes); isRenum = anIsElemNum; @@ -256,107 +257,107 @@ DriverMED_R_SMESHDS_Mesh } } break; - } - case ePOLYEDRE: { + } + case ePOLYEDRE: { PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom); EBooleen anIsElemNum = takeNumbers ? aPolyedreInfo->IsElemNum() : eFAUX; - TInt aNbElem = aPolyedreInfo->GetNbElem(); - for(TInt iElem = 0; iElem < aNbElem; iElem++){ - MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem); - TInt aNbFaces = aConnSliceArr.size(); + TInt aNbElem = aPolyedreInfo->GetNbElem(); + for(TInt iElem = 0; iElem < aNbElem; iElem++){ + MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem); + TInt aNbFaces = aConnSliceArr.size(); typedef MED::TVector TQuantities; - TQuantities aQuantities(aNbFaces); - TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem); - TNodeIds aNodeIds(aNbNodes); - for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){ - MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; - TInt aNbConn = aConnSlice.size(); + TQuantities aQuantities(aNbFaces); + TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem); + TNodeIds aNodeIds(aNbNodes); + for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){ + MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; + TInt aNbConn = aConnSlice.size(); aQuantities[iFace] = aNbConn; #ifdef _EDF_NODE_IDS_ - if(anIsNodeNum) - for(TInt iConn = 0; iConn < aNbConn; iConn++) - aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1); - else - for(TInt iConn = 0; iConn < aNbConn; iConn++) - aNodeIds[iNode++] = aConnSlice[iConn]; + if(anIsNodeNum) + for(TInt iConn = 0; iConn < aNbConn; iConn++) + aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1); + else + for(TInt iConn = 0; iConn < aNbConn; iConn++) + aNodeIds[iNode++] = aConnSlice[iConn]; #else - for(TInt iConn = 0; iConn < aNbConn; iConn++) - aNodeIds[iNode++] = aConnSlice[iConn]; -#endif - } - - bool isRenum = false; - SMDS_MeshElement* anElement = NULL; - TInt aFamNum = aPolyedreInfo->GetFamNum(iElem); - + for(TInt iConn = 0; iConn < aNbConn; iConn++) + aNodeIds[iNode++] = aConnSlice[iConn]; +#endif + } + + bool isRenum = false; + SMDS_MeshElement* anElement = NULL; + TInt aFamNum = aPolyedreInfo->GetFamNum(iElem); + #ifndef _DEXCEPT_ - try{ + try{ #endif - if(anIsElemNum){ - TInt anElemId = aPolyedreInfo->GetElemNum(iElem); - anElement = myMesh->AddPolyhedralVolumeWithID(aNodeIds,aQuantities,anElemId); - } - if(!anElement){ - std::vector aNodes(aNbNodes); - for(TInt iConn = 0; iConn < aNbNodes; iConn++) - aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]); - anElement = myMesh->AddPolyhedralVolume(aNodes,aQuantities); - isRenum = anIsElemNum; - } + if(anIsElemNum){ + TInt anElemId = aPolyedreInfo->GetElemNum(iElem); + anElement = myMesh->AddPolyhedralVolumeWithID(aNodeIds,aQuantities,anElemId); + } + if(!anElement){ + vector aNodes(aNbNodes); + for(TInt iConn = 0; iConn < aNbNodes; iConn++) + aNodes[iConn] = FindNode(myMesh,aNodeIds[iConn]); + anElement = myMesh->AddPolyhedralVolume(aNodes,aQuantities); + isRenum = anIsElemNum; + } #ifndef _DEXCEPT_ - }catch(const std::exception& exc){ - aResult = DRS_FAIL; - }catch(...){ - aResult = DRS_FAIL; - } -#endif - if(!anElement){ - aResult = DRS_WARN_SKIP_ELEM; - }else{ - if(isRenum){ - anIsElemNum = eFAUX; - takeNumbers = false; - if (aResult < DRS_WARN_RENUMBER) - aResult = DRS_WARN_RENUMBER; - } - if ( checkFamilyID ( aFamily, aFamNum )) { - // Save reference to this element from its family - aFamily->AddElement(anElement); - aFamily->SetType(anElement->GetType()); - } - } - } + }catch(const std::exception& exc){ + aResult = DRS_FAIL; + }catch(...){ + aResult = DRS_FAIL; + } +#endif + if(!anElement){ + aResult = DRS_WARN_SKIP_ELEM; + }else{ + if(isRenum){ + anIsElemNum = eFAUX; + takeNumbers = false; + if (aResult < DRS_WARN_RENUMBER) + aResult = DRS_WARN_RENUMBER; + } + if ( checkFamilyID ( aFamily, aFamNum )) { + // Save reference to this element from its family + aFamily->AddElement(anElement); + aFamily->SetType(anElement->GetType()); + } + } + } break; } - default: { + default: { PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom); EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX; TInt aNbElems = aCellInfo->GetNbElem(); if(MYDEBUG) MESSAGE("Perform - anEntity = "< DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus) if (TInt aNbMeshes = aMed->GetNbMeshes()) { for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) { - // Reading the MED mesh - //--------------------- - PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1); - aMeshNames.push_back(aMeshInfo->GetName()); + // Reading the MED mesh + //--------------------- + PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1); + aMeshNames.push_back(aMeshInfo->GetName()); } } }catch(const std::exception& exc){ @@ -764,26 +765,28 @@ std::list DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus) return aMeshNames; } -std::list DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes() +list DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes() { - std::list aResult; - std::set aResGroupNames; + list aResult; + set aResGroupNames; - std::map::iterator aFamsIter = myFamilies.begin(); + map::iterator aFamsIter = myFamilies.begin(); for (; aFamsIter != myFamilies.end(); aFamsIter++) { DriverMED_FamilyPtr aFamily = (*aFamsIter).second; const MED::TStringSet& aGroupNames = aFamily->GetGroupNames(); - std::set::const_iterator aGrNamesIter = aGroupNames.begin(); + set::const_iterator aGrNamesIter = aGroupNames.begin(); for (; aGrNamesIter != aGroupNames.end(); aGrNamesIter++) { - TNameAndType aNameAndType = make_pair( *aGrNamesIter, aFamily->GetType() ); - // Check, if this is a Group or SubMesh name -//if (aName.substr(0, 5) == string("Group")) { + const set< SMDSAbs_ElementType >& types = aFamily->GetTypes(); + set< SMDSAbs_ElementType >::const_iterator type = types.begin(); + for ( ; type != types.end(); ++type ) + { + TNameAndType aNameAndType = make_pair( *aGrNamesIter, *type ); if ( aResGroupNames.insert( aNameAndType ).second ) { aResult.push_back( aNameAndType ); } -// } + } } } @@ -792,28 +795,28 @@ std::list DriverMED_R_SMESHDS_Mesh::GetGroupNamesAndTypes() void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup) { - std::string aGroupName (theGroup->GetStoreName()); + string aGroupName (theGroup->GetStoreName()); if(MYDEBUG) MESSAGE("Get Group " << aGroupName); - std::map::iterator aFamsIter = myFamilies.begin(); + map::iterator aFamsIter = myFamilies.begin(); for (; aFamsIter != myFamilies.end(); aFamsIter++) { DriverMED_FamilyPtr aFamily = (*aFamsIter).second; - if (aFamily->GetType() == theGroup->GetType() && aFamily->MemberOf(aGroupName)) + if (aFamily->GetTypes().count( theGroup->GetType() ) && aFamily->MemberOf(aGroupName)) { - const std::set& anElements = aFamily->GetElements(); - std::set::const_iterator anElemsIter = anElements.begin(); - const SMDS_MeshElement * element = 0; + const set& anElements = aFamily->GetElements(); + set::const_iterator anElemsIter = anElements.begin(); for (; anElemsIter != anElements.end(); anElemsIter++) { - element = *anElemsIter; - theGroup->SMDSGroup().Add(element); - int aGroupAttrVal = aFamily->GetGroupAttributVal(); - if( aGroupAttrVal != 0) - theGroup->SetColorGroup(aGroupAttrVal); + const SMDS_MeshElement * element = *anElemsIter; + if ( element->GetType() == theGroup->GetType() ) // Issue 0020576 + theGroup->SMDSGroup().Add(element); } - if ( element ) - theGroup->SetType( theGroup->SMDSGroup().GetType() ); + int aGroupAttrVal = aFamily->GetGroupAttributVal(); + if( aGroupAttrVal != 0) + theGroup->SetColorGroup(aGroupAttrVal); +// if ( element ) -- Issue 0020576 +// theGroup->SetType( theGroup->SMDSGroup().GetType() ); } } } @@ -823,15 +826,15 @@ void DriverMED_R_SMESHDS_Mesh::GetSubMesh (SMESHDS_SubMesh* theSubMesh, { char submeshGrpName[ 30 ]; sprintf( submeshGrpName, "SubMesh %d", theId ); - std::string aName (submeshGrpName); - std::map::iterator aFamsIter = myFamilies.begin(); + string aName (submeshGrpName); + map::iterator aFamsIter = myFamilies.begin(); for (; aFamsIter != myFamilies.end(); aFamsIter++) { DriverMED_FamilyPtr aFamily = (*aFamsIter).second; if (aFamily->MemberOf(aName)) { - const std::set& anElements = aFamily->GetElements(); - std::set::const_iterator anElemsIter = anElements.begin(); + const set& anElements = aFamily->GetElements(); + set::const_iterator anElemsIter = anElements.begin(); if (aFamily->GetType() == SMDSAbs_Node) { for (; anElemsIter != anElements.end(); anElemsIter++) @@ -853,21 +856,21 @@ void DriverMED_R_SMESHDS_Mesh::GetSubMesh (SMESHDS_SubMesh* theSubMesh, void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes () { - std::map::iterator aFamsIter = myFamilies.begin(); + map::iterator aFamsIter = myFamilies.begin(); for (; aFamsIter != myFamilies.end(); aFamsIter++) { DriverMED_FamilyPtr aFamily = (*aFamsIter).second; MED::TStringSet aGroupNames = aFamily->GetGroupNames(); - std::set::iterator aGrNamesIter = aGroupNames.begin(); + set::iterator aGrNamesIter = aGroupNames.begin(); for (; aGrNamesIter != aGroupNames.end(); aGrNamesIter++) { - std::string aName = *aGrNamesIter; + string aName = *aGrNamesIter; // Check, if this is a Group or SubMesh name - if (aName.substr(0, 7) == std::string("SubMesh")) + if (aName.substr(0, 7) == string("SubMesh")) { - int Id = atoi(std::string(aName).substr(7).c_str()); - std::set anElements = aFamily->GetElements(); - std::set::iterator anElemsIter = anElements.begin(); + int Id = atoi(string(aName).substr(7).c_str()); + set anElements = aFamily->GetElements(); + set::iterator anElemsIter = anElements.begin(); if (aFamily->GetType() == SMDSAbs_Node) { for (; anElemsIter != anElements.end(); anElemsIter++) @@ -909,7 +912,7 @@ void DriverMED_R_SMESHDS_Mesh::CreateAllSubMeshes () bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int anID) const { if ( !aFamily || aFamily->GetId() != anID ) { - std::map::const_iterator i_fam = myFamilies.find(anID); + map::const_iterator i_fam = myFamilies.find(anID); if ( i_fam == myFamilies.end() ) return false; aFamily = i_fam->second; @@ -924,7 +927,7 @@ bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int * \return TRUE, if successfully. Else FALSE */ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper, - const MED::PMeshInfo& theMeshInfo) + const MED::PMeshInfo& theMeshInfo) { bool res = true; @@ -944,10 +947,10 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper, if((aGrilleInfo->myFamNumNode).size() > 0){ TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode); if ( checkFamilyID ( aFamily, aFamNum )) - { - aFamily->AddElement(aNode); - aFamily->SetType(SMDSAbs_Node); - } + { + aFamily->AddElement(aNode); + aFamily->SetType(SMDSAbs_Node); + } } } @@ -959,38 +962,38 @@ bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper, switch(aGrilleInfo->GetGeom()){ case MED::eSEG2: if(aNodeIds.size() != 2){ - res = false; - EXCEPTION(std::runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="< + using namespace std; @@ -49,6 +51,7 @@ DriverUNV_R_SMDS_Mesh::~DriverUNV_R_SMDS_Mesh() Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform() { + Kernel_Utils::Localizer loc; Status aResult = DRS_OK; std::ifstream in_stream(myFile.c_str()); try{ diff --git a/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx index 7a4da5e92..7b3a4d22b 100644 --- a/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx +++ b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx @@ -36,6 +36,8 @@ #include "UNV2417_Structure.hxx" #include "UNV_Utilities.hxx" +#include + using namespace std; using namespace UNV; @@ -57,6 +59,7 @@ namespace{ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform() { + Kernel_Utils::Localizer loc; Status aResult = DRS_OK; std::ofstream out_stream(myFile.c_str()); try{ diff --git a/src/DriverUNV/Makefile.am b/src/DriverUNV/Makefile.am index 5b5775f6d..7dfea7184 100644 --- a/src/DriverUNV/Makefile.am +++ b/src/DriverUNV/Makefile.am @@ -78,6 +78,7 @@ libMeshDriverUNV_la_CPPFLAGS = \ libMeshDriverUNV_la_LDFLAGS = \ ../Driver/libMeshDriver.la \ + $(KERNEL_LDFLAGS) -lSALOMEBasics \ $(CAS_KERNEL) UNV_Test_CPPFLAGS = \ diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 24fddc6c1..7a37d6541 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -72,6 +72,11 @@ #include #include +#include +#if !defined(VTK_XVERSION) +#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION) +#endif + #include "utilities.h" #ifdef _DEBUG_ @@ -90,9 +95,9 @@ SMESH_ActorDef* SMESH_ActorDef::New(){ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj, - const char* theEntry, - const char* theName, - int theIsClear) + const char* theEntry, + const char* theName, + int theIsClear) { SMESH_ActorDef* anActor = SMESH_ActorDef::New(); if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){ @@ -399,7 +404,11 @@ SMESH_ActorDef::SMESH_ActorDef() myPtsLabeledDataMapper = vtkLabeledDataMapper::New(); myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput()); +#if (VTK_XVERSION >= 0x050200) + myPtsLabeledDataMapper->SetLabelFormat("%d"); +#else myPtsLabeledDataMapper->SetLabelFormat("%g"); +#endif myPtsLabeledDataMapper->SetLabelModeToLabelScalars(); vtkTextProperty* aPtsTextProp = vtkTextProperty::New(); @@ -440,7 +449,11 @@ SMESH_ActorDef::SMESH_ActorDef() myClsLabeledDataMapper = vtkLabeledDataMapper::New(); myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput()); +#if (VTK_XVERSION >= 0x050200) + myClsLabeledDataMapper->SetLabelFormat("%d"); +#else myClsLabeledDataMapper->SetLabelFormat("%g"); +#endif myClsLabeledDataMapper->SetLabelModeToLabelScalars(); vtkTextProperty* aClsTextProp = vtkTextProperty::New(); @@ -593,7 +606,7 @@ void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled ) vtkIntArray *anArray = vtkIntArray::New(); anArray->SetNumberOfValues( aNbElem ); - for ( int anId = 0; anId < aNbElem; anId++ ) + for ( vtkIdType anId = 0; anId < aNbElem; anId++ ) { int aSMDSId = myVisualObj->GetNodeObjId( anId ); anArray->SetValue( anId, aSMDSId ); @@ -664,7 +677,7 @@ SetControlMode(eControl theMode) void SMESH_ActorDef:: SetControlMode(eControl theMode, - bool theCheckEntityMode) + bool theCheckEntityMode) { SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); if( !mgr ) @@ -796,41 +809,41 @@ SetControlMode(eControl theMode, myControlMode = theMode; switch(myControlMode){ case eFreeNodes: - myNodeExtActor->SetExtControlMode(aFunctor); - break; + myNodeExtActor->SetExtControlMode(aFunctor); + break; case eFreeEdges: case eFreeBorders: - my1DExtActor->SetExtControlMode(aFunctor); - break; + my1DExtActor->SetExtControlMode(aFunctor); + break; case eFreeFaces: - my2DExtActor->SetExtControlMode(aFunctor); - break; + my2DExtActor->SetExtControlMode(aFunctor); + break; case eLength2D: case eMultiConnection2D: - my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable); - break; + my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable); + break; default: - myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable); + myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable); } } if(theCheckEntityMode){ if(myControlActor == my1DActor) - SetEntityMode(eEdges); + SetEntityMode(eEdges); else if(myControlActor == my2DActor){ - switch(myControlMode){ - case eLength2D: - case eFreeEdges: - case eFreeFaces: - case eMultiConnection2D: - //SetEntityMode(eEdges); - SetEntityMode(eFaces); - break; - default: - SetEntityMode(eFaces); - } + switch(myControlMode){ + case eLength2D: + case eFreeEdges: + case eFreeFaces: + case eMultiConnection2D: + //SetEntityMode(eEdges); + SetEntityMode(eFaces); + break; + default: + SetEntityMode(eFaces); + } }else if(myControlActor == my3DActor) - SetEntityMode(eVolumes); + SetEntityMode(eVolumes); } }else if(theCheckEntityMode){ @@ -900,9 +913,9 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, - const char* theEntry, - const char* theName, - int theIsClear) + const char* theEntry, + const char* theName, + int theIsClear) { Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName); setIO(anIO); @@ -1034,8 +1047,8 @@ bool SMESH_ActorDef::IsInfinitive(){ vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid(); aDataSet->Update(); myIsInfinite = aDataSet->GetNumberOfCells() == 0 || - aDataSet->GetNumberOfCells() == 1 && - aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX; + ( aDataSet->GetNumberOfCells() == 1 && + aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX ); return SALOME_Actor::IsInfinitive(); } @@ -1149,21 +1162,21 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ if(myControlMode != eNone){ switch(myControlMode){ case eFreeNodes: - myNodeExtActor->VisibilityOn(); - break; + myNodeExtActor->VisibilityOn(); + break; case eFreeEdges: case eFreeBorders: - my1DExtActor->VisibilityOn(); - break; + my1DExtActor->VisibilityOn(); + break; case eFreeFaces: - my2DExtActor->VisibilityOn(); - break; + my2DExtActor->VisibilityOn(); + break; case eLength2D: case eMultiConnection2D: - my1DExtActor->VisibilityOn(); + my1DExtActor->VisibilityOn(); default: - if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) - myScalarBarActor->VisibilityOn(); + if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) + myScalarBarActor->VisibilityOn(); } } @@ -1462,12 +1475,12 @@ void SMESH_ActorDef::UpdateHighlight(){ myHighlitableActor->SetHighlited(anIsVisible); myHighlitableActor->SetVisibility(anIsVisible); myHighlitableActor->GetExtractUnstructuredGrid()-> - SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells); + SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); }else if(myRepresentation == ePoint || GetPointRepresentation()){ myHighlitableActor->SetHighlited(anIsVisible); myHighlitableActor->GetExtractUnstructuredGrid()-> - SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); + SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); myHighlitableActor->SetVisibility(anIsVisible); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint); } @@ -1585,7 +1598,7 @@ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType mySurfaceProp->SetColor(r,g,b); if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) ) if( aGroupObj->GetElementType() == SMDSAbs_Face || - aGroupObj->GetElementType() == SMDSAbs_Volume ) + aGroupObj->GetElementType() == SMDSAbs_Volume ) myNameActor->SetBackgroundColor(r,g,b); Modified(); } @@ -1758,8 +1771,8 @@ GetClippingPlane(vtkIdType theID) static void ComputeBoundsParam(vtkDataSet* theDataSet, - vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3], - vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj) + vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3], + vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj) { vtkFloatingPointType aBounds[6]; theDataSet->GetBounds(aBounds); @@ -1773,13 +1786,13 @@ static void ComputeBoundsParam(vtkDataSet* theDataSet, } vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]}, - {aBounds[1],aBounds[2],aBounds[4]}, - {aBounds[0],aBounds[3],aBounds[4]}, - {aBounds[1],aBounds[3],aBounds[4]}, - {aBounds[0],aBounds[2],aBounds[5]}, - {aBounds[1],aBounds[2],aBounds[5]}, - {aBounds[0],aBounds[3],aBounds[5]}, - {aBounds[1],aBounds[3],aBounds[5]}}; + {aBounds[1],aBounds[2],aBounds[4]}, + {aBounds[0],aBounds[3],aBounds[4]}, + {aBounds[1],aBounds[3],aBounds[4]}, + {aBounds[0],aBounds[2],aBounds[5]}, + {aBounds[1],aBounds[2],aBounds[5]}, + {aBounds[0],aBounds[3],aBounds[5]}, + {aBounds[1],aBounds[3],aBounds[5]}}; int aMaxId = 0, aMinId = aMaxId; theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]); @@ -1803,7 +1816,7 @@ static void ComputeBoundsParam(vtkDataSet* theDataSet, static void DistanceToPosition(vtkDataSet* theDataSet, - vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3]) + vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3]) { vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj); @@ -1815,7 +1828,7 @@ static void DistanceToPosition(vtkDataSet* theDataSet, static void PositionToDistance(vtkDataSet* theDataSet, - vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist) + vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist) { vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj); diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index 99005dcf1..89f4fc51a 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -44,9 +44,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor public: vtkTypeMacro(SMESH_Actor,SALOME_Actor); static SMESH_Actor* New(TVisualObjPtr theVisualObj, - const char* theEntry, - const char* theName, - int theIsClear); + const char* theEntry, + const char* theName, + int theIsClear); virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0; virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0; @@ -102,7 +102,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes, eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio, - eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D}; + eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D}; virtual void SetControlMode(eControl theMode) = 0; virtual eControl GetControlMode() = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index dbbe0a5bb..98f87fd04 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -272,9 +272,9 @@ class SMESH_ActorDef : public SMESH_Actor ~SMESH_ActorDef(); bool Init(TVisualObjPtr theVisualObj, - const char* theEntry, - const char* theName, - int theIsClear); + const char* theEntry, + const char* theName, + int theIsClear); void SetIsShrunkable(bool theShrunkable); void UpdateHighlight(); diff --git a/src/OBJECT/SMESH_ActorUtils.cxx b/src/OBJECT/SMESH_ActorUtils.cxx index c8fcbfe24..872a30acd 100644 --- a/src/OBJECT/SMESH_ActorUtils.cxx +++ b/src/OBJECT/SMESH_ActorUtils.cxx @@ -41,7 +41,7 @@ namespace SMESH vtkFloatingPointType GetFloat( const QString& theValue, - vtkFloatingPointType theDefault ) + vtkFloatingPointType theDefault ) { int pos = theValue.indexOf( ":" ); vtkFloatingPointType val = theDefault; @@ -50,15 +50,15 @@ namespace SMESH QString name = theValue.right( theValue.length()-pos-1 ), sect = theValue.left( pos ); if( !name.isEmpty() && !sect.isEmpty() ) - val = GetFloat( name, sect, theDefault ); + val = GetFloat( name, sect, theDefault ); } return val; } vtkFloatingPointType GetFloat( const QString& theValue, - const QString& theSection, - vtkFloatingPointType theDefault ) + const QString& theSection, + vtkFloatingPointType theDefault ) { vtkFloatingPointType val = theDefault; SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); @@ -70,7 +70,7 @@ namespace SMESH void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, - const char* theFileName) + const char* theFileName) { vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New(); aWriter->SetFileName(theFileName); @@ -83,8 +83,8 @@ namespace SMESH QColor GetColor( const QString& theSect, - const QString& theName, - const QColor& def ) + const QString& theName, + const QColor& def ) { QColor c = def; SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); @@ -95,11 +95,11 @@ namespace SMESH void GetColor( const QString& theSect, - const QString& theName, - int& r, - int& g, - int& b, - const QColor& def ) + const QString& theName, + int& r, + int& g, + int& b, + const QColor& def ) { QColor c = def; SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); @@ -111,11 +111,11 @@ namespace SMESH void GetColor( const QString& theSect, - const QString& theName, - vtkFloatingPointType& r, - vtkFloatingPointType& g, - vtkFloatingPointType& b, - const QColor& def ) + const QString& theName, + vtkFloatingPointType& r, + vtkFloatingPointType& g, + vtkFloatingPointType& b, + const QColor& def ) { int ir( 0 ), ig( 0 ), ib( 0 ); GetColor( theSect, theName, ir, ig, ib, def ); diff --git a/src/OBJECT/SMESH_ActorUtils.h b/src/OBJECT/SMESH_ActorUtils.h index a494f743b..69451fcac 100644 --- a/src/OBJECT/SMESH_ActorUtils.h +++ b/src/OBJECT/SMESH_ActorUtils.h @@ -33,42 +33,42 @@ namespace SMESH SMESHOBJECT_EXPORT vtkFloatingPointType GetFloat( const QString& theValue, - vtkFloatingPointType theDefault = 0 ); + vtkFloatingPointType theDefault = 0 ); SMESHOBJECT_EXPORT vtkFloatingPointType GetFloat( const QString& theName, - const QString& theSection, - vtkFloatingPointType theDefault = 0 ); + const QString& theSection, + vtkFloatingPointType theDefault = 0 ); SMESHOBJECT_EXPORT QColor GetColor( const QString& theSect, - const QString& theName, - const QColor& = QColor() ); + const QString& theName, + const QColor& = QColor() ); SMESHOBJECT_EXPORT void GetColor( const QString& theSect, - const QString& theName, - int&, - int&, - int&, - const QColor& = QColor() ); + const QString& theName, + int&, + int&, + int&, + const QColor& = QColor() ); SMESHOBJECT_EXPORT void GetColor( const QString& theSect, - const QString& theName, - vtkFloatingPointType&, - vtkFloatingPointType&, - vtkFloatingPointType&, - const QColor& = QColor() ); + const QString& theName, + vtkFloatingPointType&, + vtkFloatingPointType&, + vtkFloatingPointType&, + const QColor& = QColor() ); SMESHOBJECT_EXPORT void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, - const char* theFileName); + const char* theFileName); } diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 2b7beccf8..4d0626902 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -91,7 +91,7 @@ SMESH_DeviceActor myMapper = vtkPolyDataMapper::New(); vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor, - myPolygonOffsetUnits); + myPolygonOffsetUnits); myMapper->UseLookupTableScalarRangeOn(); myMapper->SetColorModeToMapScalars(); @@ -281,8 +281,8 @@ SMESH_DeviceActor void SMESH_DeviceActor ::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable) + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable) { bool anIsInitialized = theFunctor; if(anIsInitialized){ @@ -304,23 +304,23 @@ SMESH_DeviceActor using namespace SMESH::Controls; if(NumericalFunctor* aNumericalFunctor = dynamic_cast(theFunctor.get())){ for(vtkIdType i = 0; i < aNbCells; i++){ - vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i); - vtkIdType anObjId = myVisualObj->GetElemObjId(anId); - double aValue = aNumericalFunctor->GetValue(anObjId); - aScalars->SetValue(i,aValue); + vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i); + vtkIdType anObjId = myVisualObj->GetElemObjId(anId); + double aValue = aNumericalFunctor->GetValue(anObjId); + aScalars->SetValue(i,aValue); } }else if(Predicate* aPredicate = dynamic_cast(theFunctor.get())){ for(vtkIdType i = 0; i < aNbCells; i++){ - vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i); - vtkIdType anObjId = myVisualObj->GetElemObjId(anId); - bool aValue = aPredicate->IsSatisfy(anObjId); - aScalars->SetValue(i,aValue); + vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i); + vtkIdType anObjId = myVisualObj->GetElemObjId(anId); + bool aValue = aPredicate->IsSatisfy(anObjId); + aScalars->SetValue(i,aValue); } } aDataSet->GetCellData()->SetScalars(aScalars); aScalars->Delete(); - + theLookupTable->SetRange(aScalars->GetRange()); theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors()); theLookupTable->Build(); @@ -335,8 +335,8 @@ SMESH_DeviceActor void SMESH_DeviceActor ::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable) + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable) { bool anIsInitialized = theFunctor; myExtractUnstructuredGrid->ClearRegisteredCells(); @@ -374,18 +374,18 @@ SMESH_DeviceActor Length2D::TValues::const_iterator anIter = aValues.begin(); for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){ - const Length2D::Value& aValue = *anIter; - int aNode[2] = { - myVisualObj->GetNodeVTKId(aValue.myPntId[0]), - myVisualObj->GetNodeVTKId(aValue.myPntId[1]) - }; - if(aNode[0] >= 0 && aNode[1] >= 0){ - anIdList->SetId( 0, aNode[0] ); - anIdList->SetId( 1, aNode[1] ); - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_LINE ); - aScalars->SetValue(aVtkId,aValue.myLength); - } + const Length2D::Value& aValue = *anIter; + int aNode[2] = { + myVisualObj->GetNodeVTKId(aValue.myPntId[0]), + myVisualObj->GetNodeVTKId(aValue.myPntId[1]) + }; + if(aNode[0] >= 0 && aNode[1] >= 0){ + anIdList->SetId( 0, aNode[0] ); + anIdList->SetId( 1, aNode[1] ); + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_LINE ); + aScalars->SetValue(aVtkId,aValue.myLength); + } } VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); @@ -394,7 +394,7 @@ SMESH_DeviceActor aConnectivity->InitTraversal(); for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ) - aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); + aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); SetUnstructuredGrid(aDataSet); @@ -434,18 +434,18 @@ SMESH_DeviceActor MultiConnection2D::MValues::const_iterator anIter = aValues.begin(); for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){ - const MultiConnection2D::Value& aValue = (*anIter).first; - int aNode[2] = { - myVisualObj->GetNodeVTKId(aValue.myPntId[0]), - myVisualObj->GetNodeVTKId(aValue.myPntId[1]) - }; - if(aNode[0] >= 0 && aNode[1] >= 0){ - anIdList->SetId( 0, aNode[0] ); - anIdList->SetId( 1, aNode[1] ); - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_LINE ); - aScalars->SetValue(aVtkId,(*anIter).second); - } + const MultiConnection2D::Value& aValue = (*anIter).first; + int aNode[2] = { + myVisualObj->GetNodeVTKId(aValue.myPntId[0]), + myVisualObj->GetNodeVTKId(aValue.myPntId[1]) + }; + if(aNode[0] >= 0 && aNode[1] >= 0){ + anIdList->SetId( 0, aNode[0] ); + anIdList->SetId( 1, aNode[1] ); + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_LINE ); + aScalars->SetValue(aVtkId,(*anIter).second); + } } VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); @@ -454,7 +454,7 @@ SMESH_DeviceActor aConnectivity->InitTraversal(); for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ) - aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); + aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); SetUnstructuredGrid(aDataSet); @@ -492,7 +492,7 @@ SMESH_DeviceActor for( vtkIdType i = 0; i < aNbCells; i++ ){ vtkIdType anObjId = myVisualObj->GetElemObjId(i); if(aFreePredicate->IsSatisfy(anObjId)) - myExtractUnstructuredGrid->RegisterCell(i); + myExtractUnstructuredGrid->RegisterCell(i); } if(!myExtractUnstructuredGrid->IsCellsRegistered()) myExtractUnstructuredGrid->RegisterCell(-1); @@ -520,15 +520,15 @@ SMESH_DeviceActor for(; anIter != aBorders.end(); anIter++){ const FreeEdges::Border& aBorder = *anIter; int aNode[2] = { - myVisualObj->GetNodeVTKId(aBorder.myPntId[0]), - myVisualObj->GetNodeVTKId(aBorder.myPntId[1]) + myVisualObj->GetNodeVTKId(aBorder.myPntId[0]), + myVisualObj->GetNodeVTKId(aBorder.myPntId[1]) }; //cout<<"aNode = "<= 0 && aNode[1] >= 0){ - anIdList->SetId( 0, aNode[0] ); - anIdList->SetId( 1, aNode[1] ); - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_LINE ); + anIdList->SetId( 0, aNode[0] ); + anIdList->SetId( 1, aNode[1] ); + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_LINE ); } } @@ -550,7 +550,7 @@ SMESH_DeviceActor for( vtkIdType i = 0; i < aNbNodes; i++ ){ vtkIdType anObjId = myVisualObj->GetNodeObjId(i); if(aFreeNodes->IsSatisfy(anObjId)) - myExtractUnstructuredGrid->RegisterCell(i); + myExtractUnstructuredGrid->RegisterCell(i); } if(!myExtractUnstructuredGrid->IsCellsRegistered()) myExtractUnstructuredGrid->RegisterCell(-1); @@ -827,7 +827,7 @@ SMESH_DeviceActor void SMESH_DeviceActor ::SetPolygonOffsetParameters(vtkFloatingPointType factor, - vtkFloatingPointType units) + vtkFloatingPointType units) { myPolygonOffsetFactor = factor; myPolygonOffsetUnits = units; diff --git a/src/OBJECT/SMESH_DeviceActor.h b/src/OBJECT/SMESH_DeviceActor.h index 218050160..0b9acb48f 100644 --- a/src/OBJECT/SMESH_DeviceActor.h +++ b/src/OBJECT/SMESH_DeviceActor.h @@ -109,11 +109,11 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{ vtkUnstructuredGrid* GetUnstructuredGrid(); void SetControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable); + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable); void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable); + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable); void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor); bool IsHighlited() { return myIsHighlited;} @@ -161,11 +161,11 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{ void SetPolygonOffsetParameters(vtkFloatingPointType factor, - vtkFloatingPointType units); + vtkFloatingPointType units); void GetPolygonOffsetParameters(vtkFloatingPointType& factor, - vtkFloatingPointType& units) + vtkFloatingPointType& units) { factor = myPolygonOffsetFactor; units = myPolygonOffsetUnits; diff --git a/src/OBJECT/SMESH_ExtractGeometry.cxx b/src/OBJECT/SMESH_ExtractGeometry.cxx index 0376aba38..c7c63af36 100644 --- a/src/OBJECT/SMESH_ExtractGeometry.cxx +++ b/src/OBJECT/SMESH_ExtractGeometry.cxx @@ -152,7 +152,7 @@ int SMESH_ExtractGeometry::RequestData( { newId = newPts->InsertNextPoint(x); pointMap[ptId] = newId; - myNodeVTK2ObjIds.push_back(ptId); + myNodeVTK2ObjIds.push_back(ptId); outputPD->CopyData(pd,ptId,newId); } } @@ -175,7 +175,7 @@ int SMESH_ExtractGeometry::RequestData( { newId = newPts->InsertNextPoint(x); pointMap[ptId] = newId; - myNodeVTK2ObjIds.push_back(ptId); + myNodeVTK2ObjIds.push_back(ptId); outputPD->CopyData(pd,ptId,newId); } } @@ -228,7 +228,7 @@ int SMESH_ExtractGeometry::RequestData( x = input->GetPoint(ptId); newId = newPts->InsertNextPoint(x); pointMap[ptId] = newId; - myNodeVTK2ObjIds.push_back(ptId); + myNodeVTK2ObjIds.push_back(ptId); outputPD->CopyData(pd,ptId,newId); } newCellPts->InsertId(i,pointMap[ptId]); diff --git a/src/OBJECT/SMESH_FaceOrientationFilter.cxx b/src/OBJECT/SMESH_FaceOrientationFilter.cxx index a7f5d1d94..cf09779d0 100644 --- a/src/OBJECT/SMESH_FaceOrientationFilter.cxx +++ b/src/OBJECT/SMESH_FaceOrientationFilter.cxx @@ -209,8 +209,8 @@ void GetFaceParams( vtkCell* theFace, double theNormal[3], double& theSize ) double* aBounds = theFace->GetBounds(); theSize = pow( pow( aBounds[1] - aBounds[0], 2 ) + - pow( aBounds[3] - aBounds[2], 2 ) + - pow( aBounds[5] - aBounds[4], 2 ), 0.5 ); + pow( aBounds[3] - aBounds[2], 2 ) + + pow( aBounds[5] - aBounds[4], 2 ), 0.5 ); } /*! @@ -268,7 +268,7 @@ int SMESH_FaceOrientationFilter::RequestData( input->GetCellNeighbors( aCellId, aFace->PointIds, aNeighborIds ); if( aNeighborIds->GetNumberOfIds() > 0 ) - continue; + continue; double aSize, aNormal[3]; GetFaceParams( aFace, aNormal, aSize ); diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx index 943f0896d..e7ef139a4 100644 --- a/src/OBJECT/SMESH_Object.cxx +++ b/src/OBJECT/SMESH_Object.cxx @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include @@ -81,7 +81,7 @@ static int MYDEBUGWITHFILES = 0; // purpose : Get type of VTK cell //================================================================================= static inline vtkIdType getCellType( const SMDSAbs_ElementType theType, - const bool thePoly, + const bool thePoly, const int theNbNodes ) { switch( theType ) @@ -263,7 +263,7 @@ namespace{ typedef std::vector TConnect; int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter, - TConnect& theConnect) + TConnect& theConnect) { theConnect.clear(); for(; theNodesIter->more();) @@ -273,10 +273,10 @@ namespace{ inline void SetId(vtkIdList *theIdList, - const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes, - const TConnect& theConnect, - int thePosition, - int theId) + const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes, + const TConnect& theConnect, + int thePosition, + int theId) { theIdList->SetId(thePosition,theSMDS2VTKNodes.find(theConnect[theId]->GetID())->second); } @@ -372,12 +372,12 @@ void SMESH_VisualObjDef::buildElemPrs() myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) ); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); - switch (aType) { - case SMDSAbs_Volume:{ + switch (aType) { + case SMDSAbs_Volume:{ aConnect.clear(); - std::vector aConnectivities; - // Convertions connectivities from SMDS to VTK - if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE + std::vector aConnectivities; + // Convertions connectivities from SMDS to VTK + if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE if ( const SMDS_PolyhedralVolumeOfNodes* ph = dynamic_cast (anElem)) @@ -385,67 +385,67 @@ void SMESH_VisualObjDef::buildElemPrs() aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect); anIdList->SetNumberOfIds( aNbNodes ); } - for (int k = 0; k < aNbNodes; k++) - aConnectivities.push_back(k); + for (int k = 0; k < aNbNodes; k++) + aConnectivities.push_back(k); } else if (aNbNodes == 4) { - static int anIds[] = {0,2,1,3}; - for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + static int anIds[] = {0,2,1,3}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); - } else if (aNbNodes == 5) { - static int anIds[] = {0,3,2,1,4}; - for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + } else if (aNbNodes == 5) { + static int anIds[] = {0,3,2,1,4}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); - } else if (aNbNodes == 6) { - static int anIds[] = {0,1,2,3,4,5}; - for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + } else if (aNbNodes == 6) { + static int anIds[] = {0,1,2,3,4,5}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); - } + } else if (aNbNodes == 8) { - static int anIds[] = {0,3,2,1,4,7,6,5}; - for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + static int anIds[] = {0,3,2,1,4,7,6,5}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); - } + } else if (aNbNodes == 10) { - static int anIds[] = {0,2,1,3,6,5,4,7,9,8}; - for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); - } + static int anIds[] = {0,2,1,3,6,5,4,7,9,8}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + } else if (aNbNodes == 13) { - static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10}; - for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); - } + static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10}; + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + } else if (aNbNodes == 15) { //static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13}; static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}; - for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); - //for (int k = 0; k < aNbNodes; k++) { + for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]); + //for (int k = 0; k < aNbNodes; k++) { // int nn = aConnectivities[k]; // const SMDS_MeshNode* N = static_cast (aConnect[nn]); // cout<<"k="<X()<<","<Y()<<","<Z()<<")"< 0) { - for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++) - SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]); - } - break; - } - default: - for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){ - const SMDS_MeshElement* aNode = aNodesIter->next(); - anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] ); - } - } + if (aConnectivities.size() > 0) { + for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++) + SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]); + } + break; + } + default: + for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){ + const SMDS_MeshElement* aNode = aNodesIter->next(); + anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] ); + } + } aConnectivity->InsertNextCell( anIdList ); aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) ); @@ -483,9 +483,9 @@ void SMESH_VisualObjDef::buildElemPrs() // purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 ) //================================================================================= bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId, - const int theEdgeNum, - int& theNodeId1, - int& theNodeId2 ) const + const int theEdgeNum, + int& theNodeId1, + int& theNodeId2 ) const { const SMDS_Mesh* aMesh = GetMesh(); if ( aMesh == 0 ) @@ -520,6 +520,19 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId, return true; } +//================================================================================= +// function : IsValid +// purpose : Return true if there are some entities +//================================================================================= +bool SMESH_VisualObjDef::IsValid() const +{ + return GetNbEntities(SMDSAbs_Node) > 0 || + GetNbEntities(SMDSAbs_0DElement) > 0 || + GetNbEntities(SMDSAbs_Edge) > 0 || + GetNbEntities(SMDSAbs_Face) > 0 || + GetNbEntities(SMDSAbs_Volume) > 0 ; +} + /* Class : SMESH_MeshObj Description : Class for visualisation of mesh @@ -905,7 +918,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const case SMDSAbs_Volume: { SMESH::long_array_var anIds = - mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) ); + mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) ); return anIds->length(); } default: @@ -942,7 +955,7 @@ int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityLis else { SMESH::long_array_var anIds = - mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) ); + mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) ); return getPointers( theType, anIds, aMesh, theResList ); } } diff --git a/src/OBJECT/SMESH_Object.h b/src/OBJECT/SMESH_Object.h index 3d4dbbf8b..3bc178eca 100644 --- a/src/OBJECT/SMESH_Object.h +++ b/src/OBJECT/SMESH_Object.h @@ -62,9 +62,10 @@ public: virtual SMDS_Mesh* GetMesh() const = 0; virtual bool GetEdgeNodes( const int theElemId, - const int theEdgeNum, - int& theNodeId1, - int& theNodeId2 ) const = 0; + const int theEdgeNum, + int& theNodeId1, + int& theNodeId2 ) const = 0; + virtual bool IsValid() const = 0; virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0; diff --git a/src/OBJECT/SMESH_ObjectDef.h b/src/OBJECT/SMESH_ObjectDef.h index 094504f33..82f540913 100644 --- a/src/OBJECT/SMESH_ObjectDef.h +++ b/src/OBJECT/SMESH_ObjectDef.h @@ -69,6 +69,8 @@ public: virtual bool IsNodePrs() const = 0; virtual SMDS_Mesh* GetMesh() const = 0; + virtual bool IsValid() const; + virtual bool GetEdgeNodes( const int theElemId, const int theEdgeNum, int& theNodeId1, diff --git a/src/OBJECT/SMESH_PreviewActorsCollection.cxx b/src/OBJECT/SMESH_PreviewActorsCollection.cxx index d07e33b71..e565701da 100644 --- a/src/OBJECT/SMESH_PreviewActorsCollection.cxx +++ b/src/OBJECT/SMESH_PreviewActorsCollection.cxx @@ -137,25 +137,25 @@ GEOM_Actor* SMESH_PreviewActorsCollection::createActor(const TopoDS_Shape& shape actor->SetShape(shape,0,0); //Color Properties - /* - vtkProperty* aProp = vtkProperty::New(); - vtkProperty* aHLProp = vtkProperty::New(); - vtkProperty* aPHLProp = vtkProperty::New(); - - aProp->SetColor( 255, 0, 0); - actor->SetProperty(aProp); - - aHLProp->SetColor( 255, 255, 255); - actor->SetHighlightProperty(aHLProp); - - aPHLProp->SetColor( 155, 155, 155); - aPHLProp->SetLineWidth ( 3 ); - aPHLProp->SetOpacity ( 0.75 ); - actor->SetPreHighlightProperty(aPHLProp); - - aProp->Delete(); - aHLProp->Delete(); - aPHLProp->Delete(); + /* + vtkProperty* aProp = vtkProperty::New(); + vtkProperty* aHLProp = vtkProperty::New(); + vtkProperty* aPHLProp = vtkProperty::New(); + + aProp->SetColor( 255, 0, 0); + actor->SetProperty(aProp); + + aHLProp->SetColor( 255, 255, 255); + actor->SetHighlightProperty(aHLProp); + + aPHLProp->SetColor( 155, 155, 155); + aPHLProp->SetLineWidth ( 3 ); + aPHLProp->SetOpacity ( 0.75 ); + actor->SetPreHighlightProperty(aPHLProp); + + aProp->Delete(); + aHLProp->Delete(); + aPHLProp->Delete(); */ return actor; diff --git a/src/SMESH/SMESH_Block.cxx b/src/SMESH/SMESH_Block.cxx index 59971bfee..821d8fa9f 100644 --- a/src/SMESH/SMESH_Block.cxx +++ b/src/SMESH/SMESH_Block.cxx @@ -996,7 +996,8 @@ int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace, for ( iE = 0; wExp.More(); wExp.Next(), iE++ ) { TopoDS_Edge edge = wExp.Current(); - edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() )); + // commented for issue 0020557, other related ones: 0020526, PAL19080 + // edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() )); theEdges.push_back( edge ); } theNbVertexInWires.push_back( iE ); diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 9d5df1eb8..10ec57e1f 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -434,7 +434,7 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh, const SMESH_Algo* aGlobIgnoAlgo, const SMESH_Algo* aLocIgnoAlgo, bool & checkConform, - map& aCheckedMap, + set& aCheckedMap, list< SMESH_Gen::TAlgoStateError > & theErrors) { ASSERT( aSubMesh ); @@ -489,19 +489,15 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh, } // sub-algos will be hidden by a local - const map& smMap = aSubMesh->DependsOn(); - map::const_reverse_iterator revItSub; + SMESH_subMeshIteratorPtr revItSub = + aSubMesh->getDependsOnIterator( /*includeSelf=*/false, /*complexShapeFirst=*/true); bool checkConform2 = false; - for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++) + while ( revItSub->more() ) { - checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo, + SMESH_subMesh* sm = revItSub->next(); + checkConformIgnoredAlgos (aMesh, sm, aGlobIgnoAlgo, algo, checkConform2, aCheckedMap, theErrors); - int key = (*revItSub).first; - SMESH_subMesh* sm = (*revItSub).second; - if ( aCheckedMap.find( key ) == aCheckedMap.end() ) - { - aCheckedMap[ key ] = sm; - } + aCheckedMap.insert( sm ); } } } @@ -522,7 +518,7 @@ static bool checkMissing(SMESH_Gen* aGen, const int aTopAlgoDim, bool* globalChecked, const bool checkNoAlgo, - map& aCheckedMap, + set& aCheckedMap, list< SMESH_Gen::TAlgoStateError > & theErrors) { if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX) @@ -595,15 +591,13 @@ static bool checkMissing(SMESH_Gen* aGen, if (!algo->NeedDescretBoundary() || isTopLocalAlgo) { bool checkNoAlgo2 = ( algo->NeedDescretBoundary() ); - const map& subMeshes = aSubMesh->DependsOn(); - map::const_iterator itsub; - for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false, + /*complexShapeFirst=*/false); + while ( itsub->more() ) { // sub-meshes should not be checked further more - int key = (*itsub).first; - SMESH_subMesh* sm = (*itsub).second; - if ( aCheckedMap.find( key ) == aCheckedMap.end() ) - aCheckedMap[ key ] = sm; + SMESH_subMesh* sm = itsub->next(); + aCheckedMap.insert( sm ); if (isTopLocalAlgo) { @@ -697,39 +691,25 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh, } } - const map& smMap = sm->DependsOn(); - map::const_reverse_iterator revItSub = smMap.rbegin(); - map aCheckedMap; + set aCheckedSubs; bool checkConform = ( !theMesh.IsNotConformAllowed() ); - int aKey = 1; - SMESH_subMesh* smToCheck = sm; // loop on theShape and its sub-shapes - while ( smToCheck ) + SMESH_subMeshIteratorPtr revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, + /*complexShapeFirst=*/true); + while ( revItSub->more() ) { + SMESH_subMesh* smToCheck = revItSub->next(); if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX) break; - if ( aCheckedMap.find( aKey ) == aCheckedMap.end() ) + if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo, - 0, checkConform, aCheckedMap, theErrors)) + 0, checkConform, aCheckedSubs, theErrors)) ret = false; if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO ) hasAlgo = true; - - // next subMesh - if (revItSub != smMap.rend()) - { - aKey = (*revItSub).first; - smToCheck = (*revItSub).second; - revItSub++; - } - else - { - smToCheck = 0; - } - } // ---------------------------------------------------------------- @@ -749,36 +729,26 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh, break; } } - aCheckedMap.clear(); - smToCheck = sm; - revItSub = smMap.rbegin(); bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false; bool globalChecked[] = { false, false, false, false }; // loop on theShape and its sub-shapes - while ( smToCheck ) + aCheckedSubs.clear(); + revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, /*complexShapeFirst=*/true); + while ( revItSub->more() ) { + SMESH_subMesh* smToCheck = revItSub->next(); if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX) break; - if ( aCheckedMap.find( aKey ) == aCheckedMap.end() ) + if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim, - globalChecked, checkNoAlgo, aCheckedMap, theErrors)) + globalChecked, checkNoAlgo, aCheckedSubs, theErrors)) { ret = false; if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO ) checkNoAlgo = false; } - - // next subMesh - if (revItSub != smMap.rend()) - { - aKey = (*revItSub).first; - smToCheck = (*revItSub).second; - revItSub++; - } - else - smToCheck = 0; } if ( !hasAlgo ) { diff --git a/src/SMESH/SMESH_Gen.hxx b/src/SMESH/SMESH_Gen.hxx index 325aff4e7..ab610a00a 100644 --- a/src/SMESH/SMESH_Gen.hxx +++ b/src/SMESH/SMESH_Gen.hxx @@ -61,7 +61,7 @@ typedef std::set TSetOfInt; class SMESH_EXPORT SMESH_Gen { - public: +public: SMESH_Gen(); ~SMESH_Gen(); @@ -78,8 +78,8 @@ class SMESH_EXPORT SMESH_Gen bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool anUpward=false, - const ::MeshDimension aDim=::MeshDim_3D, - TSetOfInt* aShapesId=0); + const ::MeshDimension aDim=::MeshDim_3D, + TSetOfInt* aShapesId=0); /*! * \brief evaluates size of prospective mesh on a shape @@ -89,8 +89,8 @@ class SMESH_EXPORT SMESH_Gen * \retval bool - is a success */ bool Evaluate(::SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap, + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap, const bool anUpward=false, TSetOfInt* aShapesId=0); @@ -109,7 +109,7 @@ class SMESH_EXPORT SMESH_Gen */ void SetDefaultNbSegments(int nb) { _nbSegments = nb; } int GetDefaultNbSegments() const { return _nbSegments; } - + struct TAlgoStateError { TAlgoStateErrorName _name; @@ -138,16 +138,6 @@ class SMESH_EXPORT SMESH_Gen SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0); static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh); - // inherited methods from SALOMEDS::Driver - -// void Save(int studyId, const char *aUrlOfFile); -// void Load(int studyId, const char *aUrlOfFile); -// void Close(int studyId); -// const char *ComponentDataType(); - -// const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile); -// const char *LocalPersistentIDToIOR(const char *aLocalPersistentID); - int GetANewId(); std::map < int, SMESH_Algo * >_mapAlgo; @@ -156,7 +146,7 @@ class SMESH_EXPORT SMESH_Gen std::map < int, SMESH_2D_Algo * >_map2D_Algo; std::map < int, SMESH_3D_Algo * >_map3D_Algo; - private: +private: int _localId; // unique Id of created objects, within SMESH_Gen entity std::map < int, StudyContextStruct * >_mapStudyContext; diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 284e3d2d4..f7d2b403f 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -2805,12 +2805,12 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem, return; } - issimple[iNode] = (listNewNodes.size()==nbSteps); + issimple[iNode] = (listNewNodes.size()==nbSteps); // is node medium itNN[ iNode ] = listNewNodes.begin(); prevNod[ iNode ] = node; nextNod[ iNode ] = listNewNodes.front(); - if( !issimple[iNode] ) { + if( !elem->IsQuadratic() || !issimple[iNode] ) { if ( prevNod[ iNode ] != nextNod [ iNode ]) iNotSameNode = iNode; else { @@ -2823,8 +2823,8 @@ void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem, //cout<<" nbSame = "< 2) { - //MESSAGE( " Too many same nodes of element " << elem->GetID() ); - INFOS( " Too many same nodes of element " << elem->GetID() ); + MESSAGE( " Too many same nodes of element " << elem->GetID() ); + //INFOS( " Too many same nodes of element " << elem->GetID() ); return; } @@ -7695,6 +7695,9 @@ int SMESH_MeshEditor::convertElemToQuadratic(SMESHDS_SubMesh * theSm, case 4: NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d); break; + case 5: + NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], id, theForce3d); + break; case 6: NewElem = theHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d); break; @@ -7819,6 +7822,10 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d) NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], id, theForce3d ); break; + case 5: + NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], + aNds[3], aNds[4], id, theForce3d); + break; case 6: NewVolume = aHelper.AddVolume(aNds[0], aNds[1], aNds[2], aNds[3], aNds[4], aNds[5], id, theForce3d); @@ -8774,7 +8781,7 @@ bool SMESH_MeshEditor::doubleNodes( SMESHDS_Mesh* theMeshDS, theNodeNodeMap[ aCurrNode ] = aNewNode; myLastCreatedNodes.Append( aNewNode ); } - isDuplicate |= (aCurrNode == aNewNode); + isDuplicate |= (aCurrNode != aNewNode); newNodes[ ind++ ] = aNewNode; } if ( !isDuplicate ) @@ -8812,6 +8819,95 @@ static bool isInside(const SMDS_MeshElement* theElem, return (aState == TopAbs_IN || aState == TopAbs_ON ); } +/*! + \brief Creates a hole in a mesh by doubling the nodes of some particular elements + \param theNodes - identifiers of nodes to be doubled + \param theModifiedElems - identifiers of elements to be updated by the new (doubled) + nodes. If list of element identifiers is empty then nodes are doubled but + they not assigned to elements + \return TRUE if operation has been completed successfully, FALSE otherwise +*/ +bool SMESH_MeshEditor::DoubleNodes( const std::list< int >& theListOfNodes, + const std::list< int >& theListOfModifiedElems ) +{ + myLastCreatedElems.Clear(); + myLastCreatedNodes.Clear(); + + if ( theListOfNodes.size() == 0 ) + return false; + + SMESHDS_Mesh* aMeshDS = GetMeshDS(); + if ( !aMeshDS ) + return false; + + // iterate through nodes and duplicate them + + std::map< const SMDS_MeshNode*, const SMDS_MeshNode* > anOldNodeToNewNode; + + std::list< int >::const_iterator aNodeIter; + for ( aNodeIter = theListOfNodes.begin(); aNodeIter != theListOfNodes.end(); ++aNodeIter ) + { + int aCurr = *aNodeIter; + SMDS_MeshNode* aNode = (SMDS_MeshNode*)aMeshDS->FindNode( aCurr ); + if ( !aNode ) + continue; + + // duplicate node + + const SMDS_MeshNode* aNewNode = aMeshDS->AddNode( aNode->X(), aNode->Y(), aNode->Z() ); + if ( aNewNode ) + { + anOldNodeToNewNode[ aNode ] = aNewNode; + myLastCreatedNodes.Append( aNewNode ); + } + } + + // Create map of new nodes for modified elements + + std::map< SMDS_MeshElement*, vector > anElemToNodes; + + std::list< int >::const_iterator anElemIter; + for ( anElemIter = theListOfModifiedElems.begin(); + anElemIter != theListOfModifiedElems.end(); ++anElemIter ) + { + int aCurr = *anElemIter; + SMDS_MeshElement* anElem = (SMDS_MeshElement*)aMeshDS->FindElement( aCurr ); + if ( !anElem ) + continue; + + vector aNodeArr( anElem->NbNodes() ); + + SMDS_ElemIteratorPtr anIter = anElem->nodesIterator(); + int ind = 0; + while ( anIter->more() ) + { + SMDS_MeshNode* aCurrNode = (SMDS_MeshNode*)anIter->next(); + if ( aCurr && anOldNodeToNewNode.find( aCurrNode ) != anOldNodeToNewNode.end() ) + { + const SMDS_MeshNode* aNewNode = anOldNodeToNewNode[ aCurrNode ]; + aNodeArr[ ind++ ] = aNewNode; + } + else + aNodeArr[ ind++ ] = aCurrNode; + } + anElemToNodes[ anElem ] = aNodeArr; + } + + // Change nodes of elements + + std::map< SMDS_MeshElement*, vector >::iterator + anElemToNodesIter = anElemToNodes.begin(); + for ( ; anElemToNodesIter != anElemToNodes.end(); ++anElemToNodesIter ) + { + const SMDS_MeshElement* anElem = anElemToNodesIter->first; + vector aNodeArr = anElemToNodesIter->second; + if ( anElem ) + aMeshDS->ChangeElementNodes( anElem, &aNodeArr[ 0 ], anElem->NbNodes() ); + } + + return true; +} + /*! \brief Creates a hole in a mesh by doubling the nodes of some particular elements \param theElems - group of of elements (edges or faces) to be replicated diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index 19510498e..fba504773 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -601,6 +601,9 @@ public: const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; } const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; } + + bool DoubleNodes( const std::list< int >& theListOfNodes, + const std::list< int >& theListOfModifiedElems ); bool DoubleNodes( const TIDSortedElemSet& theElems, const TIDSortedElemSet& theNodesNot, @@ -609,7 +612,7 @@ public: bool DoubleNodesInRegion( const TIDSortedElemSet& theElems, const TIDSortedElemSet& theNodesNot, const TopoDS_Shape& theShape ); - + /*! * \brief Generated skin mesh (containing 2D cells) from 3D mesh * The created 2D mesh elements based on nodes of free faces of boundary volumes diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 34e663815..0ca91a4d3 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -356,9 +356,12 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F, static_cast(n->GetPosition().get()); int edgeID = Pos->GetShapeId(); TopoDS_Edge E = TopoDS::Edge(GetMeshDS()->IndexToShape(edgeID)); - double f, l; + double f, l, u = epos->GetUParameter(); Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); - uv = C2d->Value( epos->GetUParameter() ); + if ( f < u && u < l ) + uv = C2d->Value( u ); + else + uv.SetCoord(0.,0.); uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), BRep_Tool::Tolerance( E )); // for a node on a seam edge select one of UVs on 2 pcurves diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 3aaf987af..b086771ab 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -23,7 +23,6 @@ // File : SMESH_subMesh.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_SUBMESH_HXX_ #define _SMESH_SUBMESH_HXX_ diff --git a/src/SMESHDS/SMESHDS_CommandType.hxx b/src/SMESHDS/SMESHDS_CommandType.hxx index a033961bc..7279ba932 100644 --- a/src/SMESHDS/SMESHDS_CommandType.hxx +++ b/src/SMESHDS/SMESHDS_CommandType.hxx @@ -30,7 +30,6 @@ enum SMESHDS_CommandType { SMESHDS_AddNode, - SMESHDS_Add0DElement, SMESHDS_AddEdge, SMESHDS_AddTriangle, SMESHDS_AddQuadrangle, @@ -54,7 +53,9 @@ enum SMESHDS_CommandType { SMESHDS_AddQuadTetrahedron, SMESHDS_AddQuadPyramid, SMESHDS_AddQuadPentahedron, - SMESHDS_AddQuadHexahedron + SMESHDS_AddQuadHexahedron, + // special type for 0D elements + SMESHDS_Add0DElement }; diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index c26ecf3c5..1e58867d0 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -289,6 +289,8 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() if (!isValid()) return false; + SMESH::SMESH_Mesh_var aCompoundMesh; + if (!myMesh->_is_nil()) { QStringList aParameters; aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" ")); @@ -297,7 +299,6 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen(); // concatenate meshes - SMESH::SMESH_Mesh_var aCompoundMesh; if(CheckBoxCommon->isChecked()) aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray, !(ComboBoxUnion->currentIndex()), @@ -319,8 +320,16 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() LineEditName->setText(GetDefaultName(tr("COMPOUND_MESH"))); - //mySelectionMgr->clearSelected(); - SMESH::UpdateView(); + // IPAL21468 Compound is hidden after creation. + if ( SMESHGUI::automaticUpdate() ) { + mySelectionMgr->clearSelected(); + SMESH::UpdateView(); + + _PTR(SObject) aSO = SMESH::FindSObject(aCompoundMesh.in()); + if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) ) + SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor); + }// end IPAL21468 + return true; } return false; diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index 1364b265d..be11acf6c 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -72,7 +72,7 @@ class OrientedPlane: public vtkPlane { - SVTK_ViewWindow* myViewWindow; + QPointer myViewWindow; vtkDataSetMapper* myMapper; @@ -168,7 +168,8 @@ protected: } ~OrientedPlane(){ - myViewWindow->RemoveActor(myActor); + if (myViewWindow) + myViewWindow->RemoveActor(myActor); myActor->Delete(); myMapper->RemoveAllInputs(); diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx index 656b47463..15a6d8ff8 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx @@ -32,9 +32,10 @@ #include // SALOME GUI includes -#include -#include #include +#include +#include +#include // IDL includes #include @@ -176,6 +177,7 @@ SUIT_SelectionFilter* SMESHGUI_ConvToQuadOp::createFilter( const int theId ) con //================================================================================ bool SMESHGUI_ConvToQuadOp::onApply() { + SUIT_OverrideCursor aWaitCursor; QString aMess; diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index b567f89a5..4cc5d3fdc 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -2632,7 +2632,13 @@ void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg, //======================================================================= void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh) { - myMesh = theMesh; + if ( !theMesh->_is_nil() ) { + myMesh = theMesh; + if ( !myFilter[ myTable->GetType() ]->_is_nil() && !myFilter[ myTable->GetType() ]->GetPredicate()->_is_nil() ) { + SMESH::Predicate_ptr aPred = myFilter[ myTable->GetType() ]->GetPredicate(); + aPred->SetMesh(myMesh); + } + } const bool isEnable = !(myMesh->_is_nil()); myButtons[BTN_OK]->setEnabled(isEnable); myButtons[BTN_Apply]->setEnabled(isEnable); diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 114a7fd97..32f66474c 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -1062,6 +1062,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myIsBusy = false; return; } + + if ( myFilterDlg && !myMesh->_is_nil()){ + myFilterDlg->SetMesh( myMesh ); + } myGroup = SMESH::SMESH_Group::_nil(); // NPAL19389: create a group with a selection in another group @@ -1087,7 +1091,6 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() return; } myIsBusy = false; - myCurrentLineEdit = 0; myGroup = SMESH::SMESH_Group::_nil(); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); @@ -1417,11 +1420,14 @@ void SMESHGUI_GroupDlg::setCurrentSelection() QPushButton* send = (QPushButton*)sender(); myCurrentLineEdit = 0; if (send == myMeshGroupBtn) { - myCurrentLineEdit = myMeshGroupLine; + disconnect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); + mySelectionMgr->clearSelected(); if (myCreate) setSelectionMode(6); else setSelectionMode(5); + connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); + myCurrentLineEdit = myMeshGroupLine; onObjectSelectionChanged(); } else if (send == mySubMeshBtn) { diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 8e9ff3973..b0ced7bb6 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -533,14 +533,15 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const else if ( aHypType == "NumberOfLayers") aHelpFileName = "radial_prism_algo_page.html"; else if ( aHypType == "NumberOfLayers2D") - aHelpFileName = "radial_prism_algo_page.html"; + aHelpFileName = "radial_quadrangle_1D2D_algo_page.html"; else if ( aHypType == "LayerDistribution") aHelpFileName = "radial_prism_algo_page.html"; else if ( aHypType == "LayerDistribution2D") - aHelpFileName = "radial_prism_algo_page.html"; + aHelpFileName = "radial_quadrangle_1D2D_algo_page.html"; else if ( aHypType == "SegmentLengthAroundVertex") aHelpFileName = "segments_around_vertex_algo_page.html"; - + else if ( aHypType == "QuadrangleParams") + aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor"; return aHelpFileName; } diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 3841a194e..7b5db1430 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -712,7 +712,8 @@ namespace SMESH _PTR(Study) aDocument = aStudy->studyDS(); // Pass non-visual objects (hypotheses, etc.), return true in this case CORBA::Long anId = aDocument->StudyId(); - if (TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)) + TVisualObjPtr aVisualObj; + if ( (aVisualObj = GetVisualObj(anId,theEntry)) && aVisualObj->IsValid()) { if ((anActor = CreateActor(aDocument,theEntry,true))) { bool needFitAll = noSmeshActors(theWnd); // fit for the first object only diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 077766762..8d3cacc13 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -121,7 +121,7 @@ namespace { TCollection_AsciiString SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript, Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod, - Resource_DataMapOfAsciiStringAsciiString& theObjectNames) + Resource_DataMapOfAsciiStringAsciiString& theObjectNames) { theGen = new _pyGen( theEntry2AccessorMethod, theObjectNames ); @@ -196,7 +196,7 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript, //================================================================================ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod, - Resource_DataMapOfAsciiStringAsciiString& theObjectNames) + Resource_DataMapOfAsciiStringAsciiString& theObjectNames) : _pyObject( new _pyCommand( TPythonDump::SMESHGenName(), 0 )), myID2AccessorMethod( theEntry2AccessorMethod ), myObjectNames( theObjectNames ) @@ -541,7 +541,7 @@ Handle(_pyHypothesis) _pyGen::FindAlgo( const _pyID& theGeom, const _pyID& theMe if ( !hyp->IsNull() && (*hyp)->IsAlgo() && theHypothesis->CanBeCreatedBy( (*hyp)->GetAlgoType() ) && - (*hyp)->GetGeom() == theGeom && + (*hyp)->GetGeom() == theGeom && (*hyp)->GetMesh() == theMesh ) return *hyp; return 0; @@ -624,8 +624,8 @@ void _pyGen::SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) the //================================================================================ void _pyGen::setNeighbourCommand( Handle(_pyCommand)& theCmd, - Handle(_pyCommand)& theOtherCmd, - const bool theIsAfter ) + Handle(_pyCommand)& theOtherCmd, + const bool theIsAfter ) { list< Handle(_pyCommand) >::iterator pos; pos = find( myCommands.begin(), myCommands.end(), theCmd ); @@ -680,8 +680,8 @@ _pyID _pyGen::GenerateNewID( const _pyID& theID ) while ( myObjectNames.IsBound( aNewID ) ); myObjectNames.Bind( aNewID, myObjectNames.IsBound( theID ) - ? (myObjectNames.Find( theID ) + _pyID( "_" ) + _pyID( index-1 )) - : _pyID( "A" ) + aNewID ); + ? (myObjectNames.Find( theID ) + _pyID( "_" ) + _pyID( index-1 )) + : _pyID( "A" ) + aNewID ); return aNewID; } @@ -952,21 +952,21 @@ void _pyMesh::Flush() if ( algo->IsWrapped() ) { _pyID localAlgoID = theGen->GenerateNewID( algoID ); TCollection_AsciiString aNewCmdStr = localAlgoID + - TCollection_AsciiString( " = " ) + theGen->GetID() + - TCollection_AsciiString( ".CreateHypothesis( \"" ) + algo->GetAlgoType() + - TCollection_AsciiString( "\" )" ); + TCollection_AsciiString( " = " ) + theGen->GetID() + + TCollection_AsciiString( ".CreateHypothesis( \"" ) + algo->GetAlgoType() + + TCollection_AsciiString( "\" )" ); Handle(_pyCommand) newCmd = theGen->AddCommand( aNewCmdStr ); Handle(_pyAlgorithm) newAlgo = Handle(_pyAlgorithm)::DownCast(theGen->FindHyp( localAlgoID )); if ( !newAlgo.IsNull() ) { - newAlgo->Assign( algo, this->GetID() ); - newAlgo->SetCreationCmd( newCmd ); - algo = newAlgo; - // set algorithm creation - theGen->SetCommandBefore( newCmd, addCmd ); + newAlgo->Assign( algo, this->GetID() ); + newAlgo->SetCreationCmd( newCmd ); + algo = newAlgo; + // set algorithm creation + theGen->SetCommandBefore( newCmd, addCmd ); } else - newCmd->Clear(); + newCmd->Clear(); } _pyID geom = addCmd->GetArg( 1 ); bool isLocalAlgo = ( geom != GetGeom() ); @@ -982,14 +982,14 @@ void _pyMesh::Flush() addCmd->SetArg( addCmd->GetNbArgs() + 1, TCollection_AsciiString( "geom=" ) + geom ); // sm = mesh.GetSubMesh(geom, name) --> sm = ALGO.GetSubMesh() - list < Handle(_pySubMesh) >::iterator smIt; + list < Handle(_pySubMesh) >::iterator smIt; for ( smIt = mySubmeshes.begin(); smIt != mySubmeshes.end(); ++smIt ) { - Handle(_pySubMesh) subMesh = *smIt; + Handle(_pySubMesh) subMesh = *smIt; Handle(_pyCommand) subCmd = subMesh->GetCreationCmd(); if ( geom == subCmd->GetArg( 1 )) { subCmd->SetObject( algo->GetID() ); subCmd->RemoveArgs(); - subMesh->SetCreator( algo ); + subMesh->SetCreator( algo ); } } } @@ -1271,11 +1271,11 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th } else if ( hypType == "QuadranglePreference" ) { hyp->SetConvMethodAndType( "QuadranglePreference", "Quadrangle_2D"); - hyp->SetConvMethodAndType( "QuadranglePreference", "NETGEN_2D_ONLY"); + hyp->SetConvMethodAndType( "SetQuadAllowed", "NETGEN_2D_ONLY"); } else if ( hypType == "TrianglePreference" ) { hyp->SetConvMethodAndType( "TrianglePreference", "Quadrangle_2D"); - } + } // BLSURF ---------- else if ( hypType == "BLSURF" ) { algo->SetConvMethodAndType( "Triangle", hypType.ToCString()); @@ -1532,7 +1532,7 @@ void _pyHypothesis::ClearAllCommands() //================================================================================ void _pyHypothesis::Assign( const Handle(_pyHypothesis)& theOther, - const _pyID& theMesh ) + const _pyID& theMesh ) { myIsWrapped = false; myMesh = theMesh; @@ -1995,15 +1995,15 @@ const TCollection_AsciiString & _pyCommand::GetObject() int nb1 = 0; // number of ' character at the left of = int nb2 = 0; // number of " character at the left of = for ( int i = 1; i < begPos-1; i++ ) { - if ( myString.Value( i )=='\'' ) - nb1 += 1; - else if ( myString.Value( i )=='"' ) - nb2 += 1; + if ( myString.Value( i )=='\'' ) + nb1 += 1; + else if ( myString.Value( i )=='"' ) + nb2 += 1; } // if number of ' or " is not divisible by 2, // then get an object at the start of the command if ( nb1 % 2 != 0 || nb2 % 2 != 0 ) - begPos = 1; + begPos = 1; } myObj = GetWord( myString, begPos, true ); // check if object is complex, @@ -2073,16 +2073,16 @@ const TCollection_AsciiString & _pyCommand::GetArg( int index ) while ( begPos != EMPTY ) { begPos += prevLen; if( myString.Value( begPos ) == '(' ) - nbNestings++; + nbNestings++; // check if we are looking at the closing parenthesis while ( begPos <= Length() && isspace( myString.Value( begPos ))) ++begPos; if ( begPos > Length() ) break; if ( myString.Value( begPos ) == ')' ) { - nbNestings--; - if( nbNestings == 0 ) - break; + nbNestings--; + if( nbNestings == 0 ) + break; } myArgs.Append( GetWord( myString, begPos, true, true )); SetBegPos( ARG1_IND + i, begPos ); diff --git a/src/SMESH_I/SMESH_2smeshpy.hxx b/src/SMESH_I/SMESH_2smeshpy.hxx index 015d91bde..16926e54d 100644 --- a/src/SMESH_I/SMESH_2smeshpy.hxx +++ b/src/SMESH_I/SMESH_2smeshpy.hxx @@ -327,7 +327,7 @@ public: void Process( const Handle(_pyCommand)& theCommand); void Flush(); virtual void Assign( const Handle(_pyHypothesis)& theOther, - const _pyID& theMesh ); + const _pyID& theMesh ); DEFINE_STANDARD_RTTI (_pyHypothesis) }; diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index e940862ad..5b012b59c 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -66,8 +66,8 @@ namespace SMESH TCollection_AsciiString aCollection(Standard_CString(aString.c_str())); SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); if(!aStudy->_is_nil() && !aCollection.IsEmpty()){ - aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection); - if(MYDEBUG) MESSAGE(aString); + aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection); + if(MYDEBUG) MESSAGE(aString); } } } @@ -587,8 +587,8 @@ Handle(TColStd_HSequenceOfInteger) FindEntries (TCollection_AsciiString& theStri isFound = Standard_False; while((j < aLen) && ( isdigit(c) || c == ':' )) { //Check if it is an entry - c = (int)arr[j++]; - if(c == ':') isFound = Standard_True; + c = (int)arr[j++]; + if(c == ':') isFound = Standard_True; } if (isFound) { @@ -786,7 +786,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl } // set initial part of aSript - TCollection_AsciiString initPart = "import salome, SMESH\n"; + TCollection_AsciiString initPart = "import salome, SMESH, SALOMEDS\n"; initPart += helper + "import " + aSmeshpy + "\n\n"; if ( importGeom ) { @@ -821,7 +821,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl if( !CORBA::is_nil(aGroup) ) { SALOMEDS::Color aColor = aGroup->GetColor(); - if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) + if ( aColor.R >= 0 || aColor.G >= 0 || aColor.B >= 0 ) { CORBA::String_var anEntry = aSObj->GetID(); anUpdatedScript += SMESH_Comment("\n\t") diff --git a/src/SMESH_I/SMESH_Filter_i.cxx b/src/SMESH_I/SMESH_Filter_i.cxx index c75d81e88..e9370beda 100644 --- a/src/SMESH_I/SMESH_Filter_i.cxx +++ b/src/SMESH_I/SMESH_Filter_i.cxx @@ -2436,13 +2436,13 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria pd << "aCriterion = SMESH.Filter.Criterion(" << aCriterion << "," << aCompare << "," << aThreshold << ",'" << aThresholdStr; if (aThresholdID && strlen(aThresholdID)) - //pd << "',salome.ObjectToID(" << aThresholdID + //pd << "',salome.ObjectToID(" << aThresholdID pd << "','" << aThresholdID - << "'," << aUnary << "," << aBinary << "," << aTolerance - << "," << aTypeOfElem << "," << aPrecision << ")"; + << "'," << 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(); @@ -2534,7 +2534,7 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria { SMESH::LyingOnGeom_ptr tmpPred = aFilterMgr->CreateLyingOnGeom(); tmpPred->SetElementType( aTypeOfElem ); - tmpPred->SetShape( aThresholdID, aThresholdStr ); + tmpPred->SetShape( aThresholdID, aThresholdStr ); tmpPred->SetTolerance( aTolerance ); aPredicate = tmpPred; } diff --git a/src/SMESH_I/SMESH_Filter_i.hxx b/src/SMESH_I/SMESH_Filter_i.hxx index 090705d05..44cc246bf 100644 --- a/src/SMESH_I/SMESH_Filter_i.hxx +++ b/src/SMESH_I/SMESH_Filter_i.hxx @@ -107,10 +107,10 @@ namespace SMESH double GetTolerance(); virtual bool Contains( const SMESHDS_Mesh* theMeshDS, - const TopoDS_Shape& theShape, - const SMDS_MeshElement* theElem, - TopAbs_ShapeEnum theFindShapeEnum, - TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE ); + const TopoDS_Shape& theShape, + const SMDS_MeshElement* theElem, + TopAbs_ShapeEnum theFindShapeEnum, + TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE ); private: virtual void init(); @@ -133,7 +133,7 @@ namespace SMESH Description : An abstact class for all functors */ class SMESH_I_EXPORT Functor_i: public virtual POA_SMESH::Functor, - public virtual SALOME::GenericObj_i + public virtual SALOME::GenericObj_i { public: void SetMesh( SMESH_Mesh_ptr theMesh ); @@ -152,7 +152,7 @@ namespace SMESH Description : Base class for numerical functors */ class SMESH_I_EXPORT NumericalFunctor_i: public virtual POA_SMESH::NumericalFunctor, - public virtual Functor_i + public virtual Functor_i { public: CORBA::Double GetValue( CORBA::Long theElementId ); @@ -170,7 +170,7 @@ namespace SMESH Description : Functor for calculation of minimum angle */ class SMESH_I_EXPORT MinimumAngle_i: public virtual POA_SMESH::MinimumAngle, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: MinimumAngle_i(); @@ -183,7 +183,7 @@ namespace SMESH Description : Functor for calculating aspect ratio */ class SMESH_I_EXPORT AspectRatio_i: public virtual POA_SMESH::AspectRatio, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: AspectRatio_i(); @@ -196,7 +196,7 @@ namespace SMESH Description : Functor for calculating aspect ratio for 3D */ class SMESH_I_EXPORT AspectRatio3D_i: public virtual POA_SMESH::AspectRatio3D, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: AspectRatio3D_i(); @@ -209,7 +209,7 @@ namespace SMESH Description : Functor for calculating warping */ class SMESH_I_EXPORT Warping_i: public virtual POA_SMESH::Warping, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: Warping_i(); @@ -222,7 +222,7 @@ namespace SMESH Description : Functor for calculating taper */ class SMESH_I_EXPORT Taper_i: public virtual POA_SMESH::Taper, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: Taper_i(); @@ -235,7 +235,7 @@ namespace SMESH Description : Functor for calculating skew in degrees */ class SMESH_I_EXPORT Skew_i: public virtual POA_SMESH::Skew, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: Skew_i(); @@ -248,7 +248,7 @@ namespace SMESH Description : Functor for calculating area */ class SMESH_I_EXPORT Area_i: public virtual POA_SMESH::Area, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: Area_i(); @@ -274,7 +274,7 @@ namespace SMESH Description : Functor for calculating length of edge */ class SMESH_I_EXPORT Length_i: public virtual POA_SMESH::Length, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: Length_i(); @@ -286,7 +286,7 @@ namespace SMESH Description : Functor for calculating length of edge */ class SMESH_I_EXPORT Length2D_i: public virtual POA_SMESH::Length2D, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: Length2D_i(); @@ -303,7 +303,7 @@ namespace SMESH Description : Functor for calculating number of faces conneted to the edge */ class SMESH_I_EXPORT MultiConnection_i: public virtual POA_SMESH::MultiConnection, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: MultiConnection_i(); @@ -315,7 +315,7 @@ namespace SMESH Description : Functor for calculating number of faces conneted to the edge */ class SMESH_I_EXPORT MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D, - public virtual NumericalFunctor_i + public virtual NumericalFunctor_i { public: MultiConnection2D_i(); @@ -335,7 +335,7 @@ namespace SMESH Description : Base class for all predicates */ class SMESH_I_EXPORT Predicate_i: public virtual POA_SMESH::Predicate, - public virtual Functor_i + public virtual Functor_i { public: CORBA::Boolean IsSatisfy( CORBA::Long theElementId ); @@ -352,7 +352,7 @@ namespace SMESH the point of view of MED convention */ class SMESH_I_EXPORT BadOrientedVolume_i: public virtual POA_SMESH::BadOrientedVolume, - public virtual Predicate_i + public virtual Predicate_i { public: BadOrientedVolume_i(); @@ -364,7 +364,7 @@ namespace SMESH Description : Predicate for selection on geometrical support */ class SMESH_I_EXPORT BelongToGeom_i: public virtual POA_SMESH::BelongToGeom, - public virtual Predicate_i + public virtual Predicate_i { public: BelongToGeom_i(); @@ -395,7 +395,7 @@ namespace SMESH Description : Verify whether mesh element lie in pointed Geom planar object */ class SMESH_I_EXPORT BelongToSurface_i: public virtual POA_SMESH::BelongToSurface, - public virtual Predicate_i + public virtual Predicate_i { public: BelongToSurface_i( const Handle(Standard_Type)& ); @@ -426,7 +426,7 @@ namespace SMESH Description : Verify whether mesh element lie in pointed Geom planar object */ class SMESH_I_EXPORT BelongToPlane_i: public virtual POA_SMESH::BelongToPlane, - public virtual BelongToSurface_i + public virtual BelongToSurface_i { public: BelongToPlane_i(); @@ -439,7 +439,7 @@ namespace SMESH Description : Verify whether mesh element lie in pointed Geom cylindrical object */ class SMESH_I_EXPORT BelongToCylinder_i: public virtual POA_SMESH::BelongToCylinder, - public virtual BelongToSurface_i + public virtual BelongToSurface_i { public: BelongToCylinder_i(); @@ -465,7 +465,7 @@ namespace SMESH Description : Predicate for selection on geometrical support(lying or partially lying) */ class SMESH_I_EXPORT LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom, - public virtual Predicate_i + public virtual Predicate_i { public: LyingOnGeom_i(); @@ -496,7 +496,7 @@ namespace SMESH Description : Predicate for free borders */ class SMESH_I_EXPORT FreeBorders_i: public virtual POA_SMESH::FreeBorders, - public virtual Predicate_i + public virtual Predicate_i { public: FreeBorders_i(); @@ -509,7 +509,7 @@ namespace SMESH Description : Predicate for free edges */ class SMESH_I_EXPORT FreeEdges_i: public virtual POA_SMESH::FreeEdges, - public virtual Predicate_i + public virtual Predicate_i { public: FreeEdges_i(); @@ -526,7 +526,7 @@ namespace SMESH Description : Predicate for free faces */ class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces, - public virtual Predicate_i + public virtual Predicate_i { public: FreeFaces_i(); @@ -539,7 +539,7 @@ namespace SMESH Description : Predicate for free nodes */ class SMESH_I_EXPORT FreeNodes_i: public virtual POA_SMESH::FreeNodes, - public virtual Predicate_i + public virtual Predicate_i { public: FreeNodes_i(); @@ -552,7 +552,7 @@ namespace SMESH Description : Predicate for Range of Ids */ class SMESH_I_EXPORT RangeOfIds_i: public virtual POA_SMESH::RangeOfIds, - public virtual Predicate_i + public virtual Predicate_i { public: RangeOfIds_i(); @@ -572,7 +572,7 @@ namespace SMESH Description : Verify whether a mesh element is linear */ class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic, - public virtual Predicate_i + public virtual Predicate_i { public: LinearOrQuadratic_i(); @@ -588,7 +588,7 @@ namespace SMESH Description : Functor for check color of group to whic mesh element belongs to */ class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor, - public virtual Predicate_i + public virtual Predicate_i { public: GroupColor_i(); @@ -607,7 +607,7 @@ namespace SMESH Description : Functor for check element geometry type */ class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType, - public virtual Predicate_i + public virtual Predicate_i { public: ElemGeomType_i(); @@ -626,7 +626,7 @@ namespace SMESH Description : Base class for comparators */ class SMESH_I_EXPORT Comparator_i: public virtual POA_SMESH::Comparator, - public virtual Predicate_i + public virtual Predicate_i { public: virtual ~Comparator_i(); @@ -651,7 +651,7 @@ namespace SMESH Description : Comparator "<" */ class SMESH_I_EXPORT LessThan_i: public virtual POA_SMESH::LessThan, - public virtual Comparator_i + public virtual Comparator_i { public: LessThan_i(); @@ -664,7 +664,7 @@ namespace SMESH Description : Comparator ">" */ class SMESH_I_EXPORT MoreThan_i: public virtual POA_SMESH::MoreThan, - public virtual Comparator_i + public virtual Comparator_i { public: MoreThan_i(); @@ -677,7 +677,7 @@ namespace SMESH Description : Comparator "=" */ class SMESH_I_EXPORT EqualTo_i: public virtual POA_SMESH::EqualTo, - public virtual Comparator_i + public virtual Comparator_i { public: EqualTo_i(); @@ -695,7 +695,7 @@ namespace SMESH Description : Logical NOT predicate */ class SMESH_I_EXPORT LogicalNOT_i: public virtual POA_SMESH::LogicalNOT, - public virtual Predicate_i + public virtual Predicate_i { public: LogicalNOT_i(); @@ -716,7 +716,7 @@ namespace SMESH Description : Base class for binary logical predicate */ class SMESH_I_EXPORT LogicalBinary_i: public virtual POA_SMESH::LogicalBinary, - public virtual Predicate_i + public virtual Predicate_i { public: virtual ~LogicalBinary_i(); @@ -742,7 +742,7 @@ namespace SMESH Description : Logical AND */ class SMESH_I_EXPORT LogicalAND_i: public virtual POA_SMESH::LogicalAND, - public virtual LogicalBinary_i + public virtual LogicalBinary_i { public: LogicalAND_i(); @@ -755,7 +755,7 @@ namespace SMESH Description : Logical OR */ class SMESH_I_EXPORT LogicalOR_i: public virtual POA_SMESH::LogicalOR, - public virtual LogicalBinary_i + public virtual LogicalBinary_i { public: LogicalOR_i(); @@ -767,7 +767,7 @@ namespace SMESH FILTER */ class SMESH_I_EXPORT Filter_i: public virtual POA_SMESH::Filter, - public virtual SALOME::GenericObj_i + public virtual SALOME::GenericObj_i { public: Filter_i(); @@ -792,13 +792,13 @@ namespace SMESH static void GetElementsId( Predicate_i*, - const SMDS_Mesh*, - Controls::Filter::TIdSequence& ); + const SMDS_Mesh*, + Controls::Filter::TIdSequence& ); static void GetElementsId( Predicate_i*, - SMESH_Mesh_ptr, - Controls::Filter::TIdSequence& ); + SMESH_Mesh_ptr, + Controls::Filter::TIdSequence& ); virtual long_array* @@ -833,7 +833,7 @@ namespace SMESH FILTER LIBRARY */ class SMESH_I_EXPORT FilterLibrary_i: public virtual POA_SMESH::FilterLibrary, - public virtual SALOME::GenericObj_i + public virtual SALOME::GenericObj_i { public: FilterLibrary_i( const char* theFileName ); @@ -846,8 +846,8 @@ namespace SMESH CORBA::Boolean AddEmpty( const char* theFilterName, ElementType theType ); CORBA::Boolean Delete ( const char* theFilterName ); CORBA::Boolean Replace ( const char* theFilterName, - const char* theNewName, - Filter_ptr theFilter ); + const char* theNewName, + Filter_ptr theFilter ); CORBA::Boolean Save(); CORBA::Boolean SaveAs( const char* aFileName ); @@ -871,7 +871,7 @@ namespace SMESH */ class SMESH_I_EXPORT FilterManager_i: public virtual POA_SMESH::FilterManager, - public virtual SALOME::GenericObj_i + public virtual SALOME::GenericObj_i { public: FilterManager_i(); diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index dbf4fe43e..899581804 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1879,7 +1879,8 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray, typedef map< pair, TListOfNewGroups > TGroupsMap; typedef std::set TGroups; - TPythonDump aPythonDump; // prevent dump of called methods + TPythonDump* pPythonDump = new TPythonDump; + TPythonDump& aPythonDump = *pPythonDump; // prevent dump of called methods // create mesh SMESH::SMESH_Mesh_var aNewMesh = CreateEmptyMesh(); @@ -2147,6 +2148,24 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray, << theMergeNodesAndElements << ", " << theMergeTolerance << ")"; + delete pPythonDump; // enable python dump from GetGroups() + + // 0020577: EDF 1164 SMESH: Bad dump of concatenate with create common groups + if ( !aNewMesh->_is_nil() ) + { + SMESH::ListOfGroups_var groups = aNewMesh->GetGroups(); + } + + // IPAL21468 Change icon of compound because it need not be computed. + SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, aNewMesh ); + if( !aMeshSObj->_is_nil() ) { + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::StudyBuilder_var aBuilder = myCurrentStudy->NewBuilder(); + anAttr = aBuilder->FindOrCreateAttribute( aMeshSObj,"AttributePixMap" ); + SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap("ICON_SMESH_TREE_MESH"); + } + return aNewMesh._retn(); } diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 0a6e01061..13bca294a 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -176,7 +176,7 @@ public: // ***************************************** // Set a new Mesh object name void SetName(const char* theIOR, - const char* theName); + const char* theName); //GEOM::GEOM_Gen_ptr SetGeomEngine( const char* containerLoc ); void SetGeomEngine( GEOM::GEOM_Gen_ptr geomcompo ); @@ -266,9 +266,9 @@ public: * Return mesh preview structure */ SMESH::MeshPreviewStruct* Precompute( SMESH::SMESH_Mesh_ptr theMesh, - GEOM::GEOM_Object_ptr theSubObject, - SMESH::Dimension theDimension, - SMESH::long_array& theShapesId ) + GEOM::GEOM_Object_ptr theSubObject, + SMESH::Dimension theDimension, + SMESH::long_array& theShapesId ) throw ( SALOME::SALOME_Exception ); // Returns errors of hypotheses definintion @@ -294,30 +294,30 @@ public: // Return geometrical object the given element is built on. Don't publish it in study. GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh, - CORBA::Long theElementID) + CORBA::Long theElementID) throw ( SALOME::SALOME_Exception ); // Concatenate the given meshes into one mesh SMESH::SMESH_Mesh_ptr ConcatenateCommon(const SMESH::mesh_array& theMeshesArray, - CORBA::Boolean theUniteIdenticalGroups, - CORBA::Boolean theMergeNodesAndElements, - CORBA::Double theMergeTolerance, - CORBA::Boolean theCommonGroups) + CORBA::Boolean theUniteIdenticalGroups, + CORBA::Boolean theMergeNodesAndElements, + CORBA::Double theMergeTolerance, + CORBA::Boolean theCommonGroups) throw ( SALOME::SALOME_Exception ); // Concatenate the given meshes into one mesh SMESH::SMESH_Mesh_ptr Concatenate(const SMESH::mesh_array& theMeshesArray, - CORBA::Boolean theUniteIdenticalGroups, - CORBA::Boolean theMergeNodesAndElements, - CORBA::Double theMergeTolerance) + CORBA::Boolean theUniteIdenticalGroups, + CORBA::Boolean theMergeNodesAndElements, + CORBA::Double theMergeTolerance) throw ( SALOME::SALOME_Exception ); // Concatenate the given meshes into one mesh // Create the groups of all elements from initial meshes SMESH::SMESH_Mesh_ptr ConcatenateWithGroups(const SMESH::mesh_array& theMeshesArray, - CORBA::Boolean theUniteIdenticalGroups, - CORBA::Boolean theMergeNodesAndElements, - CORBA::Double theMergeTolerance) + CORBA::Boolean theUniteIdenticalGroups, + CORBA::Boolean theMergeNodesAndElements, + CORBA::Double theMergeTolerance) throw ( SALOME::SALOME_Exception ); // **************************************************** @@ -326,22 +326,22 @@ public: // Save SMESH data SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile ); + const char* theURL, + bool isMultiFile ); // Load SMESH data bool Load( SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile ); + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile ); // Save SMESH data in ASCII format SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile ); + const char* theURL, + bool isMultiFile ); // Load SMESH data in ASCII format bool LoadASCII( SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, - const char* theURL, - bool isMultiFile ); + const SALOMEDS::TMPFile& theStream, + const char* theURL, + bool isMultiFile ); // Create filter manager SMESH::FilterManager_ptr CreateFilterManager(); @@ -357,22 +357,22 @@ public: // Transform data from transient form to persistent char* IORToLocalPersistentID( SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII ); + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII ); // Transform data from persistent form to transient char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII ); + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII ); // Returns true if object can be published in the study bool CanPublishInStudy( CORBA::Object_ptr theIOR ); // Publish object in the study SALOMEDS::SObject_ptr PublishInStudy( SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject, - CORBA::Object_ptr theObject, - const char* theName ) + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName ) throw ( SALOME::SALOME_Exception ); // Copy-paste methods - returns true if object can be copied to the clipboard @@ -383,8 +383,8 @@ public: CORBA::Boolean CanPaste( const char* theComponentName, CORBA::Long theObjectID ) { return false; } // Copy-paste methods - paste object from the clipboard SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile& theStream, - CORBA::Long theObjectID, - SALOMEDS::SObject_ptr theObject ) { + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject ) { SALOMEDS::SObject_var aResultSO; return aResultSO._retn(); } @@ -394,8 +394,8 @@ public: // ============ virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, - CORBA::Boolean isPublished, - CORBA::Boolean& isValidScript); + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript); void AddToPythonScript (int theStudyID, const TCollection_AsciiString& theString); @@ -452,7 +452,7 @@ public: SMESH::SMESH_Mesh_ptr theMesh, SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Object_ptr theShapeObject, - const char* theName = 0); + const char* theName = 0); SALOMEDS::SObject_ptr PublishGroup (SALOMEDS::Study_ptr theStudy, SMESH::SMESH_Mesh_ptr theMesh, SMESH::SMESH_GroupBase_ptr theGroup, diff --git a/src/SMESH_I/SMESH_Group_i.cxx b/src/SMESH_I/SMESH_Group_i.cxx index 2f9a7f775..7502c5409 100644 --- a/src/SMESH_I/SMESH_Group_i.cxx +++ b/src/SMESH_I/SMESH_Group_i.cxx @@ -305,8 +305,8 @@ typedef bool (SMESHDS_Group::*TFunChangeGroup)(const int); CORBA::Long ChangeByPredicate( SMESH::Predicate_i* thePredicate, - SMESHDS_GroupBase* theGroupBase, - TFunChangeGroup theFun) + SMESHDS_GroupBase* theGroupBase, + TFunChangeGroup theFun) { CORBA::Long aNb = 0; if(SMESHDS_Group* aGroupDS = dynamic_cast(theGroupBase)){ @@ -317,7 +317,7 @@ ChangeByPredicate( SMESH::Predicate_i* thePredicate, CORBA::Long i = 0, iEnd = aSequence.size(); for(; i < iEnd; i++) if((aGroupDS->*theFun)(aSequence[i])) - aNb++; + aNb++; return aNb; } return aNb; diff --git a/src/SMESH_I/SMESH_MEDFamily_i.cxx b/src/SMESH_I/SMESH_MEDFamily_i.cxx index 35bacddc3..393e49c42 100644 --- a/src/SMESH_I/SMESH_MEDFamily_i.cxx +++ b/src/SMESH_I/SMESH_MEDFamily_i.cxx @@ -77,7 +77,7 @@ SMESH_MEDFamily_i::~SMESH_MEDFamily_i() */ //============================================================================= SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm, - string name, string description, SALOME_MED::medEntityMesh entity): + string name, string description, SALOME_MED::medEntityMesh entity): SMESH_MEDSupport_i( sm, name, description, entity ), _subMesh_i(sm), @@ -103,7 +103,7 @@ throw (SALOME::SALOME_Exception) { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); return _identifier; } @@ -117,7 +117,7 @@ throw (SALOME::SALOME_Exception) { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); return _numberOfAttribute; } //============================================================================= @@ -130,12 +130,12 @@ throw (SALOME::SALOME_Exception) { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); if (_numberOfAttribute == 0) { MESSAGE("Les familles SMESH n ont pas d attribut"); THROW_SALOME_CORBA_EXCEPTION("No attributes"\ - ,SALOME::BAD_PARAM); + ,SALOME::BAD_PARAM); }; SALOME_MED::long_array_var myseq= new SALOME_MED::long_array; @@ -157,15 +157,15 @@ CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i) { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); MESSAGE("Les familles SMESH n ont pas d attribut"); THROW_SALOME_CORBA_EXCEPTION("No attributes"\ - ,SALOME::BAD_PARAM); + ,SALOME::BAD_PARAM); if (_numberOfAttribute == 0) { MESSAGE("Les familles SMESH n ont pas d attribut"); THROW_SALOME_CORBA_EXCEPTION("No attributes"\ - ,SALOME::BAD_PARAM); + ,SALOME::BAD_PARAM); }; ASSERT (i <= _numberOfAttribute); return _attributeIdentifier[i]; @@ -180,13 +180,13 @@ SALOME_MED::long_array* SMESH_MEDFamily_i::getAttributesValues() { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); if (_numberOfAttribute == 0) { MESSAGE("Les familles SMESH n ont pas d attribut"); THROW_SALOME_CORBA_EXCEPTION("No attributes"\ - ,SALOME::BAD_PARAM); + ,SALOME::BAD_PARAM); }; SALOME_MED::long_array_var myseq= new SALOME_MED::long_array; @@ -207,12 +207,12 @@ CORBA::Long SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i) { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); if (_numberOfAttribute == 0) { MESSAGE("Les familles SMESH n ont pas d attribut"); THROW_SALOME_CORBA_EXCEPTION("No attributes"\ - ,SALOME::BAD_PARAM); + ,SALOME::BAD_PARAM); } ASSERT (i <= _numberOfAttribute); @@ -228,12 +228,12 @@ SALOME_MED::string_array * SMESH_MEDFamily_i::getAttributesDescriptions() { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); if (_numberOfAttribute == 0) { MESSAGE("Les familles SMESH n ont pas d attribut"); THROW_SALOME_CORBA_EXCEPTION("No attributes"\ - ,SALOME::BAD_PARAM); + ,SALOME::BAD_PARAM); } SALOME_MED::string_array_var myseq = new SALOME_MED::string_array; for (int i=0;i<_numberOfAttribute;i++) @@ -252,12 +252,12 @@ char * SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i) { if (_subMeshDS==NULL) THROW_SALOME_CORBA_EXCEPTION("No associated Family",\ - SALOME::INTERNAL_ERROR); + SALOME::INTERNAL_ERROR); if (_numberOfAttribute == 0) { MESSAGE("Les familles SMESH n ont pas d attribut"); THROW_SALOME_CORBA_EXCEPTION("No attributes"\ - ,SALOME::BAD_PARAM); + ,SALOME::BAD_PARAM); } ASSERT (i <= _numberOfAttribute); return CORBA::string_dup(_attributeDescription[i].c_str()); diff --git a/src/SMESH_I/SMESH_MEDFamily_i.hxx b/src/SMESH_I/SMESH_MEDFamily_i.hxx index 2b850fc8a..e6af38067 100644 --- a/src/SMESH_I/SMESH_MEDFamily_i.hxx +++ b/src/SMESH_I/SMESH_MEDFamily_i.hxx @@ -56,7 +56,7 @@ public : // Constructors and associated internal methods SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm, - std::string name, std::string description, SALOME_MED::medEntityMesh entity ); + std::string name, std::string description, SALOME_MED::medEntityMesh entity ); SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f); // IDL Methods diff --git a/src/SMESH_I/SMESH_MEDMesh_i.cxx b/src/SMESH_I/SMESH_MEDMesh_i.cxx index 9ee46fda3..f73bf1102 100644 --- a/src/SMESH_I/SMESH_MEDMesh_i.cxx +++ b/src/SMESH_I/SMESH_MEDMesh_i.cxx @@ -24,6 +24,7 @@ // Module : SMESH // #include "SMESH_MEDMesh_i.hxx" +#include "SMESH_Gen_i.hxx" #include "SMESH_Mesh_i.hxx" #include "SMESHDS_Mesh.hxx" @@ -69,8 +70,8 @@ using namespace std; // PN Est-ce un const ? SMESH_MEDMesh_i::SMESH_MEDMesh_i() { - BEGIN_OF("Default Constructor SMESH_MEDMesh_i"); - END_OF("Default Constructor SMESH_MEDMesh_i"); + BEGIN_OF("Default Constructor SMESH_MEDMesh_i"); + END_OF("Default Constructor SMESH_MEDMesh_i"); } //============================================================================= @@ -88,18 +89,18 @@ SMESH_MEDMesh_i::~SMESH_MEDMesh_i() */ //============================================================================= SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""), - _compte(false), - _creeFamily(false), - _famIdent(0), - _indexElts(0), - _indexEnts(0) + _compte(false), + _creeFamily(false), + _famIdent(0), + _indexElts(0), + _indexEnts(0) { - BEGIN_OF("Constructor SMESH_MEDMesh_i"); + BEGIN_OF("Constructor SMESH_MEDMesh_i"); - _mesh_i = m_i; - _meshDS = _mesh_i->GetImpl().GetMeshDS(); + _mesh_i = m_i; + _meshDS = _mesh_i->GetImpl().GetMeshDS(); - END_OF("Constructor SMESH_MEDMesh_i"); + END_OF("Constructor SMESH_MEDMesh_i"); } //============================================================================= @@ -109,22 +110,28 @@ SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""), //============================================================================= char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception) { - if (_meshDS == NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - - try - { - // A COMPLETER PAR LE NOM DU MAILLAGE - //return CORBA::string_dup(_mesh_i->getName().c_str()); - return CORBA::string_dup("toto"); - } - catch(...) - { - MESSAGE("Exception en accedant au nom"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } + if (_meshDS == NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + + try + { + SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen(); + SALOMEDS::Study_var study = gen->GetCurrentStudy(); + SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, _mesh_i->_this()); + if ( meshSO->_is_nil() ) + return CORBA::string_dup("toto"); + + CORBA::String_var name = meshSO->GetName(); + return CORBA::string_dup( name.in() ); + } + catch(...) + { + MESSAGE("Exception en accedant au nom"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return 0; } //============================================================================= @@ -134,8 +141,8 @@ char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception) //============================================================================= CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } //============================================================================= @@ -145,11 +152,11 @@ CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception) //============================================================================= CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception) { - // PN : Il semblerait que la dimension soit fixee a 3 - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - return 3; + // PN : Il semblerait que la dimension soit fixee a 3 + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + return 3; } //============================================================================= @@ -159,14 +166,14 @@ CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception) //============================================================================= CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - // PN : Il semblerait que la dimension soit fixee a 3 - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - return 3; + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + // PN : Il semblerait que la dimension soit fixee a 3 + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + return 3; } //============================================================================= /*! @@ -188,7 +195,7 @@ CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception) //============================================================================= CORBA::Boolean SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType, - SALOME_MED::medEntityMesh entity) + SALOME_MED::medEntityMesh entity) throw (SALOME::SALOME_Exception) { MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!"); @@ -218,21 +225,21 @@ CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axi //============================================================================= char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - // PN : En dur. Non encore prevu - try - { - string systcoo = "CARTESIEN"; - return CORBA::string_dup(systcoo.c_str()); - } - catch(...) - { - MESSAGE("Exception en accedant au maillage"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + // PN : En dur. Non encore prevu + try + { + string systcoo = "CARTESIEN"; + return CORBA::string_dup(systcoo.c_str()); + } + catch(...) + { + MESSAGE("Exception en accedant au maillage"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } //============================================================================= @@ -240,56 +247,56 @@ char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception) * CORBA: Accessor for Coordinates */ //============================================================================= -SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates( - SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception) +SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates +(SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - SALOME_MED::double_array_var myseq = new SALOME_MED::double_array; - try - { - // PN : En dur - int spaceDimension = 3; - int nbNodes = _meshDS->NbNodes(); - SCRUTE(nbNodes); - myseq->length(nbNodes * spaceDimension); - int i = 0; - - SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator(); - while(itNodes->more()) - { - const SMDS_MeshNode* node = itNodes->next(); - - if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE) - { - myseq[i * 3] = node->X(); - myseq[i * 3 + 1] = node->Y(); - myseq[i * 3 + 2] = node->Z(); - SCRUTE(myseq[i * 3]); - SCRUTE(myseq[i * 3 + 1]); - SCRUTE(myseq[i * 3 + 2]); - } - else - { - ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE); - myseq[i] = node->X(); - myseq[i + nbNodes] = node->Y(); - myseq[i + (nbNodes * 2)] = node->Z(); - SCRUTE(myseq[i]); - SCRUTE(myseq[i + nbNodes]); - SCRUTE(myseq[i + (nbNodes * 2)]); - } - i++; - } - } - catch(...) - { - MESSAGE("Exception en accedant aux coordonnees"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + SALOME_MED::double_array_var myseq = new SALOME_MED::double_array; + try + { + // PN : En dur + int spaceDimension = 3; + int nbNodes = _meshDS->NbNodes(); + SCRUTE(nbNodes); + myseq->length(nbNodes * spaceDimension); + int i = 0; + + SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator(); + while(itNodes->more()) + { + const SMDS_MeshNode* node = itNodes->next(); + + if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE) + { + myseq[i * 3] = node->X(); + myseq[i * 3 + 1] = node->Y(); + myseq[i * 3 + 2] = node->Z(); + SCRUTE(myseq[i * 3]); + SCRUTE(myseq[i * 3 + 1]); + SCRUTE(myseq[i * 3 + 2]); + } + else + { + ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE); + myseq[i] = node->X(); + myseq[i + nbNodes] = node->Y(); + myseq[i + (nbNodes * 2)] = node->Z(); + SCRUTE(myseq[i]); + SCRUTE(myseq[i + nbNodes]); + SCRUTE(myseq[i + (nbNodes * 2)]); + } + i++; + } + } + catch(...) + { + MESSAGE("Exception en accedant aux coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } //============================================================================= @@ -298,28 +305,28 @@ SALOME_MED::double_array * SMESH_MEDMesh_i::getCoordinates( */ //============================================================================= SALOME_MED::string_array * - SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception) +SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - SALOME_MED::string_array_var myseq = new SALOME_MED::string_array; - try - { - // PN : en dur - int spaceDimension = 3; - myseq->length(spaceDimension); - myseq[0] = CORBA::string_dup("x"); - myseq[1] = CORBA::string_dup("y"); - myseq[2] = CORBA::string_dup("z"); - } - catch(...) - { - MESSAGE("Exception en accedant aux noms des coordonnees"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + SALOME_MED::string_array_var myseq = new SALOME_MED::string_array; + try + { + // PN : en dur + int spaceDimension = 3; + myseq->length(spaceDimension); + myseq[0] = CORBA::string_dup("x"); + myseq[1] = CORBA::string_dup("y"); + myseq[2] = CORBA::string_dup("z"); + } + catch(...) + { + MESSAGE("Exception en accedant aux noms des coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } @@ -329,28 +336,28 @@ SALOME_MED::string_array * */ //============================================================================= SALOME_MED::string_array * - SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception) +SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - SALOME_MED::string_array_var myseq = new SALOME_MED::string_array; - try - { - // PN : en dur - int spaceDimension = 3; - myseq->length(spaceDimension); - myseq[0] = CORBA::string_dup("m"); - myseq[1] = CORBA::string_dup("m"); - myseq[2] = CORBA::string_dup("m"); - } - catch(...) - { - MESSAGE("Exception en accedant aux unites des coordonnees"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + SALOME_MED::string_array_var myseq = new SALOME_MED::string_array; + try + { + // PN : en dur + int spaceDimension = 3; + myseq->length(spaceDimension); + myseq[0] = CORBA::string_dup("m"); + myseq[1] = CORBA::string_dup("m"); + myseq[2] = CORBA::string_dup("m"); + } + catch(...) + { + MESSAGE("Exception en accedant aux unites des coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } //============================================================================= @@ -360,19 +367,19 @@ SALOME_MED::string_array * //============================================================================= CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - try - { - return _meshDS->NbNodes(); - } - catch(...) - { - MESSAGE("Exception en accedant au nombre de noeuds"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + try + { + return _meshDS->NbNodes(); + } + catch(...) + { + MESSAGE("Exception en accedant au nombre de noeuds"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } //============================================================================= @@ -381,119 +388,119 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception) */ //============================================================================= CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity) -throw(SALOME::SALOME_Exception) + throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - try - { - if (!_compte) - calculeNbElts(); - int retour = 0; - if (_mapNbTypes.find(entity) != _mapNbTypes.end()) - retour = _mapNbTypes[entity]; - return retour; - } - catch(...) - { - MESSAGE("Exception en accedant au nombre de Types"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + try + { + if (!_compte) + calculeNbElts(); + int retour = 0; + if (_mapNbTypes.find(entity) != _mapNbTypes.end()) + retour = _mapNbTypes[entity]; + return retour; + } + catch(...) + { + MESSAGE("Exception en accedant au nombre de Types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } //============================================================================= /*! * CORBA: Accessor for existing geometry element types - * Not implemented for MED_ALL_ENTITIES + * Not implemented for MED_ALL_ENTITIES */ //============================================================================= SALOME_MED::medGeometryElement_array * - SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME:: - SALOME_Exception) +SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME:: + SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - if (entity == SALOME_MED::MED_ALL_ENTITIES) - THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES", - SALOME::BAD_PARAM); - if (!_compte) - calculeNbElts(); - SALOME_MED::medGeometryElement_array_var myseq = - new SALOME_MED::medGeometryElement_array; - try - { - if (_mapNbTypes.find(entity) == _mapNbTypes.end()) - THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh", - SALOME::BAD_PARAM); - int nbTypes = _mapNbTypes[entity]; - - myseq->length(nbTypes); - - if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end()) - THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh", - SALOME::INTERNAL_ERROR); - - int index = _mapIndToVectTypes[entity]; - ASSERT(_TypesId[index].size() != 0); - int i = 0; - vector < SALOME_MED::medGeometryElement >::iterator it; - for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++) - { - myseq[i++] = *it; - }; - } - catch(...) - { - MESSAGE("Exception en accedant aux differents types"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + if (entity == SALOME_MED::MED_ALL_ENTITIES) + THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES", + SALOME::BAD_PARAM); + if (!_compte) + calculeNbElts(); + SALOME_MED::medGeometryElement_array_var myseq = + new SALOME_MED::medGeometryElement_array; + try + { + if (_mapNbTypes.find(entity) == _mapNbTypes.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh", + SALOME::BAD_PARAM); + int nbTypes = _mapNbTypes[entity]; + + myseq->length(nbTypes); + + if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh", + SALOME::INTERNAL_ERROR); + + int index = _mapIndToVectTypes[entity]; + ASSERT(_TypesId[index].size() != 0); + int i = 0; + vector < SALOME_MED::medGeometryElement >::iterator it; + for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++) + { + myseq[i++] = *it; + }; + } + catch(...) + { + MESSAGE("Exception en accedant aux differents types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } //============================================================================= /*! * CORBA: Returns number of elements of type medGeometryElement - * Not implemented for MED_ALL_ELEMENTS - * implemented for MED_ALL_ENTITIES + * Not implemented for MED_ALL_ELEMENTS + * implemented for MED_ALL_ENTITIES * * Dans cette implementation, il n est pas prevu de tenir compte du entity * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement */ //============================================================================= CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED:: - medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) + medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - if (geomElement == SALOME_MED::MED_ALL_ELEMENTS) - THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS", - SALOME::BAD_PARAM); - if (!_compte) - calculeNbElts(); - - try - { - int retour = 0; - if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end()) - { - int index = _mapIndToSeqElts[geomElement]; - - retour = _seq_elemId[index]->length(); - } - return retour; - } - catch(...) - { - MESSAGE("Exception en accedant au nombre d élements"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", - SALOME::INTERNAL_ERROR); - } + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + if (geomElement == SALOME_MED::MED_ALL_ELEMENTS) + THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS", + SALOME::BAD_PARAM); + if (!_compte) + calculeNbElts(); + + try + { + int retour = 0; + if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end()) + { + int index = _mapIndToSeqElts[geomElement]; + + retour = _seq_elemId[index]->length(); + } + return retour; + } + catch(...) + { + MESSAGE("Exception en accedant au nombre d élements"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } //============================================================================= @@ -503,29 +510,29 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED:: //============================================================================= SALOME_MED::long_array * SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch, - SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) + SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - if (mode != SALOME_MED::MED_NODAL) - THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM); - if (typeSwitch == SALOME_MED::MED_NO_INTERLACE) - THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM); - if (!_compte) - calculeNbElts(); - - // Faut-il renvoyer un pointeur vide ??? - if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end()) - THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh", - SALOME::BAD_PARAM); - - int index = _mapIndToSeqElts[geomElement]; - - return _seq_elemId[index]._retn(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + if (mode != SALOME_MED::MED_NODAL) + THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM); + if (typeSwitch == SALOME_MED::MED_NO_INTERLACE) + THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM); + if (!_compte) + calculeNbElts(); + + // Faut-il renvoyer un pointeur vide ??? + if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh", + SALOME::BAD_PARAM); + + int index = _mapIndToSeqElts[geomElement]; + + return _seq_elemId[index]._retn(); } //============================================================================= @@ -535,12 +542,12 @@ SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch, //============================================================================= SALOME_MED::long_array * SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity) + SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -550,15 +557,15 @@ SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode, //============================================================================= CORBA::Long SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement type, - const SALOME_MED::long_array & connectivity) + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement type, + const SALOME_MED::long_array & connectivity) throw(SALOME::SALOME_Exception) { - const char *LOC = "getElementNumber "; - MESSAGE(LOC << "Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return -1; + const char *LOC = "getElementNumber "; + MESSAGE(LOC << "Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return -1; } //============================================================================= @@ -568,12 +575,12 @@ SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode, */ //============================================================================= SALOME_MED::long_array * - SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED:: - medConnectivity mode) throw(SALOME::SALOME_Exception) +SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED:: + medConnectivity mode) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -582,12 +589,12 @@ SALOME_MED::long_array * */ //============================================================================= SALOME_MED::long_array * - SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED:: - medConnectivity mode) throw(SALOME::SALOME_Exception) +SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED:: + medConnectivity mode) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -596,14 +603,14 @@ SALOME_MED::long_array * */ //============================================================================= CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED:: - medEntityMesh entity) throw(SALOME::SALOME_Exception) + medEntityMesh entity) throw(SALOME::SALOME_Exception) { - if (_creeFamily == false) - createFamilies(); - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - return _families.size(); + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + return _families.size(); } //============================================================================= @@ -612,13 +619,13 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED:: */ //============================================================================= CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity) -throw(SALOME::SALOME_Exception) + throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - MESSAGE(" Pas d implementation des groupes dans SMESH"); - return 0; + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + return 0; } //============================================================================= @@ -627,24 +634,24 @@ throw(SALOME::SALOME_Exception) */ //============================================================================= SALOME_MED::Family_array * - SMESH_MEDMesh_i::getFamilies(SALOME_MED:: - medEntityMesh entity) throw(SALOME::SALOME_Exception) +SMESH_MEDMesh_i::getFamilies(SALOME_MED:: + medEntityMesh entity) throw(SALOME::SALOME_Exception) { - if (_creeFamily == false) - createFamilies(); - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array; - int nbfam = _families.size(); - myseq->length(nbfam); - int i = 0; - vector < SALOME_MED::FAMILY_ptr >::iterator it; - for (it = _families.begin(); it != _families.end(); it++) - { - myseq[i++] = *it; - }; - return myseq._retn(); + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array; + int nbfam = _families.size(); + myseq->length(nbfam); + int i = 0; + vector < SALOME_MED::FAMILY_ptr >::iterator it; + for (it = _families.begin(); it != _families.end(); it++) + { + myseq[i++] = *it; + }; + return myseq._retn(); } //============================================================================= @@ -653,16 +660,16 @@ SALOME_MED::Family_array * */ //============================================================================= SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED:: - medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception) + medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception) { - if (_creeFamily == false) - createFamilies(); - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - - SCRUTE(_families[i]->getName()); - MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i]; + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + + SCRUTE(_families[i]->getName()); + MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i]; } //============================================================================= @@ -671,14 +678,14 @@ SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED:: */ //============================================================================= SALOME_MED::Group_array * - SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME:: - SALOME_Exception) +SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME:: + SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - MESSAGE(" Pas d implementation des groupes dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM); } //============================================================================= @@ -687,13 +694,13 @@ SALOME_MED::Group_array * */ //============================================================================= SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED:: - medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception) + medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - MESSAGE(" Pas d implementation des groupes dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM); } //============================================================================= /*! @@ -764,11 +771,11 @@ SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D) */ //============================================================================= SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED:: - SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -777,11 +784,11 @@ SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED:: */ //============================================================================= SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED:: - SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -790,11 +797,11 @@ SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED:: */ //============================================================================= SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED:: - SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -803,11 +810,11 @@ SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED:: */ //============================================================================= SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED:: - SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -816,11 +823,11 @@ SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED:: */ //============================================================================= SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED:: - SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -829,11 +836,11 @@ SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED:: */ //============================================================================= SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED:: - SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -843,57 +850,57 @@ SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED:: */ //============================================================================= void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy, - SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception) + SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception) { - BEGIN_OF("MED_Mesh_i::addInStudy"); - if (_meshId != "") - { - MESSAGE("Mesh already in Study"); - THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", - SALOME::BAD_PARAM); - }; - - /* - * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); - * - * // Create SComponent labelled 'MED' if it doesn't already exit - * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED"); - * if ( CORBA::is_nil(medfather) ) - * { - * MESSAGE("Add Component MED"); - * medfather = myBuilder->NewComponent("MED"); - * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED"); - * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( - * myBuilder->FindOrCreateAttribute(medfather, "AttributeName")); - * aName->SetValue("MED"); - * - * myBuilder->DefineComponentInstance(medfather,myIor); - * - * } ; - * - * MESSAGE("Add a mesh Object under MED"); - * myBuilder->NewCommand(); - * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather); - * - * ORB_INIT &init = *SINGLETON_::Instance() ; - * ASSERT(SINGLETON_::IsAlreadyExisting()) ; - * CORBA::ORB_var &orb = init(0,0); - * CORBA::String_var iorStr = orb->object_to_string(myIor); - * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in()); - * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow( - * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR")); - * aIOR->SetValue(iorStr.c_str()); - * - * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str()); - * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( - * myBuilder->FindOrCreateAttribute(newObj, "AttributeName")); - * aName->SetValue(_mesh_i->getName().c_str()); - * - * _meshId = newObj->GetID(); - * myBuilder->CommitCommand(); - * - */ - END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)"); + BEGIN_OF("MED_Mesh_i::addInStudy"); + if (_meshId != "") + { + MESSAGE("Mesh already in Study"); + THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", + SALOME::BAD_PARAM); + }; + + /* + * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); + * + * // Create SComponent labelled 'MED' if it doesn't already exit + * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED"); + * if ( CORBA::is_nil(medfather) ) + * { + * MESSAGE("Add Component MED"); + * medfather = myBuilder->NewComponent("MED"); + * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED"); + * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( + * myBuilder->FindOrCreateAttribute(medfather, "AttributeName")); + * aName->SetValue("MED"); + * + * myBuilder->DefineComponentInstance(medfather,myIor); + * + * } ; + * + * MESSAGE("Add a mesh Object under MED"); + * myBuilder->NewCommand(); + * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather); + * + * ORB_INIT &init = *SINGLETON_::Instance() ; + * ASSERT(SINGLETON_::IsAlreadyExisting()) ; + * CORBA::ORB_var &orb = init(0,0); + * CORBA::String_var iorStr = orb->object_to_string(myIor); + * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in()); + * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow( + * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR")); + * aIOR->SetValue(iorStr.c_str()); + * + * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str()); + * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( + * myBuilder->FindOrCreateAttribute(newObj, "AttributeName")); + * aName->SetValue(_mesh_i->getName().c_str()); + * + * _meshId = newObj->GetID(); + * myBuilder->CommitCommand(); + * + */ + END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)"); } //============================================================================= @@ -902,10 +909,10 @@ void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy, */ //============================================================================= void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName) -throw(SALOME::SALOME_Exception) + throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } //============================================================================= @@ -915,8 +922,8 @@ throw(SALOME::SALOME_Exception) //============================================================================= void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } //============================================================================= @@ -926,8 +933,8 @@ void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception) //============================================================================= void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } //============================================================================= @@ -936,11 +943,11 @@ void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception) */ //============================================================================= CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType, - const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception) + const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); - return 0; + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -950,174 +957,174 @@ CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType, //============================================================================= void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception) { - if (!_compte) - { - _compte = true; - - _mapNbTypes[SALOME_MED::MED_NODE] = 1; - // On compte les aretes MED_SEG2 ou MED_SEG3 - // On range les elements dans les vecteurs correspondants - - _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++; - _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++; - _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++; - - int trouveSeg2 = 0; - int trouveSeg3 = 0; - SALOME_MED::medGeometryElement medElement; - - SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator(); - while(itEdges->more()) - { - const SMDS_MeshEdge* elem = itEdges->next(); - int nb_of_nodes = elem->NbNodes(); - - switch (nb_of_nodes) - { - case 2: - { - medElement = SALOME_MED::MED_SEG2; - if (trouveSeg2 == 0) - { - trouveSeg2 = 1; - _TypesId[SALOME_MED::MED_EDGE]. - push_back(SALOME_MED::MED_SEG2); - } - break; - } - case 3: - { - medElement = SALOME_MED::MED_SEG3; - if (trouveSeg3 == 0) - { - trouveSeg3 = 1; - _TypesId[SALOME_MED::MED_EDGE]. - push_back(SALOME_MED::MED_SEG3); - } - break; - } - } - int index = _mapIndToSeqElts[medElement]; - SCRUTE(index); - // Traitement de l arete - - int longueur = _seq_elemId[index]->length(); - _seq_elemId[index]->length(longueur + nb_of_nodes); - - SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator(); - - for(int k=0; itn->more(); k++) - _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; - } - - _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3; - - // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6 - // On range les elements dans les vecteurs correspondants - int trouveTria3 = 0; - int trouveTria6 = 0; - int trouveQuad4 = 0; - - _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++; - _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++; - _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++; - _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++; - - SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator(); - while(itFaces->more()) - { - const SMDS_MeshFace * elem = itFaces->next(); - int nb_of_nodes = elem->NbNodes(); - - switch (nb_of_nodes) - { - case 3: - { - medElement = SALOME_MED::MED_TRIA3; - if (trouveTria3 == 0) - { - trouveTria3 = 1; - _TypesId[SALOME_MED::MED_FACE]. - push_back(SALOME_MED::MED_TRIA3); - } - break; - } - case 4: - { - medElement = SALOME_MED::MED_QUAD4; - if (trouveQuad4 == 0) - { - trouveQuad4 = 1; - _TypesId[SALOME_MED::MED_FACE]. - push_back(SALOME_MED::MED_QUAD4); - } - break; - } - case 6: - { - medElement = SALOME_MED::MED_TRIA6; - if (trouveTria6 == 0) - { - trouveTria6 = 1; - _TypesId[SALOME_MED::MED_FACE]. - push_back(SALOME_MED::MED_TRIA6); - } - break; - } - } - int index = _mapIndToSeqElts[medElement]; - SCRUTE(index); - - // Traitement de la face - // Attention La numérotation des noeuds Med commence a 1 - - int longueur = _seq_elemId[index]->length(); - _seq_elemId[index]->length(longueur + nb_of_nodes); - - SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator(); - - for(int k=0; itn->more(); k++) - _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; - } //itFaces - - _mapNbTypes[SALOME_MED::MED_FACE] = - trouveTria3 + trouveTria6 + trouveQuad4; - - _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++; - _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++; - int index = _mapIndToSeqElts[medElement]; - - int trouveHexa8 = 0; - - SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator(); - while(itVolumes->more()) - { - const SMDS_MeshVolume * elem = itVolumes->next(); - - int nb_of_nodes = elem->NbNodes(); - medElement = SALOME_MED::MED_HEXA8; - ASSERT(nb_of_nodes == 8); - - if (trouveHexa8 == 0) - { - trouveHexa8 = 1; - _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8); - }; - // Traitement de la maille - int longueur = _seq_elemId[index]->length(); - _seq_elemId[index]->length(longueur + nb_of_nodes); - - SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator(); - for(int k=0; itn->more(); k++) - _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; - } - - _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8; - _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES] - = - trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 + - trouveSeg3; - }// fin du _compte + if (!_compte) + { + _compte = true; + + _mapNbTypes[SALOME_MED::MED_NODE] = 1; + // On compte les aretes MED_SEG2 ou MED_SEG3 + // On range les elements dans les vecteurs correspondants + + _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++; + + int trouveSeg2 = 0; + int trouveSeg3 = 0; + SALOME_MED::medGeometryElement medElement; + + SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator(); + while(itEdges->more()) + { + const SMDS_MeshEdge* elem = itEdges->next(); + int nb_of_nodes = elem->NbNodes(); + + switch (nb_of_nodes) + { + case 2: + { + medElement = SALOME_MED::MED_SEG2; + if (trouveSeg2 == 0) + { + trouveSeg2 = 1; + _TypesId[SALOME_MED::MED_EDGE]. + push_back(SALOME_MED::MED_SEG2); + } + break; + } + case 3: + { + medElement = SALOME_MED::MED_SEG3; + if (trouveSeg3 == 0) + { + trouveSeg3 = 1; + _TypesId[SALOME_MED::MED_EDGE]. + push_back(SALOME_MED::MED_SEG3); + } + break; + } + } + int index = _mapIndToSeqElts[medElement]; + SCRUTE(index); + // Traitement de l arete + + int longueur = _seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur + nb_of_nodes); + + SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator(); + + for(int k=0; itn->more(); k++) + _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; + } + + _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3; + + // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6 + // On range les elements dans les vecteurs correspondants + int trouveTria3 = 0; + int trouveTria6 = 0; + int trouveQuad4 = 0; + + _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++; + + SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator(); + while(itFaces->more()) + { + const SMDS_MeshFace * elem = itFaces->next(); + int nb_of_nodes = elem->NbNodes(); + + switch (nb_of_nodes) + { + case 3: + { + medElement = SALOME_MED::MED_TRIA3; + if (trouveTria3 == 0) + { + trouveTria3 = 1; + _TypesId[SALOME_MED::MED_FACE]. + push_back(SALOME_MED::MED_TRIA3); + } + break; + } + case 4: + { + medElement = SALOME_MED::MED_QUAD4; + if (trouveQuad4 == 0) + { + trouveQuad4 = 1; + _TypesId[SALOME_MED::MED_FACE]. + push_back(SALOME_MED::MED_QUAD4); + } + break; + } + case 6: + { + medElement = SALOME_MED::MED_TRIA6; + if (trouveTria6 == 0) + { + trouveTria6 = 1; + _TypesId[SALOME_MED::MED_FACE]. + push_back(SALOME_MED::MED_TRIA6); + } + break; + } + } + int index = _mapIndToSeqElts[medElement]; + SCRUTE(index); + + // Traitement de la face + // Attention La numérotation des noeuds Med commence a 1 + + int longueur = _seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur + nb_of_nodes); + + SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator(); + + for(int k=0; itn->more(); k++) + _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; + } //itFaces + + _mapNbTypes[SALOME_MED::MED_FACE] = + trouveTria3 + trouveTria6 + trouveQuad4; + + _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++; + int index = _mapIndToSeqElts[medElement]; + + int trouveHexa8 = 0; + + SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator(); + while(itVolumes->more()) + { + const SMDS_MeshVolume * elem = itVolumes->next(); + + int nb_of_nodes = elem->NbNodes(); + medElement = SALOME_MED::MED_HEXA8; + ASSERT(nb_of_nodes == 8); + + if (trouveHexa8 == 0) + { + trouveHexa8 = 1; + _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8); + }; + // Traitement de la maille + int longueur = _seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur + nb_of_nodes); + + SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator(); + for(int k=0; itn->more(); k++) + _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; + } + + _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8; + _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES] + = + trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 + + trouveSeg3; + }// fin du _compte }; //============================================================================= @@ -1128,42 +1135,42 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception) void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); - string famDes = ("Je ne sais pas"); - string famName0 = "Famille_"; - string famName; - char numero[10]; - - if (_creeFamily == false) - { - _creeFamily = true; - //SMESH_subMesh_i *subMeshServant; - - map < int, SMESH_subMesh_i * >::iterator it; - for (it = _mesh_i->_mapSubMesh_i.begin(); - it != _mesh_i->_mapSubMesh_i.end(); it++) - { - SMESH_subMesh_i *submesh_i = (*it).second; - int famIdent = (*it).first; - - ASSERT(famIdent < 999999999); - sprintf(numero, "%d\n", famIdent); - famName = famName0 + numero; - - SMESH_MEDFamily_i *famservant = - new SMESH_MEDFamily_i(famIdent, submesh_i, - famName, famDes, SALOME_MED::MED_NODE); + string famDes = ("Je ne sais pas"); + string famName0 = "Famille_"; + string famName; + char numero[10]; + + if (_creeFamily == false) + { + _creeFamily = true; + //SMESH_subMesh_i *subMeshServant; + + map < int, SMESH_subMesh_i * >::iterator it; + for (it = _mesh_i->_mapSubMesh_i.begin(); + it != _mesh_i->_mapSubMesh_i.end(); it++) + { + SMESH_subMesh_i *submesh_i = (*it).second; + int famIdent = (*it).first; + + ASSERT(famIdent < 999999999); + sprintf(numero, "%d\n", famIdent); + famName = famName0 + numero; + + SMESH_MEDFamily_i *famservant = + new SMESH_MEDFamily_i(famIdent, submesh_i, + famName, famDes, SALOME_MED::MED_NODE); #ifdef WNT SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_nil(); POA_SALOME_MED::FAMILY* servantbase = dynamic_cast(famservant); if ( servantbase ) famille = SALOME_MED::FAMILY::_narrow( servantbase->_this() ); #else - SALOME_MED::FAMILY_ptr famille = + SALOME_MED::FAMILY_ptr famille = SALOME_MED::FAMILY::_narrow( famservant->POA_SALOME_MED::FAMILY::_this() ); #endif - _families.push_back(famille); - } - } + _families.push_back(famille); + } + } }; //============================================================================= /*! @@ -1216,7 +1223,7 @@ SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity) //============================================================================= SALOME_MED::medGeometryElement SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity, - CORBA::Long number) + CORBA::Long number) throw (SALOME::SALOME_Exception) { MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!"); diff --git a/src/SMESH_I/SMESH_MEDMesh_i.hxx b/src/SMESH_I/SMESH_MEDMesh_i.hxx index 8e56e0e79..72b31032e 100644 --- a/src/SMESH_I/SMESH_MEDMesh_i.hxx +++ b/src/SMESH_I/SMESH_MEDMesh_i.hxx @@ -82,9 +82,9 @@ public: void release() {} SALOME::SenderDouble_ptr getSenderForCoordinates(SALOME_MED::medModeSwitch) {return SALOME::SenderDouble::_nil();} SALOME::SenderInt_ptr getSenderForConnectivity(SALOME_MED::medModeSwitch, - SALOME_MED::medConnectivity, - SALOME_MED::medEntityMesh, - SALOME_MED::medGeometryElement) + SALOME_MED::medConnectivity, + SALOME_MED::medEntityMesh, + SALOME_MED::medGeometryElement) { return SALOME::SenderInt::_nil(); } @@ -103,7 +103,7 @@ public: CORBA::Boolean existConnectivity(SALOME_MED::medConnectivity connectivityType, - SALOME_MED::medEntityMesh entity) + SALOME_MED::medEntityMesh entity) throw (SALOME::SALOME_Exception); char *getCoordinatesSystem() throw(SALOME::SALOME_Exception); @@ -127,27 +127,27 @@ public: SALOME_MED::medGeometryElement_array * getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME:: - SALOME_Exception); + SALOME_Exception); SALOME_MED::medGeometryElement getElementType(SALOME_MED::medEntityMesh entity, - CORBA::Long number) + CORBA::Long number) throw (SALOME::SALOME_Exception); CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception); SALOME_MED::long_array * getConnectivity(SALOME_MED::medModeSwitch typeSwitch, - SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) + SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception); SALOME_MED::long_array * getConnectivityIndex(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity) + SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception); SALOME_MED::long_array* @@ -155,9 +155,9 @@ public: throw (SALOME::SALOME_Exception); CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement type, - const SALOME_MED::long_array & connectivity) + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement type, + const SALOME_MED::long_array & connectivity) throw(SALOME::SALOME_Exception); SALOME_MED::long_array * @@ -180,14 +180,14 @@ public: throw(SALOME::SALOME_Exception); SALOME_MED::FAMILY_ptr getFamily(SALOME_MED::medEntityMesh entity, - CORBA::Long i) + CORBA::Long i) throw(SALOME::SALOME_Exception); SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception); SALOME_MED::GROUP_ptr getGroup(SALOME_MED::medEntityMesh entity, - CORBA::Long i) + CORBA::Long i) throw(SALOME::SALOME_Exception); SALOME_MED::SUPPORT_ptr @@ -221,10 +221,10 @@ public: // Others void addInStudy(SALOMEDS::Study_ptr myStudy, - SALOME_MED::MESH_ptr myIor) + SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception); CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType, - const char *fileName, const char *meshName) + const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception); void rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception); void read(CORBA::Long i) throw(SALOME::SALOME_Exception); diff --git a/src/SMESH_I/SMESH_MEDSupport_i.cxx b/src/SMESH_I/SMESH_MEDSupport_i.cxx index 56f3b73eb..4b1e66ddf 100644 --- a/src/SMESH_I/SMESH_MEDSupport_i.cxx +++ b/src/SMESH_I/SMESH_MEDSupport_i.cxx @@ -45,8 +45,8 @@ using namespace std; //============================================================================= SMESH_MEDSupport_i::SMESH_MEDSupport_i() { - BEGIN_OF("Default Constructor SMESH_MEDSupport_i"); - END_OF("Default Constructor SMESH_MEDSupport_i"); + BEGIN_OF("Default Constructor SMESH_MEDSupport_i"); + END_OF("Default Constructor SMESH_MEDSupport_i"); } //============================================================================= @@ -55,40 +55,40 @@ SMESH_MEDSupport_i::SMESH_MEDSupport_i() */ //============================================================================= SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name, - string description, SALOME_MED::medEntityMesh entity) - :_subMesh_i(sm), _name(name), _description(description), _entity(entity), - _seqNumber(false), _seqLength(0) + string description, SALOME_MED::medEntityMesh entity) + :_subMesh_i(sm), _name(name), _description(description), _entity(entity), + _seqNumber(false), _seqLength(0) { - BEGIN_OF("Constructor SMESH_MEDSupport_i"); - - _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); - - int subMeshId = _subMesh_i->GetId(); - - MESSAGE(" subMeshId " << subMeshId) - - if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != - _subMesh_i->_mesh_i->_mapSubMesh.end()) - { - ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; - _subMeshDS = subMesh->GetSubMeshDS(); - } - - if (_entity == SALOME_MED::MED_NODE) - { - _numberOfGeometricType = 1; - _geometricType = new SALOME_MED::medGeometryElement[1]; - _geometricType[0] = SALOME_MED::MED_NONE; - } - else - { - MESSAGE("Pas implemente dans cette version"); - THROW_SALOME_CORBA_EXCEPTION - ("Seules les familles de noeuds sont implementees ", - SALOME::BAD_PARAM); - } - - END_OF("Constructor SMESH_MEDSupport_i"); + BEGIN_OF("Constructor SMESH_MEDSupport_i"); + + _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); + + int subMeshId = _subMesh_i->GetId(); + + MESSAGE(" subMeshId " << subMeshId) + + if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != + _subMesh_i->_mesh_i->_mapSubMesh.end()) + { + ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; + _subMeshDS = subMesh->GetSubMeshDS(); + } + + if (_entity == SALOME_MED::MED_NODE) + { + _numberOfGeometricType = 1; + _geometricType = new SALOME_MED::medGeometryElement[1]; + _geometricType[0] = SALOME_MED::MED_NONE; + } + else + { + MESSAGE("Pas implemente dans cette version"); + THROW_SALOME_CORBA_EXCEPTION + ("Seules les familles de noeuds sont implementees ", + SALOME::BAD_PARAM); + } + + END_OF("Constructor SMESH_MEDSupport_i"); } //============================================================================= @@ -101,19 +101,19 @@ SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh_i(s._subMesh_i), _name(s._name), _description(s._description), _entity(s._entity), _seqNumber(false), _seqLength(0) { - BEGIN_OF("Constructor SMESH_MEDSupport_i"); + BEGIN_OF("Constructor SMESH_MEDSupport_i"); - _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); + _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); - int subMeshId = _subMesh_i->GetId(); - if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != - _subMesh_i->_mesh_i->_mapSubMesh.end()) - { - ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; - _subMeshDS = subMesh->GetSubMeshDS(); - } + int subMeshId = _subMesh_i->GetId(); + if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != + _subMesh_i->_mesh_i->_mapSubMesh.end()) + { + ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; + _subMeshDS = subMesh->GetSubMeshDS(); + } - END_OF("Constructor SMESH_MEDSupport_i"); + END_OF("Constructor SMESH_MEDSupport_i"); } //============================================================================= @@ -134,11 +134,11 @@ SMESH_MEDSupport_i::~SMESH_MEDSupport_i() CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception) { - if (_subMeshDS == NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); - MESSAGE("Not implemented for SMESH_i"); - THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM); + if (_subMeshDS == NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + MESSAGE("Not implemented for SMESH_i"); + THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM); } @@ -150,10 +150,10 @@ CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception) char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); - return CORBA::string_dup(_name.c_str()); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return CORBA::string_dup(_name.c_str()); } @@ -165,10 +165,10 @@ char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception) char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); - return CORBA::string_dup(_description.c_str()); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return CORBA::string_dup(_description.c_str()); } //============================================================================= @@ -178,13 +178,13 @@ char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception) //============================================================================= SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME:: - SALOME_Exception) + SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); - return _subMesh_i->_mesh_i->GetMEDMesh(); + return _subMesh_i->_mesh_i->GetMEDMesh(); } //============================================================================= @@ -194,36 +194,36 @@ SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME:: //============================================================================= CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME:: - SALOME_Exception) + SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); - if (_seqNumber == false) - { - if (_entity != SALOME_MED::MED_NONE) - { - _seqLength = _subMeshDS->NbNodes(); - _seqNumber = true; - } - else - { - MESSAGE("Only Node Families are implemented "); - THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ", - SALOME::BAD_PARAM); - } - } - try - { - _isOnAllElements = (_seqLength == _meshDS->NbNodes()); - } - catch(...) - { - MESSAGE("unable to acces related Mesh"); - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", - SALOME::INTERNAL_ERROR); - }; - return _isOnAllElements; + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + if (_seqNumber == false) + { + if (_entity != SALOME_MED::MED_NONE) + { + _seqLength = _subMeshDS->NbNodes(); + _seqNumber = true; + } + else + { + MESSAGE("Only Node Families are implemented "); + THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ", + SALOME::BAD_PARAM); + } + } + try + { + _isOnAllElements = (_seqLength == _meshDS->NbNodes()); + } + catch(...) + { + MESSAGE("unable to acces related Mesh"); + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + }; + return _isOnAllElements; } //============================================================================= @@ -233,12 +233,12 @@ CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME:: //============================================================================= SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME:: - SALOME_Exception) + SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); - return _entity; + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return _entity; } //============================================================================= @@ -248,29 +248,29 @@ SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME:: //============================================================================= SALOME_MED::medGeometryElement_array * - SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception) + SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); - SALOME_MED::medGeometryElement_array_var myseq = - new SALOME_MED::medGeometryElement_array; - try - { - int mySeqLength = _numberOfGeometricType; - myseq->length(mySeqLength); - for (int i = 0; i < mySeqLength; i++) - { - myseq[i] = _geometricType[i]; - } - } - catch(...) - { - MESSAGE("Exception lors de la recherche des differents types"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types", - SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + SALOME_MED::medGeometryElement_array_var myseq = + new SALOME_MED::medGeometryElement_array; + try + { + int mySeqLength = _numberOfGeometricType; + myseq->length(mySeqLength); + for (int i = 0; i < mySeqLength; i++) + { + myseq[i] = _geometricType[i]; + } + } + catch(...) + { + MESSAGE("Exception lors de la recherche des differents types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } //============================================================================= @@ -280,12 +280,12 @@ SALOME_MED::medGeometryElement_array * */ //============================================================================= CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED:: - medGeometryElement geomElement) throw(SALOME::SALOME_Exception) + medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); - return _numberOfGeometricType; + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return _numberOfGeometricType; } @@ -296,32 +296,32 @@ CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED:: //============================================================================= SALOME_MED::long_array * SMESH_MEDSupport_i::getNumber( - SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", - SALOME::INTERNAL_ERROR); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); - // A changer s'il ne s agit plus seulement de famille de noeuds - if (geomElement != SALOME_MED::MED_NONE) - THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM); + // A changer s'il ne s agit plus seulement de famille de noeuds + if (geomElement != SALOME_MED::MED_NONE) + THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM); - SALOME_MED::long_array_var myseq = new SALOME_MED::long_array; + SALOME_MED::long_array_var myseq = new SALOME_MED::long_array; - int i = 0; - myseq->length(_subMeshDS->NbNodes()); + int i = 0; + myseq->length(_subMeshDS->NbNodes()); - SMDS_NodeIteratorPtr it = _subMeshDS->GetNodes(); - while(it->more()) - { - myseq[i] = it->next()->GetID(); - i++; - }; + SMDS_NodeIteratorPtr it = _subMeshDS->GetNodes(); + while(it->more()) + { + myseq[i] = it->next()->GetID(); + i++; + }; - SCRUTE(myseq->length()); - MESSAGE("End of SMESH_MEDSupport_i::getNumber"); - return myseq._retn(); + SCRUTE(myseq->length()); + MESSAGE("End of SMESH_MEDSupport_i::getNumber"); + return myseq._retn(); } @@ -332,7 +332,7 @@ SALOME_MED::long_array * SMESH_MEDSupport_i::getNumber( //============================================================================= SALOME_MED::long_array * SMESH_MEDSupport_i::getNumberFromFile( - SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { return getNumber(geomElement); } @@ -345,11 +345,11 @@ SALOME_MED::long_array * SMESH_MEDSupport_i::getNumberFromFile( //============================================================================= SALOME_MED::long_array * - SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception) + SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception) { - MESSAGE("Not implemented for SMESH_i"); - THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM); - return NULL; + MESSAGE("Not implemented for SMESH_i"); + THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM); + return NULL; } //============================================================================= /*! @@ -358,10 +358,10 @@ SALOME_MED::long_array * //============================================================================= CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoint(SALOME_MED:: - medGeometryElement geomElement) throw(SALOME::SALOME_Exception) + medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - MESSAGE("Not implemented for SMESH_i"); - return 0; + MESSAGE("Not implemented for SMESH_i"); + return 0; } //============================================================================= /*! diff --git a/src/SMESH_I/SMESH_MEDSupport_i.hxx b/src/SMESH_I/SMESH_MEDSupport_i.hxx index 15cf3b8f4..56c36a881 100644 --- a/src/SMESH_I/SMESH_MEDSupport_i.hxx +++ b/src/SMESH_I/SMESH_MEDSupport_i.hxx @@ -42,78 +42,78 @@ class SMESH_subMesh_i; class SMESH_I_EXPORT SMESH_MEDSupport_i: - public virtual POA_SALOME_MED::SUPPORT, public virtual SALOME::GenericObj_i + public virtual POA_SALOME_MED::SUPPORT, public virtual SALOME::GenericObj_i { public: // Constructors and associated internal methods - SMESH_MEDSupport_i(SMESH_subMesh_i * sm, - std::string name, std::string description, SALOME_MED::medEntityMesh entity); - SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s); + SMESH_MEDSupport_i(SMESH_subMesh_i * sm, + std::string name, std::string description, SALOME_MED::medEntityMesh entity); + SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s); // IDL Methods - char *getName() throw(SALOME::SALOME_Exception); - char *getDescription() throw(SALOME::SALOME_Exception); - SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception); - CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception); - SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception); + char *getName() throw(SALOME::SALOME_Exception); + char *getDescription() throw(SALOME::SALOME_Exception); + SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception); + CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception); + SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception); CORBA::Long - getNumberOfElements(SALOME_MED::medGeometryElement geomElement) - throw(SALOME::SALOME_Exception); + getNumberOfElements(SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); CORBA::Long getNumberOfTypes() throw (SALOME::SALOME_Exception); - SALOME_MED::long_array * - getNumber(SALOME_MED::medGeometryElement geomElement) - throw(SALOME::SALOME_Exception); + SALOME_MED::long_array * + getNumber(SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); /*! * Same function as getNumber. */ - SALOME_MED::long_array * - getNumberFromFile(SALOME_MED::medGeometryElement geomElement) - throw(SALOME::SALOME_Exception); + SALOME_MED::long_array * + getNumberFromFile(SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); - SALOME_MED::long_array * getNumberIndex() - throw(SALOME::SALOME_Exception); + SALOME_MED::long_array * getNumberIndex() + throw(SALOME::SALOME_Exception); CORBA::Long - getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement) - throw(SALOME::SALOME_Exception); + getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); SALOME_MED::long_array* getNumbersOfGaussPoint() - throw (SALOME::SALOME_Exception); + throw (SALOME::SALOME_Exception); - SALOME_MED::medGeometryElement_array *getTypes() - throw(SALOME::SALOME_Exception); + SALOME_MED::medGeometryElement_array *getTypes() + throw(SALOME::SALOME_Exception); void getBoundaryElements() throw (SALOME::SALOME_Exception); - CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception); + CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception); SALOME_MED::SUPPORT::supportInfos * getSupportGlobal() - throw (SALOME::SALOME_Exception); + throw (SALOME::SALOME_Exception); - void createSeq() throw(SALOME::SALOME_Exception); + void createSeq() throw(SALOME::SALOME_Exception); public: //public field - const SMESHDS_SubMesh * _subMeshDS; - ::SMESH_subMesh_i * _subMesh_i; + const SMESHDS_SubMesh * _subMeshDS; + ::SMESH_subMesh_i * _subMesh_i; - SMESHDS_Mesh * _meshDS; - std::string _name; + SMESHDS_Mesh * _meshDS; + std::string _name; std::string _description; - bool _isOnAllElements; - bool _seqNumber; - int _seqLength; + bool _isOnAllElements; + bool _seqNumber; + int _seqLength; - SALOME_MED::medEntityMesh _entity; - SALOME_MED::medGeometryElement * _geometricType; - int _numberOfGeometricType; + SALOME_MED::medEntityMesh _entity; + SALOME_MED::medGeometryElement * _geometricType; + int _numberOfGeometricType; protected: - SMESH_MEDSupport_i(); - ~SMESH_MEDSupport_i(); + SMESH_MEDSupport_i(); + ~SMESH_MEDSupport_i(); }; #endif /* _MED_MEDSUPPORT_I_HXX_ */ diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index f4e1d4420..000bc95e8 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -2568,6 +2568,7 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object, << ( HasRefPoint ? RefPoint.x : 0 ) << ", " << ( HasRefPoint ? RefPoint.y : 0 ) << ", " << ( HasRefPoint ? RefPoint.z : 0 ) << " ), " + << MakeGroups << ", " << ElemType << " )"; } return aGroups; @@ -4213,6 +4214,142 @@ void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump & theDumpPytho } } +//================================================================================ +/*! + \brief Creates a hole in a mesh by doubling the nodes of some particular elements + \param theNodes - identifiers of nodes to be doubled + \param theModifiedElems - identifiers of elements to be updated by the new (doubled) + nodes. If list of element identifiers is empty then nodes are doubled but + they not assigned to elements + \return TRUE if operation has been completed successfully, FALSE otherwise + \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups() +*/ +//================================================================================ + +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theNodes, + const SMESH::long_array& theModifiedElems ) +{ + initData(); + + ::SMESH_MeshEditor aMeshEditor( myMesh ); + list< int > aListOfNodes; + int i, n; + for ( i = 0, n = theNodes.length(); i < n; i++ ) + aListOfNodes.push_back( theNodes[ i ] ); + + list< int > aListOfElems; + for ( i = 0, n = theModifiedElems.length(); i < n; i++ ) + aListOfElems.push_back( theModifiedElems[ i ] ); + + bool aResult = aMeshEditor.DoubleNodes( aListOfNodes, aListOfElems ); + + storeResult( aMeshEditor) ; + + return aResult; +} + +//================================================================================ +/*! + \brief Creates a hole in a mesh by doubling the nodes of some particular elements + This method provided for convenience works as DoubleNodes() described above. + \param theNodeId - identifier of node to be doubled. + \param theModifiedElems - identifiers of elements to be updated. + \return TRUE if operation has been completed successfully, FALSE otherwise + \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups() +*/ +//================================================================================ + +CORBA::Boolean SMESH_MeshEditor_i::DoubleNode( CORBA::Long theNodeId, + const SMESH::long_array& theModifiedElems ) +{ + SMESH::long_array_var aNodes = new SMESH::long_array; + aNodes->length( 1 ); + aNodes[ 0 ] = theNodeId; + return DoubleNodes( aNodes, theModifiedElems ); +} + +//================================================================================ +/*! + \brief Creates a hole in a mesh by doubling the nodes of some particular elements + This method provided for convenience works as DoubleNodes() described above. + \param theNodes - group of nodes to be doubled. + \param theModifiedElems - group of elements to be updated. + \return TRUE if operation has been completed successfully, FALSE otherwise + \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups() +*/ +//================================================================================ + +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( + SMESH::SMESH_GroupBase_ptr theNodes, + SMESH::SMESH_GroupBase_ptr theModifiedElems ) +{ + if ( CORBA::is_nil( theNodes ) && theNodes->GetType() != SMESH::NODE ) + return false; + + SMESH::long_array_var aNodes = theNodes->GetListOfID(); + SMESH::long_array_var aModifiedElems; + if ( !CORBA::is_nil( theModifiedElems ) ) + aModifiedElems = theModifiedElems->GetListOfID(); + else + { + aModifiedElems = new SMESH::long_array; + aModifiedElems->length( 0 ); + } + + return DoubleNodes( aNodes, aModifiedElems ); +} + +//================================================================================ +/*! + \brief Creates a hole in a mesh by doubling the nodes of some particular elements + This method provided for convenience works as DoubleNodes() described above. + \param theNodes - list of groups of nodes to be doubled + \param theModifiedElems - list of groups of elements to be updated. + \return TRUE if operation has been completed successfully, FALSE otherwise + \sa DoubleNode(), DoubleNodeGroup(), DoubleNodes() +*/ +//================================================================================ + +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups( + const SMESH::ListOfGroups& theNodes, + const SMESH::ListOfGroups& theModifiedElems ) +{ + initData(); + + ::SMESH_MeshEditor aMeshEditor( myMesh ); + + std::list< int > aNodes; + int i, n, j, m; + for ( i = 0, n = theNodes.length(); i < n; i++ ) + { + SMESH::SMESH_GroupBase_var aGrp = theNodes[ i ]; + if ( !CORBA::is_nil( aGrp ) && aGrp->GetType() == SMESH::NODE ) + { + SMESH::long_array_var aCurr = aGrp->GetListOfID(); + for ( j = 0, m = aCurr->length(); j < m; j++ ) + aNodes.push_back( aCurr[ j ] ); + } + } + + std::list< int > anElems; + for ( i = 0, n = theModifiedElems.length(); i < n; i++ ) + { + SMESH::SMESH_GroupBase_var aGrp = theModifiedElems[ i ]; + if ( !CORBA::is_nil( aGrp ) && aGrp->GetType() != SMESH::NODE ) + { + SMESH::long_array_var aCurr = aGrp->GetListOfID(); + for ( j = 0, m = aCurr->length(); j < m; j++ ) + anElems.push_back( aCurr[ j ] ); + } + } + + bool aResult = aMeshEditor.DoubleNodes( aNodes, anElems ); + + storeResult( aMeshEditor) ; + + return aResult; +} + //================================================================================ /*! \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -4226,9 +4363,9 @@ void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump & theDumpPytho */ //================================================================================ -CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElems, - const SMESH::long_array& theNodesNot, - const SMESH::long_array& theAffectedElems ) +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElem( const SMESH::long_array& theElems, + const SMESH::long_array& theNodesNot, + const SMESH::long_array& theAffectedElems ) { initData(); @@ -4265,7 +4402,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElem */ //================================================================================ -CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesInRegion +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemInRegion ( const SMESH::long_array& theElems, const SMESH::long_array& theNodesNot, GEOM::GEOM_Object_ptr theShape ) @@ -4315,10 +4452,10 @@ static void groupToSet(SMESH::SMESH_GroupBase_ptr theGrp, arrayToSet( anIDs, theMeshDS, theElemSet, theType); } -CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( - SMESH::SMESH_GroupBase_ptr theElems, - SMESH::SMESH_GroupBase_ptr theNodesNot, - SMESH::SMESH_GroupBase_ptr theAffectedElems ) +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroup( + SMESH::SMESH_GroupBase_ptr theElems, + SMESH::SMESH_GroupBase_ptr theNodesNot, + SMESH::SMESH_GroupBase_ptr theAffectedElems ) { if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE ) @@ -4357,10 +4494,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( */ //================================================================================ -CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupInRegion( - SMESH::SMESH_GroupBase_ptr theElems, - SMESH::SMESH_GroupBase_ptr theNodesNot, - GEOM::GEOM_Object_ptr theShape ) +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupInRegion( + SMESH::SMESH_GroupBase_ptr theElems, + SMESH::SMESH_GroupBase_ptr theNodesNot, + GEOM::GEOM_Object_ptr theShape ) { if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE ) @@ -4416,10 +4553,10 @@ static void listOfGroupToSet(const SMESH::ListOfGroups& theGrpList, } } -CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups( - const SMESH::ListOfGroups& theElems, - const SMESH::ListOfGroups& theNodesNot, - const SMESH::ListOfGroups& theAffectedElems ) +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroups( + const SMESH::ListOfGroups& theElems, + const SMESH::ListOfGroups& theNodesNot, + const SMESH::ListOfGroups& theAffectedElems ) { initData(); @@ -4455,10 +4592,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups( */ //================================================================================ -CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupsInRegion( - const SMESH::ListOfGroups& theElems, - const SMESH::ListOfGroups& theNodesNot, - GEOM::GEOM_Object_ptr theShape ) +CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupsInRegion( + const SMESH::ListOfGroups& theElems, + const SMESH::ListOfGroups& theNodesNot, + GEOM::GEOM_Object_ptr theShape ) { initData(); diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index ecdbcd71e..5c4dd85ca 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -514,6 +514,17 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor */ int GetMeshId() const { return myMesh->GetId(); } + CORBA::Boolean DoubleNodes( const SMESH::long_array& theNodes, + const SMESH::long_array& theModifiedElems ); + + CORBA::Boolean DoubleNode( CORBA::Long theNodeId, + const SMESH::long_array& theModifiedElems ); + + CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theNodes, + SMESH::SMESH_GroupBase_ptr theModifiedElems ); + + CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes, + const SMESH::ListOfGroups& theModifiedElems); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -525,9 +536,9 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroup(), DoubleNodeGroups() */ - CORBA::Boolean DoubleNodes( const SMESH::long_array& theElems, - const SMESH::long_array& theNodesNot, - const SMESH::long_array& theAffectedElems ); + CORBA::Boolean DoubleNodeElem( const SMESH::long_array& theElems, + const SMESH::long_array& theNodesNot, + const SMESH::long_array& theAffectedElems ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -540,9 +551,9 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion() */ - CORBA::Boolean DoubleNodesInRegion( const SMESH::long_array& theElems, - const SMESH::long_array& theNodesNot, - GEOM::GEOM_Object_ptr theShape ); + CORBA::Boolean DoubleNodeElemInRegion( const SMESH::long_array& theElems, + const SMESH::long_array& theNodesNot, + GEOM::GEOM_Object_ptr theShape ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -553,10 +564,10 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodes(), DoubleNodeGroups() */ - CORBA::Boolean DoubleNodeGroup( SMESH::SMESH_GroupBase_ptr theElems, - SMESH::SMESH_GroupBase_ptr theNodesNot, - SMESH::SMESH_GroupBase_ptr theAffectedElems ); - + CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems, + SMESH::SMESH_GroupBase_ptr theNodesNot, + SMESH::SMESH_GroupBase_ptr theAffectedElems ); + /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements * \param theElems - group of of elements (edges or faces) to be replicated @@ -567,9 +578,9 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion() */ - CORBA::Boolean DoubleNodeGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems, - SMESH::SMESH_GroupBase_ptr theNodesNot, - GEOM::GEOM_Object_ptr theShape ); + CORBA::Boolean DoubleNodeElemGroupInRegion( SMESH::SMESH_GroupBase_ptr theElems, + SMESH::SMESH_GroupBase_ptr theNodesNot, + GEOM::GEOM_Object_ptr theShape ); /*! * \brief Creates a hole in a mesh by doubling the nodes of some particular elements @@ -581,9 +592,9 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroup(), DoubleNodes() */ - CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theElems, - const SMESH::ListOfGroups& theNodesNot, - const SMESH::ListOfGroups& theAffectedElems ); + CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems, + const SMESH::ListOfGroups& theNodesNot, + const SMESH::ListOfGroups& theAffectedElems ); /*! @@ -597,9 +608,9 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor * \return TRUE if operation has been completed successfully, FALSE otherwise * \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion() */ - CORBA::Boolean DoubleNodeGroupsInRegion( const SMESH::ListOfGroups& theElems, - const SMESH::ListOfGroups& theNodesNot, - GEOM::GEOM_Object_ptr theShape ); + CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems, + const SMESH::ListOfGroups& theNodesNot, + GEOM::GEOM_Object_ptr theShape ); /*! * \brief Generated skin mesh (containing 2D cells) from 3D mesh diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 164b27407..bc0369dcc 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -522,41 +522,40 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aS */ //============================================================================= -SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject, - SMESH::SMESH_Hypothesis_ptr anHyp) +SMESH_Hypothesis::Hypothesis_Status +SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject, + SMESH::SMESH_Hypothesis_ptr anHyp) { - if(MYDEBUG) MESSAGE("removeHypothesis()"); - // **** proposer liste de subShape (selection multiple) + if(MYDEBUG) MESSAGE("removeHypothesis()"); + // **** proposer liste de subShape (selection multiple) - if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh()) - THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", - SALOME::BAD_PARAM); + if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh()) + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM); - SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); - if (CORBA::is_nil(myHyp)) - THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", - SALOME::BAD_PARAM); + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); + if (CORBA::is_nil(myHyp)) + THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", SALOME::BAD_PARAM); - SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK; - try - { - TopoDS_Shape myLocSubShape; - //use PseudoShape in case if mesh has no shape - if(HasShapeToMesh()) - myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject); - else - myLocSubShape = _impl->GetShapeToMesh(); - - int hypId = myHyp->GetId(); - status = _impl->RemoveHypothesis(myLocSubShape, hypId); - if ( !SMESH_Hypothesis::IsStatusFatal(status) ) - _mapHypo.erase( hypId ); - } - catch(SALOME_Exception & S_ex) - { - THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); - } - return status; + SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK; + try + { + TopoDS_Shape myLocSubShape; + //use PseudoShape in case if mesh has no shape + if(HasShapeToMesh()) + myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject); + else + myLocSubShape = _impl->GetShapeToMesh(); + + int hypId = myHyp->GetId(); + status = _impl->RemoveHypothesis(myLocSubShape, hypId); +// if ( !SMESH_Hypothesis::IsStatusFatal(status) ) EAP: hyp can be used on many subshapes +// _mapHypo.erase( hypId ); + } + catch(SALOME_Exception & S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + return status; } //============================================================================= @@ -572,8 +571,7 @@ throw(SALOME::SALOME_Exception) Unexpect aCatch(SALOME_SalomeException); if (MYDEBUG) MESSAGE("GetHypothesisList"); if (_impl->HasShapeToMesh() && CORBA::is_nil(aSubShapeObject)) - THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", - SALOME::BAD_PARAM); + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", SALOME::BAD_PARAM); SMESH::ListOfHypothesis_var aList = new SMESH::ListOfHypothesis(); @@ -669,6 +667,9 @@ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh ) if ( anSO->FindSubObject( aTag, anObj ) && anObj->ReferencedObject( aRef ) ) aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() ); +// if ( aSubShapeObject->_is_nil() ) // not published shape (IPAL13617) +// aSubShapeObject = theSubMesh->GetSubShape(); + aStudy->NewBuilder()->RemoveObjectWithChildren( anSO ); // Update Python script @@ -1976,20 +1977,37 @@ void SMESH_Mesh_i::removeSubMesh (SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Object_ptr theSubShapeObject ) { MESSAGE("SMESH_Mesh_i::removeSubMesh()"); - if ( theSubMesh->_is_nil() || theSubShapeObject->_is_nil() ) + if ( theSubMesh->_is_nil() /*|| theSubShapeObject->_is_nil()*/ ) return; - try { - SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject ); - for ( int i = 0, n = aHypList->length(); i < n; i++ ) { - removeHypothesis( theSubShapeObject, aHypList[i] ); + if ( theSubShapeObject->_is_nil() ) // not published shape (IPAL13617) + { + CORBA::Long shapeId = theSubMesh->GetId(); + if ( _mapSubMesh.find( shapeId ) != _mapSubMesh.end()) + { + TopoDS_Shape S = _mapSubMesh[ shapeId ]->GetSubShape(); + if ( !S.IsNull() ) + { + list hyps = _impl->GetHypothesisList( S ); + list::const_iterator hyp = hyps.begin(); + for ( ; hyp != hyps.end(); ++hyp ) + _impl->RemoveHypothesis(S, (*hyp)->GetID()); + } } } - catch( const SALOME::SALOME_Exception& ) { - INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!"); + else + { + try { + SMESH::ListOfHypothesis_var aHypList = GetHypothesisList( theSubShapeObject ); + for ( int i = 0, n = aHypList->length(); i < n; i++ ) { + removeHypothesis( theSubShapeObject, aHypList[i] ); + } + } + catch( const SALOME::SALOME_Exception& ) { + INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!"); + } + removeGeomGroupData( theSubShapeObject ); } - removeGeomGroupData( theSubShapeObject ); - int subMeshId = theSubMesh->GetId(); _mapSubMesh.erase(subMeshId); @@ -2127,7 +2145,7 @@ throw(SALOME::SALOME_Exception) void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception) { if(MYDEBUG) MESSAGE("SMESH_Mesh_i::ClearLog"); - // **** + _impl->ClearLog(); } //============================================================================= diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index bd7268049..2345a4279 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -239,19 +239,19 @@ void SMESH_NoteBook::ReplaceVariables() TMeshEditorMap::const_iterator meIt = myMeshEditors.find(aObject); if(meIt != myMeshEditors.end()) { TCollection_AsciiString aMesh = (*meIt).second; - it = _objectMap.find(aMesh); + it = _objectMap.find(aMesh); } } if(it == _objectMap.end()) { // additional check for pattern mapping if(aMethod.IsEqual("ApplyToMeshFaces") || - aMethod.IsEqual("ApplyToHexahedrons")) - it = _objectMap.find(aCmd->GetArg(1)); + aMethod.IsEqual("ApplyToHexahedrons")) + it = _objectMap.find(aCmd->GetArg(1)); } if(it != _objectMap.end()) { if(MYDEBUG) - cout << "Found object : " << (*it).first << endl; + cout << "Found object : " << (*it).first << endl; ObjectStates *aStates = (*it).second; // Case for LocalLength hypothesis if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) { @@ -402,9 +402,9 @@ void SMESH_NoteBook::ReplaceVariables() } else if(aStates->GetObjectType().IsEqual("Mesh")) { - TState aCurrentState = aStates->GetCurrectState(); + TState aCurrentState = aStates->GetCurrectState(); int aCurrentStateSize = aCurrentState.size(); - if(aMethod.IsEqual("Translate") || + if(aMethod.IsEqual("Translate") || aMethod.IsEqual("TranslateMakeGroups") || aMethod.IsEqual("TranslateMakeMesh") || aMethod.IsEqual("TranslateObject") || @@ -419,211 +419,211 @@ void SMESH_NoteBook::ReplaceVariables() } } if(anArgIndex > 0) { - if(aCurrentStateSize == 3) { // translation by dx, dy, dz - for(int j = 0; j < aCurrentStateSize; j++) { - if(!aCurrentState.at(j).IsEmpty()) { - isVariableFound = true; - aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); - } - } - } - else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2 - // TODO: limitation until operations on the variables will be introduced - /* - isVariableFound = true; - for(int j = 0; j < 3; j++) { - TCollection_AsciiString anArg = aCmd->GetArg(anArgIndex+j); - TCollection_AsciiString aValue1 = aCurrentState.at(2*j), aValue2 = aCurrentState.at(2*j+1); - bool aV1 = !aValue1.IsEmpty(); - bool aV2 = !aValue2.IsEmpty(); - double aValue, aCurrentValue = anArg.IsRealValue() ? anArg.RealValue() : 0; - if(aV1 && !aV2) { - if(!GetReal(aValue1, aValue)) - aValue = 0; - aValue2 = TCollection_AsciiString( aValue + aCurrentValue ); - } - else if(!aV1 && aV2) { - if(!GetReal(aValue2, aValue)) - aValue = 0; - aValue1 = TCollection_AsciiString( aValue - aCurrentValue ); - } - else if(!aV1 && !aV2) { - aValue1 = TCollection_AsciiString( 0 ); - aValue2 = TCollection_AsciiString( aCurrentValue ); - } - aCmd->SetArg(anArgIndex+j, aValue1 + ", " + aValue2 ); - } - */ - } + if(aCurrentStateSize == 3) { // translation by dx, dy, dz + for(int j = 0; j < aCurrentStateSize; j++) { + if(!aCurrentState.at(j).IsEmpty()) { + isVariableFound = true; + aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); + } + } + } + else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2 + // TODO: limitation until operations on the variables will be introduced + /* + isVariableFound = true; + for(int j = 0; j < 3; j++) { + TCollection_AsciiString anArg = aCmd->GetArg(anArgIndex+j); + TCollection_AsciiString aValue1 = aCurrentState.at(2*j), aValue2 = aCurrentState.at(2*j+1); + bool aV1 = !aValue1.IsEmpty(); + bool aV2 = !aValue2.IsEmpty(); + double aValue, aCurrentValue = anArg.IsRealValue() ? anArg.RealValue() : 0; + if(aV1 && !aV2) { + if(!GetReal(aValue1, aValue)) + aValue = 0; + aValue2 = TCollection_AsciiString( aValue + aCurrentValue ); + } + else if(!aV1 && aV2) { + if(!GetReal(aValue2, aValue)) + aValue = 0; + aValue1 = TCollection_AsciiString( aValue - aCurrentValue ); + } + else if(!aV1 && !aV2) { + aValue1 = TCollection_AsciiString( 0 ); + aValue2 = TCollection_AsciiString( aCurrentValue ); + } + aCmd->SetArg(anArgIndex+j, aValue1 + ", " + aValue2 ); + } + */ + } } if(isVariableFound) { TCollection_AsciiString aDim; - if(aCurrentStateSize == 6) - aDim = "6"; + if(aCurrentStateSize == 6) + aDim = "6"; aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr"+aDim); aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr"); } aStates->IncrementState(); } - else if(aMethod.IsEqual("Rotate") || - aMethod.IsEqual("RotateMakeGroups") || - aMethod.IsEqual("RotateMakeMesh") || + else if(aMethod.IsEqual("Rotate") || + aMethod.IsEqual("RotateMakeGroups") || + aMethod.IsEqual("RotateMakeMesh") || aMethod.IsEqual("RotateObject") || aMethod.IsEqual("RotateObjectMakeGroups") || aMethod.IsEqual("RotateObjectMakeMesh") || - aMethod.IsEqual("RotationSweep") || - aMethod.IsEqual("RotationSweepObject") || - aMethod.IsEqual("RotationSweepObject1D") || - aMethod.IsEqual("RotationSweepObject2D") || - aMethod.IsEqual("RotationSweepMakeGroups") || - aMethod.IsEqual("RotationSweepObjectMakeGroups") || - aMethod.IsEqual("RotationSweepObject1DMakeGroups") || - aMethod.IsEqual("RotationSweepObject2DMakeGroups") || - aMethod.IsEqual("Mirror") || - aMethod.IsEqual("MirrorMakeMesh") || + aMethod.IsEqual("RotationSweep") || + aMethod.IsEqual("RotationSweepObject") || + aMethod.IsEqual("RotationSweepObject1D") || + aMethod.IsEqual("RotationSweepObject2D") || + aMethod.IsEqual("RotationSweepMakeGroups") || + aMethod.IsEqual("RotationSweepObjectMakeGroups") || + aMethod.IsEqual("RotationSweepObject1DMakeGroups") || + aMethod.IsEqual("RotationSweepObject2DMakeGroups") || + aMethod.IsEqual("Mirror") || + aMethod.IsEqual("MirrorMakeMesh") || aMethod.IsEqual("MirrorMakeGroups") || aMethod.IsEqual("MirrorObject") || aMethod.IsEqual("MirrorObjectMakeMesh") || aMethod.IsEqual("MirrorObjectMakeGroups")) { - bool isSubstitute = false; - int anArgIndex = 0; - for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) { - if(aCmd->GetArg(i).IsEqual("SMESH.AxisStruct")) { - anArgIndex = i+1; - break; - } - } - if(anArgIndex > 0) { - for(int j = 0; j < aCurrentStateSize; j++) { - if(!aCurrentState.at(j).IsEmpty()) { - if(j < 6) // 0-5 - axis struct, 6 - angle (rotation & sweep), 7-8 - nbSteps and tolerance (sweep) - isSubstitute = true; - aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); - } - } - } - if(isSubstitute) - aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".AxisStructStr"); - aStates->IncrementState(); - } - else if(aMethod.IsEqual("AddNode") || - aMethod.IsEqual("MoveClosestNodeToPoint")) { - for(int j = 0; j < aCurrentStateSize; j++) { - if(!aCurrentState.at(j).IsEmpty()) - aCmd->SetArg(j+1, aCurrentState.at(j)); - } - aStates->IncrementState(); - } - else if(aMethod.IsEqual("MoveNode")) { - for(int j = 0; j < aCurrentStateSize; j++) { - if(!aCurrentState.at(j).IsEmpty()) - aCmd->SetArg(j+2, aCurrentState.at(j)); - } - aStates->IncrementState(); - } - else if(aMethod.IsEqual("ExtrusionSweep") || - aMethod.IsEqual("ExtrusionSweepObject") || - aMethod.IsEqual("ExtrusionSweepObject1D") || - aMethod.IsEqual("ExtrusionSweepObject2D") || - aMethod.IsEqual("ExtrusionSweepMakeGroups") || - aMethod.IsEqual("ExtrusionSweepObjectMakeGroups") || - aMethod.IsEqual("ExtrusionSweepObject1DMakeGroups") || - aMethod.IsEqual("ExtrusionSweepObject2DMakeGroups")) { - bool isSubstitute = false; - int anArgIndex = 0; - for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) { - if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) { - anArgIndex = i+1; - break; - } - } - if(anArgIndex > 0) { - for(int j = 0; j < aCurrentStateSize; j++) { - if(!aCurrentState.at(j).IsEmpty()) { - if(j < 3) // 0-2 - dir struct, 3 - number of steps - isSubstitute = true; - aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); - } - } - } - if(isSubstitute) { + bool isSubstitute = false; + int anArgIndex = 0; + for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) { + if(aCmd->GetArg(i).IsEqual("SMESH.AxisStruct")) { + anArgIndex = i+1; + break; + } + } + if(anArgIndex > 0) { + for(int j = 0; j < aCurrentStateSize; j++) { + if(!aCurrentState.at(j).IsEmpty()) { + if(j < 6) // 0-5 - axis struct, 6 - angle (rotation & sweep), 7-8 - nbSteps and tolerance (sweep) + isSubstitute = true; + aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); + } + } + } + if(isSubstitute) + aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".AxisStructStr"); + aStates->IncrementState(); + } + else if(aMethod.IsEqual("AddNode") || + aMethod.IsEqual("MoveClosestNodeToPoint")) { + for(int j = 0; j < aCurrentStateSize; j++) { + if(!aCurrentState.at(j).IsEmpty()) + aCmd->SetArg(j+1, aCurrentState.at(j)); + } + aStates->IncrementState(); + } + else if(aMethod.IsEqual("MoveNode")) { + for(int j = 0; j < aCurrentStateSize; j++) { + if(!aCurrentState.at(j).IsEmpty()) + aCmd->SetArg(j+2, aCurrentState.at(j)); + } + aStates->IncrementState(); + } + else if(aMethod.IsEqual("ExtrusionSweep") || + aMethod.IsEqual("ExtrusionSweepObject") || + aMethod.IsEqual("ExtrusionSweepObject1D") || + aMethod.IsEqual("ExtrusionSweepObject2D") || + aMethod.IsEqual("ExtrusionSweepMakeGroups") || + aMethod.IsEqual("ExtrusionSweepObjectMakeGroups") || + aMethod.IsEqual("ExtrusionSweepObject1DMakeGroups") || + aMethod.IsEqual("ExtrusionSweepObject2DMakeGroups")) { + bool isSubstitute = false; + int anArgIndex = 0; + for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) { + if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) { + anArgIndex = i+1; + break; + } + } + if(anArgIndex > 0) { + for(int j = 0; j < aCurrentStateSize; j++) { + if(!aCurrentState.at(j).IsEmpty()) { + if(j < 3) // 0-2 - dir struct, 3 - number of steps + isSubstitute = true; + aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); + } + } + } + if(isSubstitute) { aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr"); aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr"); - } - aStates->IncrementState(); - } - else if(aMethod.IsEqual("ExtrusionAlongPath") || - aMethod.IsEqual("ExtrusionAlongPathObject") || - aMethod.IsEqual("ExtrusionAlongPathObject1D") || - aMethod.IsEqual("ExtrusionAlongPathObject2D") || - aMethod.IsEqual("ExtrusionAlongPathMakeGroups") || - aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") || - aMethod.IsEqual("ExtrusionAlongPathObject1DMakeGroups") || - aMethod.IsEqual("ExtrusionAlongPathObject2DMakeGroups") || - /* workaround for a bug in the command parsing algorithm */ - aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 || - aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 || - aCmd->GetString().Search("ExtrusionAlongPathObject1DMakeGroups") != -1 || - aCmd->GetString().Search("ExtrusionAlongPathObject2DMakeGroups") != -1 ) { - int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z" - bool isSubstitute = false; - int anArgIndex = 0; - for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) { - if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) { - anArgIndex = i-1-aNbAngles; - break; - } - } - if(anArgIndex > 0) { - int j = 0; - for(; j < aNbAngles; j++) { - if(!aCurrentState.at(j).IsEmpty()) { - aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j)); - } - } - for(; j < aNbAngles+3; j++) { - if(!aCurrentState.at(j).IsEmpty()) { - isSubstitute = true; - aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j)); - } - } - } - if(isSubstitute) - aCmd->SetArg(anArgIndex + aNbAngles + 1, - TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr"); - aStates->IncrementState(); - } - else if(aMethod.IsEqual("TriToQuad") || - aMethod.IsEqual("Concatenate") || - aMethod.IsEqual("ConcatenateWithGroups")) { - if(aCurrentStateSize && !aCurrentState.at(0).IsEmpty()) - aCmd->SetArg(aCmd->GetNbArgs(), aCurrentState.at(0)); - aStates->IncrementState(); - } - else if(aMethod.IsEqual("Smooth") || - aMethod.IsEqual("SmoothObject") || - aMethod.IsEqual("SmoothParametric") || - aMethod.IsEqual("SmoothParametricObject")) { - int anArgIndex = aCmd->GetNbArgs() - 2; - for(int j = 0; j < aCurrentStateSize; j++) { - if(!aCurrentState.at(j).IsEmpty()) - aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); - } - aStates->IncrementState(); - } - else if(aMethod.IsEqual("ApplyToMeshFaces") || - aMethod.IsEqual("ApplyToHexahedrons")) { - int anArgIndex = aCmd->GetNbArgs()-1; - for(int j = 0; j < aCurrentStateSize; j++) - if(!aCurrentState.at(j).IsEmpty()) - aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); - aStates->IncrementState(); - } + } + aStates->IncrementState(); + } + else if(aMethod.IsEqual("ExtrusionAlongPath") || + aMethod.IsEqual("ExtrusionAlongPathObject") || + aMethod.IsEqual("ExtrusionAlongPathObject1D") || + aMethod.IsEqual("ExtrusionAlongPathObject2D") || + aMethod.IsEqual("ExtrusionAlongPathMakeGroups") || + aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") || + aMethod.IsEqual("ExtrusionAlongPathObject1DMakeGroups") || + aMethod.IsEqual("ExtrusionAlongPathObject2DMakeGroups") || + /* workaround for a bug in the command parsing algorithm */ + aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 || + aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 || + aCmd->GetString().Search("ExtrusionAlongPathObject1DMakeGroups") != -1 || + aCmd->GetString().Search("ExtrusionAlongPathObject2DMakeGroups") != -1 ) { + int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z" + bool isSubstitute = false; + int anArgIndex = 0; + for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) { + if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) { + anArgIndex = i-1-aNbAngles; + break; + } + } + if(anArgIndex > 0) { + int j = 0; + for(; j < aNbAngles; j++) { + if(!aCurrentState.at(j).IsEmpty()) { + aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j)); + } + } + for(; j < aNbAngles+3; j++) { + if(!aCurrentState.at(j).IsEmpty()) { + isSubstitute = true; + aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j)); + } + } + } + if(isSubstitute) + aCmd->SetArg(anArgIndex + aNbAngles + 1, + TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr"); + aStates->IncrementState(); + } + else if(aMethod.IsEqual("TriToQuad") || + aMethod.IsEqual("Concatenate") || + aMethod.IsEqual("ConcatenateWithGroups")) { + if(aCurrentStateSize && !aCurrentState.at(0).IsEmpty()) + aCmd->SetArg(aCmd->GetNbArgs(), aCurrentState.at(0)); + aStates->IncrementState(); + } + else if(aMethod.IsEqual("Smooth") || + aMethod.IsEqual("SmoothObject") || + aMethod.IsEqual("SmoothParametric") || + aMethod.IsEqual("SmoothParametricObject")) { + int anArgIndex = aCmd->GetNbArgs() - 2; + for(int j = 0; j < aCurrentStateSize; j++) { + if(!aCurrentState.at(j).IsEmpty()) + aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); + } + aStates->IncrementState(); + } + else if(aMethod.IsEqual("ApplyToMeshFaces") || + aMethod.IsEqual("ApplyToHexahedrons")) { + int anArgIndex = aCmd->GetNbArgs()-1; + for(int j = 0; j < aCurrentStateSize; j++) + if(!aCurrentState.at(j).IsEmpty()) + aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); + aStates->IncrementState(); + } } } else { if(MYDEBUG) - cout << "Object not found" << endl; + cout << "Object not found" << endl; } if(MYDEBUG) { cout<<"Command after: "<< aCmd->GetString()<GetMethod() == "GetMeshEditor" ) { // MeshEditor creation myMeshEditors.insert( make_pair( aCommand->GetResultValue(), - aCommand->GetObject() ) ); + aCommand->GetObject() ) ); } } diff --git a/src/SMESH_I/SMESH_Pattern_i.cxx b/src/SMESH_I/SMESH_Pattern_i.cxx index b96a8d954..f3f1fcfbc 100644 --- a/src/SMESH_I/SMESH_Pattern_i.cxx +++ b/src/SMESH_I/SMESH_Pattern_i.cxx @@ -149,7 +149,7 @@ CORBA::Boolean SMESH_Pattern_i::LoadFromFace(SMESH::SMESH_Mesh_ptr theMesh, return false; // Update Python script - TPythonDump() << "isDone = pattern.LoadFromFace( " << theMesh << ", " + TPythonDump() << "isDone = pattern.LoadFromFace( " << theMesh << ".GetMesh(), " << theFace << ", " << theProject << " )"; addErrorCode( "LoadFromFace" ); @@ -180,7 +180,7 @@ CORBA::Boolean SMESH_Pattern_i::LoadFrom3DBlock(SMESH::SMESH_Mesh_ptr theMesh, return false; // Update Python script - TPythonDump() << "isDone = pattern.LoadFrom3DBlock( " << theMesh << ", " << theBlock << " )"; + TPythonDump() << "isDone = pattern.LoadFrom3DBlock( " << theMesh << ".GetMesh(), " << theBlock << " )"; addErrorCode( "LoadFrom3DBlock" ); return myPattern.Load( aMesh, TopoDS::Shell( exp.Current() )); @@ -316,7 +316,7 @@ SMESH::point_array* } // Update Python script - TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ", " + TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ".GetMesh(), " << theFacesIDs << ", " << theNodeIndexOnKeyPoint1 << ", " << theReverse << " )"; @@ -361,7 +361,7 @@ SMESH::point_array* } // Update Python script - TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ", " + TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ".GetMesh(), " << theVolumesIDs << ", " << theNode000Index << ", " << theNode001Index << " )"; @@ -382,7 +382,7 @@ CORBA::Boolean SMESH_Pattern_i::MakeMesh (SMESH::SMESH_Mesh_ptr theMesh, return false; // Update Python script - TPythonDump() << "isDone = pattern.MakeMesh( " << theMesh << ", " + TPythonDump() << "isDone = pattern.MakeMesh( " << theMesh << ".GetMesh(), " << CreatePolygons << ", " << CreatePolyedrs << " )"; addErrorCode( "MakeMesh" ); diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index bee3cbb83..10d6dd85c 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -56,7 +56,7 @@ public: static TCollection_AsciiString ConvertScript(const TCollection_AsciiString& theScript, Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod, - Resource_DataMapOfAsciiStringAsciiString& theObjectNames); + Resource_DataMapOfAsciiStringAsciiString& theObjectNames); /*! * \brief Return the name of the python file wrapping IDL API diff --git a/src/SMESH_I/SMESH_subMesh_i.cxx b/src/SMESH_I/SMESH_subMesh_i.cxx index 7d342969a..2720de2c7 100644 --- a/src/SMESH_I/SMESH_subMesh_i.cxx +++ b/src/SMESH_I/SMESH_subMesh_i.cxx @@ -59,9 +59,9 @@ SMESH_subMesh_i::SMESH_subMesh_i() //============================================================================= SMESH_subMesh_i::SMESH_subMesh_i( PortableServer::POA_ptr thePOA, - SMESH_Gen_i* gen_i, - SMESH_Mesh_i* mesh_i, - int localId ) + SMESH_Gen_i* gen_i, + SMESH_Mesh_i* mesh_i, + int localId ) : SALOME::GenericObj_i( thePOA ) { MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i"); @@ -458,11 +458,11 @@ GEOM::GEOM_Object_ptr SMESH_subMesh_i::GetSubShape() TopoDS_Shape S = _mesh_i->_mapSubMesh[ _localId ]->GetSubShape(); if ( !S.IsNull() ) { aShapeObj = _gen_i->ShapeToGeomObject( S ); - //mzn: N7PAL16232, N7PAL16233 - //In some cases it's possible that GEOM_Client contains the shape same to S, but - //with another orientation. - if (aShapeObj->_is_nil()) - aShapeObj = _gen_i->ShapeToGeomObject( S.Reversed() ); + //mzn: N7PAL16232, N7PAL16233 + //In some cases it's possible that GEOM_Client contains the shape same to S, but + //with another orientation. + if (aShapeObj->_is_nil()) + aShapeObj = _gen_i->ShapeToGeomObject( S.Reversed() ); } } } diff --git a/src/SMESH_I/SMESH_subMesh_i.hxx b/src/SMESH_I/SMESH_subMesh_i.hxx index 26b37a753..5a6eb8bd8 100644 --- a/src/SMESH_I/SMESH_subMesh_i.hxx +++ b/src/SMESH_I/SMESH_subMesh_i.hxx @@ -48,8 +48,8 @@ public: SMESH_subMesh_i(); SMESH_subMesh_i( PortableServer::POA_ptr thePOA, SMESH_Gen_i* gen_i, - SMESH_Mesh_i* mesh_i, - int localId ); + SMESH_Mesh_i* mesh_i, + int localId ); ~SMESH_subMesh_i(); CORBA::Long GetNumberOfElements() diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py index 73c31a721..da4eda843 100644 --- a/src/SMESH_SWIG/SMESH_test.py +++ b/src/SMESH_SWIG/SMESH_test.py @@ -130,5 +130,5 @@ for a in log: i2 = a.indexes[ii] ii = ii+1 i3 = a.indexes[ii] - #ii = ii+1 + ii = ii+1 print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3) diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index a9ef16e52..4789415c9 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -108,6 +108,38 @@ except ImportError: noNETGENPlugin = 1 pass +# import GHS3DPlugin module if possible +noGHS3DPlugin = 0 +try: + import GHS3DPlugin +except ImportError: + noGHS3DPlugin = 1 + pass + +# import GHS3DPRLPlugin module if possible +noGHS3DPRLPlugin = 0 +try: + import GHS3DPRLPlugin +except ImportError: + noGHS3DPRLPlugin = 1 + pass + +# import HexoticPlugin module if possible +noHexoticPlugin = 0 +try: + import HexoticPlugin +except ImportError: + noHexoticPlugin = 1 + pass + +# import BLSURFPlugin module if possible +noBLSURFPlugin = 0 +try: + import BLSURFPlugin +except ImportError: + noBLSURFPlugin = 1 + pass + ## @addtogroup l1_auxiliary ## @{ @@ -149,7 +181,10 @@ VeryFine = 4 Custom = 5 # Optimization level of GHS3D +# V3.1 None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3 +# V4.1 (partialy redefines V3.1). Issue 0020574 +None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4 # Topology treatment way of BLSURF FromCAD, PreProcess, PreProcessPlus = 0,1,2 @@ -403,6 +438,25 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo): print hypName, "was not assigned to",geomName,":", reason pass +## Check meshing plugin availability +def CheckPlugin(plugin): + if plugin == NETGEN and noNETGENPlugin: + print "Warning: NETGENPlugin module unavailable" + return False + elif plugin == GHS3D and noGHS3DPlugin: + print "Warning: GHS3DPlugin module unavailable" + return False + elif plugin == GHS3DPRL and noGHS3DPRLPlugin: + print "Warning: GHS3DPRLPlugin module unavailable" + return False + elif plugin == Hexotic and noHexoticPlugin: + print "Warning: HexoticPlugin module unavailable" + return False + elif plugin == BLSURF and noBLSURFPlugin: + print "Warning: BLSURFPlugin module unavailable" + return False + return True + # end of l1_auxiliary ## @} @@ -756,12 +810,26 @@ class smeshDC(SMESH._objref_SMESH_Gen): print "Error: given parameter is not numerucal functor type." ## Creates hypothesis - # @param - # @param + # @param theHType mesh hypothesis type (string) + # @param theLibName mesh plug-in library name # @return created hypothesis instance def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"): return SMESH._objref_SMESH_Gen.CreateHypothesis(self, theHType, theLibName ) + ## Gets the mesh stattistic + # @return dictionary type element - count of elements + # @ingroup l1_meshinfo + def GetMeshInfo(self, obj): + if isinstance( obj, Mesh ): + obj = obj.GetMesh() + d = {} + if hasattr(obj, "_narrow") and obj._narrow(SMESH.SMESH_IDSource): + values = obj.GetMeshInfo() + for i in range(SMESH.Entity_Last._v): + if i < len(values): d[SMESH.EntityType._item(i)]=values[i] + pass + return d + import omniORB #Registering the new proxy for SMESH_Gen omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC) @@ -1252,6 +1320,8 @@ class Mesh: # 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 + # @param opt boolean parameter for creating/not creating + # the groups Group_On_All_Nodes, Group_On_All_Faces, ... # @ingroup l2_impexp def ExportToMED(self, f, version, opt=0): self.mesh.ExportToMED(f, opt, version) @@ -1323,19 +1393,37 @@ class Mesh: elif tgeo == "SHELL": typ = VOLUME elif tgeo == "COMPOUND": - if len( self.geompyD.GetObjectIDs( grp )) == 0: - print "Mesh.Group: empty geometric group", GetName( grp ) - return 0 - tgeo = self.geompyD.GetType(grp) - if tgeo == geompyDC.ShapeType["VERTEX"]: - typ = NODE - elif tgeo == geompyDC.ShapeType["EDGE"]: - typ = EDGE - elif tgeo == geompyDC.ShapeType["FACE"]: - typ = FACE - elif tgeo == geompyDC.ShapeType["SOLID"]: - typ = VOLUME - + try: # it raises on a compound of compounds + if len( self.geompyD.GetObjectIDs( grp )) == 0: + print "Mesh.Group: empty geometric group", GetName( grp ) + return 0 + pass + except: + pass + if grp.GetType() == 37: # GEOMImpl_Types.hxx: #define GEOM_GROUP 37 + # group + tgeo = self.geompyD.GetType(grp) + if tgeo == geompyDC.ShapeType["VERTEX"]: + typ = NODE + elif tgeo == geompyDC.ShapeType["EDGE"]: + typ = EDGE + elif tgeo == geompyDC.ShapeType["FACE"]: + typ = FACE + elif tgeo == geompyDC.ShapeType["SOLID"]: + typ = VOLUME + pass + pass + else: + # just a compound + for elemType, shapeType in [[VOLUME,"SOLID"],[FACE,"FACE"], + [EDGE,"EDGE"],[NODE,"VERTEX"]]: + if self.geompyD.SubShapeAll(grp,geompyDC.ShapeType[shapeType]): + typ = elemType + break + pass + pass + pass + pass if typ == None: print "Mesh.Group: bad first argument: expected a group, a vertex, an edge, a face or a solid" return 0 @@ -1596,13 +1684,7 @@ class Mesh: # @ingroup l1_meshinfo def GetMeshInfo(self, obj = None): if not obj: obj = self.mesh - d = {} - if hasattr(obj, "_narrow") and obj._narrow(SMESH.SMESH_IDSource): - values = obj.GetMeshInfo() - for i in range(SMESH.Entity_Last._v): - if i < len(values): d[SMESH.EntityType._item(i)]=values[i] - pass - return d + return self.smeshpyD.GetMeshInfo(obj) ## Returns the number of nodes in the mesh # @return an integer value @@ -2128,6 +2210,8 @@ class Mesh: # @param x the X coordinate of a point # @param y the Y coordinate of a point # @param z the Z coordinate of a point + # @param NodeID if specified (>0), the node with this ID is moved, + # otherwise, the node closest to point (@a x,@a y,@a z) is moved # @return the ID of a node # @ingroup l2_modif_throughp def MoveClosestNodeToPoint(self, x, y, z, NodeID): @@ -2814,7 +2898,7 @@ class Mesh: HasRefPoint, RefPoint, MakeGroups, ElemType) else: if isinstance(Base,Mesh): - return self.editor.ExtrusionAlongPathObjX(Base.GetMesh(), Path, NodeStart, + return self.editor.ExtrusionAlongPathObjX(Base, Path, NodeStart, HasAngles, Angles, LinearVariation, HasRefPoint, RefPoint, MakeGroups, ElemType) else: @@ -3275,6 +3359,8 @@ class Mesh: # @return a list of groups of equal elements # @ingroup l2_modif_trsf def FindEqualElements (self, MeshOrSubMeshOrGroup): + if ( isinstance( MeshOrSubMeshOrGroup, Mesh )): + MeshOrSubMeshOrGroup = MeshOrSubMeshOrGroup.GetMesh() return self.editor.FindEqualElements(MeshOrSubMeshOrGroup) ## Merges elements in each given group. @@ -3352,6 +3438,43 @@ class Mesh: # @ingroup l1_auxiliary def GetLastCreatedElems(self): return self.editor.GetLastCreatedElems() + + ## Creates a hole in a mesh by doubling the nodes of some particular elements + # @param theNodes identifiers of nodes to be doubled + # @param theModifiedElems identifiers of elements to be updated by the new (doubled) + # nodes. If list of element identifiers is empty then nodes are doubled but + # they not assigned to elements + # @return TRUE if operation has been completed successfully, FALSE otherwise + # @ingroup l2_modif_edit + def DoubleNodes(self, theNodes, theModifiedElems): + return self.editor.DoubleNodes(theNodes, theModifiedElems) + + ## Creates a hole in a mesh by doubling the nodes of some particular elements + # This method provided for convenience works as DoubleNodes() described above. + # @param theNodes identifiers of node to be doubled + # @param theModifiedElems identifiers of elements to be updated + # @return TRUE if operation has been completed successfully, FALSE otherwise + # @ingroup l2_modif_edit + def DoubleNode(self, theNodeId, theModifiedElems): + return self.editor.DoubleNode(theNodeId, theModifiedElems) + + ## Creates a hole in a mesh by doubling the nodes of some particular elements + # This method provided for convenience works as DoubleNodes() described above. + # @param theNodes group of nodes to be doubled + # @param theModifiedElems group of elements to be updated. + # @return TRUE if operation has been completed successfully, FALSE otherwise + # @ingroup l2_modif_edit + def DoubleNodeGroup(self, theNodes, theModifiedElems): + return self.editor.DoubleNodeGroup(theNodes, theModifiedElems) + + ## Creates a hole in a mesh by doubling the nodes of some particular elements + # This method provided for convenience works as DoubleNodes() described above. + # @param theNodes list of groups of nodes to be doubled + # @param theModifiedElems list of groups of elements to be updated. + # @return TRUE if operation has been completed successfully, FALSE otherwise + # @ingroup l2_modif_edit + def DoubleNodeGroups(self, theNodes, theModifiedElems): + return self.editor.DoubleNodeGroups(theNodes, theModifiedElems) ## Creates a hole in a mesh by doubling the nodes of some particular elements # @param theElems - the list of elements (edges or faces) to be replicated @@ -3361,8 +3484,8 @@ class Mesh: # replicated nodes should be associated to. # @return TRUE if operation has been completed successfully, FALSE otherwise # @ingroup l2_modif_edit - def DoubleNodes(self, theElems, theNodesNot, theAffectedElems): - return self.editor.DoubleNodes(theElems, theNodesNot, theAffectedElems) + def DoubleNodeElem(self, theElems, theNodesNot, theAffectedElems): + return self.editor.DoubleNodeElem(theElems, theNodesNot, theAffectedElems) ## Creates a hole in a mesh by doubling the nodes of some particular elements # @param theElems - the list of elements (edges or faces) to be replicated @@ -3373,8 +3496,8 @@ class Mesh: # The replicated nodes should be associated to affected elements. # @return TRUE if operation has been completed successfully, FALSE otherwise # @ingroup l2_modif_edit - def DoubleNodesInRegion(self, theElems, theNodesNot, theShape): - return self.editor.DoubleNodesInRegion(theElems, theNodesNot, theShape) + def DoubleNodeElemInRegion(self, theElems, theNodesNot, theShape): + return self.editor.DoubleNodeElemInRegion(theElems, theNodesNot, theShape) ## Creates a hole in a mesh by doubling the nodes of some particular elements # This method provided for convenience works as DoubleNodes() described above. @@ -3383,8 +3506,8 @@ class Mesh: # @param theAffectedElems - group of elements to which the replicated nodes # should be associated to. # @ingroup l2_modif_edit - def DoubleNodeGroup(self, theElems, theNodesNot, theAffectedElems): - return self.editor.DoubleNodeGroup(theElems, theNodesNot, theAffectedElems) + def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems): + return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theAffectedElems) ## Creates a hole in a mesh by doubling the nodes of some particular elements # This method provided for convenience works as DoubleNodes() described above. @@ -3394,8 +3517,8 @@ class Mesh: # located on or inside shape). # The replicated nodes should be associated to affected elements. # @ingroup l2_modif_edit - def DoubleNodeGroupInRegion(self, theElems, theNodesNot, theShape): - return self.editor.DoubleNodeGroup(theElems, theNodesNot, theShape) + def DoubleNodeElemGroupInRegion(self, theElems, theNodesNot, theShape): + return self.editor.DoubleNodeElemGroup(theElems, theNodesNot, theShape) ## Creates a hole in a mesh by doubling the nodes of some particular elements # This method provided for convenience works as DoubleNodes() described above. @@ -3405,8 +3528,8 @@ class Mesh: # should be associated to. # @return TRUE if operation has been completed successfully, FALSE otherwise # @ingroup l2_modif_edit - def DoubleNodeGroups(self, theElems, theNodesNot, theAffectedElems): - return self.editor.DoubleNodeGroups(theElems, theNodesNot, theAffectedElems) + def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems): + return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems) ## Creates a hole in a mesh by doubling the nodes of some particular elements # This method provided for convenience works as DoubleNodes() described above. @@ -3417,8 +3540,8 @@ class Mesh: # The replicated nodes should be associated to affected elements. # @return TRUE if operation has been completed successfully, FALSE otherwise # @ingroup l2_modif_edit - def DoubleNodeGroupsInRegion(self, theElems, theNodesNot, theShape): - return self.editor.DoubleNodeGroupsInRegion(theElems, theNodesNot, theShape) + def DoubleNodeElemGroupsInRegion(self, theElems, theNodesNot, theShape): + return self.editor.DoubleNodeElemGroupsInRegion(theElems, theNodesNot, theShape) ## The mother class to define algorithm, it is not recommended to use it directly. # @@ -3996,19 +4119,15 @@ class Mesh_Triangle(Mesh_Algorithm): self.Create(mesh, geom, "MEFISTO_2D") pass elif algoType == BLSURF: - import BLSURFPlugin + CheckPlugin(BLSURF) self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so") #self.SetPhysicalMesh() - PAL19680 elif algoType == NETGEN: - if noNETGENPlugin: - print "Warning: NETGENPlugin module unavailable" - pass + CheckPlugin(NETGEN) self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so") pass elif algoType == NETGEN_2D: - if noNETGENPlugin: - print "Warning: NETGENPlugin module unavailable" - pass + CheckPlugin(NETGEN) self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so") pass @@ -4057,6 +4176,7 @@ class Mesh_Triangle(Mesh_Algorithm): # @ingroup l3_hypos_blsurf def SetPhySize(self, theVal): # Parameter of BLSURF algo + self.SetPhysicalMesh(1) #Custom - else why to set the size? self.Parameters().SetPhySize(theVal) ## Sets lower boundary of mesh element size (PhySize). @@ -4311,22 +4431,22 @@ class Mesh_Tetrahedron(Mesh_Algorithm): Mesh_Algorithm.__init__(self) if algoType == NETGEN: + CheckPlugin(NETGEN) self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so") pass elif algoType == FULL_NETGEN: - if noNETGENPlugin: - print "Warning: NETGENPlugin module has not been imported." + CheckPlugin(NETGEN) self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so") pass elif algoType == GHS3D: - import GHS3DPlugin + CheckPlugin(GHS3D) self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so") pass elif algoType == GHS3DPRL: - import GHS3DPRLPlugin + CheckPlugin(GHS3DPRL) self.Create(mesh, geom, "GHS3DPRL_3D" , "libGHS3DPRLEngine.so") pass @@ -4464,8 +4584,9 @@ class Mesh_Tetrahedron(Mesh_Algorithm): self.Parameters().SetToMeshHoles(toMesh) ## Set Optimization level: - # None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization. - # Default is Medium_Optimization + # None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, + # Strong_Optimization. + # Default is Standard_Optimization # @ingroup l3_hypos_ghs3dh def SetOptimizationLevel(self, level): # Parameter of GHS3D @@ -4562,7 +4683,7 @@ class Mesh_Hexahedron(Mesh_Algorithm): pass elif algoType == Hexotic: - import HexoticPlugin + CheckPlugin(Hexotic) self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so") pass @@ -4595,8 +4716,7 @@ class Mesh_Netgen(Mesh_Algorithm): def __init__(self, mesh, is3D, geom=0): Mesh_Algorithm.__init__(self) - if noNETGENPlugin: - print "Warning: NETGENPlugin module has not been imported." + CheckPlugin(NETGEN) self.is3D = is3D if is3D: @@ -5115,7 +5235,7 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_MaxElementArea._NP_Reposito class MaxElementVolume(StdMeshers._objref_StdMeshers_MaxElementVolume): ## Set Max Element Volume parameter value - # @param area numerical value or name of variable from notebook + # @param volume numerical value or name of variable from notebook def SetMaxElementVolume(self, volume): volume ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementVolume.GetLastParameters(self),1,1,volume) StdMeshers._objref_StdMeshers_MaxElementVolume.SetParameters(self,parameters) @@ -5159,110 +5279,112 @@ class NumberOfSegments(StdMeshers._objref_StdMeshers_NumberOfSegments): #Registering the new proxy for NumberOfSegments omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfSegments._NP_RepositoryId, NumberOfSegments) +if not noNETGENPlugin: + #Wrapper class for NETGENPlugin_Hypothesis hypothesis + class NETGENPlugin_Hypothesis(NETGENPlugin._objref_NETGENPlugin_Hypothesis): + + ## Set Max Size parameter value + # @param maxsize numerical value or name of variable from notebook + def SetMaxSize(self, maxsize): + lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) + maxsize, parameters = ParseParameters(lastParameters,4,1,maxsize) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetMaxSize(self,maxsize) + + ## Set Growth Rate parameter value + # @param value numerical value or name of variable from notebook + def SetGrowthRate(self, value): + lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) + value, parameters = ParseParameters(lastParameters,4,2,value) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetGrowthRate(self,value) + + ## Set Number of Segments per Edge parameter value + # @param value numerical value or name of variable from notebook + def SetNbSegPerEdge(self, value): + lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) + value, parameters = ParseParameters(lastParameters,4,3,value) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerEdge(self,value) + + ## Set Number of Segments per Radius parameter value + # @param value numerical value or name of variable from notebook + def SetNbSegPerRadius(self, value): + lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) + value, parameters = ParseParameters(lastParameters,4,4,value) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerRadius(self,value) + + #Registering the new proxy for NETGENPlugin_Hypothesis + omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis._NP_RepositoryId, NETGENPlugin_Hypothesis) + + + #Wrapper class for NETGENPlugin_Hypothesis_2D hypothesis + class NETGENPlugin_Hypothesis_2D(NETGENPlugin_Hypothesis,NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D): + pass -#Wrapper class for NETGENPlugin_Hypothesis hypothesis -class NETGENPlugin_Hypothesis(NETGENPlugin._objref_NETGENPlugin_Hypothesis): - - ## Set Max Size parameter value - # @param maxsize numerical value or name of variable from notebook - def SetMaxSize(self, maxsize): - lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) - maxsize, parameters = ParseParameters(lastParameters,4,1,maxsize) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetMaxSize(self,maxsize) - - ## Set Growth Rate parameter value - # @param value numerical value or name of variable from notebook - def SetGrowthRate(self, value): - lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) - value, parameters = ParseParameters(lastParameters,4,2,value) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetGrowthRate(self,value) - - ## Set Number of Segments per Edge parameter value - # @param value numerical value or name of variable from notebook - def SetNbSegPerEdge(self, value): - lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) - value, parameters = ParseParameters(lastParameters,4,3,value) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerEdge(self,value) - - ## Set Number of Segments per Radius parameter value - # @param value numerical value or name of variable from notebook - def SetNbSegPerRadius(self, value): - lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetLastParameters(self) - value, parameters = ParseParameters(lastParameters,4,4,value) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerRadius(self,value) - -#Registering the new proxy for NETGENPlugin_Hypothesis -omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis._NP_RepositoryId, NETGENPlugin_Hypothesis) - - -#Wrapper class for NETGENPlugin_Hypothesis_2D hypothesis -class NETGENPlugin_Hypothesis_2D(NETGENPlugin_Hypothesis,NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D): - pass - -#Registering the new proxy for NETGENPlugin_Hypothesis_2D -omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D._NP_RepositoryId, NETGENPlugin_Hypothesis_2D) - -#Wrapper class for NETGENPlugin_SimpleHypothesis_2D hypothesis -class NETGEN_SimpleParameters_2D(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D): - - ## Set Number of Segments parameter value - # @param nbSeg numerical value or name of variable from notebook - def SetNumberOfSegments(self, nbSeg): - lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) - nbSeg, parameters = ParseParameters(lastParameters,2,1,nbSeg) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetNumberOfSegments(self, nbSeg) - - ## Set Local Length parameter value - # @param length numerical value or name of variable from notebook - def SetLocalLength(self, length): - lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) - length, parameters = ParseParameters(lastParameters,2,1,length) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetLocalLength(self, length) - - ## Set Max Element Area parameter value - # @param area numerical value or name of variable from notebook - def SetMaxElementArea(self, area): - lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) - area, parameters = ParseParameters(lastParameters,2,2,area) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetMaxElementArea(self, area) - - def LengthFromEdges(self): - lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) - value = 0; - value, parameters = ParseParameters(lastParameters,2,2,value) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.LengthFromEdges(self) - -#Registering the new proxy for NETGEN_SimpleParameters_2D -omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D._NP_RepositoryId, NETGEN_SimpleParameters_2D) - - -#Wrapper class for NETGENPlugin_SimpleHypothesis_3D hypothesis -class NETGEN_SimpleParameters_3D(NETGEN_SimpleParameters_2D,NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D): - ## Set Max Element Volume parameter value - # @param volume numerical value or name of variable from notebook - def SetMaxElementVolume(self, volume): - lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self) - volume, parameters = ParseParameters(lastParameters,3,3,volume) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetMaxElementVolume(self, volume) - - def LengthFromFaces(self): - lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self) - value = 0; - value, parameters = ParseParameters(lastParameters,3,3,value) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters) - NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.LengthFromFaces(self) - -#Registering the new proxy for NETGEN_SimpleParameters_3D -omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D._NP_RepositoryId, NETGEN_SimpleParameters_3D) + #Registering the new proxy for NETGENPlugin_Hypothesis_2D + omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_Hypothesis_2D._NP_RepositoryId, NETGENPlugin_Hypothesis_2D) + + #Wrapper class for NETGENPlugin_SimpleHypothesis_2D hypothesis + class NETGEN_SimpleParameters_2D(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D): + + ## Set Number of Segments parameter value + # @param nbSeg numerical value or name of variable from notebook + def SetNumberOfSegments(self, nbSeg): + lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) + nbSeg, parameters = ParseParameters(lastParameters,2,1,nbSeg) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetNumberOfSegments(self, nbSeg) + + ## Set Local Length parameter value + # @param length numerical value or name of variable from notebook + def SetLocalLength(self, length): + lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) + length, parameters = ParseParameters(lastParameters,2,1,length) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetLocalLength(self, length) + + ## Set Max Element Area parameter value + # @param area numerical value or name of variable from notebook + def SetMaxElementArea(self, area): + lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) + area, parameters = ParseParameters(lastParameters,2,2,area) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetMaxElementArea(self, area) + + def LengthFromEdges(self): + lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetLastParameters(self) + value = 0; + value, parameters = ParseParameters(lastParameters,2,2,value) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.LengthFromEdges(self) + + #Registering the new proxy for NETGEN_SimpleParameters_2D + omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D._NP_RepositoryId, NETGEN_SimpleParameters_2D) + + + #Wrapper class for NETGENPlugin_SimpleHypothesis_3D hypothesis + class NETGEN_SimpleParameters_3D(NETGEN_SimpleParameters_2D,NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D): + ## Set Max Element Volume parameter value + # @param volume numerical value or name of variable from notebook + def SetMaxElementVolume(self, volume): + lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self) + volume, parameters = ParseParameters(lastParameters,3,3,volume) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetMaxElementVolume(self, volume) + + def LengthFromFaces(self): + lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetLastParameters(self) + value = 0; + value, parameters = ParseParameters(lastParameters,3,3,value) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters) + NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.LengthFromFaces(self) + + #Registering the new proxy for NETGEN_SimpleParameters_3D + omniORB.registerObjref(NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D._NP_RepositoryId, NETGEN_SimpleParameters_3D) + + pass # if not noNETGENPlugin: class Pattern(SMESH._objref_SMESH_Pattern): diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index d04f77c55..38bbdeaf3 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -252,7 +252,7 @@ StdMeshers_CompositeHexa_3D::StdMeshers_CompositeHexa_3D(int hypId, int studyId, :SMESH_3D_Algo(hypId, studyId, gen) { _name = "CompositeHexa_3D"; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type } //================================================================================ @@ -514,7 +514,7 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh, //purpose : auxilary for Evaluate //======================================================================= int GetNb2d(_QuadFaceGrid* QFG, SMESH_Mesh& theMesh, - MapShapeNbElems& aResMap) + MapShapeNbElems& aResMap) { int nb2d = 0; _QuadFaceGrid::TChildIterator aCI = QFG->GetChildren(); @@ -539,8 +539,8 @@ int GetNb2d(_QuadFaceGrid* QFG, SMESH_Mesh& theMesh, //================================================================================ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, - const TopoDS_Shape& theShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape& theShape, + MapShapeNbElems& aResMap) { SMESH_MesherHelper aTool(theMesh); bool _quadraticMesh = aTool.IsQuadraticSubMesh(theShape); @@ -636,22 +636,22 @@ bool StdMeshers_CompositeHexa_3D::Evaluate(SMESH_Mesh& theMesh, int nb0 = 0; SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current()); if( sm ) { - MapShapeNbElemsItr anIt = aResMap.find(sm); - if( anIt == aResMap.end() ) continue; - std::vector aVec = (*anIt).second; - nb0 = aVec[SMDSEntity_Node]; + MapShapeNbElemsItr anIt = aResMap.find(sm); + if( anIt == aResMap.end() ) continue; + std::vector aVec = (*anIt).second; + nb0 = aVec[SMDSEntity_Node]; } int j = 1; for(; j<=BndEdges.Length(); j++) { - if( BndEdges.Value(j) == exp.Current() ) { - // internal edge => remove it - BndEdges.Remove(j); - nb0d_in += nb0; - break; - } + if( BndEdges.Value(j) == exp.Current() ) { + // internal edge => remove it + BndEdges.Remove(j); + nb0d_in += nb0; + break; + } } if( j > BndEdges.Length() ) { - BndEdges.Append(exp.Current()); + BndEdges.Append(exp.Current()); } //if( BndEdges.Contains(exp.Current()) ) { //BndEdges.Remove( exp.Current() ); diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 15ebca373..c677973be 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -165,8 +165,8 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace, //================================================================================ StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode, - const gp_Pnt2d thePnt2d, - const StdMeshers_FaceSide* theSide) + const gp_Pnt2d thePnt2d, + const StdMeshers_FaceSide* theSide) { myC2d.resize(1); myLength = 0; @@ -541,15 +541,7 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace, return TSideVector(0); } } - // find out side orientation, which is important if there are several wires (PAL19080) - bool isForward = true; - if ( nbWires > 1 ) { - TopExp_Explorer e( theFace, TopAbs_EDGE ); - while ( ! e.Current().IsSame( wireEdges.back() )) - e.Next(); - isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() ); - } - + const bool isForward = true; StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh, isForward, theIgnoreMediumNodes); wires[ iW ] = StdMeshers_FaceSidePtr( wire ); diff --git a/src/StdMeshers/StdMeshers_FaceSide.hxx b/src/StdMeshers/StdMeshers_FaceSide.hxx index f340dad04..8382a8fbd 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.hxx +++ b/src/StdMeshers/StdMeshers_FaceSide.hxx @@ -97,7 +97,7 @@ public: * \brief Wrap for vertex using data from other FaceSide */ StdMeshers_FaceSide(const SMDS_MeshNode* theNode, - const gp_Pnt2d thePnt2d, + const gp_Pnt2d thePnt2d, const StdMeshers_FaceSide* theSide); /*! * \brief Return wires of a face as StdMeshers_FaceSide's diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index 1300bf9b1..42b5488ec 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -61,10 +61,10 @@ typedef SMESH_Comment TComm; using namespace std; static SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh &, - const TopoDS_Shape &); + const TopoDS_Shape &); static bool EvaluatePentahedralMesh(SMESH_Mesh &, const TopoDS_Shape &, - MapShapeNbElems &); + MapShapeNbElems &); //============================================================================= /*! @@ -77,7 +77,7 @@ StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, int studyId, SMESH_Gen * gen) { MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D"); _name = "Hexa_3D"; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type } //============================================================================= @@ -298,7 +298,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, try { aQuads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace, _quadraticMesh); if(!aQuads[i]) { - return error( quadAlgo->GetComputeError()); + return error( quadAlgo->GetComputeError()); } } catch(SALOME_Exception & S_ex) { @@ -361,7 +361,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, int _indX1 = GetFaceIndex(aMesh, aShape, meshFaces, aCube.V100, aCube.V101, aCube.V110, aCube.V111); - // IPAL21120: SIGSEGV on Meshing attached Compound with Automatic Hexadralization + // IPAL21120: SIGSEGV on Meshing attached Compound with Automatic Hexadralization if ( _indY1 < 1 || _indZ0 < 1 || _indZ1 < 1 || _indX0 < 1 || _indX1 < 1 ) return error(COMPERR_BAD_SHAPE); @@ -374,8 +374,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, // 1.7 - get convertion coefs from face 2D normalized to 3D normalized - Conv2DStruct cx0; // for face X=0 - Conv2DStruct cx1; // for face X=1 + Conv2DStruct cx0; // for face X=0 + Conv2DStruct cx1; // for face X=1 Conv2DStruct cy0; Conv2DStruct cy1; Conv2DStruct cz0; @@ -414,12 +414,12 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, const TopoDS_Face & F = TopoDS::Face(meshFaces[_indX0]->GetSubShape()); faceQuadStruct *quad = aCube.quad_X0; - int i = 0; // j = x/face , k = y/face + int i = 0; // j = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); - + while(itf->more()) { const SMDS_MeshNode * node = itf->next(); if(aTool.IsMedium(node)) @@ -433,8 +433,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face - int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face + int j = cx0.ia * i1 + cx0.ib * j1 + cx0.ic; // j = x/face + int k = cx0.ja * i1 + cx0.jb * j1 + cx0.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -448,7 +448,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_X1; - int i = nbx - 1; // j = x/face , k = y/face + int i = nbx - 1; // j = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -465,8 +465,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face - int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face + int j = cx1.ia * i1 + cx1.ib * j1 + cx1.ic; // j = x/face + int k = cx1.ja * i1 + cx1.jb * j1 + cx1.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -480,7 +480,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Y0; - int j = 0; // i = x/face , k = y/face + int j = 0; // i = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -497,8 +497,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face - int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face + int i = cy0.ia * i1 + cy0.ib * j1 + cy0.ic; // i = x/face + int k = cy0.ja * i1 + cy0.jb * j1 + cy0.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -512,7 +512,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Y1; - int j = nby - 1; // i = x/face , k = y/face + int j = nby - 1; // i = x/face , k = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -529,8 +529,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face - int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face + int i = cy1.ia * i1 + cy1.ib * j1 + cy1.ic; // i = x/face + int k = cy1.ja * i1 + cy1.jb * j1 + cy1.jc; // k = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -544,7 +544,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Z0; - int k = 0; // i = x/face , j = y/face + int k = 0; // i = x/face , j = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -561,8 +561,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face - int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face + int i = cz0.ia * i1 + cz0.ib * j1 + cz0.ic; // i = x/face + int j = cz0.ja * i1 + cz0.jb * j1 + cz0.jc; // j = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -576,7 +576,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, SMDS_NodeIteratorPtr itf= aMesh.GetSubMesh(F)->GetSubMeshDS()->GetNodes(); faceQuadStruct *quad = aCube.quad_Z1; - int k = nbz - 1; // i = x/face , j = y/face + int k = nbz - 1; // i = x/face , j = y/face int nbdown = quad->side[0]->NbPoints(); int nbright = quad->side[1]->NbPoints(); @@ -593,8 +593,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, for (int i1 = 0; i1 < nbdown; i1++) for (int j1 = 0; j1 < nbright; j1++) { int ij1 = j1 * nbdown + i1; - int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face - int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face + int i = cz1.ia * i1 + cz1.ib * j1 + cz1.ic; // i = x/face + int j = cz1.ja * i1 + cz1.jb * j1 + cz1.jc; // j = y/face int ijk = k * nbx * nby + j * nbx + i; //MESSAGE(" "<uv_grid[ij1].node; @@ -655,9 +655,9 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, GetPoint(p1yz, nbx - 1, j, k, nbx, nby, nbz, np, meshDS); int ijk = k * nbx * nby + j * nbx + i; - double x = double (i) / double (nbx - 1); // *** seulement - double y = double (j) / double (nby - 1); // *** maillage - double z = double (k) / double (nbz - 1); // *** regulier + double x = double (i) / double (nbx - 1); // *** seulement + double y = double (j) / double (nby - 1); // *** maillage + double z = double (k) / double (nbz - 1); // *** regulier Pt3 X; for (int i = 0; i < 3; i++) { @@ -750,8 +750,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh, //============================================================================= bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap) { vector < SMESH_subMesh * >meshFaces; TopTools_SequenceOfShape aFaces; @@ -789,7 +789,7 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, std::vector aVec = (*anIt).second; int nbtri = Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); if( nbtri == 0 ) - isAllQuad = true; + isAllQuad = true; } if ( ! isAllQuad ) { return EvaluatePentahedralMesh(aMesh, aShape, aResMap); @@ -810,8 +810,8 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, std::vector aVec = (*anIt).second; nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); if(IsFirst) { - IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); - IsFirst = false; + IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); + IsFirst = false; } } } @@ -821,8 +821,8 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, bool IsOpposite = true; for(TopExp_Explorer exp(aFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) { if( Edges1.Contains(exp.Current()) ) { - IsOpposite = false; - break; + IsOpposite = false; + break; } } if(IsOpposite) { @@ -872,12 +872,12 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, void StdMeshers_Hexa_3D::GetPoint(Pt3 p, int i, int j, int k, int nbx, int nby, int nbz, Point3DStruct * np, const SMESHDS_Mesh * meshDS) { - int ijk = k * nbx * nby + j * nbx + i; - const SMDS_MeshNode * node = np[ijk].node; - p[0] = node->X(); - p[1] = node->Y(); - p[2] = node->Z(); - //MESSAGE(" "<X(); + p[1] = node->Y(); + p[2] = node->Z(); + //MESSAGE(" "<&meshFaces, - const TopoDS_Vertex & V0, - const TopoDS_Vertex & V1, - const TopoDS_Vertex & V2, const TopoDS_Vertex & V3) + const TopoDS_Shape & aShape, + const vector < SMESH_subMesh * >&meshFaces, + const TopoDS_Vertex & V0, + const TopoDS_Vertex & V1, + const TopoDS_Vertex & V2, const TopoDS_Vertex & V3) { - //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex"); - int faceIndex = -1; - for (int i = 1; i < 6; i++) - { - const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape(); - //const TopoDS_Face& F = TopoDS::Face(aFace); - TopTools_IndexedMapOfShape M; - TopExp::MapShapes(aFace, TopAbs_VERTEX, M); - bool verticesInShape = false; - if (M.Contains(V0)) - if (M.Contains(V1)) - if (M.Contains(V2)) - if (M.Contains(V3)) - verticesInShape = true; - if (verticesInShape) - { - faceIndex = i; - break; - } - } - //IPAL21120 ASSERT(faceIndex > 0); - //SCRUTE(faceIndex); - return faceIndex; + //MESSAGE("StdMeshers_Hexa_3D::GetFaceIndex"); + int faceIndex = -1; + for (int i = 1; i < 6; i++) + { + const TopoDS_Shape & aFace = meshFaces[i]->GetSubShape(); + //const TopoDS_Face& F = TopoDS::Face(aFace); + TopTools_IndexedMapOfShape M; + TopExp::MapShapes(aFace, TopAbs_VERTEX, M); + bool verticesInShape = false; + if (M.Contains(V0)) + if (M.Contains(V1)) + if (M.Contains(V2)) + if (M.Contains(V3)) + verticesInShape = true; + if (verticesInShape) + { + faceIndex = i; + break; + } + } + //IPAL21120 ASSERT(faceIndex > 0); + //SCRUTE(faceIndex); + return faceIndex; } //============================================================================= @@ -925,46 +925,46 @@ int StdMeshers_Hexa_3D::GetFaceIndex(SMESH_Mesh & aMesh, //============================================================================= TopoDS_Edge - StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - const TopoDS_Face & aFace, - const TopoDS_Vertex & aVertex, - const TopTools_IndexedDataMapOfShapeListOfShape & MS) + StdMeshers_Hexa_3D::EdgeNotInFace(SMESH_Mesh & aMesh, + const TopoDS_Shape & aShape, + const TopoDS_Face & aFace, + const TopoDS_Vertex & aVertex, + const TopTools_IndexedDataMapOfShapeListOfShape & MS) { - //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace"); - TopTools_IndexedDataMapOfShapeListOfShape MF; - TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF); - const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex); - const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex); -// SCRUTE(ancestorsInSolid.Extent()); -// SCRUTE(ancestorsInFace.Extent()); - ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees) - ASSERT(ancestorsInFace.Extent() == 2); - - TopoDS_Edge E; - E.Nullify(); - TopTools_ListIteratorOfListOfShape its(ancestorsInSolid); - for (; its.More(); its.Next()) - { - TopoDS_Shape ancestor = its.Value(); - TopTools_ListIteratorOfListOfShape itf(ancestorsInFace); - bool isInFace = false; - for (; itf.More(); itf.Next()) - { - TopoDS_Shape ancestorInFace = itf.Value(); - if (ancestorInFace.IsSame(ancestor)) - { - isInFace = true; - break; - } - } - if (!isInFace) - { - E = TopoDS::Edge(ancestor); - break; - } - } - return E; + //MESSAGE("StdMeshers_Hexa_3D::EdgeNotInFace"); + TopTools_IndexedDataMapOfShapeListOfShape MF; + TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF); + const TopTools_ListOfShape & ancestorsInSolid = MS.FindFromKey(aVertex); + const TopTools_ListOfShape & ancestorsInFace = MF.FindFromKey(aVertex); +// SCRUTE(ancestorsInSolid.Extent()); +// SCRUTE(ancestorsInFace.Extent()); + ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees) + ASSERT(ancestorsInFace.Extent() == 2); + + TopoDS_Edge E; + E.Nullify(); + TopTools_ListIteratorOfListOfShape its(ancestorsInSolid); + for (; its.More(); its.Next()) + { + TopoDS_Shape ancestor = its.Value(); + TopTools_ListIteratorOfListOfShape itf(ancestorsInFace); + bool isInFace = false; + for (; itf.More(); itf.Next()) + { + TopoDS_Shape ancestorInFace = itf.Value(); + if (ancestorInFace.IsSame(ancestor)) + { + isInFace = true; + break; + } + } + if (!isInFace) + { + E = TopoDS::Edge(ancestor); + break; + } + } + return E; } //============================================================================= @@ -974,135 +974,135 @@ TopoDS_Edge //============================================================================= void StdMeshers_Hexa_3D::GetConv2DCoefs(const faceQuadStruct & quad, - const TopoDS_Shape & aShape, - const TopoDS_Vertex & V0, - const TopoDS_Vertex & V1, - const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv) + const TopoDS_Shape & aShape, + const TopoDS_Vertex & V0, + const TopoDS_Vertex & V1, + const TopoDS_Vertex & V2, const TopoDS_Vertex & V3, Conv2DStruct & conv) { -// MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs"); -// const TopoDS_Face & F = TopoDS::Face(aShape); -// TopoDS_Edge E = quad.edge[0]; -// double f, l; -// Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); -// TopoDS_Vertex VFirst, VLast; -// TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l -// bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0); +// MESSAGE("StdMeshers_Hexa_3D::GetConv2DCoefs"); +// const TopoDS_Face & F = TopoDS::Face(aShape); +// TopoDS_Edge E = quad.edge[0]; +// double f, l; +// Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l); +// TopoDS_Vertex VFirst, VLast; +// TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l +// bool isForward = (((l - f) * (quad.last[0] - quad.first[0])) > 0); TopoDS_Vertex VA, VB; -// if (isForward) -// { -// VA = VFirst; -// VB = VLast; -// } -// else -// { -// VA = VLast; -// VB = VFirst; -// } +// if (isForward) +// { +// VA = VFirst; +// VB = VLast; +// } +// else +// { +// VA = VLast; +// VB = VFirst; +// } VA = quad.side[0]->FirstVertex(); VB = quad.side[0]->LastVertex(); - int a1, b1, c1, a2, b2, c2; - if (VA.IsSame(V0)) - if (VB.IsSame(V1)) - { - a1 = 1; - b1 = 0; - c1 = 0; // x - a2 = 0; - b2 = 1; - c2 = 0; // y - } - else - { - ASSERT(VB.IsSame(V3)); - a1 = 0; - b1 = 1; - c1 = 0; // y - a2 = 1; - b2 = 0; - c2 = 0; // x - } - if (VA.IsSame(V1)) - if (VB.IsSame(V2)) - { - a1 = 0; - b1 = -1; - c1 = 1; // 1-y - a2 = 1; - b2 = 0; - c2 = 0; // x - } - else - { - ASSERT(VB.IsSame(V0)); - a1 = -1; - b1 = 0; - c1 = 1; // 1-x - a2 = 0; - b2 = 1; - c2 = 0; // y - } - if (VA.IsSame(V2)) - if (VB.IsSame(V3)) - { - a1 = -1; - b1 = 0; - c1 = 1; // 1-x - a2 = 0; - b2 = -1; - c2 = 1; // 1-y - } - else - { - ASSERT(VB.IsSame(V1)); - a1 = 0; - b1 = -1; - c1 = 1; // 1-y - a2 = -1; - b2 = 0; - c2 = 1; // 1-x - } - if (VA.IsSame(V3)) - if (VB.IsSame(V0)) - { - a1 = 0; - b1 = 1; - c1 = 0; // y - a2 = -1; - b2 = 0; - c2 = 1; // 1-x - } - else - { - ASSERT(VB.IsSame(V2)); - a1 = 1; - b1 = 0; - c1 = 0; // x - a2 = 0; - b2 = -1; - c2 = 1; // 1-y - } -// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y"); -// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y"); - conv.a1 = a1; - conv.b1 = b1; - conv.c1 = c1; - conv.a2 = a2; - conv.b2 = b2; - conv.c2 = c2; - - int nbdown = quad.side[0]->NbPoints(); - int nbright = quad.side[1]->NbPoints(); - conv.ia = int (a1); - conv.ib = int (b1); - conv.ic = - int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1); - conv.ja = int (a2); - conv.jb = int (b2); - conv.jc = - int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1); -// MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic); -// MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc); + int a1, b1, c1, a2, b2, c2; + if (VA.IsSame(V0)) + if (VB.IsSame(V1)) + { + a1 = 1; + b1 = 0; + c1 = 0; // x + a2 = 0; + b2 = 1; + c2 = 0; // y + } + else + { + ASSERT(VB.IsSame(V3)); + a1 = 0; + b1 = 1; + c1 = 0; // y + a2 = 1; + b2 = 0; + c2 = 0; // x + } + if (VA.IsSame(V1)) + if (VB.IsSame(V2)) + { + a1 = 0; + b1 = -1; + c1 = 1; // 1-y + a2 = 1; + b2 = 0; + c2 = 0; // x + } + else + { + ASSERT(VB.IsSame(V0)); + a1 = -1; + b1 = 0; + c1 = 1; // 1-x + a2 = 0; + b2 = 1; + c2 = 0; // y + } + if (VA.IsSame(V2)) + if (VB.IsSame(V3)) + { + a1 = -1; + b1 = 0; + c1 = 1; // 1-x + a2 = 0; + b2 = -1; + c2 = 1; // 1-y + } + else + { + ASSERT(VB.IsSame(V1)); + a1 = 0; + b1 = -1; + c1 = 1; // 1-y + a2 = -1; + b2 = 0; + c2 = 1; // 1-x + } + if (VA.IsSame(V3)) + if (VB.IsSame(V0)) + { + a1 = 0; + b1 = 1; + c1 = 0; // y + a2 = -1; + b2 = 0; + c2 = 1; // 1-x + } + else + { + ASSERT(VB.IsSame(V2)); + a1 = 1; + b1 = 0; + c1 = 0; // x + a2 = 0; + b2 = -1; + c2 = 1; // 1-y + } +// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y"); +// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y"); + conv.a1 = a1; + conv.b1 = b1; + conv.c1 = c1; + conv.a2 = a2; + conv.b2 = b2; + conv.c2 = c2; + + int nbdown = quad.side[0]->NbPoints(); + int nbright = quad.side[1]->NbPoints(); + conv.ia = int (a1); + conv.ib = int (b1); + conv.ic = + int (c1 * a1 * a1) * (nbdown - 1) + int (c1 * b1 * b1) * (nbright - 1); + conv.ja = int (a2); + conv.jb = int (b2); + conv.jc = + int (c2 * a2 * a2) * (nbdown - 1) + int (c2 * b2 * b2) * (nbright - 1); +// MESSAGE("I " << conv.ia << " " << conv.ib << " " << conv.ic); +// MESSAGE("J " << conv.ja << " " << conv.jb << " " << conv.jc); } //================================================================================ @@ -1189,8 +1189,8 @@ SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh, //======================================================================= bool EvaluatePentahedralMesh(SMESH_Mesh & aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap) + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap) { StdMeshers_Penta_3D anAlgo; bool bOK = anAlgo.Evaluate(aMesh, aShape, aResMap); diff --git a/src/StdMeshers/StdMeshers_NumberOfSegments.cxx b/src/StdMeshers/StdMeshers_NumberOfSegments.cxx index e03a921e8..ce4876ee3 100644 --- a/src/StdMeshers/StdMeshers_NumberOfSegments.cxx +++ b/src/StdMeshers/StdMeshers_NumberOfSegments.cxx @@ -49,6 +49,8 @@ #include #endif +#include + using namespace std; const double PRECISION = 1e-7; @@ -233,11 +235,11 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const vector& table) #ifdef NO_CAS_CATCH OCC_CATCH_SIGNALS; #endif - val = pow( 10.0, val ); + val = pow( 10.0, val ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw SALOME_Exception( LOCALIZED( "invalid value")); - return; + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + throw SALOME_Exception( LOCALIZED( "invalid value")); + return; } } else if( _convMode==1 && val<0.0 ) @@ -303,7 +305,7 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr ) if( !name.IsNull() ) { if( name->GetName()!="t" ) - res = false; + res = false; } else res = isCorrectArg( sub ); @@ -317,10 +319,12 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr ) */ //================================================================================ bool process( const TCollection_AsciiString& str, int convMode, - bool& syntax, bool& args, - bool& non_neg, bool& non_zero, - bool& singulars, double& sing_point ) + bool& syntax, bool& args, + bool& non_neg, bool& non_zero, + bool& singulars, double& sing_point ) { + Kernel_Utils::Localizer loc; + bool parsed_ok = true; Handle( ExprIntrp_GenExp ) myExpr; try { @@ -359,19 +363,20 @@ bool process( const TCollection_AsciiString& str, int convMode, double t = double(i)/double(max), val; if( !f.value( t, val ) ) { - sing_point = t; - singulars = true; - break; + sing_point = t; + singulars = true; + break; } if( val<0 ) { - non_neg = false; - break; + non_neg = false; + break; } if( val>PRECISION ) - non_zero = true; + non_zero = true; } } + return res && non_neg && non_zero && ( !singulars ); } diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index 8ae77c241..501915676 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -77,7 +77,7 @@ typedef SMESH_Comment TComm; //============================================================================= StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, - SMESH_Gen* gen) + SMESH_Gen* gen) : SMESH_2D_Algo(hypId, studyId, gen) { MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D"); @@ -123,7 +123,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis theHyp = hyps.front(); if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) { const StdMeshers_QuadrangleParams* theHyp1 = - (const StdMeshers_QuadrangleParams*)theHyp; + (const StdMeshers_QuadrangleParams*)theHyp; myTriaVertexID = theHyp1->GetTriaVertex(); myQuadranglePreference= false; myTrianglePreference= false; @@ -144,29 +144,29 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis theHyp = hyps.front(); if(strcmp("QuadrangleParams", theHyp->GetName()) == 0) { const StdMeshers_QuadrangleParams* theHyp1 = - (const StdMeshers_QuadrangleParams*)theHyp; + (const StdMeshers_QuadrangleParams*)theHyp; myTriaVertexID = theHyp1->GetTriaVertex(); theHyp = hyps.back(); if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) { - myQuadranglePreference= true; - myTrianglePreference= false; + myQuadranglePreference= true; + myTrianglePreference= false; } else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){ - myQuadranglePreference= false; - myTrianglePreference= true; + myQuadranglePreference= false; + myTrianglePreference= true; } } else { if(strcmp("QuadranglePreference", theHyp->GetName()) == 0) { - myQuadranglePreference= true; - myTrianglePreference= false; + myQuadranglePreference= true; + myTrianglePreference= false; } else if(strcmp("TrianglePreference", theHyp->GetName()) == 0){ - myQuadranglePreference= false; - myTrianglePreference= true; + myQuadranglePreference= false; + myTrianglePreference= true; } const StdMeshers_QuadrangleParams* theHyp2 = - (const StdMeshers_QuadrangleParams*)hyps.back(); + (const StdMeshers_QuadrangleParams*)hyps.back(); myTriaVertexID = theHyp2->GetTriaVertex(); } } @@ -286,7 +286,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, d = quad->uv_grid[(j + 1) * nbhoriz + i].node; SMDS_MeshFace* face = myTool->AddFace(a, b, c, d); if(face) { - meshDS->SetMeshElementOnShape(face, geomFaceID); + meshDS->SetMeshElementOnShape(face, geomFaceID); } } } @@ -638,7 +638,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh, bool StdMeshers_Quadrangle_2D::Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, - MapShapeNbElems& aResMap) + MapShapeNbElems& aResMap) { aMesh.GetSubMesh(aShape); @@ -778,31 +778,31 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID)); if(!V.IsNull()) { - TopoDS_Edge E1,E2,E3; - for(; edgeIt != edges.end(); ++edgeIt) { - TopoDS_Edge E = TopoDS::Edge(*edgeIt); - TopoDS_Vertex VF, VL; - TopExp::Vertices(E, VF, VL, true); - if( VF.IsSame(V) ) - E1 = E; - else if( VL.IsSame(V) ) - E3 = E; - else - E2 = E; - } - quad->side.reserve(4); - quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes)); - quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes)); - quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes)); - std::vector UVPSleft = quad->side[0]->GetUVPtStruct(true,0); - std::vector UVPStop = quad->side[1]->GetUVPtStruct(false,1); - std::vector UVPSright = quad->side[2]->GetUVPtStruct(true,1); - const SMDS_MeshNode* aNode = UVPSleft[0].node; - gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v ); - StdMeshers_FaceSide* VertFS = - new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]); - quad->side.push_back(VertFS); - return quad; + TopoDS_Edge E1,E2,E3; + for(; edgeIt != edges.end(); ++edgeIt) { + TopoDS_Edge E = TopoDS::Edge(*edgeIt); + TopoDS_Vertex VF, VL; + TopExp::Vertices(E, VF, VL, true); + if( VF.IsSame(V) ) + E1 = E; + else if( VL.IsSame(V) ) + E3 = E; + else + E2 = E; + } + quad->side.reserve(4); + quad->side.push_back( new StdMeshers_FaceSide(F, E1, &aMesh, true, ignoreMediumNodes)); + quad->side.push_back( new StdMeshers_FaceSide(F, E2, &aMesh, true, ignoreMediumNodes)); + quad->side.push_back( new StdMeshers_FaceSide(F, E3, &aMesh, false, ignoreMediumNodes)); + std::vector UVPSleft = quad->side[0]->GetUVPtStruct(true,0); + std::vector UVPStop = quad->side[1]->GetUVPtStruct(false,1); + std::vector UVPSright = quad->side[2]->GetUVPtStruct(true,1); + const SMDS_MeshNode* aNode = UVPSleft[0].node; + gp_Pnt2d aPnt2d( UVPSleft[0].u, UVPSleft[0].v ); + StdMeshers_FaceSide* VertFS = + new StdMeshers_FaceSide(aNode, aPnt2d, quad->side[1]); + quad->side.push_back(VertFS); + return quad; } } return 0; @@ -900,10 +900,10 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes //============================================================================= bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, - const TopoDS_Shape & aShape, - MapShapeNbElems& aResMap, - std::vector& aNbNodes, - bool& IsQuadratic) + const TopoDS_Shape & aShape, + MapShapeNbElems& aResMap, + std::vector& aNbNodes, + bool& IsQuadratic) { const TopoDS_Face & F = TopoDS::Face(aShape); @@ -933,45 +933,45 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); TopoDS_Vertex V = TopoDS::Vertex(meshDS->IndexToShape(myTriaVertexID)); if(!V.IsNull()) { - TopoDS_Edge E1,E2,E3; - for(; edgeIt != edges.end(); ++edgeIt) { - TopoDS_Edge E = TopoDS::Edge(*edgeIt); - TopoDS_Vertex VF, VL; - TopExp::Vertices(E, VF, VL, true); - if( VF.IsSame(V) ) - E1 = E; - else if( VL.IsSame(V) ) - E3 = E; - else - E2 = E; - } - SMESH_subMesh * sm = aMesh.GetSubMesh(E1); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) return false; - std::vector aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2; - else - aNbNodes[0] = aVec[SMDSEntity_Node] + 2; - sm = aMesh.GetSubMesh(E2); - anIt = aResMap.find(sm); - if(anIt==aResMap.end()) return false; - aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2; - else - aNbNodes[1] = aVec[SMDSEntity_Node] + 2; - sm = aMesh.GetSubMesh(E3); - anIt = aResMap.find(sm); - if(anIt==aResMap.end()) return false; - aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2; - else - aNbNodes[2] = aVec[SMDSEntity_Node] + 2; - aNbNodes[3] = aNbNodes[1]; - aNbNodes.resize(5); - nbSides = 4; + TopoDS_Edge E1,E2,E3; + for(; edgeIt != edges.end(); ++edgeIt) { + TopoDS_Edge E = TopoDS::Edge(*edgeIt); + TopoDS_Vertex VF, VL; + TopExp::Vertices(E, VF, VL, true); + if( VF.IsSame(V) ) + E1 = E; + else if( VL.IsSame(V) ) + E3 = E; + else + E2 = E; + } + SMESH_subMesh * sm = aMesh.GetSubMesh(E1); + MapShapeNbElemsItr anIt = aResMap.find(sm); + if(anIt==aResMap.end()) return false; + std::vector aVec = (*anIt).second; + if(IsQuadratic) + aNbNodes[0] = (aVec[SMDSEntity_Node]-1)/2 + 2; + else + aNbNodes[0] = aVec[SMDSEntity_Node] + 2; + sm = aMesh.GetSubMesh(E2); + anIt = aResMap.find(sm); + if(anIt==aResMap.end()) return false; + aVec = (*anIt).second; + if(IsQuadratic) + aNbNodes[1] = (aVec[SMDSEntity_Node]-1)/2 + 2; + else + aNbNodes[1] = aVec[SMDSEntity_Node] + 2; + sm = aMesh.GetSubMesh(E3); + anIt = aResMap.find(sm); + if(anIt==aResMap.end()) return false; + aVec = (*anIt).second; + if(IsQuadratic) + aNbNodes[2] = (aVec[SMDSEntity_Node]-1)/2 + 2; + else + aNbNodes[2] = aVec[SMDSEntity_Node] + 2; + aNbNodes[3] = aNbNodes[1]; + aNbNodes.resize(5); + nbSides = 4; } } } @@ -980,13 +980,13 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, SMESH_subMesh * sm = aMesh.GetSubMesh( *edgeIt ); MapShapeNbElemsItr anIt = aResMap.find(sm); if(anIt==aResMap.end()) { - return false; + return false; } std::vector aVec = (*anIt).second; if(IsQuadratic) - aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2; + aNbNodes[nbSides] = (aVec[SMDSEntity_Node]-1)/2 + 2; else - aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2; + aNbNodes[nbSides] = aVec[SMDSEntity_Node] + 2; nbSides++; } } @@ -1012,16 +1012,16 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, list::iterator ite = sideEdges.begin(); aNbNodes[nbSides] = 1; for(; ite!=sideEdges.end(); ite++) { - SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) { - return false; - } - std::vector aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; - else - aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; + SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); + MapShapeNbElemsItr anIt = aResMap.find(sm); + if(anIt==aResMap.end()) { + return false; + } + std::vector aVec = (*anIt).second; + if(IsQuadratic) + aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; + else + aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; } ++nbSides; } @@ -1050,20 +1050,20 @@ bool StdMeshers_Quadrangle_2D::CheckNbEdgesForEvaluate(SMESH_Mesh& aMesh, sideEdges.splice( sideEdges.begin(), edges, --edges.end()); } } - list::iterator ite = sideEdges.begin(); - aNbNodes[nbSides] = 1; - for(; ite!=sideEdges.end(); ite++) { - SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); - MapShapeNbElemsItr anIt = aResMap.find(sm); - if(anIt==aResMap.end()) { - return false; - } - std::vector aVec = (*anIt).second; - if(IsQuadratic) - aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; - else - aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; - } + list::iterator ite = sideEdges.begin(); + aNbNodes[nbSides] = 1; + for(; ite!=sideEdges.end(); ite++) { + SMESH_subMesh * sm = aMesh.GetSubMesh( *ite ); + MapShapeNbElemsItr anIt = aResMap.find(sm); + if(anIt==aResMap.end()) { + return false; + } + std::vector aVec = (*anIt).second; + if(IsQuadratic) + aNbNodes[nbSides] += (aVec[SMDSEntity_Node]-1)/2 + 1; + else + aNbNodes[nbSides] += aVec[SMDSEntity_Node] + 1; + } ++nbSides; } } @@ -1221,11 +1221,11 @@ bool StdMeshers_Quadrangle_2D::SetNormalizedGrid (SMESH_Mesh & aMesh, for (int j = 0; j < nbvertic; j++) { int ij = j * nbhoriz + i; // --- droite i cste : x = x0 + y(x1-x0) - double x0 = uv_e0[i].normParam; // bas - sud - double x1 = uv_e2[i].normParam; // haut - nord + double x0 = uv_e0[i].normParam; // bas - sud + double x1 = uv_e2[i].normParam; // haut - nord // --- droite j cste : y = y0 + x(y1-y0) - double y0 = uv_e3[j].normParam; // gauche-ouest - double y1 = uv_e1[j].normParam; // droite - est + double y0 = uv_e3[j].normParam; // gauche-ouest + double y1 = uv_e1[j].normParam; // droite - est // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0) double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0)); double y = y0 + x * (y1 - y0); @@ -1754,7 +1754,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, int nbf=0; for(j=1; jAddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j), @@ -1867,7 +1867,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, // create faces for(j=1; j<=drl+addv; j++) { for(i=1; iAddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), @@ -1901,7 +1901,7 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, NodesLast.SetValue(nnn,1,NodesC.Value(nb,i)); } for(i=1; iAddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1), @@ -1933,8 +1933,8 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref (SMESH_Mesh & aMesh, bool StdMeshers_Quadrangle_2D::EvaluateQuadPref(SMESH_Mesh & aMesh, const TopoDS_Shape& aShape, std::vector& aNbNodes, - MapShapeNbElems& aResMap, - bool IsQuadratic) + MapShapeNbElems& aResMap, + bool IsQuadratic) { // Auxilary key in order to keep old variant // of meshing after implementation new variant diff --git a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx index fdb026293..8d21195db 100644 --- a/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cxx @@ -45,23 +45,15 @@ #include #include -//#include #include -#include -#include -//#include -//#include -//#include -//#include -//#include - - -#include +#include #include #include +#include #include #include -#include +#include +#include using namespace std; @@ -148,13 +140,167 @@ bool StdMeshers_RadialQuadrangle_1D2D::CheckHypothesis return true; } +namespace +{ + // ------------------------------------------------------------------------------ + /*! + * \brief Listener used to mark edges meshed by StdMeshers_RadialQuadrangle_1D2D + */ + class TLinEdgeMarker : public SMESH_subMeshEventListener + { + TLinEdgeMarker(): SMESH_subMeshEventListener(/*isDeletable=*/false) {} + public: + static SMESH_subMeshEventListener* getListener() + { + static TLinEdgeMarker theEdgeMarker; + return &theEdgeMarker; + } + }; + + // ------------------------------------------------------------------------------ + /*! + * \brief Mark an edge as computed by StdMeshers_RadialQuadrangle_1D2D + */ + void markLinEdgeAsComputedByMe(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) + { + if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge )) + { + if ( !edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() )) + faceSubMesh->SetEventListener( TLinEdgeMarker::getListener(), + SMESH_subMeshEventListenerData::MakeData(faceSubMesh), + edgeSM); + } + } + // ------------------------------------------------------------------------------ + /*! + * \brief Return true if a radial edge was meshed with StdMeshers_RadialQuadrangle_1D2D with + * the same radial distribution + */ + bool isEdgeCompitaballyMeshed(const TopoDS_Edge& edge, SMESH_subMesh* faceSubMesh) + { + if ( SMESH_subMesh* edgeSM = faceSubMesh->GetFather()->GetSubMeshContaining( edge )) + { + if ( SMESH_subMeshEventListenerData* otherFaceData = + edgeSM->GetEventListenerData( TLinEdgeMarker::getListener() )) + { + // compare hypothesis aplied to two disk faces sharing radial edges + SMESH_Mesh& mesh = *faceSubMesh->GetFather(); + SMESH_Algo* radialQuadAlgo = mesh.GetGen()->GetAlgo(mesh, faceSubMesh->GetSubShape() ); + SMESH_subMesh* otherFaceSubMesh = otherFaceData->mySubMeshes.front(); + const list & hyps1 = + radialQuadAlgo->GetUsedHypothesis( mesh, faceSubMesh->GetSubShape()); + const list & hyps2 = + radialQuadAlgo->GetUsedHypothesis( mesh, otherFaceSubMesh->GetSubShape()); + if( hyps1.empty() && hyps2.empty() ) + return true; // defaul hyps + if ( hyps1.size() != hyps2.size() || + strcmp( hyps1.front()->GetName(), hyps2.front()->GetName() )) + return false; + ostringstream hypDump1, hypDump2; + list ::const_iterator hyp1 = hyps1.begin(); + for ( ; hyp1 != hyps1.end(); ++hyp1 ) + const_cast(*hyp1)->SaveTo( hypDump1 ); + list ::const_iterator hyp2 = hyps2.begin(); + for ( ; hyp2 != hyps2.end(); ++hyp2 ) + const_cast(*hyp2)->SaveTo( hypDump2 ); + return hypDump1.str() == hypDump2.str(); + } + } + return false; + } + + //================================================================================ + /*! + * \brief Return base curve of the edge and extremum parameters + */ + //================================================================================ + + Handle(Geom_Curve) getCurve(const TopoDS_Edge& edge, double* f=0, double* l=0) + { + Handle(Geom_Curve) C; + if ( !edge.IsNull() ) + { + double first = 0., last = 0.; + C = BRep_Tool::Curve(edge, first, last); + if ( !C.IsNull() ) + { + Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C); + while( !tc.IsNull() ) { + C = tc->BasisCurve(); + tc = Handle(Geom_TrimmedCurve)::DownCast(C); + } + if ( f ) *f = first; + if ( l ) *l = last; + } + } + return C; + } + + //================================================================================ + /*! + * \brief Return edges of the face + * \retval int - nb of edges + */ + //================================================================================ + + int analyseFace(const TopoDS_Shape& face, + TopoDS_Edge& CircEdge, + TopoDS_Edge& LinEdge1, + TopoDS_Edge& LinEdge2) + { + CircEdge.Nullify(); LinEdge1.Nullify(); LinEdge2.Nullify(); + int nbe = 0; + + for ( TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next(), ++nbe ) + { + const TopoDS_Edge& E = TopoDS::Edge( exp.Current() ); + double f,l; + Handle(Geom_Curve) C = getCurve(E,&f,&l); + if ( !C.IsNull() ) + { + if ( C->IsKind( STANDARD_TYPE(Geom_Circle))) + { + if ( CircEdge.IsNull() ) + CircEdge = E; + else + return 0; + } + else if ( LinEdge1.IsNull() ) + LinEdge1 = E; + else + LinEdge2 = E; + } + } + return nbe; + } +} + +//======================================================================= +/*! + * \brief Allow algo to do something after persistent restoration + * \param subMesh - restored submesh + * + * call markLinEdgeAsComputedByMe() + */ +//======================================================================= + +void StdMeshers_RadialQuadrangle_1D2D::SubmeshRestored(SMESH_subMesh* faceSubMesh) +{ + if ( !faceSubMesh->IsEmpty() ) + { + TopoDS_Edge CircEdge, LinEdge1, LinEdge2; + analyseFace( faceSubMesh->GetSubShape(), CircEdge, LinEdge1, LinEdge2 ); + if ( !LinEdge1.IsNull() ) markLinEdgeAsComputedByMe( LinEdge1, faceSubMesh ); + if ( !LinEdge2.IsNull() ) markLinEdgeAsComputedByMe( LinEdge2, faceSubMesh ); + } +} //======================================================================= //function : Compute //purpose : //======================================================================= -bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, +bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) { TopExp_Explorer exp; @@ -162,33 +308,16 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, myHelper = new SMESH_MesherHelper( aMesh ); myHelper->IsQuadraticSubMesh( aShape ); + // to delete helper at exit from Compute() + auto_ptr helperDeleter( myHelper ); myLayerPositions.clear(); - TopoDS_Edge E1,E2,E3; - Handle(Geom_Curve) C1,C2,C3; - double f1,l1,f2,l2,f3,l3; - int nbe = 0; - for ( exp.Init( aShape, TopAbs_EDGE ); exp.More(); exp.Next() ) { - nbe++; - TopoDS_Edge E = TopoDS::Edge( exp.Current() ); - if(nbe==1) { - E1 = E; - C1 = BRep_Tool::Curve(E,f1,l1); - } - else if(nbe==2) { - E2 = E; - C2 = BRep_Tool::Curve(E,f2,l2); - } - else if(nbe==3) { - E3 = E; - C3 = BRep_Tool::Curve(E,f3,l3); - } - } - - if(nbe>3) + TopoDS_Edge CircEdge, LinEdge1, LinEdge2; + int nbe = analyseFace( aShape, CircEdge, LinEdge1, LinEdge2 ); + if( nbe>3 || nbe < 1 || CircEdge.IsNull() ) return error(COMPERR_BAD_SHAPE); - + gp_Pnt P0,P1; // points for rotation TColgp_SequenceOfPnt Points; @@ -196,36 +325,28 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, TColStd_SequenceOfReal Angles; // Nodes1 and Nodes2 - nodes along radiuses // CNodes - nodes on circle edge - std::vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes; + vector< const SMDS_MeshNode* > Nodes1, Nodes2, CNodes; SMDS_MeshNode * NC; // parameters edge nodes on face - TColgp_SequenceOfPnt2d Pnts2d1, Pnts2d2; + TColgp_SequenceOfPnt2d Pnts2d1; gp_Pnt2d PC; int faceID = meshDS->ShapeToIndex(aShape); TopoDS_Face F = TopoDS::Face(aShape); Handle(Geom_Surface) S = BRep_Tool::Surface(F); - // orientation - bool IsForward = F.Orientation()==TopAbs_FORWARD; - - //cout<<"RadialQuadrangle_1D2D::Compute nbe = "<Compute( aMesh, CircEdge, false, MeshDim_1D ); + bool ok = _gen->Compute( aMesh, CircEdge ); if( !ok ) return false; - std::map< double, const SMDS_MeshNode* > theNodes; + map< double, const SMDS_MeshNode* > theNodes; ok = GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); if( !ok ) return false; CNodes.clear(); - std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); + map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); const SMDS_MeshNode* NF = (*itn).second; CNodes.push_back( (*itn).second ); double fang = (*itn).first; @@ -273,88 +394,53 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, double V = PC.Y() + aVec2d.Y()*myLayerPositions[i]; meshDS->SetNodeOnFace( node, faceID, U, V ); Pnts2d1.Append(gp_Pnt2d(U,V)); - Pnts2d2.Append(gp_Pnt2d(U,V)); } Nodes1[Nodes1.size()-1] = NF; Nodes2[Nodes1.size()-1] = NF; } - else if(nbe==2) { + else if(nbe==2 && LinEdge1.Orientation() != TopAbs_INTERNAL ) + { // one curve must be a half of circle and other curve must be // a segment of line - Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - while( !tc.IsNull() ) { - C1 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - while( !tc.IsNull() ) { - C2 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - } - - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast(C2); - CircEdge = E1; - LinEdge1 = E2; - double fp = f1; - double lp = l1; - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C2); - CircEdge = E2; - LinEdge1 = E1; - fp = f2; - lp = l2; - aLine = Handle(Geom_Line)::DownCast(C3); - } - if( aCirc.IsNull() ) { - // not circle - return error(COMPERR_BAD_SHAPE); - } + double fp, lp; + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp )); if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { // not half of circle return error(COMPERR_BAD_SHAPE); } + Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); if( aLine.IsNull() ) { // other curve not line return error(COMPERR_BAD_SHAPE); } - SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); - if( sm1 ) { - SMESHDS_SubMesh* sdssm1 = sm1->GetSubMeshDS(); - if( sdssm1 ) { - if( sm1->GetSubMeshDS()->NbNodes()>0 ) { - SMESH_subMesh* sm = aMesh.GetSubMesh(F); - SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); - smError.reset(new SMESH_ComputeError(COMPERR_ALGO_FAILED, - "Invalid set of hypothesises",this)); - return false; - } - } + bool linEdgeComputed = false; + if( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1) ) { + if( !sm1->IsEmpty() ) + if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) )) + linEdgeComputed = true; + else + return error("Invalid set of hypotheses"); } - bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D ); + bool ok = _gen->Compute( aMesh, CircEdge ); if( !ok ) return false; - std::map< double, const SMDS_MeshNode* > theNodes; + map< double, const SMDS_MeshNode* > theNodes; GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); CNodes.clear(); - std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); - const SMDS_MeshNode* NF = (*itn).second; - CNodes.push_back( (*itn).second ); + map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); double fang = (*itn).first; itn++; - const SMDS_MeshNode* NL; - int nbn = 1; for(; itn != theNodes.end(); itn++ ) { - nbn++; - if( nbn == theNodes.size() ) - NL = (*itn).second; CNodes.push_back( (*itn).second ); double ang = (*itn).first - fang; if( ang>PI ) ang = ang - 2*PI; if( ang<-PI ) ang = ang + 2*PI; Angles.Append( ang ); } + const SMDS_MeshNode* NF = theNodes.begin()->second; + const SMDS_MeshNode* NL = theNodes.rbegin()->second; + CNodes.push_back( NF ); P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); gp_Pnt P2( NL->X(), NL->Y(), NL->Z() ); P0 = aCirc->Location(); @@ -362,164 +448,143 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, myLayerPositions.clear(); computeLayerPositions(P0,P1); - gp_Vec aVec(P0,P1); - int edgeID = meshDS->ShapeToIndex(LinEdge1); - // check orientation - Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); - gp_Pnt Ptmp; - Crv->D0(fp,Ptmp); - bool ori = true; - if( P1.Distance(Ptmp) > Precision::Confusion() ) - ori = false; - // get UV points for edge - gp_Pnt2d PF,PL; - BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); - PC = gp_Pnt2d( (PF.X()+PL.X())/2, (PF.Y()+PL.Y())/2 ); - gp_Vec2d V2d; - if(ori) V2d = gp_Vec2d(PC,PF); - else V2d = gp_Vec2d(PC,PL); - // add nodes on edge - double cp = (fp+lp)/2; - double dp2 = (lp-fp)/2; - NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); - meshDS->SetNodeOnEdge(NC, edgeID, cp); - Nodes1.resize( myLayerPositions.size()+1 ); - Nodes2.resize( myLayerPositions.size()+1 ); - int i = 0; - for(; iAddNode(P.X(), P.Y(), P.Z()); - Nodes1[i] = node; - double param; - if(ori) - param = fp + dp2*(1-myLayerPositions[i]); - else - param = cp + dp2*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - P = gp_Pnt( P0.X() - aVec.X()*myLayerPositions[i], - P0.Y() - aVec.Y()*myLayerPositions[i], - P0.Z() - aVec.Z()*myLayerPositions[i] ); - node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - Nodes2[i] = node; - if(!ori) - param = fp + dp2*(1-myLayerPositions[i]); - else - param = cp + dp2*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - // parameters on face - gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], - PC.Y() + V2d.Y()*myLayerPositions[i] ); - Pnts2d1.Append(P2d); - P2d = gp_Pnt2d( PC.X() - V2d.X()*myLayerPositions[i], - PC.Y() - V2d.Y()*myLayerPositions[i] ); - Pnts2d2.Append(P2d); + if ( linEdgeComputed ) + { + if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes)) + return error("Invalid mesh on a straight edge"); + + vector< const SMDS_MeshNode* > *pNodes1 = &Nodes1, *pNodes2 = &Nodes2; + bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF ); + if ( !nodesFromP0ToP1 ) std::swap( pNodes1, pNodes2 ); + + map< double, const SMDS_MeshNode* >::reverse_iterator ritn = theNodes.rbegin(); + itn = theNodes.begin(); + for ( int i = Nodes1.size()-1; i > -1; ++itn, ++ritn, --i ) + { + (*pNodes1)[i] = ritn->second; + (*pNodes2)[i] = itn->second; + Points.Append( gpXYZ( Nodes1[i])); + Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i])); + } + NC = const_cast( itn->second ); + Points.Remove( Nodes1.size() ); } - Nodes1[ myLayerPositions.size() ] = NF; - Nodes2[ myLayerPositions.size() ] = NL; - // create 1D elements on edge - std::vector< const SMDS_MeshNode* > tmpNodes; - tmpNodes.resize(2*Nodes1.size()+1); - for(i=0; iAddEdge( tmpNodes[i-1], tmpNodes[i] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + else + { + gp_Vec aVec(P0,P1); + int edgeID = meshDS->ShapeToIndex(LinEdge1); + // check orientation + Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); + gp_Pnt Ptmp; + Crv->D0(fp,Ptmp); + bool ori = true; + if( P1.Distance(Ptmp) > Precision::Confusion() ) + ori = false; + // get UV points for edge + gp_Pnt2d PF,PL; + BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); + PC = gp_Pnt2d( (PF.X()+PL.X())/2, (PF.Y()+PL.Y())/2 ); + gp_Vec2d V2d; + if(ori) V2d = gp_Vec2d(PC,PF); + else V2d = gp_Vec2d(PC,PL); + // add nodes on edge + double cp = (fp+lp)/2; + double dp2 = (lp-fp)/2; + NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); + meshDS->SetNodeOnEdge(NC, edgeID, cp); + Nodes1.resize( myLayerPositions.size()+1 ); + Nodes2.resize( myLayerPositions.size()+1 ); + int i = 0; + for(; iAddNode(P.X(), P.Y(), P.Z()); + Nodes1[i] = node; + double param; + if(ori) + param = fp + dp2*(1-myLayerPositions[i]); + else + param = cp + dp2*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + P = gp_Pnt( P0.X() - aVec.X()*myLayerPositions[i], + P0.Y() - aVec.Y()*myLayerPositions[i], + P0.Z() - aVec.Z()*myLayerPositions[i] ); + node = meshDS->AddNode(P.X(), P.Y(), P.Z()); + Nodes2[i] = node; + if(!ori) + param = fp + dp2*(1-myLayerPositions[i]); + else + param = cp + dp2*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + // parameters on face + gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], + PC.Y() + V2d.Y()*myLayerPositions[i] ); + Pnts2d1.Append(P2d); + } + Nodes1[ myLayerPositions.size() ] = NF; + Nodes2[ myLayerPositions.size() ] = NL; + // create 1D elements on edge + vector< const SMDS_MeshNode* > tmpNodes; + tmpNodes.resize(2*Nodes1.size()+1); + for(i=0; iAddEdge( tmpNodes[i-1], tmpNodes[i] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + } + markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); } } - else { // nbe==3 + else // nbe==3 or ( nbe==2 && linEdge is INTERNAL ) + { + if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL ) + LinEdge2 = LinEdge1; + // one curve must be a part of circle and other curves must be // segments of line - Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - while( !tc.IsNull() ) { - C1 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C1); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - while( !tc.IsNull() ) { - C2 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C2); - } - tc = Handle(Geom_TrimmedCurve)::DownCast(C3); - while( !tc.IsNull() ) { - C3 = tc->BasisCurve(); - tc = Handle(Geom_TrimmedCurve)::DownCast(C3); - } - - Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(C1); - Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast(C2); - Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast(C3); - CircEdge = E1; - LinEdge1 = E2; - LinEdge2 = E3; - double fp = f1; - double lp = l1; - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C2); - CircEdge = E2; - LinEdge1 = E3; - LinEdge2 = E1; - fp = f2; - lp = l2; - aLine1 = Handle(Geom_Line)::DownCast(C3); - aLine2 = Handle(Geom_Line)::DownCast(C1); - if( aCirc.IsNull() ) { - aCirc = Handle(Geom_Circle)::DownCast(C3); - CircEdge = E3; - LinEdge1 = E1; - LinEdge2 = E2; - fp = f3; - lp = l3; - aLine1 = Handle(Geom_Line)::DownCast(C1); - aLine2 = Handle(Geom_Line)::DownCast(C2); - } - } - if( aCirc.IsNull() ) { - // not circle - return error(COMPERR_BAD_SHAPE); - } + double fp, lp; + Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge )); + Handle(Geom_Line) aLine1 = Handle(Geom_Line)::DownCast( getCurve( LinEdge1 )); + Handle(Geom_Line) aLine2 = Handle(Geom_Line)::DownCast( getCurve( LinEdge2 )); if( aLine1.IsNull() || aLine2.IsNull() ) { // other curve not line return error(COMPERR_BAD_SHAPE); } - SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1); - SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2); - if( sm1 && sm2 ) { - SMESHDS_SubMesh* sdssm1 = sm1->GetSubMeshDS(); - SMESHDS_SubMesh* sdssm2 = sm2->GetSubMeshDS(); - if( sdssm1 && sdssm2 ) { - if( sm1->GetSubMeshDS()->NbNodes()>0 || sm2->GetSubMeshDS()->NbNodes()>0 ) { - SMESH_subMesh* sm = aMesh.GetSubMesh(F); - SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); - smError.reset(new SMESH_ComputeError(COMPERR_ALGO_FAILED, - "Invalid set of hypothesises",this)); - return false; - } - } - } - bool ok = _gen->Compute( aMesh, CircEdge, false, MeshDim_1D ); + bool linEdge1Computed = false; + if ( SMESH_subMesh* sm1 = aMesh.GetSubMesh(LinEdge1)) + if( !sm1->IsEmpty() ) + if( isEdgeCompitaballyMeshed( LinEdge1, aMesh.GetSubMesh(F) )) + linEdge1Computed = true; + else + return error("Invalid set of hypotheses"); + + bool linEdge2Computed = false; + if ( SMESH_subMesh* sm2 = aMesh.GetSubMesh(LinEdge2)) + if( !sm2->IsEmpty() ) + if( isEdgeCompitaballyMeshed( LinEdge2, aMesh.GetSubMesh(F) )) + linEdge2Computed = true; + else + return error("Invalid set of hypotheses"); + + bool ok = _gen->Compute( aMesh, CircEdge ); if( !ok ) return false; - std::map< double, const SMDS_MeshNode* > theNodes; + map< double, const SMDS_MeshNode* > theNodes; GetSortedNodesOnEdge(aMesh.GetMeshDS(),CircEdge,true,theNodes); + const SMDS_MeshNode* NF = theNodes.begin()->second; + const SMDS_MeshNode* NL = theNodes.rbegin()->second; CNodes.clear(); - std::map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); - const SMDS_MeshNode* NF = (*itn).second; - CNodes.push_back( (*itn).second ); + CNodes.push_back( NF ); + map< double, const SMDS_MeshNode* >::iterator itn = theNodes.begin(); double fang = (*itn).first; itn++; - const SMDS_MeshNode* NL; - int nbn = 1; for(; itn != theNodes.end(); itn++ ) { - nbn++; - if( nbn == theNodes.size() ) - NL = (*itn).second; CNodes.push_back( (*itn).second ); double ang = (*itn).first - fang; if( ang>PI ) ang = ang - 2*PI; @@ -533,6 +598,9 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, myLayerPositions.clear(); computeLayerPositions(P0,P1); + Nodes1.resize( myLayerPositions.size()+1 ); + Nodes2.resize( myLayerPositions.size()+1 ); + exp.Init( LinEdge1, TopAbs_VERTEX ); TopoDS_Vertex V1 = TopoDS::Vertex( exp.Current() ); exp.Next(); @@ -540,119 +608,169 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, gp_Pnt PE1 = BRep_Tool::Pnt(V1); gp_Pnt PE2 = BRep_Tool::Pnt(V2); if( ( P1.Distance(PE1) > Precision::Confusion() ) && - ( P1.Distance(PE2) > Precision::Confusion() ) ) { - TopoDS_Edge E = LinEdge1; - LinEdge1 = LinEdge2; - LinEdge2 = E; + ( P1.Distance(PE2) > Precision::Confusion() ) ) + { + std::swap( LinEdge1, LinEdge2 ); + std::swap( linEdge1Computed, linEdge2Computed ); } - TopoDS_Vertex VC; + TopoDS_Vertex VC = V2; if( ( P1.Distance(PE1) > Precision::Confusion() ) && - ( P2.Distance(PE1) > Precision::Confusion() ) ) { + ( P2.Distance(PE1) > Precision::Confusion() ) ) VC = V1; - } - else VC = V2; int vertID = meshDS->ShapeToIndex(VC); + // LinEdge1 - int edgeID = meshDS->ShapeToIndex(LinEdge1); - gp_Vec aVec(P0,P1); - // check orientation - Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); - gp_Pnt Ptmp; - Crv->D0(fp,Ptmp); - bool ori = false; - if( P1.Distance(Ptmp) > Precision::Confusion() ) - ori = true; - // get UV points for edge - gp_Pnt2d PF,PL; - BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); - gp_Vec2d V2d; - if(ori) { - V2d = gp_Vec2d(PF,PL); - PC = PF; - } - else { - V2d = gp_Vec2d(PL,PF); - PC = PL; - } - NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); - meshDS->SetNodeOnVertex(NC, vertID); - double dp = lp-fp; - Nodes1.resize( myLayerPositions.size()+1 ); - int i = 0; - for(; iAddNode(P.X(), P.Y(), P.Z()); - Nodes1[i] = node; - double param; - if(!ori) - param = fp + dp*(1-myLayerPositions[i]); - else - param = fp + dp*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - // parameters on face - gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], - PC.Y() + V2d.Y()*myLayerPositions[i] ); - Pnts2d1.Append(P2d); + if ( linEdge1Computed ) + { + if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge1,true,theNodes)) + return error("Invalid mesh on a straight edge"); + + bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF ); + NC = const_cast + ( nodesFromP0ToP1 ? theNodes.begin()->second : theNodes.rbegin()->second ); + int i = 0, ir = Nodes1.size()-1; + int * pi = nodesFromP0ToP1 ? &i : &ir; + itn = theNodes.begin(); + if ( nodesFromP0ToP1 ) ++itn; + for ( ; i < Nodes1.size(); ++i, --ir, ++itn ) + { + Nodes1[*pi] = itn->second; + } + for ( i = 0; i < Nodes1.size()-1; ++i ) + { + Points.Append( gpXYZ( Nodes1[i])); + Pnts2d1.Append( myHelper->GetNodeUV( F, Nodes1[i])); + } } - Nodes1[ myLayerPositions.size() ] = NF; - // create 1D elements on edge - SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); - for(i=1; iAddEdge( Nodes1[i-1], Nodes1[i] ); + else + { + int edgeID = meshDS->ShapeToIndex(LinEdge1); + gp_Vec aVec(P0,P1); + // check orientation + Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge1,fp,lp); + gp_Pnt Ptmp = Crv->Value(fp); + bool ori = false; + if( P1.Distance(Ptmp) > Precision::Confusion() ) + ori = true; + // get UV points for edge + gp_Pnt2d PF,PL; + BRep_Tool::UVPoints( LinEdge1, TopoDS::Face(aShape), PF, PL ); + gp_Vec2d V2d; + if(ori) { + V2d = gp_Vec2d(PF,PL); + PC = PF; + } + else { + V2d = gp_Vec2d(PL,PF); + PC = PL; + } + NC = const_cast( VertexNode( VC, meshDS )); + if ( !NC ) + { + NC = meshDS->AddNode(P0.X(), P0.Y(), P0.Z()); + meshDS->SetNodeOnVertex(NC, vertID); + } + double dp = lp-fp; + int i = 0; + for(; iAddNode(P.X(), P.Y(), P.Z()); + Nodes1[i] = node; + double param; + if(!ori) + param = fp + dp*(1-myLayerPositions[i]); + else + param = fp + dp*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + // parameters on face + gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], + PC.Y() + V2d.Y()*myLayerPositions[i] ); + Pnts2d1.Append(P2d); + } + Nodes1[ myLayerPositions.size() ] = NF; + // create 1D elements on edge + SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] ); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + for(i=1; iAddEdge( Nodes1[i-1], Nodes1[i] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + } + if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL ) + Nodes2 = Nodes1; } + markLinEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F )); + // LinEdge2 - edgeID = meshDS->ShapeToIndex(LinEdge2); - aVec = gp_Vec(P0,P2); - // check orientation - Crv = BRep_Tool::Curve(LinEdge2,fp,lp); - Crv->D0(fp,Ptmp); - ori = false; - if( P2.Distance(Ptmp) > Precision::Confusion() ) - ori = true; - // get UV points for edge - BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL ); - if(ori) { - V2d = gp_Vec2d(PF,PL); - PC = PF; - } - else { - V2d = gp_Vec2d(PL,PF); - PC = PL; - } - dp = lp-fp; - Nodes2.resize( myLayerPositions.size()+1 ); - for(i=0; iAddNode(P.X(), P.Y(), P.Z()); - Nodes2[i] = node; - double param; - if(!ori) - param = fp + dp*(1-myLayerPositions[i]); - else - param = fp + dp*myLayerPositions[i]; - meshDS->SetNodeOnEdge(node, edgeID, param); - // parameters on face - gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], - PC.Y() + V2d.Y()*myLayerPositions[i] ); - Pnts2d2.Append(P2d); + if ( linEdge2Computed ) + { + if (!GetSortedNodesOnEdge(aMesh.GetMeshDS(),LinEdge2,true,theNodes)) + return error("Invalid mesh on a straight edge"); + + bool nodesFromP0ToP2 = ( theNodes.rbegin()->second == NL ); + int i = 0, ir = Nodes1.size()-1; + int * pi = nodesFromP0ToP2 ? &i : &ir; + itn = theNodes.begin(); + if ( nodesFromP0ToP2 ) ++itn; + for ( ; i < Nodes2.size(); ++i, --ir, ++itn ) + Nodes2[*pi] = itn->second; } - Nodes2[ myLayerPositions.size() ] = NL; - // create 1D elements on edge - ME = myHelper->AddEdge( NC, Nodes2[0] ); - if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); - for(i=1; iAddEdge( Nodes2[i-1], Nodes2[i] ); + else + { + int edgeID = meshDS->ShapeToIndex(LinEdge2); + gp_Vec aVec = gp_Vec(P0,P2); + // check orientation + Handle(Geom_Curve) Crv = BRep_Tool::Curve(LinEdge2,fp,lp); + gp_Pnt Ptmp = Crv->Value(fp); + bool ori = false; + if( P2.Distance(Ptmp) > Precision::Confusion() ) + ori = true; + // get UV points for edge + gp_Pnt2d PF,PL; + BRep_Tool::UVPoints( LinEdge2, TopoDS::Face(aShape), PF, PL ); + gp_Vec2d V2d; + if(ori) { + V2d = gp_Vec2d(PF,PL); + PC = PF; + } + else { + V2d = gp_Vec2d(PL,PF); + PC = PL; + } + double dp = lp-fp; + for(int i=0; iAddNode(P.X(), P.Y(), P.Z()); + Nodes2[i] = node; + double param; + if(!ori) + param = fp + dp*(1-myLayerPositions[i]); + else + param = fp + dp*myLayerPositions[i]; + meshDS->SetNodeOnEdge(node, edgeID, param); + // parameters on face + gp_Pnt2d P2d( PC.X() + V2d.X()*myLayerPositions[i], + PC.Y() + V2d.Y()*myLayerPositions[i] ); + } + Nodes2[ myLayerPositions.size() ] = NL; + // create 1D elements on edge + SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes2[0] ); if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + for(int i=1; iAddEdge( Nodes2[i-1], Nodes2[i] ); + if(ME) meshDS->SetMeshElementOnShape(ME, edgeID); + } } + markLinEdgeAsComputedByMe( LinEdge2, aMesh.GetSubMesh( F )); } + // orientation + bool IsForward = ( CircEdge.Orientation()==TopAbs_FORWARD ); + // create nodes and mesh elements on face // find axis of rotation gp_Pnt P2 = gp_Pnt( CNodes[1]->X(), CNodes[1]->Y(), CNodes[1]->Z() ); @@ -664,7 +782,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, //cout<<"Angles.Length() = "< #include +#include using namespace std; @@ -757,7 +758,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, double an = _value[ END_LENGTH_IND ]; double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 ); - int n = int( 1 + ( an - a1 ) / q ); + int n = int(fabs(q) > numeric_limits::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 )); double U1 = theReverse ? l : f; double Un = theReverse ? f : l; @@ -1032,7 +1033,7 @@ bool StdMeshers_Regular_1D::Evaluate(SMESH_Mesh & theMesh, if ( _hypType == NONE ) return false; - SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); + //SMESHDS_Mesh * meshDS = theMesh.GetMeshDS(); const TopoDS_Edge & EE = TopoDS::Edge(theShape); TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); diff --git a/src/StdMeshersGUI/Makefile.am b/src/StdMeshersGUI/Makefile.am index fbc244b0f..e8a194771 100644 --- a/src/StdMeshersGUI/Makefile.am +++ b/src/StdMeshersGUI/Makefile.am @@ -96,8 +96,7 @@ libStdMeshersGUI_la_LDFLAGS = \ ../SMESHGUI/libSMESH.la \ ../OBJECT/libSMESHObject.la \ $(GUI_LDFLAGS) -lSalomeApp \ - $(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools \ - $(QWT_LIBS) + $(CAS_LDPATH) -lTKernel -lTKBO -lTKAdvTools # resources files nodist_salomeres_DATA= \ diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx index ead8d1c3d..e26ffd7e1 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx @@ -50,6 +50,8 @@ # include #endif +#include + StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h ) : QwtPlot( p ), myPoints( 50 ), @@ -60,6 +62,7 @@ StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers:: myIsDone( true ), myNbSeg( 1 ) { + Kernel_Utils::Localizer loc; myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h ); myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" ); myDensity = new QwtPlotCurve( QString() ); @@ -200,6 +203,7 @@ bool StdMeshersGUI_DistrPreview::createTable( SMESH::double_array& func ) void StdMeshersGUI_DistrPreview::update() { + Kernel_Utils::Localizer loc; SMESH::double_array graph, distr; if( isTableFunc() ) { @@ -343,6 +347,7 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr ) bool StdMeshersGUI_DistrPreview::init( const QString& str ) { + Kernel_Utils::Localizer loc; bool parsed_ok = true; try { #ifdef NO_CAS_CATCH diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 690507e21..0d72900dc 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -384,6 +384,12 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 ); ok = ( w && w->IsOk() ); } + else if ( hypType() == "QuadrangleParams" ) + { + StdMeshersGUI_SubShapeSelectorWdg* w = + widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); + ok = ( w->GetListSize() > 0 ); + } return ok; } @@ -604,11 +610,11 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const StdMeshersGUI_SubShapeSelectorWdg* w = widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); if (w) { - if( int id = w->GetListOfIDs()[0] ) { - h->SetTriaVertex( id ); + if( w->GetListSize() > 0 ) { + h->SetTriaVertex( w->GetListOfIDs()[0] ); // getlist must be called once + const char * entry = w->GetMainShapeEntry(); + h->SetObjectEntry( entry ); } - const char * entry = w->GetMainShapeEntry(); - h->SetObjectEntry( entry ); } } } @@ -1122,7 +1128,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" ); types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" ); types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" ); - types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS" ); + types.insert( "NumberOfLayers2D", "NUMBER_OF_LAYERS_2D" ); types.insert( "LayerDistribution2D", "LAYER_DISTRIBUTION" ); types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" ); types.insert( "MaxLength", "MAX_LENGTH" ); diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx index ba9bd7e3e..65b99514e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.cxx @@ -82,7 +82,8 @@ StdMeshersGUI_SubShapeSelectorWdg ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ): QWidget( parent ), - myPreviewActor( 0 ) + myPreviewActor( 0 ), + myMaxSize( 0 ) { QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); @@ -105,7 +106,6 @@ StdMeshersGUI_SubShapeSelectorWdg setLayout( edgesLayout ); setMinimumWidth( 300 ); - myMaxSize = 1000; mySubShType = TopAbs_EDGE; init(); @@ -270,7 +270,7 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd() return; myListWidget->blockSignals( true ); - for (int i = 0; i < mySelectedIDs.size(); i++) { + for (int i = 0; i < mySelectedIDs.size() && (myMaxSize < 1 || myListOfIDs.size() < myMaxSize); i++) { if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) { QString anID = QString(" %1").arg( mySelectedIDs.at(i) ); @@ -281,11 +281,8 @@ void StdMeshersGUI_SubShapeSelectorWdg::onAdd() } } onListSelectionChanged(); - myListWidget->blockSignals( false ); - - if( myListOfIDs.size() >= myMaxSize ) - myAddButton->setEnabled( false ); + myAddButton->setEnabled( myListOfIDs.size() < myMaxSize ); } //================================================================================= diff --git a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h index 48f4bc8ce..49e49e82a 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_SubShapeSelectorWdg.h @@ -77,6 +77,8 @@ public: void showPreview ( bool ); + int GetListSize() { return myListOfIDs.size(); } + void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; } void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; } diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts index 7dc80991b..7438aa85e 100644 --- a/src/StdMeshersGUI/StdMeshers_images.ts +++ b/src/StdMeshersGUI/StdMeshers_images.ts @@ -73,6 +73,10 @@ ICON_DLG_NUMBER_OF_LAYERS mesh_hypo_layer_distribution.png + + ICON_DLG_NUMBER_OF_LAYERS_2D + mesh_hypo_layer_distribution.png + ICON_DLG_PROJECTION_SOURCE_1D mesh_hypo_source_edge.png diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.ts b/src/StdMeshersGUI/StdMeshers_msg_en.ts index caabb7f54..0a8ca42f4 100644 --- a/src/StdMeshersGUI/StdMeshers_msg_en.ts +++ b/src/StdMeshersGUI/StdMeshers_msg_en.ts @@ -221,10 +221,18 @@ SMESH_NUMBER_OF_LAYERS_HYPOTHESIS Radial Prism Parameter + + SMESH_NUMBER_OF_LAYERS_2D_HYPOTHESIS + Radial Quadrangle Parameter + SMESH_NUMBER_OF_LAYERS_TITLE Hypothesis Construction + + SMESH_NUMBER_OF_LAYERS_2D_TITLE + Hypothesis Construction + SMESH_PROJECTION_SOURCE_1D_HYPOTHESIS Projection Source 1D -- 2.30.2