From 0e1b795e2c9f927bddb2639812bc3de7675875c2 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 4 Apr 2013 07:10:56 +0000 Subject: [PATCH] Merge from BR_plugins_pbyacs 03/04/2013 --- configure.ac | 1 + doc/salome/Makefile.am | 2 +- doc/salome/examples/Makefile.am | 35 ++++ doc/salome/examples/hexoticdemo.py | 33 ++++ doc/salome/examples/hexoticsubdom1.py | 59 +++++++ doc/salome/examples/hexoticsubdom2.py | 59 +++++++ doc/salome/examples/hexoticsubdom3.py | 59 +++++++ doc/salome/examples/hexoticsubdom4.py | 28 +++ doc/salome/gui/HexoticPLUGIN/Makefile.am | 5 +- doc/salome/gui/HexoticPLUGIN/doxyfile.in | 9 +- doc/salome/gui/HexoticPLUGIN/doxyfile_py.in | 6 +- .../input/hexoticplugin_python_interface.doc | 167 ++---------------- resources/HexoticPLUGIN.xml | 2 +- ...ticPLUGINDC.py => HexoticPLUGINBuilder.py} | 6 +- src/HexoticPlugin/Makefile.am | 7 +- src/HexoticPlugin/__init__.py | 22 +++ 16 files changed, 328 insertions(+), 172 deletions(-) create mode 100644 doc/salome/examples/Makefile.am create mode 100644 doc/salome/examples/hexoticdemo.py create mode 100644 doc/salome/examples/hexoticsubdom1.py create mode 100644 doc/salome/examples/hexoticsubdom2.py create mode 100644 doc/salome/examples/hexoticsubdom3.py create mode 100644 doc/salome/examples/hexoticsubdom4.py rename src/HexoticPlugin/{HexoticPLUGINDC.py => HexoticPLUGINBuilder.py} (96%) create mode 100644 src/HexoticPlugin/__init__.py diff --git a/configure.ac b/configure.ac index d65f17f..b68531f 100644 --- a/configure.ac +++ b/configure.ac @@ -468,6 +468,7 @@ AC_OUTPUT([ \ HexoticPLUGIN_version.h \ doc/Makefile \ doc/salome/Makefile \ + doc/salome/examples/Makefile \ doc/salome/gui/Makefile \ doc/salome/gui/HexoticPLUGIN/Makefile \ doc/salome/gui/HexoticPLUGIN/doxyfile \ diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index dc7adde..ebdaae8 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -23,7 +23,7 @@ # Modified by : Alexander BORODIN (OCN) - autotools usage # $Header: # -SUBDIRS = gui +SUBDIRS = examples gui SUBDIRSGUI = gui usr_docs: diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am new file mode 100644 index 0000000..3c58122 --- /dev/null +++ b/doc/salome/examples/Makefile.am @@ -0,0 +1,35 @@ +# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# File : Makefile +# Author : Alexander KOVALEV (Open Cascade NN) +# Modified by : +# Module : doc +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +pyexamplesdir = $(docdir)/examples/HexoticPLUGIN + +pyexamples_SCRIPTS = hexoticdemo.py \ + hexoticsubdom1.py \ + hexoticsubdom2.py \ + hexoticsubdom3.py \ + hexoticsubdom4.py + +EXTRA_DIST += $(pyexamples_SCRIPTS) diff --git a/doc/salome/examples/hexoticdemo.py b/doc/salome/examples/hexoticdemo.py new file mode 100644 index 0000000..188663b --- /dev/null +++ b/doc/salome/examples/hexoticdemo.py @@ -0,0 +1,33 @@ + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + + +# create a sphere +sphere = geompy.MakeSphereR(100.) +geompy.addToStudy(sphere, "sphere") + +# create a mesh on the sphere +hexoticMesh = smesh.Mesh(sphere,"sphere: BLSurf and Hexotic mesh") + +# create a BLSurf algorithm for faces +BLSURF = hexoticMesh.Triangle(algo=smeshBuilder.BLSURF) +BLSURF.SetGeometricMesh( 1 ) + +# create a Hexotic algorithm for volumes +HEXOTIC = hexoticMesh.Hexahedron(algo=smeshBuilder.Hexotic) + +# compute the mesh +hexoticMesh.Compute() + +# Change the level of subdivision +HEXOTIC.SetMinMaxHexes(4, 8) + +# End of script diff --git a/doc/salome/examples/hexoticsubdom1.py b/doc/salome/examples/hexoticsubdom1.py new file mode 100644 index 0000000..6a1c343 --- /dev/null +++ b/doc/salome/examples/hexoticsubdom1.py @@ -0,0 +1,59 @@ + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + + +# Create geometry: a box cut by a holed sphere +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Sphere_1 = geompy.MakeSphereR(75) +Sphere_2 = geompy.MakeSphereR(25) +geompy.TranslateDXDYDZ(Box_1, -100, -100, -100) +Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2) +Cut_2 = geompy.MakeCut(Box_1, Cut_1) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Sphere_1, 'Sphere_1' ) +geompy.addToStudy( Sphere_2, 'Sphere_2' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudy( Cut_2, 'Cut_2' ) + +# Create filters +# aFilter1: elements inside small sphere +aFilter1 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_2)]) +# aFilter2: elements inside big sphere and not inside small sphere +aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_1, SMESH.FT_LogicalAND), + smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_2, SMESH.FT_LogicalNOT)]) +# aFilter3: elements not inside big sphere +aFilter3 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_1, SMESH.FT_LogicalNOT)]) + +# Create mesh of Cut_2 with sd mode 1 +print "Create mesh of Cut_2 with sd mode 1" +Mesh_hexotic_sd1 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd1") + +# Create the 2D algo: BlSurf with geometrical mesh +Mesh_hexotic_sd1.Triangle(algo=smeshBuilder.BLSURF).Parameters().SetGeometricMesh( 1 ) + +# Create the 3D algo: Hexotic with: +# - minl = 4 +# - maxl = 8 +# - sd = 1 +Mesh_hexotic_sd1.Hexahedron(algo=smeshBuilder.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 1 ) + +# Create the groups on filters +g1 = Mesh_hexotic_sd1.GroupOnFilter(SMESH.VOLUME, 'small sphere', aFilter1 ) +g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) +g2 = Mesh_hexotic_sd1.GroupOnFilter(SMESH.VOLUME, 'big sphere - small sphere', aFilter2 ) +g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) +g3 = Mesh_hexotic_sd1.GroupOnFilter(SMESH.VOLUME, 'box - big sphere', aFilter3 ) +g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) + +# Compute +Mesh_hexotic_sd1.Compute() + +# End of script diff --git a/doc/salome/examples/hexoticsubdom2.py b/doc/salome/examples/hexoticsubdom2.py new file mode 100644 index 0000000..58c22b4 --- /dev/null +++ b/doc/salome/examples/hexoticsubdom2.py @@ -0,0 +1,59 @@ + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +# Create geometry: a box cut by a holed sphere +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Sphere_1 = geompy.MakeSphereR(75) +Sphere_2 = geompy.MakeSphereR(25) +geompy.TranslateDXDYDZ(Box_1, -100, -100, -100) +Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2) +Cut_2 = geompy.MakeCut(Box_1, Cut_1) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Sphere_1, 'Sphere_1' ) +geompy.addToStudy( Sphere_2, 'Sphere_2' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudy( Cut_2, 'Cut_2' ) + +# Create filters +# aFilter1: elements inside small sphere +aFilter1 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_2)]) +# aFilter2: elements inside big sphere and not inside small sphere +aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_1, SMESH.FT_LogicalAND), + smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_2, SMESH.FT_LogicalNOT)]) +# aFilter3: elements not inside big sphere +aFilter3 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_1, SMESH.FT_LogicalNOT)]) + +# Create mesh of Cut_2 with sd mode 2 +print "Create mesh of Cut_2 with sd mode 2" +Mesh_hexotic_sd2 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd2") + +# Create the 2D algo: BlSurf with geometrical mesh +Mesh_hexotic_sd2.Triangle(algo=smeshBuilder.BLSURF).Parameters().SetGeometricMesh( 1 ) + +# Create the 3D algo: Hexotic with: +# - minl = 4 +# - maxl = 8 +# - sd = 2 +Mesh_hexotic_sd2.Hexahedron(algo=smeshBuilder.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 2 ) + +# Create the groups on filters +g1 = Mesh_hexotic_sd2.GroupOnFilter(SMESH.VOLUME, 'small sphere', aFilter1 ) +g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) +g2 = Mesh_hexotic_sd2.GroupOnFilter(SMESH.VOLUME, 'big sphere - small sphere', aFilter2 ) +g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) +g3 = Mesh_hexotic_sd2.GroupOnFilter(SMESH.VOLUME, 'box - big sphere', aFilter3 ) +g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) + +# Compute +Mesh_hexotic_sd2.Compute() + +# End of script + diff --git a/doc/salome/examples/hexoticsubdom3.py b/doc/salome/examples/hexoticsubdom3.py new file mode 100644 index 0000000..f5bbcd8 --- /dev/null +++ b/doc/salome/examples/hexoticsubdom3.py @@ -0,0 +1,59 @@ + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +# Create geometry: a box cut by a holed sphere +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Sphere_1 = geompy.MakeSphereR(75) +Sphere_2 = geompy.MakeSphereR(25) +geompy.TranslateDXDYDZ(Box_1, -100, -100, -100) +Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2) +Cut_2 = geompy.MakeCut(Box_1, Cut_1) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Sphere_1, 'Sphere_1' ) +geompy.addToStudy( Sphere_2, 'Sphere_2' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudy( Cut_2, 'Cut_2' ) + +# Create filters +# aFilter1: elements inside small sphere +aFilter1 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_2)]) +# aFilter2: elements inside big sphere and not inside small sphere +aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_1, SMESH.FT_LogicalAND), + smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_2, SMESH.FT_LogicalNOT)]) +# aFilter3: elements not inside big sphere +aFilter3 = smesh.GetFilterFromCriteria([smesh.GetCriterion(SMESH.VOLUME,SMESH.FT_BelongToGeom,SMESH.FT_Undefined,Sphere_1, SMESH.FT_LogicalNOT)]) + +# Create mesh of Cut_2 with sd mode 3 +print "Create mesh of Cut_2 with sd mode 3" +Mesh_hexotic_sd3 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd3") + +# Create the 2D algo: BlSurf with geometrical mesh +Mesh_hexotic_sd3.Triangle(algo=smeshBuilder.BLSURF).Parameters().SetGeometricMesh( 1 ) + +# Create the 3D algo: Hexotic with: +# - minl = 4 +# - maxl = 8 +# - sd = 3 +Mesh_hexotic_sd3.Hexahedron(algo=smeshBuilder.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 3 ) + +# Create the groups on filters +g1 = Mesh_hexotic_sd3.GroupOnFilter(SMESH.VOLUME, 'small sphere', aFilter1 ) +g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) +g2 = Mesh_hexotic_sd3.GroupOnFilter(SMESH.VOLUME, 'big sphere - small sphere', aFilter2 ) +g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) +g3 = Mesh_hexotic_sd3.GroupOnFilter(SMESH.VOLUME, 'box - big sphere', aFilter3 ) +g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) + +# Compute +Mesh_hexotic_sd3.Compute() + +# End of script + diff --git a/doc/salome/examples/hexoticsubdom4.py b/doc/salome/examples/hexoticsubdom4.py new file mode 100644 index 0000000..c238bc2 --- /dev/null +++ b/doc/salome/examples/hexoticsubdom4.py @@ -0,0 +1,28 @@ + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) + +# Create geometry: a box cut by a plane +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Translation_1 = geompy.MakeTranslation(Box_1, 0, 200, 0) +Partition_1 = geompy.MakePartition([Box_1, Translation_1], [], [], [], geompy.ShapeType["SOLID"], 0, [], 0) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Translation_1, 'Translation_1' ) +geompy.addToStudy( Partition_1, 'Partition_1' ) + +# Create mesh of Partition_1 with sd mode 4 (default sd mode in SALOME) +Mesh_hexotic_sd4 = smesh.Mesh(Partition_1, "Mesh_hexotic_sd4") +Mesh_hexotic_sd4.Triangle(algo=smeshBuilder.BLSURF) +Mesh_hexotic_sd4.Hexahedron(algo=smeshBuilder.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 4 ) + +# Compute +Mesh_hexotic_sd4.Compute() + +# End of script diff --git a/doc/salome/gui/HexoticPLUGIN/Makefile.am b/doc/salome/gui/HexoticPLUGIN/Makefile.am index 6b672f8..cbf3930 100755 --- a/doc/salome/gui/HexoticPLUGIN/Makefile.am +++ b/doc/salome/gui/HexoticPLUGIN/Makefile.am @@ -33,10 +33,7 @@ DOC_PYTHONPATH=$(prefix)/bin/salome:$(SMESH_ROOT_DIR)/bin/salome:$(SMESH_ROOT_DI DOC_LD_LIBRARY_PATH=$(prefix)/lib/salome:${SMESH_ROOT_DIR}/lib/salome:${MED_ROOT_DIR}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome DOC_SMESH_MeshersList=HexoticPLUGIN -smesh.py: $(top_srcdir)/src/HexoticPlugin/HexoticPLUGINDC.py - @PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} LD_LIBRARY_PATH=$(DOC_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py -d -o $@ HexoticPLUGIN - -usr_docs: doxyfile_py doxyfile smesh.py +usr_docs: doxyfile_py doxyfile @$(DOXYGEN) doxyfile_py ; \ $(DOXYGEN) doxyfile diff --git a/doc/salome/gui/HexoticPLUGIN/doxyfile.in b/doc/salome/gui/HexoticPLUGIN/doxyfile.in index 23a50cc..1402ce5 100755 --- a/doc/salome/gui/HexoticPLUGIN/doxyfile.in +++ b/doc/salome/gui/HexoticPLUGIN/doxyfile.in @@ -39,7 +39,7 @@ INPUT = @srcdir@/input FILE_PATTERNS = *.doc EXCLUDE = IMAGE_PATH = @srcdir@/images -EXAMPLE_PATH = +EXAMPLE_PATH = @top_srcdir@/doc/salome/examples #--------------------------------------------------------------------------- #HTML related options @@ -77,4 +77,9 @@ GENERATE_RTF = NO #rnv: 07.04.2011 Workaround for the doxygen 1.7.3: #because it wrongly defines location of the html files for search. TAGFILES = hexoticpluginpy_doc.tag=../HexoticPLUGIN/hexoticpluginpy_doc -SEARCHENGINE = YES \ No newline at end of file +SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in b/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in index 8983011..58d85f8 100755 --- a/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in +++ b/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in @@ -96,9 +96,9 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = @top_srcdir@/src/HexoticPlugin/HexoticPLUGINDC.py \ - smesh.py \ - @SMESH_ROOT_DIR@/bin/salome/smesh_algorithm.py +INPUT = @top_srcdir@/src/HexoticPlugin/HexoticPLUGINBuilder.py \ + @SMESH_ROOT_DIR@/lib/python@PYTHON_VERSION@/site-packages/salome/salome/smesh/smeshBuilder.py \ + @SMESH_ROOT_DIR@/lib/python@PYTHON_VERSION@/site-packages/salome/salome/smesh/smesh_algorithm.py FILE_PATTERNS = IMAGE_PATH = @srcdir@/images RECURSIVE = NO diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc b/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc index 709680e..6e1bc6d 100644 --- a/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc +++ b/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc @@ -2,7 +2,7 @@ \page hexoticplugin_python_interface_page Python Interface -Python package HexoticPLUGINDC defines several classes, destined for creation of the 3D meshes. +Python package HexoticPLUGIN defines several classes, destined for creation of the 3D meshes. Hexotic meshing plugin dynamically adds several methods to the smesh.Mesh class to create meshing algorithms. @@ -19,32 +19,8 @@ Below you can see an example of usage of the HexoticPlugin Python API for mesh g \section tui_hexotic_basic Construction of Mesh using Hexotic algorithm -\code -import geompy -import smesh - -# create a sphere -sphere = geompy.MakeSphereR(100.) -geompy.addToStudy(sphere, "sphere") - -# create a mesh on the sphere -hexoticMesh = smesh.Mesh(sphere,"sphere: BLSurf and Hexotic mesh") - -# create a BLSurf algorithm for faces -BLSURF = hexoticMesh.Triangle(algo=smesh.BLSURF) -BLSURF.SetGeometricMesh( 1 ) - -# create a Hexotic algorithm for volumes -HEXOTIC = hexoticMesh.Hexahedron(algo=smesh.Hexotic) - -# compute the mesh -hexoticMesh.Compute() - -# Change the level of subdivision -HEXOTIC.SetMinMaxHexes(4, 8) - -# End of script -\endcode +

Example of mesh generation with Hexotic algorithm:

+\tui_script{hexoticdemo.py} \image html hexotic_basic_subdivisions_4_8.png Left: Hexotic mesh without hypothesis, right: Hexotic mesh with an hypothesis defined by minl=4 and maxl=8 @@ -56,59 +32,8 @@ This example illustrates the sub-domain mode of Hexotic. \subsection tui_hexotic_sd_mode1 Sub-domain mode = 1 -\code -import SALOMEDS -import geompy -import smesh - -# Create geometry: a box cut by a holed sphere -Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) -Sphere_1 = geompy.MakeSphereR(75) -Sphere_2 = geompy.MakeSphereR(25) -geompy.TranslateDXDYDZ(Box_1, -100, -100, -100) -Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2) -Cut_2 = geompy.MakeCut(Box_1, Cut_1) -geompy.addToStudy( Box_1, 'Box_1' ) -geompy.addToStudy( Sphere_1, 'Sphere_1' ) -geompy.addToStudy( Sphere_2, 'Sphere_2' ) -geompy.addToStudy( Cut_1, 'Cut_1' ) -geompy.addToStudy( Cut_2, 'Cut_2' ) - -# Create filters -# aFilter1: elements inside small sphere -aFilter1 = smesh.GetFilterFromCriteria([smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_2)]) -# aFilter2: elements inside big sphere and not inside small sphere -aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_1, smesh.FT_LogicalAND), - smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_2, smesh.FT_LogicalNOT)]) -# aFilter3: elements not inside big sphere -aFilter3 = smesh.GetFilterFromCriteria([smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_1, smesh.FT_LogicalNOT)]) - -# Create mesh of Cut_2 with sd mode 1 -print "Create mesh of Cut_2 with sd mode 1" -Mesh_hexotic_sd1 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd1") - -# Create the 2D algo: BlSurf with geometrical mesh -Mesh_hexotic_sd1.Triangle(algo=smesh.BLSURF).Parameters().SetGeometricMesh( 1 ) - -# Create the 3D algo: Hexotic with: -# - minl = 4 -# - maxl = 8 -# - sd = 1 -Mesh_hexotic_sd1.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 1 ) - -# Create the groups on filters -g1 = Mesh_hexotic_sd1.GroupOnFilter(smesh.VOLUME, 'small sphere', aFilter1 ) -g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) -g2 = Mesh_hexotic_sd1.GroupOnFilter(smesh.VOLUME, 'big sphere - small sphere', aFilter2 ) -g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) -g3 = Mesh_hexotic_sd1.GroupOnFilter(smesh.VOLUME, 'box - big sphere', aFilter3 ) -g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) - -# Compute -Mesh_hexotic_sd1.Compute() - -# End of script -\endcode +

Example of sub-domain mode 1 with Hexotic algorithm:

+\tui_script{hexoticsubdom1.py} \image html hexotic_sd_mode_1.png Hexotic mesh of a box cut by a holed sphere ( sd = 1 ) @@ -116,34 +41,8 @@ Mesh_hexotic_sd1.Compute() \subsection tui_hexotic_sd_mode2 Sub-domain mode = 2 -\code - -# Create mesh of Cut_2 with sd mode 2 -print "Create mesh of Cut_2 with sd mode 2" -Mesh_hexotic_sd2 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd2") - -# Create the 2D algo: BlSurf with geometrical mesh -Mesh_hexotic_sd2.Triangle(algo=smesh.BLSURF).Parameters().SetGeometricMesh( 1 ) - -# Create the 3D algo: Hexotic with: -# - minl = 4 -# - maxl = 8 -# - sd = 2 -Mesh_hexotic_sd2.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 2 ) - -# Create the groups on filters -g1 = Mesh_hexotic_sd2.GroupOnFilter(smesh.VOLUME, 'small sphere', aFilter1 ) -g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) -g2 = Mesh_hexotic_sd2.GroupOnFilter(smesh.VOLUME, 'big sphere - small sphere', aFilter2 ) -g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) -g3 = Mesh_hexotic_sd2.GroupOnFilter(smesh.VOLUME, 'box - big sphere', aFilter3 ) -g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) - -# Compute -Mesh_hexotic_sd2.Compute() - -# End of script -\endcode +

Example of sub-domain mode 2 with Hexotic algorithm:

+\tui_script{hexoticsubdom2.py} \image html hexotic_sd_mode_2.png Hexotic mesh of a box cut by a holed sphere ( sd = 2 ) @@ -151,34 +50,8 @@ Mesh_hexotic_sd2.Compute() \subsection tui_hexotic_sd_mode3 Sub-domain mode = 3 -\code - -# Create mesh of Cut_2 with sd mode 3 -print "Create mesh of Cut_2 with sd mode 3" -Mesh_hexotic_sd3 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd3") - -# Create the 2D algo: BlSurf with geometrical mesh -Mesh_hexotic_sd3.Triangle(algo=smesh.BLSURF).Parameters().SetGeometricMesh( 1 ) - -# Create the 3D algo: Hexotic with: -# - minl = 4 -# - maxl = 8 -# - sd = 3 -Mesh_hexotic_sd3.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 3 ) - -# Create the groups on filters -g1 = Mesh_hexotic_sd3.GroupOnFilter(smesh.VOLUME, 'small sphere', aFilter1 ) -g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) -g2 = Mesh_hexotic_sd3.GroupOnFilter(smesh.VOLUME, 'big sphere - small sphere', aFilter2 ) -g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) -g3 = Mesh_hexotic_sd3.GroupOnFilter(smesh.VOLUME, 'box - big sphere', aFilter3 ) -g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) - -# Compute -Mesh_hexotic_sd3.Compute() - -# End of script -\endcode +

Example of sub-domain mode 3 with Hexotic algorithm:

+\tui_script{hexoticsubdom3.py} \image html hexotic_sd_mode_3.png Hexotic mesh of a box cut by a holed sphere ( sd = 3 ) @@ -186,26 +59,8 @@ Mesh_hexotic_sd3.Compute() \subsection tui_hexotic_sd_mode4 Sub-domain mode = 4 -\code - -# Create geometry: a box cut by a plane -Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) -Translation_1 = geompy.MakeTranslation(Box_1, 0, 200, 0) -Partition_1 = geompy.MakePartition([Box_1, Translation_1], [], [], [], geompy.ShapeType["SOLID"], 0, [], 0) -geompy.addToStudy( Box_1, 'Box_1' ) -geompy.addToStudy( Translation_1, 'Translation_1' ) -geompy.addToStudy( Partition_1, 'Partition_1' ) - -# Create mesh of Partition_1 with sd mode 4 (default sd mode in SALOME) -Mesh_hexotic_sd4 = smesh.Mesh(Partition_1, "Mesh_hexotic_sd4") -Mesh_hexotic_sd4.Triangle(algo=smesh.BLSURF) -Mesh_hexotic_sd4.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 4 ) - -# Compute -Mesh_hexotic_sd4.Compute() - -# End of script -\endcode +

Example of sub-domain mode 4 with Hexotic algorithm:

+\tui_script{hexoticsubdom4.py} \image html hexotic_sd_mode_4.png Hexotic mesh of a box cut by a plane ( On the left, sd = 3: the internal surface is ignored ; on the right sd = 4: all sub-domains are meshed ) diff --git a/resources/HexoticPLUGIN.xml b/resources/HexoticPLUGIN.xml index 5365eb1..b6aa907 100644 --- a/resources/HexoticPLUGIN.xml +++ b/resources/HexoticPLUGIN.xml @@ -45,7 +45,7 @@ need-geom="false" dim="3"> - Hexotic_3D=Hexahedron(algo=smesh.Hexotic) + Hexotic_3D=Hexahedron(algo=smeshBuilder.Hexotic) Hexotic_Parameters=Parameters() diff --git a/src/HexoticPlugin/HexoticPLUGINDC.py b/src/HexoticPlugin/HexoticPLUGINBuilder.py similarity index 96% rename from src/HexoticPlugin/HexoticPLUGINDC.py rename to src/HexoticPlugin/HexoticPLUGINBuilder.py index de7f9ea..552658d 100644 --- a/src/HexoticPlugin/HexoticPLUGINDC.py +++ b/src/HexoticPlugin/HexoticPLUGINBuilder.py @@ -18,11 +18,11 @@ # ## -# @package HexoticPLUGINDC +# @package HexoticPLUGINBuilder # Python API for the Hexotic meshing plug-in module. -from smesh_algorithm import Mesh_Algorithm -from smesh import AssureGeomPublished +from salome.smesh.smesh_algorithm import Mesh_Algorithm +from salome.smesh.smeshBuilder import AssureGeomPublished # import HexoticPlugin module if possible noHexoticPlugin = 0 diff --git a/src/HexoticPlugin/Makefile.am b/src/HexoticPlugin/Makefile.am index c6b09df..38cadab 100644 --- a/src/HexoticPlugin/Makefile.am +++ b/src/HexoticPlugin/Makefile.am @@ -64,5 +64,8 @@ libHexoticEngine_la_LDFLAGS = \ $(BLSURFPLUGIN_LDFLAGS) # Scripts to be installed. -dist_salomescript_DATA=HexoticPLUGINDC.py - +#dist_salomescript_DATA=HexoticPLUGINDC.py +mypkgpythondir = $(salomepythondir)/salome/HexoticPLUGIN +mypkgpython_PYTHON = \ + __init__.py \ + HexoticPLUGINBuilder.py diff --git a/src/HexoticPlugin/__init__.py b/src/HexoticPlugin/__init__.py new file mode 100644 index 0000000..c41cf58 --- /dev/null +++ b/src/HexoticPlugin/__init__.py @@ -0,0 +1,22 @@ +# Copyright (C) 2007-2013 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +## +# @package HexoticPluginBuilder +# Python API for the Hexotic meshing plug-in module. -- 2.39.2