From db7aa8538fc7d6d7f1a9b5522e6f2605e3c143df Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 4 Apr 2013 07:11:14 +0000 Subject: [PATCH] Merge from BR_plugins_pbyacs 03/04/2013 --- configure.ac | 1 + doc/salome/Makefile.am | 2 +- doc/salome/examples/Makefile.am | 31 +++++++++++ doc/salome/examples/netgendemo.py | 50 ++++++++++++++++++ doc/salome/gui/NETGENPLUGIN/Makefile.am | 5 +- doc/salome/gui/NETGENPLUGIN/doxyfile.in | 7 ++- doc/salome/gui/NETGENPLUGIN/doxyfile_py.in | 6 +-- .../input/netgenplugin_python_interface.doc | 52 ++----------------- resources/NETGENPlugin.xml | 6 +-- src/NETGENPlugin/Makefile.am | 6 ++- ...TGENPluginDC.py => NETGENPluginBuilder.py} | 6 +-- src/NETGENPlugin/__init__.py | 22 ++++++++ 12 files changed, 131 insertions(+), 63 deletions(-) create mode 100644 doc/salome/examples/Makefile.am create mode 100644 doc/salome/examples/netgendemo.py rename src/NETGENPlugin/{NETGENPluginDC.py => NETGENPluginBuilder.py} (99%) create mode 100644 src/NETGENPlugin/__init__.py diff --git a/configure.ac b/configure.ac index ef3cdad..4f876bd 100644 --- a/configure.ac +++ b/configure.ac @@ -442,6 +442,7 @@ AC_OUTPUT([ \ NETGENPLUGIN_version.h \ doc/Makefile \ doc/salome/Makefile \ + doc/salome/examples/Makefile \ doc/salome/gui/Makefile \ doc/salome/gui/NETGENPLUGIN/Makefile \ doc/salome/gui/NETGENPLUGIN/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..b1c7881 --- /dev/null +++ b/doc/salome/examples/Makefile.am @@ -0,0 +1,31 @@ +# 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/NETGENPLUGIN + +pyexamples_SCRIPTS = netgendemo.py + +EXTRA_DIST += $(pyexamples_SCRIPTS) diff --git a/doc/salome/examples/netgendemo.py b/doc/salome/examples/netgendemo.py new file mode 100644 index 0000000..8ef585b --- /dev/null +++ b/doc/salome/examples/netgendemo.py @@ -0,0 +1,50 @@ +# 2d and 3d mesh generation with NETGEN + +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 box +box = geompy.MakeBoxDXDYDZ(10., 10., 10.) +geompy.addToStudy(box, "Box") + + +# 1. Create a triangular 2D mesh on the box with NETGEN_1D2D algorithm +triaN = smesh.Mesh(box, "Box : triangular mesh by NETGEN_1D2D") + +# create a Netgen_1D2D algorithm for solids +algo2D = triaN.Triangle(smeshBuilder.NETGEN_1D2D) + +# define hypotheses +n12_params = algo2D.Parameters() + +# define number of segments +n12_params.SetNbSegPerEdge(19) + +# define max element +n12_params.SetMaxSize(300) + +# 2. Create a tetrahedral mesh on the box with NETGEN_1D2D3D algorithm (full netgen) +tetraN = smesh.Mesh(box, "Box : tetrahedrical mesh by NETGEN_1D2D3D") + +# create a Netgen_1D2D3D algorithm for solids +algo3D = tetraN.Tetrahedron(smeshBuilder.FULL_NETGEN) + +# define hypotheses +n123_params = algo3D.Parameters() + +# define number of segments +n123_params.SetNbSegPerEdge(11) + +# define max element size +n123_params.SetMaxSize(300) + +# compute the meshes +triaN.Compute() +tetraN.Compute() diff --git a/doc/salome/gui/NETGENPLUGIN/Makefile.am b/doc/salome/gui/NETGENPLUGIN/Makefile.am index 21f4d0f..450e776 100755 --- a/doc/salome/gui/NETGENPLUGIN/Makefile.am +++ b/doc/salome/gui/NETGENPLUGIN/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=NETGENPlugin -smesh.py: $(top_srcdir)/src/NETGENPlugin/NETGENPluginDC.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 $@ NETGENPlugin - -usr_docs: doxyfile_py doxyfile smesh.py +usr_docs: doxyfile_py doxyfile @$(DOXYGEN) doxyfile_py ; \ $(DOXYGEN) doxyfile diff --git a/doc/salome/gui/NETGENPLUGIN/doxyfile.in b/doc/salome/gui/NETGENPLUGIN/doxyfile.in index 75fd0d0..d2c89ea 100755 --- a/doc/salome/gui/NETGENPLUGIN/doxyfile.in +++ b/doc/salome/gui/NETGENPLUGIN/doxyfile.in @@ -42,7 +42,7 @@ INPUT = @srcdir@/input FILE_PATTERNS = *.doc EXCLUDE = IMAGE_PATH = @srcdir@/images -EXAMPLE_PATH = +EXAMPLE_PATH = @top_srcdir@/doc/salome/examples #--------------------------------------------------------------------------- #HTML related options @@ -113,3 +113,8 @@ GENERATE_RTF = NO #because it wrongly defines location of the html files for search. TAGFILES = netgenpluginpy_doc.tag=../NETGENPLUGIN/netgenpluginpy_doc SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/NETGENPLUGIN/doxyfile_py.in b/doc/salome/gui/NETGENPLUGIN/doxyfile_py.in index 799e701..1cc0738 100755 --- a/doc/salome/gui/NETGENPLUGIN/doxyfile_py.in +++ b/doc/salome/gui/NETGENPLUGIN/doxyfile_py.in @@ -99,9 +99,9 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = @top_srcdir@/src/NETGENPlugin/NETGENPluginDC.py \ - smesh.py \ - @SMESH_ROOT_DIR@/bin/salome/smesh_algorithm.py +INPUT = @top_srcdir@/src/NETGENPlugin/NETGENPluginBuilder.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/NETGENPLUGIN/input/netgenplugin_python_interface.doc b/doc/salome/gui/NETGENPLUGIN/input/netgenplugin_python_interface.doc index f5f6ecd..29cf161 100644 --- a/doc/salome/gui/NETGENPLUGIN/input/netgenplugin_python_interface.doc +++ b/doc/salome/gui/NETGENPLUGIN/input/netgenplugin_python_interface.doc @@ -2,59 +2,17 @@ \page netgenplugin_python_interface_page Python Interface -Python package NETGENPluginDC defines several classes, destined for +Python package NETGENPlugin defines several classes, destined for creation of the 2D and 3D meshes. NETGEN meshing plugin dynamically adds several methods to the -smesh.Mesh class to create meshing algorithms. + \ref SMESH_SWIG.smeshBuilder.Mesh "class Mesh" to create meshing algorithms. Below you can see an example of usage of the NETGENPlugin package for mesh generation: -\code - -import geompy -import smesh - -# create a box -box = geompy.MakeBoxDXDYDZ(10., 10., 10.) -geompy.addToStudy(box, "Box") - - -# 1. Create a triangular 2D mesh on the box with NETGEN_1D2D algorithm -triaN = smesh.Mesh(box, "Box : triangular mesh by NETGEN_1D2D") - -# create a Netgen_1D2D algorithm for solids -algo2D = triaN.Triangle(smesh.NETGEN_1D2D) - -# define hypotheses -n12_params = algo2D.Parameters() - -# define number of segments -n12_params.SetNbSegPerEdge(19) - -# define max element -n12_params.SetMaxSize(300) - -# 2. Create a tetrahedral mesh on the box with NETGEN_1D2D3D algorithm (full netgen) -tetraN = smesh.Mesh(box, "Box : tetrahedrical mesh by NETGEN_1D2D3D") - -# create a Netgen_1D2D3D algorithm for solids -algo3D = tetraN.Tetrahedron(smesh.FULL_NETGEN) - -# define hypotheses -n123_params = algo3D.Parameters() - -# define number of segments -n123_params.SetNbSegPerEdge(11) - -# define max element size -n123_params.SetMaxSize(300) - -# compute the meshes -triaN.Compute() -tetraN.Compute() - -\endcode +\anchor example_NETGENPlugin +

Example of 2d and 3d mesh generation with NETGEN:

+\tui_script{netgendemo.py} */ diff --git a/resources/NETGENPlugin.xml b/resources/NETGENPlugin.xml index cdb581f..f9b0d97 100644 --- a/resources/NETGENPlugin.xml +++ b/resources/NETGENPlugin.xml @@ -84,7 +84,7 @@ output="TRIA,QUAD" dim="2"> - NETGEN_2D_ONLY=Triangle(algo=smesh.NETGEN_2D) + NETGEN_2D_ONLY=Triangle(algo=smeshBuilder.NETGEN_2D) LengthFromEdges=LengthFromEdges() MaxElementArea=MaxElementArea(SetMaxElementArea()) NETGEN_Parameters_2D_ONLY=Parameters() @@ -102,7 +102,7 @@ dim="2" support-submeshes="true"> - NETGEN_2D=Triangle(algo=smesh.NETGEN_1D2D) + NETGEN_2D=Triangle(algo=smeshBuilder.NETGEN_1D2D) NETGEN_Parameters_2D=Parameters() NETGEN_SimpleParameters_2D=Parameters(smesh.SIMPLE) ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges()) @@ -116,7 +116,7 @@ dim="3" support-submeshes="true"> - NETGEN_2D3D=Tetrahedron(algo=smesh.NETGEN_1D2D3D) + NETGEN_2D3D=Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D) NETGEN_Parameters=Parameters() NETGEN_SimpleParameters_3D=Parameters(smesh.SIMPLE) diff --git a/src/NETGENPlugin/Makefile.am b/src/NETGENPlugin/Makefile.am index fc0d63c..2ac9d89 100644 --- a/src/NETGENPlugin/Makefile.am +++ b/src/NETGENPlugin/Makefile.am @@ -99,4 +99,8 @@ libNETGENEngine_la_LDFLAGS += \ $(KERNEL_LDFLAGS) -lSalomeGenericObj -lSalomeNS -lSALOMELocalTrace -lOpUtil # Scripts to be installed. -dist_salomescript_DATA= NETGENPluginDC.py +#dist_salomescript_DATA= NETGENPluginDC.py +mypkgpythondir = $(salomepythondir)/salome/NETGENPlugin +mypkgpython_PYTHON = \ + __init__.py \ + NETGENPluginBuilder.py diff --git a/src/NETGENPlugin/NETGENPluginDC.py b/src/NETGENPlugin/NETGENPluginBuilder.py similarity index 99% rename from src/NETGENPlugin/NETGENPluginDC.py rename to src/NETGENPlugin/NETGENPluginBuilder.py index d2800b1..ba3958c 100644 --- a/src/NETGENPlugin/NETGENPluginDC.py +++ b/src/NETGENPlugin/NETGENPluginBuilder.py @@ -18,11 +18,11 @@ # ## -# @package NETGENPluginDC +# @package NETGENPluginBuilder # Python API for the NETGEN meshing plug-in module. -from smesh_algorithm import Mesh_Algorithm -from smesh import AssureGeomPublished, ParseParameters, IsEqual +from salome.smesh.smesh_algorithm import Mesh_Algorithm +from salome.smesh.smeshBuilder import AssureGeomPublished, ParseParameters, IsEqual # import NETGENPlugin module if possible noNETGENPlugin = 0 diff --git a/src/NETGENPlugin/__init__.py b/src/NETGENPlugin/__init__.py new file mode 100644 index 0000000..e49d62f --- /dev/null +++ b/src/NETGENPlugin/__init__.py @@ -0,0 +1,22 @@ +# 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 +# + +## +# @package NETGENPluginBuilder +# Python API for the NETGEN meshing plug-in module. -- 2.39.2