Merge from BR_Dev_For_4_0.
This commit is contained in:
parent
22cc72b40c
commit
045264aff0
@ -13,6 +13,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
|
||||
@ -28,12 +29,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
|
||||
echo "failed : GUI_ROOT_DIR variable is not correct !"
|
||||
exit
|
||||
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
|
||||
|
||||
########################################################################
|
||||
@ -63,24 +78,29 @@ fi
|
||||
cd ${CONF_DIR}
|
||||
ABS_CONF_DIR=`pwd`
|
||||
|
||||
#######################################################################
|
||||
# Update configure.ac script: to set NETGENPLUGIN_WITH_GUI variable
|
||||
sed -e s/NETGENPLUGIN_WITH_GUI=[a-z]*/NETGENPLUGIN_WITH_GUI=${NETGENPLUGIN_WITH_GUI}/g configure.ac > configure.tmp
|
||||
mv -f configure.tmp configure.ac
|
||||
|
||||
mkdir -p salome_adm/unix/config_files
|
||||
cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/* salome_adm/unix/config_files
|
||||
cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/pythonbe.py salome_adm/unix
|
||||
#cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/* salome_adm/unix/config_files
|
||||
#cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/pythonbe.py salome_adm/unix
|
||||
|
||||
cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix
|
||||
|
||||
cp -f ${GUI_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
cp -f ${MED_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
cp -f ${GEOM_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
cp -f ${SMESH_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
#cp -f ${GUI_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
#cp -f ${MED_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
#cp -f ${GEOM_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
#cp -f ${SMESH_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
|
||||
|
||||
# remove KERNEL deprecated configure files
|
||||
for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \
|
||||
check_mico.m4 config.guess ltmain.sh ac_cxx_bool.m4 ltconfig ac_cxx_typename.m4 \
|
||||
check_pthreads.m4 config.sub libtool.m4 ac_cxx_mutable.m4 missing
|
||||
do
|
||||
rm -f salome_adm/unix/config_files/${deprecated}
|
||||
done
|
||||
#for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \
|
||||
# check_mico.m4 config.guess ltmain.sh ac_cxx_bool.m4 ltconfig ac_cxx_typename.m4 \
|
||||
# check_pthreads.m4 config.sub libtool.m4 ac_cxx_mutable.m4 missing
|
||||
# do
|
||||
# rm -f salome_adm/unix/config_files/${deprecated}
|
||||
# done
|
||||
|
||||
|
||||
# ____________________________________________________________________
|
||||
@ -92,7 +112,20 @@ for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \
|
||||
# autom4te.cache (directory)
|
||||
echo "====================================================== aclocal"
|
||||
|
||||
aclocal -I adm_local/unix/config_files -I salome_adm/unix/config_files || exit 1
|
||||
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 || exit 1
|
||||
else
|
||||
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 || exit 1
|
||||
fi
|
||||
|
||||
# ____________________________________________________________________
|
||||
# libtoolize creates some configuration files (ltmain.sh,
|
||||
|
108
configure.ac
108
configure.ac
@ -17,18 +17,13 @@
|
||||
# Created from configure.in.base
|
||||
#
|
||||
|
||||
AC_INIT([Salome2 Project NETGENPLUGIN module], [4.0.0], [gboulant@CS], [salome])
|
||||
AC_INIT([Salome2 Project NETGENPLUGIN module], [4.1.1], [webmaster.salome@opencascade.com], [salome])
|
||||
AC_CONFIG_AUX_DIR(salome_adm/unix/config_files)
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
PACKAGE=salome
|
||||
AC_SUBST(PACKAGE)
|
||||
|
||||
VERSION=4.0.0
|
||||
XVERSION=0x040000
|
||||
AC_SUBST(VERSION)
|
||||
XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'`
|
||||
AC_SUBST(XVERSION)
|
||||
|
||||
# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
|
||||
@ -228,37 +223,63 @@ AC_SUBST_FILE(CORBA)
|
||||
corba=make_$ORB
|
||||
CORBA=adm_local/unix/$corba
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing openGL
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
NETGENPLUGIN_WITH_GUI=no
|
||||
|
||||
CHECK_OPENGL
|
||||
AM_CONDITIONAL(NETGENPLUGIN_ENABLE_GUI, [test "${NETGENPLUGIN_WITH_GUI}" = "yes"])
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing QT
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
if test "${NETGENPLUGIN_WITH_GUI}" = "yes"; then
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing MSG2QM
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_QT
|
||||
CHECK_MSG2QM
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing MSG2QM
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing openGL
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_MSG2QM
|
||||
CHECK_OPENGL
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing VTK
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing QT
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_VTK
|
||||
CHECK_QT
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing VTK
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_VTK
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_SALOME_GUI
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing full GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
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
|
||||
echo ---------------------------------------------
|
||||
@ -284,26 +305,6 @@ echo
|
||||
|
||||
CHECK_HTML_GENERATORS
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_SALOME_GUI
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing full GUI
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
|
||||
CHECK_CORBA_IN_GUI
|
||||
if test "x${CORBA_IN_GUI}" != "xyes"; then
|
||||
echo "failed : For configure NETGENPLUGIN module necessary full GUI !"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing Kernel
|
||||
@ -353,7 +354,12 @@ echo
|
||||
#AM_CONDITIONAL( USE_GFORTRAN, [test "$F77" = "gfortran"])
|
||||
|
||||
echo Configure
|
||||
if test "${NETGENPLUGIN_WITH_GUI}" = "yes"; then
|
||||
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"
|
||||
fi
|
||||
if test "${NETGENPLUGIN_WITH_GUI}" = "no"; then
|
||||
variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok SMesh_ok Netgen_ok"
|
||||
fi
|
||||
|
||||
for var in $variables
|
||||
do
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -24,6 +24,7 @@
|
||||
label-id="Tetrahedron (Netgen)"
|
||||
icon-id="mesh_algo_tetra.png"
|
||||
hypos="MaxElementVolume"
|
||||
need-geom="false"
|
||||
input="TRIA"
|
||||
dim="3"/>
|
||||
<algorithm type="NETGEN_2D"
|
||||
@ -37,6 +38,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>
|
||||
|
||||
|
@ -122,16 +122,18 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
|
||||
myGrowthRate->setMinValue( 0.1 );
|
||||
myGrowthRate->setMaxValue( 10 );
|
||||
myGrowthRate->setLineStep( 0.1 );
|
||||
|
||||
|
||||
const double VALUE_MAX = 1.0e+6;
|
||||
|
||||
new QLabel( tr( "NETGEN_SEG_PER_EDGE" ), GroupC1 );
|
||||
myNbSegPerEdge = new QtxDblSpinBox( GroupC1 );
|
||||
myNbSegPerEdge->setMinValue( 0.2 );
|
||||
myNbSegPerEdge->setMaxValue( 5.0 );
|
||||
myNbSegPerEdge->setMaxValue( VALUE_MAX ); // (PAL14890) max value in native netgen gui is 5
|
||||
|
||||
new QLabel( tr( "NETGEN_SEG_PER_RADIUS" ), GroupC1 );
|
||||
myNbSegPerRadius = new QtxDblSpinBox( GroupC1 );
|
||||
myNbSegPerRadius->setMinValue( 0.2 );
|
||||
myNbSegPerRadius->setMaxValue( 5.0 );
|
||||
myNbSegPerRadius->setMaxValue( VALUE_MAX ); // (PAL14890) max value in native netgen gui is 5
|
||||
|
||||
if ( hypType()=="NETGEN_Parameters_2D" )
|
||||
{
|
||||
|
@ -27,4 +27,10 @@
|
||||
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
SUBDIRS = NETGEN NETGENPlugin GUI
|
||||
#SUBDIRS = NETGEN NETGENPlugin GUI
|
||||
|
||||
SUBDIRS = NETGEN NETGENPlugin
|
||||
|
||||
if NETGENPLUGIN_ENABLE_GUI
|
||||
SUBDIRS += GUI
|
||||
endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,6 +41,8 @@ dist_libNETGENEngine_la_SOURCES = \
|
||||
NETGENPlugin_NETGEN_2D_i.cxx \
|
||||
NETGENPlugin_NETGEN_2D3D.cxx \
|
||||
NETGENPlugin_NETGEN_2D3D_i.cxx \
|
||||
NETGENPlugin_NETGEN_2D_ONLY.cxx \
|
||||
NETGENPlugin_NETGEN_2D_ONLY_i.cxx \
|
||||
NETGENPlugin_Hypothesis.cxx \
|
||||
NETGENPlugin_Hypothesis_i.cxx \
|
||||
NETGENPlugin_Hypothesis_2D.cxx \
|
||||
|
@ -34,4 +34,4 @@
|
||||
#define NETGENPLUGIN_EXPORT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -25,11 +25,13 @@
|
||||
// Project : SALOME
|
||||
// $Header$
|
||||
//=============================================================================
|
||||
|
||||
#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>
|
||||
@ -43,6 +45,9 @@
|
||||
#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 {
|
||||
@ -153,6 +158,33 @@ 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
|
||||
@ -182,21 +214,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
|
||||
@ -416,7 +434,7 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
// create tetrahedra
|
||||
for (i = 1; i <= nbVol/* && isOK*/; ++i)
|
||||
{
|
||||
const netgen::Element& elem = ngMesh->VolumeElement(i);
|
||||
const netgen::Element& elem = ngMesh->VolumeElement(i);
|
||||
int aSolidInd = elem.GetIndex();
|
||||
TopoDS_Solid aSolid;
|
||||
if (aSolidInd > 0 && aSolidInd <= occgeo.somap.Extent())
|
||||
@ -488,5 +506,25 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)ngMesh);
|
||||
nglib::Ng_Exit();
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -30,13 +30,15 @@
|
||||
#define _NETGENPlugin_Mesher_HXX_
|
||||
|
||||
#include "NETGENPlugin_Defs.hxx"
|
||||
|
||||
#include "SMESH_ComputeError.hxx"
|
||||
#include "StdMeshers_FaceSide.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
|
||||
@ -54,6 +56,11 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
|
||||
|
||||
bool Compute();
|
||||
|
||||
static void PrepareOCCgeometry(netgen::OCCGeometry& occgeom,
|
||||
const TopoDS_Shape& shape);
|
||||
|
||||
static void RemoveTmpFiles();
|
||||
|
||||
private:
|
||||
SMESH_Mesh* _mesh;
|
||||
const TopoDS_Shape& _shape;
|
||||
|
@ -28,6 +28,8 @@
|
||||
//=============================================================================
|
||||
#include "NETGENPlugin_NETGEN_3D.hxx"
|
||||
|
||||
#include "NETGENPlugin_Mesher.hxx"
|
||||
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMESHDS_Mesh.hxx"
|
||||
@ -42,6 +44,9 @@
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <list>
|
||||
@ -312,11 +317,17 @@ 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 (Standard_Failure& exc) {
|
||||
error(COMPERR_OCC_EXCEPTION, exc.GetMessageString());
|
||||
status = NG_VOLUME_FAILURE;
|
||||
}
|
||||
catch (...) {
|
||||
MESSAGE("An exception has been caught during the Volume Mesh Generation ...");
|
||||
error(dfltErr(), "Exception in Ng_GenerateVolumeMesh()");
|
||||
error("Exception in Ng_GenerateVolumeMesh()");
|
||||
status = NG_VOLUME_FAILURE;
|
||||
}
|
||||
if ( GetComputeError()->IsOK() ) {
|
||||
@ -378,5 +389,185 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
Ng_DeleteMesh(Netgen_mesh);
|
||||
Ng_Exit();
|
||||
|
||||
NETGENPlugin_Mesher::RemoveTmpFiles();
|
||||
|
||||
return (status == NG_OK);
|
||||
}
|
||||
|
||||
bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
|
||||
SMESH_MesherHelper* aHelper)
|
||||
{
|
||||
MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume);
|
||||
const int invalid_ID = -1;
|
||||
bool _quadraticMesh = false;
|
||||
typedef map< const SMDS_MeshNode*, int> TNodeToIDMap;
|
||||
TNodeToIDMap nodeToNetgenID;
|
||||
list< const SMDS_MeshElement* > triangles;
|
||||
SMESHDS_Mesh* MeshDS = aHelper->GetMeshDS();
|
||||
|
||||
SMESH_MesherHelper::MType MeshType = aHelper->IsQuadraticMesh();
|
||||
|
||||
if(MeshType == SMESH_MesherHelper::COMP)
|
||||
return error( COMPERR_BAD_INPUT_MESH,
|
||||
SMESH_Comment("Mesh with linear and quadratic elements given."));
|
||||
else if (MeshType == SMESH_MesherHelper::QUADRATIC)
|
||||
_quadraticMesh = true;
|
||||
|
||||
SMDS_FaceIteratorPtr iteratorFace = MeshDS->facesIterator();
|
||||
|
||||
while(iteratorFace->more())
|
||||
{
|
||||
// check element
|
||||
const SMDS_MeshElement* elem = iteratorFace->next();
|
||||
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 );
|
||||
// put elem nodes to nodeToNetgenID map
|
||||
SMDS_ElemIteratorPtr triangleNodesIt = elem->nodesIterator();
|
||||
while ( triangleNodesIt->more() ) {
|
||||
const SMDS_MeshNode * node =
|
||||
static_cast<const SMDS_MeshNode *>(triangleNodesIt->next());
|
||||
if(aHelper->IsMedium(node))
|
||||
continue;
|
||||
|
||||
nodeToNetgenID.insert( make_pair( node, invalid_ID ));
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
// Feed the Netgen with surface mesh
|
||||
// ---------------------------------
|
||||
|
||||
int Netgen_NbOfNodes = 0;
|
||||
int Netgen_param2ndOrder = 0;
|
||||
double Netgen_paramFine = 1.;
|
||||
double Netgen_paramSize = _maxElementVolume;
|
||||
|
||||
double Netgen_point[3];
|
||||
int Netgen_triangle[3];
|
||||
int Netgen_tetrahedron[4];
|
||||
|
||||
Ng_Init();
|
||||
|
||||
Ng_Mesh * Netgen_mesh = Ng_NewMesh();
|
||||
|
||||
// set nodes and remember thier netgen IDs
|
||||
|
||||
TNodeToIDMap::iterator n_id = nodeToNetgenID.begin();
|
||||
for ( ; n_id != nodeToNetgenID.end(); ++n_id )
|
||||
{
|
||||
const SMDS_MeshNode* node = n_id->first;
|
||||
|
||||
Netgen_point [ 0 ] = node->X();
|
||||
Netgen_point [ 1 ] = node->Y();
|
||||
Netgen_point [ 2 ] = node->Z();
|
||||
Ng_AddPoint(Netgen_mesh, Netgen_point);
|
||||
n_id->second = ++Netgen_NbOfNodes; // set netgen ID
|
||||
|
||||
}
|
||||
|
||||
// set triangles
|
||||
list< const SMDS_MeshElement* >::iterator tria = triangles.begin();
|
||||
for ( ; tria != triangles.end(); ++tria)
|
||||
{
|
||||
int i = 0;
|
||||
SMDS_ElemIteratorPtr triangleNodesIt = (*tria)->nodesIterator();
|
||||
while ( triangleNodesIt->more() ) {
|
||||
const SMDS_MeshNode * node =
|
||||
static_cast<const SMDS_MeshNode *>(triangleNodesIt->next());
|
||||
if(aHelper->IsMedium(node))
|
||||
continue;
|
||||
Netgen_triangle[ i ] = nodeToNetgenID[ node ];
|
||||
++i;
|
||||
}
|
||||
|
||||
Ng_AddSurfaceElement(Netgen_mesh, NG_TRIG, Netgen_triangle);
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
// Generate the volume mesh
|
||||
// -------------------------
|
||||
|
||||
Ng_Meshing_Parameters Netgen_param;
|
||||
|
||||
Netgen_param.secondorder = Netgen_param2ndOrder;
|
||||
Netgen_param.fineness = Netgen_paramFine;
|
||||
Netgen_param.maxh = Netgen_paramSize;
|
||||
|
||||
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 (Standard_Failure& exc) {
|
||||
error(COMPERR_OCC_EXCEPTION, exc.GetMessageString());
|
||||
status = NG_VOLUME_FAILURE;
|
||||
}
|
||||
catch (...) {
|
||||
error("Bad mesh input!!!");
|
||||
status = NG_VOLUME_FAILURE;
|
||||
}
|
||||
if ( GetComputeError()->IsOK() ) {
|
||||
error( status, "Bad mesh input!!!");
|
||||
}
|
||||
|
||||
int Netgen_NbOfNodesNew = Ng_GetNP(Netgen_mesh);
|
||||
|
||||
int Netgen_NbOfTetra = Ng_GetNE(Netgen_mesh);
|
||||
|
||||
MESSAGE("End of Volume Mesh Generation. status=" << status <<
|
||||
", nb new nodes: " << Netgen_NbOfNodesNew - Netgen_NbOfNodes <<
|
||||
", nb tetra: " << Netgen_NbOfTetra);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Feed back the SMESHDS with the generated Nodes and Volume Elements
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
bool isOK = ( Netgen_NbOfTetra > 0 );// get whatever built
|
||||
if ( isOK )
|
||||
{
|
||||
// vector of nodes in which node index == netgen ID
|
||||
vector< const SMDS_MeshNode* > nodeVec ( Netgen_NbOfNodesNew + 1 );
|
||||
// insert old nodes into nodeVec
|
||||
for ( n_id = nodeToNetgenID.begin(); n_id != nodeToNetgenID.end(); ++n_id ) {
|
||||
nodeVec.at( n_id->second ) = n_id->first;
|
||||
}
|
||||
// create and insert new nodes into nodeVec
|
||||
int nodeIndex = Netgen_NbOfNodes + 1;
|
||||
|
||||
for ( ; nodeIndex <= Netgen_NbOfNodesNew; ++nodeIndex )
|
||||
{
|
||||
Ng_GetPoint( Netgen_mesh, nodeIndex, Netgen_point );
|
||||
SMDS_MeshNode * node = aHelper->AddNode(Netgen_point[0],
|
||||
Netgen_point[1],
|
||||
Netgen_point[2]);
|
||||
nodeVec.at(nodeIndex) = node;
|
||||
}
|
||||
|
||||
// create tetrahedrons
|
||||
for ( int elemIndex = 1; elemIndex <= Netgen_NbOfTetra; ++elemIndex )
|
||||
{
|
||||
Ng_GetVolumeElement(Netgen_mesh, elemIndex, Netgen_tetrahedron);
|
||||
aHelper->AddVolume (nodeVec.at( Netgen_tetrahedron[0] ),
|
||||
nodeVec.at( Netgen_tetrahedron[1] ),
|
||||
nodeVec.at( Netgen_tetrahedron[2] ),
|
||||
nodeVec.at( Netgen_tetrahedron[3] ));
|
||||
}
|
||||
}
|
||||
|
||||
Ng_DeleteMesh(Netgen_mesh);
|
||||
Ng_Exit();
|
||||
|
||||
NETGENPlugin_Mesher::RemoveTmpFiles();
|
||||
|
||||
return (status == NG_OK);
|
||||
}
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
virtual bool Compute(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape);
|
||||
|
||||
virtual bool Compute(SMESH_Mesh& aMesh,
|
||||
SMESH_MesherHelper* aHelper);
|
||||
|
||||
protected:
|
||||
double _maxElementVolume;
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#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…
Reference in New Issue
Block a user