updating or adding when merging in the main trunk with the version in the

branch nadir_1_2_2 !!
This commit is contained in:
nadir 2003-12-08 15:43:20 +00:00
parent cf8c1dc99e
commit faa1c8f2bc
53 changed files with 17558 additions and 38 deletions

View File

@ -1,4 +1,4 @@
This is SMESH V1_3_0
This is SMESH V1_3_1
Compatible with :
GEOM V1_3_0

View File

@ -23,6 +23,7 @@ mesh_algo_hexa.png \
mesh_algo_mefisto.png \
mesh_algo_quad.png \
mesh_algo_regular.png \
mesh_algo_tetra.png \
mesh_angle.png \
mesh_area.png \
mesh_aspect.png \
@ -63,6 +64,7 @@ mesh_tree_algo_mefisto.png \
mesh_tree_algo.png \
mesh_tree_algo_quad.png \
mesh_tree_algo_regular.png \
mesh_tree_algo_tetra.png \
mesh_tree_hypo_area.png \
mesh_tree_hypo_length.png \
mesh_tree_hypo.png \
@ -80,7 +82,8 @@ mesh_wrap.png \
ModuleMesh.png \
select1.png \
SMESH_en.xml \
SMESHCatalog.xml
SMESHCatalog.xml \
flight_solid.brep
BIN_SCRIPT= \
VERSION

View File

@ -0,0 +1,123 @@
AC_DEFUN([CHECK_NETGEN],[
AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_PROG_CXXCPP])dnl
AC_CHECKING(for Netgen Libraries)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_ARG_WITH(netgen,
--with-netgen=DIR root directory path of NETGEN installation,
WITHNETGEN="yes",WITHNETGEN="no")
NETGEN_INCLUDES=""
NETGEN_LIBS=""
Netgen_ok=no
if test "$WITHNETGEN" = yes; 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 SMESH_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_HOME=$withval
if test "$NETGEN_HOME"; then
NETGEN_INCLUDES="-I$NETGEN_HOME/include"
NETGEN_LIBS_DIR="$NETGEN_HOME/lib/LINUX"
NETGEN_LIBS="-L$NETGEN_LIBS_DIR"
fi
CPPFLAGS_old="$CPPFLAGS"
CPPFLAGS="$NETGEN_INCLUDES $CPPFLAGS"
CXXFLAGS_old="$CXXFLAGS"
CXXFLAGS="$NETGEN_INCLUDES $CXXFLAGS"
AC_MSG_CHECKING(for Netgen header file)
AC_CHECK_HEADER(nglib.h,Netgen_ok=yes,Netgen_ok=no)
CPPFLAGS="$CPPFLAGS_old"
CXXFLAGS="$CXXFLAGS_old"
if test "$WITHNETGEN" = "yes";then
NETGEN_LIBS="-L. -lNETGEN"
AC_MSG_CHECKING(for Netgen libraries)
CPPFLAGS_old="$CPPFLAGS"
CPPFLAGS="$NETGEN_INCLUDES $CPPFLAGS"
CXXFLAGS_old="$CXXFLAGS"
CXXFLAGS="$NETGEN_INCLUDES $CXXFLAGS"
LDFLAGS_old="$LDFLAGS"
LDFLAGS="$NETGEN_LIBS $LDFLAGS"
AC_TRY_COMPILE(#include <iostream.h>
#include <fstream.h>
#include "nglib.h"
,Ng_Init();
Ng_Exit();,Netgen_ok=yes;ar x "$NETGEN_LIBS_DIR"/libnginterface.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 pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline2d.o splinegeometry2.o ngnewdelete.o nglib.o -o libNETGEN.so;
rm -rf adfront2.o adfront3.o adtree.o algprim.o array.o basemat.o bfgs.o bisect.o bitarray.o boundarylayer.o brick.o bspline2d.o clusters.o csgeom.o csgparser.o curve2d.o curvedelems.o delaunay.o densemat.o dynamicmem.o edgeflw.o explicitcurve2d.o extrusion.o flags.o gencyl.o genmesh.o geom2dmesh.o geom2d.o geom3d.o geomfuncs.o geomsearch.o geomtest3d.o global.o hashtabl.o hprefinement.o identify.o importsolution.o improve2gen.o improve2.o improve3.o linopt.o linsearch.o localh.o manifold.o meshclass.o meshfunc2d.o meshfunc.o meshing2.o meshing3.o meshstlsurface.o meshsurf.o meshtool.o meshtype.o moveablemem.o msghandler.o mystring.o netrule2.o netrule3.o ngexception.o nglib.o ngnewdelete.o optmem.o parser2.o parser3.o parthreads.o polyhedra.o polynomial.o prism2rls.o pyramid2rls.o pyramidrls.o quadrls.o readuser.o refine.o revolution.o ruler2.o ruler3.o secondorder.o seti.o singularref.o smoothing2.o smoothing3.o solid.o sort.o sparsmat.o spbita2d.o specials.o specpoin.o spline2d.o spline3d.o splinegeometry2.o stlgeomchart.o stlgeommesh.o stlgeom.o stlline.o stltool.o stltopology.o surface.o symbolta.o table.o tetrarls.o topology.o transform3d.o triapprox.o triarls.o vector.o writeabaqus.o writediffpack.o writefeap.o writefluent.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o zrefine.o,
Netgen_ok=no)
AC_CACHE_VAL(salome_netgen_lib,[
AC_TRY_LINK(
#include <iostream.h>
#include <fstream.h>
#include "nglib.h"
,Ng_Init();
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"
CPPFLAGS="$CPPFLAGS_old"
CXXFLAGS="$CXXFLAGS_old"
fi
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)
NETGEN_LIBS="-lNETGEN"
fi
fi
AC_SUBST(NETGEN_INCLUDES)
AC_SUBST(NETGEN_LIBS)
AC_SUBST(NETGEN_LIBS_DIR)
AC_SUBST(WITHNETGEN)
AC_LANG_RESTORE
])dnl

View File

@ -245,5 +245,9 @@ ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \
check_swig.m4
#ifeq (@WITHNETGEN@,yes)
# ACLOCAL_SRC += check_Netgen.m4
#endif
$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files

View File

@ -1 +1,2 @@
THIS IS SALOME - SMESH VERSION: 1.3.0
THIS IS SALOME - SMESH VERSION: 1.3.1

View File

@ -273,6 +273,14 @@ echo
CHECK_MED
echo
echo ---------------------------------------------
echo Testing Netgen
echo ---------------------------------------------
echo
CHECK_NETGEN
echo
echo ---------------------------------------------
echo Summary
@ -280,7 +288,7 @@ echo ---------------------------------------------
echo
echo Configure
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok"
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok Netgen_ok"
for var in $variables
do

View File

@ -56,6 +56,13 @@ module SMESH
double GetMaxElementArea();
};
interface SMESH_LengthFromEdges : SMESH_Hypothesis
{
void SetMode(in long mode)
raises (SALOME::SALOME_Exception);
long GetMode();
};
interface SMESH_MaxElementVolume : SMESH_Hypothesis
{
void SetMaxElementVolume(in double volume)
@ -78,6 +85,10 @@ module SMESH
interface SMESH_Hexa_3D : SMESH_3D_Algo
{
};
interface SMESH_NETGEN_3D : SMESH_3D_Algo
{
};
};
#endif

View File

@ -40,12 +40,13 @@
<popup-item item-id="5030" pos-id="" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5031" pos-id="" label-id="Nb. Segments" icon-id="mesh_hypo_segment.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5032" pos-id="" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5033" pos-id="" label-id="Max. Hexahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5033" pos-id="" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="5000" pos-id="" label-id="Wire discretisation" icon-id="mesh_algo_regular.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5010" pos-id="" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5011" pos-id="" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5020" pos-id="" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5021" pos-id="" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ************************** Mesh (menubar) ************************************ -->
@ -196,12 +197,13 @@
<toolbutton-item item-id="5030" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="Avreage length Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5031" label-id="Segments" icon-id="mesh_hypo_segment.png" tooltip-id="Nb. Segments Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5032" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="Max. Triangle Area Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5033" label-id="Max. Hexahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="Max. Hexahedron Volume Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5033" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="Max. Hexahedron or Tetrahedron Volume Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="5000" label-id="Wire Discretisation" icon-id="mesh_algo_regular.png" tooltip-id="Wire Discratisation Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5010" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="Triangle (Mefisto) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5011" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="Quadrangle (Mapping) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5020" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="Hexahedron (i,j,k) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5021" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_hexa.png" tooltip-id="Tetrahedron (Netgen) Delaunay Algorithm" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Controls toolbar">

View File

@ -40,12 +40,13 @@
<popup-item item-id="5030" pos-id="" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5031" pos-id="" label-id="Nb. Segments" icon-id="mesh_hypo_segment.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5032" pos-id="" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5033" pos-id="" label-id="Max. Hexahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5033" pos-id="" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="5000" pos-id="" label-id="Wire discretisation" icon-id="mesh_algo_regular.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5010" pos-id="" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5011" pos-id="" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5020" pos-id="" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5021" pos-id="" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ************************** Mesh (menubar) ************************************ -->
@ -196,12 +197,13 @@
<toolbutton-item item-id="5030" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="Avreage length Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5031" label-id="Segments" icon-id="mesh_hypo_segment.png" tooltip-id="Nb. Segments Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5032" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="Max. Triangle Area Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5033" label-id="Max. Hexahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="Max. Hexahedron Volume Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5033" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="Max. Hexahedron or Tetrahedron Volume Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="5000" label-id="Wire Discretisation" icon-id="mesh_algo_regular.png" tooltip-id="Wire Discratisation Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5010" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="Triangle (Mefisto) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5011" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="Quadrangle (Mapping) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5020" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="Hexahedron (i,j,k) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5021" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_hexa.png" tooltip-id="Tetrahedron (Netgen) Delaunay Algorithm" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
<toolbar label-id="Controls toolbar">

13835
resources/flight_solid.brep Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

View File

@ -456,6 +456,36 @@ void DriverMED_R_SMDS_Mesh::Read()
}
break;
}
case MED_TETRA4:
{
if (inuele)
{
for (j = 0; j < nmailles[i]; j++)
{
elem_id = *(numele + j);
ok = myMesh->AddVolumeWithID(*(connectivite +
j * (taille)),
*(connectivite + j * (taille) + 1),
*(connectivite + j * (taille) + 2),
*(connectivite + j * (taille) + 3), elem_id);
//fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
}
}
else
{
for (j = 0; j < nmailles[i]; j++)
{
cmpt++;
ok = myMesh->AddVolumeWithID(*(connectivite +
j * (taille)),
*(connectivite + j * (taille) + 1),
*(connectivite + j * (taille) + 2),
*(connectivite + j * (taille) + 3), cmpt);
//fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
}
}
break;
}
case MED_HEXA8:
{
if (inuele)

View File

@ -478,6 +478,37 @@ void DriverMED_R_SMESHDS_Mesh::ReadMySelf()
}
break;
}
case MED_TETRA4:
{
if (inuele)
{
for (j = 0; j < nmailles[i]; j++)
{
elem_id = *(numele + j);
ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite +
j * (taille - nsup)),
*(connectivite + j * (taille - nsup) + 1),
*(connectivite + j * (taille - nsup) + 2),
*(connectivite + j * (taille - nsup) + 3),
elem_id);
//fprintf(Out,"%d %d %d %d\n",elem_id,*(connectivite+j*(taille-nsup)),*(connectivite+j*(taille-nsup)+1),*(connectivite+j*(taille-nsup)+2),*(connectivite+j*(taille-nsup)+3));
}
}
else
{
for (j = 0; j < nmailles[i]; j++)
{
cmpt++;
ok = mySMESHDSMesh->AddVolumeWithID(*(connectivite +
j * (taille)),
*(connectivite + j * (taille) + 1),
*(connectivite + j * (taille) + 2),
*(connectivite + j * (taille) + 3), cmpt);
//fprintf(Out,"%d %d %d %d\n",j,*(connectivite+j*(taille)),*(connectivite+j*(taille)+1),*(connectivite+j*(taille)+2),*(connectivite+j*(taille)+3));
}
}
break;
}
case MED_HEXA8:
{
if (inuele)

View File

@ -266,6 +266,12 @@ void DriverMED_W_SMDS_Mesh::Write()
nmailles[9]++;
break;
}
case 4 :
{
elem_Id[7].push_back(elem->GetID());
nmailles[7]++;
break;
}
}
}

View File

@ -361,6 +361,12 @@ void DriverMED_W_SMESHDS_Mesh::Add()
nmailles[9]++;
break;
}
case 4 :
{
elem_Id[7].push_back(elem->GetID());
nmailles[7]++;
break;
}
}
}

View File

@ -35,5 +35,10 @@ SUBDIRS = OBJECT SMDS SMESHDS Driver DriverMED DriverDAT DriverUNV MEFISTO2 \
SMESH SMESH_I SMESHFiltersSelection SMESHGUI \
SMESH_SWIG
ifeq (@WITHNETGEN@,yes)
SUBDIRS = OBJECT SMDS SMESHDS Driver DriverMED DriverDAT DriverUNV MEFISTO2 \
NETGEN SMESH SMESH_I SMESHFiltersSelection SMESHGUI \
SMESH_SWIG
endif
@MODULE@

152
src/NETGEN/Makefile.in Normal file
View File

@ -0,0 +1,152 @@
# -* Makefile *-
#
# Author : Nadir Bouhamou (CEA)
# Module : SMESH
# Date : 10/10/2003
#
#
# source path
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
VPATH=.:@srcdir@
@COMMENCE@
# Libraries targets
LIB = libNETGEN.la
# additionnal information to compil and link file
CPPFLAGS += -DSOLIDGEOM -DLINUX $(OCC_INCLUDES)
CXXFLAGS += -DSOLIDGEOM -DLINUX $(OCC_CXXFLAGS)
LDFLAGS += $(OCC_LIBS) -lg2c
NETGEN_LIBS_DIR=@NETGEN_LIBS_DIR@
LIB_OBJ_O = linopt.o \
bfgs.o \
linsearch.o \
global.o \
bisect.o \
meshtool.o \
refine.o \
ruler3.o \
improve3.o \
adfront3.o \
tetrarls.o \
prism2rls.o \
pyramidrls.o \
pyramid2rls.o \
netrule3.o \
ruler2.o \
meshclass.o \
improve2.o \
adfront2.o \
netrule2.o \
triarls.o \
geomsearch.o \
secondorder.o \
meshtype.o \
parser3.o \
quadrls.o \
specials.o \
parser2.o \
meshing2.o \
meshing3.o \
meshfunc.o \
localh.o \
improve2gen.o \
delaunay.o \
boundarylayer.o \
msghandler.o \
meshfunc2d.o \
smoothing2.o \
smoothing3.o \
topology.o \
curvedelems.o \
clusters.o \
zrefine.o \
ngexception.o \
geomtest3d.o \
geom2d.o \
geom3d.o \
adtree.o \
transform3d.o \
geomfuncs.o \
polynomial.o \
densemat.o \
vector.o \
basemat.o \
sparsmat.o \
algprim.o \
brick.o \
manifold.o \
bspline2d.o \
meshsurf.o \
csgeom.o \
polyhedra.o \
curve2d.o \
singularref.o \
edgeflw.o \
solid.o \
explicitcurve2d.o \
specpoin.o \
gencyl.o \
revolution.o \
genmesh.o \
spline3d.o \
surface.o \
identify.o \
triapprox.o \
meshstlsurface.o \
stlline.o \
stltopology.o \
stltool.o \
stlgeom.o \
stlgeomchart.o \
stlgeommesh.o \
table.o \
optmem.o \
spbita2d.o \
hashtabl.o \
sort.o \
flags.o \
seti.o \
bitarray.o \
array.o \
symbolta.o \
mystring.o \
moveablemem.o \
spline2d.o \
splinegeometry2.o \
ngnewdelete.o \
nglib.o
$(LIB_OBJ_O):
ar x $(NETGEN_LIBS_DIR)/libnginterface.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
rm -rf sgparser.o hprefinement.o parthreads.o writediffpack.o writepermas.o writeuser.o dynamicmem.o importsolution.o readuser.o writefeap.o writetecplot.o wuchemnitz.o extrusion.o writeabaqus.o writefluent.o writetochnog.o csgparser.o geom2dmesh.o
LIB_OBJ_LO = $(LIB_OBJ_O:%.o=%.lo)
#implicits rules
.o.lo:
ln -s $< $@ || true
@CONCLUDE@
$(LIB): $(LIB_OBJ_O) $(LIB_OBJ_LO)
@$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ_LO) $(LDFLAGS) $(LIBS)
mostlyclean: cleandep
-$(RM) $(LIB_OBJ_O) $(LIB_OBJ_LO)

View File

@ -0,0 +1,90 @@
The Netgen 4.3 from the web location : http://www.hpfem.jku.at/netgen/ is used
in the SMESH Module of Salome2 distribution.
Assumptions on the Netgen installation
--------------------------------------
The SMESH Engine of SALOME2 (particularly the m4 file check_Netgen.m4) assume
that Netgen is installed in the directory <netgen_installation_path> as follow:
prompt> ls <netgen_installation_path>
bin/ cshrc_for_netgen doc/ include/ lib/ tutorials/
prompt> ls <netgen_installation_path>/bin
LINUX/
prompt> ls <netgen_installation_path>/bin/LINUX/
demoapp/ ng ng.tcl ngtcltk/ startup.tcl
prompt> ls <netgen_installation_path>/bin/LINUX/demoapp/
demoapp.tcl
prompt> ls <netgen_installation_path>/bin/LINUX/ngtcltk/
dialog.tcl menustat.tcl ngicon.tcl parameters.tcl
drawing.tcl nghelp.tcl ngvisual.tcl variables.tcl
prompt> ls <netgen_installation_path>/doc/
ng4.pdf usenetgen.ps
prompt> ls <netgen_installation_path>/include/
nglib.h
prompt> ls <netgen_installation_path>/lib/
LINUX/
prompt> ls <netgen_installation_path>/lib/LINUX/
libcsg.a libgeom2d.a libla.a libnginterface.a libstlgeom.a
libgen.a libgprim.a libmesh.a libopti.a libvis.a
prompt> ls <netgen_installation_path>/tutorials/
boxcyl.geo cylinder.geo ficherea.geo part1.stl square.in2d
cone.geo cylsphere.geo hinge.stl sculpture.geo trafo.geo
cubeandspheres.geo demo2d.in2d lshape3d.geo shaft.geo twobricks.geo
cube.geo ellipsoid.geo manyholes.geo sphere.geo twocubes.geo
cubemcyl.geo ellipticcyl.geo matrix.geo sphereincube.geo twocyl.geo
cubemsphere.geo
All *.tcl files are needed to control and initiate the Netgen mesher throughout its
MHI (Machine Human Interface).<netgen_installation_path>/bin/LINUX/ng is the Netgen
executable with its embarked MHI. All the libraries *.a should be compiled without
the option -DOPENGL which is only needed for the Netgen MHI. netgen43 is assumed to
be the directory downloaded from the above web location archive of Netgen. The library
<netgen_installation_path>/lib/LINUX/libnginterface.a should contain the objects
nglib.o (from netgen43/libsrc/interface/nglib.cpp) and ngnewdelete.o
(from netgen43/ngtcltk/ngnewdelete.cpp).
To have that kind of distribution from the version in the above web location you
should first compile Netgen as suggested in the netgen43/README.INSTALL file. It will
then produce the executable ng linked statically with the libraries *.a. Then modify
the Makefiles to remove -DOPENGL from compiler flags list, add the objects nglib.o
and ngnewdelete.o to the library libnginterface.a and recompile the libraries only.
From the above web location perhaps, you will have to alter some Netgen sources to
compile them; if you find any difficulties to do that, just ask me.
Nadir
********************************
* Dr Nadir Bouhamou *
* Ingénieur-chercheur *
* Engineer-Researcher *
* *
* CEA Saclay *
* DEN/DM2S/SFME/LGLS *
* Bat 454 Pièce 5A *
* 91191 Gif-Sur-Yvette cédex *
* *
* Tél: +33 (0)1 69 08 73 07 *
* Fax: +33 (0)1 69 08 96 96 *
* email: nadir.bouhamou@cea.fr *
********************************

View File

@ -95,5 +95,14 @@ CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR
LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV -L${KERNEL_ROOT_DIR}/lib/salome
ifeq (@WITHNETGEN@,yes)
EXPORT_HEADERS+= SMESH_NETGEN_3D.hxx
LIB_SRC+= SMESH_NETGEN_3D.cxx
NETGEN_INCLUDES=@NETGEN_INCLUDES@
CPPFLAGS+= $(NETGEN_INCLUDES)
CXXFLAGS+= $(NETGEN_INCLUDES)
LDFLAGS+= -lNETGEN
endif
@CONCLUDE@

View File

@ -41,10 +41,12 @@ using namespace std;
#include "SMESH_LengthFromEdges.hxx"
#include "SMESH_NumberOfSegments.hxx"
#include "SMESH_MaxElementArea.hxx"
#include "SMESH_MaxElementVolume.hxx"
#include "SMESH_Regular_1D.hxx"
#include "SMESH_MEFISTO_2D.hxx"
#include "SMESH_Quadrangle_2D.hxx"
#include "SMESH_Hexa_3D.hxx"
#include "SMESH_NETGEN_3D.hxx"
//---------------------------------------
@ -87,11 +89,12 @@ _creatorMap["LocalLength"] = new SMESH_HypothesisCreator<SMESH_LocalLength>;
_creatorMap["NumberOfSegments"] = new SMESH_HypothesisCreator<SMESH_NumberOfSegments>;
_creatorMap["LengthFromEdges"] = new SMESH_HypothesisCreator<SMESH_LengthFromEdges>;
_creatorMap["MaxElementArea"] = new SMESH_HypothesisCreator<SMESH_MaxElementArea>;
_creatorMap["MaxElementVolume"] = new SMESH_HypothesisCreator<SMESH_MaxElementVolume>;
_creatorMap["Regular_1D"] = new SMESH_HypothesisCreator<SMESH_Regular_1D>;
_creatorMap["MEFISTO_2D"] = new SMESH_HypothesisCreator<SMESH_MEFISTO_2D>;
_creatorMap["Quadrangle_2D"] = new SMESH_HypothesisCreator<SMESH_Quadrangle_2D>;
_creatorMap["Hexa_3D"] = new SMESH_HypothesisCreator<SMESH_Hexa_3D>;
_creatorMap["NETGEN_3D"] = new SMESH_HypothesisCreator<SMESH_NETGEN_3D>;
//---------------------------------------
}

View File

@ -260,7 +260,8 @@ bool SMESH_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
if (ierr == 0)
{
MESSAGE("... End Triangulation");
MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
MESSAGE(" Node Number " << nbst);
//SCRUTE(nbst);
//SCRUTE(nbt);
StoreResult(aMesh, nbst, uvst, nbt, nust, F,

View File

@ -27,3 +27,111 @@
// $Header$
using namespace std;
#include "SMESH_MaxElementVolume.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_MaxElementVolume::SMESH_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen)
: SMESH_Hypothesis(hypId, studyId, gen)
{
_maxVolume =1.;
_name = "MaxElementVolume";
// SCRUTE(_name);
SCRUTE(&_name);
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_MaxElementVolume::~SMESH_MaxElementVolume()
{
MESSAGE("SMESH_MaxElementVolume::~SMESH_MaxElementVolume");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_MaxElementVolume::SetMaxVolume(double maxVolume)
throw (SALOME_Exception)
{
double oldVolume = _maxVolume;
if (maxVolume <= 0)
throw SALOME_Exception(LOCALIZED("maxVolume must be positive"));
_maxVolume = maxVolume;
if (_maxVolume != oldVolume)
NotifySubMeshesHypothesisModification();
}
//=============================================================================
/*!
*
*/
//=============================================================================
double SMESH_MaxElementVolume::GetMaxVolume() const
{
return _maxVolume;
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & SMESH_MaxElementVolume::SaveTo(ostream & save)
{
return save << this;
}
//=============================================================================
/*!
*
*/
//=============================================================================
istream & SMESH_MaxElementVolume::LoadFrom(istream & load)
{
return load >> (*this);
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & operator << (ostream & save, SMESH_MaxElementVolume & hyp)
{
save << hyp._maxVolume;
return save;
}
//=============================================================================
/*!
*
*/
//=============================================================================
istream & operator >> (istream & load, SMESH_MaxElementVolume & hyp)
{
bool isOK = true;
double a;
isOK = (load >> a);
if (isOK) hyp._maxVolume = a;
else load.clear(ios::badbit | load.rdstate());
return load;
}

View File

@ -26,3 +26,31 @@
// Module : SMESH
// $Header$
#ifndef _SMESH_MAXELEMENTVOLUME_HXX_
#define _SMESH_MAXELEMENTVOLUME_HXX_
#include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx"
class SMESH_MaxElementVolume:
public SMESH_Hypothesis
{
public:
SMESH_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_MaxElementVolume();
void SetMaxVolume(double maxVolume)
throw (SALOME_Exception);
double GetMaxVolume() const;
virtual ostream & SaveTo(ostream & save);
virtual istream & LoadFrom(istream & load);
friend ostream & operator << (ostream & save, SMESH_MaxElementVolume & hyp);
friend istream & operator >> (istream & load, SMESH_MaxElementVolume & hyp);
protected:
double _maxVolume;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
//=============================================================================
// File : SMESH_NETGEN_3D.hxx
// Created : lundi 27 Janvier 2003
// Author : Nadir BOUHAMOU (CEA)
// Project : SALOME
// Copyright : CEA 2003
// $Header$
//=============================================================================
#ifndef _SMESH_NETGEN_3D_HXX_
#define _SMESH_NETGEN_3D_HXX_
#include "SMESH_3D_Algo.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MaxElementVolume.hxx"
#include "Utils_SALOME_Exception.hxx"
class SMESH_NETGEN_3D: public SMESH_3D_Algo
{
public:
SMESH_NETGEN_3D(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_NETGEN_3D();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
throw (SALOME_Exception);
ostream & SaveTo(ostream & save);
istream & LoadFrom(istream & load);
friend ostream & operator << (ostream & save, SMESH_NETGEN_3D & hyp);
friend istream & operator >> (istream & load, SMESH_NETGEN_3D & hyp);
protected:
double _maxElementVolume;
const SMESH_MaxElementVolume* _hypMaxElementVolume;
};
#endif

View File

@ -249,12 +249,60 @@ bool SMESH_subMesh::SubMeshesComputed() throw(SALOME_Exception)
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
{
SMESH_subMesh *sm = (*itsub).second;
const TopoDS_Shape & ss = sm->GetSubShape();
int type = ss.ShapeType();
// SCRUTE(sm->GetId());
// SCRUTE(sm->GetComputeState());
bool computeOk = (sm->GetComputeState() == COMPUTE_OK);
if (!computeOk)
{
subMeshesComputed = false;
switch (type)
{
case TopAbs_COMPOUND:
{
MESSAGE("The not computed sub mesh is a COMPOUND");
break;
}
case TopAbs_COMPSOLID:
{
MESSAGE("The not computed sub mesh is a COMPSOLID");
break;
}
case TopAbs_SHELL:
{
MESSAGE("The not computed sub mesh is a SHEL");
break;
}
case TopAbs_WIRE:
{
MESSAGE("The not computed sub mesh is a WIRE");
break;
}
case TopAbs_SOLID:
{
MESSAGE("The not computed sub mesh is a SOLID");
break;
}
case TopAbs_FACE:
{
MESSAGE("The not computed sub mesh is a FACE");
break;
}
case TopAbs_EDGE:
{
MESSAGE("The not computed sub mesh is a EDGE");
break;
}
default:
{
MESSAGE("The not computed sub mesh is of unknown type");
break;
}
}
SCRUTE(sm->GetId());
break;
}

View File

@ -848,6 +848,8 @@ void SMESHGUI::CreateAlgorithm( QString TypeAlgo, QString NameAlgo )
Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
else if ( TypeAlgo.compare("Hexa_3D") == 0 )
Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
else if ( TypeAlgo.compare("NETGEN_3D") == 0 )
Hyp = myComponentMesh->CreateHypothesis( TypeAlgo, myStudyId );
if ( !Hyp->_is_nil() ) {
SALOMEDS::SObject_var SHyp = myStudyAPI.AddNewAlgorithms( Hyp );
@ -930,7 +932,7 @@ void SMESHGUI::CreateMaxElementVolume( QString TypeHypothesis, QString NameHypot
*
*/
//=============================================================================
void SMESHGUI::CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, double nbSegments )
void SMESHGUI::CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, int nbSegments )
{
QApplication::setOverrideCursor( Qt::waitCursor );
try {
@ -1368,13 +1370,29 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
float backfacecolor[3];
float nodecolor[3];
ac->GetColor(color[0],color[1],color[2]);
QColor c(color[0]*255,color[1]*255,color[2]*255);
// QColor c(color[0]*255,color[1]*255,color[2]*255);
int c0 = int(color[0]*255);
int c1 = int(color[1]*255);
int c2 = int(color[2]*255);
QColor c( c0, c1, c2 );
ac->GetEdgeColor(edgecolor[0],edgecolor[1],edgecolor[2]);
QColor e(edgecolor[0]*255,edgecolor[1]*255,edgecolor[2]*255);
// QColor e(edgecolor[0]*255,edgecolor[1]*255,edgecolor[2]*255);
c0 = int(edgecolor[0]*255);
c1 = int(edgecolor[1]*255);
c2 = int(edgecolor[2]*255);
QColor e( c0, c1, c2 );
ac->GetBackfaceProperty()->GetColor(backfacecolor);
QColor b(backfacecolor[0]*255,backfacecolor[1]*255,backfacecolor[2]*255);
// QColor b(backfacecolor[0]*255,backfacecolor[1]*255,backfacecolor[2]*255);
c0 = int(backfacecolor[0]*255);
c1 = int(backfacecolor[1]*255);
c2 = int(backfacecolor[2]*255);
QColor b( c0, c1, c2 );
ac->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2] ) ;
QColor n(nodecolor[0]*255, nodecolor[1]*255, nodecolor[2]*255 ) ;
// QColor n(nodecolor[0]*255, nodecolor[1]*255, nodecolor[2]*255 ) ;
c0 = int(nodecolor[0]*255);
c1 = int(nodecolor[1]*255);
c2 = int(nodecolor[2]*255);
QColor n( c0, c1, c2 ) ;
int Edgewidth = (int)ac->EdgeDevice->GetProperty()->GetLineWidth();
if ( Edgewidth == 0 )
@ -2292,7 +2310,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
double beforeMaxVolume = MEV->GetMaxElementVolume() ;
double MaxVolume = smeshGUI->Parameter( res,
beforeMaxVolume,
tr("SMESH_MAX_ELEMENT_AREA_HYPOTHESIS"),
tr("SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS"),
tr("SMESH_VALUE"),
1.0E-5, 1E6, 6 ) ;
if ( res && MaxVolume != beforeMaxVolume ) {
@ -2499,6 +2517,11 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
smeshGUI->CreateAlgorithm("Hexa_3D","Hexahedron (i,j,k)");
break;
}
case 5021:
{
smeshGUI->CreateAlgorithm("NETGEN_3D","Tetrahedron (Netgen)");
break;
}
case 5030: // HYPOTHESIS - LOCAL LENGTH
{
@ -5234,7 +5257,8 @@ void SMESHGUI::DisplaySimulationNode( SMESH::SMESH_Mesh_ptr aMesh, float x, floa
QString SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue");
QColor nodecolor(SCr.toInt(), SCg.toInt(), SCb.toInt());
if ( !nodecolor.isValid() )
nodecolor = QColor(0.,1.,0.);
// nodecolor = QColor(0.,1.,0.);
nodecolor = QColor(0,1,0);
node->GetProperty()->SetColor( float(nodecolor.red())/255.,
float(nodecolor.green())/255.,

View File

@ -150,7 +150,7 @@ public :
void RemoveHypothesisOrAlgorithmOnMesh( SALOMEDS::SObject_ptr MorSM, SMESH::SMESH_Hypothesis_ptr anHyp ) ;
void CreateLocalLength( QString TypeHypothesis, QString NameHypothesis, double Length );
void CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, double nbSegments );
void CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, int nbSegments );
void CreateMaxElementArea( QString TypeHypothesis, QString NameHypothesis, double MaxArea );
void CreateMaxElementVolume( QString TypeHypothesis, QString NameHypothesis, double MaxVolume );

View File

@ -242,7 +242,8 @@ void SMESHGUI_NbSegmentsDlg::ClickOnApply()
case 0 :
{
myNbSeg = SpinBox_NbSeg->value() ;
mySMESHGUI->CreateNbSegments( "NumberOfSegments", myNameHypothesis, myNbSeg );
int nbSegInt = int(myNbSeg);
mySMESHGUI->CreateNbSegments( "NumberOfSegments", myNameHypothesis, nbSegInt );
break ;
}
}

View File

@ -123,7 +123,7 @@ msgstr "mesh_vertex.png"
msgid "ICON_DLG_LINE"
msgstr "mesh_line.png"
#triangle
#Triangle
msgid "ICON_DLG_TRIANGLE"
msgstr "mesh_triangle.png"
@ -131,11 +131,11 @@ msgstr "mesh_triangle.png"
msgid "ICON_DLG_QUADRANGLE"
msgstr "mesh_quad.png"
#triangle
#Tetrahedrons
msgid "ICON_DLG_TETRAS"
msgstr "mesh_tetra.png"
#Quadrangle
#Hexahedrons
msgid "ICON_DLG_HEXAS"
msgstr "mesh_hexa.png"
@ -168,6 +168,10 @@ msgstr "mesh_tree_algo_mefisto.png"
msgid "ICON_SMESH_TREE_ALGO_Quadrangle_2D"
msgstr "mesh_tree_algo_quad.png"
#mesh_tree_algo_netgen
msgid "ICON_SMESH_TREE_ALGO_NETGEN_3D"
msgstr "mesh_tree_algo_netgen.png"
#mesh_tree_hypo
msgid "ICON_SMESH_TREE_HYPO"
msgstr "mesh_tree_hypo.png"

View File

@ -54,6 +54,7 @@ LIB_SRC = SMESH_Gen_i.cxx SMESH_Mesh_i.cxx SMESH_MEDMesh_i.cxx \
SMESH_NumberOfSegments_i.cxx \
SMESH_LocalLength_i.cxx \
SMESH_MaxElementArea_i.cxx \
SMESH_LengthFromEdges_i.cxx \
SMESH_MaxElementVolume_i.cxx \
SMESH_Regular_1D_i.cxx \
SMESH_Quadrangle_2D_i.cxx \
@ -78,5 +79,10 @@ CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR
LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lSMESHimpl -lSalomeContainer -lSalomeNS -lSalomeDS -lRegistry -lSalomeHDFPersist -lOpUtil -lGEOMClient -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverMED -lSalomeLifeCycleCORBA -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome
ifeq (@WITHNETGEN@,yes)
LIB_SRC += SMESH_NETGEN_3D_i.cxx
LDFLAGS += -lNETGEN
endif
@CONCLUDE@

View File

@ -53,6 +53,7 @@ using namespace std;
#include "SMESH_LocalLength_i.hxx"
#include "SMESH_NumberOfSegments_i.hxx"
#include "SMESH_MaxElementArea_i.hxx"
#include "SMESH_MaxElementVolume_i.hxx"
#include "SMESHDS_Document.hxx"
@ -465,7 +466,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
//************branch 1 : hypothesis
if (gotBranch->Tag()==Tag_HypothesisRoot) { //hypothesis = tag 1
double length,maxElementsArea;
double length,maxElementsArea,maxElementsVolume;
int numberOfSegments;
destFile = fopen( hypofile.ToCString() ,"w");
@ -495,6 +496,11 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
maxElementsArea = MEA->GetMaxElementArea();
fprintf(destFile,"%f\n",maxElementsArea);
}
else if (strcmp(myHyp->GetName(),"MaxElementVolume")==0) {
SMESH::SMESH_MaxElementVolume_var MEV = SMESH::SMESH_MaxElementVolume::_narrow( myHyp );
maxElementsVolume = MEV->GetMaxElementVolume();
fprintf(destFile,"%f\n",maxElementsVolume);
}
}
}
fclose(destFile);
@ -945,7 +951,7 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
//***************
if (strcmp(name,"Hypothesis")==0) {
double length,maxElementsArea;
double length,maxElementsArea,maxElementsVolume;
int numberOfSegments;
hdf_group[Tag_HypothesisRoot] = new HDFgroup(name,hdf_file);
@ -1000,6 +1006,16 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
sprintf(objectId,"%d",MEA->GetId());
_SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString;
}
else if (strcmp(aLine,"MaxElementVolume")==0) {
SMESH::SMESH_Hypothesis_var myHyp = this->CreateHypothesis(aLine,studyId);
SMESH::SMESH_MaxElementVolume_var MEV = SMESH::SMESH_MaxElementVolume::_narrow( myHyp );
fscanf(loadedFile,"%s",aLine);
maxElementsVolume = atof(aLine);
MEV->SetMaxElementVolume(maxElementsVolume);
string iorString = _orb->object_to_string(MEV);
sprintf(objectId,"%d",MEV->GetId());
_SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString;
}
}

View File

@ -38,11 +38,14 @@ using namespace std;
//---------------------------------------
#include "SMESH_LocalLength_i.hxx"
#include "SMESH_NumberOfSegments_i.hxx"
#include "SMESH_LengthFromEdges_i.hxx"
#include "SMESH_MaxElementArea_i.hxx"
#include "SMESH_MaxElementVolume_i.hxx"
#include "SMESH_Regular_1D_i.hxx"
#include "SMESH_MEFISTO_2D_i.hxx"
#include "SMESH_Quadrangle_2D_i.hxx"
#include "SMESH_Hexa_3D_i.hxx"
#include "SMESH_NETGEN_3D_i.hxx"
//---------------------------------------
@ -82,11 +85,14 @@ SMESH_HypothesisFactory_i::SMESH_HypothesisFactory_i()
//---------------------------------------
_creatorMap["LocalLength"] = new HypothesisCreator_i<SMESH_LocalLength_i>;
_creatorMap["NumberOfSegments"] = new HypothesisCreator_i<SMESH_NumberOfSegments_i>;
_creatorMap["LengthFromEdges"] = new HypothesisCreator_i<SMESH_LengthFromEdges_i>;
_creatorMap["MaxElementArea"] = new HypothesisCreator_i<SMESH_MaxElementArea_i>;
_creatorMap["MaxElementVolume"] = new HypothesisCreator_i<SMESH_MaxElementVolume_i>;
_creatorMap["Regular_1D"] = new HypothesisCreator_i<SMESH_Regular_1D_i>;
_creatorMap["MEFISTO_2D"] = new HypothesisCreator_i<SMESH_MEFISTO_2D_i>;
_creatorMap["Quadrangle_2D"] = new HypothesisCreator_i<SMESH_Quadrangle_2D_i>;
_creatorMap["Hexa_3D"] = new HypothesisCreator_i<SMESH_Hexa_3D_i>;
_creatorMap["NETGEN_3D"] = new HypothesisCreator_i<SMESH_NETGEN_3D_i>;
//---------------------------------------
}

View File

@ -0,0 +1,98 @@
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : SMESH_LengthFromEdges_i.cxx
// Author : Nadir BOUHAMOU CEA/DEN, Paul RASCLE, EDF
// Module : SMESH
// $Header$
using namespace std;
using namespace std;
#include "SMESH_LengthFromEdges_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
* Constructor:
* _name is related to the class name: prefix = SMESH_ ; suffix = _i .
*/
//=============================================================================
SMESH_LengthFromEdges_i::SMESH_LengthFromEdges_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_LengthFromEdges_i::SMESH_LengthFromEdges_i");
_impl = new ::SMESH_LengthFromEdges(genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_LengthFromEdges_i::~SMESH_LengthFromEdges_i()
{
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_LengthFromEdges_i::SetMode(CORBA::Long mode)
throw (SALOME::SALOME_Exception)
{
ASSERT(_impl);
try
{
_impl->SetMode(mode);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_LengthFromEdges_i::GetMode()
{
ASSERT(_impl);
return _impl->GetMode();
}

View File

@ -0,0 +1,59 @@
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : SMESH_LengthFromEdges_i.hxx
// Author : Nadir BOUHAMOU CEA/DEN, Paul RASCLE, EDF
// Module : SMESH
// $Header$
#ifndef _SMESH_LENGTHFROMEDGES_I_HXX_
#define _SMESH_LENGTHFROMEDGES_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_LengthFromEdges.hxx"
class SMESH_LengthFromEdges_i:
public POA_SMESH::SMESH_LengthFromEdges,
public SMESH_Hypothesis_i
{
public:
SMESH_LengthFromEdges_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_LengthFromEdges_i();
void SetMode(CORBA::Long mode)
throw (SALOME::SALOME_Exception);
CORBA::Long GetMode();
protected:
::SMESH_LengthFromEdges* _impl;
};
#endif

View File

@ -87,12 +87,16 @@ SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
//=============================================================================
SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
_compte(false),
_creeFamily(false), _famIdent(0), _indexElts(0), _indexEnts(0)
_creeFamily(false),
_famIdent(0),
_indexElts(0),
_indexEnts(0)
{
BEGIN_OF("Constructor SMESH_MEDMesh_i");
_mesh_i = m_i;
_meshDS = _mesh_i->GetImpl().GetMeshDS();
BEGIN_OF("Constructor SMESH_MEDMesh_i");
END_OF("Constructor SMESH_MEDMesh_i");
}
@ -478,13 +482,14 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end())
{
int index = _mapIndToSeqElts[geomElement];
retour = _seq_elemId[index]->length();
}
return retour;
}
catch(...)
{
MESSAGE("Exception en accedant au nombre d élements");
MESSAGE("Exception en accedant au nombre d élements");
THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
SALOME::INTERNAL_ERROR);
}
@ -518,6 +523,7 @@ SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
SALOME::BAD_PARAM);
int index = _mapIndToSeqElts[geomElement];
return _seq_elemId[index]._retn();
}
@ -977,6 +983,7 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
int index = _mapIndToSeqElts[medElement];
SCRUTE(index);
// Traitement de l arete
int longueur = _seq_elemId[index]->length();
_seq_elemId[index]->length(longueur + nb_of_nodes);
@ -1047,7 +1054,7 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
SCRUTE(index);
// Traitement de la face
// Attention La numérotation des noeuds Med commence a 1
// Attention La numérotation des noeuds Med commence a 1
int longueur = _seq_elemId[index]->length();
_seq_elemId[index]->length(longueur + nb_of_nodes);
@ -1198,5 +1205,5 @@ SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
return 0;
return (SALOME_MED::medGeometryElement) 0;
}

View File

@ -337,7 +337,6 @@ SALOME_MED::long_array *
THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
return NULL;
}
//=============================================================================
/*!
* CORBA: Array containing indexes for elements included in the support

View File

@ -27,3 +27,73 @@
// $Header$
using namespace std;
#include "SMESH_MaxElementVolume_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
* Constructor:
* _name is related to the class name: prefix = SMESH_ ; suffix = _i .
*/
//=============================================================================
SMESH_MaxElementVolume_i::SMESH_MaxElementVolume_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_MaxElementVolume_i::SMESH_MaxElementVolume_i");
_impl = new ::SMESH_MaxElementVolume(genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_MaxElementVolume_i::~SMESH_MaxElementVolume_i()
{
MESSAGE("SMESH_MaxElementVolume_i::~SMESH_MaxElementVolume_i()");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_MaxElementVolume_i::SetMaxElementVolume(CORBA::Double volume)
throw (SALOME::SALOME_Exception)
{
ASSERT(_impl);
try
{
_impl->SetMaxVolume(volume);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Double SMESH_MaxElementVolume_i::GetMaxElementVolume()
{
ASSERT(_impl);
return _impl->GetMaxVolume();
}

View File

@ -26,3 +26,33 @@
// Module : SMESH
// $Header$
#ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_
#define _SMESH_MAXELEMENTVOLUME_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_MaxElementVolume.hxx"
class SMESH_MaxElementVolume_i:
public POA_SMESH::SMESH_MaxElementVolume,
public SMESH_Hypothesis_i
{
public:
SMESH_MaxElementVolume_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_MaxElementVolume_i();
void SetMaxElementVolume(CORBA::Double volume)
throw (SALOME::SALOME_Exception);
CORBA::Double GetMaxElementVolume();
protected:
::SMESH_MaxElementVolume* _impl;
};
#endif

View File

@ -0,0 +1,60 @@
//=============================================================================
// File : SMESH_NETGEN_3D_i.cxx
// Created : Jeudi 31 Janvier 2003
// Author : Nadir Bouhamou CEA
// Project : SALOME
// Copyright : CEA 2003
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_NETGEN_3D_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_NETGEN_3D_i::SMESH_NETGEN_3D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_NETGEN_3D_i::SMESH_NETGEN_3D_i");
_genImpl = genImpl;
::SMESH_NETGEN_3D* impl
= new ::SMESH_NETGEN_3D(_genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
SetImpl(impl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_NETGEN_3D_i::~SMESH_NETGEN_3D_i()
{
MESSAGE("SMESH_NETGEN_3D_i::~SMESH_NETGEN_3D_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_NETGEN_3D_i::SetImpl(::SMESH_NETGEN_3D* impl)
{
MESSAGE("SMESH_NETGEN_3D_i::SetImpl");
SMESH_3D_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,36 @@
//=============================================================================
// File : SMESH_NETGEN_3D_i.hxx
// Created : Jeudi 31 Janvier 2003
// Author : Nadir Bouhamou CEA
// Project : SALOME
// Copyright : CEA 2003
// $Header$
//=============================================================================
#ifndef _SMESH_NETGEN_3D_I_HXX_
#define _SMESH_NETGEN_3D_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_3D_Algo_i.hxx"
#include "SMESH_NETGEN_3D.hxx"
class SMESH_NETGEN_3D_i:
public POA_SMESH::SMESH_NETGEN_3D,
public SMESH_3D_Algo_i
{
public:
SMESH_NETGEN_3D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_NETGEN_3D_i();
protected:
virtual void SetImpl(::SMESH_NETGEN_3D* impl);
::SMESH_NETGEN_3D* _impl;
};
#endif

View File

@ -39,7 +39,21 @@ LIB_SRC =
SWIG_DEF = libSMESH_Swig.i
EXPORT_PYSCRIPTS = libSMESH_Swig.py \
SMESH_test0.py SMESH_test1.py SMESH_test2.py SMESH_test3.py SMESH_mechanic.py SMESH_fixation.py batchmode_smesh.py
SMESH_test0.py\
SMESH_test1.py \
SMESH_test2.py \
SMESH_test3.py \
SMESH_mechanic.py \
SMESH_mechanic_tetra.py \
SMESH_fixation.py \
SMESH_fixation_hexa.py \
SMESH_fixation_tetra.py \
batchmode_smesh.py \
SMESH_box_tetra.py \
SMESH_box2_tetra.py \
SMESH_box3_tetra.py \
SMESH_flight_skin.py \
SMESH_Partition1_tetra.py
LIB_CLIENT_IDL = SALOMEDS.idl \
SALOME_Exception.idl \

View File

@ -0,0 +1,245 @@
#
# Tetrahedrization of the geometry generated by the Python script GEOM_Partition1.py
# Hypothesis and algorithms for the mesh generation are global
#
#%Make geometry (like CEA script (A1)) using Partition algorithm% from OCC
# -- Rayon de la bariere
barier_height = 7.0
barier_radius = 5.6 / 2 # Rayon de la bariere
colis_radius = 1.0 / 2 # Rayon du colis
colis_step = 2.0 # Distance s‰parant deux colis
cc_width = 0.11 # Epaisseur du complement de colisage
# --
cc_radius = colis_radius + cc_width
from math import sqrt
colis_center = sqrt(2.0)*colis_step/2
# --
import geompy
geom = geompy.geom
boolean_common = 1
boolean_cut = 2
boolean_fuse = 3
boolean_section = 4
# --
barier = geompy.MakeCylinder(
geom.MakePointStruct(0.,0.,0.),
geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
barier_radius,
barier_height)
# --
colis = geompy.MakeCylinder(
geom.MakePointStruct(0.,0.,0.),
geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
colis_radius,
barier_height)
cc = geompy.MakeCylinder(
geom.MakePointStruct(0.,0.,0.),
geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
cc_radius,
barier_height)
colis_cc = geompy.MakeCompound(
[colis._get_Name(), cc._get_Name()])
colis_cc = geompy.MakeTranslation(
colis_cc, colis_center, 0.0, 0.0)
colis_cc_multi = geompy.MakeMultiRotation1D(
colis_cc,
geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
geom.MakePointStruct(0.,0.,0.),
4)
# --
alveole = geompy.Partition(
[colis_cc_multi._get_Name(), barier._get_Name()])
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
print "Analysis of the geometry to mesh (right after the Partition) :"
subShellList=geompy.SubShapeAll(alveole,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(alveole,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(alveole,ShapeTypeEdge)
print "number of Shells in alveole : ",len(subShellList)
print "number of Faces in alveole : ",len(subFaceList)
print "number of Edges in alveole : ",len(subEdgeList)
subshapes = geompy.SubShapeAll( alveole, geompy.ShapeType["SHAPE"] )
## there are 9 subshapes
comp1 = geompy.MakeCompound( [ subshapes[0]._get_Name(), subshapes[1]._get_Name() ] );
comp2 = geompy.MakeCompound( [ subshapes[2]._get_Name(), subshapes[3]._get_Name() ] );
comp3 = geompy.MakeCompound( [ subshapes[4]._get_Name(), subshapes[5]._get_Name() ] );
comp4 = geompy.MakeCompound( [ subshapes[6]._get_Name(), subshapes[7]._get_Name() ] );
compIORs = []
compIORs.append( comp1._get_Name() );
compIORs.append( comp2._get_Name() );
compIORs.append( comp3._get_Name() );
compIORs.append( comp4._get_Name() );
comp = geompy.MakeCompound( compIORs );
alveole = geompy.MakeCompound( [ comp._get_Name(), subshapes[8]._get_Name() ]);
idalveole= geompy.addToStudy(alveole, "alveole")
print "Analysis of the geometry to mesh (right after the MakeCompound) :"
subShellList=geompy.SubShapeAll(alveole,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(alveole,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(alveole,ShapeTypeEdge)
print "number of Shells in alveole : ",len(subShellList)
print "number of Faces in alveole : ",len(subFaceList)
print "number of Edges in alveole : ",len(subEdgeList)
status=geompy.CheckShape(alveole)
print " check status ", status
# ---- launch SMESH
import salome
from salome import sg
import SMESH
import smeshpy
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis (In this case global hypothesis are used)"
print "-------------------------- NumberOfSegments"
numberOfSegments = 10
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
print "-------------------------- MaxElementArea"
maxElementArea = 0.1
hyp2=gen.CreateHypothesis("MaxElementArea")
hypArea=hyp2._narrow(SMESH.SMESH_MaxElementArea)
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
print hypArea.GetMaxElementArea()
idarea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )
smeshgui.SetName(idarea, "MaxElementArea")
print "-------------------------- MaxElementVolume"
maxElementVolume = 0.5
hyp3=gen.CreateHypothesis("MaxElementVolume")
hypVolume=hyp3._narrow(SMESH.SMESH_MaxElementVolume)
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idvolume, "MaxElementVolume")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the alveole
mesh=gen.Init(idalveole)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshAlveole")
smeshgui.SetShape(idalveole, idmesh)
# ---- add hypothesis to alveole
print "-------------------------- add hypothesis to alveole"
ret=mesh.AddHypothesis(alveole,regular1D)
print ret
ret=mesh.AddHypothesis(alveole,hypNbSeg)
print ret
ret=mesh.AddHypothesis(alveole,mefisto2D)
print ret
ret=mesh.AddHypothesis(alveole,hypArea)
print ret
ret=mesh.AddHypothesis(alveole,netgen3D)
print ret
ret=mesh.AddHypothesis(alveole,hypVolume)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idarea )
smeshgui.SetAlgorithms( idmesh, netgenID )
smeshgui.SetHypothesis( idmesh, idvolume )
sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of alveole "
ret=gen.Compute(mesh,idalveole)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "problem when computing the mesh"
sg.updateObjBrowser(1)

View File

@ -0,0 +1,189 @@
#
# Tetrahedrization of the geometry union of 2 boxes having a face in common
# Hypothesis and algorithms for the mesh generation are global
#
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
# ---- define 2 boxes box1 and box2
box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
idbox1 = geompy.addToStudy(box1,"box1")
print "Analysis of the geometry box1 :"
subShellList=geompy.SubShapeAll(box1,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(box1,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(box1,ShapeTypeEdge)
print "number of Shells in box1 : ",len(subShellList)
print "number of Faces in box1 : ",len(subFaceList)
print "number of Edges in box1 : ",len(subEdgeList)
box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
idbox2 = geompy.addToStudy(box2,"box2")
print "Analysis of the geometry box2 :"
subShellList=geompy.SubShapeAll(box2,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(box2,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(box2,ShapeTypeEdge)
print "number of Shells in box2 : ",len(subShellList)
print "number of Faces in box2 : ",len(subFaceList)
print "number of Edges in box2 : ",len(subEdgeList)
blocs = []
blocs.append(box1._get_Name())
blocs.append(box2._get_Name())
# append the tow boxes to make ine shel, referrencing only once
# the internal interface
shell = geompy.Partition(blocs)
idshell = geompy.addToStudy(shell,"shell")
print "Analysis of the geometry shell (union of box1 and box2) :"
subShellList=geompy.SubShapeAll(shell,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(shell,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(shell,ShapeTypeEdge)
print "number of Shells in shell : ",len(subShellList)
print "number of Faces in shell : ",len(subFaceList)
print "number of Edges in shell : ",len(subEdgeList)
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 10
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
print "-------------------------- MaxElementArea"
maxElementArea = 500
hyp2=gen.CreateHypothesis("MaxElementArea")
hypArea=hyp2._narrow(SMESH.SMESH_MaxElementArea)
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
print hypArea.GetMaxElementArea()
idarea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )
smeshgui.SetName(idarea, "MaxElementArea")
print "-------------------------- MaxElementVolume"
maxElementVolume = 500
hyp3=gen.CreateHypothesis("MaxElementVolume")
hypVolume=hyp3._narrow(SMESH.SMESH_MaxElementVolume)
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idvolume, "MaxElementVolume")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the shell
mesh=gen.Init(idshell)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshBox2")
smeshgui.SetShape(idshell, idmesh)
# ---- add hypothesis to shell
print "-------------------------- add hypothesis to shell"
ret=mesh.AddHypothesis(shell,regular1D)
print ret
ret=mesh.AddHypothesis(shell,hypNbSeg)
print ret
ret=mesh.AddHypothesis(shell,mefisto2D)
print ret
ret=mesh.AddHypothesis(shell,hypArea)
print ret
ret=mesh.AddHypothesis(shell,netgen3D)
print ret
ret=mesh.AddHypothesis(shell,hypVolume)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idarea )
smeshgui.SetAlgorithms( idmesh, netgenID )
smeshgui.SetHypothesis( idmesh, idvolume )
sg.updateObjBrowser(1)
print "-------------------------- compute shell"
ret=gen.Compute(mesh,idshell)
print ret
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
sg.updateObjBrowser(1)

View File

@ -0,0 +1,201 @@
#
# Tetrahedrization of the geometry union of 3 boxes aligned where the middle
# one has a race in common with the two others.
# Hypothesis and algorithms for the mesh generation are global
#
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
# ---- define 3 boxes box1, box2 and box3
box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
idbox1 = geompy.addToStudy(box1,"box1")
print "Analysis of the geometry box1 :"
subShellList=geompy.SubShapeAll(box1,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(box1,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(box1,ShapeTypeEdge)
print "number of Shells in box1 : ",len(subShellList)
print "number of Faces in box1 : ",len(subFaceList)
print "number of Edges in box1 : ",len(subEdgeList)
box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.)
idbox2 = geompy.addToStudy(box2,"box2")
print "Analysis of the geometry box2 :"
subShellList=geompy.SubShapeAll(box2,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(box2,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(box2,ShapeTypeEdge)
print "number of Shells in box2 : ",len(subShellList)
print "number of Faces in box2 : ",len(subFaceList)
print "number of Edges in box2 : ",len(subEdgeList)
box3 = geompy.MakeBox(0., 0., 300., 200., 200., 500.)
idbox3 = geompy.addToStudy(box3,"box3")
print "Analysis of the geometry box3 :"
subShellList=geompy.SubShapeAll(box3,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(box3,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(box3,ShapeTypeEdge)
print "number of Shells in box3 : ",len(subShellList)
print "number of Faces in box3 : ",len(subFaceList)
print "number of Edges in box3 : ",len(subEdgeList)
blocs = []
blocs.append(box1._get_Name())
blocs.append(box2._get_Name())
blocs.append(box3._get_Name())
shell = geompy.Partition(blocs)
idshell = geompy.addToStudy(shell,"shell")
print "Analysis of the geometry shell (union of box1, box2 and box3) :"
subShellList=geompy.SubShapeAll(shell,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(shell,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(shell,ShapeTypeEdge)
print "number of Shells in shell : ",len(subShellList)
print "number of Faces in shell : ",len(subFaceList)
print "number of Edges in shell : ",len(subEdgeList)
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 10
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
print "-------------------------- MaxElementArea"
maxElementArea = 500
hyp2=gen.CreateHypothesis("MaxElementArea")
hypArea=hyp2._narrow(SMESH.SMESH_MaxElementArea)
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
print hypArea.GetMaxElementArea()
idarea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )
smeshgui.SetName(idarea, "MaxElementArea")
print "-------------------------- MaxElementVolume"
maxElementVolume = 500
hyp3=gen.CreateHypothesis("MaxElementVolume")
hypVolume=hyp3._narrow(SMESH.SMESH_MaxElementVolume)
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idvolume, "MaxElementVolume")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the shell
mesh=gen.Init(idshell)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshBox2")
smeshgui.SetShape(idshell, idmesh)
# ---- add hypothesis to shell
print "-------------------------- add hypothesis to shell"
ret=mesh.AddHypothesis(shell,regular1D)
print ret
ret=mesh.AddHypothesis(shell,hypNbSeg)
print ret
ret=mesh.AddHypothesis(shell,mefisto2D)
print ret
ret=mesh.AddHypothesis(shell,hypArea)
print ret
ret=mesh.AddHypothesis(shell,netgen3D)
print ret
ret=mesh.AddHypothesis(shell,hypVolume)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idarea )
smeshgui.SetAlgorithms( idmesh, netgenID )
smeshgui.SetHypothesis( idmesh, idvolume )
sg.updateObjBrowser(1)
print "-------------------------- compute shell"
ret=gen.Compute(mesh,idshell)
print ret
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
sg.updateObjBrowser(1)

View File

@ -0,0 +1,162 @@
#
# Tetrahedrization of a simple box. Hypothesis and algorithms for
# the mesh generation are global
#
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
# -----------------------------------------------------------------------------
##geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry")
##myBuilder = salome.myStudy.NewBuilder()
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
# ---- define a boxe
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
idbox = geompy.addToStudy(box,"box")
print "Analysis of the geometry box :"
subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(box,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(box,ShapeTypeEdge)
print "number of Shells in box : ",len(subShellList)
print "number of Faces in box : ",len(subFaceList)
print "number of Edges in box : ",len(subEdgeList)
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 10
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
print "-------------------------- MaxElementArea"
maxElementArea = 500
hyp2=gen.CreateHypothesis("MaxElementArea")
hypArea=hyp2._narrow(SMESH.SMESH_MaxElementArea)
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
print hypArea.GetMaxElementArea()
idarea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )
smeshgui.SetName(idarea, "MaxElementArea")
print "-------------------------- MaxElementVolume"
maxElementVolume = 500
hyp3=gen.CreateHypothesis("MaxElementVolume")
hypVolume=hyp3._narrow(SMESH.SMESH_MaxElementVolume)
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idvolume, "MaxElementVolume")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the boxe
mesh=gen.Init(idbox)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshBox")
smeshgui.SetShape(idbox, idmesh)
# ---- add hypothesis to the boxe
print "-------------------------- add hypothesis to the boxe"
ret=mesh.AddHypothesis(box,regular1D)
print ret
ret=mesh.AddHypothesis(box,hypNbSeg)
print ret
ret=mesh.AddHypothesis(box,mefisto2D)
print ret
ret=mesh.AddHypothesis(box,hypArea)
print ret
ret=mesh.AddHypothesis(box,netgen3D)
print ret
ret=mesh.AddHypothesis(box,hypVolume)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idarea )
smeshgui.SetAlgorithms( idmesh, netgenID )
smeshgui.SetHypothesis( idmesh, idvolume )
sg.updateObjBrowser(1)
print "-------------------------- compute the mesh of the boxe"
ret=gen.Compute(mesh,idbox)
print ret
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
sg.updateObjBrowser(1)

View File

@ -0,0 +1,122 @@
#
# Hexahedrization of the geometry generated by the Python script
# SMESH_fixation.py
# Hypothesis and algorithms for the mesh generation are global
#
import SMESH_fixation
import SMESH
import smeshpy
compshell = SMESH_fixation.compshell
idcomp = SMESH_fixation.idcomp
geompy = SMESH_fixation.geompy
salome = SMESH_fixation.salome
sg = SMESH_fixation.sg
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
print "Analysis of the geometry to be meshed :"
subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
print "number of Shells in compshell : ",len(subShellList)
print "number of Faces in compshell : ",len(subFaceList)
print "number of Edges in compshell : ",len(subEdgeList)
status=geompy.CheckShape(compshell)
print " check status ", status
### ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
### ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 5
hyp1=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- Quadrangle_2D"
hypothesis=gen.CreateHypothesis("Quadrangle_2D")
quad2D = hypothesis._narrow(SMESH.SMESH_Quadrangle_2D)
quadID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(quad2D) )
smeshgui.SetName(quadID, "Quadrangle_2D")
print "-------------------------- Hexa_3D"
hypothesis=gen.CreateHypothesis("Hexa_3D")
hexa3D = hypothesis._narrow(SMESH.SMESH_Hexa_3D)
hexaID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(hexa3D) )
smeshgui.SetName(hexaID, "Hexa_3D")
# ---- init a Mesh with the compshell
mesh=gen.Init(idcomp)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshcompShel")
smeshgui.SetShape(idcomp, idmesh)
# ---- add hypothesis to compshell
print "-------------------------- add hypothesis to compshell"
ret=mesh.AddHypothesis(compshell,regular1D)
print ret
ret=mesh.AddHypothesis(compshell,hypNbSeg)
print ret
ret=mesh.AddHypothesis(compshell,quad2D)
print ret
ret=mesh.AddHypothesis(compshell,hexa3D)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, quadID )
smeshgui.SetAlgorithms( idmesh, hexaID )
sg.updateObjBrowser(1)
print "-------------------------- compute compshell"
ret=gen.Compute(mesh,idcomp)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "problem when Computing the mesh"
sg.updateObjBrowser(1)

View File

@ -0,0 +1,155 @@
#
# Tetrahedrization of the geometry generated by the Python script
# SMESH_fixation.py
# Hypothesis and algorithms for the mesh generation are global
#
import SMESH_fixation
import SMESH
import smeshpy
compshell = SMESH_fixation.compshell
idcomp = SMESH_fixation.idcomp
geompy = SMESH_fixation.geompy
salome = SMESH_fixation.salome
sg = SMESH_fixation.sg
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
print "Analysis of the geometry to be meshed :"
subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
print "number of Shells in compshell : ",len(subShellList)
print "number of Faces in compshell : ",len(subFaceList)
print "number of Edges in compshell : ",len(subEdgeList)
status=geompy.CheckShape(compshell)
print " check status ", status
### ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
### ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- NumberOfSegments"
numberOfSegments = 5
hypothesis=gen.CreateHypothesis("NumberOfSegments")
hypNbSeg=hypothesis._narrow(SMESH.SMESH_NumberOfSegments)
hypNbSeg.SetNumberOfSegments(numberOfSegments)
hypNbSegID = hypNbSeg.GetId()
print hypNbSeg.GetName()
print hypNbSegID
print hypNbSeg.GetNumberOfSegments()
idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idseg, "NumberOfSegments")
print "-------------------------- MaxElementArea"
maxElementArea = 80
hypothesis=gen.CreateHypothesis("MaxElementArea")
hypArea=hypothesis._narrow(SMESH.SMESH_MaxElementArea)
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
print hypArea.GetMaxElementArea()
idarea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )
smeshgui.SetName(idarea, "MaxElementArea")
print "-------------------------- MaxElementVolume"
maxElementVolume = 150
hypothesis=gen.CreateHypothesis("MaxElementVolume")
hypVolume=hypothesis._narrow(SMESH.SMESH_MaxElementVolume)
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idvolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idvolume, "MaxElementVolume")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the compshell
mesh=gen.Init(idcomp)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshcompShell")
smeshgui.SetShape(idcomp, idmesh)
# ---- add hypothesis to compshell
print "-------------------------- add hypothesis to compshell"
ret=mesh.AddHypothesis(compshell,regular1D)
print ret
ret=mesh.AddHypothesis(compshell,hypNbSeg)
print ret
ret=mesh.AddHypothesis(compshell,mefisto2D)
print ret
ret=mesh.AddHypothesis(compshell,hypArea)
print ret
ret=mesh.AddHypothesis(compshell,netgen3D)
print ret
ret=mesh.AddHypothesis(compshell,hypVolume)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idseg )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idarea )
smeshgui.SetAlgorithms( idmesh, netgenID )
smeshgui.SetHypothesis( idmesh, idvolume )
sg.updateObjBrowser(1)
print "-------------------------- compute compshell"
ret=gen.Compute(mesh,idcomp)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "problem when computing the mesh"
sg.updateObjBrowser(1)

View File

@ -0,0 +1,146 @@
#
# Triangulation of the skin of the geometry from a Brep representing a plane
# This geometry is from EADS
# Hypothesis and algorithms for the mesh generation are global
#
import salome
from salome import sg
import geompy
import SMESH
import smeshpy
geom = geompy.geom
myBuilder = geompy.myBuilder
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeEdge = 6
import os
# import a BRep
#before running this script, please be sure about
#the path the file fileName
filePath=os.environ["SMESH_ROOT_DIR"]
filePath=filePath+"/share/salome/resources/"
filename = "flight_solid.brep"
filename = filePath + filename
shape = geompy.ImportBREP(filename)
idShape = geompy.addToStudy(shape,"flight")
print "Analysis of the geometry flight :"
subShellList=geompy.SubShapeAll(shape,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(shape,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(shape,ShapeTypeEdge)
print "number of Shells in flight : ",len(subShellList)
print "number of Faces in flight : ",len(subFaceList)
print "number of Edges in flight : ",len(subEdgeList)
# ---- launch SMESH
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
gen=smeshpy.smeshpy()
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- LocalLength"
lengthOfSegments = 0.3
hypothesis=gen.CreateHypothesis("LocalLength")
hypLength=hypothesis._narrow(SMESH.SMESH_LocalLength)
hypLength.SetLength(lengthOfSegments)
hypLengthID = hypLength.GetId()
print hypLength.GetName()
print hypLengthID
print hypLength.GetLength()
idlen = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLength) )
smeshgui.SetName(idlen, "LocalLength")
print "-------------------------- LengthFromEdges"
hypothesis=gen.CreateHypothesis("LengthFromEdges")
hypLengthFromEdge=hypothesis._narrow(SMESH.SMESH_LengthFromEdges)
hypLengthFromEdgeID = hypLengthFromEdge.GetId()
print hypLengthFromEdge.GetName()
print hypLengthFromEdgeID
idlenfromedge = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypLengthFromEdge) )
smeshgui.SetName(idlenfromedge, "LengthFromEdge")
# ---- create Algorithms
print "-------------------------- create Algorithms"
print "-------------------------- Regular_1D"
hypothesis=gen.CreateHypothesis("Regular_1D")
regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
smeshgui.SetName(regularID, "Wire Discretisation")
print "-------------------------- MEFISTO_2D"
hypothesis=gen.CreateHypothesis("MEFISTO_2D")
mefisto2D = hypothesis._narrow(SMESH.SMESH_MEFISTO_2D)
mefistoID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(mefisto2D) )
smeshgui.SetName(mefistoID, "MEFISTO_2D")
print "-------------------------- NETGEN_3D"
hypothesis=gen.CreateHypothesis("NETGEN_3D")
netgen3D = hypothesis._narrow(SMESH.SMESH_NETGEN_3D)
netgenID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(netgen3D) )
smeshgui.SetName(netgenID, "NETGEN_3D")
# ---- init a Mesh with the shell
mesh=gen.Init(idShape)
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName(idmesh, "MeshFlight")
smeshgui.SetShape(idShape, idmesh)
# ---- add hypothesis to flight
print "-------------------------- add hypothesis to flight"
ret=mesh.AddHypothesis(shape,regular1D)
print ret
ret=mesh.AddHypothesis(shape,hypLength)
print ret
ret=mesh.AddHypothesis(shape,mefisto2D)
print ret
ret=mesh.AddHypothesis(shape,hypLengthFromEdge)
print ret
smeshgui.SetAlgorithms( idmesh, regularID)
smeshgui.SetHypothesis( idmesh, idlen )
smeshgui.SetAlgorithms( idmesh, mefistoID )
smeshgui.SetHypothesis( idmesh, idlenfromedge)
sg.updateObjBrowser(1)
print "-------------------------- compute the skin flight"
ret=gen.Compute(mesh,idShape)
print ret
if ret != 0:
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
else:
print "probleme when computing the mesh"
sg.updateObjBrowser(1)

View File

@ -0,0 +1,254 @@
# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#
#
#
# File : SMESH_withHole.py
# Author : Lucien PIGNOLONI
# Module : SMESH
# $Header$
import SMESH
import smeshpy
import salome
from salome import sg
import math
import geompy
# ---------------------------- GEOM --------------------------------------
geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
myBuilder = salome.myStudy.NewBuilder()
#from geompy import gg
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
ShapeTypeCompSolid = 1
ShapeTypeSolid = 2
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeWire = 5
ShapeTypeEdge = 6
ShapeTypeVertex = 7
# ---- define contigous arcs and segment to define a closed wire
p1 = geom.MakePointStruct( 100.0, 0.0, 0.0 )
p2 = geom.MakePointStruct( 50.0, 50.0, 0.0 )
p3 = geom.MakePointStruct( 100.0, 100.0, 0.0 )
arc1 = geom.MakeArc( p1, p2, p3 )
p4 = geom.MakePointStruct( 170.0, 100.0, 0.0 )
seg1 = geom.MakeVector( p3, p4 )
p5 = geom.MakePointStruct( 200.0, 70.0, 0.0 )
p6 = geom.MakePointStruct( 170.0, 40.0, 0.0 )
arc2 = geom.MakeArc( p4, p5, p6 )
p7 = geom.MakePointStruct( 120.0, 30.0, 0.0 )
arc3 = geom.MakeArc( p6, p7, p1 )
# ---- define a closed wire with arcs and segment
List1 = []
List1.append( arc1 )
List1.append( seg1 )
List1.append( arc2 )
List1.append( arc3 )
ListIOR1 = []
for S in List1 :
ListIOR1.append( S._get_Name() )
wire1 = geom.MakeWire( ListIOR1 )
# ---- define a planar face with wire
WantPlanarFace = 1 #True
face1 = geom.MakeFace( wire1, WantPlanarFace )
# ---- create a shape by extrusion
pO = geom.MakePointStruct( 0.0, 0.0, 0.0 )
pz = geom.MakePointStruct( 0.0, 0.0, 100.0 )
prism1 = geom.MakePrism( face1, pO, pz )
# ---- create two cylinders
pc1 = geom.MakePointStruct( 90.0, 50.0, -40.0 )
pc2 = geom.MakePointStruct( 170.0, 70.0, -40.0 )
vz = geom.MakeDirection( pz )
radius = 20.0
height = 180.0
cyl1 = geom.MakeCylinder( pc1, vz, radius, height )
cyl2 = geom.MakeCylinder( pc2, vz, radius, height )
# ---- cut with cyl1
shape = geom.MakeBoolean( prism1, cyl1, 2 )
# ---- fuse with cyl2 to obtain the final mechanic piece :)
mechanic = geom.MakeBoolean( shape, cyl2, 3 )
idMechanic = geompy.addToStudy( mechanic, "mechanic")
# ---- Analysis of the geometry
print "Analysis of the geometry mechanic :"
subShellList=geompy.SubShapeAll(mechanic,ShapeTypeShell)
subFaceList=geompy.SubShapeAll(mechanic,ShapeTypeFace)
subEdgeList=geompy.SubShapeAll(mechanic,ShapeTypeEdge)
print "number of Shells in mechanic : ",len(subShellList)
print "number of Faces in mechanic : ",len(subFaceList)
print "number of Edges in mechanic : ",len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
# ---- launch SMESH, init a Mesh with shape 'mechanic'
gen = smeshpy.smeshpy()
mesh = gen.Init( idMechanic )
idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
smeshgui.SetName( idmesh, "Mesh_mechanic" )
smeshgui.SetShape( idMechanic, idmesh )
print "-------------------------- NumberOfSegments"
numberOfSegment = 10
hypNumberOfSegment = gen.CreateHypothesis( "NumberOfSegments" )
hypNbSeg = hypNumberOfSegment._narrow( SMESH.SMESH_NumberOfSegments )
hypNbSeg.SetNumberOfSegments(numberOfSegment)
print hypNbSeg.GetName()
print hypNbSeg.GetId()
print hypNbSeg.GetNumberOfSegments()
idSeg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
smeshgui.SetName(idSeg, "NumberOfSegments")
print "-------------------------- MaxElementArea"
maxElementArea = 20
hypMaxElementArea = gen.CreateHypothesis( "MaxElementArea" )
hypArea = hypMaxElementArea._narrow( SMESH.SMESH_MaxElementArea )
hypArea.SetMaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
print hypArea.GetMaxElementArea()
idArea = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypArea) )
smeshgui.SetName(idArea, "MaxElementArea")
print "-------------------------- MaxElementVolume"
maxElementVolume = 20
hypMaxElementVolume = gen.CreateHypothesis( "MaxElementVolume" )
hypVolume = hypMaxElementVolume._narrow( SMESH.SMESH_MaxElementVolume )
hypVolume.SetMaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
print hypVolume.GetMaxElementVolume()
idVolume = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypVolume) )
smeshgui.SetName(idVolume, "MaxElementArea")
print "-------------------------- Regular_1D"
alg1D = gen.CreateHypothesis( "Regular_1D" )
algo1D = alg1D._narrow( SMESH.SMESH_Algo )
listHyp =algo1D.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
algoReg1D = alg1D._narrow( SMESH.SMESH_Regular_1D )
print algoReg1D.GetName()
print algoReg1D.GetId()
idReg1D = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoReg1D) )
smeshgui.SetName( idReg1D, "Regular_1D" )
print "-------------------------- MEFISTO_2D"
alg2D = gen.CreateHypothesis( "MEFISTO_2D" )
algo2D = alg2D._narrow( SMESH.SMESH_Algo )
listHyp = algo2D.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
algoMef = alg2D._narrow( SMESH.SMESH_MEFISTO_2D )
print algoMef.GetName()
print algoMef.GetId()
idMef = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoMef) )
smeshgui.SetName( idMef, "MEFISTO_2D" )
print "-------------------------- NETGEN_3D"
alg3D = gen.CreateHypothesis( "NETGEN_3D" )
algo3D = alg3D._narrow( SMESH.SMESH_Algo )
listHyp = algo3D.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
algoNg = alg3D._narrow( SMESH.SMESH_NETGEN_3D )
print algoNg.GetName()
print algoNg.GetId()
idNg = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(algoNg) )
smeshgui.SetName( idNg, "NETGEN_2D" )
print "-------------------------- add hypothesis to main mechanic"
shape_mesh = salome.IDToObject( idMechanic )
submesh = mesh.GetElementsOnShape( shape_mesh )
ret = mesh.AddHypothesis( shape_mesh, algoReg1D ) # Regular 1D/wire discretisation
print ret
ret = mesh.AddHypothesis( shape_mesh, algoMef ) # MEFISTO 2D
print ret
ret = mesh.AddHypothesis( shape_mesh, algoNg ) # NETGEN 3D
print ret
ret = mesh.AddHypothesis( shape_mesh, hypNbSeg ) # nb segments
print ret
ret = mesh.AddHypothesis( shape_mesh, hypArea ) # max area
print ret
ret = mesh.AddHypothesis( shape_mesh, hypVolume ) # max volume
print ret
smeshgui.SetAlgorithms( idmesh, idReg1D ); # Regular 1D/wire discretisation
smeshgui.SetAlgorithms( idmesh, idMef ); # MEFISTO 2D
smeshgui.SetAlgorithms( idmesh, idNg ); # NETGEN 3D
smeshgui.SetHypothesis( idmesh, idSeg ); # nb segments
smeshgui.SetHypothesis( idmesh, idArea ); # max area
smeshgui.SetHypothesis( idmesh, idVolume ); # max volume
sg.updateObjBrowser(1);
print "-------------------------- compute the mesh of the mechanic piece"
ret=gen.Compute(mesh,idMechanic)
print ret
log=mesh.GetLog(0) # no erase trace
for linelog in log:
print linelog
sg.updateObjBrowser(1)