From c53cbf459a20b27706080228c1b4d21cd4a036d2 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 22 Aug 2012 11:30:22 +0000 Subject: [PATCH] 0021308: EDF 1923 SMESH: Remove hard-coded dependency of the external mesh plugins from the SMESH module * Improve documentation for meshing plug-ins (in particular, dynamically added methods) --- doc/salome/gui/GHS3DPLUGIN/Makefile.am | 17 +- doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in | 4 +- .../gui/GHS3DPLUGIN/input/ghs3d_hypo.doc | 166 ++++++++---------- .../input/ghs3dplugin_python_interface.doc | 23 +-- doc/salome/gui/GHS3DPLUGIN/input/index.doc | 12 +- src/GHS3DPlugin/GHS3DPluginDC.py | 103 ++++++++--- 6 files changed, 180 insertions(+), 145 deletions(-) diff --git a/doc/salome/gui/GHS3DPLUGIN/Makefile.am b/doc/salome/gui/GHS3DPLUGIN/Makefile.am index dfe458e..3ebe707 100755 --- a/doc/salome/gui/GHS3DPLUGIN/Makefile.am +++ b/doc/salome/gui/GHS3DPLUGIN/Makefile.am @@ -23,16 +23,15 @@ EXTRA_DIST += images input static/footer.html static/doxygen.css guidocdir = $(docdir)/gui/GHS3DPLUGIN guidoc_DATA = images/head.png +DOC_PYTHONPATH=$(prefix)/bin/salome:$(SMESH_ROOT_DIR)/bin/salome:$(SMESH_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(MED_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GEOM_ROOT_DIR)/bin/salome:$(GEOM_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages +DOC_SMESH_MeshersList=GHS3DPlugin -usr_docs: doxyfile - echo "===========================================" ; \ - echo "Generating Python interface documentation"; \ - echo "===========================================" ; \ - $(DOXYGEN) doxyfile_py \ - echo "===========================================" ; \ - echo "Generating GUI documentation" ; \ - echo "===========================================" ; \ - $(DOXYGEN) doxyfile ; +smesh.py: $(top_srcdir)/src/GHS3DPlugin/GHS3DPluginDC.py + @PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py -d -o $@ GHS3DPlugin + +usr_docs: doxyfile_py doxyfile smesh.py + @$(DOXYGEN) doxyfile_py ; \ + $(DOXYGEN) doxyfile docs: usr_docs diff --git a/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in b/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in index 47082b5..d43b169 100755 --- a/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in +++ b/doc/salome/gui/GHS3DPLUGIN/doxyfile_py.in @@ -96,7 +96,7 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = @top_srcdir@/src/GHS3DPlugin/GHS3DPluginDC.py +INPUT = @top_srcdir@/src/GHS3DPlugin/GHS3DPluginDC.py smesh.py FILE_PATTERNS = IMAGE_PATH = @srcdir@/images RECURSIVE = NO @@ -156,4 +156,4 @@ DOT_CLEANUP = YES #External reference options #--------------------------------------------------------------------------- GENERATE_TAGFILE = ghs3dpluginpy_doc.tag -SEARCHENGINE = YES \ No newline at end of file +SEARCHENGINE = YES diff --git a/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc b/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc index f5d528b..8b544ed 100644 --- a/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc +++ b/doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc @@ -3,41 +3,38 @@ \page ghs3d_hypo_page GHS3D Parameters hypothesis \anchor ghs3d_top -\n GHS3D Parameters hypothesis works only with Tetrahedron (GHS3D) +GHS3D Parameters hypothesis works only with Tetrahedron (GHS3D) algorithm. This algorithm is a commercial software. -\n To get a licence, visit http://www.distene.com/corp/eval-distene.html --# \ref ghs3d_general_parameters --# \ref ghs3d_advanced_parameters --# \ref ghs3d_enforced_vertices --# \ref ghs3d_enforced_meshes +To get a licence, visit http://www.distene.com/corp/eval-distene.html + +\tableofcontents \section ghs3d_general_parameters General parameters \image html ghs3d_parameters_basic.png - +to the solid. + +- Optimization level - allows choosing the required +optimization level (higher level of optimisation provides better mesh, +but can be time-consuming): + + - none + + - light + + - medium (standard) + + - standard+ + + - strong \ref ghs3d_top "Back to top" @@ -45,36 +42,38 @@ optimisation provides better mesh, but can be time-consuming. \image html ghs3d_parameters_advanced.png -
  • Maximum memory size - launches ghs3d software with +- Maximum memory size - launches ghs3d software with work space limited to the specified amount of RAM, in Mbytes. If this option is -checked off, the software will be launched with 7O% of the total RAM space.
  • +checked off, the software will be launched with 7O% of the total RAM space. -
  • Initial memory size - starts ghs3d software with +- Initial memory size - starts ghs3d software with the specified amount of work space, in Mbytes. If this option is checked off, the -software will be started with 100 Megabytes of working space.
  • +software will be started with 100 Megabytes of working space. -
  • Working directory - allows defining the folder for input and output -files of ghs3d software, which are the files starting with "GHS3D_" prefix.
  • +- Working directory - allows defining the folder for input and output +files of ghs3d software, which are the files starting with "GHS3D_" prefix. -
  • Keep working files - allows checking input and output files +- Keep working files - allows checking input and output files of ghs3d software, while usually these files are removed after the -launch of the mesher.
  • +launch of the mesher. -
  • Verbose level - to choose verbosity level in the range from +- Verbose level - to choose verbosity level in the range from 0 to 10. -
  • - -
  • To create new nodes - if this option is checked off, ghs3d -tries to create tetrahedrons using only the nodes of the 2D mesh.
  • - -
  • To remove the initial central point TetMesh-GHS3D adds an internal point + + - 0, no standard output, + + - 2, prints the data, quality statistics of the skin and final + meshes and indicates when the final mesh is being saved. In addition + the software gives indication regarding the CPU time. + + - 10, same as 2 plus the main steps in the computation, quality + statistics histogram of the skin mesh, quality statistics histogram + together with the characteristics of the final mesh. + +- To create new nodes - if this option is checked off, ghs3d +tries to create tetrahedrons using only the nodes of the 2D mesh. + +- To remove the initial central point TetMesh-GHS3D adds an internal point at the gravity centre of the bounding box to speed up and to simplify the meshing process. However, it is possible to refrain from creating this point by using the command line option -no initial central point. This can be @@ -86,18 +85,18 @@ Use this option if the boundary regeneration has failed with the standard parame the recovery version (command line option -C). Note: when using this option, the speed of the meshing process may decrease, and the quality may change. -Note: the boundary regeneration may fail with this option, in some rare cases.
  • +Note: the boundary regeneration may fail with this option, in some rare cases. -
  • To use boundary recovery version - enables using a +- To use boundary recovery version - enables using a boundary recovery module which tries to create volume meshes starting from very poor quality surface meshes (almost flat triangles on the surface, high density propagation, extreme aspect ratios, etc.) which fails with the standard version. The resulting volume mesh will however most likely have a very poor quality (poor aspect ratio of elements, tetrahedra with a very small -positive volume).
  • +positive volume). -
  • To use FEM correction - Applies finite-element correction by +- To use FEM correction - Applies finite-element correction by replacing overconstrained elements where it is possible. At first the process slices the overconstrained edges and at second the overconstrained facets. This ensures that there are no edges with two boundary @@ -106,12 +105,10 @@ and final overconstrained edges and facets. It also gives the facets which have three edges on the boundary. Note: when using this option, the speed of the meshing process may decrease, quality may change, and the smallest volume may be smaller. -By default, the FEM correction is not used.
  • +By default, the FEM correction is not used. -
  • Option as text - allows to input in the command line any text -for ghs3d, for example, advanced options.
  • - - +- Option as text - allows to input in the command line any text +for ghs3d, for example, advanced options. \ref ghs3d_top "Back to top" @@ -119,11 +116,10 @@ for ghs3d, for example, advanced options. \note This feature is currently partially available only on meshes with no geometry attached. Such meshes can be obtained by - +- Copying an existing mesh +- Importing a mesh from file +- Applying a transformation to a mesh a get result in a new mesh +. See below for more details. \image html ghs3d_enforced_vertices.png @@ -133,50 +129,40 @@ define enforced vertices in the volume where the mesh will be detailed. A node will be created at the enforced vertex coordinates. An enforced vertex is defined by: - +- A vertex + - from GEOM (Vertex, Compound) - only avaible on meshes with no + geometry attached + - or from (x,y,z) cartesian coordinates +- A constant physical size +- If a group name is given, the created node will be added to the +group. If the group does not exist, it is created. + \ref ghs3d_top "Back to top" \section ghs3d_enforced_meshes Enforced Meshes \note This feature is currently only available on 2D meshes with no geometry attached. Such meshes can be obtained by - +- Copying an existing 2D mesh +- Importing a 2D mesh from file +- Applying a transformation to a 2D mesh a get result in a new mesh \image html ghs3d_enforced_meshes.png GHS3D algorithm can be forced by other meshes, sub-meshes or groups. The constraint elements should be contained entirely into the solid mesh. - +- The constraint element types are: + - NODE + - EDGE + - FACE +- If a size is given, the mesh will be refined around the enforced +elements given the size (not available yet) +- If a group name is given, the enforced elements will be added to +the group. If the group does not exist, it is created.
    See Also a sample TUI Script of the \ref tui_ghs3d "creation of a Ghs3D hypothesis", including enforced vertices and meshes. \ref ghs3d_top "Back to top" - */ diff --git a/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc b/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc index 09825c1..2a394ca 100644 --- a/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc +++ b/doc/salome/gui/GHS3DPLUGIN/input/ghs3dplugin_python_interface.doc @@ -2,22 +2,19 @@ \page ghs3dplugin_python_interface_page Python Interface -Python package \ref GHS3DPluginDC "GHS3DPlugin" defines several classes, destined for creation of the 3D meshes. +Python package GHS3DPluginDC defines several classes, destined for creation of the 3D meshes. -Documentation for GHS3DPlugin package is available in linear form grouped by classes, declared in the GHS3DPluginDC.py file. +BLSURF meshing plugin dynamically adds several methods to the smesh.Mesh class to create meshing algorithms. -Below you can see an example of usage of the GHS3DPlugin package for mesh generation: +Below you can see an example of usage of the GHS3DPlugin Python API for mesh generation: \anchor tui_ghs3d -
      -
    1. \ref tui_ghs3d_basic "Construction of Mesh using Ghs3D algorithm"
    2. -
    3. \ref tui_ghs3d_enforced_vertices "Adding enforced vertices"
    4. -
    5. \ref tui_ghs3d_enforced_meshes "Adding enforced mesh"
    6. -
    +-# \ref tui_ghs3d_basic "Construction of Mesh using Ghs3D algorithm" +-# \ref tui_ghs3d_enforced_vertices "Adding enforced vertices" +-# \ref tui_ghs3d_enforced_meshes "Adding enforced mesh" -\anchor tui_ghs3d_basic -

    Construction of Mesh using Ghs3D algorithm

    +\section tui_ghs3d_basic Construction of Mesh using Ghs3D algorithm \code import geompy @@ -46,8 +43,7 @@ ghs3dMesh.Compute() \ref tui_ghs3d "Back to top" -\anchor tui_ghs3d_enforced_vertices -

    Adding enforced vertices

    +\section tui_ghs3d_enforced_vertices Adding enforced vertices \code @@ -121,8 +117,7 @@ GHS3D_Parameters.ClearEnforcedVertices() \ref tui_ghs3d "Back to top" -\anchor tui_ghs3d_enforced_meshes -

    Adding enforced mesh

    +\section tui_ghs3d_enforced_meshes Adding enforced mesh \code diff --git a/doc/salome/gui/GHS3DPLUGIN/input/index.doc b/doc/salome/gui/GHS3DPLUGIN/input/index.doc index e39ba6d..02d8150 100644 --- a/doc/salome/gui/GHS3DPLUGIN/input/index.doc +++ b/doc/salome/gui/GHS3DPLUGIN/input/index.doc @@ -2,17 +2,13 @@ \mainpage Introduction to GHS3DPLUGIN +\b GHS3DPLUGIN plugin is destined for: +- Meshing 3D geometric entities: volumes are split into tetrahedral (pyramidal) elements. +- Generating 3D meshes from 2D meshes, working without geometrical objects. + \note GHS3DPLUGIN plugin used GHS3D commercial mesher and require a license to be used within the Mesh module. -\n \b GHS3DPLUGIN plugin is destined for: - - - To manage parameters of the GHS3DPLUGIN use \subpage ghs3d_hypo_page and \subpage additional_hypo_page Also all GHS3DPLUGIN functionalities are accessible via diff --git a/src/GHS3DPlugin/GHS3DPluginDC.py b/src/GHS3DPlugin/GHS3DPluginDC.py index adc2dd9..93ec39b 100644 --- a/src/GHS3DPlugin/GHS3DPluginDC.py +++ b/src/GHS3DPlugin/GHS3DPluginDC.py @@ -17,6 +17,15 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +## +# @package GHS3DPluginDC +# Python API for the GHS3D meshing plug-in module. + +## +# @package smesh +# Documentation of the methods dynamically added by the GHS3D meshing plug-in to the +# smesh.Mesh class. + from smesh import Mesh_Algorithm, AssureGeomPublished # import GHS3DPlugin module if possible @@ -33,92 +42,132 @@ None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization # V4.1 (partialy redefines V3.1). Issue 0020574 None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4 +#---------------------------- +# Mesh algo type identifiers +#---------------------------- + +## Algorithm type: GHS3D tetrahedron 3D algorithm, see GHS3D_Algorithm GHS3D = "GHS3D_3D" ## Tetrahedron GHS3D 3D algorithm -# It is created by calling Mesh.Tetrahedron( GHS3D, geom=0 ) -# +# +# It can be created by calling smesh.Mesh.Tetrahedron( smesh.GHS3D, geom=0 ) class GHS3D_Algorithm(Mesh_Algorithm): + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Tetrahedron" + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = GHS3D + ## doc string of the method in smesh.Mesh class + # @internal + docHelper = "Creates tetrahedron 3D algorithm for volumes" ## 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 noGHS3DPlugin: print "Warning: GHS3DPlugin module unavailable" self.Create(mesh, geom, self.algoType, "libGHS3DEngine.so") self.params = None + pass ## Defines hypothesis having several parameters - # + # @return hypothesis object def Parameters(self): if not self.params: self.params = self.Hypothesis("GHS3D_Parameters", [], "libGHS3DEngine.so", UseExisting=0) + pass return self.params ## To mesh "holes" in a solid or not. Default is to mesh. - # + # @param toMesh "mesh holes" flag value def SetToMeshHoles(self, toMesh): self.Parameters().SetToMeshHoles(toMesh) + pass ## Set Optimization level: - # None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, - # Strong_Optimization. - # Default is Standard_Optimization + # @param level optimization level, one of the following values + # - None_Optimization + # - Light_Optimization + # - Standard_Optimization + # - StandardPlus_Optimization + # - Strong_Optimization. + # . + # Default is Standard_Optimization def SetOptimizationLevel(self, level): self.Parameters().SetOptimizationLevel(level) + pass - ## Maximal size of memory to be used by the algorithm (in Megabytes). - # + ## Set maximal size of memory to be used by the algorithm (in Megabytes). + # @param MB maximal size of memory def SetMaximumMemory(self, MB): self.Parameters().SetMaximumMemory(MB) + pass - ## Initial size of memory to be used by the algorithm (in Megabytes) in + ## Set initial size of memory to be used by the algorithm (in Megabytes) in # automatic memory adjustment mode. + # @param MB initial size of memory def SetInitialMemory(self, MB): self.Parameters().SetInitialMemory(MB) + pass - ## Path to working directory. - # + ## Set path to working directory. + # @param path working directory def SetWorkingDirectory(self, path): self.Parameters().SetWorkingDirectory(path) + pass ## To keep working files or remove them. Log file remains in case of errors anyway. + # @param toKeep "keep working files" flag value def SetKeepFiles(self, toKeep): self.Parameters().SetKeepFiles(toKeep) - - ## To set verbose level [0-10]. + pass + + ## Set verbosity level [0-10]. + # @param level verbosity level + # - 0 - no standard output, + # - 2 - prints the data, quality statistics of the skin and final meshes and + # indicates when the final mesh is being saved. In addition the software + # gives indication regarding the CPU time. + # - 10 - same as 2 plus the main steps in the computation, quality statistics + # histogram of the skin mesh, quality statistics histogram together with + # the characteristics of the final mesh. def SetVerboseLevel(self, level): self.Parameters().SetVerboseLevel(level) + pass ## To create new nodes. + # @param toCreate "create new nodes" flag value def SetToCreateNewNodes(self, toCreate): self.Parameters().SetToCreateNewNodes(toCreate) + pass ## To use boundary recovery version which tries to create mesh on a very poor # quality surface mesh. + # @param toUse "use boundary recovery version" flag value def SetToUseBoundaryRecoveryVersion(self, toUse): self.Parameters().SetToUseBoundaryRecoveryVersion(toUse) + pass ## Applies finite-element correction by replacing overconstrained elements where # it is possible. The process is cutting first the overconstrained edges and # second the overconstrained facets. This insure that no edges have two boundary # vertices and that no facets have three boundary vertices. + # @param toUseFem "apply finite-element correction" flag value def SetFEMCorrection(self, toUseFem): self.Parameters().SetFEMCorrection(toUseFem) + pass - ## To removes initial central point. + ## To remove initial central point. + # @param toRemove "remove initial central point" flag value def SetToRemoveCentralPoint(self, toRemove): self.Parameters().SetToRemoveCentralPoint(toRemove) + pass ## To set an enforced vertex. # @param x : x coordinate @@ -133,11 +182,14 @@ class GHS3D_Algorithm(Mesh_Algorithm): return self.Parameters().SetEnforcedVertex(x, y, z, size) else: return self.Parameters().SetEnforcedVertexWithGroup(x, y, z, size, groupName) + pass else: if groupName == "": return self.Parameters().SetEnforcedVertexNamed(x, y, z, size, vertexName) else: return self.Parameters().SetEnforcedVertexNamedWithGroup(x, y, z, size, vertexName, groupName) + pass + pass ## To set an enforced vertex given a GEOM vertex, group or compound. # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace. @@ -149,6 +201,7 @@ class GHS3D_Algorithm(Mesh_Algorithm): return self.Parameters().SetEnforcedVertexGeom(theVertex, size) else: return self.Parameters().SetEnforcedVertexGeomWithGroup(theVertex, size, groupName) + pass ## To remove an enforced vertex. # @param x : x coordinate @@ -174,13 +227,19 @@ class GHS3D_Algorithm(Mesh_Algorithm): return self.Parameters().SetEnforcedMesh(theSource, elementType) else: return self.Parameters().SetEnforcedMeshWithGroup(theSource, elementType, groupName) + pass else: if groupName == "": return self.Parameters().SetEnforcedMeshSize(theSource, elementType, size) else: return self.Parameters().SetEnforcedMeshSizeWithGroup(theSource, elementType, size, groupName) + pass + pass ## Sets command line option as text. + # @param option command line option def SetTextOption(self, option): self.Parameters().SetTextOption(option) + pass + pass # end of GHS3D_Algorithm class -- 2.39.2