From: jfa Date: Sat, 6 May 2006 08:54:13 +0000 (+0000) Subject: Join modifications from branch OCC_debug_for_3_2_0b1 X-Git-Tag: T3_2_0b1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e97896c68ffa2410c664d37d803c66eae28329e7;p=plugins%2Fnetgenplugin.git Join modifications from branch OCC_debug_for_3_2_0b1 --- diff --git a/INSTALL b/INSTALL index 677e917..b058815 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -This is the version 3.2.0a2 of NETGENPLUGIN +This is the version 3.2.0b1 of NETGENPLUGIN Compatible with : - - KERNEL 3.2.0a2 - - SALOMEGUI 3.2.0a2 - - SMESH 3.2.0a2 + - KERNEL 3.2.0b1 + - SALOMEGUI 3.2.0b1 + - SMESH 3.2.0b1 diff --git a/Makefile.in b/Makefile.in index eb02034..810d124 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,3 +1,22 @@ +# 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/ +# # -* Makefile *- # # Author : Patrick GOLDBRONN (CEA) @@ -16,7 +35,16 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl SUBDIRS = idl src adm_local -RESOURCES_FILES = NETGENPlugin.xml +RESOURCES_FILES = \ + NETGENPlugin.xml \ + mesh_hypo_netgen.png \ + mesh_hypo_netgen_2d.png \ + mesh_algo_netgen_2d3d.png \ + mesh_algo_netgen_2d.png \ + mesh_tree_hypo_netgen.png \ + mesh_tree_hypo_netgen_2d.png \ + mesh_tree_algo_netgen_2d3d.png \ + mesh_tree_algo_netgen_2d.png BIN_SCRIPT = VERSION diff --git a/adm_local/Makefile.in b/adm_local/Makefile.in index 9b5e810..b19e7c1 100644 --- a/adm_local/Makefile.in +++ b/adm_local/Makefile.in @@ -1,3 +1,22 @@ +# 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/ +# # source path top_srcdir=@top_srcdir@ top_builddir=.. diff --git a/adm_local/unix/config_files/check_NETGENPLUGIN.m4 b/adm_local/unix/config_files/check_NETGENPLUGIN.m4 index af8cfde..1838cde 100644 --- a/adm_local/unix/config_files/check_NETGENPLUGIN.m4 +++ b/adm_local/unix/config_files/check_NETGENPLUGIN.m4 @@ -3,7 +3,7 @@ AC_DEFUN([CHECK_NETGEN],[ AC_REQUIRE([AC_PROG_CXX])dnl AC_REQUIRE([AC_PROG_CXXCPP])dnl -AC_CHECKING(for Netgen Libraries) +AC_CHECKING(for Netgen 4.5 and higher Libraries) AC_LANG_SAVE AC_LANG_CPLUSPLUS @@ -57,8 +57,8 @@ if test "x$NETGEN_HOME" != "x"; then CPPFLAGS_old="$CPPFLAGS" CXXFLAGS_old="$CXXFLAGS" - CPPFLAGS="$NETGEN_INCLUDES $CPPFLAGS" - CXXFLAGS="$NETGEN_INCLUDES $CXXFLAGS" + CPPFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CPPFLAGS" + CXXFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CXXFLAGS" AC_MSG_CHECKING(for Netgen header file) @@ -68,13 +68,19 @@ if test "x$NETGEN_HOME" != "x"; then AC_MSG_CHECKING(for Netgen libraries) LDFLAGS_old="$LDFLAGS" - LDFLAGS="-L. -lNETGEN $LDFLAGS" + LDFLAGS="-L. -lNETGEN $CAS_LDPATH -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo $LDFLAGS" AC_TRY_COMPILE(#include #include +namespace nglib { #include "nglib.h" -,Ng_Init(); - Ng_Exit();,Netgen_ok=yes;ar x "$NETGEN_LIBS_DIR/libnginterface.a"; +} +#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"; @@ -83,17 +89,22 @@ if test "x$NETGEN_HOME" != "x"; then 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 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.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.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 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 spline2d.o splinegeometry2.o ngnewdelete.o nglib.o -o libNETGEN.so; - rm -rf adfront2.o adfront3.o adtree.o algprim.o array.o basemat.o bfgs.o bisect.o bitarray.o boundarylayer.o brick.o bspline2d.o clusters.o csgeom.o csgparser.o curve2d.o curvedelems.o delaunay.o densemat.o dynamicmem.o edgeflw.o explicitcurve2d.o extrusion.o flags.o gencyl.o genmesh.o geom2dmesh.o geom2d.o geom3d.o geomfuncs.o geomsearch.o geomtest3d.o global.o hashtabl.o hprefinement.o identify.o importsolution.o improve2gen.o improve2.o improve3.o linopt.o linsearch.o localh.o manifold.o meshclass.o meshfunc2d.o meshfunc.o meshing2.o meshing3.o meshstlsurface.o meshsurf.o meshtool.o meshtype.o moveablemem.o msghandler.o mystring.o netrule2.o netrule3.o ngexception.o nglib.o ngnewdelete.o optmem.o parser2.o parser3.o parthreads.o polyhedra.o polynomial.o prism2rls.o pyramid2rls.o pyramidrls.o quadrls.o readuser.o refine.o revolution.o ruler2.o ruler3.o secondorder.o seti.o singularref.o smoothing2.o smoothing3.o solid.o sort.o sparsmat.o spbita2d.o specials.o specpoin.o spline2d.o spline3d.o splinegeometry2.o stlgeomchart.o stlgeommesh.o stlgeom.o stlline.o stltool.o stltopology.o surface.o symbolta.o table.o tetrarls.o topology.o transform3d.o triapprox.o triarls.o vector.o writeabaqus.o writediffpack.o writefeap.o writefluent.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o zrefine.o, + $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" -,Ng_Init(); - Ng_Exit();, +} +#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" diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index bd60ef8..19336a2 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -105,6 +105,7 @@ OCC_VIEWER_LIBS=@CAS_VIEWER@ OCC_MODELER_LIBS=@CAS_MODELER@ OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ OCC_LIBS=@CAS_LDFLAGS@ +OCC_LDPATH=@CAS_LDPATH@ # MPICH @@ -234,7 +235,13 @@ all: Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in cd $(top_builddir) ; ./config.status -$(top_builddir)/config.status: $(top_srcdir)/configure +LOCAL_MAKE = make_commence make_omniorb + +KERNEL_MAKE = make_module make_conclude depend SALOMEconfig.h F77config.h sstream envScript + +$(top_builddir)/config.status: $(top_srcdir)/configure \ + $(LOCAL_MAKE:%=$(top_srcdir)/adm_local/unix/%.in) \ + $(KERNEL_MAKE:%=$(KERNEL_ROOT_DIR)/salome_adm/unix/%.in) cd $(top_builddir) ; ./config.status --recheck # VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-) @@ -249,7 +256,7 @@ $(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base cd $(top_srcdir) && ./build_configure -ACLOCAL_SRC = \ +ACLOCAL_KERNEL = \ ac_cxx_bool.m4 check_corba.m4 \ ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \ ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \ @@ -270,11 +277,11 @@ ACLOCAL_GEOM = check_GEOM.m4 ACLOCAL_SMESH = check_SMESH.m4 -$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ +$(top_srcdir)/aclocal.m4: $(ACLOCAL_KERNEL%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ $(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%) \ $(ACLOCAL_GEOM:%=@GEOM_ROOT_DIR@/adm_local/unix/config_files/%) \ $(ACLOCAL_SMESH:%=@SMESH_ROOT_DIR@/adm_local/unix/config_files/%) - cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ + cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ -I @GUI_ROOT_DIR@/adm_local/unix/config_files \ -I @GEOM_ROOT_DIR@/adm_local/unix/config_files \ -I @SMESH_ROOT_DIR@/adm_local/unix/config_files diff --git a/bin/VERSION b/bin/VERSION index a969cb5..28be725 100755 --- a/bin/VERSION +++ b/bin/VERSION @@ -1 +1 @@ -THIS IS SALOME - NETGENPLUGIN VERSION: 3.2.0a2 +THIS IS SALOME - NETGENPLUGIN VERSION: 3.2.0b1 diff --git a/build_configure b/build_configure index 61073f4..cf7d322 100755 --- a/build_configure +++ b/build_configure @@ -157,9 +157,9 @@ echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1 -echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 -echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 diff --git a/idl/Makefile.in b/idl/Makefile.in index f5aac86..cc6c37f 100644 --- a/idl/Makefile.in +++ b/idl/Makefile.in @@ -1,3 +1,22 @@ +# 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/ +# # # generate dependencies for idl file : # diff --git a/idl/NETGENPlugin_Algorithm.idl b/idl/NETGENPlugin_Algorithm.idl index d8d0263..76a6772 100644 --- a/idl/NETGENPlugin_Algorithm.idl +++ b/idl/NETGENPlugin_Algorithm.idl @@ -40,6 +40,56 @@ module NETGENPlugin { }; + /*! + * NETGENPlugin_NETGEN_2D: interface of "1D-2D (Netgen)" algorithm + */ + interface NETGENPlugin_NETGEN_2D : SMESH::SMESH_2D_Algo + { + }; + + /*! + * NETGENPlugin_NETGEN_2D3D: interface of "1D-2D-3D (Netgen)" algorithm + */ + interface NETGENPlugin_NETGEN_2D3D : SMESH::SMESH_3D_Algo + { + }; + + /*! + * NETGENPlugin_Hypothesis: interface of "NETGEN parameters" hypothesis + */ + interface NETGENPlugin_Hypothesis : SMESH::SMESH_Hypothesis + { + void SetMaxSize(in double value); + double GetMaxSize(); + + void SetSecondOrder(in boolean value); + boolean GetSecondOrder(); + + void SetOptimize(in boolean value); + boolean GetOptimize(); + + void SetFineness(in long value); + long GetFineness(); + + void SetGrowthRate(in double value); + double GetGrowthRate(); + + void SetNbSegPerEdge(in double value); + double GetNbSegPerEdge(); + + void SetNbSegPerRadius(in double value); + double GetNbSegPerRadius(); + }; + + /*! + * NETGENPlugin_Hypothesis_2D: interface of "NETGEN 2D parameters" hypothesis + */ + interface NETGENPlugin_Hypothesis_2D : NETGENPlugin_Hypothesis + { + void SetQuadAllowed(in boolean value); + boolean GetQuadAllowed(); + }; + }; #endif diff --git a/resources/NETGENPlugin.xml b/resources/NETGENPlugin.xml index ba9ece2..df4e14d 100644 --- a/resources/NETGENPlugin.xml +++ b/resources/NETGENPlugin.xml @@ -8,11 +8,34 @@ + gui-lib="libNETGENPluginGUI.so"> + + + + + + diff --git a/resources/mesh_algo_netgen_2d.png b/resources/mesh_algo_netgen_2d.png new file mode 100644 index 0000000..2629a2b Binary files /dev/null and b/resources/mesh_algo_netgen_2d.png differ diff --git a/resources/mesh_algo_netgen_2d3d.png b/resources/mesh_algo_netgen_2d3d.png new file mode 100644 index 0000000..2629a2b Binary files /dev/null and b/resources/mesh_algo_netgen_2d3d.png differ diff --git a/resources/mesh_hypo_netgen.png b/resources/mesh_hypo_netgen.png new file mode 100644 index 0000000..3fb67d5 Binary files /dev/null and b/resources/mesh_hypo_netgen.png differ diff --git a/resources/mesh_hypo_netgen_2d.png b/resources/mesh_hypo_netgen_2d.png new file mode 100644 index 0000000..487fdb7 Binary files /dev/null and b/resources/mesh_hypo_netgen_2d.png differ diff --git a/resources/mesh_tree_algo_netgen_2d.png b/resources/mesh_tree_algo_netgen_2d.png new file mode 100755 index 0000000..092eae3 Binary files /dev/null and b/resources/mesh_tree_algo_netgen_2d.png differ diff --git a/resources/mesh_tree_algo_netgen_2d3d.png b/resources/mesh_tree_algo_netgen_2d3d.png new file mode 100644 index 0000000..eeaf98a Binary files /dev/null and b/resources/mesh_tree_algo_netgen_2d3d.png differ diff --git a/resources/mesh_tree_hypo_netgen.png b/resources/mesh_tree_hypo_netgen.png new file mode 100644 index 0000000..ad5e9f3 Binary files /dev/null and b/resources/mesh_tree_hypo_netgen.png differ diff --git a/resources/mesh_tree_hypo_netgen_2d.png b/resources/mesh_tree_hypo_netgen_2d.png new file mode 100644 index 0000000..cd813c8 Binary files /dev/null and b/resources/mesh_tree_hypo_netgen_2d.png differ diff --git a/src/GUI/Makefile.in b/src/GUI/Makefile.in new file mode 100644 index 0000000..7f95f16 --- /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/ +# +# 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..2cf5c38 --- /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.org +// +// +// +// 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..525d2a8 --- /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.org +// +// +// +// 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..7411351 --- /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.org +// +// +// +// 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..4d8a573 --- /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/ +# +# 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..07871b3 --- /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/ +# +# 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/Makefile.in b/src/Makefile.in index 6b66e77..f83554a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -31,6 +31,6 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = NETGEN NETGENPlugin +SUBDIRS = NETGEN NETGENPlugin GUI @MODULE@ diff --git a/src/NETGEN/Makefile.in b/src/NETGEN/Makefile.in index e2092a8..90b4b09 100644 --- a/src/NETGEN/Makefile.in +++ b/src/NETGEN/Makefile.in @@ -1,3 +1,22 @@ +# 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/ +# # -* Makefile *- # # Author : Edward AGAPOV (OCC) @@ -21,24 +40,26 @@ LIB = libNETGEN.la LIB_OBJ_O = \ linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o \ - improve3.o adfront3.o tetrarls.o prism2rls.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.o \ - clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.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 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 spline2d.o splinegeometry2.o ngnewdelete.o nglib.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 NETGEN_LIBS_DIR=@NETGEN_LIBS_DIR@ $(LIB_OBJ_O): 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 @@ -47,7 +68,7 @@ $(LIB_OBJ_O): ar x $(NETGEN_LIBS_DIR)/libla.a ar x $(NETGEN_LIBS_DIR)/libstlgeom.a ar x $(NETGEN_LIBS_DIR)/libgeom2d.a - rm -rf sgparser.o hprefinement.o parthreads.o writediffpack.o writepermas.o writeuser.o dynamicmem.o importsolution.o readuser.o writefeap.o writetecplot.o wuchemnitz.o extrusion.o writeabaqus.o writefluent.o writetochnog.o csgparser.o geom2dmesh.o + rm -rf 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 LIB_OBJ_LO = $(LIB_OBJ_O:%.o=%.lo) @@ -62,4 +83,6 @@ else LDFLAGS += -lg2c endif +LDFLAGS += $(OCC_LDPATH) -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES + MOSTLYCLEAN += $(LIB_OBJ_O) diff --git a/src/NETGEN/ReadMeForNgUsers b/src/NETGEN/ReadMeForNgUsers index 555eb97..4abb2b1 100644 --- a/src/NETGEN/ReadMeForNgUsers +++ b/src/NETGEN/ReadMeForNgUsers @@ -1,102 +1,78 @@ -The Netgen 4.3 from the web location : http://www.hpfem.jku.at/netgen/ is used -in the SMESH Module of Salome2 distribution. +The Netgen 4.5 from the web location : http://www.hpfem.jku.at/netgen/ +(CVS access) is used in the SMESH Module of Salome3 distribution. How to build Netgen for Salome ------------------------------ -Patch the official netgen 4.3 distribution: +Patch the netgen 4.5 distribution: -$ cd netgen43 -$ patch -p1 < patch_directory/netgen43ForSalome.patch +$ cd netgen45 +$ patch -p1 < patch_directory/netgen45ForSalome.patch -Then run makeForSalome.sh: +Then run makeForSalome.sh (it will be created by the patch): $ sh makeForSalome.sh Additional information for maintainers -------------------------------------- -The SMESH Engine of SALOME2 (particularly the m4 file check_Netgen.m4) assume +The file check_NETGENPLUGIN.m4 assumes that Netgen is installed in the directory as follow: prompt> ls -bin/ cshrc_for_netgen doc/ include/ lib/ tutorials/ - -prompt> ls /bin - -LINUX/ - -prompt> ls /bin/LINUX/ - -demoapp/ ng ng.tcl ngtcltk/ startup.tcl - -prompt> ls /bin/LINUX/demoapp/ - -demoapp.tcl - -prompt> ls /bin/LINUX/ngtcltk/ - -dialog.tcl menustat.tcl ngicon.tcl parameters.tcl -drawing.tcl nghelp.tcl ngvisual.tcl variables.tcl - -prompt> ls /doc/ - -ng4.pdf usenetgen.ps - -prompt> ls /include/ - -nglib.h - -prompt> ls /lib/ +include/ lib/ + +prompt> ls /include + +adfront2.hpp explicitcurve2d.hpp hpref_quad.hpp myadt.hpp spbita2d.hpp +adfront3.hpp extrusion.hpp hpref_segm.hpp mydefs.hpp specials.hpp +adtree.hpp findip.hpp hpref_tet.hpp mystdlib.h specpoin.hpp +algprim.hpp findip2.hpp hpref_trig.hpp mystring.hpp spline.hpp +array.hpp flags.hpp hprefinement.hpp ngexception.hpp spline2d.hpp +autoptr.hpp gencyl.hpp identify.hpp nglib.h spline3d.hpp +basemat.hpp geom2d.hpp improve2.hpp occgeom.hpp splinegeometry.hpp +bisect.hpp geom2dmesh.hpp improve3.hpp occmeshsurf.hpp splinegeometry2.hpp +bitarray.hpp geom3d.hpp linalg.hpp opti.hpp stack.hpp +boundarylayer.hpp geometry2d.hpp localh.hpp optmem.hpp stlgeom.hpp +brick.hpp geomfuncs.hpp manifold.hpp parthreads.hpp stlline.hpp +classifyhpel.hpp geoml.hpp meshclass.hpp polyhedra.hpp stltool.hpp +clusters.hpp geomobjects.hpp meshfunc.hpp polynomial.hpp stltopology.hpp +csg.hpp geomops.hpp meshing.hpp profiler.hpp surface.hpp +csgeom.hpp geomsearch.hpp meshing2.hpp revolution.hpp symbolta.hpp +csgparser.hpp geomtest3d.hpp meshing3.hpp ruler2.hpp table.hpp +curve2d.hpp global.hpp meshstlsurface.hpp ruler3.hpp template.hpp +curvedelems.hpp gprim.hpp meshsurf.hpp seti.hpp topology.hpp +curvedelems_new.hpp hashtabl.hpp meshtool.hpp singularref.hpp transform3d.hpp +densemat.hpp hpref_hex.hpp meshtype.hpp solid.hpp triapprox.hpp +dynamicmem.hpp hpref_prism.hpp moveablemem.hpp sort.hpp vector.hpp +edgeflw.hpp hpref_pyramid.hpp msghandler.hpp sparsmat.hpp + +prompt> ls /lib LINUX/ -prompt> ls /lib/LINUX/ +prompt> ls /lib/LINUX -libcsg.a libgeom2d.a libla.a libnginterface.a libstlgeom.a -libgen.a libgprim.a libmesh.a libopti.a libvis.a +libcsg.a libgeom2d.a libla.a libnginterface.a libopti.a +libgen.a libgprim.a libmesh.a libocc.a libstlgeom.a -prompt> ls /tutorials/ - -boxcyl.geo cylinder.geo ficherea.geo part1.stl square.in2d -cone.geo cylsphere.geo hinge.stl sculpture.geo trafo.geo -cubeandspheres.geo demo2d.in2d lshape3d.geo shaft.geo twobricks.geo -cube.geo ellipsoid.geo manyholes.geo sphere.geo twocubes.geo -cubemcyl.geo ellipticcyl.geo matrix.geo sphereincube.geo twocyl.geo -cubemsphere.geo - -All *.tcl files are needed to control and initiate the Netgen mesher throughout its -MHI (Machine Human Interface)./bin/LINUX/ng is the Netgen -executable with its embarked MHI. All the libraries *.a should be compiled without -the option -DOPENGL which is only needed for the Netgen MHI. netgen43 is assumed to -be the directory downloaded from the above web location archive of Netgen. The library +All the libraries *.a should be compiled without the option -DOPENGL. +netgen45 is assumed to be the directory downloaded from the above web +location archive of Netgen. The library /lib/LINUX/libnginterface.a should contain the objects -nglib.o (from netgen43/libsrc/interface/nglib.cpp) and ngnewdelete.o -(from netgen43/ngtcltk/ngnewdelete.cpp). +nglib.o (from netgen45/libsrc/interface/nglib.cpp) and ngnewdelete.o +(from netgen45/ngtcltk/ngnewdelete.cpp). To have that kind of distribution from the version in the above web location you -should first compile Netgen as suggested in the netgen43/README.INSTALL file. It will -then produce the executable ng linked statically with the libraries *.a. Then modify -the Makefiles to remove -DOPENGL from compiler flags list, add the objects nglib.o -and ngnewdelete.o to the library libnginterface.a and recompile the libraries only. - -From the above web location perhaps, you will have to alter some Netgen sources to -compile them; if you find any difficulties to do that, just ask me. - -Nadir - -******************************** -* Dr Nadir Bouhamou * -* Ingénieur-chercheur * -* Engineer-Researcher * -* * -* CEA Saclay * -* DEN/DM2S/SFME/LGLS * -* Bat 454 Pièce 5A * -* 91191 Gif-Sur-Yvette cédex * -* * -* Tél: +33 (0)1 69 08 73 07 * -* Fax: +33 (0)1 69 08 96 96 * -* email: nadir.bouhamou@cea.fr * -******************************** +need not to compile Netgen as suggested in the netgen45/README.INSTALL file. +Simply modify the Makefiles to remove -DOPENGL from compiler flags +list and to add OCC include dir and flags to compiler flags, add the objects +nglib.o and ngnewdelete.o to the library libnginterface.a and +recompile the libraries only. +All this job is done by applying the patch and running the script makeForSalome.sh. + +Th suggested patch alters some Netgen sources to compile them. + +Michael SAZONOV +m-sazonov@opencascade.com diff --git a/src/NETGEN/netgen43ForSalome.patch b/src/NETGEN/netgen43ForSalome.patch deleted file mode 100644 index 5e08d88..0000000 --- a/src/NETGEN/netgen43ForSalome.patch +++ /dev/null @@ -1,221 +0,0 @@ -diff -N -r -u netgen43/libsrc/include/spline2d.hpp /tmp/netgen43/libsrc/include/spline2d.hpp ---- netgen43/libsrc/include/spline2d.hpp 1970-01-01 01:00:00.000000000 +0100 -+++ /tmp/netgen43/libsrc/include/spline2d.hpp 2003-12-10 16:28:12.000000000 +0100 -@@ -0,0 +1 @@ -+#include "../geom2d/spline2d.hpp" -diff -N -r -u netgen43/libsrc/include/splinegeometry2.hpp /tmp/netgen43/libsrc/include/splinegeometry2.hpp ---- netgen43/libsrc/include/splinegeometry2.hpp 1970-01-01 01:00:00.000000000 +0100 -+++ /tmp/netgen43/libsrc/include/splinegeometry2.hpp 2003-12-10 16:28:23.000000000 +0100 -@@ -0,0 +1 @@ -+#include "../geom2d/splinegeometry2.hpp" -diff -N -r -u netgen43/libsrc/interface/Makefile /tmp/netgen43/libsrc/interface/Makefile ---- netgen43/libsrc/interface/Makefile 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/interface/Makefile 2003-12-10 15:59:47.000000000 +0100 -@@ -1,4 +1,4 @@ --src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.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 readuser.cpp importsolution.cpp nglib.cpp ngnewdelete.cpp - # - lib = nginterface - libpath = libsrc/interface -diff -N -r -u netgen43/libsrc/interface/nglib.cpp /tmp/netgen43/libsrc/interface/nglib.cpp ---- netgen43/libsrc/interface/nglib.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/interface/nglib.cpp 2003-12-10 16:32:54.000000000 +0100 -@@ -23,6 +23,20 @@ - - #include "nglib.h" - -+namespace netgen -+{ -+ char geomfilename [100]; -+ -+ //Destination for messages, errors, ... -+ void Ng_PrintDest(const char * s) -+ { -+ (*mycout) << s << flush; -+ } -+ -+#include -+#include -+} -+ - using namespace netgen; - - // constants and types: -@@ -171,8 +185,6 @@ - // CSG Geometry - - // FlexLexer * lexer; --char geomfilename [100]; -- - - // 2D Meshing Functions: - -@@ -362,7 +374,18 @@ - cout << "e(" << readedges.Get(i) << "," << readedges.Get(i+1) << ")" << endl; - } - */ -- geo->AddEdges(readedges); -+ -+ ARRAY< Point<3> > readedges1; -+ -+ for (i = 1; i <= readedges.Size(); i++) -+ { -+ Point3d readedgesData = readedges.Get(i); -+ Point <3> readedges1Data = Point<3>(readedgesData.X(),readedgesData.Y(),readedgesData.Z()); -+ -+ readedges1.Append(readedges1Data); -+ } -+ -+ geo->AddEdges(readedges1); - } - - if (geo->GetStatus() == STLTopology::STL_GOOD || geo->GetStatus() == STLTopology::STL_WARNING) return NG_OK; -@@ -472,7 +495,14 @@ - n = Vec3d(nv[0],nv[1],nv[2]); - } - -- readtrias.Append(STLReadTriangle(apts,n)); -+ Point<3> apts1[3]; -+ apts1[0] = Point<3>(p1[0],p1[1],p1[2]); -+ apts1[1] = Point<3>(p2[0],p2[1],p2[2]); -+ apts1[2] = Point<3>(p3[0],p3[1],p3[2]); -+ -+ Vec<3> n1 = Vec<3>(n.X(),n.Y(),n.Z()); -+ -+ readtrias.Append(STLReadTriangle(apts1,n1)); - } - - // add (optional) edges: -@@ -487,30 +517,29 @@ - - // compatibility functions: - --void MyError (const char * ch) -+void netgen::MyError (const char * ch) - { - cerr << ch; - } - --//Destination for messages, errors, ... --void Ng_PrintDest(const char * s) --{ -- (*mycout) << s << flush; --} -- -- --double GetTime () -+double netgen::GetTime () - { - return 0; - } - --void ResetTime () -+void netgen::ResetTime () - { - ; - } - --void MyBeep (int i) -+void netgen::MyBeep (int i) - { - ; - } - -+void MeshFromSpline2D (SplineGeometry2d & geometry, -+ Mesh *& mesh, -+ MeshingParameters & mp) -+{ -+ MeshFromSpline2D (geometry, mesh, mp); -+} -diff -N -r -u netgen43/libsrc/makefile.mach.LINUX /tmp/netgen43/libsrc/makefile.mach.LINUX ---- netgen43/libsrc/makefile.mach.LINUX 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/makefile.mach.LINUX 2003-12-10 15:12:18.000000000 +0100 -@@ -14,7 +14,8 @@ - # - CFLAGS2 = - # pg stands for profiling - also in linkflags2 --CPLUSPLUSFLAGS2 = -O2 -I/usr/X11R6/include -DLINUX -DOPENGL -+#CPLUSPLUSFLAGS2 = -O2 -I/usr/X11R6/include -DLINUX -DOPENGL -+CPLUSPLUSFLAGS2 = -O2 -I/usr/X11R6/include -DLINUX - # -fomit-frame-pointer - # -ffast-math - # -diff -N -r -u netgen43/libsrc/meshing/improve2.cpp /tmp/netgen43/libsrc/meshing/improve2.cpp ---- netgen43/libsrc/meshing/improve2.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/meshing/improve2.cpp 2003-12-10 15:42:00.000000000 +0100 -@@ -3,7 +3,7 @@ - #include "meshing.hpp" - #include - --#include -+/*#include */ - - - namespace netgen -diff -N -r -u netgen43/libsrc/meshing/meshing2.cpp /tmp/netgen43/libsrc/meshing/meshing2.cpp ---- netgen43/libsrc/meshing/meshing2.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/meshing/meshing2.cpp 2003-12-10 15:34:35.000000000 +0100 -@@ -1785,7 +1785,7 @@ - - - #else --void glrender (int wait) -+void netgen::glrender (int wait) - { - ; - } -diff -N -r -u netgen43/libsrc/visualization/stlmeshing.cpp /tmp/netgen43/libsrc/visualization/stlmeshing.cpp ---- netgen43/libsrc/visualization/stlmeshing.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/visualization/stlmeshing.cpp 2003-12-10 15:52:53.000000000 +0100 -@@ -5,7 +5,7 @@ - #include - - #include --#include -+/*#include */ - - namespace netgen - { -diff -N -r -u netgen43/Makefile /tmp/netgen43/Makefile ---- netgen43/Makefile 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/Makefile 2003-12-10 15:11:41.000000000 +0100 -@@ -35,7 +35,8 @@ - .SUFFIXES: .cpp .o - # - # --CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -DOPENGL -+#CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -DOPENGL -+CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include - LINKFLAGS1 = -lGL -lGLU -lX11 -lXext -lXmu - # - CPLUSPLUSFLAGS = $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGS3) -diff -N -r -u netgen43/makeForSalome.sh /tmp/netgen43/makeForSalome.sh ---- netgen43/makeForSalome.sh 1970-01-01 01:00:00.000000000 +0100 -+++ /tmp/netgen43/makeForSalome.sh 2004-01-05 12:33:59.000000000 +0100 -@@ -0,0 +1,26 @@ -+#! /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 -+ -+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 install/include 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/Makefile.in b/src/NETGENPlugin/Makefile.in index c33380d..88e5885 100644 --- a/src/NETGENPlugin/Makefile.in +++ b/src/NETGENPlugin/Makefile.in @@ -1,3 +1,22 @@ +# 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/ +# # -* Makefile *- # # Author : Edward AGAPOV (OCC) @@ -10,20 +29,32 @@ top_srcdir=@top_srcdir@ top_builddir=../.. srcdir=@srcdir@ -VPATH=.:@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_icons.po - LIB_SRC = \ NETGENPlugin_NETGEN_3D.cxx \ NETGENPlugin_NETGEN_3D_i.cxx \ + NETGENPlugin_NETGEN_2D.cxx \ + NETGENPlugin_NETGEN_2D_i.cxx \ + NETGENPlugin_NETGEN_2D3D.cxx \ + NETGENPlugin_NETGEN_2D3D_i.cxx \ + NETGENPlugin_Hypothesis.cxx \ + NETGENPlugin_Hypothesis_i.cxx \ + NETGENPlugin_Hypothesis_2D.cxx \ + NETGENPlugin_Hypothesis_2D_i.cxx \ + NETGENPlugin_Mesher.cxx \ NETGENPlugin_i.cxx LIB_SERVER_IDL = NETGENPlugin_Algorithm.idl +LIB_CLIENT_IDL = \ + SALOME_Component.idl \ + SALOME_Comm.idl \ + GEOM_Gen.idl \ + MED.idl + # Libraries targets LIB = libNETGENEngine.la diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx new file mode 100644 index 0000000..905a244 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..df18995 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..920c534 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..2ffabc8 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..77820ec --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..29ca9b3 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..af4df0b --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..0c61322 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..79b0ed9 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..dc3a92f --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..7c53a91 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..c1a87eb --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..35a57f9 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..f2b9f96 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..ff86ed2 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..2d5b823 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..6c597fc --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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..4292cd4 --- /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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// 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 diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index bb34c62..159a2e3 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -1,3 +1,22 @@ +// 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/ +// //============================================================================= // File : NETGENPlugin_NETGEN_3D.cxx // Moved here from SMESH_NETGEN_3D.cxx @@ -17,7 +36,7 @@ using namespace std; #include "SMESHDS_Mesh.hxx" #include "SMDS_MeshElement.hxx" #include "SMDS_MeshNode.hxx" -#include "StdMeshers_Helper.hxx" +#include "SMESH_MesherHelper.hxx" #include #include @@ -34,7 +53,10 @@ using namespace std; Netgen include files */ -#include "nglib.h" +namespace nglib { +#include +} +using namespace nglib; //============================================================================= /*! @@ -138,7 +160,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, // get triangles on aShell and make a map of nodes to Netgen node IDs // ------------------------------------------------------------------- - StdMeshers_Helper* myTool = new StdMeshers_Helper(aMesh); + SMESH_MesherHelper* myTool = new SMESH_MesherHelper(aMesh); bool _quadraticMesh = myTool->IsQuadraticSubMesh(aShape); typedef map< const SMDS_MeshNode*, int> TNodeToIDMap; diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx index b085880..537ba58 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx @@ -1,3 +1,22 @@ +// 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/ +// //============================================================================= // File : NETGENPlugin_NETGEN_3D.hxx // Moved here from SMESH_NETGEN_3D.hxx diff --git a/src/NETGENPlugin/NETGENPlugin_i.cxx b/src/NETGENPlugin/NETGENPlugin_i.cxx index a08f1be..92f967a 100644 --- a/src/NETGENPlugin/NETGENPlugin_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_i.cxx @@ -30,6 +30,16 @@ using namespace std; #include "utilities.h" #include "NETGENPlugin_NETGEN_3D_i.hxx" +#include "NETGENPlugin_NETGEN_2D_i.hxx" +#include "NETGENPlugin_NETGEN_2D3D_i.hxx" +#include "NETGENPlugin_Hypothesis_i.hxx" +#include "NETGENPlugin_Hypothesis_2D_i.hxx" + +template class NETGENPlugin_Creator_i:public HypothesisCreator_i +{ + // as we have 'module NETGENPlugin' in NETGENPlugin_Algorithm.idl + virtual std::string GetModuleName() { return "NETGENPlugin"; } +}; //============================================================================= /*! @@ -49,7 +59,16 @@ extern "C" // Algorithms if (strcmp(aHypName, "NETGEN_3D") == 0) - aCreator = new HypothesisCreator_i; + aCreator = new NETGENPlugin_Creator_i; + else if (strcmp(aHypName, "NETGEN_2D") == 0) + aCreator = new NETGENPlugin_Creator_i; + else if (strcmp(aHypName, "NETGEN_2D3D") == 0) + aCreator = new NETGENPlugin_Creator_i; + // Hypotheses + else if (strcmp(aHypName, "NETGEN_Parameters") == 0) + aCreator = new NETGENPlugin_Creator_i; + else if (strcmp(aHypName, "NETGEN_Parameters_2D") == 0) + aCreator = new NETGENPlugin_Creator_i; else ; return aCreator; diff --git a/src/NETGENPlugin/NETGENPlugin_icons.po b/src/NETGENPlugin/NETGENPlugin_icons.po deleted file mode 100644 index a3f6297..0000000 --- a/src/NETGENPlugin/NETGENPlugin_icons.po +++ /dev/null @@ -1,20 +0,0 @@ -# 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" - - -#----------------------------------------------------------- -# ObjectBrowser -#----------------------------------------------------------- - -#mesh_tree_algo_netgen -msgid "ICON_SMESH_TREE_ALGO_NETGEN_3D" -msgstr "mesh_tree_algo_tetra.png" -#msgstr "mesh_tree_algo_netgen.png"