Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7a6fe8cb2b | ||
![]() |
38b11905c3 | ||
![]() |
b4dd1ea56c | ||
![]() |
d1ed4d43ef | ||
![]() |
9565b39f81 | ||
![]() |
7caa737797 | ||
![]() |
2a1dcc2d04 | ||
![]() |
8aa09ae908 | ||
![]() |
7c12dca52a | ||
![]() |
da18b44963 | ||
![]() |
30859bc68d | ||
![]() |
ee63a46d6e | ||
![]() |
efeb59f024 | ||
![]() |
d38a69aaf9 | ||
![]() |
07a1186497 | ||
![]() |
defb336a7b | ||
![]() |
861e381989 | ||
![]() |
2c929246f6 | ||
![]() |
c2c6bf25cc | ||
![]() |
59ab1d8e2b | ||
![]() |
29bdee2b25 | ||
![]() |
3797701125 | ||
![]() |
7004be4f8a | ||
![]() |
27a9ce955f | ||
![]() |
41ac578763 | ||
![]() |
566aa2640b | ||
![]() |
0b1c10baab | ||
![]() |
33346e31ba | ||
![]() |
1dd5913e4e | ||
![]() |
9ab44e1f03 | ||
![]() |
30b91f7405 | ||
![]() |
a1bb961bcb |
145
adm_local/unix/config_files/check_NETGEN.m4
Normal file
145
adm_local/unix/config_files/check_NETGEN.m4
Normal file
@ -0,0 +1,145 @@
|
||||
AC_DEFUN([CHECK_NETGEN],[
|
||||
|
||||
AC_REQUIRE([AC_PROG_CXX])dnl
|
||||
AC_REQUIRE([AC_PROG_CXXCPP])dnl
|
||||
|
||||
AC_CHECKING(for Netgen 4.5 and higher Libraries)
|
||||
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
AC_ARG_WITH(netgen,
|
||||
[ --with-netgen=DIR root directory path of NETGEN installation],
|
||||
NETGEN_HOME=$withval,NETGEN_HOME="")
|
||||
|
||||
NETGEN_INCLUDES=""
|
||||
NETGEN_LIBS_DIR=""
|
||||
|
||||
Netgen_ok=no
|
||||
|
||||
if test "x$NETGEN_HOME" == "x" ; then
|
||||
|
||||
# no --with-netgen option used
|
||||
if test "x$NETGENHOME" != "x" ; then
|
||||
|
||||
# NETGENHOME environment variable defined
|
||||
NETGEN_HOME=$NETGENHOME
|
||||
|
||||
fi
|
||||
#
|
||||
fi
|
||||
|
||||
if test "x$NETGEN_HOME" != "x"; then
|
||||
|
||||
echo
|
||||
echo
|
||||
echo -------------------------------------------------
|
||||
echo You are about to choose to use somehow the
|
||||
echo Netgen Library to generate Tetrahedric mesh.
|
||||
echo
|
||||
echo WARNING
|
||||
echo ----------------------------------------------------------
|
||||
echo ----------------------------------------------------------
|
||||
echo You are strongly advised to consult the file
|
||||
echo NETGENPLUGIN_SRC/src/NETGEN/ReadMeForNgUsers, particularly about
|
||||
echo assumptions made on the installation of the Netgen
|
||||
echo application and libraries.
|
||||
echo Ask your system administrator for those details.
|
||||
echo ----------------------------------------------------------
|
||||
echo ----------------------------------------------------------
|
||||
echo
|
||||
echo
|
||||
|
||||
|
||||
|
||||
NETGEN_INCLUDES="-I${NETGEN_HOME}/include"
|
||||
|
||||
# check ${NETGEN_HOME}/lib/LINUX directory for libraries
|
||||
if test -f ${NETGEN_HOME}/lib/LINUX/libcsg.a ; then
|
||||
NETGEN_LIBS_DIR="${NETGEN_HOME}/lib/LINUX"
|
||||
else
|
||||
# check ${NETGEN_HOME}/lib/LINUX64 directory for libraries
|
||||
if test -f ${NETGEN_HOME}/lib/LINUX64/libcsg.a ; then
|
||||
NETGEN_LIBS_DIR="${NETGEN_HOME}/lib/LINUX64"
|
||||
else
|
||||
NETGEN_LIBS_DIR="${NETGEN_HOME}/lib"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "NETGEN_LIBS_DIR = $NETGEN_LIBS_DIR"
|
||||
|
||||
CPPFLAGS_old="$CPPFLAGS"
|
||||
CXXFLAGS_old="$CXXFLAGS"
|
||||
CPPFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CPPFLAGS"
|
||||
CXXFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CXXFLAGS"
|
||||
|
||||
AC_MSG_CHECKING(for Netgen header file)
|
||||
|
||||
AC_CHECK_HEADER(nglib.h,Netgen_ok=yes,Netgen_ok=no)
|
||||
if test "x$Netgen_ok" == "xyes"; then
|
||||
|
||||
AC_MSG_CHECKING(for Netgen libraries)
|
||||
|
||||
LDFLAGS_old="$LDFLAGS"
|
||||
LDFLAGS="-L. -lNETGEN $CAS_LDPATH -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo $LDFLAGS"
|
||||
|
||||
AC_TRY_COMPILE(#include <iostream.h>
|
||||
#include <fstream.h>
|
||||
namespace nglib {
|
||||
#include "nglib.h"
|
||||
}
|
||||
#define OCCGEOMETRY
|
||||
#include <occgeom.hpp>
|
||||
,nglib::Ng_Init();
|
||||
netgen::OCCGeometry occgeo;
|
||||
nglib::Ng_Exit();,Netgen_ok=yes;ar x "$NETGEN_LIBS_DIR/libnginterface.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libocc.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libcsg.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libgprim.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libmesh.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libopti.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libgen.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libla.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libstlgeom.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libgeom2d.a";
|
||||
$CXX -shared linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o -o libNETGEN.so;
|
||||
rm -rf linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o csgparser.o dynamicmem.o extrusion.o occconstruction.o parthreads.o readuser.o writeabaqus.o writediffpack.o writeelmer.o writefeap.o writefluent.o writegmsh.o writejcm.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o,
|
||||
Netgen_ok=no)
|
||||
|
||||
AC_CACHE_VAL(salome_netgen_lib,[
|
||||
AC_TRY_LINK(
|
||||
#include <iostream.h>
|
||||
#include <fstream.h>
|
||||
namespace nglib {
|
||||
#include "nglib.h"
|
||||
}
|
||||
#define OCCGEOMETRY
|
||||
#include <occgeom.hpp>
|
||||
,nglib::Ng_Init();
|
||||
netgen::OCCGeometry occgeo;
|
||||
nglib::Ng_Exit();,
|
||||
eval "salome_netgen_lib=yes";rm -rf libNETGEN.so,eval "salome_netgen_lib=no";rm -rf libNETGEN.so)
|
||||
])
|
||||
Netgen_ok="$salome_netgen_lib"
|
||||
|
||||
|
||||
LDFLAGS="$LDFLAGS_old"
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_old"
|
||||
CXXFLAGS="$CXXFLAGS_old"
|
||||
|
||||
if test "x$Netgen_ok" == xno ; then
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN(Netgen libraries not found or not properly installed)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(NETGEN_INCLUDES)
|
||||
AC_SUBST(NETGEN_LIBS_DIR)
|
||||
|
||||
AC_LANG_RESTORE
|
||||
|
||||
])dnl
|
@ -1,132 +1,53 @@
|
||||
AC_DEFUN([CHECK_NETGEN],[
|
||||
#------------------------------------------------------------
|
||||
# Check availability of Salome NETGEN mesh plugin module
|
||||
# distribution
|
||||
#------------------------------------------------------------
|
||||
|
||||
AC_REQUIRE([AC_PROG_CXX])dnl
|
||||
AC_REQUIRE([AC_PROG_CXXCPP])dnl
|
||||
AC_DEFUN([CHECK_NETGENPLUGIN],[
|
||||
|
||||
AC_CHECKING(for Netgen 4.5 and higher Libraries)
|
||||
AC_CHECKING(for NETGEN mesh plugin)
|
||||
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
NGplugin_ok=no
|
||||
|
||||
AC_ARG_WITH(netgen,
|
||||
[ --with-netgen=DIR root directory path of NETGEN installation],
|
||||
NETGEN_HOME=$withval,NETGEN_HOME="")
|
||||
NETGENPLUGIN_LDLAGS=""
|
||||
NETGENPLUGIN_CXXFLAGS=""
|
||||
|
||||
NETGEN_INCLUDES=""
|
||||
NETGEN_LIBS_DIR=""
|
||||
AC_ARG_WITH(netgenplugin,
|
||||
[ --with-netgenplugin=DIR root directory path of NETGEN mesh plugin installation ],
|
||||
NETGENPLUGIN_DIR="$withval",NETGENPLUGIN_DIR="")
|
||||
|
||||
Netgen_ok=no
|
||||
if test "x$NETGENPLUGIN_DIR" == "x" ; then
|
||||
|
||||
if test "x$NETGEN_HOME" == "x" ; then
|
||||
# no --with-netgenplugin-dir option used
|
||||
|
||||
# no --with-netgen option used
|
||||
if test "x$NETGENHOME" != "x" ; then
|
||||
if test "x$NETGENPLUGIN_ROOT_DIR" != "x" ; then
|
||||
|
||||
# NETGENHOME environment variable defined
|
||||
NETGEN_HOME=$NETGENHOME
|
||||
# NETGENPLUGIN_ROOT_DIR environment variable defined
|
||||
NETGENPLUGIN_DIR=$NETGENPLUGIN_ROOT_DIR
|
||||
|
||||
fi
|
||||
#
|
||||
fi
|
||||
|
||||
if test "x$NETGEN_HOME" != "x"; then
|
||||
if test -f ${NETGENPLUGIN_DIR}/lib${LIB_LOCATION_SUFFIX}/salome/libNETGENEngine.so ; then
|
||||
NGplugin_ok=yes
|
||||
AC_MSG_RESULT(Using NETGEN mesh plugin distribution in ${NETGENPLUGIN_DIR})
|
||||
|
||||
echo
|
||||
echo
|
||||
echo -------------------------------------------------
|
||||
echo You are about to choose to use somehow the
|
||||
echo Netgen Library to generate Tetrahedric mesh.
|
||||
echo
|
||||
echo WARNING
|
||||
echo ----------------------------------------------------------
|
||||
echo ----------------------------------------------------------
|
||||
echo You are strongly advised to consult the file
|
||||
echo NETGENPLUGIN_SRC/src/ReadMeForNgUsers, particularly about
|
||||
echo assumptions made on the installation of the Netgen
|
||||
echo application and libraries.
|
||||
echo Ask your system administrator for those details.
|
||||
echo ----------------------------------------------------------
|
||||
echo ----------------------------------------------------------
|
||||
echo
|
||||
echo
|
||||
|
||||
|
||||
|
||||
NETGEN_INCLUDES="-I$NETGEN_HOME/include"
|
||||
NETGEN_LIBS_DIR="$NETGEN_HOME/lib/LINUX"
|
||||
|
||||
CPPFLAGS_old="$CPPFLAGS"
|
||||
CXXFLAGS_old="$CXXFLAGS"
|
||||
CPPFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CPPFLAGS"
|
||||
CXXFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CXXFLAGS"
|
||||
|
||||
AC_MSG_CHECKING(for Netgen header file)
|
||||
|
||||
AC_CHECK_HEADER(nglib.h,Netgen_ok=yes,Netgen_ok=no)
|
||||
if test "x$Netgen_ok" == "xyes"; then
|
||||
|
||||
AC_MSG_CHECKING(for Netgen libraries)
|
||||
|
||||
LDFLAGS_old="$LDFLAGS"
|
||||
LDFLAGS="-L. -lNETGEN $CAS_LDPATH -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo $LDFLAGS"
|
||||
|
||||
AC_TRY_COMPILE(#include <iostream.h>
|
||||
#include <fstream.h>
|
||||
namespace nglib {
|
||||
#include "nglib.h"
|
||||
}
|
||||
#define OCCGEOMETRY
|
||||
#include <occgeom.hpp>
|
||||
,nglib::Ng_Init();
|
||||
netgen::OCCGeometry occgeo;
|
||||
nglib::Ng_Exit();,Netgen_ok=yes;ar x "$NETGEN_LIBS_DIR/libnginterface.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libocc.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libcsg.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libgprim.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libmesh.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libopti.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libgen.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libla.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libstlgeom.a";
|
||||
ar x "$NETGEN_LIBS_DIR/libgeom2d.a";
|
||||
$CXX -shared linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o -o libNETGEN.so;
|
||||
rm -rf linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o csgparser.o dynamicmem.o extrusion.o occconstruction.o parthreads.o readuser.o writeabaqus.o writediffpack.o writeelmer.o writefeap.o writefluent.o writegmsh.o writejcm.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o,
|
||||
Netgen_ok=no)
|
||||
|
||||
AC_CACHE_VAL(salome_netgen_lib,[
|
||||
AC_TRY_LINK(
|
||||
#include <iostream.h>
|
||||
#include <fstream.h>
|
||||
namespace nglib {
|
||||
#include "nglib.h"
|
||||
}
|
||||
#define OCCGEOMETRY
|
||||
#include <occgeom.hpp>
|
||||
,nglib::Ng_Init();
|
||||
netgen::OCCGeometry occgeo;
|
||||
nglib::Ng_Exit();,
|
||||
eval "salome_netgen_lib=yes";rm -rf libNETGEN.so,eval "salome_netgen_lib=no";rm -rf libNETGEN.so)
|
||||
])
|
||||
Netgen_ok="$salome_netgen_lib"
|
||||
|
||||
|
||||
LDFLAGS="$LDFLAGS_old"
|
||||
if test "x$NETGENPLUGIN_ROOT_DIR" == "x" ; then
|
||||
NETGENPLUGIN_ROOT_DIR=${NETGENPLUGIN_DIR}
|
||||
fi
|
||||
AC_SUBST(NETGENPLUGIN_ROOT_DIR)
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_old"
|
||||
CXXFLAGS="$CXXFLAGS_old"
|
||||
NETGENPLUGIN_LDFLAGS=-L${NETGENPLUGIN_DIR}/lib${LIB_LOCATION_SUFFIX}/salome
|
||||
NETGENPLUGIN_CXXFLAGS=-I${NETGENPLUGIN_DIR}/include/salome
|
||||
|
||||
if test "x$Netgen_ok" == xno ; then
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN(Netgen libraries not found or not properly installed)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
AC_SUBST(NETGENPLUGIN_LDFLAGS)
|
||||
AC_SUBST(NETGENPLUGIN_CXXFLAGS)
|
||||
|
||||
else
|
||||
AC_MSG_WARN("Cannot find compiled NETGEN mesh plugin distribution")
|
||||
fi
|
||||
|
||||
AC_SUBST(NETGEN_INCLUDES)
|
||||
AC_SUBST(NETGEN_LIBS_DIR)
|
||||
|
||||
AC_LANG_RESTORE
|
||||
AC_MSG_RESULT(for NETGEN mesh plugin: $NGplugin_ok)
|
||||
|
||||
])dnl
|
||||
|
@ -1,6 +1,8 @@
|
||||
# common directories to put headerfiles
|
||||
inc_builddir=$(top_builddir)/include/salome
|
||||
|
||||
MODULE_NAME=@MODULE_NAME@
|
||||
|
||||
@SET_MAKE@
|
||||
SHELL=/bin/sh
|
||||
|
||||
@ -10,7 +12,7 @@ HAVE_SSTREAM=@HAVE_SSTREAM@
|
||||
|
||||
|
||||
LIBS=@LIBS@
|
||||
LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker $(top_builddir)/lib/salome
|
||||
LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -Xlinker -rpath-link -Xlinker $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome
|
||||
# add libstdc++ to link c++ library with libtool !
|
||||
LDFLAGS+= -lstdc++
|
||||
|
||||
@ -34,6 +36,15 @@ CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
|
||||
|
||||
# FORTRAN
|
||||
|
||||
F77 = @F77@
|
||||
FC = @FC@
|
||||
FFLAGS = @FFLAGS@
|
||||
FCFLAGS = @FCFLAGS@
|
||||
FLIBS = @FLIBS@
|
||||
FCLIBS = @FCLIBS@
|
||||
|
||||
# BOOST Library
|
||||
|
||||
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
|
||||
@ -173,7 +184,7 @@ SALOME_INCLUDES = \
|
||||
CPPFLAGS += -DSOLIDGEOM -DLINUX $(OCC_INCLUDES) $(SALOME_INCLUDES) $(BOOST_CPPFLAGS)
|
||||
CXXFLAGS += -DSOLIDGEOM -DLINUX $(OCC_CXXFLAGS) $(SALOME_INCLUDES)
|
||||
|
||||
LDFLAGS += -lSMESHimpl -lSMESHEngine -lStdMeshers -lStdMeshersEngine -L${KERNEL_ROOT_DIR}/lib/salome -L${SMESH_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeGenericObj
|
||||
LDFLAGS += -lSMESHimpl -lSMESHEngine -lStdMeshers -lStdMeshersEngine -L${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome -L${SMESH_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome -L${GEOM_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome -lSalomeGenericObj
|
||||
|
||||
# add corba libs when link salome application !
|
||||
#LDFLAGS+= $(CORBA_LIBS)
|
||||
@ -203,7 +214,7 @@ LN_S=@LN_S@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@/salome
|
||||
libdir=@libdir@/salome
|
||||
libdir=@exec_prefix@/lib@LIB_LOCATION_SUFFIX@/salome
|
||||
# warning : if user give this path in configure we could have salome/salome :-(
|
||||
includedir=@includedir@/salome
|
||||
datadir=@datadir@/salome
|
||||
@ -269,20 +280,32 @@ ac_cc_warnings.m4 check_swig.m4 check_boost.m4
|
||||
# ACLOCAL_SRC += check_Netgen.m4
|
||||
#endif
|
||||
|
||||
ACLOCAL_GUI = \
|
||||
check_vtk.m4 check_opengl.m4 check_qt.m4 \
|
||||
check_GUI.m4 check_corba_in_GUI.m4
|
||||
|
||||
ACLOCAL_GEOM = check_GEOM.m4
|
||||
|
||||
ACLOCAL_SMESH = check_SMESH.m4
|
||||
|
||||
ifeq ($(NETGENPLUGIN_WITH_GUI),yes)
|
||||
ACLOCAL_GUI = \
|
||||
check_vtk.m4 check_opengl.m4 check_qt.m4 \
|
||||
check_GUI.m4 check_corba_in_GUI.m4
|
||||
|
||||
$(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 -I 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
|
||||
endif
|
||||
|
||||
ifeq ($(NETGENPLUGIN_WITH_GUI),no)
|
||||
$(top_srcdir)/aclocal.m4: $(ACLOCAL_KERNEL%=@KERNEL_ROOT_DIR@/salome_adm/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 -I adm_local/unix/config_files \
|
||||
-I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \
|
||||
-I @GEOM_ROOT_DIR@/adm_local/unix/config_files \
|
||||
-I @SMESH_ROOT_DIR@/adm_local/unix/config_files
|
||||
endif
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
ORIG_DIR=`pwd`
|
||||
CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
|
||||
NETGENPLUGIN_WITH_GUI="yes"
|
||||
|
||||
########################################################################
|
||||
# Test if the KERNEL_ROOT_DIR is set correctly
|
||||
@ -26,12 +27,26 @@ fi
|
||||
# echo "failed : KERNEL_SRC variable is not correct !"
|
||||
# exit
|
||||
#fi
|
||||
for option
|
||||
do
|
||||
case $option in
|
||||
-with-ihm | --with-ihm)
|
||||
NETGENPLUGIN_WITH_GUI="yes"
|
||||
break;;
|
||||
-without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no)
|
||||
NETGENPLUGIN_WITH_GUI="no"
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
########################################################################
|
||||
# Test if the GUI_ROOT_DIR is set correctly
|
||||
|
||||
if test ! -d "${GUI_ROOT_DIR}"; then
|
||||
if test ${NETGENPLUGIN_WITH_GUI} = yes; then
|
||||
if test ! -d "${GUI_ROOT_DIR}"; then
|
||||
echo "failed : GUI_ROOT_DIR variable is not correct !"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
########################################################################
|
||||
@ -235,11 +250,21 @@ else
|
||||
echo -n "Creating 'configure' script ... "
|
||||
fi
|
||||
|
||||
if test ${NETGENPLUGIN_WITH_GUI} = yes; then
|
||||
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 ${MED_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
|
||||
fi
|
||||
|
||||
if test ${NETGENPLUGIN_WITH_GUI} = no; then
|
||||
aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
|
||||
-I ${MED_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
|
||||
fi
|
||||
|
||||
if autoconf
|
||||
then
|
||||
echo "done"
|
||||
|
@ -22,11 +22,15 @@ AC_CANONICAL_HOST
|
||||
PACKAGE=salome
|
||||
AC_SUBST(PACKAGE)
|
||||
|
||||
VERSION=3.2.0
|
||||
XVERSION=0x030200
|
||||
VERSION=3.2.10
|
||||
XVERSION=0x03020A
|
||||
AC_SUBST(VERSION)
|
||||
AC_SUBST(XVERSION)
|
||||
|
||||
# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
|
||||
MODULE_NAME=netgenplugin
|
||||
AC_SUBST(MODULE_NAME)
|
||||
|
||||
dnl
|
||||
dnl Initialize source and build root directories
|
||||
dnl
|
||||
@ -102,6 +106,23 @@ AC_DEPEND_FLAG
|
||||
# AC_CC_WARNINGS([ansi])
|
||||
cc_ok=yes
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing Fortran
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
fortran_ok=no
|
||||
AC_PROG_F77
|
||||
AC_F77_LIBRARY_LDFLAGS
|
||||
AC_PROG_FC
|
||||
AC_FC_LIBRARY_LDFLAGS
|
||||
if test "X$FC" != "X" ; then
|
||||
fortran_ok=yes
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
dnl Library libdl :
|
||||
AC_CHECK_LIB(dl,dlopen)
|
||||
|
||||
@ -123,6 +144,14 @@ echo
|
||||
|
||||
CHECK_BOOST
|
||||
|
||||
dnl
|
||||
dnl ---------------------------------------------
|
||||
dnl testing WITHIHM
|
||||
dnl ---------------------------------------------
|
||||
dnl
|
||||
|
||||
CHECK_WITHIHM
|
||||
|
||||
dnl
|
||||
dnl ---------------------------------------------
|
||||
dnl testing MPICH
|
||||
@ -203,13 +232,15 @@ AC_SUBST_FILE(CORBA)
|
||||
corba=make_$ORB
|
||||
CORBA=adm_local/unix/$corba
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing openGL
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
if test "X$WITHIHM" = "Xyes"; then
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing openGL
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_OPENGL
|
||||
CHECK_OPENGL
|
||||
fi
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
@ -227,13 +258,15 @@ echo
|
||||
|
||||
CHECK_MSG2QM
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing VTK
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
if test "X$WITHIHM" = "Xyes"; then
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing VTK
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_VTK
|
||||
CHECK_VTK
|
||||
fi
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
@ -259,24 +292,26 @@ echo
|
||||
|
||||
CHECK_HTML_GENERATORS
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
if test "X$WITHIHM" = "Xyes"; then
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_SALOME_GUI
|
||||
CHECK_SALOME_GUI
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing full GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing full GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_CORBA_IN_GUI
|
||||
if test "x${CORBA_IN_GUI}" != "xyes"; then
|
||||
CHECK_CORBA_IN_GUI
|
||||
if test "x${CORBA_IN_GUI}" != "xyes"; then
|
||||
echo "failed : For configure NETGENPLUGIN module necessary full GUI !"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
@ -326,7 +361,7 @@ echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
echo Configure
|
||||
variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok SMesh_ok Netgen_ok"
|
||||
variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok SMesh_ok Netgen_ok"
|
||||
|
||||
for var in $variables
|
||||
do
|
||||
@ -356,7 +391,7 @@ else
|
||||
fi
|
||||
|
||||
# make other build directories
|
||||
for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl
|
||||
for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources/${MODULE_NAME} idl
|
||||
do
|
||||
# if test ! -d $rep ; then
|
||||
# eval mkdir $rep
|
||||
|
@ -46,7 +46,7 @@ $(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%)
|
||||
# python wrap
|
||||
lib: pyidl
|
||||
|
||||
PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@
|
||||
PYTHON_BUILD_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/@PACKAGE@
|
||||
|
||||
pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py)
|
||||
|
||||
|
@ -41,19 +41,28 @@ module NETGENPlugin
|
||||
};
|
||||
|
||||
/*!
|
||||
* NETGENPlugin_NETGEN_2D: interface of "1D-2D (Netgen)" algorithm
|
||||
* NETGENPlugin_NETGEN_2D: interface of "Netgen 1D-2D" algorithm
|
||||
*/
|
||||
interface NETGENPlugin_NETGEN_2D : SMESH::SMESH_2D_Algo
|
||||
{
|
||||
};
|
||||
|
||||
/*!
|
||||
* NETGENPlugin_NETGEN_2D3D: interface of "1D-2D-3D (Netgen)" algorithm
|
||||
* NETGENPlugin_NETGEN_2D3D: interface of "Netgen 1D-2D-3D" algorithm
|
||||
*/
|
||||
interface NETGENPlugin_NETGEN_2D3D : SMESH::SMESH_3D_Algo
|
||||
{
|
||||
};
|
||||
|
||||
/*!
|
||||
* NETGENPlugin_NETGEN_2D_ONLY: interface of "Netgen 2D" algorithm,
|
||||
* generating 2D elements on a geometrical face taking
|
||||
* into account pre-existing nodes on face boundaries
|
||||
*/
|
||||
interface NETGENPlugin_NETGEN_2D_ONLY : SMESH::SMESH_2D_Algo
|
||||
{
|
||||
};
|
||||
|
||||
/*!
|
||||
* NETGENPlugin_Hypothesis: interface of "NETGEN parameters" hypothesis
|
||||
*/
|
||||
|
@ -37,6 +37,14 @@
|
||||
icon-id="mesh_algo_netgen_2d3d.png"
|
||||
hypos="NETGEN_Parameters"
|
||||
dim="3"/>
|
||||
<algorithm type="NETGEN_2D_ONLY"
|
||||
label-id="Netgen 2D"
|
||||
icon-id="mesh_algo_netgen_2d.png"
|
||||
hypos="LengthFromEdges,MaxElementArea"
|
||||
opt-hypos="QuadranglePreference"
|
||||
input="EDGE"
|
||||
output="TRIA,QUAD"
|
||||
dim="2"/>
|
||||
</algorithms>
|
||||
</meshers-group>
|
||||
|
||||
|
@ -67,8 +67,7 @@ CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
|
||||
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
|
||||
LDFLAGS += $(OCC_KERNEL_LIBS) $(KERNEL_LDFLAGS) $(GUI_LDFLAGS) ${GEOM_LDFLAGS} ${SMESH_LDFLAGS} -lSMESH
|
||||
|
||||
|
||||
@CONCLUDE@
|
||||
|
@ -31,6 +31,12 @@ VPATH=.:@srcdir@
|
||||
|
||||
@COMMENCE@
|
||||
|
||||
SUBDIRS = NETGEN NETGENPlugin GUI
|
||||
#SUBDIRS = NETGEN NETGENPlugin GUI
|
||||
|
||||
SUBDIRS = NETGEN NETGENPlugin
|
||||
|
||||
ifeq (@WITHIHM@,yes)
|
||||
SUBDIRS += GUI
|
||||
endif
|
||||
|
||||
@MODULE@
|
||||
|
@ -77,12 +77,6 @@ LIB_OBJ_LO = $(LIB_OBJ_O:%.o=%.lo)
|
||||
$(LIB): $(LIB_OBJ_O) $(LIB_OBJ_LO)
|
||||
LIB_OBJ = $(LIB_OBJ_LO)
|
||||
|
||||
ifeq ($(F77),gfortran)
|
||||
LDFLAGS += -lgfortran
|
||||
else
|
||||
LDFLAGS += -lg2c
|
||||
endif
|
||||
|
||||
LDFLAGS += $(OCC_LDPATH) -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES
|
||||
LDFLAGS += $(OCC_LDPATH) $(FCLIBS) -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES
|
||||
|
||||
MOSTLYCLEAN += $(LIB_OBJ_O)
|
||||
|
@ -1,23 +1,40 @@
|
||||
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
|
||||
1. How to build Netgen for Salome
|
||||
------------------------------
|
||||
|
||||
Patch the netgen 4.5 distribution:
|
||||
1.1. Download Netgen 4.5 from the NETGEN home site (see above).
|
||||
|
||||
1.2. Unpack the downloaded Netgen 4.5 archive
|
||||
(hereafter we assume that this is netgen45 directory)
|
||||
|
||||
1.3. Patch the netgen 4.5 distribution for SALOME:
|
||||
|
||||
$ cd netgen45
|
||||
$ patch -p1 < patch_directory/netgen45ForSalome.patch
|
||||
|
||||
Then run makeForSalome.sh (it will be created by the patch):
|
||||
1.4. For 64-bit platform you also need to apply another patch:
|
||||
|
||||
$ cd netgen45
|
||||
$ patch -p1 < patch_directory/netgen45lib64.patch
|
||||
|
||||
1.5. Set CASROOT environment variable to OCCT installation path,
|
||||
since Netgen 4.5 requires Open CASCADE Technology:
|
||||
|
||||
$ setenv CASROOT <occt_installation_path>
|
||||
|
||||
1.6. Compile and install netgen 4.5. To do this, simply run
|
||||
makeForSalome.sh script (it is created from the patch):
|
||||
|
||||
$ sh makeForSalome.sh
|
||||
|
||||
|
||||
Additional information for maintainers
|
||||
2. Additional information for maintainers
|
||||
--------------------------------------
|
||||
|
||||
The file check_NETGENPLUGIN.m4 assumes
|
||||
that Netgen is installed in the directory <netgen_installation_path> as follow:
|
||||
The file check_NETGEN.m4 assumes that Netgen is installed in
|
||||
the directory <netgen_installation_path> as follow:
|
||||
|
||||
prompt> ls <netgen_installation_path>
|
||||
|
||||
@ -50,17 +67,16 @@ edgeflw.hpp hpref_pyramid.hpp msghandler.hpp sparsmat.hpp
|
||||
|
||||
prompt> ls <netgen_installation_path>/lib
|
||||
|
||||
LINUX/
|
||||
|
||||
prompt> ls <netgen_installation_path>/lib/LINUX
|
||||
|
||||
libcsg.a libgeom2d.a libla.a libnginterface.a libopti.a
|
||||
libgen.a libgprim.a libmesh.a libocc.a libstlgeom.a
|
||||
|
||||
The library files can be also installed in the LINUX or LINUX64
|
||||
subfolder of the lib directory.
|
||||
|
||||
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
|
||||
<netgen_installation_path>/lib/LINUX/libnginterface.a should contain the objects
|
||||
<netgen_installation_path>/lib/libnginterface.a should contain the objects
|
||||
nglib.o (from netgen45/libsrc/interface/nglib.cpp) and ngnewdelete.o
|
||||
(from netgen45/ngtcltk/ngnewdelete.cpp).
|
||||
|
||||
@ -72,7 +88,7 @@ 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.
|
||||
The suggested patch alters some Netgen sources to compile them.
|
||||
|
||||
Michael SAZONOV
|
||||
m-sazonov@opencascade.com
|
||||
|
File diff suppressed because it is too large
Load Diff
45
src/NETGEN/netgen45lib64.patch
Executable file
45
src/NETGEN/netgen45lib64.patch
Executable file
@ -0,0 +1,45 @@
|
||||
diff -ur netgen-4.5.old/libsrc/makefile.inc netgen-4.5.new/libsrc/makefile.inc
|
||||
--- netgen-4.5/libsrc/makefile.inc 2006-04-27 13:12:54.000000000 +0400
|
||||
+++ netgen-4.5/libsrc/makefile.inc 2006-09-05 14:16:32.000000000 +0400
|
||||
@@ -14,7 +14,7 @@
|
||||
#
|
||||
include $(LIBSRC_DIR)/makefile.mach.$(MACHINE)
|
||||
#
|
||||
-CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) \
|
||||
+CPLUSPLUSFLAGS1 = -c -m64 -fPIC -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) \
|
||||
-DOCCGEOMETRY -DOCC52 -DHAVE_IOSTREAM -DHAVE_LIMITS_H
|
||||
#
|
||||
ARFLAGS = r
|
||||
diff -ur netgen-4.5.old/libsrc/makefile.mach.LINUX64 netgen-4.5.new/libsrc/makefile.mach.LINUX64
|
||||
--- netgen-4.5/libsrc/makefile.mach.LINUX64 2006-03-29 15:09:32.000000000 +0400
|
||||
+++ netgen-4.5/libsrc/makefile.mach.LINUX64 2006-09-07 15:48:39.000000000 +0400
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
#
|
||||
CFLAGS2 =
|
||||
-CPLUSPLUSFLAGS2 = -pg -march=nocona -O2 -DLINUX -DOPENGL \
|
||||
+CPLUSPLUSFLAGS2 = -pg -march=nocona -O2 -DLINUX \
|
||||
-ftemplate-depth-99 -finline-limit=100000 \
|
||||
-fforce-addr -funroll-loops \
|
||||
-DTRAFO -DNGSOLVE -DnoADDON -DnoLAPACK -DnoFAST \
|
||||
@@ -23,7 +23,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
-LINKFLAGS2 = -pg -L/usr/openwin/lib64 -L/usr/X11R6/lib64 -L/usr/lib/GL3.5 -L/usr/lib64
|
||||
+LINKFLAGS2 = -fPIC -pg -L/usr/openwin/lib64 -L/usr/X11R6/lib64 -L/usr/lib/GL3.5 -L/usr/lib64
|
||||
|
||||
|
||||
SYSLIB2 = -lstdc++
|
||||
diff -ur netgen-4.5.old/Makefile netgen-4.5.new/Makefile
|
||||
--- netgen-4.5/Makefile 2006-03-29 15:09:12.000000000 +0400
|
||||
+++ netgen-4.5/Makefile 2006-09-07 15:46:07.000000000 +0400
|
||||
@@ -72,7 +72,7 @@
|
||||
#
|
||||
#CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -DOPENGL
|
||||
|
||||
-CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) -I./ngsolve/include -Ilibsrc/interface -DOPENGL -I$(METISINC)
|
||||
+CPLUSPLUSFLAGS1 = -c -m64 -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) -I./ngsolve/include -Ilibsrc/interface -I$(METISINC)
|
||||
|
||||
LINKFLAGS1 = -lGL -lGLU -lX11 -lXext -lXmu
|
||||
#
|
@ -45,13 +45,18 @@ LIB_SRC = \
|
||||
NETGENPlugin_Hypothesis_2D.cxx \
|
||||
NETGENPlugin_Hypothesis_2D_i.cxx \
|
||||
NETGENPlugin_Mesher.cxx \
|
||||
NETGENPlugin_i.cxx
|
||||
NETGENPlugin_i.cxx \
|
||||
NETGENPlugin_NETGEN_2D_ONLY.cxx \
|
||||
NETGENPlugin_NETGEN_2D_ONLY_i.cxx
|
||||
|
||||
LIB_SERVER_IDL = NETGENPlugin_Algorithm.idl
|
||||
|
||||
LIB_CLIENT_IDL = \
|
||||
SALOME_Component.idl \
|
||||
SALOME_Comm.idl \
|
||||
SALOME_Exception.idl \
|
||||
SALOME_GenericObj.idl \
|
||||
SMESH_Hypothesis.idl \
|
||||
GEOM_Gen.idl \
|
||||
MED.idl
|
||||
|
||||
@ -61,6 +66,6 @@ LIB = libNETGENEngine.la
|
||||
NETGEN_INCLUDES = @NETGEN_INCLUDES@
|
||||
CPPFLAGS += $(NETGEN_INCLUDES)
|
||||
CXXFLAGS += $(NETGEN_INCLUDES)
|
||||
LDFLAGS += -lNETGEN
|
||||
LDFLAGS += -L${NETGENPLUGIN_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome -lNETGEN
|
||||
|
||||
@CONCLUDE@
|
||||
|
@ -30,6 +30,10 @@ using namespace std;
|
||||
#include "NETGENPlugin_Mesher.hxx"
|
||||
#include "NETGENPlugin_Hypothesis_2D.hxx"
|
||||
|
||||
#include <SMESH_Mesh.hxx>
|
||||
#include <SMESH_Comment.hxx>
|
||||
#include <SMESH_ComputeError.hxx>
|
||||
#include <SMESH_subMesh.hxx>
|
||||
#include <SMESHDS_Mesh.hxx>
|
||||
#include <SMDS_MeshElement.hxx>
|
||||
#include <SMDS_MeshNode.hxx>
|
||||
@ -42,6 +46,9 @@ using namespace std;
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
// Netgen include files
|
||||
namespace nglib {
|
||||
@ -62,10 +69,10 @@ namespace netgen {
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
NETGENPlugin_Mesher::NETGENPlugin_Mesher (SMESHDS_Mesh* meshDS,
|
||||
NETGENPlugin_Mesher::NETGENPlugin_Mesher (SMESH_Mesh* mesh,
|
||||
const TopoDS_Shape& aShape,
|
||||
const bool isVolume)
|
||||
: _meshDS (meshDS),
|
||||
: _mesh (mesh),
|
||||
_shape (aShape),
|
||||
_isVolume(isVolume),
|
||||
_optimize(true)
|
||||
@ -140,6 +147,32 @@ Standard_Boolean IsEqual(const Link& aLink1, const Link& aLink2)
|
||||
aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Initialize netgen::OCCGeometry with OCCT shape
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo,
|
||||
const TopoDS_Shape& shape)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Here we are going to use the NETGEN mesher
|
||||
@ -156,6 +189,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
" second order = " << netgen::mparam.secondorder << "\n"
|
||||
" quad allowed = " << netgen::mparam.quad);
|
||||
|
||||
SMESH_ComputeErrorPtr error = SMESH_ComputeError::New();
|
||||
nglib::Ng_Init();
|
||||
|
||||
// -------------------------
|
||||
@ -163,21 +197,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
// -------------------------
|
||||
|
||||
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);
|
||||
PrepareOCCgeometry( occgeo, _shape );
|
||||
|
||||
// -------------------------
|
||||
// Generate the mesh
|
||||
@ -193,14 +213,17 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
char *optstr;
|
||||
|
||||
int err = 0;
|
||||
SMESH_Comment comment;
|
||||
try
|
||||
{
|
||||
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
|
||||
if (err) comment << "Error in netgen::OCCGenerateMesh()";
|
||||
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) comment << "Error in netgen::OCCGenerateMesh()";
|
||||
}
|
||||
if (!err && netgen::mparam.secondorder > 0)
|
||||
{
|
||||
@ -210,8 +233,8 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
}
|
||||
catch (netgen::NgException exc)
|
||||
{
|
||||
MESSAGE ("Exception in NETGEN: " << exc.What());
|
||||
err = 1;
|
||||
error->myName = err = COMPERR_ALGO_FAILED;
|
||||
comment << exc.What();
|
||||
}
|
||||
|
||||
int nbNod = ngMesh->GetNP();
|
||||
@ -229,8 +252,9 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
// Feed back the SMESHDS with the generated Nodes and Elements
|
||||
// -----------------------------------------------------------
|
||||
|
||||
SMESHDS_Mesh* meshDS = _mesh->GetMeshDS();
|
||||
bool isOK = ( !err && (_isVolume ? (nbVol > 0) : (nbFac > 0)) );
|
||||
if ( isOK )
|
||||
if ( true /*isOK*/ ) // get whatever built
|
||||
{
|
||||
// vector of nodes in which node index == netgen ID
|
||||
vector< SMDS_MeshNode* > nodeVec ( nbNod + 1 );
|
||||
@ -238,7 +262,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
NCollection_Map<int> pindMap;
|
||||
// create and insert nodes into nodeVec
|
||||
int i;
|
||||
for (i = 1; i <= nbNod && isOK; ++i )
|
||||
for (i = 1; i <= nbNod /*&& isOK*/; ++i )
|
||||
{
|
||||
const netgen::MeshPoint& ngPoint = ngMesh->Point(i);
|
||||
SMDS_MeshNode* node = NULL;
|
||||
@ -248,7 +272,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
{
|
||||
// point on vertex
|
||||
aVert = TopoDS::Vertex(occgeo.vmap(i));
|
||||
SMESHDS_SubMesh * submesh = _meshDS->MeshElements(aVert);
|
||||
SMESHDS_SubMesh * submesh = meshDS->MeshElements(aVert);
|
||||
if (submesh)
|
||||
{
|
||||
SMDS_NodeIteratorPtr it = submesh->GetNodes();
|
||||
@ -262,25 +286,26 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
newNodeOnVertex = true;
|
||||
}
|
||||
if (!node)
|
||||
node = _meshDS->AddNode(ngPoint.X(), ngPoint.Y(), ngPoint.Z());
|
||||
node = meshDS->AddNode(ngPoint.X(), ngPoint.Y(), ngPoint.Z());
|
||||
if (!node)
|
||||
{
|
||||
MESSAGE("Cannot create a mesh node");
|
||||
isOK = false;
|
||||
if ( !comment.size() ) comment << "Cannot create a mesh node";
|
||||
nbSeg = nbFac = nbVol = isOK = 0;
|
||||
break;
|
||||
}
|
||||
nodeVec.at(i) = node;
|
||||
if (newNodeOnVertex)
|
||||
{
|
||||
// point on vertex
|
||||
_meshDS->SetNodeOnVertex(node, aVert);
|
||||
meshDS->SetNodeOnVertex(node, aVert);
|
||||
pindMap.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// create mesh segments along geometric edges
|
||||
NCollection_Map<Link> linkMap;
|
||||
for (i = 1; i <= nbSeg && isOK; ++i )
|
||||
for (i = 1; i <= nbSeg/* && isOK*/; ++i )
|
||||
{
|
||||
const netgen::Segment& seg = ngMesh->LineSegment(i);
|
||||
Link link(seg.p1, seg.p2);
|
||||
@ -314,28 +339,29 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
continue;
|
||||
if (!aEdge.IsNull())
|
||||
{
|
||||
_meshDS->SetNodeOnEdge(nodeVec.at(pind), aEdge, param);
|
||||
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]));
|
||||
edge = meshDS->AddEdge(nodeVec.at(pinds[0]), nodeVec.at(pinds[1]));
|
||||
else
|
||||
edge = _meshDS->AddEdge(nodeVec.at(pinds[0]), nodeVec.at(pinds[1]),
|
||||
edge = meshDS->AddEdge(nodeVec.at(pinds[0]), nodeVec.at(pinds[1]),
|
||||
nodeVec.at(pinds[2]));
|
||||
if (!edge)
|
||||
{
|
||||
if ( !comment.size() ) comment << "Cannot create a mesh edge";
|
||||
MESSAGE("Cannot create a mesh edge");
|
||||
isOK = false;
|
||||
nbSeg = nbFac = nbVol = isOK = 0;
|
||||
break;
|
||||
}
|
||||
if (!aEdge.IsNull())
|
||||
_meshDS->SetMeshElementOnShape(edge, aEdge);
|
||||
meshDS->SetMeshElementOnShape(edge, aEdge);
|
||||
}
|
||||
|
||||
// create mesh faces along geometric faces
|
||||
for (i = 1; i <= nbFac && isOK; ++i )
|
||||
for (i = 1; i <= nbFac/* && isOK*/; ++i )
|
||||
{
|
||||
const netgen::Element2d& elem = ngMesh->SurfaceElement(i);
|
||||
int aGeomFaceInd = elem.GetIndex();
|
||||
@ -353,7 +379,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
if (!aFace.IsNull())
|
||||
{
|
||||
const netgen::PointGeomInfo& pgi = elem.GeomInfoPi(j);
|
||||
_meshDS->SetNodeOnFace(node, aFace, pgi.u, pgi.v);
|
||||
meshDS->SetNodeOnFace(node, aFace, pgi.u, pgi.v);
|
||||
pindMap.Add(pind);
|
||||
}
|
||||
}
|
||||
@ -361,16 +387,16 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
switch (elem.GetType())
|
||||
{
|
||||
case netgen::TRIG:
|
||||
face = _meshDS->AddFace(nodes[0],nodes[1],nodes[2]);
|
||||
face = meshDS->AddFace(nodes[0],nodes[1],nodes[2]);
|
||||
break;
|
||||
case netgen::QUAD:
|
||||
face = _meshDS->AddFace(nodes[0],nodes[1],nodes[2],nodes[3]);
|
||||
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]);
|
||||
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],
|
||||
face = meshDS->AddFace(nodes[0],nodes[1],nodes[2],nodes[3],
|
||||
nodes[4],nodes[7],nodes[5],nodes[6]);
|
||||
break;
|
||||
default:
|
||||
@ -379,16 +405,17 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
}
|
||||
if (!face)
|
||||
{
|
||||
if ( !comment.size() ) comment << "Cannot create a mesh face";
|
||||
MESSAGE("Cannot create a mesh face");
|
||||
isOK = false;
|
||||
nbSeg = nbFac = nbVol = isOK = 0;
|
||||
break;
|
||||
}
|
||||
if (!aFace.IsNull())
|
||||
_meshDS->SetMeshElementOnShape(face, aFace);
|
||||
meshDS->SetMeshElementOnShape(face, aFace);
|
||||
}
|
||||
|
||||
// create tetrahedra
|
||||
for (i = 1; i <= nbVol && isOK; ++i)
|
||||
for (i = 1; i <= nbVol/* && isOK*/; ++i)
|
||||
{
|
||||
const netgen::Element& elem = ngMesh->VolumeElement(i);
|
||||
int aSolidInd = elem.GetIndex();
|
||||
@ -406,7 +433,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
if (!aSolid.IsNull())
|
||||
{
|
||||
// point in solid
|
||||
_meshDS->SetNodeInVolume(node, aSolid);
|
||||
meshDS->SetNodeInVolume(node, aSolid);
|
||||
pindMap.Add(pind);
|
||||
}
|
||||
}
|
||||
@ -414,10 +441,10 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
switch (elem.GetType())
|
||||
{
|
||||
case netgen::TET:
|
||||
vol = _meshDS->AddVolume(nodes[0],nodes[1],nodes[2],nodes[3]);
|
||||
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],
|
||||
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:
|
||||
@ -426,17 +453,61 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
}
|
||||
if (!vol)
|
||||
{
|
||||
if ( !comment.size() ) comment << "Cannot create a mesh volume";
|
||||
MESSAGE("Cannot create a mesh volume");
|
||||
isOK = false;
|
||||
nbSeg = nbFac = nbVol = isOK = 0;
|
||||
break;
|
||||
}
|
||||
if (!aSolid.IsNull())
|
||||
_meshDS->SetMeshElementOnShape(vol, aSolid);
|
||||
meshDS->SetMeshElementOnShape(vol, aSolid);
|
||||
}
|
||||
}
|
||||
|
||||
if ( error->IsOK() && ( !isOK || comment.size() > 0 ))
|
||||
error->myName = COMPERR_ALGO_FAILED;
|
||||
if ( !comment.empty() )
|
||||
error->myComment = comment;
|
||||
|
||||
// set bad compute error to subshapes of all failed subshapes shapes
|
||||
if ( !error->IsOK() && err )
|
||||
{
|
||||
for (int i = 1; i <= occgeo.fmap.Extent(); i++) {
|
||||
int status = occgeo.facemeshstatus[i-1];
|
||||
if (status == 1 ) continue;
|
||||
if ( SMESH_subMesh* sm = _mesh->GetSubMeshContaining( occgeo.fmap( i ))) {
|
||||
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
|
||||
if ( !smError || smError->IsOK() ) {
|
||||
if ( status == -1 )
|
||||
smError.reset( new SMESH_ComputeError( error->myName, error->myComment ));
|
||||
else
|
||||
smError.reset( new SMESH_ComputeError( COMPERR_ALGO_FAILED, "Ignored" ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)ngMesh);
|
||||
nglib::Ng_Exit();
|
||||
|
||||
return isOK;
|
||||
RemoveTmpFiles();
|
||||
|
||||
return error->IsOK();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Remove "test.out" and "problemfaces" files in current directory
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void NETGENPlugin_Mesher::RemoveTmpFiles()
|
||||
{
|
||||
TCollection_AsciiString str("test.out");
|
||||
OSD_Path path1( str );
|
||||
OSD_File file1( path1 );
|
||||
file1.Remove();
|
||||
str = "problemfaces";
|
||||
OSD_Path path2( str );
|
||||
OSD_File file2( path2 );
|
||||
file2.Remove();
|
||||
}
|
||||
|
@ -29,9 +29,13 @@
|
||||
#ifndef _NETGENPlugin_Mesher_HXX_
|
||||
#define _NETGENPlugin_Mesher_HXX_
|
||||
|
||||
class SMESH_Mesh;
|
||||
class SMESHDS_Mesh;
|
||||
class TopoDS_Shape;
|
||||
class NETGENPlugin_Hypothesis;
|
||||
namespace netgen {
|
||||
class OCCGeometry;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief This class calls the NETGEN mesher of OCC geometry
|
||||
@ -42,15 +46,20 @@ class NETGENPlugin_Mesher
|
||||
public:
|
||||
// ---------- PUBLIC METHODS ----------
|
||||
|
||||
NETGENPlugin_Mesher (SMESHDS_Mesh* meshDS, const TopoDS_Shape& aShape,
|
||||
NETGENPlugin_Mesher (SMESH_Mesh* mesh, const TopoDS_Shape& aShape,
|
||||
const bool isVolume);
|
||||
|
||||
void SetParameters(const NETGENPlugin_Hypothesis* hyp);
|
||||
|
||||
bool Compute();
|
||||
|
||||
static void PrepareOCCgeometry(netgen::OCCGeometry& occgeom,
|
||||
const TopoDS_Shape& shape);
|
||||
|
||||
static void RemoveTmpFiles();
|
||||
|
||||
private:
|
||||
SMESHDS_Mesh* _meshDS;
|
||||
SMESH_Mesh* _mesh;
|
||||
const TopoDS_Shape& _shape;
|
||||
bool _isVolume;
|
||||
bool _optimize;
|
||||
|
@ -119,53 +119,10 @@ bool NETGENPlugin_NETGEN_2D::CheckHypothesis
|
||||
bool NETGENPlugin_NETGEN_2D::Compute(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape)
|
||||
{
|
||||
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||
//SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||
|
||||
NETGENPlugin_Mesher mesher(meshDS, aShape, false);
|
||||
NETGENPlugin_Mesher mesher(&aMesh, aShape, false);
|
||||
// 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 );
|
||||
}
|
||||
|
@ -49,11 +49,6 @@ public:
|
||||
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;
|
||||
};
|
||||
|
@ -121,53 +121,10 @@ bool NETGENPlugin_NETGEN_2D3D::CheckHypothesis
|
||||
bool NETGENPlugin_NETGEN_2D3D::Compute(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape)
|
||||
{
|
||||
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||
// SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||
|
||||
NETGENPlugin_Mesher mesher(meshDS, aShape, true);
|
||||
NETGENPlugin_Mesher mesher(&aMesh, aShape, true);
|
||||
// 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 );
|
||||
}
|
||||
|
@ -49,11 +49,6 @@ public:
|
||||
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;
|
||||
};
|
||||
|
436
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
Normal file
436
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
Normal file
@ -0,0 +1,436 @@
|
||||
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : NETGENPlugin_NETGEN_2D_ONLY.cxx
|
||||
// Author : Edward AGAPOV (OCC)
|
||||
// Project : SALOME
|
||||
|
||||
|
||||
#include "NETGENPlugin_NETGEN_2D_ONLY.hxx"
|
||||
|
||||
#include "NETGENPlugin_Mesher.hxx"
|
||||
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "SMESH_Comment.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_MesherHelper.hxx"
|
||||
#include "StdMeshers_FaceSide.hxx"
|
||||
#include "StdMeshers_MaxElementArea.hxx"
|
||||
#include "StdMeshers_LengthFromEdges.hxx"
|
||||
#include "StdMeshers_QuadranglePreference.hxx"
|
||||
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
Netgen include files
|
||||
*/
|
||||
namespace nglib {
|
||||
#include <nglib.h>
|
||||
}
|
||||
#define OCCGEOMETRY
|
||||
#include <occgeom.hpp>
|
||||
#include <meshing.hpp>
|
||||
namespace netgen {
|
||||
extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
|
||||
extern MeshingParameters mparam;
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
using namespace netgen;
|
||||
using namespace nglib;
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY(int hypId, int studyId,
|
||||
SMESH_Gen* gen)
|
||||
: SMESH_2D_Algo(hypId, studyId, gen)
|
||||
{
|
||||
MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY");
|
||||
_name = "NETGEN_2D_ONLY";
|
||||
|
||||
_shapeType = (1 << TopAbs_FACE);// 1 bit /shape type
|
||||
|
||||
_compatibleHypothesis.push_back("MaxElementArea");
|
||||
_compatibleHypothesis.push_back("LengthFromEdges");
|
||||
_compatibleHypothesis.push_back("QuadranglePreference");
|
||||
|
||||
_hypMaxElementArea = 0;
|
||||
_hypLengthFromEdges = 0;
|
||||
_hypQuadranglePreference = 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY()
|
||||
{
|
||||
MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY");
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape,
|
||||
Hypothesis_Status& aStatus)
|
||||
{
|
||||
_hypMaxElementArea = 0;
|
||||
_hypLengthFromEdges = 0;
|
||||
_hypQuadranglePreference = 0;
|
||||
|
||||
aStatus = HYP_MISSING;
|
||||
|
||||
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
|
||||
|
||||
if (hyps.empty()) return false; // can't work with no hypothesis
|
||||
|
||||
list<const SMESHDS_Hypothesis*>::const_iterator ith;
|
||||
for (ith = hyps.begin(); ith != hyps.end(); ++ith )
|
||||
{
|
||||
const SMESHDS_Hypothesis* hyp = (*ith);
|
||||
|
||||
string hypName = hyp->GetName();
|
||||
|
||||
if ( hypName == "MaxElementArea")
|
||||
_hypMaxElementArea = static_cast<const StdMeshers_MaxElementArea*> (hyp);
|
||||
else if ( hypName == "LengthFromEdges" )
|
||||
_hypLengthFromEdges = static_cast<const StdMeshers_LengthFromEdges*> (hyp);
|
||||
else if ( hypName == "QuadranglePreference" )
|
||||
_hypQuadranglePreference = static_cast<const StdMeshers_QuadranglePreference*>(hyp);
|
||||
else {
|
||||
aStatus = HYP_INCOMPATIBLE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( _hypMaxElementArea && _hypLengthFromEdges ) {
|
||||
aStatus = HYP_CONCURENT;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( _hypMaxElementArea || _hypLengthFromEdges )
|
||||
aStatus = HYP_OK;
|
||||
|
||||
return aStatus == HYP_OK;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Fill netgen mesh with segments
|
||||
* \retval SMESH_ComputeErrorPtr - error description
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
static TError AddSegmentsToMesh(netgen::Mesh& ngMesh,
|
||||
OCCGeometry& geom,
|
||||
const TSideVector& wires,
|
||||
SMESH_MesherHelper& helper,
|
||||
vector< const SMDS_MeshNode* > & nodeVec)
|
||||
{
|
||||
// ----------------------------
|
||||
// Check wires and count nodes
|
||||
// ----------------------------
|
||||
int nbNodes = 0;
|
||||
for ( int iW = 0; iW < wires.size(); ++iW )
|
||||
{
|
||||
StdMeshers_FaceSidePtr wire = wires[ iW ];
|
||||
if ( wire->MissVertexNode() )
|
||||
return TError
|
||||
(new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH, "Missing nodes on vertices"));
|
||||
|
||||
const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct();
|
||||
if ( uvPtVec.size() != wire->NbPoints() )
|
||||
return TError
|
||||
(new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,
|
||||
SMESH_Comment("Unexpected nb of points on wire ") << iW
|
||||
<< ": " << uvPtVec.size()<<" != "<<wire->NbPoints()));
|
||||
nbNodes += wire->NbSegments();
|
||||
}
|
||||
nodeVec.reserve( nbNodes );
|
||||
|
||||
// -----------------
|
||||
// Fill netgen mesh
|
||||
// -----------------
|
||||
|
||||
// netgen::Box<3> bb = geom.GetBoundingBox();
|
||||
// bb.Increase (bb.Diam()/10);
|
||||
// ngMesh.SetLocalH (bb.PMin(), bb.PMax(), 0.5); // set grading
|
||||
|
||||
const int faceID = 1, solidID = 0;
|
||||
ngMesh.AddFaceDescriptor (FaceDescriptor(faceID, solidID, solidID, 0));
|
||||
|
||||
for ( int iW = 0; iW < wires.size(); ++iW )
|
||||
{
|
||||
StdMeshers_FaceSidePtr wire = wires[ iW ];
|
||||
const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct();
|
||||
|
||||
int firstPointID = ngMesh.GetNP() + 1;
|
||||
int edgeID = 1, posID = -2;
|
||||
for ( int i = 0; i < wire->NbSegments(); ++i ) // loop on segments
|
||||
{
|
||||
// Add the first point of a segment
|
||||
const SMDS_MeshNode * n = uvPtVec[ i ].node;
|
||||
const int posShapeID = n->GetPosition()->GetShapeId();
|
||||
|
||||
// skip nodes on degenerated edges
|
||||
if ( helper.IsDegenShape( posShapeID ) &&
|
||||
helper.IsDegenShape( uvPtVec[ i+1 ].node->GetPosition()->GetShapeId() ))
|
||||
continue;
|
||||
|
||||
nodeVec.push_back( n );
|
||||
|
||||
MeshPoint mp( Point<3> (n->X(), n->Y(), n->Z()) );
|
||||
ngMesh.AddPoint ( mp, 1, EDGEPOINT );
|
||||
|
||||
// Add the segment
|
||||
Segment seg;
|
||||
|
||||
seg.p1 = ngMesh.GetNP(); // ng node id
|
||||
seg.p2 = seg.p1 + 1; // ng node id
|
||||
seg.edgenr = ngMesh.GetNSeg() + 1;// segment id
|
||||
seg.si = faceID; // = geom.fmap.FindIndex (face);
|
||||
|
||||
for ( int iEnd = 0; iEnd < 2; ++iEnd)
|
||||
{
|
||||
const UVPtStruct& pnt = uvPtVec[ i + iEnd ];
|
||||
|
||||
seg.epgeominfo[ iEnd ].dist = pnt.param; // param on curve
|
||||
seg.epgeominfo[ iEnd ].u = pnt.u;
|
||||
seg.epgeominfo[ iEnd ].v = pnt.v;
|
||||
|
||||
// find out edge id and node parameter on edge
|
||||
bool onVertex = ( pnt.node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_VERTEX );
|
||||
if ( onVertex || posShapeID != posID )
|
||||
{
|
||||
// get edge id
|
||||
double normParam = pnt.normParam;
|
||||
if ( onVertex )
|
||||
normParam = 0.5 * ( uvPtVec[ i ].normParam + uvPtVec[ i+1 ].normParam );
|
||||
const TopoDS_Edge& edge = wire->Edge( wire->EdgeIndex( normParam ));
|
||||
edgeID = geom.emap.FindIndex( edge );
|
||||
posID = posShapeID;
|
||||
if ( onVertex ) // param on curve is different on each of two edges
|
||||
seg.epgeominfo[ iEnd ].dist = helper.GetNodeU( edge, pnt.node );
|
||||
}
|
||||
seg.epgeominfo[ iEnd ].edgenr = edgeID; // = geom.emap.FindIndex(edge);
|
||||
}
|
||||
|
||||
ngMesh.AddSegment (seg);
|
||||
|
||||
// cout << "Segment: " << seg.edgenr << endl
|
||||
// << "\tp1: " << seg.p1 << endl
|
||||
// << "\tp2: " << seg.p2 << endl
|
||||
// << "\tp0 param: " << seg.epgeominfo[ 0 ].dist << endl
|
||||
// << "\tp0 uv: " << seg.epgeominfo[ 0 ].u <<", "<< seg.epgeominfo[ 0 ].v << endl
|
||||
// << "\tp0 edge: " << seg.epgeominfo[ 0 ].edgenr << endl
|
||||
// << "\tp1 param: " << seg.epgeominfo[ 1 ].dist << endl
|
||||
// << "\tp1 uv: " << seg.epgeominfo[ 1 ].u <<", "<< seg.epgeominfo[ 1 ].v << endl
|
||||
// << "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl;
|
||||
}
|
||||
Segment& seg = ngMesh.LineSegment( ngMesh.GetNSeg() );
|
||||
seg.p2 = firstPointID;
|
||||
}
|
||||
|
||||
ngMesh.CalcSurfacesOfNode();
|
||||
|
||||
return TError();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*Here we are going to use the NETGEN mesher
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape)
|
||||
{
|
||||
MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::Compute()");
|
||||
|
||||
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||
int faceID = meshDS->ShapeToIndex( aShape );
|
||||
|
||||
SMESH_MesherHelper helper(aMesh);
|
||||
_quadraticMesh = helper.IsQuadraticSubMesh(aShape);
|
||||
helper.SetElementsOnShape( true );
|
||||
const bool ignoreMediumNodes = _quadraticMesh;
|
||||
|
||||
// ------------------------
|
||||
// get all edges of a face
|
||||
// ------------------------
|
||||
const TopoDS_Face F = TopoDS::Face( aShape.Oriented( TopAbs_FORWARD ));
|
||||
TError problem;
|
||||
TSideVector wires = StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, problem );
|
||||
if ( problem && !problem->IsOK() )
|
||||
return error( problem );
|
||||
int nbWires = wires.size();
|
||||
if ( nbWires == 0 )
|
||||
return error( "Problem in StdMeshers_FaceSide::GetFaceWires()");
|
||||
if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments
|
||||
return error(COMPERR_BAD_INPUT_MESH,
|
||||
SMESH_Comment("Too few segments: ")<<wires[0]->NbSegments());
|
||||
|
||||
// -------------------------
|
||||
// Make input netgen mesh
|
||||
// -------------------------
|
||||
|
||||
Ng_Init();
|
||||
netgen::Mesh * ngMesh = new netgen::Mesh ();
|
||||
|
||||
netgen::OCCGeometry occgeo;
|
||||
NETGENPlugin_Mesher::PrepareOCCgeometry( occgeo, F );
|
||||
|
||||
vector< const SMDS_MeshNode* > nodeVec;
|
||||
problem = AddSegmentsToMesh( *ngMesh, occgeo, wires, helper, nodeVec );
|
||||
if ( problem && !problem->IsOK() ) {
|
||||
delete ngMesh; Ng_Exit();
|
||||
return error( problem );
|
||||
}
|
||||
|
||||
// --------------------
|
||||
// compute edge length
|
||||
// --------------------
|
||||
|
||||
double edgeLength = 0;
|
||||
if (_hypLengthFromEdges)
|
||||
{
|
||||
int nbSegments = 0;
|
||||
for ( int iW = 0; iW < nbWires; ++iW )
|
||||
{
|
||||
edgeLength += wires[ iW ]->Length();
|
||||
nbSegments += wires[ iW ]->NbSegments();
|
||||
}
|
||||
if ( nbSegments )
|
||||
edgeLength /= nbSegments;
|
||||
}
|
||||
if ( _hypMaxElementArea )
|
||||
{
|
||||
double maxArea = _hypMaxElementArea->GetMaxArea();
|
||||
edgeLength = sqrt(2. * maxArea/sqrt(3.0));
|
||||
}
|
||||
if ( edgeLength < DBL_MIN )
|
||||
edgeLength = occgeo.GetBoundingBox().Diam();
|
||||
|
||||
//cout << " edgeLength = " << edgeLength << endl;
|
||||
|
||||
netgen::mparam.maxh = edgeLength;
|
||||
netgen::mparam.quad = _hypQuadranglePreference ? 1 : 0;
|
||||
//ngMesh->SetGlobalH ( edgeLength );
|
||||
|
||||
// -------------------------
|
||||
// Generate surface mesh
|
||||
// -------------------------
|
||||
|
||||
char *optstr;
|
||||
int startWith = MESHCONST_MESHSURFACE;
|
||||
int endWith = MESHCONST_OPTSURFACE;
|
||||
int err = 1;
|
||||
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
|
||||
}
|
||||
catch (Standard_Failure& ex) {
|
||||
string comment = ex.DynamicType()->Name();
|
||||
if ( ex.GetMessageString() && strlen( ex.GetMessageString() )) {
|
||||
comment += ": ";
|
||||
comment += ex.GetMessageString();
|
||||
}
|
||||
error(COMPERR_OCC_EXCEPTION, comment);
|
||||
}
|
||||
catch (NgException exc) {
|
||||
error( SMESH_Comment("NgException: ") << exc.What() );
|
||||
}
|
||||
catch (...) {
|
||||
error(COMPERR_EXCEPTION,"Exception in netgen::OCCGenerateMesh()");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// Fill the SMESHDS with the generated nodes and faces
|
||||
// ----------------------------------------------------
|
||||
|
||||
int nbNodes = ngMesh->GetNP();
|
||||
int nbFaces = ngMesh->GetNSE();
|
||||
|
||||
int nbInputNodes = nodeVec.size();
|
||||
nodeVec.resize( nbNodes, 0 );
|
||||
|
||||
// add nodes
|
||||
for ( int i = nbInputNodes + 1; i <= nbNodes; ++i )
|
||||
{
|
||||
const MeshPoint& ngPoint = ngMesh->Point(i);
|
||||
SMDS_MeshNode * node = meshDS->AddNode(ngPoint.X(), ngPoint.Y(), ngPoint.Z());
|
||||
nodeVec[ i-1 ] = node;
|
||||
}
|
||||
|
||||
// create faces
|
||||
bool reverse = ( aShape.Orientation() == TopAbs_REVERSED );
|
||||
for ( int i = 1; i <= nbFaces ; ++i )
|
||||
{
|
||||
const Element2d& elem = ngMesh->SurfaceElement(i);
|
||||
vector<const SMDS_MeshNode*> nodes( elem.GetNP() );
|
||||
for (int j=1; j <= elem.GetNP(); ++j)
|
||||
{
|
||||
int pind = elem.PNum(j);
|
||||
const SMDS_MeshNode* node = nodeVec.at(pind-1);
|
||||
if ( reverse )
|
||||
nodes[ nodes.size()-j ] = node;
|
||||
else
|
||||
nodes[ j-1 ] = node;
|
||||
if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_3DSPACE )
|
||||
{
|
||||
const PointGeomInfo& pgi = elem.GeomInfoPi(j);
|
||||
meshDS->SetNodeOnFace((SMDS_MeshNode*)node, faceID, pgi.u, pgi.v);
|
||||
}
|
||||
}
|
||||
SMDS_MeshFace* face = 0;
|
||||
if ( elem.GetType() == TRIG )
|
||||
face = helper.AddFace(nodes[0],nodes[1],nodes[2]);
|
||||
else
|
||||
face = helper.AddFace(nodes[0],nodes[1],nodes[2],nodes[3]);
|
||||
}
|
||||
|
||||
Ng_DeleteMesh((nglib::Ng_Mesh*)ngMesh);
|
||||
Ng_Exit();
|
||||
|
||||
NETGENPlugin_Mesher::RemoveTmpFiles();
|
||||
|
||||
return !err;
|
||||
}
|
63
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.hxx
Normal file
63
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.hxx
Normal file
@ -0,0 +1,63 @@
|
||||
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : NETGENPlugin_NETGEN_2D_ONLY.hxx
|
||||
// Project : SALOME
|
||||
// Author : Edward AGAPOV (OCC)
|
||||
|
||||
#ifndef _NETGENPlugin_NETGEN_2D_ONLY_HXX_
|
||||
#define _NETGENPlugin_NETGEN_2D_ONLY_HXX_
|
||||
|
||||
#include "SMESH_2D_Algo.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
|
||||
class StdMeshers_MaxElementArea;
|
||||
class StdMeshers_LengthFromEdges;
|
||||
class StdMeshers_QuadranglePreference;
|
||||
//class NETGENPlugin_Hypothesis;
|
||||
|
||||
/*!
|
||||
* \brief Mesher generating 2D elements on a geometrical face taking
|
||||
* into account pre-existing nodes on face boundaries
|
||||
*
|
||||
* Historically, NETGENPlugin_NETGEN_2D is actually 1D-2D, that is why
|
||||
* the class is named NETGENPlugin_NETGEN_2D_ONLY. Renaming is useless as
|
||||
* algorithm field "_name" can't be changed
|
||||
*/
|
||||
class NETGENPlugin_NETGEN_2D_ONLY: public SMESH_2D_Algo
|
||||
{
|
||||
public:
|
||||
NETGENPlugin_NETGEN_2D_ONLY(int hypId, int studyId, SMESH_Gen* gen);
|
||||
virtual ~NETGENPlugin_NETGEN_2D_ONLY();
|
||||
|
||||
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape,
|
||||
Hypothesis_Status& aStatus);
|
||||
|
||||
virtual bool Compute(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape);
|
||||
|
||||
protected:
|
||||
const StdMeshers_MaxElementArea* _hypMaxElementArea;
|
||||
const StdMeshers_LengthFromEdges* _hypLengthFromEdges;
|
||||
const StdMeshers_QuadranglePreference* _hypQuadranglePreference;
|
||||
// const NETGENPlugin_Hypothesis* _hypothesis;
|
||||
};
|
||||
|
||||
#endif
|
81
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY_i.cxx
Normal file
81
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY_i.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : NETGENPlugin_NETGEN_2D_ONLY_i.cxx
|
||||
// Author : Edward AGAPOV (OCC)
|
||||
// Module : SMESH
|
||||
|
||||
#include "NETGENPlugin_NETGEN_2D_ONLY_i.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* NETGENPlugin_NETGEN_2D_ONLY_i::NETGENPlugin_NETGEN_2D_ONLY_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
NETGENPlugin_NETGEN_2D_ONLY_i::NETGENPlugin_NETGEN_2D_ONLY_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_ONLY_i::NETGENPlugin_NETGEN_2D_ONLY_i" );
|
||||
myBaseImpl = new ::NETGENPlugin_NETGEN_2D_ONLY( theGenImpl->GetANewId(),
|
||||
theStudyId,
|
||||
theGenImpl );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* NETGENPlugin_NETGEN_2D_ONLY_i::~NETGENPlugin_NETGEN_2D_ONLY_i
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
NETGENPlugin_NETGEN_2D_ONLY_i::~NETGENPlugin_NETGEN_2D_ONLY_i()
|
||||
{
|
||||
MESSAGE( "NETGENPlugin_NETGEN_2D_ONLY_i::~NETGENPlugin_NETGEN_2D_ONLY_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* NETGENPlugin_NETGEN_2D_ONLY_i::GetImpl
|
||||
*
|
||||
* Get implementation
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
::NETGENPlugin_NETGEN_2D_ONLY* NETGENPlugin_NETGEN_2D_ONLY_i::GetImpl()
|
||||
{
|
||||
MESSAGE( "NETGENPlugin_NETGEN_2D_ONLY_i::GetImpl" );
|
||||
return ( ::NETGENPlugin_NETGEN_2D_ONLY* )myBaseImpl;
|
||||
}
|
||||
|
56
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY_i.hxx
Normal file
56
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY_i.hxx
Normal file
@ -0,0 +1,56 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : NETGENPlugin_NETGEN_2D_ONLY_i.cxx
|
||||
// Author : Edward AGAPOV (OCC)
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _NETGENPlugin_NETGEN_2D_ONLY_I_HXX_
|
||||
#define _NETGENPlugin_NETGEN_2D_ONLY_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm)
|
||||
|
||||
#include "SMESH_2D_Algo_i.hxx"
|
||||
#include "NETGENPlugin_NETGEN_2D_ONLY.hxx"
|
||||
|
||||
// ======================================================
|
||||
// NETGEN 2D algorithm
|
||||
// ======================================================
|
||||
class NETGENPlugin_NETGEN_2D_ONLY_i:
|
||||
public virtual POA_NETGENPlugin::NETGENPlugin_NETGEN_2D_ONLY,
|
||||
public virtual SMESH_2D_Algo_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
NETGENPlugin_NETGEN_2D_ONLY_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~NETGENPlugin_NETGEN_2D_ONLY_i();
|
||||
|
||||
// Get implementation
|
||||
::NETGENPlugin_NETGEN_2D_ONLY* GetImpl();
|
||||
};
|
||||
|
||||
#endif
|
@ -30,12 +30,15 @@ using namespace std;
|
||||
|
||||
#include "NETGENPlugin_NETGEN_3D.hxx"
|
||||
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "NETGENPlugin_Mesher.hxx"
|
||||
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
#include "SMESH_Comment.hxx"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_MesherHelper.hxx"
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
@ -43,6 +46,9 @@ using namespace std;
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <list>
|
||||
@ -160,7 +166,8 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
// get triangles on aShell and make a map of nodes to Netgen node IDs
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
SMESH_MesherHelper* myTool = new SMESH_MesherHelper(aMesh);
|
||||
SMESH_MesherHelper helper(aMesh);
|
||||
SMESH_MesherHelper* myTool = &helper;
|
||||
bool _quadraticMesh = myTool->IsQuadraticSubMesh(aShape);
|
||||
|
||||
typedef map< const SMDS_MeshNode*, int> TNodeToIDMap;
|
||||
@ -187,12 +194,12 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
{
|
||||
// check element
|
||||
const SMDS_MeshElement* elem = iteratorElem->next();
|
||||
if ( !elem ||
|
||||
!( elem->NbNodes()==3 || ( _quadraticMesh && elem->NbNodes()==6) ) ) {
|
||||
INFOS( "NETGENPlugin_NETGEN_3D::Compute(), bad mesh");
|
||||
delete myTool; myTool = 0;
|
||||
return false;
|
||||
}
|
||||
if ( !elem )
|
||||
return error( COMPERR_BAD_INPUT_MESH, "Null element encounters");
|
||||
bool isTraingle = ( elem->NbNodes()==3 || (_quadraticMesh && elem->NbNodes()==6 ));
|
||||
if ( !isTraingle )
|
||||
return error( COMPERR_BAD_INPUT_MESH,
|
||||
SMESH_Comment("Not triangle element ")<<elem->GetID());
|
||||
// keep a triangle
|
||||
triangles.push_back( elem );
|
||||
isReversed.push_back( isRev );
|
||||
@ -312,12 +319,28 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
Ng_Result status;
|
||||
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
status = Ng_GenerateVolumeMesh(Netgen_mesh, &Netgen_param);
|
||||
}
|
||||
catch (...) {
|
||||
MESSAGE("An exception has been caught during the Volume Mesh Generation ...");
|
||||
catch (Standard_Failure& exc) {
|
||||
error(COMPERR_OCC_EXCEPTION, exc.GetMessageString());
|
||||
status = NG_VOLUME_FAILURE;
|
||||
}
|
||||
catch (...) {
|
||||
error("Exception in Ng_GenerateVolumeMesh()");
|
||||
status = NG_VOLUME_FAILURE;
|
||||
}
|
||||
if ( GetComputeError()->IsOK() ) {
|
||||
switch ( status ) {
|
||||
case NG_SURFACE_INPUT_ERROR:error( status, "NG_SURFACE_INPUT_ERROR");
|
||||
case NG_VOLUME_FAILURE: error( status, "NG_VOLUME_FAILURE");
|
||||
case NG_STL_INPUT_ERROR: error( status, "NG_STL_INPUT_ERROR");
|
||||
case NG_SURFACE_FAILURE: error( status, "NG_SURFACE_FAILURE");
|
||||
case NG_FILE_NOT_FOUND: error( status, "NG_FILE_NOT_FOUND");
|
||||
};
|
||||
}
|
||||
|
||||
int Netgen_NbOfNodesNew = Ng_GetNP(Netgen_mesh);
|
||||
|
||||
@ -331,7 +354,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
// Feed back the SMESHDS with the generated Nodes and Volume Elements
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
bool isOK = ( status == NG_OK && Netgen_NbOfTetra > 0 );
|
||||
bool isOK = ( /*status == NG_OK &&*/ Netgen_NbOfTetra > 0 );// get whatever built
|
||||
if ( isOK )
|
||||
{
|
||||
// vector of nodes in which node index == netgen ID
|
||||
@ -368,51 +391,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
Ng_DeleteMesh(Netgen_mesh);
|
||||
Ng_Exit();
|
||||
|
||||
delete myTool; myTool = 0;
|
||||
NETGENPlugin_Mesher::RemoveTmpFiles();
|
||||
|
||||
return isOK;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
ostream & NETGENPlugin_NETGEN_3D::SaveTo(ostream & save)
|
||||
{
|
||||
return save;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
istream & NETGENPlugin_NETGEN_3D::LoadFrom(istream & load)
|
||||
{
|
||||
return load;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
ostream & operator << (ostream & save, NETGENPlugin_NETGEN_3D & hyp)
|
||||
{
|
||||
return hyp.SaveTo( save );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
istream & operator >> (istream & load, NETGENPlugin_NETGEN_3D & hyp)
|
||||
{
|
||||
return hyp.LoadFrom( load );
|
||||
return (status == NG_OK);
|
||||
}
|
||||
|
@ -48,11 +48,6 @@ public:
|
||||
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_3D & hyp);
|
||||
friend istream & operator >> (istream & load, NETGENPlugin_NETGEN_3D & hyp);
|
||||
|
||||
protected:
|
||||
double _maxElementVolume;
|
||||
|
||||
|
@ -31,6 +31,7 @@ using namespace std;
|
||||
|
||||
#include "NETGENPlugin_NETGEN_3D_i.hxx"
|
||||
#include "NETGENPlugin_NETGEN_2D_i.hxx"
|
||||
#include "NETGENPlugin_NETGEN_2D_ONLY_i.hxx"
|
||||
#include "NETGENPlugin_NETGEN_2D3D_i.hxx"
|
||||
#include "NETGENPlugin_Hypothesis_i.hxx"
|
||||
#include "NETGENPlugin_Hypothesis_2D_i.hxx"
|
||||
@ -62,6 +63,8 @@ extern "C"
|
||||
aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_3D_i>;
|
||||
else if (strcmp(aHypName, "NETGEN_2D") == 0)
|
||||
aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_2D_i>;
|
||||
else if (strcmp(aHypName, "NETGEN_2D_ONLY") == 0)
|
||||
aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_2D_ONLY_i>;
|
||||
else if (strcmp(aHypName, "NETGEN_2D3D") == 0)
|
||||
aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_2D3D_i>;
|
||||
// Hypotheses
|
||||
|
Loading…
x
Reference in New Issue
Block a user