From: vsr Date: Thu, 4 Apr 2013 07:09:30 +0000 (+0000) Subject: Merge from BR_plugins_pbyacs 03/04/2013 X-Git-Tag: V7_2_0~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8abb552206770f6399d103b05fbb79ecc7c74802;p=plugins%2Fblsurfplugin.git Merge from BR_plugins_pbyacs 03/04/2013 --- diff --git a/configure.ac b/configure.ac index 79a5b34..361e52f 100644 --- a/configure.ac +++ b/configure.ac @@ -433,6 +433,7 @@ AC_OUTPUT([ \ adm_local/cmake_files/Makefile \ doc/Makefile \ doc/salome/Makefile \ + doc/salome/examples/Makefile \ doc/salome/gui/Makefile \ doc/salome/gui/BLSURFPLUGIN/Makefile \ doc/salome/gui/BLSURFPLUGIN/doxyfile \ diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index 319d245..6d93c6e 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -21,7 +21,7 @@ # Author : Patrick GOLDBRONN (CEA) # Date : 30/11/2001 # -SUBDIRS = tui gui +SUBDIRS = examples tui gui SUBDIRSTUI = tui SUBDIRSGUI = gui diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am new file mode 100644 index 0000000..fc32167 --- /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/BLSURFPLUGIN + +pyexamples_SCRIPTS = blsurfdemo.py + +EXTRA_DIST += $(pyexamples_SCRIPTS) diff --git a/doc/salome/examples/blsurfdemo.py b/doc/salome/examples/blsurfdemo.py new file mode 100644 index 0000000..1a2203f --- /dev/null +++ b/doc/salome/examples/blsurfdemo.py @@ -0,0 +1,146 @@ +# ------------------------------------------------- +# blsurf_construct_mesh_basic_hypo Basic hypothesis +# ------------------------------------------------- + +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(200., 200., 200.) +geompy.addToStudy(box, "box") + +# get sub-shapes +Face_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0] +Edge_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["EDGE"])[0] +Vertex_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["VERTEX"])[0] + +Face_2 = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[5] +Wire_1 = geompy.SubShapeAllSorted(Face_2, geompy.ShapeType["WIRE"])[0] + +# Geom object with sizemaps can be unpublished in study. +# They will then be automatically published. +geompy.addToStudyInFather(box,Face_1, "Face_1") +geompy.addToStudyInFather(box,Edge_1, "Edge_1") +geompy.addToStudyInFather(box,Vertex_1, "Vertex_1") + +geompy.addToStudyInFather(box ,Face_2, "Face_2") +geompy.addToStudyInFather(Face_2,Wire_1, "Wire_1") + +# create a mesh on the box +blsurfMesh = smesh.Mesh(box,"box: BLSurf mesh") + +# create a BLSurf algorithm for faces +algo2d = blsurfMesh.Triangle(algo=smeshBuilder.BLSURF) + +# ---------------------------------------------- +# blsurf_construct_mesh_sizemaps Adding sizemaps +# ---------------------------------------------- + +# optional - set physical mesh to 2 = Size Map +algo2d.SetPhysicalMesh( 2 ) + +# optional - set global mesh size +algo2d.SetPhySize( 34.641 ) + +# set size on Face_1 +algo2d.SetSizeMap(Face_1, 'def f(u,v): return 10' ) +# set size on Edge_1 +algo2d.SetSizeMap(Edge_1, 'def f(t): return 5' ) +# set size on Vertex_1 +algo2d.SetSizeMap(Vertex_1, 'def f(): return 2' ) + +# compute the mesh +blsurfMesh.Compute() + +# ---------------------------------------------------------------- +# blsurf_construct_mesh_enforced_vertices Adding enforced vertices +# ---------------------------------------------------------------- + +# Add enforced vertex for Face_1 on (50, 50, 50) +# The projection coordinates will be (50, 50, 0) +algo2d.SetEnforcedVertex(Face_1, 50, 50, 50) + +# Add another enforced vertex on (150, 150, 150) +algo2d.SetEnforcedVertex(Face_1, 150, 150, 150) + +# Retrieve and print the list of enforced vertices defines on Face_1 +enfList = algo2d.GetEnforcedVertices(Face_1) +print "List of enforced vertices for Face_1: " +print enfList + +# compute the mesh +blsurfMesh.Compute() + +# Remove an enforced vertex and print the list +algo2d.UnsetEnforcedVertex(Face_1, 50, 50, 50) +enfList = algo2d.GetEnforcedVertices(Face_1) +print "List of enforced vertices for Face_1: " +print enfList + +# compute the mesh +blsurfMesh.Compute() + +# Remove all enforced vertices defined on Face_1 +algo2d.UnsetEnforcedVertices(Face_1) + +# compute the mesh +blsurfMesh.Compute() + +# --------------------------------------------------- +# blsurf_construct_mesh_attractor Adding an attractor +# --------------------------------------------------- + +# Add an attractor on Face_2, which shape is Wire_1 + +# The size on Wire_1 is 1 and will grow until a maximum of 36.641 (physical size set above) +# The influence distance of the attractor is 20 +# The size is kept constant until a distance of 10 +algo2d.SetAttractorGeom(Face_2, Wire_1, 1, 36.641, 20, 10) + +# In order to let the attractor control the growing of the mesh let set +# the gradation to its maximum +algo2d.SetGradation( 2.5 ) + +# compute the mesh +blsurfMesh.Compute() + +# --------------------------------------------------------------- +# blsurf_construct_mesh_internal_vertices Using internal vertices +# --------------------------------------------------------------- + +# Creating a geometry containing internal vertices +Face_3 = geompy.MakeFaceHW(1, 1, 1) +Vertex_2 = geompy.MakeVertex(0.2, 0.2, 0) +Partition_1 = geompy.MakePartition([Face_3, Vertex_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +Multi_Translation_1 = geompy.MakeMultiTranslation2D(Partition_1, OX, 1, 10, OY, 1, 10) +geompy.addToStudy( Face_3, 'Face_3' ) +geompy.addToStudy( Vertex_2, 'Vertex_2' ) +geompy.addToStudy( Partition_1, 'Partition_1' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( Multi_Translation_1, 'Multi-Translation_1' ) + +# The mesh on the geometry with internal vertices +blsurfMesh_internal = smesh.Mesh(Multi_Translation_1, "blsurfMesh_internal") +algo2d = blsurfMesh_internal.Triangle(algo=smeshBuilder.BLSURF) +algo2d.SetPhySize( 0.1 ) + +# Allows BLSURF to take into account internal vertices +algo2d.SetInternalEnforcedVertexAllFaces( True ) + +# Add the created nodes into a group +algo2d.SetInternalEnforcedVertexAllFacesGroup( "my group" ) + +# compute the mesh +blsurfMesh_internal.Compute() + +# End of script diff --git a/doc/salome/gui/BLSURFPLUGIN/Makefile.am b/doc/salome/gui/BLSURFPLUGIN/Makefile.am index 2bb9e46..f0cb7ec 100644 --- a/doc/salome/gui/BLSURFPLUGIN/Makefile.am +++ b/doc/salome/gui/BLSURFPLUGIN/Makefile.am @@ -32,10 +32,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=BLSURFPlugin -smesh.py: $(top_srcdir)/src/BLSURFPlugin/BLSURFPluginDC.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 $@ BLSURFPlugin - -usr_docs: doxyfile_py doxyfile smesh.py +usr_docs: doxyfile_py doxyfile @$(DOXYGEN) doxyfile_py ; \ $(DOXYGEN) doxyfile diff --git a/doc/salome/gui/BLSURFPLUGIN/doxyfile.in b/doc/salome/gui/BLSURFPLUGIN/doxyfile.in index 039b1c3..5aa7a7a 100755 --- a/doc/salome/gui/BLSURFPLUGIN/doxyfile.in +++ b/doc/salome/gui/BLSURFPLUGIN/doxyfile.in @@ -38,6 +38,7 @@ WARNINGS = YES INPUT = @srcdir@/input FILE_PATTERNS = *.doc IMAGE_PATH = @srcdir@/images +EXAMPLE_PATH = @top_srcdir@/doc/salome/examples #--------------------------------------------------------------------------- #HTML related options @@ -69,4 +70,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 = blsurfpluginpy_doc.tag=../BLSURFPLUGIN/blsurfpluginpy_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/BLSURFPLUGIN/doxyfile_py.in b/doc/salome/gui/BLSURFPLUGIN/doxyfile_py.in index 097ce1e..4dad659 100755 --- a/doc/salome/gui/BLSURFPLUGIN/doxyfile_py.in +++ b/doc/salome/gui/BLSURFPLUGIN/doxyfile_py.in @@ -96,9 +96,9 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = @top_srcdir@/src/BLSURFPlugin/BLSURFPluginDC.py \ - smesh.py \ - @SMESH_ROOT_DIR@/bin/salome/smesh_algorithm.py +INPUT = @top_srcdir@/src/BLSURFPlugin/BLSURFPluginBuilder.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/BLSURFPLUGIN/input/blsurfplugin_python_interface.doc b/doc/salome/gui/BLSURFPLUGIN/input/blsurfplugin_python_interface.doc index 2e883ab..3ee0b8f 100644 --- a/doc/salome/gui/BLSURFPLUGIN/input/blsurfplugin_python_interface.doc +++ b/doc/salome/gui/BLSURFPLUGIN/input/blsurfplugin_python_interface.doc @@ -2,9 +2,9 @@ \page blsurfplugin_python_interface_page Python Interface -Python package BLSURFPluginDC defines several classes, destined for creation of the 2D meshes. +Python package BLSURFPlugin defines several classes, destined for creation of the 2D meshes. -BLSURF meshing plugin dynamically adds several methods to the smesh.Mesh class to create meshing algorithms. +BLSURF meshing plugin dynamically adds several methods to the \ref SMESH_SWIG.smeshBuilder.Mesh "class Mesh" to create meshing algorithms. Below you can see an example of usage of the BLSURFPlugin Python API for mesh generation: @@ -12,148 +12,8 @@ Below you can see an example of usage of the BLSURFPlugin Python API for mesh ge \section blsurf_construct_mesh Construction of Mesh using BLSurf algorithm -\subsection blsurf_construct_mesh_basic_hypo Basic hypothesis -\code -import geompy -import smesh -import BLSURFPlugin - -# create a box -box = geompy.MakeBoxDXDYDZ(200., 200., 200.) -geompy.addToStudy(box, "box") - -# get sub-shapes -Face_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0] -Edge_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["EDGE"])[0] -Vertex_1 = geompy.SubShapeAllSorted(box, geompy.ShapeType["VERTEX"])[0] - -Face_2 = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[5] -Wire_1 = geompy.SubShapeAllSorted(Face_2, geompy.ShapeType["WIRE"])[0] - -# Geom object with sizemaps can be unpublished in study. -# They will then be automatically published. -geompy.addToStudyInFather(box,Face_1, "Face_1") -geompy.addToStudyInFather(box,Edge_1, "Edge_1") -geompy.addToStudyInFather(box,Vertex_1, "Vertex_1") - -geompy.addToStudyInFather(box ,Face_2, "Face_2") -geompy.addToStudyInFather(Face_2,Wire_1, "Wire_1") - -# create a mesh on the box -blsurfMesh = smesh.Mesh(box,"box: BLSurf mesh") - -# create a BLSurf algorithm for faces -algo2d = blsurfMesh.Triangle(algo=smesh.BLSURF) - -# End of script -\endcode - -\subsection blsurf_construct_mesh_sizemaps Adding sizemaps -\code -# optional - set physical mesh to 2 = Size Map -algo2d.SetPhysicalMesh( 2 ) - -# optional - set global mesh size -algo2d.SetPhySize( 34.641 ) - -# set size on Face_1 -algo2d.SetSizeMap(Face_1, 'def f(u,v): return 10' ) -# set size on Edge_1 -algo2d.SetSizeMap(Edge_1, 'def f(t): return 5' ) -# set size on Vertex_1 -algo2d.SetSizeMap(Vertex_1, 'def f(): return 2' ) - -# compute the mesh -blsurfMesh.Compute() - -# End of script -\endcode - -\subsection blsurf_construct_mesh_enforced_vertices Adding enforced vertices -\code -# Add enforced vertex for Face_1 on (50, 50, 50) -# The projection coordinates will be (50, 50, 0) -algo2d.SetEnforcedVertex(Face_1, 50, 50, 50) - -# Add another enforced vertex on (150, 150, 150) -algo2d.SetEnforcedVertex(Face_1, 150, 150, 150) - -# Retrieve and print the list of enforced vertices defines on Face_1 -enfList = algo2d.GetEnforcedVertices(Face_1) -print "List of enforced vertices for Face_1: " -print enfList - -# compute the mesh -blsurfMesh.Compute() - -# Remove an enforced vertex and print the list -algo2d.UnsetEnforcedVertex(Face_1, 50, 50, 50) -enfList = algo2d.GetEnforcedVertices(Face_1) -print "List of enforced vertices for Face_1: " -print enfList - -# compute the mesh -blsurfMesh.Compute() - -# Remove all enforced vertices defined on Face_1 -algo2d.UnsetEnforcedVertices(Face_1) - -# compute the mesh -blsurfMesh.Compute() - -# End of script -\endcode - -\subsection blsurf_construct_mesh_attractor Adding an attractor -\code -# Add an attractor on Face_2, which shape is Wire_1 - -# The size on Wire_1 is 1 and will grow until a maximum of 36.641 (physical size set above) -# The influence distance of the attractor is 20 -# The size is kept constant until a distance of 10 -algo2d.SetAttractorGeom(Face_2, Wire_1, 1, 36.641, 20, 10) - -# In order to let the attractor control the growing of the mesh let set -# the gradation to its maximum -algo2d.SetGradation( 2.5 ) - -# compute the mesh -blsurfMesh.Compute() - -# End of script -\endcode - -\subsection blsurf_construct_mesh_internal_vertices Using internal vertices -\code -# Creating a geometry containing internal vertices -Face_3 = geompy.MakeFaceHW(1, 1, 1) -Vertex_2 = geompy.MakeVertex(0.2, 0.2, 0) -Partition_1 = geompy.MakePartition([Face_3, Vertex_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) -OX = geompy.MakeVectorDXDYDZ(1, 0, 0) -OY = geompy.MakeVectorDXDYDZ(0, 1, 0) -Multi_Translation_1 = geompy.MakeMultiTranslation2D(Partition_1, OX, 1, 10, OY, 1, 10) -geompy.addToStudy( Face_3, 'Face_3' ) -geompy.addToStudy( Vertex_2, 'Vertex_2' ) -geompy.addToStudy( Partition_1, 'Partition_1' ) -geompy.addToStudy( OX, 'OX' ) -geompy.addToStudy( OY, 'OY' ) -geompy.addToStudy( Multi_Translation_1, 'Multi-Translation_1' ) - -# The mesh on the geometry with internal vertices -blsurfMesh_internal = smesh.Mesh(Multi_Translation_1, "blsurfMesh_internal") -algo2d = blsurfMesh_internal.Triangle(algo=smesh.BLSURF) -algo2d.SetPhySize( 0.1 ) - -# Allows BLSURF to take into account internal vertices -algo2d.SetInternalEnforcedVertexAllFaces( True ) - -# Add the created nodes into a group -algo2d.SetInternalEnforcedVertexAllFacesGroup( "my group" ) - -# compute the mesh -blsurfMesh_internal.Compute() - -# End of script -\endcode +\anchor example_BLSURFPlugin +

Example of mesh generation with BLSurf algorithm:

+\tui_script{blsurfdemo.py} */ diff --git a/resources/BLSURFPlugin.xml b/resources/BLSURFPlugin.xml index ec9402d..d627730 100644 --- a/resources/BLSURFPlugin.xml +++ b/resources/BLSURFPlugin.xml @@ -71,7 +71,7 @@ dim="2" support-submeshes="true"> - BLSURF=Triangle(algo=smesh.BLSURF) + BLSURF=Triangle(algo=smeshBuilder.BLSURF) BLSURF_Parameters=Parameters() ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges()) diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py new file mode 100644 index 0000000..4c2316e --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -0,0 +1,489 @@ +# 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 BLSURFPluginBuilder +# Python API for the BLSURF meshing plug-in module. + +from salome.smesh.smesh_algorithm import Mesh_Algorithm +from salome.smesh.smeshBuilder import AssureGeomPublished + +# Topology treatment way of BLSURF +FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3 + +# Element size flag of BLSURF +DefaultSize, DefaultGeom, BLSURF_GlobalSize, BLSURF_LocalSize = 0,0,1,2 +# Retrocompatibility +BLSURF_Custom, SizeMap = BLSURF_GlobalSize, BLSURF_LocalSize + + +# import BLSURFPlugin module if possible +noBLSURFPlugin = 0 +try: + import BLSURFPlugin +except ImportError: + noBLSURFPlugin = 1 + pass + +#---------------------------- +# Mesh algo type identifiers +#---------------------------- + +## Algorithm type: BLSurf triangle 2D algorithm, see BLSURF_Algorithm +BLSURF = "BLSURF" + +#---------------------- +# Algorithms +#---------------------- + +## BLSurf 2D algorithm. +# +# It can be created by calling smesh.Mesh.Triangle(smesh.BLSURF,geom=0) +# +class BLSURF_Algorithm(Mesh_Algorithm): + + ## name of the dynamic method in smesh.Mesh class + # @internal + meshMethod = "Triangle" + ## type of algorithm used with helper function in smesh.Mesh class + # @internal + algoType = BLSURF + ## doc string of the method + # @internal + docHelper = "Creates triangle 2D algorithm for faces" + + _anisotropic_ratio = 0 + _bad_surface_element_aspect_ratio = 1000 + _geometric_approximation = 22 + _gradation = 1.3 + _metric = "isotropic" + _remove_tiny_edges = 0 + + ## Private constructor. + # @param mesh parent mesh object algorithm is assigned to + # @param geom geometry (shape/sub-shape) algorithm is assigned to; + # if it is @c 0 (default), the algorithm is assigned to the main shape + def __init__(self, mesh, geom=0): + Mesh_Algorithm.__init__(self) + if noBLSURFPlugin: + print "Warning: BLSURFPlugin module unavailable" + self.Create(mesh, geom, BLSURF, "libBLSURFEngine.so") + self.params=None + #self.SetPhysicalMesh() - PAL19680 + pass + + ## Sets a way to define size of mesh elements to generate. + # @param thePhysicalMesh is: DefaultSize, BLSURF_Custom or SizeMap. + def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize): + physical_size_mode = thePhysicalMesh + if self.Parameters().GetGeometricMesh() == DefaultGeom: + if physical_size_mode == DefaultSize: + physical_size_mode = BLSURF_GlobalSize + self.Parameters().SetPhysicalMesh(physical_size_mode) + pass + + ## Sets a way to define maximum angular deflection of mesh from CAD model. + # @param theGeometricMesh is: DefaultGeom (0)) or BLSURF_GlobalSize (1)) + def SetGeometricMesh(self, theGeometricMesh=DefaultGeom): + geometric_size_mode = theGeometricMesh + if self.Parameters().GetPhysicalMesh() == DefaultSize: + if geometric_size_mode == DefaultGeom: + geometric_size_mode = BLSURF_GlobalSize + self.Parameters().SetGeometricMesh(geometric_size_mode) + pass + + ## Sets size of mesh elements to generate. + # @param theVal : constant global size when using a global physical size. + # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box + def SetPhySize(self, theVal, isRelative = False): + if self.Parameters().GetPhysicalMesh() == DefaultSize: + self.SetPhysicalMesh(BLSURF_GlobalSize) + if isRelative: + self.Parameters().SetPhySizeRel(theVal) + else: + self.Parameters().SetPhySize(theVal) + pass + + ## Sets lower boundary of mesh element size. + # @param theVal : global minimal cell size desired. + # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box + def SetMinSize(self, theVal=-1, isRelative = False): + if isRelative: + self.Parameters().SetMinSizeRel(theVal) + else: + self.Parameters().SetMinSize(theVal) + pass + + ## Sets upper boundary of mesh element size. + # @param theVal : global maximal cell size desired. + # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box + def SetMaxSize(self, theVal=-1): + if isRelative: + self.Parameters().SetMaxSizeRel(theVal) + else: + self.Parameters().SetMaxSize(theVal) + pass + + ## Sets angular deflection (in degrees) from CAD surface. + # @param theVal value of angular deflection + def SetAngleMesh(self, theVal=_geometric_approximation): + if self.Parameters().GetGeometricMesh() == DefaultGeom: + self.SetGeometricMesh(BLSURF_GlobalSize) + self.Parameters().SetAngleMesh(theVal) + pass + + ## Sets maximal allowed ratio between the lengths of two adjacent edges. + # @param theVal value of maximal length ratio + def SetGradation(self, theVal=_gradation): + if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation + self.Parameters().SetGradation(theVal) + pass + + ## Sets topology usage way. + # @param way defines how mesh conformity is assured + def SetTopology(self, way): + if way != PreCAD: + print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way + way = FromCAD + self.Parameters().SetTopology(way) + pass + + ## To respect geometrical edges or not. + # @param toIgnoreEdges "ignore edges" flag value + def SetDecimesh(self, toIgnoreEdges=False): + if toIgnoreEdges: + self.SetOptionValue("respect_geometry","0") + else: + self.SetOptionValue("respect_geometry","1") + pass + + ## Sets verbosity level in the range 0 to 100. + # @param level verbosity level + def SetVerbosity(self, level): + self.Parameters().SetVerbosity(level) + pass + + ## To optimize merges edges. + # @param toMergeEdges "merge edges" flag value + def SetPreCADMergeEdges(self, toMergeEdges=False): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADMergeEdges(toMergeEdges) + pass + + ## To process 3D topology. + # @param toProcess "PreCAD process 3D" flag value + def SetPreCADProcess3DTopology(self, toProcess=False): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADProcess3DTopology(toProcess) + pass + + ## To remove nano edges. + # @param toRemoveNanoEdges "remove nano edges" flag value + def SetPreCADRemoveNanoEdges(self, toRemoveNanoEdges=False): + if toRemoveNanoEdges: + self.SetPreCADOptionValue("remove_tiny_edges","1") + else: + self.SetPreCADOptionValue("remove_tiny_edges","0") + pass + + ## To compute topology from scratch + # @param toDiscardInput "discard input" flag value + def SetPreCADDiscardInput(self, toDiscardInput=False): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADDiscardInput(toDiscardInput) + pass + + ## Sets the length below which an edge is considered as nano + # for the topology processing. + # @param epsNano nano edge length threshold value + def SetPreCADEpsNano(self, epsNano): + self.SetPreCADOptionValue("tiny_edge_length","%f"%epsNano) + pass + + ## Sets advanced option value. + # @param optionName advanced option name + # @param level advanced option value + def SetOptionValue(self, optionName, level): + self.Parameters().SetOptionValue(optionName,level) + pass + + ## Sets advanced PreCAD option value. + # @param optionName name of the option + # @param optionValue value of the option + def SetPreCADOptionValue(self, optionName, optionValue): + if self.Parameters().GetTopology() != PreCAD: + self.SetTopology(PreCAD) + self.Parameters().SetPreCADOptionValue(optionName,optionValue) + pass + + ## Sets GMF file for export at computation + # @param fileName GMF file name + def SetGMFFile(self, fileName): + self.Parameters().SetGMFFile(fileName) + pass + + #----------------------------------------- + # Enforced vertices (BLSURF) + #----------------------------------------- + + ## To get all the enforced vertices + def GetAllEnforcedVertices(self): + return self.Parameters().GetAllEnforcedVertices() + + ## To get all the enforced vertices sorted by face (or group, compound) + def GetAllEnforcedVerticesByFace(self): + return self.Parameters().GetAllEnforcedVerticesByFace() + + ## To get all the enforced vertices sorted by coords of input vertices + def GetAllEnforcedVerticesByCoords(self): + return self.Parameters().GetAllEnforcedVerticesByCoords() + + ## To get all the coords of input vertices sorted by face (or group, compound) + def GetAllCoordsByFace(self): + return self.Parameters().GetAllCoordsByFace() + + ## To get all the enforced vertices on a face (or group, compound) + # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex + def GetEnforcedVertices(self, theFace): + AssureGeomPublished( self.mesh, theFace ) + return self.Parameters().GetEnforcedVertices(theFace) + + ## To clear all the enforced vertices + def ClearAllEnforcedVertices(self): + return self.Parameters().ClearAllEnforcedVertices() + + ## To set an enforced vertex on a face (or group, compound) given the coordinates of a point. If the point is not on the face, it will projected on it. If there is no projection, no enforced vertex is created. + # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex + # @param x : x coordinate + # @param y : y coordinate + # @param z : z coordinate + # @param vertexName : name of the enforced vertex + # @param groupName : name of the group + def SetEnforcedVertex(self, theFace, x, y, z, vertexName = "", groupName = ""): + AssureGeomPublished( self.mesh, theFace ) + if vertexName == "": + if groupName == "": + return self.Parameters().SetEnforcedVertex(theFace, x, y, z) + else: + return self.Parameters().SetEnforcedVertexWithGroup(theFace, x, y, z, groupName) + pass + else: + if groupName == "": + return self.Parameters().SetEnforcedVertexNamed(theFace, x, y, z, vertexName) + else: + return self.Parameters().SetEnforcedVertexNamedWithGroup(theFace, x, y, z, vertexName, groupName) + pass + pass + + ## To set an enforced vertex on a face (or group, compound) given a GEOM vertex, group or compound. + # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex + # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace. + # @param groupName : name of the group + def SetEnforcedVertexGeom(self, theFace, theVertex, groupName = ""): + AssureGeomPublished( self.mesh, theFace ) + AssureGeomPublished( self.mesh, theVertex ) + if groupName == "": + return self.Parameters().SetEnforcedVertexGeom(theFace, theVertex) + else: + return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName) + pass + + ## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates. + # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex + # @param x : x coordinate + # @param y : y coordinate + # @param z : z coordinate + def UnsetEnforcedVertex(self, theFace, x, y, z): + AssureGeomPublished( self.mesh, theFace ) + return self.Parameters().UnsetEnforcedVertex(theFace, x, y, z) + + ## To remove an enforced vertex on a given GEOM face (or group, compound) given a GEOM vertex, group or compound. + # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex + # @param theVertex : GEOM vertex (or group, compound) to remove. + def UnsetEnforcedVertexGeom(self, theFace, theVertex): + AssureGeomPublished( self.mesh, theFace ) + AssureGeomPublished( self.mesh, theVertex ) + return self.Parameters().UnsetEnforcedVertexGeom(theFace, theVertex) + + ## To remove all enforced vertices on a given face. + # @param theFace : face (or group/compound of faces) on which to remove all enforced vertices + def UnsetEnforcedVertices(self, theFace): + AssureGeomPublished( self.mesh, theFace ) + return self.Parameters().UnsetEnforcedVertices(theFace) + + ## To tell BLSURF to add a node on internal vertices + # @param toEnforceInternalVertices : boolean; if True the internal vertices are added as enforced vertices + def SetInternalEnforcedVertexAllFaces(self, toEnforceInternalVertices): + return self.Parameters().SetInternalEnforcedVertexAllFaces(toEnforceInternalVertices) + + ## To know if BLSURF will add a node on internal vertices + def GetInternalEnforcedVertexAllFaces(self): + return self.Parameters().GetInternalEnforcedVertexAllFaces() + + ## To define a group for the nodes of internal vertices + # @param groupName : string; name of the group + def SetInternalEnforcedVertexAllFacesGroup(self, groupName): + return self.Parameters().SetInternalEnforcedVertexAllFacesGroup(groupName) + + ## To get the group name of the nodes of internal vertices + def GetInternalEnforcedVertexAllFacesGroup(self): + return self.Parameters().GetInternalEnforcedVertexAllFacesGroup() + + #----------------------------------------- + # Attractors + #----------------------------------------- + + ## Sets an attractor on the chosen face. The mesh size will decrease exponentially with the distance from theAttractor, following the rule h(d) = theEndSize - (theEndSize - theStartSize) * exp [ - ( d / theInfluenceDistance ) ^ 2 ] + # @param theFace : face on which the attractor will be defined + # @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially + # @param theStartSize : mesh size on theAttractor + # @param theEndSize : maximum size that will be reached on theFace + # @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high) + # @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace + def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance): + AssureGeomPublished( self.mesh, theFace ) + AssureGeomPublished( self.mesh, theAttractor ) + self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance) + pass + + ## Unsets an attractor on the chosen face. + # @param theFace : face on which the attractor has to be removed + def UnsetAttractorGeom(self, theFace): + AssureGeomPublished( self.mesh, theFace ) + self.Parameters().SetAttractorGeom(theFace) + pass + + #----------------------------------------- + # Size maps (BLSURF) + #----------------------------------------- + + ## To set a size map on a face, edge or vertex (or group, compound) given Python function. + # If theObject is a face, the function can be: def f(u,v): return u+v + # If theObject is an edge, the function can be: def f(t): return t/2 + # If theObject is a vertex, the function can be: def f(): return 10 + # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map + # @param theSizeMap : Size map defined as a string + def SetSizeMap(self, theObject, theSizeMap): + AssureGeomPublished( self.mesh, theObject ) + self.Parameters().SetSizeMap(theObject, theSizeMap) + pass + + ## To set a constant size map on a face, edge or vertex (or group, compound). + # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map + # @param theSizeMap : Size map defined as a double + def SetConstantSizeMap(self, theObject, theSizeMap): + AssureGeomPublished( self.mesh, theObject ) + self.Parameters().SetConstantSizeMap(theObject, theSizeMap) + + ## To remove a size map defined on a face, edge or vertex (or group, compound) + # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map + def UnsetSizeMap(self, theObject): + AssureGeomPublished( self.mesh, theObject ) + self.Parameters().UnsetSizeMap(theObject) + pass + + ## To remove all the size maps + def ClearSizeMaps(self): + self.Parameters().ClearSizeMaps() + pass + + ## Sets QuadAllowed flag. + # @param toAllow "allow quadrangles" flag value + def SetQuadAllowed(self, toAllow=True): + self.Parameters().SetQuadAllowed(toAllow) + pass + + ## Defines hypothesis having several parameters + # @return hypothesis object + def Parameters(self): + if not self.params: + self.params = self.Hypothesis("BLSURF_Parameters", [], + "libBLSURFEngine.so", UseExisting=0) + pass + return self.params + + #===================== + # Obsolete methods + #===================== + # + # SALOME 6.6.0 + # + + ## Sets lower boundary of mesh element size (PhySize). + def SetPhyMin(self, theVal=-1): + """ + Obsolete function. Use SetMinSize. + """ + print "Warning: SetPhyMin is obsolete. Please use SetMinSize" + self.SetMinSize(theVal) + pass + + ## Sets upper boundary of mesh element size (PhySize). + def SetPhyMax(self, theVal=-1): + """ + Obsolete function. Use SetMaxSize. + """ + print "Warning: SetPhyMax is obsolete. Please use SetMaxSize" + self.SetMaxSize(theVal) + pass + + ## Sets angular deflection (in degrees) of a mesh face from CAD surface. + def SetAngleMeshS(self, theVal=_geometric_approximation): + """ + Obsolete function. Use SetAngleMesh. + """ + print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh" + self.SetAngleMesh(theVal) + pass + + ## Sets angular deflection (in degrees) of a mesh edge from CAD curve. + def SetAngleMeshC(self, theVal=_geometric_approximation): + """ + Obsolete function. Use SetAngleMesh. + """ + print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh" + self.SetAngleMesh(theVal) + pass + + ## Sets lower boundary of mesh element size computed to respect angular deflection. + def SetGeoMin(self, theVal=-1): + """ + Obsolete function. Use SetMinSize. + """ + print "Warning: SetGeoMin is obsolete. Please use SetMinSize" + self.SetMinSize(theVal) + pass + + ## Sets upper boundary of mesh element size computed to respect angular deflection. + def SetGeoMax(self, theVal=-1): + """ + Obsolete function. Use SetMaxSize. + """ + print "Warning: SetGeoMax is obsolete. Please use SetMaxSize" + self.SetMaxSize(theVal) + pass + + + pass # end of BLSURF_Algorithm class diff --git a/src/BLSURFPlugin/BLSURFPluginDC.py b/src/BLSURFPlugin/BLSURFPluginDC.py deleted file mode 100644 index 0ae068d..0000000 --- a/src/BLSURFPlugin/BLSURFPluginDC.py +++ /dev/null @@ -1,489 +0,0 @@ -# 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 BLSURFPluginDC -# Python API for the BLSURF meshing plug-in module. - -from smesh_algorithm import Mesh_Algorithm -from smesh import AssureGeomPublished - -# Topology treatment way of BLSURF -FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3 - -# Element size flag of BLSURF -DefaultSize, DefaultGeom, BLSURF_GlobalSize, BLSURF_LocalSize = 0,0,1,2 -# Retrocompatibility -BLSURF_Custom, SizeMap = BLSURF_GlobalSize, BLSURF_LocalSize - - -# import BLSURFPlugin module if possible -noBLSURFPlugin = 0 -try: - import BLSURFPlugin -except ImportError: - noBLSURFPlugin = 1 - pass - -#---------------------------- -# Mesh algo type identifiers -#---------------------------- - -## Algorithm type: BLSurf triangle 2D algorithm, see BLSURF_Algorithm -BLSURF = "BLSURF" - -#---------------------- -# Algorithms -#---------------------- - -## BLSurf 2D algorithm. -# -# It can be created by calling smesh.Mesh.Triangle(smesh.BLSURF,geom=0) -# -class BLSURF_Algorithm(Mesh_Algorithm): - - ## name of the dynamic method in smesh.Mesh class - # @internal - meshMethod = "Triangle" - ## type of algorithm used with helper function in smesh.Mesh class - # @internal - algoType = BLSURF - ## doc string of the method - # @internal - docHelper = "Creates triangle 2D algorithm for faces" - - _anisotropic_ratio = 0 - _bad_surface_element_aspect_ratio = 1000 - _geometric_approximation = 22 - _gradation = 1.3 - _metric = "isotropic" - _remove_tiny_edges = 0 - - ## Private constructor. - # @param mesh parent mesh object algorithm is assigned to - # @param geom geometry (shape/sub-shape) algorithm is assigned to; - # if it is @c 0 (default), the algorithm is assigned to the main shape - def __init__(self, mesh, geom=0): - Mesh_Algorithm.__init__(self) - if noBLSURFPlugin: - print "Warning: BLSURFPlugin module unavailable" - self.Create(mesh, geom, BLSURF, "libBLSURFEngine.so") - self.params=None - #self.SetPhysicalMesh() - PAL19680 - pass - - ## Sets a way to define size of mesh elements to generate. - # @param thePhysicalMesh is: DefaultSize, BLSURF_Custom or SizeMap. - def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize): - physical_size_mode = thePhysicalMesh - if self.Parameters().GetGeometricMesh() == DefaultGeom: - if physical_size_mode == DefaultSize: - physical_size_mode = BLSURF_GlobalSize - self.Parameters().SetPhysicalMesh(physical_size_mode) - pass - - ## Sets a way to define maximum angular deflection of mesh from CAD model. - # @param theGeometricMesh is: DefaultGeom (0)) or BLSURF_GlobalSize (1)) - def SetGeometricMesh(self, theGeometricMesh=DefaultGeom): - geometric_size_mode = theGeometricMesh - if self.Parameters().GetPhysicalMesh() == DefaultSize: - if geometric_size_mode == DefaultGeom: - geometric_size_mode = BLSURF_GlobalSize - self.Parameters().SetGeometricMesh(geometric_size_mode) - pass - - ## Sets size of mesh elements to generate. - # @param theVal : constant global size when using a global physical size. - # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box - def SetPhySize(self, theVal, isRelative = False): - if self.Parameters().GetPhysicalMesh() == DefaultSize: - self.SetPhysicalMesh(BLSURF_GlobalSize) - if isRelative: - self.Parameters().SetPhySizeRel(theVal) - else: - self.Parameters().SetPhySize(theVal) - pass - - ## Sets lower boundary of mesh element size. - # @param theVal : global minimal cell size desired. - # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box - def SetMinSize(self, theVal=-1, isRelative = False): - if isRelative: - self.Parameters().SetMinSizeRel(theVal) - else: - self.Parameters().SetMinSize(theVal) - pass - - ## Sets upper boundary of mesh element size. - # @param theVal : global maximal cell size desired. - # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box - def SetMaxSize(self, theVal=-1): - if isRelative: - self.Parameters().SetMaxSizeRel(theVal) - else: - self.Parameters().SetMaxSize(theVal) - pass - - ## Sets angular deflection (in degrees) from CAD surface. - # @param theVal value of angular deflection - def SetAngleMesh(self, theVal=_geometric_approximation): - if self.Parameters().GetGeometricMesh() == DefaultGeom: - self.SetGeometricMesh(BLSURF_GlobalSize) - self.Parameters().SetAngleMesh(theVal) - pass - - ## Sets maximal allowed ratio between the lengths of two adjacent edges. - # @param theVal value of maximal length ratio - def SetGradation(self, theVal=_gradation): - if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation - self.Parameters().SetGradation(theVal) - pass - - ## Sets topology usage way. - # @param way defines how mesh conformity is assured - def SetTopology(self, way): - if way != PreCAD: - print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way - way = FromCAD - self.Parameters().SetTopology(way) - pass - - ## To respect geometrical edges or not. - # @param toIgnoreEdges "ignore edges" flag value - def SetDecimesh(self, toIgnoreEdges=False): - if toIgnoreEdges: - self.SetOptionValue("respect_geometry","0") - else: - self.SetOptionValue("respect_geometry","1") - pass - - ## Sets verbosity level in the range 0 to 100. - # @param level verbosity level - def SetVerbosity(self, level): - self.Parameters().SetVerbosity(level) - pass - - ## To optimize merges edges. - # @param toMergeEdges "merge edges" flag value - def SetPreCADMergeEdges(self, toMergeEdges=False): - if self.Parameters().GetTopology() != PreCAD: - self.SetTopology(PreCAD) - self.Parameters().SetPreCADMergeEdges(toMergeEdges) - pass - - ## To process 3D topology. - # @param toProcess "PreCAD process 3D" flag value - def SetPreCADProcess3DTopology(self, toProcess=False): - if self.Parameters().GetTopology() != PreCAD: - self.SetTopology(PreCAD) - self.Parameters().SetPreCADProcess3DTopology(toProcess) - pass - - ## To remove nano edges. - # @param toRemoveNanoEdges "remove nano edges" flag value - def SetPreCADRemoveNanoEdges(self, toRemoveNanoEdges=False): - if toRemoveNanoEdges: - self.SetPreCADOptionValue("remove_tiny_edges","1") - else: - self.SetPreCADOptionValue("remove_tiny_edges","0") - pass - - ## To compute topology from scratch - # @param toDiscardInput "discard input" flag value - def SetPreCADDiscardInput(self, toDiscardInput=False): - if self.Parameters().GetTopology() != PreCAD: - self.SetTopology(PreCAD) - self.Parameters().SetPreCADDiscardInput(toDiscardInput) - pass - - ## Sets the length below which an edge is considered as nano - # for the topology processing. - # @param epsNano nano edge length threshold value - def SetPreCADEpsNano(self, epsNano): - self.SetPreCADOptionValue("tiny_edge_length","%f"%epsNano) - pass - - ## Sets advanced option value. - # @param optionName advanced option name - # @param level advanced option value - def SetOptionValue(self, optionName, level): - self.Parameters().SetOptionValue(optionName,level) - pass - - ## Sets advanced PreCAD option value. - # @param optionName name of the option - # @param optionValue value of the option - def SetPreCADOptionValue(self, optionName, optionValue): - if self.Parameters().GetTopology() != PreCAD: - self.SetTopology(PreCAD) - self.Parameters().SetPreCADOptionValue(optionName,optionValue) - pass - - ## Sets GMF file for export at computation - # @param fileName GMF file name - def SetGMFFile(self, fileName): - self.Parameters().SetGMFFile(fileName) - pass - - #----------------------------------------- - # Enforced vertices (BLSURF) - #----------------------------------------- - - ## To get all the enforced vertices - def GetAllEnforcedVertices(self): - return self.Parameters().GetAllEnforcedVertices() - - ## To get all the enforced vertices sorted by face (or group, compound) - def GetAllEnforcedVerticesByFace(self): - return self.Parameters().GetAllEnforcedVerticesByFace() - - ## To get all the enforced vertices sorted by coords of input vertices - def GetAllEnforcedVerticesByCoords(self): - return self.Parameters().GetAllEnforcedVerticesByCoords() - - ## To get all the coords of input vertices sorted by face (or group, compound) - def GetAllCoordsByFace(self): - return self.Parameters().GetAllCoordsByFace() - - ## To get all the enforced vertices on a face (or group, compound) - # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex - def GetEnforcedVertices(self, theFace): - AssureGeomPublished( self.mesh, theFace ) - return self.Parameters().GetEnforcedVertices(theFace) - - ## To clear all the enforced vertices - def ClearAllEnforcedVertices(self): - return self.Parameters().ClearAllEnforcedVertices() - - ## To set an enforced vertex on a face (or group, compound) given the coordinates of a point. If the point is not on the face, it will projected on it. If there is no projection, no enforced vertex is created. - # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex - # @param x : x coordinate - # @param y : y coordinate - # @param z : z coordinate - # @param vertexName : name of the enforced vertex - # @param groupName : name of the group - def SetEnforcedVertex(self, theFace, x, y, z, vertexName = "", groupName = ""): - AssureGeomPublished( self.mesh, theFace ) - if vertexName == "": - if groupName == "": - return self.Parameters().SetEnforcedVertex(theFace, x, y, z) - else: - return self.Parameters().SetEnforcedVertexWithGroup(theFace, x, y, z, groupName) - pass - else: - if groupName == "": - return self.Parameters().SetEnforcedVertexNamed(theFace, x, y, z, vertexName) - else: - return self.Parameters().SetEnforcedVertexNamedWithGroup(theFace, x, y, z, vertexName, groupName) - pass - pass - - ## To set an enforced vertex on a face (or group, compound) given a GEOM vertex, group or compound. - # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex - # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace. - # @param groupName : name of the group - def SetEnforcedVertexGeom(self, theFace, theVertex, groupName = ""): - AssureGeomPublished( self.mesh, theFace ) - AssureGeomPublished( self.mesh, theVertex ) - if groupName == "": - return self.Parameters().SetEnforcedVertexGeom(theFace, theVertex) - else: - return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName) - pass - - ## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates. - # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex - # @param x : x coordinate - # @param y : y coordinate - # @param z : z coordinate - def UnsetEnforcedVertex(self, theFace, x, y, z): - AssureGeomPublished( self.mesh, theFace ) - return self.Parameters().UnsetEnforcedVertex(theFace, x, y, z) - - ## To remove an enforced vertex on a given GEOM face (or group, compound) given a GEOM vertex, group or compound. - # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex - # @param theVertex : GEOM vertex (or group, compound) to remove. - def UnsetEnforcedVertexGeom(self, theFace, theVertex): - AssureGeomPublished( self.mesh, theFace ) - AssureGeomPublished( self.mesh, theVertex ) - return self.Parameters().UnsetEnforcedVertexGeom(theFace, theVertex) - - ## To remove all enforced vertices on a given face. - # @param theFace : face (or group/compound of faces) on which to remove all enforced vertices - def UnsetEnforcedVertices(self, theFace): - AssureGeomPublished( self.mesh, theFace ) - return self.Parameters().UnsetEnforcedVertices(theFace) - - ## To tell BLSURF to add a node on internal vertices - # @param toEnforceInternalVertices : boolean; if True the internal vertices are added as enforced vertices - def SetInternalEnforcedVertexAllFaces(self, toEnforceInternalVertices): - return self.Parameters().SetInternalEnforcedVertexAllFaces(toEnforceInternalVertices) - - ## To know if BLSURF will add a node on internal vertices - def GetInternalEnforcedVertexAllFaces(self): - return self.Parameters().GetInternalEnforcedVertexAllFaces() - - ## To define a group for the nodes of internal vertices - # @param groupName : string; name of the group - def SetInternalEnforcedVertexAllFacesGroup(self, groupName): - return self.Parameters().SetInternalEnforcedVertexAllFacesGroup(groupName) - - ## To get the group name of the nodes of internal vertices - def GetInternalEnforcedVertexAllFacesGroup(self): - return self.Parameters().GetInternalEnforcedVertexAllFacesGroup() - - #----------------------------------------- - # Attractors - #----------------------------------------- - - ## Sets an attractor on the chosen face. The mesh size will decrease exponentially with the distance from theAttractor, following the rule h(d) = theEndSize - (theEndSize - theStartSize) * exp [ - ( d / theInfluenceDistance ) ^ 2 ] - # @param theFace : face on which the attractor will be defined - # @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially - # @param theStartSize : mesh size on theAttractor - # @param theEndSize : maximum size that will be reached on theFace - # @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high) - # @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace - def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance): - AssureGeomPublished( self.mesh, theFace ) - AssureGeomPublished( self.mesh, theAttractor ) - self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance) - pass - - ## Unsets an attractor on the chosen face. - # @param theFace : face on which the attractor has to be removed - def UnsetAttractorGeom(self, theFace): - AssureGeomPublished( self.mesh, theFace ) - self.Parameters().SetAttractorGeom(theFace) - pass - - #----------------------------------------- - # Size maps (BLSURF) - #----------------------------------------- - - ## To set a size map on a face, edge or vertex (or group, compound) given Python function. - # If theObject is a face, the function can be: def f(u,v): return u+v - # If theObject is an edge, the function can be: def f(t): return t/2 - # If theObject is a vertex, the function can be: def f(): return 10 - # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map - # @param theSizeMap : Size map defined as a string - def SetSizeMap(self, theObject, theSizeMap): - AssureGeomPublished( self.mesh, theObject ) - self.Parameters().SetSizeMap(theObject, theSizeMap) - pass - - ## To set a constant size map on a face, edge or vertex (or group, compound). - # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map - # @param theSizeMap : Size map defined as a double - def SetConstantSizeMap(self, theObject, theSizeMap): - AssureGeomPublished( self.mesh, theObject ) - self.Parameters().SetConstantSizeMap(theObject, theSizeMap) - - ## To remove a size map defined on a face, edge or vertex (or group, compound) - # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map - def UnsetSizeMap(self, theObject): - AssureGeomPublished( self.mesh, theObject ) - self.Parameters().UnsetSizeMap(theObject) - pass - - ## To remove all the size maps - def ClearSizeMaps(self): - self.Parameters().ClearSizeMaps() - pass - - ## Sets QuadAllowed flag. - # @param toAllow "allow quadrangles" flag value - def SetQuadAllowed(self, toAllow=True): - self.Parameters().SetQuadAllowed(toAllow) - pass - - ## Defines hypothesis having several parameters - # @return hypothesis object - def Parameters(self): - if not self.params: - self.params = self.Hypothesis("BLSURF_Parameters", [], - "libBLSURFEngine.so", UseExisting=0) - pass - return self.params - - #===================== - # Obsolete methods - #===================== - # - # SALOME 6.6.0 - # - - ## Sets lower boundary of mesh element size (PhySize). - def SetPhyMin(self, theVal=-1): - """ - Obsolete function. Use SetMinSize. - """ - print "Warning: SetPhyMin is obsolete. Please use SetMinSize" - self.SetMinSize(theVal) - pass - - ## Sets upper boundary of mesh element size (PhySize). - def SetPhyMax(self, theVal=-1): - """ - Obsolete function. Use SetMaxSize. - """ - print "Warning: SetPhyMax is obsolete. Please use SetMaxSize" - self.SetMaxSize(theVal) - pass - - ## Sets angular deflection (in degrees) of a mesh face from CAD surface. - def SetAngleMeshS(self, theVal=_geometric_approximation): - """ - Obsolete function. Use SetAngleMesh. - """ - print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh" - self.SetAngleMesh(theVal) - pass - - ## Sets angular deflection (in degrees) of a mesh edge from CAD curve. - def SetAngleMeshC(self, theVal=_geometric_approximation): - """ - Obsolete function. Use SetAngleMesh. - """ - print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh" - self.SetAngleMesh(theVal) - pass - - ## Sets lower boundary of mesh element size computed to respect angular deflection. - def SetGeoMin(self, theVal=-1): - """ - Obsolete function. Use SetMinSize. - """ - print "Warning: SetGeoMin is obsolete. Please use SetMinSize" - self.SetMinSize(theVal) - pass - - ## Sets upper boundary of mesh element size computed to respect angular deflection. - def SetGeoMax(self, theVal=-1): - """ - Obsolete function. Use SetMaxSize. - """ - print "Warning: SetGeoMax is obsolete. Please use SetMaxSize" - self.SetMaxSize(theVal) - pass - - - pass # end of BLSURF_Algorithm class \ No newline at end of file diff --git a/src/BLSURFPlugin/Makefile.am b/src/BLSURFPlugin/Makefile.am index efa0fc4..1b920a6 100644 --- a/src/BLSURFPlugin/Makefile.am +++ b/src/BLSURFPlugin/Makefile.am @@ -73,4 +73,8 @@ libBLSURFEngine_la_LDFLAGS = \ $(BOOST_LIB_REGEX) # Scripts to be installed. -dist_salomescript_DATA= BLSURFPluginDC.py +#dist_salomescript_DATA= BLSURFPluginDC.py +mypkgpythondir = $(salomepythondir)/salome/BLSURFPlugin +mypkgpython_PYTHON = \ + __init__.py \ + BLSURFPluginBuilder.py diff --git a/src/BLSURFPlugin/__init__.py b/src/BLSURFPlugin/__init__.py new file mode 100644 index 0000000..2c6cf4f --- /dev/null +++ b/src/BLSURFPlugin/__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 BLSURFPluginBuilder +# Python API for the BLSURF meshing plug-in module.