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-22 05:30:32 +00:00
parent 72dc83bdda
commit 8508f51dda
5 changed files with 261 additions and 98 deletions

View File

@ -29,16 +29,15 @@ EXTRA_DIST += images input static/footer.html static/doxygen.css
guidocdir = $(docdir)/gui/NETGENPLUGIN guidocdir = $(docdir)/gui/NETGENPLUGIN
guidoc_DATA = images/head.png guidoc_DATA = images/head.png
DOC_PYTHONPATH=$(prefix)/bin/salome:$(SMESH_ROOT_DIR)/bin/salome:$(SMESH_ROOT_DIR)/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=NETGENPlugin
usr_docs: doxyfile smesh.py: $(top_srcdir)/src/NETGENPlugin/NETGENPluginDC.py
echo "===========================================" ; \ @PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py -d -o $@ NETGENPlugin
echo "Generating Python interface documentation"; \
echo "===========================================" ; \ usr_docs: doxyfile_py doxyfile smesh.py
$(DOXYGEN) doxyfile_py \ @$(DOXYGEN) doxyfile_py ; \
echo "===========================================" ; \ $(DOXYGEN) doxyfile
echo "Generating GUI documentation" ; \
echo "===========================================" ; \
$(DOXYGEN) doxyfile ;
docs: usr_docs docs: usr_docs

View File

@ -99,7 +99,7 @@ EXAMPLE_RECURSIVE = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#Input related options #Input related options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = @top_srcdir@/src/NETGENPlugin/NETGENPluginDC.py INPUT = @top_srcdir@/src/NETGENPlugin/NETGENPluginDC.py smesh.py
FILE_PATTERNS = FILE_PATTERNS =
IMAGE_PATH = @srcdir@/images IMAGE_PATH = @srcdir@/images
RECURSIVE = NO RECURSIVE = NO
@ -159,4 +159,4 @@ DOT_CLEANUP = YES
#External reference options #External reference options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
GENERATE_TAGFILE = netgenpluginpy_doc.tag GENERATE_TAGFILE = netgenpluginpy_doc.tag
SEARCHENGINE = YES SEARCHENGINE = YES

View File

@ -24,8 +24,7 @@ algorithms </em></center>
- <b>Min Size</b> - minimum linear dimensions for mesh cells. It is - <b>Min Size</b> - minimum linear dimensions for mesh cells. It is
ignored if it is more than <b>Max Size</b>. ignored if it is more than <b>Max Size</b>.
- <b>Second Order</b> - if this box is checked in, the algorithm will - <b>Second Order</b> - if this box is checked in, the algorithm will
create second order nodes on the mesh, which actually will become create second order nodes on the mesh, which will then become quadratic.
\ref adding_quadratic_elements_page "Quadratic".
- <b>Fineness</b> - ranging from Very Coarse to Very Fine allows to set the - <b>Fineness</b> - ranging from Very Coarse to Very Fine allows to set the
level of meshing detalization using the three parameters below. You level of meshing detalization using the three parameters below. You
can select Custom to define them manually. can select Custom to define them manually.
@ -59,17 +58,18 @@ parameters</b> allow defining the size of elements for each
dimension. dimension.
\b 1D group allows defining the size of 1D elements in either of two ways: \b 1D group allows defining the size of 1D elements in either of two ways:
- <b>Number of Segments</b> has the same sense as \ref - <b>Number of Segments</b> allows specifying number of segments, that
number_of_segments_anchor "Number of segments" hypothesis with will split each edge, with equidistant distribution.
equidistant distribution. - <b>Local Length</b> can be applied for meshing of edges
- <b>Local Length</b> has the same sense as \ref composing geometrical object. Definition of this hypothesis
average_length_anchor "Local Length" hypothesis. consists of setting required \b length of segments.
\b 2D group allows defining the size of 2D elements \b 2D group allows defining the size of 2D elements
- <b>Length from edges</b> if checked in, acts like \ref - <b>Length from edges</b> if checked in, hypothesis forces building of
length_from_edges_anchor "Length from Edges" hypothesis, else 2D mesh segments having a length calculated as an average edge length
- <b>Max. Element Area</b> defines the maximum element area like \ref for a given wire, else
max_element_area_anchor "Max Element Area" hypothesis. - <b>Max. Element Area</b> specifies expected maximum element area for
each 2d element.
- <b>Allow Quadrangles</b> - allows to use quadrangle elements in a - <b>Allow Quadrangles</b> - allows to use quadrangle elements in a
triangle 2D mesh. This checkbox is not present in Netgen 3D simple parameters triangle 2D mesh. This checkbox is not present in Netgen 3D simple parameters
because currently building a tetrahedral mesh with quadrangle faces is because currently building a tetrahedral mesh with quadrangle faces is
@ -78,9 +78,8 @@ not possible.
\b 3D groups allows defining the size of 3D elements. \b 3D groups allows defining the size of 3D elements.
- <b>Length from faces</b> if checked in, the area of sides of - <b>Length from faces</b> if checked in, the area of sides of
volumic elements will be equal to an average area of 2D elements, else volumic elements will be equal to an average area of 2D elements, else
- <b>Max. Element Volume</b> defines the maximum element volume like - <b>Max. Element Volume</b> specifies expected maximum element volume
\ref max_element_volume_hypo_page "Max Element Volume" of each 3d element.
hypothesis.
\note Netgen algorithm does not strictly follow the input \note Netgen algorithm does not strictly follow the input
parameters. The actual mesh can be more or less dense than parameters. The actual mesh can be more or less dense than

View File

@ -2,9 +2,11 @@
\page netgenplugin_python_interface_page Python Interface \page netgenplugin_python_interface_page Python Interface
Python package \ref NETGENPluginDC "NETGENPlugin" defines several classes, destined for creation of the 2D and 3D meshes. Python package NETGENPluginDC defines several classes, destined for
creation of the 2D and 3D meshes.
Documentation for NETGENPlugin package is available in linear form grouped by classes, declared in the NETGENPluginDC.py file. NETGEN meshing plugin dynamically adds several methods to the
smesh.Mesh class to create meshing algorithms.
Below you can see an example of usage of the NETGENPlugin package for mesh generation: Below you can see an example of usage of the NETGENPlugin package for mesh generation:

View File

@ -17,6 +17,15 @@
# 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 NETGENPluginDC
# Python API for the NETGEN meshing plug-in module.
##
# @package smesh
# Documentation of the methods dynamically added by the NETGEN meshing plug-in to the
# smesh.Mesh class.
from smesh import Mesh_Algorithm, AssureGeomPublished, ParseParameters, IsEqual from smesh import Mesh_Algorithm, AssureGeomPublished, ParseParameters, IsEqual
# import NETGENPlugin module if possible # import NETGENPlugin module if possible
@ -27,71 +36,117 @@ except ImportError:
noNETGENPlugin = 1 noNETGENPlugin = 1
pass pass
# Types of algorithms #----------------------------
# Mesh algo type identifiers
#----------------------------
## Algorithm type: Netgen tetrahedron 3D algorithm, see NETGEN_3D_Algorithm
NETGEN_3D = "NETGEN_3D" NETGEN_3D = "NETGEN_3D"
## Algorithm type: Netgen tetrahedron 1D-2D-3D algorithm, see NETGEN_1D2D3D_Algorithm
NETGEN_1D2D3D = "NETGEN_2D3D" NETGEN_1D2D3D = "NETGEN_2D3D"
## Algorithm type: Netgen triangle 1D-2D algorithm, see NETGEN_1D2D_Algorithm
NETGEN_1D2D = "NETGEN_2D" NETGEN_1D2D = "NETGEN_2D"
## Algorithm type: Netgen triangle 2D algorithm, see NETGEN_2D_Only_Algorithm
NETGEN_2D = "NETGEN_2D_ONLY" NETGEN_2D = "NETGEN_2D_ONLY"
## Algorithm type: Synonim of NETGEN_1D2D3D, see NETGEN_1D2D3D_Algorithm
NETGEN_FULL = NETGEN_1D2D3D NETGEN_FULL = NETGEN_1D2D3D
## Algorithm type: Synonim of NETGEN_3D, see NETGEN_3D_Algorithm
NETGEN = NETGEN_3D NETGEN = NETGEN_3D
## Algorithm type: Synonim of NETGEN_1D2D3D, see NETGEN_1D2D3D_Algorithm
FULL_NETGEN = NETGEN_FULL FULL_NETGEN = NETGEN_FULL
#----------------------------
# Hypothesis type enumeration
#----------------------------
## Hypothesis type enumeration: complex hypothesis
# (full set of parameters can be specified),
# see NETGEN_Algorithm.Parameters()
SOLE = 0 SOLE = 0
## Hypothesis type enumeration: simple hypothesis
# (only major parameters are specified),
# see NETGEN_Algorithm.Parameters()
SIMPLE = 1 SIMPLE = 1
#----------------------
# Fineness enumeration # Fineness enumeration
#----------------------
## Fineness enumeration: very coarse quality of mesh,
# see NETGEN_Algorithm.SetFineness()
VeryCoarse = 0 VeryCoarse = 0
## Fineness enumeration: coarse quality of mesh,
# see NETGEN_Algorithm.SetFineness()
Coarse = 1 Coarse = 1
## Fineness enumeration: moderate quality of mesh,
# see NETGEN_Algorithm.SetFineness()
Moderate = 2 Moderate = 2
## Fineness enumeration: fine quality of mesh,
# see NETGEN_Algorithm.SetFineness()
Fine = 3 Fine = 3
## Fineness enumeration: very fine quality of mesh,
# see NETGEN_Algorithm.SetFineness()
VeryFine = 4 VeryFine = 4
## Fineness enumeration: custom quality of mesh specified by other parameters),
# see NETGEN_Algorithm.SetFineness()
Custom = 5 Custom = 5
#----------------------
# Algorithms
#----------------------
## Base of all NETGEN algorithms. ## Base of all NETGEN algorithms.
# #
# This class provides common methods for all algorithms implemented by NETGEN plugin.
# @note This class must not be instantiated directly.
class NETGEN_Algorithm(Mesh_Algorithm): class NETGEN_Algorithm(Mesh_Algorithm):
## 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)
if noNETGENPlugin: print "Warning: NETGENPlugin module unavailable" if noNETGENPlugin: print "Warning: NETGENPlugin module unavailable"
self.Create(mesh, geom, self.algoType, "libNETGENEngine.so") self.Create(mesh, geom, self.algoType, "libNETGENEngine.so")
self.params = None self.params = None
pass
## Sets MaxSize ## Sets @c MaxSize parameter
# # @param theSize new value of the @c MaxSize parameter
def SetMaxSize(self, theSize): def SetMaxSize(self, theSize):
if self.Parameters(): if self.Parameters(): self.params.SetMaxSize(theSize)
self.params.SetMaxSize(theSize) pass
## Sets MinSize ## Sets @c MinSize parameter
# # @param theSize new value of the @c MinSize parameter
def SetMinSize(self, theSize): def SetMinSize(self, theSize):
if self.Parameters(): if self.Parameters(): self.params.SetMinSize(theSize)
self.params.SetMinSize(theSize) pass
## Sets @c Optimize flag
## Sets Optimize flag # @param theVal new value of the @c Optimize parameter
#
def SetOptimize(self, theVal): def SetOptimize(self, theVal):
if self.Parameters(): if self.Parameters(): self.params.SetOptimize(theVal)
self.params.SetOptimize(theVal) pass
## Sets Fineness ## Sets @c Fineness parameter
# @param theFineness is: # @param theFineness new value of the @c Fineness parameter; it can be:
# VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom # @ref VeryCoarse, @ref Coarse, @ref Moderate, @ref Fine, @ref VeryFine or @ref Custom
#
def SetFineness(self, theFineness): def SetFineness(self, theFineness):
if self.Parameters(): if self.Parameters(): self.params.SetFineness(theFineness)
self.params.SetFineness(theFineness) pass
## Sets GrowthRate ## Sets @c GrowthRate parameter
# # @param theRate new value of the @c GrowthRate parameter
def SetGrowthRate(self, theRate): def SetGrowthRate(self, theRate):
if self.Parameters(): if self.Parameters(): self.params.SetGrowthRate(theRate)
self.params.SetGrowthRate(theRate) pass
## Defines hypothesis having several parameters ## Creates meshing hypothesis according to the chosen algorithm type
# # and initializes it with default parameters
# @param which hypothesis type; can be either @ref SOLE (default) or @ref SIMPLE
# @return hypothesis object
def Parameters(self, which=SOLE): def Parameters(self, which=SOLE):
if self.algoType == NETGEN_1D2D: if self.algoType == NETGEN_1D2D:
if which == SIMPLE: if which == SIMPLE:
@ -116,111 +171,161 @@ class NETGEN_Algorithm(Mesh_Algorithm):
return self.params return self.params
pass # end of NETGEN_Algorithm class
## Defines a tetrahedron 1D-2D-3D algorithm ## Tetrahedron 1D-2D-3D algorithm.
# It is created by calling Mesh.Triangle( NETGEN_1D2D3D, geom=0 )
# #
# It can be created by calling smesh.Mesh.Tetrahedron( smesh.NETGEN_1D2D3D, geom=0 ).
# This algorithm generates all 1D (edges), 2D (faces) and 3D (volumes) elements
# for given geometrical shape.
class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm): class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm):
## name of the dynamic method in smesh.Mesh class
# @internal
meshMethod = "Tetrahedron" meshMethod = "Tetrahedron"
## type of algorithm used with helper function in smesh.Mesh class
# @internal
algoType = NETGEN_1D2D3D algoType = NETGEN_1D2D3D
## 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):
NETGEN_Algorithm.__init__(self, mesh, geom) NETGEN_Algorithm.__init__(self, mesh, geom)
pass
## Sets SecondOrder flag ## Sets @c SecondOrder flag
# # @param theVal new value of the @c SecondOrder parameter
def SetSecondOrder(self, theVal): def SetSecondOrder(self, theVal):
if self.Parameters(): if self.Parameters(): self.params.SetSecondOrder(theVal)
self.params.SetSecondOrder(theVal) pass
## Sets NbSegPerEdge ## Sets @c NbSegPerEdge parameter
# # @param theVal new value of the @c NbSegPerEdge parameter
def SetNbSegPerEdge(self, theVal): def SetNbSegPerEdge(self, theVal):
if self.Parameters(): if self.Parameters(): self.params.SetNbSegPerEdge(theVal)
self.params.SetNbSegPerEdge(theVal) pass
## Sets NbSegPerRadius ## Sets @c NbSegPerRadius parameter
# # @param theVal new value of the @c NbSegPerRadius parameter
def SetNbSegPerRadius(self, theVal): def SetNbSegPerRadius(self, theVal):
if self.Parameters(): if self.Parameters(): self.params.SetNbSegPerRadius(theVal)
self.params.SetNbSegPerRadius(theVal) pass
## Sets QuadAllowed flag. ## Sets @c QuadAllowed flag
# @param toAllow new value of the @c QuadAllowed parameter (@c True by default)
def SetQuadAllowed(self, toAllow=True): def SetQuadAllowed(self, toAllow=True):
if self.Parameters(): if self.Parameters(): self.params.SetQuadAllowed(toAllow)
self.params.SetQuadAllowed(toAllow) pass
## Sets number of segments overriding the value set by SetLocalLength() ## Sets number of segments overriding the value set by SetLocalLength()
# # @param theVal new value of number of segments parameter
def SetNumberOfSegments(self, theVal): def SetNumberOfSegments(self, theVal):
self.Parameters(SIMPLE).SetNumberOfSegments(theVal) self.Parameters(SIMPLE).SetNumberOfSegments(theVal)
pass
## Sets number of segments overriding the value set by SetNumberOfSegments() ## Sets number of segments overriding the value set by SetNumberOfSegments()
# # @param theVal new value of local length parameter
def SetLocalLength(self, theVal): def SetLocalLength(self, theVal):
self.Parameters(SIMPLE).SetLocalLength(theVal) self.Parameters(SIMPLE).SetLocalLength(theVal)
pass
## Defines "MaxElementArea" parameter of NETGEN_SimpleParameters_3D hypothesis. ## Defines @c MaxElementArea parameter of @c NETGEN_SimpleParameters_3D hypothesis.
# Overrides value set by LengthFromEdges() # Overrides value set by LengthFromEdges()
# @param area new value of @c MaxElementArea parameter
def MaxElementArea(self, area): def MaxElementArea(self, area):
self.Parameters(SIMPLE).SetMaxElementArea(area) self.Parameters(SIMPLE).SetMaxElementArea(area)
pass
## Defines "LengthFromEdges" parameter of NETGEN_SimpleParameters_3D hypothesis ## Defines @c LengthFromEdges parameter of @c NETGEN_SimpleParameters_3D hypothesis.
# Overrides value set by MaxElementArea() # Overrides value set by MaxElementArea()
def LengthFromEdges(self): def LengthFromEdges(self):
self.Parameters(SIMPLE).LengthFromEdges() self.Parameters(SIMPLE).LengthFromEdges()
pass
## Defines "LengthFromFaces" parameter of NETGEN_SimpleParameters_3D hypothesis ## Defines @c LengthFromFaces parameter of @c NETGEN_SimpleParameters_3D hypothesis.
# Overrides value set by MaxElementVolume() # Overrides value set by MaxElementVolume()
def LengthFromFaces(self): def LengthFromFaces(self):
self.Parameters(SIMPLE).LengthFromFaces() self.Parameters(SIMPLE).LengthFromFaces()
pass
## Defines "MaxElementVolume" parameter of NETGEN_SimpleParameters_3D hypothesis ## Defines @c MaxElementVolume parameter of @c NETGEN_SimpleParameters_3D hypothesis.
# Overrides value set by LengthFromFaces() # Overrides value set by LengthFromFaces()
# @param vol new value of @c MaxElementVolume parameter
def MaxElementVolume(self, vol): def MaxElementVolume(self, vol):
self.Parameters(SIMPLE).SetMaxElementVolume(vol) self.Parameters(SIMPLE).SetMaxElementVolume(vol)
pass
pass # end of NETGEN_1D2D3D_Algorithm class
## Triangle NETGEN 1D-2D algorithm. ## Triangle NETGEN 1D-2D algorithm.
# It is created by calling Mesh.Triangle( NETGEN_1D2D, geom=0 )
# #
# It can be created by calling smesh.Mesh.Triangle( smesh.NETGEN_1D2D, geom=0 )
#
# This algorithm generates 1D (edges) and 2D (faces) elements
# for given geometrical shape.
class NETGEN_1D2D_Algorithm(NETGEN_1D2D3D_Algorithm): class NETGEN_1D2D_Algorithm(NETGEN_1D2D3D_Algorithm):
## name of the dynamic method in smesh.Mesh class
# @internal
meshMethod = "Triangle" meshMethod = "Triangle"
## type of algorithm used with helper function in smesh.Mesh class
# @internal
algoType = NETGEN_1D2D algoType = NETGEN_1D2D
## doc string of the method
# @internal
docHelper = "Creates triangle 2D algorithm for faces"
## 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):
NETGEN_1D2D3D_Algorithm.__init__(self, mesh, geom) NETGEN_1D2D3D_Algorithm.__init__(self, mesh, geom)
pass
pass # end of NETGEN_1D2D_Algorithm class
## Triangle NETGEN 2D algorithm ## Triangle NETGEN 2D algorithm
# It is created by calling Mesh.Triangle( NETGEN_2D, geom=0 )
# #
# It can be created by calling smesh.Mesh.Triangle( smesh.NETGEN_2D, geom=0 )
#
# This algorithm generates only 2D (faces) elements for given geometrical shape
# and, in contrast to NETGEN_1D2D_Algorithm class, should be used in conjunction
# with other 1D meshing algorithm.
class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm): class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
## name of the dynamic method in smesh.Mesh class
# @internal
meshMethod = "Triangle" meshMethod = "Triangle"
## type of algorithm used with helper function in smesh.Mesh class
# @internal
algoType = NETGEN_2D algoType = NETGEN_2D
## doc string of the method
# @internal
docHelper = "Creates triangle 2D algorithm for faces"
## 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):
NETGEN_Algorithm.__init__(self, mesh, geom) NETGEN_Algorithm.__init__(self, mesh, geom)
pass
## Sets QuadAllowed flag. ## Defines @c MaxElementArea parameter of hypothesis basing on the definition of the
def SetQuadAllowed(self, toAllow=True): # maximum area of each triangle
if self.Parameters(): # @param area maximum area value of each triangle
self.params.SetQuadAllowed(toAllow) # @param UseExisting if \c True - searches for an existing hypothesis created with the
## Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle
# @param area for the maximum area of each triangle
# @param UseExisting if ==true - searches for an existing hypothesis created with the
# same parameters, else (default) - creates a new one # same parameters, else (default) - creates a new one
# # @return hypothesis object
def MaxElementArea(self, area, UseExisting=0): def MaxElementArea(self, area, UseExisting=0):
compFun = lambda hyp, args: IsEqual(hyp.GetMaxElementArea(), args[0]) compFun = lambda hyp, args: IsEqual(hyp.GetMaxElementArea(), args[0])
hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting, hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
@ -228,14 +333,16 @@ class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
hyp.SetMaxElementArea(area) hyp.SetMaxElementArea(area)
return hyp return hyp
## Defines "LengthFromEdges" hypothesis to build triangles ## Defines @c LengthFromEdges hypothesis to build triangles
# based on the length of the edges taken from the wire # based on the length of the edges taken from the wire
# # @return hypothesis object
def LengthFromEdges(self): def LengthFromEdges(self):
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp) hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
return hyp return hyp
## Sets QuadAllowed flag. ## Sets @c QuadAllowed flag.
# @param toAllow new value of the @c QuadAllowed parameter (@c True by default)
# @return hypothesis object
def SetQuadAllowed(self, toAllow=True): def SetQuadAllowed(self, toAllow=True):
if not self.params: if not self.params:
# use simple hyps # use simple hyps
@ -260,23 +367,45 @@ class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
self.Parameters().SetQuadAllowed( toAllow ) self.Parameters().SetQuadAllowed( toAllow )
return self.params return self.params
## Defines a tetrahedron 3D algorithm pass # end of NETGEN_2D_Only_Algorithm class
# It is created by calling Mesh.Tetrahedron()
## Tetrahedron 3D algorithm
# #
# It can be created by calling smesh.Mesh.Tetrahedron() or smesh.Mesh.Tetrahedron( smesh.NETGEN, geom=0 )
#
# This algorithm generates only 3D (volumes) elements for given geometrical shape
# and, in contrast to NETGEN_1D2D3D_Algorithm class, should be used in conjunction
# with other 1D and 2D meshing algorithms.
class NETGEN_3D_Algorithm(NETGEN_Algorithm): class NETGEN_3D_Algorithm(NETGEN_Algorithm):
## name of the dynamic method in smesh.Mesh class
# @internal
meshMethod = "Tetrahedron" meshMethod = "Tetrahedron"
## type of algorithm used with helper function in smesh.Mesh class
# @internal
algoType = NETGEN algoType = NETGEN
## 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 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):
NETGEN_Algorithm.__init__(self, mesh, geom) NETGEN_Algorithm.__init__(self, mesh, geom)
pass
## Defines "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedron ## Defines @c MaxElementVolume hypothesis to specify the maximum volume value of each tetrahedron
# @param vol for the maximum volume of each tetrahedron # @param vol maximum volume value of each tetrahedron
# @param UseExisting if ==true - searches for the existing hypothesis created with # @param UseExisting if \c True - searches for the existing hypothesis created with
# the same parameters, else (default) - creates a new one # the same parameters, else (default) - creates a new one
# @return hypothesis object
def MaxElementVolume(self, vol, UseExisting=0): def MaxElementVolume(self, vol, UseExisting=0):
compFun = lambda hyp, args: IsEqual(hyp.GetMaxElementVolume(), args[0]) compFun = lambda hyp, args: IsEqual(hyp.GetMaxElementVolume(), args[0])
hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting, hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting,
@ -284,23 +413,57 @@ class NETGEN_3D_Algorithm(NETGEN_Algorithm):
hyp.SetMaxElementVolume(vol) hyp.SetMaxElementVolume(vol)
return hyp return hyp
pass # end of NETGEN_3D_Algorithm class
# Class just to create NETGEN_1D2D by calling Mesh.Triangle(NETGEN)
## Triangle (helper) 1D-2D algorithm
#
# This is the helper class that is used just to allow creating of create NETGEN_1D2D algorithm
# by calling smesh.Mesh.Triangle( smesh.NETGEN, geom=0 ); this is required for backward compatibility
# with old Python scripts.
#
# @note This class (and corresponding smesh.Mesh function) is obsolete;
# use smesh.Mesh.Triangle( smesh.NETGEN_1D2D, geom=0 ) instead.
class NETGEN_1D2D_Algorithm_2(NETGEN_1D2D_Algorithm): class NETGEN_1D2D_Algorithm_2(NETGEN_1D2D_Algorithm):
## name of the dynamic method in smesh.Mesh class
# @internal
algoType = NETGEN algoType = NETGEN
## 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.algoType = NETGEN_1D2D self.algoType = NETGEN_1D2D
NETGEN_1D2D_Algorithm.__init__(self,mesh, geom) NETGEN_1D2D_Algorithm.__init__(self,mesh, geom)
pass
pass # end of NETGEN_1D2D_Algorithm_2 class
# Class just to create NETGEN_1D2D3D by calling Mesh.Netgen() ## Tetrahedron (helper) 1D-2D-3D algorithm.
#
# This is the helper class that is used just to allow creating of create NETGEN_1D2D3D
# by calling smesh.Mesh.Netgen(); this is required for backward compatibility with old Python scripts.
#
# @note This class (and corresponding smesh.Mesh function) is obsolete;
# use smesh.Mesh.Tetrahedron( smesh.NETGEN_1D2D3D, geom=0 ) instead.
class NETGEN_1D2D3D_Algorithm_2(NETGEN_1D2D3D_Algorithm): class NETGEN_1D2D3D_Algorithm_2(NETGEN_1D2D3D_Algorithm):
## name of the dynamic method in smesh.Mesh class
# @internal
meshMethod = "Netgen" meshMethod = "Netgen"
## doc string of the method
# @internal
docHelper = "Deprecated, used only for compatibility! See Tetrahedron() method."
## 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):
NETGEN_1D2D3D_Algorithm.__init__(self,mesh, geom) NETGEN_1D2D3D_Algorithm.__init__(self,mesh, geom)
pass
pass # end of NETGEN_1D2D3D_Algorithm_2 class