From 899f23e83ef643a97bf33f744f8fde86c58a845f Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 1 Jun 2006 11:43:03 +0000 Subject: [PATCH] This commit was generated by cvs2git to create branch 'WPdev'. Cherrypick from master 2006-06-01 11:42:55 UTC jfa 'Join modifications from branch BR_DEBUG_3_2_0b1': NETGENPLUGIN_version.h.in adm_local/Makefile.in adm_local/unix/config_files/check_NETGENPLUGIN.m4 bin/VERSION.in resources/mesh_algo_netgen_2d.png resources/mesh_algo_netgen_2d3d.png resources/mesh_hypo_netgen.png resources/mesh_hypo_netgen_2d.png resources/mesh_tree_algo_netgen_2d.png resources/mesh_tree_algo_netgen_2d3d.png resources/mesh_tree_hypo_netgen.png resources/mesh_tree_hypo_netgen_2d.png src/GUI/Makefile.in src/GUI/NETGENPluginGUI.cxx src/GUI/NETGENPluginGUI_HypothesisCreator.cxx src/GUI/NETGENPluginGUI_HypothesisCreator.h src/GUI/NETGENPlugin_images.po src/GUI/NETGENPlugin_msg_en.po src/NETGEN/netgen45ForSalome.patch src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cxx src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx src/NETGENPlugin/NETGENPlugin_Mesher.cxx src/NETGENPlugin/NETGENPlugin_Mesher.hxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D.hxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.hxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.cxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.hxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.hxx --- NETGENPLUGIN_version.h.in | 34 ++ adm_local/Makefile.in | 60 +++ .../unix/config_files/check_NETGENPLUGIN.m4 | 132 ++++++ bin/VERSION.in | 1 + resources/mesh_algo_netgen_2d.png | Bin 0 -> 250 bytes resources/mesh_algo_netgen_2d3d.png | Bin 0 -> 250 bytes resources/mesh_hypo_netgen.png | Bin 0 -> 616 bytes resources/mesh_hypo_netgen_2d.png | Bin 0 -> 536 bytes resources/mesh_tree_algo_netgen_2d.png | Bin 0 -> 225 bytes resources/mesh_tree_algo_netgen_2d3d.png | Bin 0 -> 278 bytes resources/mesh_tree_hypo_netgen.png | Bin 0 -> 278 bytes resources/mesh_tree_hypo_netgen_2d.png | Bin 0 -> 225 bytes src/GUI/Makefile.in | 74 +++ src/GUI/NETGENPluginGUI.cxx | 45 ++ src/GUI/NETGENPluginGUI_HypothesisCreator.cxx | 345 ++++++++++++++ src/GUI/NETGENPluginGUI_HypothesisCreator.h | 90 ++++ src/GUI/NETGENPlugin_images.po | 59 +++ src/GUI/NETGENPlugin_msg_en.po | 84 ++++ src/NETGEN/netgen45ForSalome.patch | 202 ++++++++ src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx | 364 +++++++++++++++ src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx | 111 +++++ .../NETGENPlugin_Hypothesis_2D.cxx | 104 +++++ .../NETGENPlugin_Hypothesis_2D.hxx | 57 +++ .../NETGENPlugin_Hypothesis_2D_i.cxx | 126 +++++ .../NETGENPlugin_Hypothesis_2D_i.hxx | 64 +++ .../NETGENPlugin_Hypothesis_i.cxx | 297 ++++++++++++ .../NETGENPlugin_Hypothesis_i.hxx | 82 ++++ src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 442 ++++++++++++++++++ src/NETGENPlugin/NETGENPlugin_Mesher.hxx | 59 +++ src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx | 171 +++++++ src/NETGENPlugin/NETGENPlugin_NETGEN_2D.hxx | 61 +++ src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cxx | 173 +++++++ src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.hxx | 61 +++ .../NETGENPlugin_NETGEN_2D3D_i.cxx | 81 ++++ .../NETGENPlugin_NETGEN_2D3D_i.hxx | 55 +++ src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx | 81 ++++ src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.hxx | 55 +++ 37 files changed, 3570 insertions(+) create mode 100644 NETGENPLUGIN_version.h.in create mode 100644 adm_local/Makefile.in create mode 100644 adm_local/unix/config_files/check_NETGENPLUGIN.m4 create mode 100755 bin/VERSION.in create mode 100644 resources/mesh_algo_netgen_2d.png create mode 100644 resources/mesh_algo_netgen_2d3d.png create mode 100644 resources/mesh_hypo_netgen.png create mode 100644 resources/mesh_hypo_netgen_2d.png create mode 100755 resources/mesh_tree_algo_netgen_2d.png create mode 100644 resources/mesh_tree_algo_netgen_2d3d.png create mode 100644 resources/mesh_tree_hypo_netgen.png create mode 100644 resources/mesh_tree_hypo_netgen_2d.png create mode 100644 src/GUI/Makefile.in create mode 100755 src/GUI/NETGENPluginGUI.cxx create mode 100644 src/GUI/NETGENPluginGUI_HypothesisCreator.cxx create mode 100644 src/GUI/NETGENPluginGUI_HypothesisCreator.h create mode 100755 src/GUI/NETGENPlugin_images.po create mode 100755 src/GUI/NETGENPlugin_msg_en.po create mode 100644 src/NETGEN/netgen45ForSalome.patch create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Mesher.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_Mesher.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.hxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx create mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.hxx diff --git a/NETGENPLUGIN_version.h.in b/NETGENPLUGIN_version.h.in new file mode 100644 index 0000000..349432e --- /dev/null +++ b/NETGENPLUGIN_version.h.in @@ -0,0 +1,34 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// +// File : NETGENPLUGIN_version.h +// Author : Vadim SANDLER +// Module : SALOME + +#if !defined(__NETGENPLUGIN_VERSION_H__) +#define __NETGENPLUGIN_VERSION_H__ + +/* + NETGENPLUGIN_VERSION is (major << 16) + (minor << 8) + patch. +*/ + +#define NETGENPLUGIN_VERSION_STR "@VERSION@" +#define NETGENPLUGIN_VERSION @XVERSION@ + +#endif // __NETGENPLUGIN_VERSION_H__ diff --git a/adm_local/Makefile.in b/adm_local/Makefile.in new file mode 100644 index 0000000..8e8c657 --- /dev/null +++ b/adm_local/Makefile.in @@ -0,0 +1,60 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:$(srcdir)/adm_local + + +all: resources + +install: + cp -rf @top_srcdir@/adm_local @prefix@ + +bin: + +resources : + cp -rf @top_srcdir@/adm_local $(top_builddir) + +inc: + +lib: + +depend: + +depend_idl: + +install-end: + +install-include: + +install-bin: + +uninstall: + +uninstall-idl: + +distclean: + +clean: + +distclean-other: + diff --git a/adm_local/unix/config_files/check_NETGENPLUGIN.m4 b/adm_local/unix/config_files/check_NETGENPLUGIN.m4 new file mode 100644 index 0000000..1838cde --- /dev/null +++ b/adm_local/unix/config_files/check_NETGENPLUGIN.m4 @@ -0,0 +1,132 @@ +AC_DEFUN([CHECK_NETGEN],[ + +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl + +AC_CHECKING(for Netgen 4.5 and higher Libraries) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +AC_ARG_WITH(netgen, + [ --with-netgen=DIR root directory path of NETGEN installation], + NETGEN_HOME=$withval,NETGEN_HOME="") + +NETGEN_INCLUDES="" +NETGEN_LIBS_DIR="" + +Netgen_ok=no + +if test "x$NETGEN_HOME" == "x" ; then + +# no --with-netgen option used + if test "x$NETGENHOME" != "x" ; then + + # NETGENHOME environment variable defined + NETGEN_HOME=$NETGENHOME + + fi +# +fi + +if test "x$NETGEN_HOME" != "x"; then + + echo + echo + echo ------------------------------------------------- + echo You are about to choose to use somehow the + echo Netgen Library to generate Tetrahedric mesh. + echo + echo WARNING + echo ---------------------------------------------------------- + echo ---------------------------------------------------------- + echo You are strongly advised to consult the file + echo NETGENPLUGIN_SRC/src/ReadMeForNgUsers, particularly about + echo assumptions made on the installation of the Netgen + echo application and libraries. + echo Ask your system administrator for those details. + echo ---------------------------------------------------------- + echo ---------------------------------------------------------- + echo + echo + + + + NETGEN_INCLUDES="-I$NETGEN_HOME/include" + NETGEN_LIBS_DIR="$NETGEN_HOME/lib/LINUX" + + CPPFLAGS_old="$CPPFLAGS" + CXXFLAGS_old="$CXXFLAGS" + CPPFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CPPFLAGS" + CXXFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CXXFLAGS" + + AC_MSG_CHECKING(for Netgen header file) + + AC_CHECK_HEADER(nglib.h,Netgen_ok=yes,Netgen_ok=no) + if test "x$Netgen_ok" == "xyes"; then + + AC_MSG_CHECKING(for Netgen libraries) + + LDFLAGS_old="$LDFLAGS" + LDFLAGS="-L. -lNETGEN $CAS_LDPATH -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo $LDFLAGS" + + AC_TRY_COMPILE(#include +#include +namespace nglib { +#include "nglib.h" +} +#define OCCGEOMETRY +#include +,nglib::Ng_Init(); + netgen::OCCGeometry occgeo; + nglib::Ng_Exit();,Netgen_ok=yes;ar x "$NETGEN_LIBS_DIR/libnginterface.a"; + ar x "$NETGEN_LIBS_DIR/libocc.a"; + ar x "$NETGEN_LIBS_DIR/libcsg.a"; + ar x "$NETGEN_LIBS_DIR/libgprim.a"; + ar x "$NETGEN_LIBS_DIR/libmesh.a"; + ar x "$NETGEN_LIBS_DIR/libopti.a"; + ar x "$NETGEN_LIBS_DIR/libgen.a"; + ar x "$NETGEN_LIBS_DIR/libla.a"; + ar x "$NETGEN_LIBS_DIR/libstlgeom.a"; + ar x "$NETGEN_LIBS_DIR/libgeom2d.a"; + $CXX -shared linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o -o libNETGEN.so; + rm -rf linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o csgparser.o dynamicmem.o extrusion.o occconstruction.o parthreads.o readuser.o writeabaqus.o writediffpack.o writeelmer.o writefeap.o writefluent.o writegmsh.o writejcm.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o, + Netgen_ok=no) + + AC_CACHE_VAL(salome_netgen_lib,[ + AC_TRY_LINK( +#include +#include +namespace nglib { +#include "nglib.h" +} +#define OCCGEOMETRY +#include +,nglib::Ng_Init(); + netgen::OCCGeometry occgeo; + nglib::Ng_Exit();, + eval "salome_netgen_lib=yes";rm -rf libNETGEN.so,eval "salome_netgen_lib=no";rm -rf libNETGEN.so) + ]) + Netgen_ok="$salome_netgen_lib" + + + LDFLAGS="$LDFLAGS_old" + fi + + CPPFLAGS="$CPPFLAGS_old" + CXXFLAGS="$CXXFLAGS_old" + + if test "x$Netgen_ok" == xno ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(Netgen libraries not found or not properly installed) + else + AC_MSG_RESULT(yes) + fi +fi + +AC_SUBST(NETGEN_INCLUDES) +AC_SUBST(NETGEN_LIBS_DIR) + +AC_LANG_RESTORE + +])dnl diff --git a/bin/VERSION.in b/bin/VERSION.in new file mode 100755 index 0000000..b5e9383 --- /dev/null +++ b/bin/VERSION.in @@ -0,0 +1 @@ +THIS IS SALOME - NETGENPLUGIN VERSION: @VERSION@ diff --git a/resources/mesh_algo_netgen_2d.png b/resources/mesh_algo_netgen_2d.png new file mode 100644 index 0000000000000000000000000000000000000000..2629a2b594fabede3e57ca1c5eafa11ce8b3d299 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`kNVGw3Kp1&dmD7ePc z#WAE}&fUp|d@Tk%EPpHR9Z>dLQ?8v)X z$^0-*p+ki$M4yfCG1uyKva2e8>P^siaNvQZXZF=4V$T}av=y?le>*5v!FKw<%-R*c z%Qw6<-pMArqg|{~DAhYjdTwm?`}+adLQ?8v)X z$^0-*p+ki$M4yfCG1uyKva2e8>P^siaNvQZXZF=4V$T}av=y?le>*5v!FKw<%-R*c z%Qw6<-pMArqg|{~DAhYjdTwm?`}+agk0*WI5 zYK&P=DhHv(ok~os#Qtm3x^86>yemH)59hsgylw%-5w$PvREIIfYF)Q-`fH7We5-B-}HkHZ%;m1IbZ_q{%pYlPG9F?n-(n>+z0&(EC&>c_wn@oZe_JbH65Rw zS9n*crw5Y(iX$o#pYX0S_t~=-@pm}yX>vn~;)vESZJs|7=D9u}E-L)$PGAMbK??wt za*0y8^e9MDc4CVqgi{EoO8^Rwc}@pa)+^iv9qxiIrfIC)J^UX_pJp>T<@kMCfK_W$ zb7gI-I<%g2zv*ZY>djVZ`}|ByXP1{pwy6u_^N)dZB=aV3 z7HtuZwVoH(=RA?lO6M{Ur^A3`@51w6OqMg*^U9^Xxz8>iA3}hJ1JH3?hz@kZ1JZe- zV@$uTWzP+X6hlvuzX;O6<5M47uv+`D+D{a+)Wp)~S9e25+N&#;vw-+C%=tLblcX}r zMnnNU2cFNj1ehf|Ps}+`9eAEBQD-=9{t6Q)0V9fs^Ur`chQ(PvZUMq5=4>{dB(?W% zH}Kuv6#56+XGTFFrhD*?qwu*3XUIFT+i;RnxdgVPKx{h$n*>8~K*F{{3S&^0Ln*v* z65_}Ew8*qhyDBlFWKuBJPe=N)DQKA~fXYdPEy5fpVZzaZLqyBl257fBplVrYBLib{ zy1lDON@2-|G-n}Ykg22Ha=|iVz~K=V`;kzKq-6$%*9TeC2vHUzFijhNQUciK>cA#V zcr3_N0IFmzx}z#I$MNpm-nZZtyeri){b- a1^fXkxYyqogPPR<0000z literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_algo_netgen_2d.png b/resources/mesh_tree_algo_netgen_2d.png new file mode 100755 index 0000000000000000000000000000000000000000..092eae3c049d4e0190e7bee44dd45172f8234d25 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwOg_WC4@=NFA<3OQ2PZ!4!iOX{*9ppWrz{5PZtJH|g zSTQY0gw4x7w^Kk-v+nnS8v-ouy9!o_lubINwqT2?#@1Vm3_CaMDm2=^EFdKJT7mE4psdQ$ z-6Y5-Q9-heuUp3sl~+H>~rToA)Pq!JRcbY~o};nfq4fXC4-u RA_a6VgQu&X%Q~loCIB=OUwZ%m literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_hypo_netgen.png b/resources/mesh_tree_hypo_netgen.png new file mode 100644 index 0000000000000000000000000000000000000000..ad5e9f3c4c3bde47d12ecc2b38ad11c3f05c041e GIT binary patch literal 278 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o{+5N5n|x9$&6kiEpy*OmPm3oD7mE4psdQ$ z-6Y5-Q9-heuUp3sl~+H>~rToA)Pq!JRcbY~o};nfq4fXC4-u RA_a6VgQu&X%Q~loCIDO<>&kwOg_WC4$+d~=F;FPa)5S4F;_}={2YC-D@G#HqDmCIV zR!mD0Ve_)j?G#Ydtowc7h5(EEu7VXJWs^>+E!bkJvGo=s!_E!63XS$J3kb2US=X&Y;r!<9S4xBy= Pw3)%v)z4*}Q$iB}xc5qt literal 0 HcmV?d00001 diff --git a/src/GUI/Makefile.in b/src/GUI/Makefile.in new file mode 100644 index 0000000..d12da02 --- /dev/null +++ b/src/GUI/Makefile.in @@ -0,0 +1,74 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# File : Makefile.in +# Author : Michael Sazonov +# Module : NETGENPLUGIN +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${GUI_ROOT_DIR}/idl/salome:${GEOM_ROOT_DIR}/idl/salome:${SMESH_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + +@COMMENCE@ + +# .po files to transform in .qm +PO_FILES = \ + NETGENPlugin_images.po \ + NETGENPlugin_msg_en.po + +# Libraries targets +LIB = libNETGENPluginGUI.la + +LIB_SRC = \ + NETGENPluginGUI.cxx \ + NETGENPluginGUI_HypothesisCreator.cxx + +LIB_MOC = \ + NETGENPluginGUI_HypothesisCreator.h + +LIB_CLIENT_IDL = \ + SALOME_Exception.idl \ + SALOME_GenericObj.idl \ + SALOME_Component.idl \ + SALOME_Comm.idl \ + GEOM_Gen.idl \ + MED.idl \ + SMESH_Gen.idl \ + SMESH_Mesh.idl \ + SMESH_Group.idl \ + NETGENPlugin_Algorithm.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \ + -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \ + -I${GEOM_ROOT_DIR}/include/salome -I${SMESH_ROOT_DIR}/include/salome \ + $(BOOST_CPPFLAGS) +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \ + -I${GEOM_ROOT_DIR}/include/salome -I${SMESH_ROOT_DIR}/include/salome + +LDFLAGS += -lSMESH $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome \ + -L${GUI_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome \ + -L${SMESH_ROOT_DIR}/lib/salome + +@CONCLUDE@ diff --git a/src/GUI/NETGENPluginGUI.cxx b/src/GUI/NETGENPluginGUI.cxx new file mode 100755 index 0000000..47fd3c0 --- /dev/null +++ b/src/GUI/NETGENPluginGUI.cxx @@ -0,0 +1,45 @@ +// NETGENPlugin GUI: GUI for plugged-in mesher NETGENPlugin +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : NETGENPluginGUI.cxx +// Author : Michael Zorin +// Module : NETGENPlugin +// $Header: + +//#include "SMESHGUI_Hypotheses.h" +#include "NETGENPluginGUI_HypothesisCreator.h" + +//============================================================================= +/*! GetHypothesisCreator + * + */ +//============================================================================= +extern "C" +{ + SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType ) + { + SMESHGUI_GenericHypothesisCreator* aCreator = NULL; + if( aHypType=="NETGEN_Parameters_2D" || aHypType=="NETGEN_Parameters" ) + aCreator = new NETGENPluginGUI_HypothesisCreator( aHypType ); + return aCreator; + } +} diff --git a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx new file mode 100644 index 0000000..5da2f11 --- /dev/null +++ b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx @@ -0,0 +1,345 @@ +// NETGENPlugin GUI: GUI for plugged-in mesher NETGENPlugin +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : NETGENPluginGUI_HypothesisCreator.cxx +// Author : Michael Zorin +// Module : NETGENPlugin +// $Header: + +#include "NETGENPluginGUI_HypothesisCreator.h" + +#include +#include + +#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + enum Fineness + { + VeryCoarse, + Coarse, + Moderate, + Fine, + VeryFine, + UserDefined + }; + +NETGENPluginGUI_HypothesisCreator::NETGENPluginGUI_HypothesisCreator( const QString& theHypType ) +: SMESHGUI_GenericHypothesisCreator( theHypType ), + myIs2D(false) +{ +} + +NETGENPluginGUI_HypothesisCreator::~NETGENPluginGUI_HypothesisCreator() +{ +} + +bool NETGENPluginGUI_HypothesisCreator::checkParams() const +{ + NetgenHypothesisData data_old, data_new; + readParamsFromHypo( data_old ); + readParamsFromWidgets( data_new ); + bool res = storeParamsToHypo( data_new ); + storeParamsToHypo( data_old ); + return res; +} + +QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame() +{ + QFrame* fr = new QFrame( 0, "myframe" ); + QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 ); + + QGroupBox* GroupC1 = new QGroupBox( 2, Qt::Horizontal, fr, "GroupC1" ); + lay->addWidget( GroupC1 ); + + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->layout()->setSpacing( 6 ); + GroupC1->layout()->setMargin( 11 ); + + myName = 0; + if( isCreation() ) + { + new QLabel( tr( "SMESH_NAME" ), GroupC1 ); + myName = new QLineEdit( GroupC1 ); + } + + new QLabel( tr( "NETGEN_MAX_SIZE" ), GroupC1 ); + myMaxSize = new QtxDblSpinBox( GroupC1 ); + myMaxSize->setPrecision( 7 ); + myMaxSize->setMinValue( 1e-07 ); + myMaxSize->setMaxValue( 1e+06 ); + myMaxSize->setLineStep( 10 ); + + mySecondOrder = new QCheckBox( tr( "NETGEN_SECOND_ORDER" ), GroupC1 ); + GroupC1->addSpace(0); + + new QLabel( tr( "NETGEN_FINENESS" ), GroupC1 ); + myFineness = new QtxComboBox( GroupC1 ); + QStringList types; + types.append( QObject::tr( "NETGEN_VERYCOARSE" ) ); + types.append( QObject::tr( "NETGEN_COARSE" ) ); + types.append( QObject::tr( "NETGEN_MODERATE" ) ); + types.append( QObject::tr( "NETGEN_FINE" ) ); + types.append( QObject::tr( "NETGEN_VERYFINE" ) ); + types.append( QObject::tr( "NETGEN_CUSTOM" ) ); + myFineness->insertStringList( types ); + + new QLabel( tr( "NETGEN_GROWTH_RATE" ), GroupC1 ); + myGrowthRate = new QtxDblSpinBox( GroupC1 ); + myGrowthRate->setMinValue( 0.1 ); + myGrowthRate->setMaxValue( 10 ); + myGrowthRate->setLineStep( 0.1 ); + + new QLabel( tr( "NETGEN_SEG_PER_EDGE" ), GroupC1 ); + myNbSegPerEdge = new QtxDblSpinBox( GroupC1 ); + myNbSegPerEdge->setMinValue( 0.2 ); + myNbSegPerEdge->setMaxValue( 5.0 ); + + new QLabel( tr( "NETGEN_SEG_PER_RADIUS" ), GroupC1 ); + myNbSegPerRadius = new QtxDblSpinBox( GroupC1 ); + myNbSegPerRadius->setMinValue( 0.2 ); + myNbSegPerRadius->setMaxValue( 5.0 ); + + if ( hypType()=="NETGEN_Parameters_2D" ) + { + myAllowQuadrangles = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), GroupC1 ); + GroupC1->addSpace(0); + myIs2D = true; + } + + myOptimize = new QCheckBox( tr( "NETGEN_OPTIMIZE" ), GroupC1 ); + GroupC1->addSpace(0); + + connect( myFineness, SIGNAL( activated( int ) ), this, SLOT( onFinenessChanged() ) ); + + return fr; +} + +void NETGENPluginGUI_HypothesisCreator::retrieveParams() const +{ + NetgenHypothesisData data; + readParamsFromHypo( data ); + + if( myName ) + myName->setText( data.myName ); + myMaxSize->setValue( data.myMaxSize ); + mySecondOrder->setChecked( data.mySecondOrder ); + myOptimize->setChecked( data.myOptimize ); + myFineness->setCurrentItem( data.myFineness ); + myGrowthRate->setValue( data.myGrowthRate ); + myNbSegPerEdge->setValue( data.myNbSegPerEdge ); + myNbSegPerRadius->setValue( data.myNbSegPerRadius ); + if (myIs2D) + myAllowQuadrangles->setChecked( data.myAllowQuadrangles ); + + // update widgets + bool isCustom = (myFineness->currentItem() == UserDefined); + myGrowthRate->setEnabled(isCustom); + myNbSegPerEdge->setEnabled(isCustom); + myNbSegPerRadius->setEnabled(isCustom); +} + +QString NETGENPluginGUI_HypothesisCreator::storeParams() const +{ + NetgenHypothesisData data; + readParamsFromWidgets( data ); + storeParamsToHypo( data ); + + QString valStr = tr("NETGEN_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; "; + if ( data.mySecondOrder ) + valStr += tr("NETGEN_SECOND_ORDER") + "; "; + if ( data.myOptimize ) + valStr += tr("NETGEN_OPTIMIZE") + "; "; + valStr += myFineness->currentText() + "(" + QString::number( data.myGrowthRate ) + ", " + + QString::number( data.myNbSegPerEdge ) + ", " + + QString::number( data.myNbSegPerRadius ) + ")"; + + if ( myIs2D && data.myAllowQuadrangles ) + valStr += "; " + tr("NETGEN_ALLOW_QUADRANGLES"); + + return valStr; +} + +bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData& h_data ) const +{ + NETGENPlugin::NETGENPlugin_Hypothesis_var h = + NETGENPlugin::NETGENPlugin_Hypothesis::_narrow( initParamsHypothesis() ); + + HypothesisData* data = SMESH::GetHypothesisData( hypType() ); + h_data.myName = isCreation() && data ? data->Label : ""; + + h_data.myMaxSize = h->GetMaxSize(); + h_data.mySecondOrder = h->GetSecondOrder(); + h_data.myOptimize = h->GetOptimize(); + + h_data.myFineness = (int) h->GetFineness(); + h_data.myGrowthRate = h->GetGrowthRate(); + h_data.myNbSegPerEdge = h->GetNbSegPerEdge(); + h_data.myNbSegPerRadius = h->GetNbSegPerRadius(); + + if ( myIs2D ) + { + NETGENPlugin::NETGENPlugin_Hypothesis_2D_var h_2d = + NETGENPlugin::NETGENPlugin_Hypothesis_2D::_narrow( initParamsHypothesis() ); + + if ( !h_2d->_is_nil() ) + h_data.myAllowQuadrangles = h_2d->GetQuadAllowed(); + } + + return true; +} + +bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesisData& h_data ) const +{ + NETGENPlugin::NETGENPlugin_Hypothesis_var h = + NETGENPlugin::NETGENPlugin_Hypothesis::_narrow( hypothesis() ); + + bool ok = true; + try + { + if( isCreation() ) + SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.latin1() ); + + h->SetMaxSize( h_data.myMaxSize ); + h->SetSecondOrder( h_data.mySecondOrder ); + h->SetOptimize( h_data.myOptimize ); + int fineness = h_data.myFineness; + h->SetFineness( fineness ); + + if( fineness==UserDefined ) + { + h->SetGrowthRate( h_data.myGrowthRate ); + h->SetNbSegPerEdge( h_data.myNbSegPerEdge ); + h->SetNbSegPerRadius( h_data.myNbSegPerRadius ); + } + + if ( myIs2D ) + { + NETGENPlugin::NETGENPlugin_Hypothesis_2D_var h_2d = + NETGENPlugin::NETGENPlugin_Hypothesis_2D::_narrow( h ); + + if ( !h_2d->_is_nil() ) + h_2d->SetQuadAllowed( h_data.myAllowQuadrangles ); + } + } + catch(const SALOME::SALOME_Exception& ex) + { + SalomeApp_Tools::QtCatchCorbaException(ex); + ok = false; + } + return ok; +} + +bool NETGENPluginGUI_HypothesisCreator::readParamsFromWidgets( NetgenHypothesisData& h_data ) const +{ + h_data.myName = myName ? myName->text() : ""; + h_data.myMaxSize = myMaxSize->value(); + h_data.mySecondOrder = mySecondOrder->isChecked(); + h_data.myOptimize = myOptimize->isChecked(); + h_data.myFineness = myFineness->currentItem(); + h_data.myGrowthRate = myGrowthRate->value(); + h_data.myNbSegPerEdge = myNbSegPerEdge->value(); + h_data.myNbSegPerRadius = myNbSegPerRadius->value(); + + if ( myIs2D ) + h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked(); + + return true; +} + +void NETGENPluginGUI_HypothesisCreator::onFinenessChanged() +{ + bool isCustom = (myFineness->currentItem() == UserDefined); + + myGrowthRate->setEnabled(isCustom); + myNbSegPerEdge->setEnabled(isCustom); + myNbSegPerRadius->setEnabled(isCustom); + + if (!isCustom) + { + double aGrowthRate, aNbSegPerEdge, aNbSegPerRadius; + + switch ( myFineness->currentItem() ) + { + case VeryCoarse: + aGrowthRate = 0.7; + aNbSegPerEdge = 0.3; + aNbSegPerRadius = 1; + break; + case Coarse: + aGrowthRate = 0.5; + aNbSegPerEdge = 0.5; + aNbSegPerRadius = 1.5; + break; + case Fine: + aGrowthRate = 0.2; + aNbSegPerEdge = 2; + aNbSegPerRadius = 3; + break; + case VeryFine: + aGrowthRate = 0.1; + aNbSegPerEdge = 3; + aNbSegPerRadius = 5; + break; + case Moderate: + default: + aGrowthRate = 0.3; + aNbSegPerEdge = 1; + aNbSegPerRadius = 2; + break; + } + + myGrowthRate->setValue( aGrowthRate ); + myNbSegPerEdge->setValue( aNbSegPerEdge ); + myNbSegPerRadius->setValue( aNbSegPerRadius ); + } +} + +QString NETGENPluginGUI_HypothesisCreator::caption() const +{ + return tr( QString( "NETGEN_%1_TITLE" ).arg(myIs2D?QString("2D"):QString("3D")) ); +} + +QPixmap NETGENPluginGUI_HypothesisCreator::icon() const +{ + QString hypIconName = tr( QString("ICON_DLG_NETGEN_PARAMETERS%1").arg(myIs2D?QString("_2D"):QString("")) ); + return SUIT_Session::session()->resourceMgr()->loadPixmap( "NETGENPlugin", hypIconName ); +} + +QString NETGENPluginGUI_HypothesisCreator::type() const +{ + return tr( QString( "NETGEN_%1_HYPOTHESIS" ).arg(myIs2D?QString("2D"):QString("3D")) ); +} diff --git a/src/GUI/NETGENPluginGUI_HypothesisCreator.h b/src/GUI/NETGENPluginGUI_HypothesisCreator.h new file mode 100644 index 0000000..c86b99f --- /dev/null +++ b/src/GUI/NETGENPluginGUI_HypothesisCreator.h @@ -0,0 +1,90 @@ +// NETGENPlugin GUI: GUI for plugged-in mesher NETGENPlugin +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : NETGENPluginGUI_HypothesisCreator.h +// Author : Michael Zorin +// Module : NETGENPlugin +// $Header: + +#ifndef NETGENPLUGINGUI_HypothesisCreator_HeaderFile +#define NETGENPLUGINGUI_HypothesisCreator_HeaderFile + +#include + +class QtxDblSpinBox; +class QtxComboBox; +class QCheckBox; +class QLineEdit; + +typedef struct +{ + double myMaxSize, myGrowthRate, myNbSegPerEdge, myNbSegPerRadius; + int myFineness; + bool mySecondOrder, myAllowQuadrangles, myOptimize; + QString myName; +} NetgenHypothesisData; + +/*! + * \brief Class for creation of NETGEN2D and NETGEN3D hypotheses +*/ +class NETGENPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator +{ + Q_OBJECT + +public: + NETGENPluginGUI_HypothesisCreator( const QString& ); + virtual ~NETGENPluginGUI_HypothesisCreator(); + + virtual bool checkParams() const; + +protected: + virtual QFrame* buildFrame (); + virtual void retrieveParams() const; + virtual QString storeParams () const; + + virtual QString caption() const; + virtual QPixmap icon() const; + virtual QString type() const; + +protected slots: + virtual void onFinenessChanged(); + +private: + bool readParamsFromHypo( NetgenHypothesisData& ) const; + bool readParamsFromWidgets( NetgenHypothesisData& ) const; + bool storeParamsToHypo( const NetgenHypothesisData& ) const; + +private: + QLineEdit* myName; + QtxDblSpinBox* myMaxSize; + QCheckBox* mySecondOrder; + QCheckBox* myOptimize; + QtxComboBox* myFineness; + QtxDblSpinBox* myGrowthRate; + QtxDblSpinBox* myNbSegPerEdge; + QtxDblSpinBox* myNbSegPerRadius; + QCheckBox* myAllowQuadrangles; + + bool myIs2D; +}; + +#endif diff --git a/src/GUI/NETGENPlugin_images.po b/src/GUI/NETGENPlugin_images.po new file mode 100755 index 0000000..1d06b49 --- /dev/null +++ b/src/GUI/NETGENPlugin_images.po @@ -0,0 +1,59 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" +# would be translated to "Pub", not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n" +"PO-Revision-Date: YYYY-MM-DD\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + + +#----------------------------------------------------------- +# Hypothesis +#----------------------------------------------------------- + +msgid "ICON_DLG_NETGEN_PARAMETERS" +msgstr "mesh_hypo_netgen.png" + +msgid "ICON_DLG_NETGEN_PARAMETERS_2D" +msgstr "mesh_hypo_netgen_2d.png" + +#----------------------------------------------------------- +# ObjectBrowser +#----------------------------------------------------------- + +msgid "ICON_SMESH_TREE_ALGO_NETGEN_3D" +msgstr "mesh_tree_algo_tetra.png" + +msgid "ICON_SMESH_TREE_ALGO_NETGEN_2D" +msgstr "mesh_tree_algo_netgen_2d.png" + +msgid "ICON_SMESH_TREE_ALGO_NETGEN_2D3D" +msgstr "mesh_tree_algo_netgen_2d3d.png" + +msgid "ICON_SMESH_TREE_HYPO_NETGEN_Parameters" +msgstr "mesh_tree_hypo_netgen.png" + +msgid "ICON_SMESH_TREE_HYPO_NETGEN_Parameters_2D" +msgstr "mesh_tree_hypo_netgen_2d.png" diff --git a/src/GUI/NETGENPlugin_msg_en.po b/src/GUI/NETGENPlugin_msg_en.po new file mode 100755 index 0000000..c60a745 --- /dev/null +++ b/src/GUI/NETGENPlugin_msg_en.po @@ -0,0 +1,84 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" +# would be translated to "Pub", not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2002-05-28 10:46:48 AM CEST\n" +"PO-Revision-Date: YYYY-MM-DD\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + + +msgid "NETGEN_MAX_SIZE" +msgstr "Max. Size" + +msgid "NETGEN_SECOND_ORDER" +msgstr "Second Order" + +msgid "NETGEN_OPTIMIZE" +msgstr "Optimize" + +msgid "NETGEN_FINENESS" +msgstr "Fineness" + +msgid "NETGEN_VERYCOARSE" +msgstr "Very Coarse" + +msgid "NETGEN_COARSE" +msgstr "Coarse" + +msgid "NETGEN_MODERATE" +msgstr "Moderate" + +msgid "NETGEN_FINE" +msgstr "Fine" + +msgid "NETGEN_VERYFINE" +msgstr "Very Fine" + +msgid "NETGEN_CUSTOM" +msgstr "Custom" + +msgid "NETGEN_GROWTH_RATE" +msgstr "Growth Rate" + +msgid "NETGEN_SEG_PER_EDGE" +msgstr "Nb. Segs per Edge" + +msgid "NETGEN_SEG_PER_RADIUS" +msgstr "Nb. Segs per Radius" + +msgid "NETGEN_ALLOW_QUADRANGLES" +msgstr "Allow Quadrangles" + +msgid "NETGEN_2D_HYPOTHESIS" +msgstr "Netgen 2D" + +msgid "NETGEN_3D_HYPOTHESIS" +msgstr "Netgen 3D" + +msgid "NETGEN_2D_TITLE" +msgstr "Hypothesis Construction" + +msgid "NETGEN_3D_TITLE" +msgstr "Hypothesis Construction" diff --git a/src/NETGEN/netgen45ForSalome.patch b/src/NETGEN/netgen45ForSalome.patch new file mode 100644 index 0000000..2ee4dab --- /dev/null +++ b/src/NETGEN/netgen45ForSalome.patch @@ -0,0 +1,202 @@ +diff -N -r -u netgen45_orig/libsrc/interface/Makefile netgen45_new/libsrc/interface/Makefile +--- netgen45_orig/libsrc/interface/Makefile 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/interface/Makefile 2006-04-25 11:55:09.296578936 +0400 +@@ -1,4 +1,5 @@ +-src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp writegmsh.cpp writejcm.cpp readuser.cpp importsolution.cpp ++#src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp writegmsh.cpp writejcm.cpp readuser.cpp importsolution.cpp ++src = writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp writegmsh.cpp writejcm.cpp readuser.cpp nglib.cpp ngnewdelete.cpp + # + lib = nginterface + libpath = libsrc/interface +diff -N -r -u netgen45_orig/libsrc/interface/nglib.cpp netgen45_new/libsrc/interface/nglib.cpp +--- netgen45_orig/libsrc/interface/nglib.cpp 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/interface/nglib.cpp 2006-04-25 11:55:09.297578764 +0400 +@@ -56,7 +56,8 @@ + + void Ng_Exit () + { +- ; ++ delete testout; ++ testout = NULL; + } + + +diff -N -r -u netgen45_orig/libsrc/makefile.inc netgen45_new/libsrc/makefile.inc +--- netgen45_orig/libsrc/makefile.inc 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/makefile.inc 2006-04-25 11:55:09.297578764 +0400 +@@ -8,17 +8,14 @@ + LIBSRC_DIR=$(CPP_DIR)/libsrc + LIB_DIR=$(CPP_DIR)/lib/$(MACHINE) + +-#OCC_DIR=../../occ +-#OCCINC_DIR=$(OCC_DIR)/inc +-#OCCLIB_DIR=$(OCC_DIR)/lib +-# OCC_DIR=/opt/OpenCASCADE5.2/ros +-# OCC_DIR=/home/joachim/download/occ/Linux +-# OCCINC_DIR=$(OCC_DIR)/inc -I$(OCC_DIR)/ros/inc +-# OCCLIB_DIR=$(OCC_DIR)/Linux/lib ++OCC_DIR=$(CASROOT) ++OCCINC_DIR=$(OCC_DIR)/inc ++OCCLIB_DIR=$(OCC_DIR)/Linux/lib + # + include $(LIBSRC_DIR)/makefile.mach.$(MACHINE) + # +-CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) ++CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) \ ++ -DOCCGEOMETRY -DOCC52 -DHAVE_IOSTREAM -DHAVE_LIMITS + # + ARFLAGS = r + # +diff -N -r -u netgen45_orig/libsrc/makefile.mach.LINUX netgen45_new/libsrc/makefile.mach.LINUX +--- netgen45_orig/libsrc/makefile.mach.LINUX 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/makefile.mach.LINUX 2006-04-25 11:55:09.298578593 +0400 +@@ -16,7 +16,7 @@ + # + CFLAGS2 = + +-CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL3.5 -DLINUX -DOPENGL \ ++CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL3.5 -DLINUX \ + -ftemplate-depth-99 -finline-limit=10000 \ + -Wdisabled-optimization -funroll-loops -DnoNGSOLVE + +diff -N -r -u netgen45_orig/libsrc/meshing/improve2.cpp netgen45_new/libsrc/meshing/improve2.cpp +--- netgen45_orig/libsrc/meshing/improve2.cpp 2006-03-29 15:09:49.000000000 +0400 ++++ netgen45_new/libsrc/meshing/improve2.cpp 2006-04-25 11:56:02.693420537 +0400 +@@ -4,7 +4,7 @@ + #include + + #ifndef SMALLLIB +-#include ++//#include + #endif + + namespace netgen +diff -N -r -u netgen45_orig/libsrc/occ/occconstruction.cpp netgen45_new/libsrc/occ/occconstruction.cpp +--- netgen45_orig/libsrc/occ/occconstruction.cpp 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/occ/occconstruction.cpp 2006-04-25 11:55:09.298578593 +0400 +@@ -28,8 +28,8 @@ + #include + #include + #include +-#include +-#include ++//#include ++//#include + #include + #include + namespace netgen +diff -N -r -u netgen45_orig/libsrc/occ/occgenmesh.cpp netgen45_new/libsrc/occ/occgenmesh.cpp +--- netgen45_orig/libsrc/occ/occgenmesh.cpp 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/occ/occgenmesh.cpp 2006-04-25 11:55:09.300578250 +0400 +@@ -112,7 +112,7 @@ + + static void FindEdges (OCCGeometry & geom, Mesh & mesh) + { +- char * savetask = multithread.task; ++ const char * savetask = multithread.task; + multithread.task = "Edge meshing"; + + (*testout) << "edge meshing" << endl; +@@ -394,7 +394,7 @@ + int i, j, k; + int changed; + +- char * savetask = multithread.task; ++ const char * savetask = multithread.task; + multithread.task = "Surface meshing"; + + geom.facemeshstatus = 0; +@@ -779,7 +779,7 @@ + double nq = n*q; + + Point<3> p = p0 + 0.5*n; +- double lambda = (p-l.p0)*n / nq; ++ double lambda = (fabs(nq) > 1e-10 ? (p-l.p0)*n / nq : -1); + + if (lambda >= 0 && lambda <= 1) + { +@@ -970,7 +970,7 @@ + if (mparam.uselocalh) + { + +- char * savetask = multithread.task; ++ const char * savetask = multithread.task; + multithread.percent = 0; + + mesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading); +diff -N -r -u netgen45_orig/libsrc/occ/occgeom.cpp netgen45_new/libsrc/occ/occgeom.cpp +--- netgen45_orig/libsrc/occ/occgeom.cpp 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/occ/occgeom.cpp 2006-04-25 11:55:09.301578078 +0400 +@@ -947,13 +947,13 @@ + + void OCCGeometry :: BuildVisualizationMesh () + { +- +- cout << "Preparing visualization (deflection = " << vispar.occdeflection << ") ... " << flush; ++ double vispar_occdeflection = 0.01; ++ cout << "Preparing visualization (deflection = " << vispar_occdeflection << ") ... " << flush; + + + BRepTools::Clean (shape); + //WriteOCC_STL("test.stl"); +- BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, vispar.occdeflection, true); ++ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, vispar_occdeflection, true); + cout << "done" << endl; + + +diff -N -r -u netgen45_orig/libsrc/occ/occgeom.hpp netgen45_new/libsrc/occ/occgeom.hpp +--- netgen45_orig/libsrc/occ/occgeom.hpp 2006-04-13 12:58:37.000000000 +0400 ++++ netgen45_new/libsrc/occ/occgeom.hpp 2006-04-25 11:55:09.302577907 +0400 +@@ -69,7 +69,7 @@ + #include "IGESToBRep_Reader.hxx" + #include "Interface_Static.hxx" + #include "GeomAPI_ExtremaCurveCurve.hxx" +-#include "Standard_ErrorHandler.hxx" ++//#include "Standard_ErrorHandler.hxx" + #include "Standard_Failure.hxx" + #include "ShapeUpgrade_ShellSewing.hxx" + #include "ShapeFix_Shape.hxx" +@@ -88,7 +88,7 @@ + namespace netgen + { + +-#include "../visualization/vispar.hpp" ++ //#include "../visualization/vispar.hpp" + // class VisualizationParameters; + // extern VisualizationParameters vispar; + +diff -N -r -u netgen45_orig/makeForSalome.sh netgen45_new/makeForSalome.sh +--- netgen45_orig/makeForSalome.sh 1970-01-01 03:00:00.000000000 +0300 ++++ netgen45_new/makeForSalome.sh 2006-04-25 11:55:09.302577907 +0400 +@@ -0,0 +1,31 @@ ++#! /bin/sh ++cp ngtcltk/ngnewdelete.* libsrc/interface/ ++ ++MACHINE=LINUX ++export MACHINE ++make -C libsrc/csg ++make -C libsrc/general ++make -C libsrc/geom2d ++make -C libsrc/gprim ++make -C libsrc/interface ++make -C libsrc/linalg ++make -C libsrc/meshing ++make -C libsrc/opti ++make -C libsrc/stlgeom ++make -C libsrc/occ ++ ++if [ ! -d install ] ; then ++ mkdir install ++fi ++ ++cp -r lib install/ ++ ++if [ ! -d install/include ] ; then ++ mkdir install/include ++fi ++ ++cp libsrc/interface/nglib.h libsrc/general/*.hpp libsrc/csg/*.hpp libsrc/geom2d/*.hpp \ ++ libsrc/gprim/*.hpp libsrc/linalg/*.hpp libsrc/meshing/*.hpp \ ++ libsrc/occ/*.hpp libsrc/opti/*.hpp libsrc/include/mydefs.hpp \ ++ libsrc/stlgeom/*.hpp libsrc/include/mystdlib.h \ ++ install/include diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx new file mode 100644 index 0000000..d5f43cd --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx @@ -0,0 +1,364 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis.cxx +// Author : Michael Sazonov (OCN) +// Date : 28/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +using namespace std; +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= +NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, int studyId, + SMESH_Gen * gen) + : SMESH_Hypothesis(hypId, studyId, gen), + _maxSize (GetDefaultMaxSize()), + _growthRate (GetDefaultGrowthRate()), + _nbSegPerEdge (GetDefaultNbSegPerEdge()), + _nbSegPerRadius(GetDefaultNbSegPerRadius()), + _fineness (GetDefaultFineness()), + _secondOrder (GetDefaultSecondOrder()), + _optimize (GetDefaultOptimize()) +{ + _name = "NETGEN_Parameters"; + _param_algo_dim = 3; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetMaxSize(double theSize) +{ + if (theSize != _maxSize) + { + _maxSize = theSize; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetSecondOrder(bool theVal) +{ + if (theVal != _secondOrder) + { + _secondOrder = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetOptimize(bool theVal) +{ + if (theVal != _optimize) + { + _optimize = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetFineness(Fineness theFineness) +{ + if (theFineness != _fineness) + { + _fineness = theFineness; + // the predefined values are taken from NETGEN 4.5 sources + switch (_fineness) + { + case VeryCoarse: + _growthRate = 0.7; + _nbSegPerEdge = 0.3; + _nbSegPerRadius = 1; + break; + case Coarse: + _growthRate = 0.5; + _nbSegPerEdge = 0.5; + _nbSegPerRadius = 1.5; + break; + case Fine: + _growthRate = 0.2; + _nbSegPerEdge = 2; + _nbSegPerRadius = 3; + break; + case VeryFine: + _growthRate = 0.1; + _nbSegPerEdge = 3; + _nbSegPerRadius = 5; + break; + case UserDefined: + break; + case Moderate: + default: + _growthRate = 0.3; + _nbSegPerEdge = 1; + _nbSegPerRadius = 2; + break; + } + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetGrowthRate(double theRate) +{ + if (theRate != _growthRate) + { + _growthRate = theRate; + _fineness = UserDefined; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetNbSegPerEdge(double theVal) +{ + if (theVal != _nbSegPerEdge) + { + _nbSegPerEdge = theVal; + _fineness = UserDefined; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis::SetNbSegPerRadius(double theVal) +{ + if (theVal != _nbSegPerRadius) + { + _nbSegPerRadius = theVal; + _fineness = UserDefined; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +ostream & NETGENPlugin_Hypothesis::SaveTo(ostream & save) +{ + save << _maxSize << " " << _fineness; + + if (_fineness == UserDefined) + save << " " << _growthRate << " " << _nbSegPerEdge << " " << _nbSegPerRadius; + + save << " " << (int)_secondOrder << " " << (int)_optimize; + + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +istream & NETGENPlugin_Hypothesis::LoadFrom(istream & load) +{ + bool isOK = true; + int is; + double val; + + isOK = (load >> val); + if (isOK) + _maxSize = val; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + SetFineness((Fineness) is); + else + load.clear(ios::badbit | load.rdstate()); + + if (_fineness == UserDefined) + { + isOK = (load >> val); + if (isOK) + _growthRate = val; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _nbSegPerEdge = val; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> val); + if (isOK) + _nbSegPerRadius = val; + else + load.clear(ios::badbit | load.rdstate()); + } + + isOK = (load >> is); + if (isOK) + _secondOrder = (bool) is; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> is); + if (isOK) + _optimize = (bool) is; + else + load.clear(ios::badbit | load.rdstate()); + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp) +{ + return hyp.SaveTo( save ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp) +{ + return hyp.LoadFrom( load ); +} + + +//================================================================================ +/*! + * \brief Does nothing + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - always false + */ +//================================================================================ +bool NETGENPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh, + const TopoDS_Shape& theShape) +{ + return false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +double NETGENPlugin_Hypothesis::GetDefaultMaxSize() +{ + return 1000; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +NETGENPlugin_Hypothesis::Fineness NETGENPlugin_Hypothesis::GetDefaultFineness() +{ + return Moderate; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +double NETGENPlugin_Hypothesis::GetDefaultGrowthRate() +{ + return 0.3; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +double NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge() +{ + return 1; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +double NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius() +{ + return 2; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool NETGENPlugin_Hypothesis::GetDefaultSecondOrder() +{ + return false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool NETGENPlugin_Hypothesis::GetDefaultOptimize() +{ + return true; +} diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx new file mode 100644 index 0000000..01a4c3e --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx @@ -0,0 +1,111 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis.hxx +// Author : Michael Sazonov (OCN) +// Date : 27/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _NETGENPlugin_Hypothesis_HXX_ +#define _NETGENPlugin_Hypothesis_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +// Parameters for work of NETGEN +// + +class NETGENPlugin_Hypothesis: public SMESH_Hypothesis +{ +public: + + NETGENPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen); + + void SetMaxSize(double theSize); + double GetMaxSize() const { return _maxSize; } + + void SetSecondOrder(bool theVal); + bool GetSecondOrder() const { return _secondOrder; } + + void SetOptimize(bool theVal); + bool GetOptimize() const { return _optimize; } + + enum Fineness + { + VeryCoarse, + Coarse, + Moderate, + Fine, + VeryFine, + UserDefined + }; + + void SetFineness(Fineness theFineness); + Fineness GetFineness() const { return _fineness; } + + // the following parameters are controlled by Fineness + + void SetGrowthRate(double theRate); + double GetGrowthRate() const { return _growthRate; } + + void SetNbSegPerEdge(double theVal); + double GetNbSegPerEdge() const { return _nbSegPerEdge; } + + void SetNbSegPerRadius(double theVal); + double GetNbSegPerRadius() const { return _nbSegPerRadius; } + + // the default values (taken from NETGEN 4.5 sources) + + static double GetDefaultMaxSize(); + static Fineness GetDefaultFineness(); + static double GetDefaultGrowthRate(); + static double GetDefaultNbSegPerEdge(); + static double GetDefaultNbSegPerRadius(); + static bool GetDefaultSecondOrder(); + static bool GetDefaultOptimize(); + + // Persistence + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp); + friend istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp); + + /*! + * \brief Does nothing + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - always false + */ + virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); + +private: + double _maxSize; + double _growthRate; + double _nbSegPerEdge; + double _nbSegPerRadius; + Fineness _fineness; + bool _secondOrder; + bool _optimize; +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cxx new file mode 100644 index 0000000..46f89ef --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.cxx @@ -0,0 +1,104 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis_2D.cxx +// Author : Michael Sazonov (OCN) +// Date : 28/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +using namespace std; +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= +NETGENPlugin_Hypothesis_2D::NETGENPlugin_Hypothesis_2D (int hypId, int studyId, + SMESH_Gen * gen) + : NETGENPlugin_Hypothesis(hypId, studyId, gen), + _quadAllowed (GetDefaultQuadAllowed()) +{ + _name = "NETGEN_Parameters_2D"; + _param_algo_dim = 2; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void NETGENPlugin_Hypothesis_2D::SetQuadAllowed(bool theVal) +{ + if (theVal != _quadAllowed) + { + _quadAllowed = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed() +{ + return false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +ostream & NETGENPlugin_Hypothesis_2D::SaveTo(ostream & save) +{ + NETGENPlugin_Hypothesis::SaveTo(save); + + save << " " << (int)_quadAllowed; + + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +istream & NETGENPlugin_Hypothesis_2D::LoadFrom(istream & load) +{ + NETGENPlugin_Hypothesis::LoadFrom(load); + + bool isOK = true; + int is; + + isOK = (load >> is); + if (isOK) + _quadAllowed = (bool) is; + else + load.clear(ios::badbit | load.rdstate()); + + return load; +} diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx new file mode 100644 index 0000000..a9b0acd --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D.hxx @@ -0,0 +1,57 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis_2D.hxx +// Author : Michael Sazonov (OCN) +// Date : 27/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _NETGENPlugin_Hypothesis_2D_HXX_ +#define _NETGENPlugin_Hypothesis_2D_HXX_ + +#include "NETGENPlugin_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +// Parameters for work of NETGEN. +// This class is just to give 2D dimension, actually +// it inherits all behaviour of the parent + +class NETGENPlugin_Hypothesis_2D: public NETGENPlugin_Hypothesis +{ +public: + + NETGENPlugin_Hypothesis_2D(int hypId, int studyId, SMESH_Gen * gen); + + void SetQuadAllowed(bool theVal); + bool GetQuadAllowed() const { return _quadAllowed; } + static bool GetDefaultQuadAllowed(); + + // Persistence + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + +private: + bool _quadAllowed; +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx new file mode 100644 index 0000000..36ed667 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.cxx @@ -0,0 +1,126 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis_2D_i.cxx +// Author : Michael Sazonov (OCN) +// Date : 03/04/2006 +// Project : SALOME +// $Header$ +//============================================================================= +using namespace std; + +#include "NETGENPlugin_Hypothesis_2D_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_2D_i::NETGENPlugin_Hypothesis_2D_i + * + * Constructor + */ +//============================================================================= +NETGENPlugin_Hypothesis_2D_i:: +NETGENPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + NETGENPlugin_Hypothesis_i( thePOA, theStudyId, theGenImpl ) +{ + MESSAGE( "NETGENPlugin_Hypothesis_2D_i::NETGENPlugin_Hypothesis_2D_i" ); + if (myBaseImpl) + delete (::NETGENPlugin_Hypothesis*)myBaseImpl; + myBaseImpl = new ::NETGENPlugin_Hypothesis_2D (theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i + * + * Destructor + */ +//============================================================================= +NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i() +{ + MESSAGE( "NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i" ); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed + * + * Set QuadAllowed flag + */ +//============================================================================= +void NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed (CORBA::Boolean theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_2D_i::SetQuadAllowed"); + ASSERT(myBaseImpl); + this->GetImpl()->SetQuadAllowed(theValue); + SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_2D_i::GetQuadAllowed + * + * Get QuadAllowed flag + */ +//============================================================================= +CORBA::Boolean NETGENPlugin_Hypothesis_2D_i::GetQuadAllowed() +{ + MESSAGE("NETGENPlugin_Hypothesis_2D_i::GetQuadAllowed"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetQuadAllowed(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_2D_i::GetImpl + * + * Get implementation + */ +//============================================================================= +::NETGENPlugin_Hypothesis_2D* NETGENPlugin_Hypothesis_2D_i::GetImpl() +{ + MESSAGE("NETGENPlugin_Hypothesis_2D_i::GetImpl"); + return (::NETGENPlugin_Hypothesis_2D*)myBaseImpl; +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) + */ +//================================================================================ +CORBA::Boolean NETGENPlugin_Hypothesis_2D_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_2D; +} diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx new file mode 100644 index 0000000..1df8e19 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_2D_i.hxx @@ -0,0 +1,64 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis_2D_i.hxx +// Author : Michael Sazonov (OCN) +// Date : 03/04/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _NETGENPlugin_Hypothesis_2D_i_HXX_ +#define _NETGENPlugin_Hypothesis_2D_i_HXX_ + +#include +#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) + +#include "NETGENPlugin_Hypothesis_i.hxx" +#include "NETGENPlugin_Hypothesis_2D.hxx" + +class SMESH_Gen; + +// NETGENPlugin parameters hypothesis (2D case) + +class NETGENPlugin_Hypothesis_2D_i: + public virtual POA_NETGENPlugin::NETGENPlugin_Hypothesis_2D, + public NETGENPlugin_Hypothesis_i +{ + public: + // Constructor + NETGENPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl); + // Destructor + virtual ~NETGENPlugin_Hypothesis_2D_i(); + + void SetQuadAllowed(CORBA::Boolean theVal); + CORBA::Boolean GetQuadAllowed(); + + // Get implementation + ::NETGENPlugin_Hypothesis_2D* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx new file mode 100644 index 0000000..313fe31 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx @@ -0,0 +1,297 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis_i.cxx +// Author : Michael Sazonov (OCN) +// Date : 03/04/2006 +// Project : SALOME +// $Header$ +//============================================================================= +using namespace std; + +#include "NETGENPlugin_Hypothesis_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i + * + * Constructor + */ +//============================================================================= +NETGENPlugin_Hypothesis_i:: +NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ) +{ + MESSAGE( "NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i" ); + myBaseImpl = new ::NETGENPlugin_Hypothesis (theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i + * + * Destructor + */ +//============================================================================= +NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i() +{ + MESSAGE( "NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i" ); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::SetMaxSize + * + * Set MaxSize + */ +//============================================================================= +void NETGENPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_i::SetMaxSize"); + ASSERT(myBaseImpl); + this->GetImpl()->SetMaxSize(theValue); + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetMaxSize + * + * Get MaxSize + */ +//============================================================================= +CORBA::Double NETGENPlugin_Hypothesis_i::GetMaxSize() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetMaxSize"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetMaxSize(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::SetSecondOrder + * + * Set SecondOrder flag + */ +//============================================================================= +void NETGENPlugin_Hypothesis_i::SetSecondOrder (CORBA::Boolean theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_i::SetSecondOrder"); + ASSERT(myBaseImpl); + this->GetImpl()->SetSecondOrder(theValue); + SMESH::TPythonDump() << _this() << ".SetSecondOrder( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetSecondOrder + * + * Get SecondOrder flag + */ +//============================================================================= +CORBA::Boolean NETGENPlugin_Hypothesis_i::GetSecondOrder() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetSecondOrder"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetSecondOrder(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::SetOptimize + * + * Set Optimize flag + */ +//============================================================================= +void NETGENPlugin_Hypothesis_i::SetOptimize (CORBA::Boolean theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_i::SetOptimize"); + ASSERT(myBaseImpl); + this->GetImpl()->SetOptimize(theValue); + SMESH::TPythonDump() << _this() << ".SetOptimize( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetOptimize + * + * Get Optimize flag + */ +//============================================================================= +CORBA::Boolean NETGENPlugin_Hypothesis_i::GetOptimize() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetOptimize"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetOptimize(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::SetFineness + * + * Set Fineness + */ +//============================================================================= +void NETGENPlugin_Hypothesis_i::SetFineness (CORBA::Long theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_i::SetFineness"); + ASSERT(myBaseImpl); + this->GetImpl()->SetFineness((::NETGENPlugin_Hypothesis::Fineness)theValue); + SMESH::TPythonDump() << _this() << ".SetFineness( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetFineness + * + * Get Fineness + */ +//============================================================================= +CORBA::Long NETGENPlugin_Hypothesis_i::GetFineness() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetFineness"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetFineness(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::SetGrowthRate + * + * Set GrowthRate + */ +//============================================================================= +void NETGENPlugin_Hypothesis_i::SetGrowthRate (CORBA::Double theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_i::SetGrowthRate"); + ASSERT(myBaseImpl); + this->GetImpl()->SetGrowthRate(theValue); + SMESH::TPythonDump() << _this() << ".SetGrowthRate( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetGrowthRate + * + * Get GrowthRate + */ +//============================================================================= +CORBA::Double NETGENPlugin_Hypothesis_i::GetGrowthRate() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetGrowthRate"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetGrowthRate(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::SetNbSegPerEdge + * + * Set NbSegPerEdge + */ +//============================================================================= +void NETGENPlugin_Hypothesis_i::SetNbSegPerEdge (CORBA::Double theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_i::SetNbSegPerEdge"); + ASSERT(myBaseImpl); + this->GetImpl()->SetNbSegPerEdge(theValue); + SMESH::TPythonDump() << _this() << ".SetNbSegPerEdge( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetNbSegPerEdge + * + * Get NbSegPerEdge + */ +//============================================================================= +CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerEdge() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetNbSegPerEdge"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetNbSegPerEdge(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::SetNbSegPerRadius + * + * Set NbSegPerRadius + */ +//============================================================================= +void NETGENPlugin_Hypothesis_i::SetNbSegPerRadius (CORBA::Double theValue) +{ + MESSAGE("NETGENPlugin_Hypothesis_i::SetNbSegPerRadius"); + ASSERT(myBaseImpl); + this->GetImpl()->SetNbSegPerRadius(theValue); + SMESH::TPythonDump() << _this() << ".SetNbSegPerRadius( " << theValue << " )"; +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetNbSegPerRadius + * + * Get NbSegPerRadius + */ +//============================================================================= +CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerRadius() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetNbSegPerRadius"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetNbSegPerRadius(); +} + +//============================================================================= +/*! + * NETGENPlugin_Hypothesis_i::GetImpl + * + * Get implementation + */ +//============================================================================= +::NETGENPlugin_Hypothesis* NETGENPlugin_Hypothesis_i::GetImpl() +{ + MESSAGE("NETGENPlugin_Hypothesis_i::GetImpl"); + return (::NETGENPlugin_Hypothesis*)myBaseImpl; +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) + */ +//================================================================================ +CORBA::Boolean NETGENPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_3D; +} diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx new file mode 100644 index 0000000..edde231 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx @@ -0,0 +1,82 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Hypothesis_i.hxx +// Author : Michael Sazonov (OCN) +// Date : 03/04/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _NETGENPlugin_Hypothesis_i_HXX_ +#define _NETGENPlugin_Hypothesis_i_HXX_ + +#include +#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) + +#include "SMESH_Hypothesis_i.hxx" +#include "NETGENPlugin_Hypothesis.hxx" + +class SMESH_Gen; + +// NETGENPlugin parameters hypothesis + +class NETGENPlugin_Hypothesis_i: + public virtual POA_NETGENPlugin::NETGENPlugin_Hypothesis, + public virtual SMESH_Hypothesis_i +{ + public: + // Constructor + NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl); + // Destructor + virtual ~NETGENPlugin_Hypothesis_i(); + + void SetMaxSize(CORBA::Double theSize); + CORBA::Double GetMaxSize(); + + void SetSecondOrder(CORBA::Boolean theVal); + CORBA::Boolean GetSecondOrder(); + + void SetOptimize(CORBA::Boolean theVal); + CORBA::Boolean GetOptimize(); + + void SetFineness(CORBA::Long theFineness); + CORBA::Long GetFineness(); + + void SetGrowthRate(CORBA::Double theRate); + CORBA::Double GetGrowthRate(); + + void SetNbSegPerEdge(CORBA::Double theVal); + CORBA::Double GetNbSegPerEdge(); + + void SetNbSegPerRadius(CORBA::Double theVal); + CORBA::Double GetNbSegPerRadius(); + + // Get implementation + ::NETGENPlugin_Hypothesis* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx new file mode 100644 index 0000000..09c51aa --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -0,0 +1,442 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Mesher.cxx +// Author : Michael Sazonov (OCN) +// Date : 31/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= +using namespace std; + +#include "NETGENPlugin_Mesher.hxx" +#include "NETGENPlugin_Hypothesis_2D.hxx" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +// Netgen include files +namespace nglib { +#include +} +#define OCCGEOMETRY +#include +#include +//#include +namespace netgen { + extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*); + extern MeshingParameters mparam; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +NETGENPlugin_Mesher::NETGENPlugin_Mesher (SMESHDS_Mesh* meshDS, + const TopoDS_Shape& aShape, + const bool isVolume) + : _meshDS (meshDS), + _shape (aShape), + _isVolume(isVolume), + _optimize(true) +{ + // Initialize global NETGEN parameters by default values: + // maximal mesh edge size + netgen::mparam.maxh = NETGENPlugin_Hypothesis::GetDefaultMaxSize(); + // minimal number of segments per edge + netgen::mparam.segmentsperedge = NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge(); + // rate of growth of size between elements + netgen::mparam.grading = NETGENPlugin_Hypothesis::GetDefaultGrowthRate(); + // safety factor for curvatures (elements per radius) + netgen::mparam.curvaturesafety = NETGENPlugin_Hypothesis::GetDefaultNbSegPerRadius(); + // create elements of second order + netgen::mparam.secondorder = NETGENPlugin_Hypothesis::GetDefaultSecondOrder() ? 1 : 0; + // quad-dominated surface meshing + if (_isVolume) + netgen::mparam.quad = 0; + else + netgen::mparam.quad = NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed() ? 1 : 0; +} + +//============================================================================= +/*! + * Pass parameters to NETGEN + */ +//============================================================================= +void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp) +{ + if (hyp) + { + // Initialize global NETGEN parameters: + // maximal mesh segment size + netgen::mparam.maxh = hyp->GetMaxSize(); + // minimal number of segments per edge + netgen::mparam.segmentsperedge = hyp->GetNbSegPerEdge(); + // rate of growth of size between elements + netgen::mparam.grading = hyp->GetGrowthRate(); + // safety factor for curvatures (elements per radius) + netgen::mparam.curvaturesafety = hyp->GetNbSegPerRadius(); + // create elements of second order + netgen::mparam.secondorder = hyp->GetSecondOrder() ? 1 : 0; + // quad-dominated surface meshing + // only triangles are allowed for volumic mesh + if (!_isVolume) + netgen::mparam.quad = static_cast + (hyp)->GetQuadAllowed() ? 1 : 0; + _optimize = hyp->GetOptimize(); + } +} + +//============================================================================= +/*! + * Link - a pair of integer numbers + */ +//============================================================================= +struct Link +{ + int n1, n2; + Link(int _n1, int _n2) : n1(_n1), n2(_n2) {} + Link() : n1(0), n2(0) {} +}; + +int HashCode(const Link& aLink, int aLimit) +{ + return HashCode(aLink.n1 + aLink.n2, aLimit); +} + +Standard_Boolean IsEqual(const Link& aLink1, const Link& aLink2) +{ + return (aLink1.n1 == aLink2.n1 && aLink1.n2 == aLink2.n2 || + aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1); +} + +//============================================================================= +/*! + * Here we are going to use the NETGEN mesher + */ +//============================================================================= +bool NETGENPlugin_Mesher::Compute() +{ + MESSAGE("Compute with:\n" + " max size = " << netgen::mparam.maxh << "\n" + " segments per edge = " << netgen::mparam.segmentsperedge); + MESSAGE("\n" + " growth rate = " << netgen::mparam.grading << "\n" + " elements per radius = " << netgen::mparam.curvaturesafety << "\n" + " second order = " << netgen::mparam.secondorder << "\n" + " quad allowed = " << netgen::mparam.quad); + + nglib::Ng_Init(); + + // ------------------------- + // Prepare OCC geometry + // ------------------------- + + netgen::OCCGeometry occgeo; + occgeo.shape = _shape; + occgeo.changed = 1; + occgeo.BuildFMap(); + BRepTools::Clean (_shape); + BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (_shape, 0.01, true); + Bnd_Box bb; + BRepBndLib::Add (_shape, bb); + double x1,y1,z1,x2,y2,z2; + bb.Get (x1,y1,z1,x2,y2,z2); + MESSAGE("shape bounding box:\n" << + "(" << x1 << " " << y1 << " " << z1 << ") " << + "(" << x2 << " " << y2 << " " << z2 << ")"); + netgen::Point<3> p1 = netgen::Point<3> (x1,y1,z1); + netgen::Point<3> p2 = netgen::Point<3> (x2,y2,z2); + occgeo.boundingbox = netgen::Box<3> (p1,p2); + + // ------------------------- + // Generate the mesh + // ------------------------- + + netgen::Mesh *ngMesh = NULL; + // we start always with ANALYSE, + // but end depending on _optimize and _isVolume + int startWith = netgen::MESHCONST_ANALYSE; + int endWith = (_optimize + ? (_isVolume ? netgen::MESHCONST_OPTVOLUME : netgen::MESHCONST_OPTSURFACE) + : netgen::MESHCONST_MESHSURFACE); + char *optstr; + + int err = 0; + try + { + err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); + if (!err && !_optimize) + { + // we have got surface mesh only, so generate volume mesh + startWith = endWith = netgen::MESHCONST_MESHVOLUME; + err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); + } + if (!err && netgen::mparam.secondorder > 0) + { + netgen::OCCRefinementSurfaces ref (occgeo); + ref.MakeSecondOrder (*ngMesh); + } + } + catch (netgen::NgException exc) + { + MESSAGE ("Exception in NETGEN: " << exc.What()); + err = 1; + } + + int nbNod = ngMesh->GetNP(); + int nbSeg = ngMesh->GetNSeg(); + int nbFac = ngMesh->GetNSE(); + int nbVol = ngMesh->GetNE(); + + MESSAGE((err ? "Mesh Generation failure" : "End of Mesh Generation") << + ", nb nodes: " << nbNod << + ", nb segments: " << nbSeg << + ", nb faces: " << nbFac << + ", nb volumes: " << nbVol); + + // ----------------------------------------------------------- + // Feed back the SMESHDS with the generated Nodes and Elements + // ----------------------------------------------------------- + + bool isOK = ( !err && (_isVolume ? (nbVol > 0) : (nbFac > 0)) ); + if ( isOK ) + { + // vector of nodes in which node index == netgen ID + vector< SMDS_MeshNode* > nodeVec ( nbNod + 1 ); + // map of nodes assigned to submeshes + NCollection_Map pindMap; + // create and insert nodes into nodeVec + int i; + for (i = 1; i <= nbNod && isOK; ++i ) + { + const netgen::MeshPoint& ngPoint = ngMesh->Point(i); + SMDS_MeshNode* node = NULL; + bool newNodeOnVertex = false; + TopoDS_Vertex aVert; + if (i <= occgeo.vmap.Extent()) + { + // point on vertex + aVert = TopoDS::Vertex(occgeo.vmap(i)); + SMESHDS_SubMesh * submesh = _meshDS->MeshElements(aVert); + if (submesh) + { + SMDS_NodeIteratorPtr it = submesh->GetNodes(); + if (it->more()) + { + node = const_cast (it->next()); + pindMap.Add(i); + } + } + if (!node) + newNodeOnVertex = true; + } + if (!node) + node = _meshDS->AddNode(ngPoint.X(), ngPoint.Y(), ngPoint.Z()); + if (!node) + { + MESSAGE("Cannot create a mesh node"); + isOK = false; + break; + } + nodeVec.at(i) = node; + if (newNodeOnVertex) + { + // point on vertex + _meshDS->SetNodeOnVertex(node, aVert); + pindMap.Add(i); + } + } + + // create mesh segments along geometric edges + NCollection_Map linkMap; + for (i = 1; i <= nbSeg && isOK; ++i ) + { + const netgen::Segment& seg = ngMesh->LineSegment(i); + Link link(seg.p1, seg.p2); + if (linkMap.Contains(link)) + continue; + linkMap.Add(link); + TopoDS_Edge aEdge; + int pinds[3] = { seg.p1, seg.p2, seg.pmid }; + int nbp = 0; + double param2 = 0; + for (int j=0; j < 3; ++j) + { + int pind = pinds[j]; + if (pind <= 0) continue; + ++nbp; + double param; + if (j < 2) + { + if (aEdge.IsNull()) + { + int aGeomEdgeInd = seg.epgeominfo[j].edgenr; + if (aGeomEdgeInd > 0 && aGeomEdgeInd <= occgeo.emap.Extent()) + aEdge = TopoDS::Edge(occgeo.emap(aGeomEdgeInd)); + } + param = seg.epgeominfo[j].dist; + param2 += param; + } + else + param = param2 * 0.5; + if (pindMap.Contains(pind)) + continue; + if (!aEdge.IsNull()) + { + _meshDS->SetNodeOnEdge(nodeVec.at(pind), aEdge, param); + pindMap.Add(pind); + } + } + SMDS_MeshEdge* edge; + if (nbp < 3) // second order ? + edge = _meshDS->AddEdge(nodeVec.at(pinds[0]), nodeVec.at(pinds[1])); + else + edge = _meshDS->AddEdge(nodeVec.at(pinds[0]), nodeVec.at(pinds[1]), + nodeVec.at(pinds[2])); + if (!edge) + { + MESSAGE("Cannot create a mesh edge"); + isOK = false; + break; + } + if (!aEdge.IsNull()) + _meshDS->SetMeshElementOnShape(edge, aEdge); + } + + // create mesh faces along geometric faces + for (i = 1; i <= nbFac && isOK; ++i ) + { + const netgen::Element2d& elem = ngMesh->SurfaceElement(i); + int aGeomFaceInd = elem.GetIndex(); + TopoDS_Face aFace; + if (aGeomFaceInd > 0 && aGeomFaceInd <= occgeo.fmap.Extent()) + aFace = TopoDS::Face(occgeo.fmap(aGeomFaceInd)); + vector nodes; + for (int j=1; j <= elem.GetNP(); ++j) + { + int pind = elem.PNum(j); + SMDS_MeshNode* node = nodeVec.at(pind); + nodes.push_back(node); + if (pindMap.Contains(pind)) + continue; + if (!aFace.IsNull()) + { + const netgen::PointGeomInfo& pgi = elem.GeomInfoPi(j); + _meshDS->SetNodeOnFace(node, aFace, pgi.u, pgi.v); + pindMap.Add(pind); + } + } + SMDS_MeshFace* face = NULL; + switch (elem.GetType()) + { + case netgen::TRIG: + face = _meshDS->AddFace(nodes[0],nodes[1],nodes[2]); + break; + case netgen::QUAD: + face = _meshDS->AddFace(nodes[0],nodes[1],nodes[2],nodes[3]); + break; + case netgen::TRIG6: + face = _meshDS->AddFace(nodes[0],nodes[1],nodes[2],nodes[5],nodes[3],nodes[4]); + break; + case netgen::QUAD8: + face = _meshDS->AddFace(nodes[0],nodes[1],nodes[2],nodes[3], + nodes[4],nodes[7],nodes[5],nodes[6]); + break; + default: + MESSAGE("NETGEN created a face of unexpected type, ignoring"); + continue; + } + if (!face) + { + MESSAGE("Cannot create a mesh face"); + isOK = false; + break; + } + if (!aFace.IsNull()) + _meshDS->SetMeshElementOnShape(face, aFace); + } + + // create tetrahedra + for (i = 1; i <= nbVol && isOK; ++i) + { + const netgen::Element& elem = ngMesh->VolumeElement(i); + int aSolidInd = elem.GetIndex(); + TopoDS_Solid aSolid; + if (aSolidInd > 0 && aSolidInd <= occgeo.somap.Extent()) + aSolid = TopoDS::Solid(occgeo.somap(aSolidInd)); + vector nodes; + for (int j=1; j <= elem.GetNP(); ++j) + { + int pind = elem.PNum(j); + SMDS_MeshNode* node = nodeVec.at(pind); + nodes.push_back(node); + if (pindMap.Contains(pind)) + continue; + if (!aSolid.IsNull()) + { + // point in solid + _meshDS->SetNodeInVolume(node, aSolid); + pindMap.Add(pind); + } + } + SMDS_MeshVolume* vol = NULL; + switch (elem.GetType()) + { + case netgen::TET: + vol = _meshDS->AddVolume(nodes[0],nodes[1],nodes[2],nodes[3]); + break; + case netgen::TET10: + vol = _meshDS->AddVolume(nodes[0],nodes[1],nodes[2],nodes[3], + nodes[4],nodes[7],nodes[5],nodes[6],nodes[8],nodes[9]); + break; + default: + MESSAGE("NETGEN created a volume of unexpected type, ignoring"); + continue; + } + if (!vol) + { + MESSAGE("Cannot create a mesh volume"); + isOK = false; + break; + } + if (!aSolid.IsNull()) + _meshDS->SetMeshElementOnShape(vol, aSolid); + } + } + + nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)ngMesh); + nglib::Ng_Exit(); + + return isOK; +} diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.hxx b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx new file mode 100644 index 0000000..4d09177 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx @@ -0,0 +1,59 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_Mesher.hxx +// Author : Michael Sazonov (OCN) +// Date : 31/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _NETGENPlugin_Mesher_HXX_ +#define _NETGENPlugin_Mesher_HXX_ + +class SMESHDS_Mesh; +class TopoDS_Shape; +class NETGENPlugin_Hypothesis; + +/*! + * \brief This class calls the NETGEN mesher of OCC geometry + */ + +class NETGENPlugin_Mesher +{ + public: + // ---------- PUBLIC METHODS ---------- + + NETGENPlugin_Mesher (SMESHDS_Mesh* meshDS, const TopoDS_Shape& aShape, + const bool isVolume); + + void SetParameters(const NETGENPlugin_Hypothesis* hyp); + + bool Compute(); + + private: + SMESHDS_Mesh* _meshDS; + const TopoDS_Shape& _shape; + bool _isVolume; + bool _optimize; +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx new file mode 100644 index 0000000..fcf4153 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.cxx @@ -0,0 +1,171 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D.cxx +// Author : Michael Sazonov (OCN) +// Date : 20/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= +using namespace std; + +#include "NETGENPlugin_NETGEN_2D.hxx" +#include "NETGENPlugin_Hypothesis_2D.hxx" +#include "NETGENPlugin_Mesher.hxx" + +#include +#include +#include +#include +#include + +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, studyId, gen) +{ + MESSAGE("NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D"); + _name = "NETGEN_2D"; + _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type + _compatibleHypothesis.push_back("NETGEN_Parameters_2D"); + _requireDescretBoundary = false; + _onlyUnaryInput = false; + _hypothesis = NULL; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D() +{ + MESSAGE("NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool NETGENPlugin_NETGEN_2D::CheckHypothesis + (SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus) +{ + _hypothesis = NULL; + + list::const_iterator itl; + const SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (!nbHyp) + { + aStatus = SMESH_Hypothesis::HYP_OK; + return true; // can work with no hypothesis + } + + itl = hyps.begin(); + theHyp = (*itl); // use only the first hypothesis + + string hypName = theHyp->GetName(); + + if (hypName == "NETGEN_Parameters_2D") + { + _hypothesis = static_cast (theHyp); + ASSERT(_hypothesis); + aStatus = SMESH_Hypothesis::HYP_OK; + } + else + aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; + + return aStatus == SMESH_Hypothesis::HYP_OK; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool NETGENPlugin_NETGEN_2D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); + + NETGENPlugin_Mesher mesher(meshDS, aShape, false); + mesher.SetParameters(_hypothesis); + return mesher.Compute(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & NETGENPlugin_NETGEN_2D::SaveTo(ostream & save) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & NETGENPlugin_NETGEN_2D::LoadFrom(istream & load) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, NETGENPlugin_NETGEN_2D & hyp) +{ + return hyp.SaveTo( save ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, NETGENPlugin_NETGEN_2D & hyp) +{ + return hyp.LoadFrom( load ); +} diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.hxx new file mode 100644 index 0000000..aafcb2e --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D.hxx @@ -0,0 +1,61 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D.hxx +// Author : Michael Sazonov (OCN) +// Date : 20/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _NETGENPlugin_NETGEN_2D_HXX_ +#define _NETGENPlugin_NETGEN_2D_HXX_ + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "StdMeshers_MaxElementVolume.hxx" +#include "Utils_SALOME_Exception.hxx" + +class NETGENPlugin_Hypothesis_2D; + +class NETGENPlugin_NETGEN_2D: public SMESH_2D_Algo +{ +public: + NETGENPlugin_NETGEN_2D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~NETGENPlugin_NETGEN_2D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, NETGENPlugin_NETGEN_2D & hyp); + friend istream & operator >> (istream & load, NETGENPlugin_NETGEN_2D & hyp); + +protected: + const NETGENPlugin_Hypothesis_2D* _hypothesis; +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cxx new file mode 100644 index 0000000..0f392c1 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.cxx @@ -0,0 +1,173 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D3D.cxx +// Author : Michael Sazonov (OCN) +// Date : 20/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= +using namespace std; + +#include "NETGENPlugin_NETGEN_2D3D.hxx" +#include "NETGENPlugin_Hypothesis.hxx" +#include "NETGENPlugin_Mesher.hxx" + +#include +#include +#include +#include +#include + +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D3D::NETGENPlugin_NETGEN_2D3D(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, studyId, gen) +{ + MESSAGE("NETGENPlugin_NETGEN_2D3D::NETGENPlugin_NETGEN_2D3D"); + _name = "NETGEN_2D3D"; + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type + _compatibleHypothesis.push_back("NETGEN_Parameters"); + _requireDescretBoundary = false; + _onlyUnaryInput = false; + _hypothesis = NULL; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D3D::~NETGENPlugin_NETGEN_2D3D() +{ + MESSAGE("NETGENPlugin_NETGEN_2D3D::~NETGENPlugin_NETGEN_2D3D"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool NETGENPlugin_NETGEN_2D3D::CheckHypothesis + (SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus) +{ + MESSAGE("NETGENPlugin_NETGEN_2D3D::CheckHypothesis"); + + _hypothesis = NULL; + + list::const_iterator itl; + const SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (!nbHyp) + { + aStatus = SMESH_Hypothesis::HYP_OK; + return true; // can work with no hypothesis + } + + itl = hyps.begin(); + theHyp = (*itl); // use only the first hypothesis + + string hypName = theHyp->GetName(); + + if (hypName == "NETGEN_Parameters") + { + _hypothesis = static_cast (theHyp); + ASSERT(_hypothesis); + aStatus = SMESH_Hypothesis::HYP_OK; + } + else + aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; + + return aStatus == SMESH_Hypothesis::HYP_OK; +} + +//============================================================================= +/*! + *Here we are going to use the NETGEN mesher + */ +//============================================================================= + +bool NETGENPlugin_NETGEN_2D3D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); + + NETGENPlugin_Mesher mesher(meshDS, aShape, true); + mesher.SetParameters(_hypothesis); + return mesher.Compute(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & NETGENPlugin_NETGEN_2D3D::SaveTo(ostream & save) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & NETGENPlugin_NETGEN_2D3D::LoadFrom(istream & load) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, NETGENPlugin_NETGEN_2D3D & hyp) +{ + return hyp.SaveTo( save ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, NETGENPlugin_NETGEN_2D3D & hyp) +{ + return hyp.LoadFrom( load ); +} diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.hxx new file mode 100644 index 0000000..169cb15 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D.hxx @@ -0,0 +1,61 @@ +// NETGENPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D3D.hxx +// Author : Michael Sazonov (OCN) +// Date : 20/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _NETGENPlugin_NETGEN_2D3D_HXX_ +#define _NETGENPlugin_NETGEN_2D3D_HXX_ + +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "StdMeshers_MaxElementVolume.hxx" +#include "Utils_SALOME_Exception.hxx" + +class NETGENPlugin_Hypothesis; + +class NETGENPlugin_NETGEN_2D3D: public SMESH_3D_Algo +{ +public: + NETGENPlugin_NETGEN_2D3D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~NETGENPlugin_NETGEN_2D3D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, NETGENPlugin_NETGEN_2D3D & hyp); + friend istream & operator >> (istream & load, NETGENPlugin_NETGEN_2D3D & hyp); + +protected: + const NETGENPlugin_Hypothesis* _hypothesis; +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.cxx new file mode 100644 index 0000000..accbeaf --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.cxx @@ -0,0 +1,81 @@ +// NETGENPlugin : idl implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D3D_i.cxx +// Author : Michael Sazonov (OCN) +// Module : NETGENPlugin +// $Header$ + +using namespace std; +#include "NETGENPlugin_NETGEN_2D3D_i.hxx" +#include "SMESH_Gen.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * NETGENPlugin_NETGEN_2D3D_i::NETGENPlugin_NETGEN_2D3D_i + * + * Constructor + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D3D_i::NETGENPlugin_NETGEN_2D3D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_3D_Algo_i( thePOA ) +{ + MESSAGE( "NETGENPlugin_NETGEN_2D3D_i::NETGENPlugin_NETGEN_2D3D_i" ); + myBaseImpl = new ::NETGENPlugin_NETGEN_2D3D( theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//============================================================================= +/*! + * NETGENPlugin_NETGEN_2D3D_i::~NETGENPlugin_NETGEN_2D3D_i + * + * Destructor + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D3D_i::~NETGENPlugin_NETGEN_2D3D_i() +{ + MESSAGE( "NETGENPlugin_NETGEN_2D3D_i::~NETGENPlugin_NETGEN_2D3D_i" ); +} + +//============================================================================= +/*! + * NETGENPlugin_NETGEN_2D3D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::NETGENPlugin_NETGEN_2D3D* NETGENPlugin_NETGEN_2D3D_i::GetImpl() +{ + MESSAGE( "NETGENPlugin_NETGEN_2D3D_i::GetImpl" ); + return ( ::NETGENPlugin_NETGEN_2D3D* )myBaseImpl; +} diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.hxx new file mode 100644 index 0000000..dc8f6d8 --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D3D_i.hxx @@ -0,0 +1,55 @@ +// NETGENPlugin : idl implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D3D_i.hxx +// Author : Michael Sazonov (OCN) +// Module : NETGENPlugin +// $Header$ + +#ifndef _NETGENPlugin_NETGEN_2D3D_I_HXX_ +#define _NETGENPlugin_NETGEN_2D3D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) + +#include "SMESH_3D_Algo_i.hxx" +#include "NETGENPlugin_NETGEN_2D3D.hxx" + +// ====================================================== +// NETGEN 3d algorithm +// ====================================================== +class NETGENPlugin_NETGEN_2D3D_i: + public virtual POA_NETGENPlugin::NETGENPlugin_NETGEN_2D3D, + public virtual SMESH_3D_Algo_i +{ +public: + // Constructor + NETGENPlugin_NETGEN_2D3D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~NETGENPlugin_NETGEN_2D3D_i(); + + // Get implementation + ::NETGENPlugin_NETGEN_2D3D* GetImpl(); +}; + +#endif diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx new file mode 100644 index 0000000..060af2e --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.cxx @@ -0,0 +1,81 @@ +// NETGENPlugin : idl implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D_i.cxx +// Author : Michael Sazonov (OCN) +// Module : NETGENPlugin +// $Header$ + +using namespace std; +#include "NETGENPlugin_NETGEN_2D_i.hxx" +#include "SMESH_Gen.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i + * + * Constructor + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_2D_Algo_i( thePOA ) +{ + MESSAGE( "NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i" ); + myBaseImpl = new ::NETGENPlugin_NETGEN_2D( theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//============================================================================= +/*! + * NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i + * + * Destructor + */ +//============================================================================= + +NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i() +{ + MESSAGE( "NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i" ); +} + +//============================================================================= +/*! + * NETGENPlugin_NETGEN_2D_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::NETGENPlugin_NETGEN_2D* NETGENPlugin_NETGEN_2D_i::GetImpl() +{ + MESSAGE( "NETGENPlugin_NETGEN_2D_i::GetImpl" ); + return ( ::NETGENPlugin_NETGEN_2D* )myBaseImpl; +} diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.hxx new file mode 100644 index 0000000..af8e9fe --- /dev/null +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_i.hxx @@ -0,0 +1,55 @@ +// NETGENPlugin : idl implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : NETGENPlugin_NETGEN_2D_i.hxx +// Author : Michael Sazonov (OCN) +// Module : NETGENPlugin +// $Header$ + +#ifndef _NETGENPlugin_NETGEN_2D_I_HXX_ +#define _NETGENPlugin_NETGEN_2D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) + +#include "SMESH_2D_Algo_i.hxx" +#include "NETGENPlugin_NETGEN_2D.hxx" + +// ====================================================== +// NETGEN 3d algorithm +// ====================================================== +class NETGENPlugin_NETGEN_2D_i: + public virtual POA_NETGENPlugin::NETGENPlugin_NETGEN_2D, + public virtual SMESH_2D_Algo_i +{ +public: + // Constructor + NETGENPlugin_NETGEN_2D_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~NETGENPlugin_NETGEN_2D_i(); + + // Get implementation + ::NETGENPlugin_NETGEN_2D* GetImpl(); +}; + +#endif -- 2.39.2