0021308: EDF 1923 SMESH: Remove hard-coded dependency of the external mesh plugins from the SMESH module

* Improve documentation for meshing plug-ins (in particular, dynamically added methods)
This commit is contained in:
vsr 2012-08-21 13:15:16 +00:00
parent 68d4198983
commit 9423cdc0ef
6 changed files with 423 additions and 166 deletions

View File

@ -26,25 +26,26 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
EXTRA_DIST += images input static/footer.html static/doxygen.css EXTRA_DIST += images input static/footer.html static/doxygen.css
dist_salomescript_DATA = collect_mesh_methods.py
guidocdir = $(docdir)/gui/SMESH guidocdir = $(docdir)/gui/SMESH
guidoc_DATA = images/head.png guidoc_DATA = images/head.png
DOC_PYTHONPATH=$(prefix)/bin/salome:$(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(MED_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GEOM_ROOT_DIR)/bin/salome:$(GEOM_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages
DOC_SMESH_MeshersList=StdMeshers
usr_docs: doxyfile_py doxyfile # to have smesh.py in the documentation instead of smeshDC.py
echo "===========================================" ; \ # we create dummy smesh.py from the smeshDC.py
echo "Replacing smeshDC by smesh" ; \ smesh.py: ../../../../src/SMESH_SWIG/smeshDC.py
echo "===========================================" ; \ @awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \
awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \ $< > $@
$(top_srcdir)/src/SMESH_SWIG/smeshDC.py > ./smesh.py ; \
echo "===========================================" ; \ tmp/smesh.py: $(top_srcdir)/src/SMESH_SWIG/StdMeshersDC.py $(srcdir)/collect_mesh_methods.py
echo "Generating Python interface documentation"; \ @$(MKDIR_P) tmp && PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(srcdir)/collect_mesh_methods.py -o $@ StdMeshers
echo "===========================================" ; \
$(DOXYGEN) doxyfile_py ; \ usr_docs: doxyfile_py doxyfile smesh.py tmp/smesh.py
echo "===========================================" ; \ @$(DOXYGEN) doxyfile_py ; \
echo "Generating GUI documentation" ; \ $(DOXYGEN) doxyfile
echo "===========================================" ; \
$(DOXYGEN) doxyfile ; \
rm -f ./smesh.py
docs: usr_docs docs: usr_docs

View File

@ -0,0 +1,114 @@
#!/usr/bin/env python
#################################################################################
#
# File: collect_mesh_methods.py
# Author: Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
#
#################################################################################
#
# Extraction of the meshing algorithm classes
# dynamically added by the plug-in to the Mesh
# class.
#
# This script is intended for internal usage - only
# for generatation of the extra developer documentation for
# the meshing plug-in(s).
#
# Usage:
# collect_mesh_methods.py <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 sys
def main(plugin, dummymeshhelp = True, output_file = "smesh.py"):
plugin_module = plugin + "DC"
try:
mod = __import__(plugin_module)
methods = {}
for attr in dir( mod ):
if attr.startswith( '_' ): continue
algo = getattr( mod, attr )
if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ):
method = getattr( algo, "meshMethod" )
if method not in methods: methods[ method ] = []
methods[ method ].append( algo )
pass
pass
if methods:
output = []
if dummymeshhelp:
# Add dummy Mesh help
# This is supposed to be done when generating documentation for meshing plug-ins
output.append( "## This class allows defining and managing a mesh." )
output.append( "#" )
output.append( "# @note The documentation below does not provide complete description of class @b %Mesh" )
output.append( "# from @b %smesh.py package. This documentation provides only information about" )
output.append( "# the methods dynamically added to the %Mesh class by the " + plugin + " plugin" )
output.append( "# For more details on the %Mesh class, please refer to the SALOME %Mesh module" )
output.append( "# documentation." )
pass
else:
# Extend documentation for Mesh class with information about dynamically added methods.
# This is supposed to be done only when building documentation for SMESH module
output.append( "## This class allows defining and managing a mesh." )
output.append( "#" )
output.append( "# @note Some methods are dynamically added to the @b %Mesh class in runtime by meshing " )
output.append( "# plug-in modules. If you fail to find help on some methods in the documentation of SMESH module, " )
output.append( "# try to look into the documentation for the meshing plug-ins." )
pass
output.append( "class Mesh:" )
for method in methods:
docHelper = ""
for algo in methods[ method ]:
if hasattr( algo, "docHelper" ): docHelper = getattr( algo, "docHelper" )
if docHelper: break
pass
if not docHelper: docHelper = "Creates new algorithm."
output.append( " ## %s." % docHelper )
output.append( " # This method is dynamically added to %Mesh class by the meshing plug-in(s). " )
output.append( " #" )
output.append( " # If the optional @a geom_shape parameter is not set, this algorithm is global (applied to whole mesh)." )
output.append( " # Otherwise, this algorithm defines a submesh based on @a geom_shape subshape." )
output.append( " # @param algo_type type of algorithm to be created; allowed values are specified by classes implemented by plug-in (see below)" )
output.append( " # @param geom_shape if defined, the subshape to be meshed (GEOM_Object)" )
output.append( " # @return An instance of Mesh_Algorithm sub-class according to the specified @a algo_type:" )
output.append( " # %s" % ", ".join( [ "%s.%s" % ( plugin_module, algo.__name__ ) for algo in methods[ method ] ] ) )
output.append( " def %s(algo_type, geom_shape=0):" % method )
output.append( " pass" )
pass
f = open(output_file, "w")
for line in output: f.write( line + "\n" )
f.close()
pass
pass
except Exception, e:
print e
pass
pass
if __name__ == "__main__":
import optparse
parser = optparse.OptionParser(usage="%prog [options] plugin")
h = "Output file (smesh.py by default)"
parser.add_option("-o", "--output", dest="output",
action="store", default=None, metavar="file",
help=h)
h = "If this option is True, dummy help for Mesh class is added. "
h += "This option should be False (default) when building documentation for SMESH module "
h += "and True when building documentation for meshing plug-ins."
parser.add_option("-d", "--dummy-mesh-help", dest="dummymeshhelp",
action="store_true", default=False,
help=h)
(options, args) = parser.parse_args()
if len( args ) < 1: sys.exit("Plugin name is not specified")
main( args[0], options.dummymeshhelp, options.output )
pass

View File

@ -99,7 +99,7 @@ EXAMPLE_RECURSIVE = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#Input related options #Input related options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = smesh.py @top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py INPUT = smesh.py @top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py tmp/smesh.py
FILE_PATTERNS = FILE_PATTERNS =
IMAGE_PATH = @srcdir@/images IMAGE_PATH = @srcdir@/images
RECURSIVE = NO RECURSIVE = NO

View File

@ -2,44 +2,37 @@
\page smeshpy_interface_page Python interface \page smeshpy_interface_page Python interface
Python package smesh defines several classes, destined for easy and Python API for SALOME %Mesh module defines several classes that can
clear mesh creation and edition. be used for easy mesh creation and edition.
Documentation for smesh package is available in two forms: Documentation for SALOME %Mesh module Python API is available in two forms:
- <a href="smeshpy_doc/modules.html">Structured documentation</a>, where all methods and
The <a href="smeshpy_doc/modules.html"> structured
documentation for smesh package</a>, where all methods and
classes are grouped by their functionality, like it is done in the GUI documentation classes are grouped by their functionality, like it is done in the GUI documentation
and the \ref smeshDC "linear documentation for smesh package" - <a href="smeshpy_doc/namespaces.html">Linear documentation</a> grouped only by classes, declared
grouped only by classes, declared in the smesh.py file. in the \ref smesh and StdMeshersDC Python packages.
The main page of the \ref smeshDC "linear documentation for smesh package" Python package \ref smesh provides an interface to create and handle
contains a list of data structures and a list of meshes. It can be used to create an empty mesh or to import mesh from the data file.
functions, provided by the package smesh.py. The first item in
the list of data structures (\ref smeshDC::smeshDC "class smesh")
also represents documentation for the methods of the package smesh.py itself.
The package smesh.py provides an interface to create and handle As soon as mesh is created, it is possible to manage it via its own
meshes. Use it to create an empty mesh or to import it from the data file. methods, described in \ref smesh.Mesh "class Mesh" documentation.
Once a mesh has been created, it is possible to manage it via its own Class \ref smesh.Mesh "Mesh" allows assigning algorithms to a mesh.
methods, described at \ref smeshDC::Mesh "class Mesh" documentation Please note that some algorithms, included in the standard SALOME
(it is also accessible by the second item "class Mesh" in the list of data structures). distribution are always available. Python package \ref StdMeshersDC
provides an interface for standard meshing algorithms included into
Class \b Mesh allows assigning algorithms to a mesh. the SALOME %Mesh module distribution, like:
Please note, that some algorithms, included in the standard SALOME
distribution are always available:
- REGULAR (1D) - REGULAR (1D)
- COMPOSITE (1D) - COMPOSITE (1D)
- MEFISTO (2D) - MEFISTO (2D)
- Quadrangle (2D) - Quadrangle (2D)
- Hexa(3D) - Hexa(3D)
- etc... - etc ...
To add hypotheses, use the interfaces, provided by the assigned To add meshing hypotheses, it is possible to use the functions provided by the
algorithms. algorithms interfaces.
Below you can see an example of usage of the package smesh for 3d mesh generation. An example below demonstrates usage of the Python API for 3d mesh generation.
\anchor example_3d_mesh \anchor example_3d_mesh
<h2>Example of 3d mesh generation:</h2> <h2>Example of 3d mesh generation:</h2>
@ -118,7 +111,7 @@ tetra.Group(group)
\endcode \endcode
Examples of Python scripts for all Mesh operations are available by Examples of Python scripts for Mesh operations are available by
the following links: the following links:
- \subpage tui_creating_meshes_page - \subpage tui_creating_meshes_page

View File

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

View File

@ -20,10 +20,8 @@
# Author : Francis KLOSS, OCC # Author : Francis KLOSS, OCC
# Module : SMESH # Module : SMESH
""" ## @package smesh
\namespace smesh # Python API for SALOME %Mesh module
\brief Module smesh
"""
## @defgroup l1_auxiliary Auxiliary methods and structures ## @defgroup l1_auxiliary Auxiliary methods and structures
## @defgroup l1_creating Creating meshes ## @defgroup l1_creating Creating meshes