MESSAGE(FATAL_ERROR "We absolutely need a Salome GEOM, please define GEOM_ROOT_DIR")
ENDIF(EXISTS ${GEOM_ROOT_DIR})
-# Find SHAPERSTUDY
-# ================
-SET(WITH_SHAPER_STUDY OFF)
-SET(SHAPERSTUDY_ROOT_DIR $ENV{SHAPERSTUDY_ROOT_DIR} CACHE PATH "Path to the Salome SHAPERSTUDY")
-IF(EXISTS ${SHAPERSTUDY_ROOT_DIR})
- FIND_PACKAGE(SalomeSHAPERSTUDY)
- IF(SalomeSHAPERSTUDY_FOUND)
- SET(WITH_SHAPER_STUDY ON)
- ENDIF()
-ENDIF(EXISTS ${SHAPERSTUDY_ROOT_DIR})
-IF(NOT WITH_SHAPER_STUDY AND SALOME_BUILD_TESTS)
- MESSAGE(WARNING "SHAPERSTUDY is not found; the corresponding tests will be omitted")
-ENDIF()
-
##
## SMESH specifics
##
ADD_SUBDIRECTORY(resources)
ADD_SUBDIRECTORY(bin)
ADD_SUBDIRECTORY(src)
-IF(SALOME_BUILD_DOC)
- ADD_SUBDIRECTORY(doc)
-ENDIF()
+ADD_SUBDIRECTORY(doc)
IF(SALOME_BUILD_TESTS)
ADD_SUBDIRECTORY(test)
ENDIF()
# Install the export set for use with the install-tree
INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
FILE ${PROJECT_NAME}Targets.cmake)
+
+IF(SALOME_BUILD_TESTS)
+ # Application tests
+ INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test
+ RENAME CTestTestfile.cmake)
+ENDIF()
--- /dev/null
+# Copyright (C) 2017-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
+
+SET(COMPONENT_NAME SMESH)
+SET(TIMEOUT 300)
+
+SUBDIRS(examples)
+SUBDIRS(tests)
+SUBDIRS(tools)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-ADD_SUBDIRECTORY(tui)
-ADD_SUBDIRECTORY(gui)
-ADD_SUBDIRECTORY(examples)
\ No newline at end of file
+ADD_SUBDIRECTORY(examples)
+IF(SALOME_BUILD_DOC)
+ ADD_SUBDIRECTORY(tui)
+ ADD_SUBDIRECTORY(gui)
+ENDIF()
+
+SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py ${SALOME_INSTALL_BINS})
--- /dev/null
+#!/usr/bin/env python3
+# Copyright (C) 2012-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#################################################################################
+#
+# File: 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 generation of the extra developer documentation for
+# the meshing plug-in(s).
+#
+# Usage:
+# collect_mesh_methods.py <plugin_name>
+# where
+# <plugin_name> 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 inspect
+import sys
+
+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:
+ exec("from salome.smesh.smeshBuilder import *", globals())
+ exec("import %s" % plugin_module, globals())
+ exec("mod = %s" % plugin_module , globals())
+ methods = {}
+ for attr in dir( mod ):
+ if attr.startswith( '_' ): continue
+ algo = getattr( mod, attr )
+ if inspect.isclass(algo) 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:
+ 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
+ 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
+ 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
+ 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
+ if format == "doxygen":
+ 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 = "Create new algorithm."
+ 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" )
+ 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 :class:`Mesh <smeshBuilder.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' )
+ 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
+ with open(output_file, "w", encoding='utf8') as f:
+ f.write('\n'.join(output))
+ pass
+ pass
+ except Exception as e:
+ print(e)
+ pass
+ pass
+
+if __name__ == "__main__":
+ import argparse
+ parser = argparse.ArgumentParser()
+ h = "Output file (smesh.py by default)"
+ parser.add_argument("-o", "--output", dest="output",
+ action="store", default='smesh.py', 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_argument("-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 definition."
+ h+= "'sphinx' - documentation strings are generated in the sphinx format, after a method definition."
+ parser.add_argument("-f", "--format", dest="format",
+ action="store", default="doxygen", help=h)
+
+ parser.add_argument("plugin_name")
+
+
+ args = parser.parse_args()
+
+ if args.plugin_name is None : sys.exit("Plugin name is not specified")
+ main( args.plugin_name, args.dummymeshhelp, args.output, args.format )
+ pass
INCLUDE(tests.set)
-SET(TEST_REINIT_SALOME "False")
SALOME_CONFIGURE_FILE(tests.py.in tests.py)
-SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+# Install examples
-IF(SMESH_JOIN_TESTS)
- ADD_TEST(NAME SMESH_examples COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py tests.py)
-ELSE(SMESH_JOIN_TESTS)
- FOREACH(test ${GOOD_TESTS})
- GET_FILENAME_COMPONENT(testname ${test} NAME_WE)
- ADD_TEST(NAME ${testname}
- COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${CMAKE_CURRENT_SOURCE_DIR}/${test})
- SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
- ENDFOREACH()
-ENDIF(SMESH_JOIN_TESTS)
-
-# install Python scripts
+SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS})
SALOME_INSTALL_SCRIPTS("${EXAMPLES_TESTS}" ${SALOME_INSTALL_DOC}/examples/SMESH)
-# Application tests
+# Tests
+
+IF(SALOME_BUILD_TESTS)
+
+ SET(TEST_REINIT_SALOME "False")
+ SET(TEST_HELPER ${KERNEL_ROOT_DIR}/bin/salome/test_helper.py)
+
+ SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+
+ IF(SMESH_JOIN_TESTS)
+ ADD_TEST(NAME all_examples COMMAND ${PYTHON_EXECUTABLE} -B ${TEST_HELPER} tests.py)
+ ELSE(SMESH_JOIN_TESTS)
+ FOREACH(test ${GOOD_TESTS})
+ GET_FILENAME_COMPONENT(testname ${test} NAME_WE)
+ ADD_TEST(NAME ${testname}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${TEST_HELPER} ${CMAKE_CURRENT_SOURCE_DIR}/${test})
+ SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
+ ENDFOREACH()
+ ENDIF(SMESH_JOIN_TESTS)
+
+ # Application tests
+ # Note: we don't install test scripts as they are already installed to the documentation folder
+
+ SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/examples)
-SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
-INSTALL(FILES ${GOOD_TESTS} ${BAD_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY})
+ CONFIGURE_FILE(CTestTestfileInstall.cmake ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
+ INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
-INSTALL(FILES CTestTestfileInstall.cmake
- DESTINATION ${TEST_INSTALL_DIRECTORY}
- RENAME CTestTestfile.cmake)
-INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
+ENDIF(SALOME_BUILD_TESTS)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(tests.set)
+SET(TESTS_DIR "$ENV{SMESH_ROOT_DIR}/@SALOME_INSTALL_DOC@/examples/SMESH")
-SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
-SET(COMPONENT_NAME SMESH)
-SET(TIMEOUT 300)
+INCLUDE(tests.set)
FOREACH(tfile ${GOOD_TESTS} ${BAD_TESTS})
GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE)
- SET(TEST_NAME SMESH_${BASE_NAME})
- ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile})
+ SET(TEST_NAME ${COMPONENT_NAME}_${BASE_NAME})
+ ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${TESTS_DIR}/${tfile})
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
ENDFOREACH()
+++ /dev/null
-#!/usr/bin/env python3
-# Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-
-import unittest, sys, os
-
-class SalomeSession(object):
- def __init__(self, script):
- import runSalome
- run_script = "runSalome.py"
- if sys.platform == 'win32':
- module_dir = os.getenv("KERNEL_ROOT_DIR")
- if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script)
- pass
- sys.argv = [run_script]
- sys.argv += ["--terminal"]
- sys.argv += ["--modules=GEOM,SHAPER,SHAPERSTUDY,SMESH"]
- sys.argv += ["%s" % script]
- if sys.platform == 'win32':
- main_module_path = sys.modules['__main__'].__file__
- sys.modules['__main__'].__file__ = ''
- clt, d = runSalome.main()
- if sys.platform == 'win32':
- sys.modules['__main__'].__file__ = main_module_path
- return
-
- def __del__(self):
- port = os.getenv('NSPORT')
- import killSalomeWithPort
- killSalomeWithPort.killMyPort(port)
- return
- pass
-
-class MyTest(unittest.TestCase):
- def testFunction(self):
- SalomeSession(sys.argv[1])
- pass
-
-unittest.main(argv=sys.argv[:1])
quad_medial_axis_algo.py
defining_hypotheses_len_near_vertex.py
)
-
-SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} testme.py)
INCLUDE(UseSphinx)
-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_file "${CMAKE_SOURCE_DIR}/doc/salome/collect_mesh_methods.py")
SET(smesh_merge_file "${CMAKE_CURRENT_SOURCE_DIR}/merge_mesh_class.py")
# Define requared environment variables
+++ /dev/null
-#!/usr/bin/env python3
-# Copyright (C) 2012-2020 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-#################################################################################
-#
-# File: 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 generation of the extra developer documentation for
-# the meshing plug-in(s).
-#
-# Usage:
-# collect_mesh_methods.py <plugin_name>
-# where
-# <plugin_name> 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 inspect
-import sys
-
-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:
- exec("from salome.smesh.smeshBuilder import *", globals())
- exec("import %s" % plugin_module, globals())
- exec("mod = %s" % plugin_module , globals())
- methods = {}
- for attr in dir( mod ):
- if attr.startswith( '_' ): continue
- algo = getattr( mod, attr )
- if inspect.isclass(algo) 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:
- 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
- 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
- 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
- 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
- if format == "doxygen":
- 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 = "Create new algorithm."
- 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" )
- 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 :class:`Mesh <smeshBuilder.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' )
- 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
- with open(output_file, "w", encoding='utf8') as f:
- f.write('\n'.join(output))
- pass
- pass
- except Exception as e:
- print(e)
- pass
- pass
-
-if __name__ == "__main__":
- import argparse
- parser = argparse.ArgumentParser()
- h = "Output file (smesh.py by default)"
- parser.add_argument("-o", "--output", dest="output",
- action="store", default='smesh.py', 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_argument("-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 definition."
- h+= "'sphinx' - documentation strings are generated in the sphinx format, after a method definition."
- parser.add_argument("-f", "--format", dest="format",
- action="store", default="doxygen", help=h)
-
- parser.add_argument("plugin_name")
-
-
- args = parser.parse_args()
-
- if args.plugin_name is None : sys.exit("Plugin name is not specified")
- main( args.plugin_name, args.dummymeshhelp, args.output, args.format )
- pass
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS})
+
+IF(SALOME_BUILD_TESTS)
+ SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/tools)
+ INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
+ENDIF()
--- /dev/null
+# Copyright (C) 2017-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SUBDIRS(MacMesh)
MacMesh/PublishGroups.py
MacMesh/SharpAngle.py
)
-SET(sample_SCRIPT
+SET(sample_SCRIPTS
${CMAKE_CURRENT_BINARY_DIR}/PressureValve.py
)
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${MACMESH_INSTALL_PY})
-SALOME_INSTALL_SCRIPTS("${sample_SCRIPT}" ${SALOME_INSTALL_SCRIPT_PYTHON} DEF_PERMS)
+SALOME_INSTALL_SCRIPTS("${sample_SCRIPTS}" ${SALOME_INSTALL_DOC}/examples/SMESH DEF_PERMS)
-SET(testname MacMesh_Example_PressureValve)
-SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
-ADD_TEST(
- NAME ${testname}
- COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${sample_SCRIPT})
-SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
+IF(SALOME_BUILD_TESTS)
+ SET(TEST_HELPER ${KERNEL_ROOT_DIR}/bin/salome/test_helper.py)
+ SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+ FOREACH(test ${sample_SCRIPTS})
+ GET_FILENAME_COMPONENT(testname ${test} NAME_WE)
+ ADD_TEST(NAME MacMesh_${testname}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${TEST_HELPER} ${test})
+ SET_TESTS_PROPERTIES(MacMesh_${testname} PROPERTIES ENVIRONMENT "${tests_env}")
+ ENDFOREACH()
+
+ # Application tests
+ # Note: we don't install test scripts as they are already installed to the documentation folder
+
+ SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/tools/MacMesh)
+
+ CONFIGURE_FILE(CTestTestfileInstall.cmake ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
+ENDIF()
--- /dev/null
+# Copyright (C) 2015-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(TESTS_DIR "$ENV{SMESH_ROOT_DIR}/@SALOME_INSTALL_DOC@/examples/SMESH")
+
+SET(TESTS PressureValve.py)
+
+FOREACH(tfile ${TESTS})
+ GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE)
+ SET(TEST_NAME ${COMPONENT_NAME}_${BASE_NAME})
+ ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${TESTS_DIR}/${tfile})
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+INCLUDE(tests.set)
+
+# For 'make test'
+
SALOME_GENERATE_TESTS_ENVIRONMENT(_test_env)
-SET(_test_helper ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py)
+SET(TEST_HELPER ${KERNEL_ROOT_DIR}/bin/salome/test_helper.py)
+
+FOREACH(test ${GOOD_TESTS})
+ GET_FILENAME_COMPONENT(testname ${test} NAME_WE)
+ ADD_TEST(NAME ${testname}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${TEST_HELPER} ${CMAKE_CURRENT_SOURCE_DIR}/${test})
+ SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
+ENDFOREACH()
+
+# Application tests
-# Tests from RESTRICTED repository -----------------------------------
+SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/tests)
-SET(RESTRICTED_ROOT_DIR $ENV{RESTRICTED_ROOT_DIR} CACHE PATH "Path to the restricted repository")
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
-IF(WITH_SHAPER_STUDY AND EXISTS ${RESTRICTED_ROOT_DIR})
- FILE(GLOB _restricted_tests "${RESTRICTED_ROOT_DIR}/SMESH/*.py")
- FOREACH(_test ${_restricted_tests})
- GET_FILENAME_COMPONENT(_test_name ${_test} NAME_WE)
- ADD_TEST(NAME ${_test_name}
- COMMAND ${PYTHON_EXECUTABLE} -B ${_test_helper} ${_test})
- SET_TESTS_PROPERTIES(${_test_name} PROPERTIES ENVIRONMENT "${_test_env}")
- ENDFOREACH()
-ELSE()
- MESSAGE(WARNING "Tests from RESTRICTED repository aren't available")
-ENDIF()
+INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
-# --------------------------------------------------------------------
+# WARNING! DO NOT INSTALL RESTRICTED_TESTS HERE!!!!
+SET(ALL_TESTS ${BAD_TESTS} ${GOOD_TESTS})
+SALOME_INSTALL_SCRIPTS("${ALL_TESTS}" ${TEST_INSTALL_DIRECTORY})
--- /dev/null
+# Copyright (C) 2015-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(tests.set)
+
+FOREACH(tfile ${GOOD_TESTS} ${BAD_TESTS} ${RESTRICTED_TESTS})
+ GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE)
+ SET(TEST_NAME ${COMPONENT_NAME}_${BASE_NAME})
+ ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile})
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+# Copyright (C) 2015-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# test cases that can't be used for testing because they use external mesher plug-ins
+SET(BAD_TESTS)
+
+# test cases that can be used for testing because they don't use external mesher plug-ins
+SET(GOOD_TESTS)
+
+# test cases from RESTRICTED repositpory
+SET(RESTRICTED_ROOT_DIR $ENV{RESTRICTED_ROOT_DIR})
+
+SET(RESTRICTED_TESTS)
+IF(EXISTS ${RESTRICTED_ROOT_DIR})
+ FILE(GLOB _restricted_tests "${RESTRICTED_ROOT_DIR}/SMESH/*.py")
+ FOREACH(_test ${_restricted_tests})
+ LIST(APPEND RESTRICTED_TESTS ${_test})
+ ENDFOREACH()
+ENDIF()