mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-19 20:33:07 +05:00
Sphinx documentation: Minor modifications and some corrections.
This commit is contained in:
parent
e1c0323a8c
commit
f699d8bf4d
@ -18,17 +18,16 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py ${SALOME_INSTALL_BINS})
|
SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py ${SALOME_INSTALL_BINS})
|
||||||
|
|
||||||
SET(DOC_SMESH_MeshersList StdMeshers)
|
SET(DOC_SMESH_MeshersList StdMeshers)
|
||||||
SET(smesh_file "${CMAKE_CURRENT_SOURCE_DIR}/collect_mesh_methods.py")
|
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(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)
|
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
|
# Make configuration file
|
||||||
SALOME_CONFIGURE_FILE(conf.py.in conf.py)
|
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_SPHINXOPTS)
|
||||||
SET(PO_ALLSPHINXOPTS ${PO_SPHINXOPTS} update -p potfiles)
|
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 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_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_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_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_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
|
ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp1
|
||||||
|
|
||||||
# Make temporary directory for python modules
|
# Make temporary directory for python modules
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory tmp2
|
COMMAND ${CMAKE_COMMAND} -E make_directory tmp2
|
||||||
|
|
||||||
# Copy python modules to be documented into memporary directory
|
# Copy python module to the temporary file
|
||||||
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/smeshBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/tmp1/smeshBuilder_origin.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
|
|
||||||
|
|
||||||
# collect methods from StdMeshers
|
# Copy python modules to be documented into memporary director
|
||||||
COMMAND ${_cmd}
|
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:
|
# Internatiolization commands:
|
||||||
# 1. Copy existing po files
|
# 1. Copy existing po files
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/locale ${CMAKE_CURRENT_BINARY_DIR}/locale
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/locale ${CMAKE_CURRENT_BINARY_DIR}/locale
|
||||||
|
|
||||||
# 2. sphinx-intl "build"
|
# 2. sphinx-intl "build"
|
||||||
COMMAND ${_cmd_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)
|
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
|
# 1. Generate potfiles
|
||||||
COMMAND ${_cmd_sphinx_pot}
|
COMMAND ${_cmd_sphinx_pot}
|
||||||
# 2. Copy existing po files
|
# 2. Copy existing po files
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/locale ${CMAKE_CURRENT_BINARY_DIR}/locale
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/locale ${CMAKE_CURRENT_BINARY_DIR}/locale
|
||||||
# 3. Update PO files
|
# 3. Update PO files
|
||||||
COMMAND ${_cmd_sphinx_intl_update}
|
COMMAND ${_cmd_sphinx_intl_update}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEPENDENCIES(check_translations usr_docs)
|
ADD_DEPENDENCIES(check_translations usr_docs)
|
||||||
|
|
||||||
FOREACH(pofile ${POFILES})
|
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
|
ADD_CUSTOM_COMMAND(TARGET check_translations POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E
|
COMMAND ${CMAKE_COMMAND} -E
|
||||||
copy_if_different ${pofile} ${CMAKE_CURRENT_SOURCE_DIR}/locale/fr/LC_MESSAGES/${fn_wo_path})
|
copy_if_different ${pofile} ${CMAKE_CURRENT_SOURCE_DIR}/locale/fr/LC_MESSAGES/${fn_wo_path})
|
||||||
|
@ -45,10 +45,9 @@
|
|||||||
# variables are set properly; otherwise the script will fail.
|
# variables are set properly; otherwise the script will fail.
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
import sys
|
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_name = plugin_name + "Builder"
|
||||||
plugin_module = "salome.%s.%s" % (plugin_name, plugin_module_name)
|
plugin_module = "salome.%s.%s" % (plugin_name, plugin_module_name)
|
||||||
try:
|
try:
|
||||||
@ -68,29 +67,59 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
|
|||||||
if methods:
|
if methods:
|
||||||
output = []
|
output = []
|
||||||
if dummymeshhelp:
|
if dummymeshhelp:
|
||||||
output.append( "## @package smeshBuilder" )
|
if format == "doxygen":
|
||||||
output.append( "# Documentation of the methods dynamically added by the " + plugin_name + " meshing plug-in to the Mesh class." )
|
output.append( "## @package smeshBuilder" )
|
||||||
output.append( "" )
|
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
|
pass
|
||||||
output.append( "## This class allows defining and managing a mesh." )
|
if format == "doxygen":
|
||||||
output.append( "#" )
|
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:
|
if dummymeshhelp:
|
||||||
# Add dummy Mesh help
|
# Add dummy Mesh help
|
||||||
# This is supposed to be done when generating documentation for meshing plug-ins
|
# 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" )
|
if format == "doxygen":
|
||||||
output.append( "# from @b smeshBuilder package. This documentation provides only information about" )
|
output.append( "# @note The documentation below does not provide complete description of class @b %Mesh" )
|
||||||
output.append( "# the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin" )
|
output.append( "# from @b smeshBuilder package. This documentation provides only information about" )
|
||||||
output.append( "# For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
|
output.append( "# the methods dynamically added to the %Mesh class by the " + plugin_name + " plugin" )
|
||||||
output.append( "# documentation." )
|
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
|
pass
|
||||||
else:
|
else:
|
||||||
# Extend documentation for Mesh class with information about dynamically added methods.
|
# Extend documentation for Mesh class with information about dynamically added methods.
|
||||||
# This is supposed to be done only when building documentation for SMESH module
|
# 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 " )
|
if format == "doxygen":
|
||||||
output.append( "# plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
|
output.append( "# @note Some methods are dynamically added to the @b %Mesh class in runtime by meshing " )
|
||||||
output.append( "# try to look into the documentation for the meshing plug-ins." )
|
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
|
pass
|
||||||
output.append( "class Mesh:" )
|
if format == "doxygen":
|
||||||
|
output.append( "class Mesh:" )
|
||||||
for method in methods:
|
for method in methods:
|
||||||
docHelper = ""
|
docHelper = ""
|
||||||
for algo in methods[ method ]:
|
for algo in methods[ method ]:
|
||||||
@ -98,18 +127,38 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"):
|
|||||||
if docHelper: break
|
if docHelper: break
|
||||||
pass
|
pass
|
||||||
if not docHelper: docHelper = "Creates new algorithm."
|
if not docHelper: docHelper = "Creates new algorithm."
|
||||||
output.append( " ## %s" % docHelper )
|
if format == "doxygen":
|
||||||
output.append( " #" )
|
output.append( " ## %s" % docHelper )
|
||||||
output.append( " # This method is dynamically added to %Mesh class by the meshing plug-in(s). " )
|
output.append( " #" )
|
||||||
output.append( " #" )
|
output.append( " # This method is dynamically added to %Mesh class by the meshing plug-in(s). " )
|
||||||
output.append( " # If the optional @a geom_shape parameter is not set, this algorithm is global (applied to whole mesh)." )
|
output.append( " #" )
|
||||||
output.append( " # Otherwise, this algorithm defines a submesh based on @a geom_shape subshape." )
|
output.append( " # If the optional @a geom_shape parameter is not set, this algorithm is global (applied to whole mesh)." )
|
||||||
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( " # Otherwise, this algorithm defines a submesh based on @a geom_shape subshape." )
|
||||||
output.append( " # @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" )
|
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( " # @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type, see " )
|
output.append( " # @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" )
|
||||||
output.append( " # %s" % ", ".join( [ "%s.%s" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
|
output.append( " # @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type, see " )
|
||||||
output.append( " def %s(algo_type, geom_shape=0):" % method )
|
output.append( " # %s" % ", ".join( [ "%s.%s" % ( plugin_module_name, algo.__name__ ) for algo in methods[ method ] ] ) )
|
||||||
output.append( " pass" )
|
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
|
pass
|
||||||
f = open(output_file, "w")
|
f = open(output_file, "w")
|
||||||
for line in output: f.write( line + "\n" )
|
for line in output: f.write( line + "\n" )
|
||||||
@ -134,8 +183,14 @@ if __name__ == "__main__":
|
|||||||
parser.add_option("-d", "--dummy-mesh-help", dest="dummymeshhelp",
|
parser.add_option("-d", "--dummy-mesh-help", dest="dummymeshhelp",
|
||||||
action="store_true", default=False,
|
action="store_true", default=False,
|
||||||
help=h)
|
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()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if len( args ) < 1: sys.exit("Plugin name is not specified")
|
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
|
pass
|
||||||
|
59
doc/salome/gui/SMESH/merge_mesh_class.py
Normal file
59
doc/salome/gui/SMESH/merge_mesh_class.py
Normal 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
|
@ -32,47 +32,47 @@ import StdMeshers
|
|||||||
|
|
||||||
REGULAR = "Regular_1D"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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
|
# import items of enums
|
||||||
|
@ -20,66 +20,6 @@
|
|||||||
# Author : Francis KLOSS, OCC
|
# Author : Francis KLOSS, OCC
|
||||||
# Module : SMESH
|
# 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
|
import salome
|
||||||
from salome.geom import geomBuilder
|
from salome.geom import geomBuilder
|
||||||
|
|
||||||
@ -103,9 +43,6 @@ class MeshMeta(type):
|
|||||||
"""Implement issubclass(sub, cls)."""
|
"""Implement issubclass(sub, cls)."""
|
||||||
return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__)
|
return type.__subclasscheck__(cls, sub) or (cls.__name__ == sub.__name__ and cls.__module__ == sub.__module__)
|
||||||
|
|
||||||
## @addtogroup l1_auxiliary
|
|
||||||
## @{
|
|
||||||
|
|
||||||
def DegreesToRadians(AngleInDegrees):
|
def DegreesToRadians(AngleInDegrees):
|
||||||
"""Convert an angle from degrees to radians
|
"""Convert an angle from degrees to radians
|
||||||
"""
|
"""
|
||||||
@ -321,10 +258,6 @@ def FirstVertexOnCurve(mesh, edge):
|
|||||||
else:
|
else:
|
||||||
return vv[1]
|
return vv[1]
|
||||||
|
|
||||||
# end of l1_auxiliary
|
|
||||||
## @}
|
|
||||||
|
|
||||||
|
|
||||||
smeshInst = None
|
smeshInst = None
|
||||||
"""
|
"""
|
||||||
Warning:
|
Warning:
|
||||||
@ -1178,8 +1111,8 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
|||||||
"""
|
"""
|
||||||
Get minimum distance between two objects
|
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 *src2* is None, and *id2* = 0, distance from *src1* / *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* None, and *id2* != 0, it is assumed that both *id1* and *id2* belong to *src1*.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
src1: first source object
|
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
|
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 *src2* is None, and *id2* = 0, distance from *src1* / *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, it is assumed that both *id1* and *id2* belong to *src1*.
|
||||||
|
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@ -3556,9 +3489,9 @@ class Mesh:
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id1: first node/element id
|
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
|
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:
|
Returns:
|
||||||
minimum distance value **GetMinDistance()**
|
minimum distance value **GetMinDistance()**
|
||||||
@ -3573,7 +3506,7 @@ class Mesh:
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id1: first node/element id
|
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
|
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
|
isElem2: *True* if *id2* is element id, *False* if it is node id
|
||||||
|
|
||||||
@ -3606,7 +3539,7 @@ class Mesh:
|
|||||||
Parameters:
|
Parameters:
|
||||||
objects: single source object or list of source objects or list of nodes/elements IDs
|
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,
|
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:
|
Returns:
|
||||||
tuple of six values (minX, minY, minZ, maxX, maxY, maxZ) **GetBoundingBox()**
|
tuple of six values (minX, minY, minZ, maxX, maxY, maxZ) **GetBoundingBox()**
|
||||||
@ -3626,7 +3559,7 @@ class Mesh:
|
|||||||
Parameters:
|
Parameters:
|
||||||
IDs: single source object or list of source objects or list of nodes/elements IDs
|
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,
|
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:
|
Returns:
|
||||||
Measure structure **BoundingBox()**
|
Measure structure **BoundingBox()**
|
||||||
@ -4024,7 +3957,7 @@ class Mesh:
|
|||||||
y: the Y coordinate of a point
|
y: the Y coordinate of a point
|
||||||
z: the Z coordinate of a point
|
z: the Z coordinate of a point
|
||||||
NodeID: if specified (>0), the node with this ID is moved,
|
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:
|
Returns:
|
||||||
the ID of a node
|
the ID of a node
|
||||||
@ -4306,7 +4239,7 @@ class Mesh:
|
|||||||
Parameters:
|
Parameters:
|
||||||
IDsOfElements: the faces to be splitted.
|
IDsOfElements: the faces to be splitted.
|
||||||
theCriterion: is a numerical functor, in terms of enum SMESH.FunctorType, used to
|
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.
|
value, then quadrangles will be split by the smallest diagonal.
|
||||||
Type SMESH.FunctorType._items in the Python Console to see all items.
|
Type SMESH.FunctorType._items in the Python Console to see all items.
|
||||||
Note that not all items correspond to numerical functors.
|
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,
|
theObject: the object from which the list of elements is taken,
|
||||||
this is mesh, submesh or group
|
this is mesh, submesh or group
|
||||||
theCriterion: is a numerical functor, in terms of enum SMESH.FunctorType, used to
|
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.
|
value, then quadrangles will be split by the smallest diagonal.
|
||||||
Type SMESH.FunctorType._items in the Python Console to see all items.
|
Type SMESH.FunctorType._items in the Python Console to see all items.
|
||||||
Note that not all items correspond to numerical functors.
|
Note that not all items correspond to numerical functors.
|
||||||
@ -4464,17 +4397,17 @@ class Mesh:
|
|||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
elems: either a list of elements or a mesh or a group or a submesh or a filter
|
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.
|
gives a normal vector defining facets to split into triangles.
|
||||||
**startHexPoint** can be either a triple of coordinates or a vertex.
|
**startHexPoint** can be either a triple of coordinates or a vertex.
|
||||||
facetNormal: a normal to a facet to split into triangles of a
|
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.
|
**facetNormal** can be either a triple of coordinates or an edge.
|
||||||
method: flags passing splitting method: smesh.Hex_2Prisms, smesh.Hex_4Prisms.
|
method: flags passing splitting method: smesh.Hex_2Prisms, smesh.Hex_4Prisms.
|
||||||
smesh.Hex_2Prisms - to split the hexahedron into 2 prisms, etc.
|
smesh.Hex_2Prisms - to split the hexahedron into 2 prisms, etc.
|
||||||
allDomains: if :code:`False`, only hexahedra adjacent to one closest
|
allDomains: if :code:`False`, only hexahedra adjacent to one closest
|
||||||
to **startHexPoint** are split, else **startHexPoint**
|
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
|
# IDSource
|
||||||
unRegister = genObjUnRegister()
|
unRegister = genObjUnRegister()
|
||||||
@ -5054,7 +4987,7 @@ class Mesh:
|
|||||||
NbOfSteps: the number of steps
|
NbOfSteps: the number of steps
|
||||||
MakeGroups: forces the generation of new groups from existing ones
|
MakeGroups: forces the generation of new groups from existing ones
|
||||||
scaleFactors: optional scale factors to apply during extrusion
|
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
|
else scaleFactors[i] is applied to nodes at the i-th extrusion step
|
||||||
basePoint: optional scaling center; if not provided, a gravity center of
|
basePoint: optional scaling center; if not provided, a gravity center of
|
||||||
nodes and elements being extruded is used as the scaling center.
|
nodes and elements being extruded is used as the scaling center.
|
||||||
@ -6959,13 +6892,12 @@ class genObjUnRegister:
|
|||||||
if genObj and hasattr( genObj, "UnRegister" ):
|
if genObj and hasattr( genObj, "UnRegister" ):
|
||||||
genObj.UnRegister()
|
genObj.UnRegister()
|
||||||
|
|
||||||
|
|
||||||
for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
|
for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
|
||||||
"""
|
"""
|
||||||
Bind methods creating mesher plug-ins to the Mesh class
|
Bind methods creating mesher plug-ins to the Mesh class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#print "pluginName: ", pluginName
|
# print "pluginName: ", pluginName
|
||||||
pluginBuilderName = pluginName + "Builder"
|
pluginBuilderName = pluginName + "Builder"
|
||||||
try:
|
try:
|
||||||
exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
|
exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
|
||||||
@ -6975,19 +6907,21 @@ for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
|
|||||||
continue
|
continue
|
||||||
exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
|
exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
|
||||||
plugin = eval( pluginBuilderName )
|
plugin = eval( pluginBuilderName )
|
||||||
#print " plugin:" , str(plugin)
|
# print " plugin:" , str(plugin)
|
||||||
|
|
||||||
# add methods creating algorithms to Mesh
|
# add methods creating algorithms to Mesh
|
||||||
for k in dir( plugin ):
|
for k in dir( plugin ):
|
||||||
if k[0] == '_': continue
|
if k[0] == '_': continue
|
||||||
algo = getattr( plugin, k )
|
algo = getattr( plugin, k )
|
||||||
#print " algo:", str(algo)
|
# print " algo:", str(algo)
|
||||||
if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ):
|
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 ):
|
if not hasattr( Mesh, algo.meshMethod ):
|
||||||
setattr( Mesh, algo.meshMethod, algoCreator( algo.meshMethod ))
|
setattr( Mesh, algo.meshMethod, algoCreator( algo.meshMethod ))
|
||||||
pass
|
pass
|
||||||
getattr( Mesh, algo.meshMethod ).add( algo )
|
_mmethod = getattr( Mesh, algo.meshMethod )
|
||||||
|
if hasattr( _mmethod, "add" ):
|
||||||
|
_mmethod.add(algo)
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
|
@ -35,7 +35,7 @@ class Mesh_Algorithm:
|
|||||||
|
|
||||||
For each meshing algorithm, a python class inheriting from 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
|
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):
|
in StdMeshersBuilder package):
|
||||||
|
|
||||||
- :code:`meshMethod` attribute defines name of method of class smesh.Mesh by calling which the
|
- :code:`meshMethod` attribute defines name of method of class smesh.Mesh by calling which the
|
||||||
|
Loading…
Reference in New Issue
Block a user