PAL6951: Documentation of meshpy.py.

This commit is contained in:
jfa 2005-01-14 12:06:51 +00:00
parent b2ec35e1ca
commit d8359857be
5 changed files with 319 additions and 54 deletions

View File

@ -16,13 +16,28 @@ doxygen=@DOXYGEN@
@COMMENCE@
PYTHON_SCRIPTS = \
meshpy.py
docs:
cp -fr $(srcdir)/SMESH ./INPUT; \
cd INPUT; \
sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
mv -f doxyfile1 doxyfile; \
$(doxygen) ./doxyfile; \
cd ..; \
mkdir py1; mkdir py2; \
cd ..
for file in $(PYTHON_SCRIPTS) dummy; do \
if [ $$file != "dummy" ]; then \
cp $(root_srcdir)/src/SMESH_SWIG/$$file INPUT/py1/; \
fi ; \
done
cd INPUT; \
python $(KERNEL_ROOT_DIR)/doc/salome/tui/KERNEL/pythfilter.py ./py1 ./py2; \
sed 's|list_py_files_to_process|$(PYTHON_SCRIPTS)|' ./doxyfile_py > py2/doxyfile_py; \
cd py2; \
$(doxygen) ./doxyfile_py; \
cd ../..; \
cp -fr $(srcdir)/SMESH/sources/static/*.* ./SMESH/
cp -fr $(srcdir)/SMESH/sources/ SMESH/
cp -fr $(srcdir)/SMESH/HTML/ SMESH/

200
doc/salome/tui/SMESH/doxyfile_py Executable file
View File

@ -0,0 +1,200 @@
# Doxyfile 1.3-rc1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SALOME - SMESH - v.2.1.0"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = NO
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 5
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 25
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = YES
SHOW_USED_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = log.txt
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = list_py_files_to_process
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = ../sources/
INPUT_FILTER =
FILTER_SOURCE_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = ../SMESH/meshpy_doc
HTML_FILE_EXTENSION = .html
HTML_HEADER = ../sources/myheader_py2.html
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = YES
TOC_EXPAND = YES
DISABLE_INDEX = YES
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_SCHEMA =
XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = jpg
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1200
GENERATE_LEGEND = NO
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =

View File

@ -0,0 +1,24 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
<title>Main Page</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
&nbsp;
<center><table WIDTH="96%" >
<tr>
<td><a href="http://www.opencascade.com"><img src="../sources/logocorp.gif" BORDER=0 height=46 width=122></a></td>
<td>
<div align=right><a href="http://www.opencascade.org/SALOME/"><img src="../sources/application.gif" BORDER=0 height=46 width=108></a></div>
</td>
</tr>
</table></center>
</body>
</html>

View File

@ -18,5 +18,12 @@ aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
insDoc(aux1, gLnk("Mapping of SMESH IDL definitions to Python language", "", "page2.html"))
aux1 = insFld(foldersTree, gFld("Python Commands", "", "meshpy_doc/main.html"))
insDoc(aux1, gLnk("Package List", "", "meshpy_doc/namespaces.html"))
insDoc(aux1, gLnk("Data Structures", "", "meshpy_doc/annotated.html"))
insDoc(aux1, gLnk("Namespace Members", "", "meshpy_doc/namespacemembers.html"))
insDoc(aux1, gLnk("File List", "", "meshpy_doc/files.html"))
aux1 = insFld(foldersTree, gFld("Adding meshers in SMESH", ""))
insDoc(aux1, gLnk("Using Plugin mechanism in SMESH", "", "PluginMeshers.html"))

View File

@ -5,13 +5,16 @@
# ------
import geompy
import salome
import StdMeshers
import SMESH
"""
\namespace meshpy
\brief Module meshpy
"""
# Variables
# ---------
@ -20,24 +23,29 @@ smesh.SetCurrentStudy(salome.myStudy)
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init(salome.myStudyId)
# Hexahedrical meshing
#
# Examples: cube2pyGibi.py, lines 270-295
# cube2partition.py, lines 72-83
# --------------------
class MeshHexaImpl:
"""
Class MeshHexaImpl for Hexahedrical meshing
Examples: cube2pyGibi.py, lines 270-295
cube2partition.py, lines 72-83
"""
piece = 0
name = 0
mesh = 0
cpt = 0
# Sets algorithm and hypothesis for 1D discretization of the <shape>:
# - algorithm "Regular_1D"
# - hypothesis "NumberOfSegments" with number of segments <n>
# --------------------
def Mesh1D(self, shape, n, propagate=0):
"""
Define Wires discretization.
Sets algorithm and hypothesis for 1D discretization of \a shape:
- algorithm "Regular_1D"
- hypothesis "NumberOfSegments" with number of segments \a n
\param shape Main shape or sub-shape to define wire discretization of
\param n Number of segments to split eash wire of the \a shape on
\param propagate Boolean flag. If propagate = 1,
"Propagation" hypothesis will be applied also to the \a shape
"""
hyp1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
smeshgui.SetName(salome.ObjectToID(hyp1D), self.name+"/WireDiscretisation/"+str(self.cpt))
self.mesh.AddHypothesis(shape, hyp1D)
@ -54,21 +62,24 @@ class MeshHexaImpl:
self.cpt=self.cpt+1
# Constructor
#
# Creates mesh on the shape <piece>,
# sets GUI name of this mesh to <name>.
# Sets the following global algorithms and hypotheses:
# - for 1D discretization:
# - algorithm "Regular_1D"
# - hypothesis "NumberOfSegments" with number of segments <n>,
# - for 2D discretization:
# - algorithm "Quadrangle_2D"
# - for 3D discretization:
# - algorithm "Hexa_3D"
# --------------------
def __init__(self, piece, n, name):
"""
Constructor
Creates mesh on the shape \a piece,
sets GUI name of this mesh to \a name. \n
Sets the following global algorithms and hypotheses:
- for 1D discretization:
- algorithm "Regular_1D"
- hypothesis "NumberOfSegments" with number of segments \a n
- for 2D discretization:
- algorithm "Quadrangle_2D"
- for 3D discretization:
- algorithm "Hexa_3D"
\param piece Shape to be meshed
\param n Global number of segments for wires discretization
\param name Name for mesh to be created
"""
self.piece = piece
self.name = name
@ -85,44 +96,50 @@ class MeshHexaImpl:
smeshgui.SetName(salome.ObjectToID(hyp3D), name+"/ijk")
self.mesh.AddHypothesis(piece, hyp3D)
# Creates sub-mesh of the mesh, created by constructor.
# This sub-mesh will be created on edge <edge>.
# Set algorithm and hypothesis for 1D discretization of the <edge>:
# - algorithm "Regular_1D"
# - hypothesis "NumberOfSegments" with number of segments <n>
# Note: the <edge> will be automatically published in study under the shape, given in constructor.
# --------------------
def local(self, edge, n):
"""
Creates sub-mesh of the mesh, created by constructor.
This sub-mesh will be created on edge \a edge.
Set algorithm and hypothesis for 1D discretization of the \a edge:
- algorithm "Regular_1D"
- hypothesis "NumberOfSegments" with number of segments \a n
\param edge Sub-edge of the main shape
\param n Number of segments to split the \a edge on
\note: \a edge will be automatically published in study under the shape, given in constructor.
"""
geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
self.Mesh1D(edge, n)
# Creates sub-mesh of the mesh, created by constructor.
# This sub-mesh will be created on edge <edge> and propagate the hypothesis on all correspondant edges.
# Set algorithm and hypothesis for 1D discretization of the <edge> and all other propagate edges:
# - algorithm "Regular_1D"
# - hypothesis "NumberOfSegments" with number of segments <n>
# - hypothesis "Propagation" with number of segments <n>
# Note: the <edge> will be automatically published in study under the shape, given in constructor.
# --------------------
def Propagate(self, edge, n):
"""
Creates sub-mesh of the mesh, created by constructor.
This sub-mesh will be created on edge \a edge and propagate the hypothesis on all correspondant edges.
Set algorithm and hypothesis for 1D discretization of the \a edge and all other propagate edges:
- algorithm "Regular_1D"
- hypothesis "NumberOfSegments" with number of segments \a n
- hypothesis "Propagation"
\param edge Sub-edge of the main shape
\param n Number of segments to split the \a edge and all other propagate edges on
\note: \a edge will be automatically published in study under the shape, given in constructor.
"""
geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
self.Mesh1D(edge, n, 1)
# Computes mesh, created by constructor.
# --------------------
def Compute(self):
"""
Computes mesh, created by constructor.
"""
smesh.Compute(self.mesh, self.piece)
salome.sg.updateObjBrowser(1)
# Creates mesh group based on a geometric group
# --------------------
def Group(self, grp, name=""):
"""
Creates mesh group based on a geometric group
\param grp Geometric group
\param name Name for mesh group to be created
"""
if name == "":
name = grp.GetName()
tgeo = geompy.GroupOp.GetType(grp)
@ -136,10 +153,12 @@ class MeshHexaImpl:
type = SMESH.VOLUME
return self.mesh.CreateGroupFromGEOM(type, name, grp)
# Export mesh in a MED file
# --------------------
def ExportMED(self, filename, groups=1):
"""
Export mesh in a MED file
\param filename Name for MED file to be created
\param groups Boolean flag. If groups = 1, mesh groups will be also stored in file
"""
self.mesh.ExportMED(filename, groups)
MeshHexa = MeshHexaImpl