From 9423cdc0efcb6144155c045ef822ef0e86db0cfe Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 21 Aug 2012 13:15:16 +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/SMESH/Makefile.am | 31 +- doc/salome/gui/SMESH/collect_mesh_methods.py | 114 ++++++ doc/salome/gui/SMESH/doxyfile_py.in | 2 +- .../gui/SMESH/input/smeshpy_interface.doc | 47 +-- src/SMESH_SWIG/StdMeshersDC.py | 377 ++++++++++++------ src/SMESH_SWIG/smeshDC.py | 6 +- 6 files changed, 417 insertions(+), 160 deletions(-) create mode 100755 doc/salome/gui/SMESH/collect_mesh_methods.py diff --git a/doc/salome/gui/SMESH/Makefile.am b/doc/salome/gui/SMESH/Makefile.am index cc3ddb251..fa493ed73 100755 --- a/doc/salome/gui/SMESH/Makefile.am +++ b/doc/salome/gui/SMESH/Makefile.am @@ -26,25 +26,26 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am EXTRA_DIST += images input static/footer.html static/doxygen.css +dist_salomescript_DATA = collect_mesh_methods.py + guidocdir = $(docdir)/gui/SMESH guidoc_DATA = images/head.png +DOC_PYTHONPATH=$(prefix)/bin/salome:$(prefix)/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=StdMeshers + +# to have smesh.py in the documentation instead of smeshDC.py +# we create dummy smesh.py from the smeshDC.py +smesh.py: ../../../../src/SMESH_SWIG/smeshDC.py + @awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \ + $< > $@ + +tmp/smesh.py: $(top_srcdir)/src/SMESH_SWIG/StdMeshersDC.py $(srcdir)/collect_mesh_methods.py + @$(MKDIR_P) tmp && PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(srcdir)/collect_mesh_methods.py -o $@ StdMeshers -usr_docs: doxyfile_py doxyfile - echo "===========================================" ; \ - echo "Replacing smeshDC by smesh" ; \ - echo "===========================================" ; \ - awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \ - $(top_srcdir)/src/SMESH_SWIG/smeshDC.py > ./smesh.py ; \ - echo "===========================================" ; \ - echo "Generating Python interface documentation"; \ - echo "===========================================" ; \ - $(DOXYGEN) doxyfile_py ; \ - echo "===========================================" ; \ - echo "Generating GUI documentation" ; \ - echo "===========================================" ; \ - $(DOXYGEN) doxyfile ; \ - rm -f ./smesh.py +usr_docs: doxyfile_py doxyfile smesh.py tmp/smesh.py + @$(DOXYGEN) doxyfile_py ; \ + $(DOXYGEN) doxyfile docs: usr_docs diff --git a/doc/salome/gui/SMESH/collect_mesh_methods.py b/doc/salome/gui/SMESH/collect_mesh_methods.py new file mode 100755 index 000000000..278ce2017 --- /dev/null +++ b/doc/salome/gui/SMESH/collect_mesh_methods.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +################################################################################# +# +# File: collect_mesh_methods.py +# Author: Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com) +# +################################################################################# +# +# Extraction of the meshing algorithm classes +# dynamically added by the plug-in to the Mesh +# class. +# +# This script is intended for internal usage - only +# for generatation of the extra developer documentation for +# the meshing plug-in(s). +# +# Usage: +# collect_mesh_methods.py +# where +# is a name of the plug-in module +# +# Notes: +# - the script is supposed to be run in correct environment +# i.e. PYTHONPATH, SMESH_MeshersList and other important +# variables are set properly; otherwise the script will fail. +# +################################################################################ + +import sys + +def main(plugin, dummymeshhelp = True, output_file = "smesh.py"): + plugin_module = plugin + "DC" + try: + mod = __import__(plugin_module) + methods = {} + for attr in dir( mod ): + if attr.startswith( '_' ): continue + algo = getattr( mod, attr ) + if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ): + method = getattr( algo, "meshMethod" ) + if method not in methods: methods[ method ] = [] + methods[ method ].append( algo ) + pass + pass + if methods: + output = [] + if dummymeshhelp: + # Add dummy Mesh help + # This is supposed to be done when generating documentation for meshing plug-ins + output.append( "## This class allows defining and managing a mesh." ) + output.append( "#" ) + output.append( "# @note The documentation below does not provide complete description of class @b %Mesh" ) + output.append( "# from @b %smesh.py package. This documentation provides only information about" ) + output.append( "# the methods dynamically added to the %Mesh class by the " + plugin + " plugin" ) + output.append( "# For more details on the %Mesh class, please refer to the SALOME %Mesh module" ) + output.append( "# documentation." ) + pass + else: + # Extend documentation for Mesh class with information about dynamically added methods. + # This is supposed to be done only when building documentation for SMESH module + output.append( "## This class allows defining and managing a mesh." ) + output.append( "#" ) + output.append( "# @note Some methods are dynamically added to the @b %Mesh class in runtime by meshing " ) + output.append( "# plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " ) + output.append( "# try to look into the documentation for the meshing plug-ins." ) + pass + output.append( "class Mesh:" ) + for method in methods: + docHelper = "" + for algo in methods[ method ]: + if hasattr( algo, "docHelper" ): docHelper = getattr( algo, "docHelper" ) + if docHelper: break + pass + if not docHelper: docHelper = "Creates new algorithm." + output.append( " ## %s." % docHelper ) + output.append( " # This method is dynamically added to %Mesh class by the meshing plug-in(s). " ) + output.append( " #" ) + output.append( " # If the optional @a geom_shape parameter is not set, this algorithm is global (applied to whole mesh)." ) + output.append( " # Otherwise, this algorithm defines a submesh based on @a geom_shape subshape." ) + output.append( " # @param algo_type type of algorithm to be created; allowed values are specified by classes implemented by plug-in (see below)" ) + output.append( " # @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" ) + output.append( " # @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type:" ) + output.append( " # %s" % ", ".join( [ "%s.%s" % ( plugin_module, algo.__name__ ) for algo in methods[ method ] ] ) ) + output.append( " def %s(algo_type, geom_shape=0):" % method ) + output.append( " pass" ) + pass + f = open(output_file, "w") + for line in output: f.write( line + "\n" ) + f.close() + pass + pass + except Exception, e: + print e + pass + pass + +if __name__ == "__main__": + import optparse + parser = optparse.OptionParser(usage="%prog [options] plugin") + h = "Output file (smesh.py by default)" + parser.add_option("-o", "--output", dest="output", + action="store", default=None, metavar="file", + help=h) + h = "If this option is True, dummy help for Mesh class is added. " + h += "This option should be False (default) when building documentation for SMESH module " + h += "and True when building documentation for meshing plug-ins." + parser.add_option("-d", "--dummy-mesh-help", dest="dummymeshhelp", + action="store_true", default=False, + help=h) + (options, args) = parser.parse_args() + + if len( args ) < 1: sys.exit("Plugin name is not specified") + main( args[0], options.dummymeshhelp, options.output ) + pass diff --git a/doc/salome/gui/SMESH/doxyfile_py.in b/doc/salome/gui/SMESH/doxyfile_py.in index 19e21b96e..068df6213 100755 --- a/doc/salome/gui/SMESH/doxyfile_py.in +++ b/doc/salome/gui/SMESH/doxyfile_py.in @@ -99,7 +99,7 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = smesh.py @top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py +INPUT = smesh.py @top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py tmp/smesh.py FILE_PATTERNS = IMAGE_PATH = @srcdir@/images RECURSIVE = NO diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index e725ef99c..29ff056b7 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -2,44 +2,37 @@ \page smeshpy_interface_page Python interface -Python package smesh defines several classes, destined for easy and -clear mesh creation and edition. +Python API for SALOME %Mesh module defines several classes that can +be used for easy mesh creation and edition. -Documentation for smesh package is available in two forms: - -The structured -documentation for smesh package, where all methods and +Documentation for SALOME %Mesh module Python API is available in two forms: +- Structured documentation, where all methods and classes are grouped by their functionality, like it is done in the GUI documentation -and the \ref smeshDC "linear documentation for smesh package" -grouped only by classes, declared in the smesh.py file. - -The main page of the \ref smeshDC "linear documentation for smesh package" -contains a list of data structures and a list of -functions, provided by the package smesh.py. The first item in -the list of data structures (\ref smeshDC::smeshDC "class smesh") -also represents documentation for the methods of the package smesh.py itself. +- Linear documentation grouped only by classes, declared +in the \ref smesh and StdMeshersDC Python packages. -The package smesh.py provides an interface to create and handle -meshes. Use it to create an empty mesh or to import it from the data file. +Python package \ref smesh provides an interface to create and handle +meshes. It can be used to create an empty mesh or to import mesh from the data file. -Once a mesh has been created, it is possible to manage it via its own -methods, described at \ref smeshDC::Mesh "class Mesh" documentation -(it is also accessible by the second item "class Mesh" in the list of data structures). +As soon as mesh is created, it is possible to manage it via its own +methods, described in \ref smesh.Mesh "class Mesh" documentation. -Class \b Mesh allows assigning algorithms to a mesh. -Please note, that some algorithms, included in the standard SALOME -distribution are always available: +Class \ref smesh.Mesh "Mesh" allows assigning algorithms to a mesh. +Please note that some algorithms, included in the standard SALOME +distribution are always available. Python package \ref StdMeshersDC +provides an interface for standard meshing algorithms included into +the SALOME %Mesh module distribution, like: - REGULAR (1D) - COMPOSITE (1D) - MEFISTO (2D) - Quadrangle (2D) - Hexa(3D) -- etc... +- etc ... -To add hypotheses, use the interfaces, provided by the assigned -algorithms. +To add meshing hypotheses, it is possible to use the functions provided by the +algorithms interfaces. -Below you can see an example of usage of the package smesh for 3d mesh generation. +An example below demonstrates usage of the Python API for 3d mesh generation. \anchor example_3d_mesh

Example of 3d mesh generation:

@@ -118,7 +111,7 @@ tetra.Group(group) \endcode -Examples of Python scripts for all Mesh operations are available by +Examples of Python scripts for Mesh operations are available by the following links: - \subpage tui_creating_meshes_page diff --git a/src/SMESH_SWIG/StdMeshersDC.py b/src/SMESH_SWIG/StdMeshersDC.py index af20cb4e2..587f91070 100644 --- a/src/SMESH_SWIG/StdMeshersDC.py +++ b/src/SMESH_SWIG/StdMeshersDC.py @@ -17,45 +17,71 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +## +# @package StdMeshersDC +# Python API for the standard meshing plug-in module. + from smesh import Mesh_Algorithm, AssureGeomPublished, IsEqual, ParseParameters from smesh import GetName, TreatHypoStatus from smeshDC import Mesh import StdMeshers -# Types of algorithms +#---------------------------- +# Mesh algo type identifiers +#---------------------------- + +## Algorithm type: Regular 1D algorithm, see StdMeshersDC_Segment REGULAR = "Regular_1D" +## Algorithm type: Python 1D algorithm, see StdMeshersDC_Segment_Python PYTHON = "Python_1D" +## Algorithm type: Composite segment 1D algorithm, see StdMeshersDC_CompositeSegment COMPOSITE = "CompositeSegment_1D" +## Algorithm type: Triangle MEFISTO 2D algorithm, see StdMeshersDC_Triangle_MEFISTO MEFISTO = "MEFISTO_2D" +## Algorithm type: Hexahedron 3D (i-j-k) algorithm, see StdMeshersDC_Hexahedron Hexa = "Hexa_3D" +## Algorithm type: Quadrangle 2D algorithm, see StdMeshersDC_Quadrangle QUADRANGLE = "Quadrangle_2D" +## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersDC_RadialQuadrangle1D2D RADIAL_QUAD = "RadialQuadrangle_1D2D" - # import items of enum QuadType for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e)) +#---------------------- +# Algorithms +#---------------------- -# Public class: Mesh_Segment -# -------------------------- - -## Class to define a REGULAR 1D algorithm for discretization. It is created by -# calling Mesh.Segment(geom=0) +## Defines segment 1D algorithm for edges discretization. +# +# It can be created by calling smesh.Mesh.Segment(geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_Segment(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Segment" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = REGULAR + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True + ## doc string of the method + # @internal + docHelper = "Creates segment 1D algorithm for edges" ## 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) self.Create(mesh, geom, self.algoType) + pass ## Defines "LocalLength" hypothesis to cut an edge in several segments with the same length # @param l for the length of segments that cut an edge @@ -135,7 +161,8 @@ class StdMeshersDC_Segment(Mesh_Algorithm): return hyp ## Private method - ## Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments + # + # Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments def _compareNumberOfSegments(self, hyp, args): if hyp.GetNumberOfSegments() == args[0]: if len(args) == 3: @@ -282,7 +309,7 @@ class StdMeshersDC_Segment(Mesh_Algorithm): else: self.geom = vertex pass - ### 0D algorithm + # 0D algorithm if self.geom is None: raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape" AssureGeomPublished( self.mesh, self.geom ) @@ -294,7 +321,7 @@ class StdMeshersDC_Segment(Mesh_Algorithm): pass status = self.mesh.mesh.AddHypothesis(self.geom, algo) TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True) - ### + # comFun = lambda hyp, args: IsEqual(hyp.GetLength(), args[0]) hyp = self.Hypothesis("SegmentLengthAroundVertex", [length], UseExisting=UseExisting, CompareMethod=comFun) @@ -314,44 +341,61 @@ class StdMeshersDC_Segment(Mesh_Algorithm): hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp) return hyp -# Public class: Mesh_CompositeSegment -# -------------------------- + pass # end of StdMeshersDC_Segment class -## A regular 1D algorithm for discretization of a set of adjacent edges as one. -# It is created by calling Mesh.Segment(COMPOSITE,geom=0) +## Segment 1D algorithm for discretization of a set of adjacent edges as one edge. +# +# It is created by calling smesh.Mesh.Segment(COMPOSITE,geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_CompositeSegment(StdMeshersDC_Segment): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Segment" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = COMPOSITE + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = False ## 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): self.Create(mesh, geom, self.algoType) + pass + pass # end of StdMeshersDC_CompositeSegment class -# Public class: Mesh_Segment_Python -# --------------------------------- - -## Defines a segment 1D algorithm for discretization with python function -# It is created by calling Mesh.Segment(PYTHON,geom=0) +## Defines a segment 1D algorithm for discretization of edges with Python function +# +# It is created by calling smesh.Mesh.Segment(PYTHON,geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_Segment_Python(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Segment" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = PYTHON + ## doc string of the method + # @internal + docHelper = "Creates tetrahedron 3D algorithm for solids" ## 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): import Python1dPlugin self.Create(mesh, geom, self.algoType, "libPython1dEngine.so") + pass ## Defines "PythonSplit1D" hypothesis # @param n for the number of segments that cut an edge @@ -367,25 +411,34 @@ class StdMeshersDC_Segment_Python(Mesh_Algorithm): hyp.SetPythonLog10RatioFunction(func) return hyp -# Public class: Mesh_Triangle_MEFISTO -# ----------------------------------- + pass # end of StdMeshersDC_Segment_Python class ## Triangle MEFISTO 2D algorithm -# It is created by calling Mesh.Triangle(MEFISTO,geom=0) +# +# It is created by calling smesh.Mesh.Triangle(MEFISTO,geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_Triangle_MEFISTO(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Triangle" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = MEFISTO + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True ## 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) self.Create(mesh, geom, self.algoType) + pass ## Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle # @param area for the maximum area of each triangle @@ -408,28 +461,37 @@ class StdMeshersDC_Triangle_MEFISTO(Mesh_Algorithm): hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp) return hyp -# Public class: Mesh_Quadrangle -# ----------------------------- + pass # end of StdMeshersDC_Triangle_MEFISTO class ## Defines a quadrangle 2D algorithm -# It is created by calling Mesh.Quadrangle(geom=0) +# +# It is created by calling smesh.Mesh.Quadrangle(geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_Quadrangle(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Quadrangle" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = QUADRANGLE + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True - - params=0 + ## hypothesis associated with algorithm + # @internal + params = 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) self.Create(mesh, geom, self.algoType) - return + pass ## Defines "QuadrangleParameters" hypothesis # @param quadType defines the algorithm of transition between differently descretized @@ -515,47 +577,63 @@ class StdMeshersDC_Quadrangle(Mesh_Algorithm): def TriangleVertex(self, vertex, UseExisting=0): return self.QuadrangleParameters(QUAD_STANDARD,vertex,UseExisting) - -# Public class: Mesh_Hexahedron -# ------------------------------ + pass # end of StdMeshersDC_Quadrangle class ## Defines a hexahedron 3D algorithm -# It is created by calling Mesh.Hexahedron(geom=0) +# +# It is created by calling smesh.Mesh.Hexahedron(geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_Hexahedron(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Hexahedron" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = Hexa + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True ## 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) self.Create(mesh, geom, Hexa) pass -# Public class: Mesh_Projection1D -# ------------------------------- + pass # end of StdMeshersDC_Hexahedron class ## Defines a projection 1D algorithm -# It is created by calling Mesh.Projection1D(geom=0) -# @ingroup l3_algos_proj +# +# It is created by calling smesh.Mesh.Projection1D(geom=0) # +# @ingroup l3_algos_proj class StdMeshersDC_Projection1D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Projection1D" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Projection_1D" + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True ## 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) self.Create(mesh, geom, self.algoType) + pass ## Defines "Source Edge" hypothesis, specifying a meshed edge, from where # a mesh pattern is taken, and, optionally, the association of vertices @@ -582,26 +660,34 @@ class StdMeshersDC_Projection1D(Mesh_Algorithm): hyp.SetVertexAssociation( srcV, tgtV ) return hyp - -# Public class: Mesh_Projection2D -# ------------------------------ + pass # end of StdMeshersDC_Projection1D class ## Defines a projection 2D algorithm -# It is created by calling Mesh.Projection2D(geom=0) -# @ingroup l3_algos_proj +# +# It is created by calling smesh.Mesh.Projection2D(geom=0) # +# @ingroup l3_algos_proj class StdMeshersDC_Projection2D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Projection2D" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Projection_2D" + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True ## 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) self.Create(mesh, geom, self.algoType) + pass ## Defines "Source Face" hypothesis, specifying a meshed face, from where # a mesh pattern is taken, and, optionally, the association of vertices @@ -634,44 +720,54 @@ class StdMeshersDC_Projection2D(Mesh_Algorithm): hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 ) return hyp -# Public class: Mesh_Projection1D2D -# --------------------------------- + pass # end of StdMeshersDC_Projection2D class ## Defines a projection 1D-2D algorithm -# It is created by calling Mesh.Projection1D2D(geom=0) +# +# It is created by calling smesh.Mesh.Projection1D2D(geom=0) # # @ingroup l3_algos_proj - class StdMeshersDC_Projection1D2D(StdMeshersDC_Projection2D): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Projection1D2D" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Projection_1D2D" ## 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): StdMeshersDC_Projection2D.__init__(self, mesh, geom) + pass -# Public class: Mesh_Projection3D -# ------------------------------ + pass # end of StdMeshersDC_Projection1D2D class ## Defines a projection 3D algorithm -# It is created by calling Mesh.Projection3D(COMPOSITE) +# +# It is created by calling smesh.Mesh.Projection3D(geom=0) # # @ingroup l3_algos_proj -# class StdMeshersDC_Projection3D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Projection3D" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Projection_3D" ## 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) self.Create(mesh, geom, self.algoType) + pass ## Defines the "Source Shape 3D" hypothesis, specifying a meshed solid, from where # the mesh pattern is taken, and, optionally, the association of vertices @@ -707,23 +803,27 @@ class StdMeshersDC_Projection3D(Mesh_Algorithm): #elif srcV1 or srcV2 or tgtV1 or tgtV2: return hyp -# Public class: Mesh_Prism -# ------------------------ + pass # end of StdMeshersDC_Projection3D class ## Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" # depending on geometry -# It is created by calling Mesh.Prism(geom=0) +# +# It is created by calling smesh.Mesh.Prism(geom=0) # # @ingroup l3_algos_3dextr -# class StdMeshersDC_Prism3D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Prism" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Prism_3D" ## 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) @@ -735,11 +835,14 @@ class StdMeshersDC_Prism3D(Mesh_Algorithm): nbShells = len( SubShapeAll( shape, ShapeType["SHELL"] )) if nbSolids == 0 or nbSolids == nbShells: self.Create(mesh, geom, "Prism_3D") + pass else: self.algoType = "RadialPrism_3D" self.Create(mesh, geom, "RadialPrism_3D") self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0) self.nbLayers = None + pass + pass ## Return 3D hypothesis holding the 1D one def Get3DHypothesis(self): @@ -847,28 +950,33 @@ class StdMeshersDC_Prism3D(Mesh_Algorithm): hyp.SetFineness( fineness ) return hyp - -# Public class: Mesh_RadialQuadrangle1D2D -# ------------------------------- + pass # end of StdMeshersDC_Prism3D class ## Defines a Radial Quadrangle 1D2D algorithm -# It is created by calling Mesh.Quadrangle(RADIAL_QUAD,geom=0) +# +# It is created by calling smesh.Mesh.Quadrangle(RADIAL_QUAD,geom=0) # # @ingroup l2_algos_radialq class StdMeshersDC_RadialQuadrangle1D2D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Quadrangle" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = RADIAL_QUAD ## 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) self.Create(mesh, geom, self.algoType) self.distribHyp = None #self.Hypothesis("LayerDistribution2D", UseExisting=0) self.nbLayers = None + pass ## Return 2D hypothesis holding the 1D one def Get2DHypothesis(self): @@ -954,25 +1062,34 @@ class StdMeshersDC_RadialQuadrangle1D2D(Mesh_Algorithm): hyp.SetFineness( fineness ) return hyp + pass # end of StdMeshersDC_RadialQuadrangle1D2D class -# Public class: Mesh_UseExistingElements -# -------------------------------------- -## Defines a Radial Quadrangle 1D2D algorithm -# It is created by calling Mesh.UseExisting1DElements(geom=0) +## Defines a Use Existing Elements 1D algorithm +# +# It is created by calling smesh.Mesh.UseExisting1DElements(geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_UseExistingElements_1D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "UseExisting1DElements" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Import_1D" + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True + ## 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) self.Create(mesh, geom, self.algoType) - return + pass ## Defines "Source edges" hypothesis, specifying groups of edges to import # @param groups list of groups of edges @@ -991,24 +1108,34 @@ class StdMeshersDC_UseExistingElements_1D(Mesh_Algorithm): hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups) return hyp -# Public class: Mesh_UseExistingElements -# -------------------------------------- -## Defines a Radial Quadrangle 1D2D algorithm -# It is created by calling Mesh.UseExisting2DElements(geom=0) + pass # end of StdMeshersDC_UseExistingElements_1D class + +## Defines a Use Existing Elements 1D-2D algorithm +# +# It is created by calling smesh.Mesh.UseExisting2DElements(geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_UseExistingElements_1D2D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "UseExisting2DElements" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Import_1D2D" + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True + ## 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) self.Create(mesh, geom, self.algoType) - return + pass ## Defines "Source faces" hypothesis, specifying groups of faces to import # @param groups list of groups of faces @@ -1027,25 +1154,34 @@ class StdMeshersDC_UseExistingElements_1D2D(Mesh_Algorithm): hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups) return hyp + pass # end of StdMeshersDC_UseExistingElements_1D2D class -# Public class: Mesh_Cartesian_3D -# -------------------------------------- ## Defines a Body Fitting 3D algorithm -# It is created by calling Mesh.BodyFitted(geom=0) +# +# It is created by calling smesh.Mesh.BodyFitted(geom=0) # # @ingroup l3_algos_basic class StdMeshersDC_Cartesian_3D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "BodyFitted" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "Cartesian_3D" + ## flag pointing either this algorithm should be used by default in dynamic method + # of smesh.Mesh class + # @internal isDefault = True + ## 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): self.Create(mesh, geom, self.algoType) self.hyp = None - return + pass ## Defines "Body Fitting parameters" hypothesis # @param xGridDef is definition of the grid along the X asix. @@ -1088,39 +1224,54 @@ class StdMeshersDC_Cartesian_3D(Mesh_Algorithm): self.hyp.SetSizeThreshold( sizeThreshold ) return self.hyp -# Public class: Mesh_UseExisting_1D -# --------------------------------- + pass # end of StdMeshersDC_Cartesian_3D class + ## Defines a stub 1D algorithm, which enables "manual" creation of nodes and # segments usable by 2D algoritms -# It is created by calling Mesh.UseExistingSegments(geom=0) +# +# It is created by calling smesh.Mesh.UseExistingSegments(geom=0) # # @ingroup l3_algos_basic - class StdMeshersDC_UseExisting_1D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "UseExistingSegments" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "UseExisting_1D" + ## 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): self.Create(mesh, geom, self.algoType) + pass + pass # end of StdMeshersDC_UseExisting_1D class -# Public class: Mesh_UseExisting -# ------------------------------- ## Defines a stub 2D algorithm, which enables "manual" creation of nodes and # faces usable by 3D algoritms -# It is created by calling Mesh.UseExistingFaces(geom=0) +# +# It is created by calling smesh.Mesh.UseExistingFaces(geom=0) # # @ingroup l3_algos_basic - class StdMeshersDC_UseExisting_2D(Mesh_Algorithm): - ## Name of method of class Mesh creating an instance of this class + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "UseExistingFaces" - ## Name of algorithm type + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = "UseExisting_2D" + ## 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): self.Create(mesh, geom, self.algoType) + pass + + pass # end of StdMeshersDC_UseExisting_2D class diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 9780503a1..7b99c3519 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -20,10 +20,8 @@ # Author : Francis KLOSS, OCC # Module : SMESH -""" - \namespace smesh - \brief Module smesh -""" +## @package smesh +# Python API for SALOME %Mesh module ## @defgroup l1_auxiliary Auxiliary methods and structures ## @defgroup l1_creating Creating meshes -- 2.30.2