Add new type of Doxygen comments for generating documentation of Python files.

This commit is contained in:
mkr 2006-05-24 08:15:18 +00:00
parent 8f5e8cdfbb
commit 76a6098c04

View File

@ -31,8 +31,6 @@ import geompy
import StdMeshers import StdMeshers
import SMESH import SMESH
# Public variables
# ----------------
REGULAR = 1 REGULAR = 1
PYTHON = 2 PYTHON = 2
@ -43,8 +41,6 @@ GHS3D = 4
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
smesh.SetCurrentStudy(salome.myStudy) smesh.SetCurrentStudy(salome.myStudy)
# Private functions
# -----------------
NO_NAME = "NoName" NO_NAME = "NoName"
@ -64,39 +60,31 @@ def SetName(obj, name):
attr = sobj.FindAttribute("AttributeName")[1] attr = sobj.FindAttribute("AttributeName")[1]
attr.SetValue(name) attr.SetValue(name)
# Algorithms and hypothesis ## Mother class to define algorithm, recommended to don't use directly.
# ========================= #
# More details.
# Private class: Mesh_Algorithm
# -----------------------------
class Mesh_Algorithm: class Mesh_Algorithm:
""" # @class Mesh_Algorithm
Mother class to define algorithm, recommended to don't use directly # @brief Class Mesh_Algorithm
"""
mesh = 0 mesh = 0
geom = 0 geom = 0
subm = 0 subm = 0
algo = 0 algo = 0
## If the algorithm is global, return 0
# \fn else return the submesh associated to this algorithm.
#
# More details.
def GetSubMesh(self): def GetSubMesh(self):
"""
If the algorithm is global, return 0
else return the submesh associated to this algorithm
"""
return self.subm return self.subm
## Return the wrapped mesher.
def GetAlgorithm(self): def GetAlgorithm(self):
"""
Return the wrapped mesher
"""
return self.algo return self.algo
## Private method. Print error message if a hypothesis was not assigned.
def TreatHypoStatus(self, status, hypName, geomName, isAlgo): def TreatHypoStatus(self, status, hypName, geomName, isAlgo):
"""
Private method. Print error message if a hypothesis was not assigned
"""
if isAlgo: if isAlgo:
hypType = "algorithm" hypType = "algorithm"
else: else:
@ -125,10 +113,8 @@ class Mesh_Algorithm:
print hypName, "was not assigned to",geomName,":", reason print hypName, "was not assigned to",geomName,":", reason
pass pass
## Private method.
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"): def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
"""
Private method
"""
if geom is None: if geom is None:
raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape" raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
self.mesh = mesh self.mesh = mesh
@ -149,10 +135,8 @@ class Mesh_Algorithm:
status = mesh.mesh.AddHypothesis(self.geom, self.algo) status = mesh.mesh.AddHypothesis(self.geom, self.algo)
self.TreatHypoStatus( status, hypo, name, 1 ) self.TreatHypoStatus( status, hypo, name, 1 )
## Private method
def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"): def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"):
"""
Private method
"""
hypo = smesh.CreateHypothesis(hyp, so) hypo = smesh.CreateHypothesis(hyp, so)
a = "" a = ""
s = "=" s = "="
@ -171,32 +155,26 @@ class Mesh_Algorithm:
# Public class: Mesh_Segment # Public class: Mesh_Segment
# -------------------------- # --------------------------
## Class to define a segment 1D algorithm for discretization
#
# More details.
class Mesh_Segment(Mesh_Algorithm): class Mesh_Segment(Mesh_Algorithm):
"""
Class to define a segment 1D algorithm for discretization
"""
## Private constructor.
def __init__(self, mesh, geom=0): def __init__(self, mesh, geom=0):
"""
Private constructor
"""
self.Create(mesh, geom, "Regular_1D") self.Create(mesh, geom, "Regular_1D")
## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
# @param l for the length of segments that cut an edge
def LocalLength(self, l): def LocalLength(self, l):
"""
Define "LocalLength" hypothesis to cut an edge in several segments with the same length
\param l for the length of segments that cut an edge
"""
hyp = self.Hypothesis("LocalLength", [l]) hyp = self.Hypothesis("LocalLength", [l])
hyp.SetLength(l) hyp.SetLength(l)
return hyp return hyp
## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
# @param n for the number of segments that cut an edge
# @param s for the scale factor (optional)
def NumberOfSegments(self, n, s=[]): def NumberOfSegments(self, n, s=[]):
"""
Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
\param n for the number of segments that cut an edge
\param s for the scale factor (optional)
"""
if s == []: if s == []:
hyp = self.Hypothesis("NumberOfSegments", [n]) hyp = self.Hypothesis("NumberOfSegments", [n])
else: else:
@ -206,86 +184,70 @@ class Mesh_Segment(Mesh_Algorithm):
hyp.SetNumberOfSegments(n) hyp.SetNumberOfSegments(n)
return hyp return hyp
## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
# @param start for the length of the first segment
# @param end for the length of the last segment
def Arithmetic1D(self, start, end): def Arithmetic1D(self, start, end):
"""
Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
\param start for the length of the first segment
\param end for the length of the last segment
"""
hyp = self.Hypothesis("Arithmetic1D", [start, end]) hyp = self.Hypothesis("Arithmetic1D", [start, end])
hyp.SetLength(start, 1) hyp.SetLength(start, 1)
hyp.SetLength(end , 0) hyp.SetLength(end , 0)
return hyp return hyp
## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
# @param start for the length of the first segment
# @param end for the length of the last segment
def StartEndLength(self, start, end): def StartEndLength(self, start, end):
"""
Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
\param start for the length of the first segment
\param end for the length of the last segment
"""
hyp = self.Hypothesis("StartEndLength", [start, end]) hyp = self.Hypothesis("StartEndLength", [start, end])
hyp.SetLength(start, 1) hyp.SetLength(start, 1)
hyp.SetLength(end , 0) hyp.SetLength(end , 0)
return hyp return hyp
## Define "Deflection1D" hypothesis
# @param d for the deflection
def Deflection1D(self, d): def Deflection1D(self, d):
"""
Define "Deflection1D" hypothesis
\param d for the deflection
"""
hyp = self.Hypothesis("Deflection1D", [d]) hyp = self.Hypothesis("Deflection1D", [d])
hyp.SetDeflection(d) hyp.SetDeflection(d)
return hyp return hyp
## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
# the opposite side in the case of quadrangular faces
def Propagation(self): def Propagation(self):
"""
Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
the opposite side in the case of quadrangular faces
"""
return self.Hypothesis("Propagation") return self.Hypothesis("Propagation")
## Define "AutomaticLength" hypothesis
# @param fineness for the fineness [0-1]
def AutomaticLength(self, fineness=0): def AutomaticLength(self, fineness=0):
"""
Define "AutomaticLength" hypothesis
\param fineness for the fineness [0-1]
"""
hyp = self.Hypothesis("AutomaticLength") hyp = self.Hypothesis("AutomaticLength")
hyp.SetFineness( fineness ) hyp.SetFineness( fineness )
return hyp return hyp
## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
# If the 2D mesher sees that all boundary edges are quadratic ones,
# it generates quadratic faces, else it generates linear faces using
# medium nodes as if they were vertex ones.
# The 3D mesher generates quadratic volumes only if all boundary faces
# are quadratic ones, else it fails.
def QuadraticMesh(self): def QuadraticMesh(self):
"""
Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
If the 2D mesher sees that all boundary edges are quadratic ones,
it generates quadratic faces, else it generates linear faces using
medium nodes as if they were vertex ones.
The 3D mesher generates quadratic volumes only if all boundary faces
are quadratic ones, else it fails.
"""
hyp = self.Hypothesis("QuadraticMesh") hyp = self.Hypothesis("QuadraticMesh")
return hyp return hyp
# Public class: Mesh_Segment_Python # Public class: Mesh_Segment_Python
# --------------------------------- # ---------------------------------
## Class to define a segment 1D algorithm for discretization with python function
#
# More details.
class Mesh_Segment_Python(Mesh_Segment): class Mesh_Segment_Python(Mesh_Segment):
"""
Class to define a segment 1D algorithm for discretization with python function
"""
## Private constructor.
def __init__(self, mesh, geom=0): def __init__(self, mesh, geom=0):
"""
Private constructor
"""
import Python1dPlugin import Python1dPlugin
self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so") self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
# @param n for the number of segments that cut an edge
# @param func for the python function that calculate the length of all segments
def PythonSplit1D(self, n, func): def PythonSplit1D(self, n, func):
"""
Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
\param n for the number of segments that cut an edge
\param func for the python function that calculate the length of all segments
"""
hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so") hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so")
hyp.SetNumberOfSegments(n) hyp.SetNumberOfSegments(n)
hyp.SetPythonLog10RatioFunction(func) hyp.SetPythonLog10RatioFunction(func)
@ -294,78 +256,64 @@ class Mesh_Segment_Python(Mesh_Segment):
# Public class: Mesh_Triangle # Public class: Mesh_Triangle
# --------------------------- # ---------------------------
## Class to define a triangle 2D algorithm
#
# More details.
class Mesh_Triangle(Mesh_Algorithm): class Mesh_Triangle(Mesh_Algorithm):
"""
Class to define a triangle 2D algorithm
"""
## Private constructor.
def __init__(self, mesh, geom=0): def __init__(self, mesh, geom=0):
"""
Private constructor
"""
self.Create(mesh, geom, "MEFISTO_2D") self.Create(mesh, geom, "MEFISTO_2D")
## Define "MaxElementArea" hypothesis to give the maximun area of each triangles
# @param area for the maximum area of each triangles
def MaxElementArea(self, area): def MaxElementArea(self, area):
"""
Define "MaxElementArea" hypothesis to give the maximun area of each triangles
\param area for the maximum area of each triangles
"""
hyp = self.Hypothesis("MaxElementArea", [area]) hyp = self.Hypothesis("MaxElementArea", [area])
hyp.SetMaxElementArea(area) hyp.SetMaxElementArea(area)
return hyp return hyp
## Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
def LengthFromEdges(self): def LengthFromEdges(self):
"""
Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
"""
return self.Hypothesis("LengthFromEdges") return self.Hypothesis("LengthFromEdges")
# Public class: Mesh_Quadrangle # Public class: Mesh_Quadrangle
# ----------------------------- # -----------------------------
## Class to define a quadrangle 2D algorithm
#
# More details.
class Mesh_Quadrangle(Mesh_Algorithm): class Mesh_Quadrangle(Mesh_Algorithm):
"""
Class to define a quadrangle 2D algorithm
"""
## Private constructor.
def __init__(self, mesh, geom=0): def __init__(self, mesh, geom=0):
"""
Private constructor
"""
self.Create(mesh, geom, "Quadrangle_2D") self.Create(mesh, geom, "Quadrangle_2D")
## Define "QuadranglePreference" hypothesis, forcing construction
# of quadrangles if the number of nodes on opposite edges is not the same
# in the case where the global number of nodes on edges is even
def QuadranglePreference(self): def QuadranglePreference(self):
"""
Define "QuadranglePreference" hypothesis, forcing construction
of quadrangles if the number of nodes on opposite edges is not the same
in the case where the global number of nodes on edges is even
"""
hyp = self.Hypothesis("QuadranglePreference") hyp = self.Hypothesis("QuadranglePreference")
return hyp return hyp
# Public class: Mesh_Tetrahedron # Public class: Mesh_Tetrahedron
# ------------------------------ # ------------------------------
## Class to define a tetrahedron 3D algorithm
#
# More details.
class Mesh_Tetrahedron(Mesh_Algorithm): class Mesh_Tetrahedron(Mesh_Algorithm):
"""
Class to define a tetrahedron 3D algorithm
"""
## Private constructor.
def __init__(self, mesh, algo, geom=0): def __init__(self, mesh, algo, geom=0):
"""
Private constructor
"""
if algo == NETGEN: if algo == NETGEN:
self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so") self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
elif algo == GHS3D: elif algo == GHS3D:
import GHS3DPlugin import GHS3DPlugin
self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so") self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
## Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral
# @param vol for the maximum volume of each tetrahedral
def MaxElementVolume(self, vol): def MaxElementVolume(self, vol):
"""
Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral
\param vol for the maximum volume of each tetrahedral
"""
hyp = self.Hypothesis("MaxElementVolume", [vol]) hyp = self.Hypothesis("MaxElementVolume", [vol])
hyp.SetMaxElementVolume(vol) hyp.SetMaxElementVolume(vol)
return hyp return hyp
@ -373,42 +321,36 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
# Public class: Mesh_Hexahedron # Public class: Mesh_Hexahedron
# ------------------------------ # ------------------------------
## Class to define a hexahedron 3D algorithm
#
# More details.
class Mesh_Hexahedron(Mesh_Algorithm): class Mesh_Hexahedron(Mesh_Algorithm):
"""
Class to define a hexahedron 3D algorithm
"""
## Private constructor.
def __init__(self, mesh, geom=0): def __init__(self, mesh, geom=0):
"""
Private constructor
"""
self.Create(mesh, geom, "Hexa_3D") self.Create(mesh, geom, "Hexa_3D")
# Public class: Mesh_Netgen # Public class: Mesh_Netgen
# ------------------------------ # ------------------------------
## Class to define a NETGEN-based 2D or 3D algorithm
# that need no discrete boundary (i.e. independent)
#
# More details.
class Mesh_Netgen(Mesh_Algorithm): class Mesh_Netgen(Mesh_Algorithm):
"""
Class to define a NETGEN-based 2D or 3D algorithm
that need no discrete boundary (i.e. independent)
"""
is3D = 0 is3D = 0
## Private constructor.
def __init__(self, mesh, is3D, geom=0): def __init__(self, mesh, is3D, geom=0):
"""
Private constructor
"""
self.is3D = is3D self.is3D = is3D
if is3D: if is3D:
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so") self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
else: else:
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so") self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
## Define hypothesis containing parameters of the algorithm
def Parameters(self): def Parameters(self):
"""
Define hypothesis containing parameters of the algorithm
"""
if self.is3D: if self.is3D:
hyp = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so") hyp = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so")
else: else:
@ -418,23 +360,21 @@ class Mesh_Netgen(Mesh_Algorithm):
# Public class: Mesh # Public class: Mesh
# ================== # ==================
## Class to define a mesh
#
# More details.
class Mesh: class Mesh:
"""
Class to define a mesh
"""
geom = 0 geom = 0
mesh = 0 mesh = 0
## Constructor
#
# Creates mesh on the shape \a geom,
# sets GUI name of this mesh to \a name.
# @param geom Shape to be meshed
# @param name Study name of the mesh
def __init__(self, geom, name=0): def __init__(self, geom, name=0):
"""
Constructor
Creates mesh on the shape \a geom,
sets GUI name of this mesh to \a name.
\param geom Shape to be meshed
\param name Study name of the mesh
"""
self.geom = geom self.geom = geom
self.mesh = smesh.CreateMesh(geom) self.mesh = smesh.CreateMesh(geom)
if name == 0: if name == 0:
@ -442,22 +382,16 @@ class Mesh:
else: else:
SetName(self.mesh, name) SetName(self.mesh, name)
## Method that returns the mesh
def GetMesh(self): def GetMesh(self):
"""
Method that returns the mesh
"""
return self.mesh return self.mesh
## Method that returns the shape associated to the mesh
def GetShape(self): def GetShape(self):
"""
Method that returns the shape associated to the mesh
"""
return self.geom return self.geom
## Returns mesh dimension depending on shape one
def MeshDimension(self): def MeshDimension(self):
"""
Returns mesh dimension depending on shape one
"""
shells = geompy.SubShapeAllIDs( self.geom, geompy.ShapeType["SHELL"] ) shells = geompy.SubShapeAllIDs( self.geom, geompy.ShapeType["SHELL"] )
if len( shells ) > 0 : if len( shells ) > 0 :
return 3 return 3
@ -469,15 +403,13 @@ class Mesh:
return 0; return 0;
pass pass
## Creates a segment discretization 1D algorithm.
# If the optional \a algo parameter is not sets, this algorithm is REGULAR.
# If the optional \a geom parameter is not sets, this algorithm is global.
# Otherwise, this algorithm define a submesh based on \a geom subshape.
# @param algo values are smesh.REGULAR or smesh.PYTHON for discretization via python function
# @param geom If defined, subshape to be meshed
def Segment(self, algo=REGULAR, geom=0): def Segment(self, algo=REGULAR, geom=0):
"""
Creates a segment discretization 1D algorithm.
If the optional \a algo parameter is not sets, this algorithm is REGULAR.
If the optional \a geom parameter is not sets, this algorithm is global.
Otherwise, this algorithm define a submesh based on \a geom subshape.
\param algo values are smesh.REGULAR or smesh.PYTHON for discretization via python function
\param geom If defined, subshape to be meshed
"""
## if Segment(geom) is called by mistake ## if Segment(geom) is called by mistake
if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)): if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)):
algo, geom = geom, algo algo, geom = geom, algo
@ -489,63 +421,51 @@ class Mesh:
else: else:
return Mesh_Segment(self, geom) return Mesh_Segment(self, geom)
## Creates a triangle 2D algorithm for faces.
# If the optional \a geom parameter is not sets, this algorithm is global.
# Otherwise, this algorithm define a submesh based on \a geom subshape.
# @param geom If defined, subshape to be meshed
def Triangle(self, geom=0): def Triangle(self, geom=0):
"""
Creates a triangle 2D algorithm for faces.
If the optional \a geom parameter is not sets, this algorithm is global.
Otherwise, this algorithm define a submesh based on \a geom subshape.
\param geom If defined, subshape to be meshed
"""
return Mesh_Triangle(self, geom) return Mesh_Triangle(self, geom)
## Creates a quadrangle 2D algorithm for faces.
# If the optional \a geom parameter is not sets, this algorithm is global.
# Otherwise, this algorithm define a submesh based on \a geom subshape.
# @param geom If defined, subshape to be meshed
def Quadrangle(self, geom=0): def Quadrangle(self, geom=0):
"""
Creates a quadrangle 2D algorithm for faces.
If the optional \a geom parameter is not sets, this algorithm is global.
Otherwise, this algorithm define a submesh based on \a geom subshape.
\param geom If defined, subshape to be meshed
"""
return Mesh_Quadrangle(self, geom) return Mesh_Quadrangle(self, geom)
## Creates a tetrahedron 3D algorithm for solids.
# The parameter \a algo permits to choice the algorithm: NETGEN or GHS3D
# If the optional \a geom parameter is not sets, this algorithm is global.
# Otherwise, this algorithm define a submesh based on \a geom subshape.
# @param algo values are: smesh.NETGEN, smesh.GHS3D
# @param geom If defined, subshape to be meshed
def Tetrahedron(self, algo, geom=0): def Tetrahedron(self, algo, geom=0):
"""
Creates a tetrahedron 3D algorithm for solids.
The parameter \a algo permits to choice the algorithm: NETGEN or GHS3D
If the optional \a geom parameter is not sets, this algorithm is global.
Otherwise, this algorithm define a submesh based on \a geom subshape.
\param algo values are: smesh.NETGEN, smesh.GHS3D
\param geom If defined, subshape to be meshed
"""
## if Tetrahedron(geom) is called by mistake ## if Tetrahedron(geom) is called by mistake
if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)): if ( isinstance( algo, geompy.GEOM._objref_GEOM_Object)):
algo, geom = geom, algo algo, geom = geom, algo
pass pass
return Mesh_Tetrahedron(self, algo, geom) return Mesh_Tetrahedron(self, algo, geom)
## Creates a hexahedron 3D algorithm for solids.
# If the optional \a geom parameter is not sets, this algorithm is global.
# Otherwise, this algorithm define a submesh based on \a geom subshape.
# @param geom If defined, subshape to be meshed
def Hexahedron(self, geom=0): def Hexahedron(self, geom=0):
"""
Creates a hexahedron 3D algorithm for solids.
If the optional \a geom parameter is not sets, this algorithm is global.
Otherwise, this algorithm define a submesh based on \a geom subshape.
\param geom If defined, subshape to be meshed
"""
return Mesh_Hexahedron(self, geom) return Mesh_Hexahedron(self, geom)
## Creates a NETGEN-based 2D or 3D independent algorithm (i.e. needs no
# discrete boundary).
# If the optional \a geom parameter is not sets, this algorithm is global.
# Otherwise, this algorithm defines a submesh based on \a geom subshape.
# @param is3D If 0 then algorithm is 2D, otherwise 3D
# @param geom If defined, subshape to be meshed
def Netgen(self, is3D, geom=0): def Netgen(self, is3D, geom=0):
"""
Creates a NETGEN-based 2D or 3D independent algorithm (i.e. needs no
discrete boundary).
If the optional \a geom parameter is not sets, this algorithm is global.
Otherwise, this algorithm defines a submesh based on \a geom subshape.
\param is3D If 0 then algorithm is 2D, otherwise 3D
\param geom If defined, subshape to be meshed
"""
return Mesh_Netgen(self, is3D, geom) return Mesh_Netgen(self, is3D, geom)
## Compute the mesh and return the status of the computation
def Compute(self): def Compute(self):
"""
Compute the mesh and return the status of the computation
"""
ok = smesh.Compute(self.mesh, self.geom) ok = smesh.Compute(self.mesh, self.geom)
if not ok: if not ok:
errors = smesh.GetAlgoState( self.mesh, self.geom ) errors = smesh.GetAlgoState( self.mesh, self.geom )
@ -583,11 +503,9 @@ class Mesh:
pass pass
return ok return ok
## Compute tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN
# The parameter \a fineness [0.-1.] defines mesh fineness
def AutomaticTetrahedralization(self, fineness=0): def AutomaticTetrahedralization(self, fineness=0):
"""
Compute tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN
The parameter \a fineness [0.-1.] defines mesh fineness
"""
dim = self.MeshDimension() dim = self.MeshDimension()
# assign hypotheses # assign hypotheses
self.RemoveGlobalHypotheses() self.RemoveGlobalHypotheses()
@ -600,11 +518,9 @@ class Mesh:
pass pass
return self.Compute() return self.Compute()
## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
# The parameter \a fineness [0.-1.] defines mesh fineness
def AutomaticHexahedralization(self, fineness=0): def AutomaticHexahedralization(self, fineness=0):
"""
Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
The parameter \a fineness [0.-1.] defines mesh fineness
"""
dim = self.MeshDimension() dim = self.MeshDimension()
# assign hypotheses # assign hypotheses
self.RemoveGlobalHypotheses() self.RemoveGlobalHypotheses()
@ -617,24 +533,20 @@ class Mesh:
pass pass
return self.Compute() return self.Compute()
## Removes all global hypotheses
def RemoveGlobalHypotheses(self): def RemoveGlobalHypotheses(self):
"""
Removes all global hypotheses
"""
current_hyps = self.mesh.GetHypothesisList( self.geom ) current_hyps = self.mesh.GetHypothesisList( self.geom )
for hyp in current_hyps: for hyp in current_hyps:
self.mesh.RemoveHypothesis( self.geom, hyp ) self.mesh.RemoveHypothesis( self.geom, hyp )
pass pass
pass pass
## Create a mesh group based on geometric object \a grp
# and give a \a name, if this parameter is not defined
# the name is the same as the geometric group name
# @param grp is a geometric group, a vertex, an edge, a face or a solid
# @param name is the name of the mesh group
def Group(self, grp, name=""): def Group(self, grp, name=""):
"""
Create a mesh group based on geometric object \a grp
and give a \a name, if this parameter is not defined
the name is the same as the geometric group name
\param grp is a geometric group, a vertex, an edge, a face or a solid
\param name is the name of the mesh group
"""
if name == "": if name == "":
name = grp.GetName() name = grp.GetName()
@ -670,39 +582,29 @@ class Mesh:
else: else:
return self.mesh.CreateGroupFromGEOM(type, name, grp) return self.mesh.CreateGroupFromGEOM(type, name, grp)
## Export the mesh in a file with the MED format and choice the \a version of MED format
# @param f is the file name
# @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
def ExportToMED(self, f, version, opt=0): def ExportToMED(self, f, version, opt=0):
"""
Export the mesh in a file with the MED format and choice the \a version of MED format
\param f is the file name
\param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
"""
self.mesh.ExportToMED(f, opt, version) self.mesh.ExportToMED(f, opt, version)
## Export the mesh in a file with the MED format
# @param f is the file name
def ExportMED(self, f, opt=0): def ExportMED(self, f, opt=0):
"""
Export the mesh in a file with the MED format
\param f is the file name
"""
self.mesh.ExportMED(f, opt) self.mesh.ExportMED(f, opt)
## Export the mesh in a file with the DAT format
# @param f is the file name
def ExportDAT(self, f): def ExportDAT(self, f):
"""
Export the mesh in a file with the DAT format
\param f is the file name
"""
self.mesh.ExportDAT(f) self.mesh.ExportDAT(f)
## Export the mesh in a file with the UNV format
# @param f is the file name
def ExportUNV(self, f): def ExportUNV(self, f):
"""
Export the mesh in a file with the UNV format
\param f is the file name
"""
self.mesh.ExportUNV(f) self.mesh.ExportUNV(f)
## Export the mesh in a file with the STL format
# @param f is the file name
# @param ascii defined the kind of file contents
def ExportSTL(self, f, ascii=1): def ExportSTL(self, f, ascii=1):
"""
Export the mesh in a file with the STL format
\param f is the file name
\param ascii defined the kind of file contents
"""
self.mesh.ExportSTL(f, ascii) self.mesh.ExportSTL(f, ascii)