Sphinx documentation: Minor modifications and some corrections.

This commit is contained in:
rnv 2018-01-25 13:54:58 +03:00
parent e1c0323a8c
commit f699d8bf4d
6 changed files with 205 additions and 144 deletions

View File

@ -18,17 +18,16 @@
#
SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py ${SALOME_INSTALL_BINS})
SET(DOC_SMESH_MeshersList StdMeshers)
SET(smesh_file "${CMAKE_CURRENT_SOURCE_DIR}/collect_mesh_methods.py")
SET(smesh_merge_file "${CMAKE_CURRENT_SOURCE_DIR}/merge_mesh_class.py")
# Define requared environment variables
SALOME_ACCUMULATE_ENVIRONMENT(SMESH_MeshersList NOCHECK ${DOC_SMESH_MeshersList})
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/tmp1)
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/tmp2)
# TODO: to think how to generate documentation with sphinx for StdMeshers
SET(_cmd_options ${smesh_file} -o tmp1/smeshBuilder.py StdMeshers)
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${PYTHON_EXECUTABLE}" "${_cmd_options}")
# Make configuration file
SALOME_CONFIGURE_FILE(conf.py.in conf.py)
@ -52,29 +51,43 @@ SET(POT_ALLSPHINXOPTS -c ${CMAKE_CURRENT_BINARY_DIR} -b gettext ${POT_SPHINXOPTS
SET(PO_SPHINXOPTS)
SET(PO_ALLSPHINXOPTS ${PO_SPHINXOPTS} update -p potfiles)
# 6. Options for generating temporary python modues
SET(_cmd_tmp_gen_options ${smesh_file} -o tmp1/smeshBuilder_dynamic.py -f sphinx StdMeshers)
# 7. Options for generating final smeshBuilder.py script
SET(_cmd_smeshBuilder_gen_options ${smesh_merge_file} -o tmp2/smeshBuilder.py smeshBuilder)
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_sphinx env_script_sphinx "${SPHINX_EXECUTABLE}" "${ALLSPHINXOPTS}")
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_sphinx_fr env_script_sphinx "${SPHINX_EXECUTABLE}" "${FR_ALLSPHINXOPTS}")
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_sphinx_pot env_script_sphinx "${SPHINX_EXECUTABLE}" "${POT_ALLSPHINXOPTS}")
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_sphinx_intl_build env_script_sphinx "${SPHINX_INTL_EXECUTABLE}" "build")
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_sphinx_intl_update env_script_sphinx "${SPHINX_INTL_EXECUTABLE}" "${PO_ALLSPHINXOPTS}")
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_tmp_gen env_script "${PYTHON_EXECUTABLE}" "${_cmd_tmp_gen_options}")
SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_smeshBuilder_gen env_script "${PYTHON_EXECUTABLE}" "${_cmd_smeshBuilder_gen_options}")
ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp1
# Make temporary directory for python modules
COMMAND ${CMAKE_COMMAND} -E make_directory tmp2
# Copy python modules to be documented into memporary directory
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshBuilder.py tmp2/smeshBuilder.py
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smesh_algorithm.py tmp2/smesh_algorithm.py
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/StdMeshersBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2/StdMeshersBuilder.py
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_PY/smeshstudytools.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2
# Copy python module to the temporary file
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/tmp1/smeshBuilder_origin.py
# collect methods from StdMeshers
COMMAND ${_cmd}
# Copy python modules to be documented into memporary director
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/StdMeshersBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2/StdMeshersBuilder.py
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smesh_algorithm.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2/smesh_algorithm.py
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/SMESH_PY/smeshstudytools.py ${CMAKE_CURRENT_BINARY_DIR}/tmp2/smeshstudytools.py
# Collect methods from StdMeshers into temporary python module
COMMAND ${_cmd_tmp_gen}
# Generate smeshBuilder.py script
COMMAND ${_cmd_smeshBuilder_gen}
# Internatiolization commands:
# 1. Copy existing po files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/locale ${CMAKE_CURRENT_BINARY_DIR}/locale
# 2. sphinx-intl "build"
COMMAND ${_cmd_sphinx_intl_build}
@ -91,19 +104,19 @@ ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp1
FILE(GLOB POFILES ${CMAKE_CURRENT_BINARY_DIR}/locale/fr/LC_MESSAGES/*.po)
ADD_CUSTOM_TARGET(check_translations
ADD_CUSTOM_TARGET(check_translations
# 1. Generate potfiles
COMMAND ${_cmd_sphinx_pot}
# 2. Copy existing po files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/locale ${CMAKE_CURRENT_BINARY_DIR}/locale
# 3. Update PO files
COMMAND ${_cmd_sphinx_intl_update}
COMMAND ${_cmd_sphinx_intl_update}
)
ADD_DEPENDENCIES(check_translations usr_docs)
FOREACH(pofile ${POFILES})
GET_FILENAME_COMPONENT(fn_wo_path ${pofile} NAME)
GET_FILENAME_COMPONENT(fn_wo_path ${pofile} NAME)
ADD_CUSTOM_COMMAND(TARGET check_translations POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different ${pofile} ${CMAKE_CURRENT_SOURCE_DIR}/locale/fr/LC_MESSAGES/${fn_wo_path})

View File

@ -45,10 +45,9 @@
# variables are set properly; otherwise the script will fail.
#
################################################################################
import sys
def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py", format = "doxygen"):
plugin_module_name = plugin_name + "Builder"
plugin_module = "salome.%s.%s" % (plugin_name, plugin_module_name)
try:
@ -68,29 +67,59 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
if methods:
output = []
if dummymeshhelp:
output.append( "## @package smeshBuilder" )
output.append( "# Documentation of the methods dynamically added by the " + plugin_name + " meshing plug-in to the Mesh class." )
output.append( "" )
if format == "doxygen":
output.append( "## @package smeshBuilder" )
output.append( "# Documentation of the methods dynamically added by the " + plugin_name + " meshing plug-in to the Mesh class." )
output.append( "" )
elif format == "sphinx":
output.append( '"""' )
output.append( 'Documentation of the methods dynamically added by the ' + plugin_name + ' meshing plug-in to the Mesh class.' )
output.append( '"""' )
output.append( '' )
pass
output.append( "## This class allows defining and managing a mesh." )
output.append( "#" )
if format == "doxygen":
output.append( "## This class allows defining and managing a mesh." )
output.append( "#" )
elif format == "sphinx":
output.append( "class Mesh:" )
output.append( ' """' )
output.append( ' This class allows defining and managing a mesh.' )
output.append( ' ' )
if dummymeshhelp:
# Add dummy Mesh help
# This is supposed to be done when generating documentation for meshing plug-ins
output.append( "# @note The documentation below does not provide complete description of class @b %Mesh" )
output.append( "# from @b smeshBuilder package. This documentation provides only information about" )
output.append( "# the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin" )
output.append( "# For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
output.append( "# documentation." )
if format == "doxygen":
output.append( "# @note The documentation below does not provide complete description of class @b %Mesh" )
output.append( "# from @b smeshBuilder package. This documentation provides only information about" )
output.append( "# the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin" )
output.append( "# For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
output.append( "# documentation." )
elif format == "sphinx":
output.append( ' The documentation below does not provide complete description of class @b %Mesh' )
output.append( ' from @b smeshBuilder package. This documentation provides only information about' )
output.append( ' the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin' )
output.append( ' For more details on the %Mesh class, please refer to the SALOME %Mesh module' )
output.append( ' documentation.' )
output.append( ' """' )
output.append( ' ' )
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( "# @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." )
if format == "doxygen":
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." )
elif format == "sphinx":
output.append( " Note:")
output.append( " 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." )
output.append( ' """' )
output.append( ' ' )
pass
output.append( "class Mesh:" )
if format == "doxygen":
output.append( "class Mesh:" )
for method in methods:
docHelper = ""
for algo in methods[ method ]:
@ -98,18 +127,38 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
if docHelper: break
pass
if not docHelper: docHelper = "Creates new algorithm."
output.append( " ## %s" % docHelper )
output.append( " #" )
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, see " )
output.append( " # %s" % ", ".join( [ "%s.%s" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
output.append( " def %s(algo_type, geom_shape=0):" % method )
output.append( " pass" )
if format == "doxygen":
output.append( " ## %s" % docHelper )
output.append( " #" )
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, see " )
output.append( " # %s" % ", ".join( [ "%s.%s" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
output.append( " def %s(algo_type, geom_shape=0):" % method )
output.append( " pass" )
elif format == "sphinx":
output.append( ' def %s(algo_type, geom_shape=0):' % method )
output.append( ' """' )
output.append( ' %s' % docHelper )
output.append( ' ' )
output.append( ' This method is dynamically added to **Mesh** class by the meshing plug-in(s). ' )
output.append( ' ' )
output.append( ' If the optional *geom_shape* parameter is not set, this algorithm is global (applied to whole mesh).' )
output.append( ' Otherwise, this algorithm defines a submesh based on *geom_shape* subshape.' )
output.append( ' ' )
output.append( ' Parameters:' )
output.append( ' algo_type: type of algorithm to be created; allowed values are specified by classes implemented by plug-in (see below)' )
output.append( ' geom_shape (GEOM_Object): if defined, the subshape to be meshed' )
output.append( ' ' )
output.append( ' Returns:')
output.append( ' An instance of Mesh_Algorithm sub-class according to the specified *algo_type*, see ' )
output.append( ' %s' % ", ".join( [ ":class:`~%s.%s`" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
output.append( ' """' )
output.append( ' pass' )
pass
f = open(output_file, "w")
for line in output: f.write( line + "\n" )
@ -134,8 +183,14 @@ if __name__ == "__main__":
parser.add_option("-d", "--dummy-mesh-help", dest="dummymeshhelp",
action="store_true", default=False,
help=h)
h = "Format of the documentation strings in the output file. Possible values are: "
h+= "'doxygen' - documentation strings are generated in the doxygen format, before a method defenition."
h+= "'sphinx' - documentation strings are generated in the sphinx format, after a method defenition."
parser.add_option("-f", "--format", dest="format",
action="store", default="doxygen", 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 )
main( args[0], options.dummymeshhelp, options.output, options.format )
pass

View File

@ -0,0 +1,59 @@
import inspect
import sys
from types import FunctionType
import copy
ORIGIN_MODULE_SUFFIX = "_origin"
DYNAMIC_MODULE_SUFFIX = "_dynamic"
def main(module_name, output_file = "smeshBuilder.py"):
oringin_module_name = module_name + ORIGIN_MODULE_SUFFIX
dynamic_module_name = module_name + DYNAMIC_MODULE_SUFFIX
try:
exec( "import %s" % oringin_module_name )
exec( "origin_module = %s" % oringin_module_name )
origin_module_lines = inspect.getsourcelines( origin_module )[0]
origin_meshClass_lines = inspect.getsourcelines(origin_module.Mesh)[0]
origin_module_text = "".join( origin_module_lines )
origin_meshClass_text = "".join( origin_meshClass_lines )
exec( "import %s" % dynamic_module_name )
exec( "dynanmic_module = %s" % dynamic_module_name )
dynanmic_meshClass = dynanmic_module.Mesh
new_meshClass_lines = copy.copy(origin_meshClass_lines)
# remove end of class 'pass'
if new_meshClass_lines[-1].find("pass") > 0:
new_meshClass_lines.pop()
dynanmic_meshClass_methods = [x for x, y in dynanmic_meshClass.__dict__.items() if type(y) == FunctionType]
for method in dynanmic_meshClass_methods:
exec( "method_lines = inspect.getsourcelines(dynanmic_module.Mesh.%s)[0]" % method)
new_meshClass_lines+=method_lines
pass
new_meshClass_text = "".join( new_meshClass_lines )
f = open( output_file, "w" )
f.write( origin_module_text.replace( origin_meshClass_text, new_meshClass_text) )
f.close()
except Exception, e:
print e
pass
pass
if __name__ == "__main__":
import optparse
parser = optparse.OptionParser(usage="%prog [options] modulename")
h = "Output file (smeshBuilder.py by default)"
parser.add_option("-o", "--output", dest="output",
action="store", default="smeshBuilder.py", metavar="file",
help=h)
(options, args) = parser.parse_args()
if len( args ) < 1: sys.exit("Module name is not specified")
main( args[0], options.output )
pass

View File

@ -32,47 +32,47 @@ import StdMeshers
REGULAR = "Regular_1D"
"""
Algorithm type: Regular 1D algorithm, see :class:`StdMeshersBuilder_Segment`
Algorithm type: Regular 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Segment`
"""
PYTHON = "Python_1D"
"""
Algorithm type: Python 1D algorithm, see StdMeshersBuilder_Segment_Python
Algorithm type: Python 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Segment_Python`
"""
COMPOSITE = "CompositeSegment_1D"
"""
Algorithm type: Composite segment 1D algorithm, see StdMeshersBuilder_CompositeSegment
Algorithm type: Composite segment 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_CompositeSegment`
"""
MEFISTO = "MEFISTO_2D"
"""
Algorithm type: Triangle MEFISTO 2D algorithm, see StdMeshersBuilder_Triangle_MEFISTO
Algorithm type: Triangle MEFISTO 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Triangle_MEFISTO`
"""
Hexa = "Hexa_3D"
"""
Algorithm type: Hexahedron 3D (i-j-k) algorithm, see StdMeshersBuilder_Hexahedron
Algorithm type: Hexahedron 3D (i-j-k) algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Hexahedron`
"""
QUADRANGLE = "Quadrangle_2D"
"""
Algorithm type: Quadrangle 2D algorithm, see StdMeshersBuilder_Quadrangle
Algorithm type: Quadrangle 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Quadrangle`
"""
RADIAL_QUAD = "RadialQuadrangle_1D2D"
"""
Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersBuilder_RadialQuadrangle1D2D
Algorithm type: Radial Quadrangle 1D-2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_RadialQuadrangle1D2D`
"""
QUAD_MA_PROJ = "QuadFromMedialAxis_1D2D"
"""
Algorithm type: Quadrangle (Medial Axis Projection) 1D-2D algorithm, see StdMeshersBuilder_QuadMA_1D2D
Algorithm type: Quadrangle (Medial Axis Projection) 1D-2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_QuadMA_1D2D`
"""
POLYGON = "PolygonPerFace_2D"
"""
Algorithm type: Polygon Per Face 2D algorithm, see StdMeshersBuilder_PolygonPerFace
Algorithm type: Polygon Per Face 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_PolygonPerFace`
"""
# import items of enums

View File

@ -20,66 +20,6 @@
# Author : Francis KLOSS, OCC
# Module : SMESH
## @package smeshBuilder
# Python API for SALOME %Mesh module
## @defgroup l1_auxiliary Auxiliary methods and structures
## @defgroup l1_creating Creating meshes
## @{
## @defgroup l2_impexp Importing and exporting meshes
## @{
## @details
## These are methods of class \ref smeshBuilder.smeshBuilder "smeshBuilder"
## @}
## @defgroup l2_construct Constructing meshes
## @defgroup l2_algorithms Defining Algorithms
## @{
## @defgroup l3_algos_basic Basic meshing algorithms
## @defgroup l3_algos_proj Projection Algorithms
## @defgroup l3_algos_segmarv Segments around Vertex
## @defgroup l3_algos_3dextr 3D extrusion meshing algorithm
## @}
## @defgroup l2_hypotheses Defining hypotheses
## @{
## @defgroup l3_hypos_1dhyps 1D Meshing Hypotheses
## @defgroup l3_hypos_2dhyps 2D Meshing Hypotheses
## @defgroup l3_hypos_maxvol Max Element Volume hypothesis
## @defgroup l3_hypos_quad Quadrangle Parameters hypothesis
## @defgroup l3_hypos_additi Additional Hypotheses
## @}
## @defgroup l2_submeshes Constructing sub-meshes
## @defgroup l2_editing Editing Meshes
## @}
## @defgroup l1_meshinfo Mesh Information
## @defgroup l1_controls Quality controls and Filtering
## @defgroup l1_grouping Grouping elements
## @{
## @defgroup l2_grps_create Creating groups
## @defgroup l2_grps_operon Using operations on groups
## @defgroup l2_grps_delete Deleting Groups
## @}
## @defgroup l1_modifying Modifying meshes
## @{
## @defgroup l2_modif_add Adding nodes and elements
## @defgroup l2_modif_del Removing nodes and elements
## @defgroup l2_modif_edit Modifying nodes and elements
## @defgroup l2_modif_renumber Renumbering nodes and elements
## @defgroup l2_modif_trsf Transforming meshes (Translation, Rotation, Symmetry, Sewing, Merging)
## @defgroup l2_modif_unitetri Uniting triangles
## @defgroup l2_modif_cutquadr Cutting elements
## @defgroup l2_modif_changori Changing orientation of elements
## @defgroup l2_modif_smooth Smoothing
## @defgroup l2_modif_extrurev Extrusion and Revolution
## @defgroup l2_modif_tofromqu Convert to/from Quadratic Mesh
## @defgroup l2_modif_duplicat Duplication of nodes and elements (to emulate cracks)
## @}
## @defgroup l1_measurements Measurements
import salome
from salome.geom import geomBuilder
@ -103,9 +43,6 @@ class MeshMeta(type):
"""Implement issubclass(sub, cls)."""
return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__)
## @addtogroup l1_auxiliary
## @{
def DegreesToRadians(AngleInDegrees):
"""Convert an angle from degrees to radians
"""
@ -321,10 +258,6 @@ def FirstVertexOnCurve(mesh, edge):
else:
return vv[1]
# end of l1_auxiliary
## @}
smeshInst = None
"""
Warning:
@ -1178,8 +1111,8 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
"""
Get minimum distance between two objects
If @a src2 is None, and @a id2 = 0, distance from @a src1 / @a id1 to the origin is computed.
If @a src2 is None, and @a id2 != 0, it is assumed that both @a id1 and @a id2 belong to @a src1.
If *src2* is None, and *id2* = 0, distance from *src1* / *id1* to the origin is computed.
If *src2* None, and *id2* != 0, it is assumed that both *id1* and *id2* belong to *src1*.
Parameters:
src1: first source object
@ -1204,8 +1137,8 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
"""
Get measure structure specifying minimum distance data between two objects
If @a src2 is None, and @a id2 = 0, distance from @a src1 / @a id1 to the origin is computed.
If @a src2 is None, and @a id2 != 0, it is assumed that both @a id1 and @a id2 belong to @a src1.
If *src2* is None, and *id2* = 0, distance from *src1* / *id1* to the origin is computed.
If *src2* is None, and *id2* != 0, it is assumed that both *id1* and *id2* belong to *src1*.
Parameters:
@ -3556,9 +3489,9 @@ class Mesh:
Parameters:
id1: first node/element id
id2: second node/element id (if 0, distance from @a id1 to the origin is computed)
id2: second node/element id (if 0, distance from *id1* to the origin is computed)
isElem1: *True* if *id1* is element id, *False* if it is node id
isElem2: *True* if @a id2 is element id, *False* if it is node id
isElem2: *True* if *id2* is element id, *False* if it is node id
Returns:
minimum distance value **GetMinDistance()**
@ -3573,7 +3506,7 @@ class Mesh:
Parameters:
id1: first node/element id
id2: second node/element id (if 0, distance from @a id1 to the origin is computed)
id2: second node/element id (if 0, distance from *id1* to the origin is computed)
isElem1: *True* if *id1* is element id, *False* if it is node id
isElem2: *True* if *id2* is element id, *False* if it is node id
@ -3606,7 +3539,7 @@ class Mesh:
Parameters:
objects: single source object or list of source objects or list of nodes/elements IDs
isElem: if *objects* is a list of IDs, *True* value in this parameters specifies that *objects* are elements,
*False* specifies that @a objects are nodes
*False* specifies that *objects* are nodes
Returns:
tuple of six values (minX, minY, minZ, maxX, maxY, maxZ) **GetBoundingBox()**
@ -3626,7 +3559,7 @@ class Mesh:
Parameters:
IDs: single source object or list of source objects or list of nodes/elements IDs
isElem: if *IDs* is a list of IDs, *True* value in this parameters specifies that *objects* are elements,
*False* specifies that @a objects are nodes
*False* specifies that *objects* are nodes
Returns:
Measure structure **BoundingBox()**
@ -4024,7 +3957,7 @@ class Mesh:
y: the Y coordinate of a point
z: the Z coordinate of a point
NodeID: if specified (>0), the node with this ID is moved,
otherwise, the node closest to point (@a x,@a y,@a z) is moved
otherwise, the node closest to point (*x*, *y*, *z*) is moved
Returns:
the ID of a node
@ -4306,7 +4239,7 @@ class Mesh:
Parameters:
IDsOfElements: the faces to be splitted.
theCriterion: is a numerical functor, in terms of enum SMESH.FunctorType, used to
choose a diagonal for splitting. If @a theCriterion is None, which is a default
choose a diagonal for splitting. If *theCriterion* is None, which is a default
value, then quadrangles will be split by the smallest diagonal.
Type SMESH.FunctorType._items in the Python Console to see all items.
Note that not all items correspond to numerical functors.
@ -4329,7 +4262,7 @@ class Mesh:
theObject: the object from which the list of elements is taken,
this is mesh, submesh or group
theCriterion: is a numerical functor, in terms of enum SMESH.FunctorType, used to
choose a diagonal for splitting. If @a theCriterion is None, which is a default
choose a diagonal for splitting. If *theCriterion* is None, which is a default
value, then quadrangles will be split by the smallest diagonal.
Type SMESH.FunctorType._items in the Python Console to see all items.
Note that not all items correspond to numerical functors.
@ -4464,17 +4397,17 @@ class Mesh:
Parameters:
elems: either a list of elements or a mesh or a group or a submesh or a filter
startHexPoint: a point used to find a hexahedron for which @a facetNormal
startHexPoint: a point used to find a hexahedron for which *facetNormal*
gives a normal vector defining facets to split into triangles.
**startHexPoint** can be either a triple of coordinates or a vertex.
facetNormal: a normal to a facet to split into triangles of a
hexahedron found by @a startHexPoint.
hexahedron found by *startHexPoint*.
**facetNormal** can be either a triple of coordinates or an edge.
method: flags passing splitting method: smesh.Hex_2Prisms, smesh.Hex_4Prisms.
smesh.Hex_2Prisms - to split the hexahedron into 2 prisms, etc.
allDomains: if :code:`False`, only hexahedra adjacent to one closest
to **startHexPoint** are split, else **startHexPoint**
is used to find the facet to split in all domains present in @a elems.
is used to find the facet to split in all domains present in *elems*.
"""
# IDSource
unRegister = genObjUnRegister()
@ -5054,7 +4987,7 @@ class Mesh:
NbOfSteps: the number of steps
MakeGroups: forces the generation of new groups from existing ones
scaleFactors: optional scale factors to apply during extrusion
linearVariation: if *True*, scaleFactors are spread over all @a scaleFactors,
linearVariation: if *True*, scaleFactors are spread over all *scaleFactors*,
else scaleFactors[i] is applied to nodes at the i-th extrusion step
basePoint: optional scaling center; if not provided, a gravity center of
nodes and elements being extruded is used as the scaling center.
@ -6959,13 +6892,12 @@ class genObjUnRegister:
if genObj and hasattr( genObj, "UnRegister" ):
genObj.UnRegister()
for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
"""
Bind methods creating mesher plug-ins to the Mesh class
"""
#print "pluginName: ", pluginName
# print "pluginName: ", pluginName
pluginBuilderName = pluginName + "Builder"
try:
exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
@ -6975,19 +6907,21 @@ for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
continue
exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
plugin = eval( pluginBuilderName )
#print " plugin:" , str(plugin)
# print " plugin:" , str(plugin)
# add methods creating algorithms to Mesh
for k in dir( plugin ):
if k[0] == '_': continue
algo = getattr( plugin, k )
#print " algo:", str(algo)
# print " algo:", str(algo)
if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ):
#print " meshMethod:" , str(algo.meshMethod)
# print " meshMethod:" , str(algo.meshMethod)
if not hasattr( Mesh, algo.meshMethod ):
setattr( Mesh, algo.meshMethod, algoCreator( algo.meshMethod ))
pass
getattr( Mesh, algo.meshMethod ).add( algo )
_mmethod = getattr( Mesh, algo.meshMethod )
if hasattr( _mmethod, "add" ):
_mmethod.add(algo)
pass
pass
pass

View File

@ -35,7 +35,7 @@ class Mesh_Algorithm:
For each meshing algorithm, a python class inheriting from class %Mesh_Algorithm
should be defined. This descendant class should have two attributes defining the way
it is created by class Mesh (see e.g. class :ref:`StdMeshersBuilder.StdMeshersBuilder_Segment`
it is created by class Mesh (see e.g. class :class:`~StdMeshersBuilder.StdMeshersBuilder_Segment`
in StdMeshersBuilder package):
- :code:`meshMethod` attribute defines name of method of class smesh.Mesh by calling which the