-# More details.
-# @ingroup l3_algos_basic
-class Mesh_Segment(Mesh_Algorithm):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- Mesh_Algorithm.__init__(self)
- self.Create(mesh, geom, "Regular_1D")
-
- ## 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 UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - creates a new one
- # @param p precision, used for calculation of the number of segments.
- # The precision should be a positive, meaningful value within the range [0,1].
- # In general, the number of segments is calculated with the formula:
- # nb = ceil((edge_length / l) - p)
- # Function ceil rounds its argument to the higher integer.
- # So, p=0 means rounding of (edge_length / l) to the higher integer,
- # p=0.5 means rounding of (edge_length / l) to the nearest integer,
- # p=1 means rounding of (edge_length / l) to the lower integer.
- # Default value is 1e-07.
- # @return an instance of StdMeshers_LocalLength hypothesis
- # @ingroup l3_hypos_1dhyps
- def LocalLength(self, l, UseExisting=0, p=1e-07):
- hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting,
- CompareMethod=self.CompareLocalLength)
- hyp.SetLength(l)
- hyp.SetPrecision(p)
- return hyp
-
- ## Private method
- ## Checks if the given "LocalLength" hypothesis has the same parameters as the given arguments
- def CompareLocalLength(self, hyp, args):
- if IsEqual(hyp.GetLength(), args[0]):
- return IsEqual(hyp.GetPrecision(), args[1])
- return False
-
- ## Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value
- # @param length is optional maximal allowed length of segment, if it is omitted
- # the preestimated length is used that depends on geometry size
- # @param UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - create a new one
- # @return an instance of StdMeshers_MaxLength hypothesis
- # @ingroup l3_hypos_1dhyps
- def MaxSize(self, length=0.0, UseExisting=0):
- hyp = self.Hypothesis("MaxLength", [length], UseExisting=UseExisting)
- if length > 0.0:
- # set given length
- hyp.SetLength(length)
- if not UseExisting:
- # set preestimated length
- gen = self.mesh.smeshpyD
- initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
- self.mesh.GetMesh(), self.mesh.GetShape(),
- False) # <- byMesh
- preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
- if preHyp:
- hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )
- pass
- pass
- hyp.SetUsePreestimatedLength( length == 0.0 )
- return hyp
-
- ## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
- # @param n for the number of segments that cut an edge
- # @param s for the scale factor (optional)
- # @param reversedEdges is a list of edges to mesh using reversed orientation
- # @param UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - create a new one
- # @return an instance of StdMeshers_NumberOfSegments hypothesis
- # @ingroup l3_hypos_1dhyps
- def NumberOfSegments(self, n, s=[], reversedEdges=[], UseExisting=0):
- if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
- reversedEdges, UseExisting = [], reversedEdges
- entry = self.MainShapeEntry()
- if reversedEdges and isinstance(reversedEdges[0],geompyDC.GEOM._objref_GEOM_Object):
- reversedEdges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, e) for e in reversedEdges ]
- if s == []:
- hyp = self.Hypothesis("NumberOfSegments", [n, reversedEdges, entry],
- UseExisting=UseExisting,
- CompareMethod=self.CompareNumberOfSegments)
- else:
- hyp = self.Hypothesis("NumberOfSegments", [n,s, reversedEdges, entry],
- UseExisting=UseExisting,
- CompareMethod=self.CompareNumberOfSegments)
- hyp.SetDistrType( 1 )
- hyp.SetScaleFactor(s)
- hyp.SetNumberOfSegments(n)
- hyp.SetReversedEdges( reversedEdges )
- hyp.SetObjectEntry( entry )
- return hyp
-
- ## Private method
- ## Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
- def CompareNumberOfSegments(self, hyp, args):
- if hyp.GetNumberOfSegments() == args[0]:
- if len(args) == 3:
- if hyp.GetReversedEdges() == args[1]:
- if not args[1] or hyp.GetObjectEntry() == args[2]:
- return True
- else:
- if hyp.GetReversedEdges() == args[2]:
- if not args[2] or hyp.GetObjectEntry() == args[3]:
- if hyp.GetDistrType() == 1:
- if IsEqual(hyp.GetScaleFactor(), args[1]):
- return True
- return False
-
- ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length
- # @param start defines the length of the first segment
- # @param end defines the length of the last segment
- # @param reversedEdges is a list of edges to mesh using reversed orientation
- # @param UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - creates a new one
- # @return an instance of StdMeshers_Arithmetic1D hypothesis
- # @ingroup l3_hypos_1dhyps
- def Arithmetic1D(self, start, end, reversedEdges=[], UseExisting=0):
- if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
- reversedEdges, UseExisting = [], reversedEdges
- if reversedEdges and isinstance(reversedEdges[0],geompyDC.GEOM._objref_GEOM_Object):
- reversedEdges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, e) for e in reversedEdges ]
- entry = self.MainShapeEntry()
- hyp = self.Hypothesis("Arithmetic1D", [start, end, reversedEdges, entry],
- UseExisting=UseExisting,
- CompareMethod=self.CompareArithmetic1D)
- hyp.SetStartLength(start)
- hyp.SetEndLength(end)
- hyp.SetReversedEdges( reversedEdges )
- hyp.SetObjectEntry( entry )
- return hyp
-
- ## Private method
- ## Check if the given "Arithmetic1D" hypothesis has the same parameters as the given arguments
- def CompareArithmetic1D(self, hyp, args):
- if IsEqual(hyp.GetLength(1), args[0]):
- if IsEqual(hyp.GetLength(0), args[1]):
- if hyp.GetReversedEdges() == args[2]:
- if not args[2] or hyp.GetObjectEntry() == args[3]:
- return True
- return False
-
-
- ## Defines "FixedPoints1D" hypothesis to cut an edge using parameter
- # on curve from 0 to 1 (additionally it is neecessary to check
- # orientation of edges and create list of reversed edges if it is
- # needed) and sets numbers of segments between given points (default
- # values are equals 1
- # @param points defines the list of parameters on curve
- # @param nbSegs defines the list of numbers of segments
- # @param reversedEdges is a list of edges to mesh using reversed orientation
- # @param UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - creates a new one
- # @return an instance of StdMeshers_Arithmetic1D hypothesis
- # @ingroup l3_hypos_1dhyps
- def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
- if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
- reversedEdges, UseExisting = [], reversedEdges
- if reversedEdges and isinstance(reversedEdges[0],geompyDC.GEOM._objref_GEOM_Object):
- reversedEdges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, e) for e in reversedEdges ]
- entry = self.MainShapeEntry()
- hyp = self.Hypothesis("FixedPoints1D", [points, nbSegs, reversedEdges, entry],
- UseExisting=UseExisting,
- CompareMethod=self.CompareFixedPoints1D)
- hyp.SetPoints(points)
- hyp.SetNbSegments(nbSegs)
- hyp.SetReversedEdges(reversedEdges)
- hyp.SetObjectEntry(entry)
- return hyp
-
- ## Private method
- ## Check if the given "FixedPoints1D" hypothesis has the same parameters
- ## as the given arguments
- def CompareFixedPoints1D(self, hyp, args):
- if hyp.GetPoints() == args[0]:
- if hyp.GetNbSegments() == args[1]:
- if hyp.GetReversedEdges() == args[2]:
- if not args[2] or hyp.GetObjectEntry() == args[3]:
- return True
- return False
-
-
-
- ## Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
- # @param start defines the length of the first segment
- # @param end defines the length of the last segment
- # @param reversedEdges is a list of edges to mesh using reversed orientation
- # @param UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - creates a new one
- # @return an instance of StdMeshers_StartEndLength hypothesis
- # @ingroup l3_hypos_1dhyps
- def StartEndLength(self, start, end, reversedEdges=[], UseExisting=0):
- if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
- reversedEdges, UseExisting = [], reversedEdges
- if reversedEdges and isinstance(reversedEdges[0],geompyDC.GEOM._objref_GEOM_Object):
- reversedEdges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, e) for e in reversedEdges ]
- entry = self.MainShapeEntry()
- hyp = self.Hypothesis("StartEndLength", [start, end, reversedEdges, entry],
- UseExisting=UseExisting,
- CompareMethod=self.CompareStartEndLength)
- hyp.SetStartLength(start)
- hyp.SetEndLength(end)
- hyp.SetReversedEdges( reversedEdges )
- hyp.SetObjectEntry( entry )
- return hyp
-
- ## Check if the given "StartEndLength" hypothesis has the same parameters as the given arguments
- def CompareStartEndLength(self, hyp, args):
- if IsEqual(hyp.GetLength(1), args[0]):
- if IsEqual(hyp.GetLength(0), args[1]):
- if hyp.GetReversedEdges() == args[2]:
- if not args[2] or hyp.GetObjectEntry() == args[3]:
- return True
- return False
-
- ## Defines "Deflection1D" hypothesis
- # @param d for the deflection
- # @param UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - create a new one
- # @ingroup l3_hypos_1dhyps
- def Deflection1D(self, d, UseExisting=0):
- hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting,
- CompareMethod=self.CompareDeflection1D)
- hyp.SetDeflection(d)
- return hyp
-
- ## Check if the given "Deflection1D" hypothesis has the same parameters as the given arguments
- def CompareDeflection1D(self, hyp, args):
- return IsEqual(hyp.GetDeflection(), args[0])
-
- ## Defines "Propagation" hypothesis that propagates all other hypotheses on all other edges that are at
- # the opposite side in case of quadrangular faces
- # @ingroup l3_hypos_additi
- def Propagation(self):
- return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
-
- ## Defines "AutomaticLength" hypothesis
- # @param fineness for the fineness [0-1]
- # @param UseExisting if ==true - searches for an existing hypothesis created with the
- # same parameters, else (default) - create a new one
- # @ingroup l3_hypos_1dhyps
- def AutomaticLength(self, fineness=0, UseExisting=0):
- hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting,
- CompareMethod=self.CompareAutomaticLength)
- hyp.SetFineness( fineness )
- return hyp
-
- ## Checks if the given "AutomaticLength" hypothesis has the same parameters as the given arguments
- def CompareAutomaticLength(self, hyp, args):
- return IsEqual(hyp.GetFineness(), args[0])
-
- ## Defines "SegmentLengthAroundVertex" hypothesis
- # @param length for the segment length
- # @param vertex for the length localization: the vertex index [0,1] | vertex object.
- # Any other integer value means that the hypothesis will be set on the
- # whole 1D shape, where Mesh_Segment algorithm is assigned.
- # @param UseExisting if ==true - searches for an existing hypothesis created with
- # the same parameters, else (default) - creates a new one
- # @ingroup l3_algos_segmarv
- def LengthNearVertex(self, length, vertex=0, UseExisting=0):
- import types
- store_geom = self.geom
- if type(vertex) is types.IntType:
- if vertex == 0 or vertex == 1:
- vertex = self.mesh.geompyD.ExtractShapes(self.geom, geompyDC.ShapeType["VERTEX"],True)[vertex]
- self.geom = vertex
- pass
- pass
- else:
- self.geom = vertex
- pass
- ### 0D algorithm
- if self.geom is None:
- raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape"
- self.AssureGeomPublished( self.geom )
- name = GetName(self.geom)
-
- algo = self.FindAlgorithm("SegmentAroundVertex_0D", self.mesh.smeshpyD)
- if algo is None:
- algo = self.mesh.smeshpyD.CreateHypothesis("SegmentAroundVertex_0D", "libStdMeshersEngine.so")
- pass
- status = self.mesh.mesh.AddHypothesis(self.geom, algo)
- TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True)
- ###
- hyp = self.Hypothesis("SegmentLengthAroundVertex", [length], UseExisting=UseExisting,
- CompareMethod=self.CompareLengthNearVertex)
- self.geom = store_geom
- hyp.SetLength( length )
- return hyp
-
- ## Checks if the given "LengthNearVertex" hypothesis has the same parameters as the given arguments
- # @ingroup l3_algos_segmarv
- def CompareLengthNearVertex(self, hyp, args):
- return IsEqual(hyp.GetLength(), args[0])
-
- ## Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
- # If the 2D mesher sees that all boundary edges are quadratic,
- # it generates quadratic faces, else it generates linear faces using
- # medium nodes as if they are vertices.
- # The 3D mesher generates quadratic volumes only if all boundary faces
- # are quadratic, else it fails.
- #
- # @ingroup l3_hypos_additi
- def QuadraticMesh(self):
- hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
- return hyp
-
-# Public class: Mesh_CompositeSegment
-# --------------------------
-
-## Defines a segment 1D algorithm for discretization
-#
-# @ingroup l3_algos_basic
-class Mesh_CompositeSegment(Mesh_Segment):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- self.Create(mesh, geom, "CompositeSegment_1D")
-
-
-# Public class: Mesh_Segment_Python
-# ---------------------------------
-
-## Defines a segment 1D algorithm for discretization with python function
-#
-# @ingroup l3_algos_basic
-class Mesh_Segment_Python(Mesh_Segment):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- import Python1dPlugin
- self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
-
- ## Defines "PythonSplit1D" hypothesis
- # @param n for the number of segments that cut an edge
- # @param func for the python function that calculates the length of all segments
- # @param UseExisting if ==true - searches for the existing hypothesis created with
- # the same parameters, else (default) - creates a new one
- # @ingroup l3_hypos_1dhyps
- def PythonSplit1D(self, n, func, UseExisting=0):
- hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so",
- UseExisting=UseExisting, CompareMethod=self.ComparePythonSplit1D)
- hyp.SetNumberOfSegments(n)
- hyp.SetPythonLog10RatioFunction(func)
- return hyp
-
- ## Checks if the given "PythonSplit1D" hypothesis has the same parameters as the given arguments
- def ComparePythonSplit1D(self, hyp, args):
- #if hyp.GetNumberOfSegments() == args[0]:
- # if hyp.GetPythonLog10RatioFunction() == args[1]:
- # return True
- return False
-
-# Public class: Mesh_Triangle
-# ---------------------------
-
-## Defines a triangle 2D algorithm
-#
-# @ingroup l3_algos_basic
-class Mesh_Triangle(Mesh_Algorithm):
-
- # default values
- algoType = 0
- params = 0
-
- _angleMeshS = 8
- _gradation = 1.1
-
- ## Private constructor.
- def __init__(self, mesh, algoType, geom=0):
- Mesh_Algorithm.__init__(self)
-
- self.algoType = algoType
- if algoType == MEFISTO:
- self.Create(mesh, geom, "MEFISTO_2D")
- pass
- elif algoType == BLSURF:
- CheckPlugin(BLSURF)
- self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so")
- #self.SetPhysicalMesh() - PAL19680
- elif algoType == NETGEN:
- CheckPlugin(NETGEN)
- self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
- pass
- elif algoType == NETGEN_2D:
- CheckPlugin(NETGEN)
- self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
- pass
-
- ## 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
- #
- # Only for algoType == MEFISTO || NETGEN_2D
- # @ingroup l3_hypos_2dhyps
- def MaxElementArea(self, area, UseExisting=0):
- if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
- hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
- CompareMethod=self.CompareMaxElementArea)
- elif self.algoType == NETGEN:
- hyp = self.Parameters(SIMPLE)
- hyp.SetMaxElementArea(area)
- return hyp
-
- ## Checks if the given "MaxElementArea" hypothesis has the same parameters as the given arguments
- def CompareMaxElementArea(self, hyp, args):
- return IsEqual(hyp.GetMaxElementArea(), args[0])
-
- ## Defines "LengthFromEdges" hypothesis to build triangles
- # based on the length of the edges taken from the wire
- #
- # Only for algoType == MEFISTO || NETGEN_2D
- # @ingroup l3_hypos_2dhyps
- def LengthFromEdges(self):
- if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
- hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
- return hyp
- elif self.algoType == NETGEN:
- hyp = self.Parameters(SIMPLE)
- hyp.LengthFromEdges()
- return hyp
-
- ## Sets a way to define size of mesh elements to generate.
- # @param thePhysicalMesh is: DefaultSize or Custom.
- # @ingroup l3_hypos_blsurf
- def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize):
- # Parameter of BLSURF algo
- self.Parameters().SetPhysicalMesh(thePhysicalMesh)
-
- ## Sets size of mesh elements to generate.
- # @ingroup l3_hypos_blsurf
- def SetPhySize(self, theVal):
- # Parameter of BLSURF algo
- self.SetPhysicalMesh(1) #Custom - else why to set the size?
- self.Parameters().SetPhySize(theVal)
-
- ## Sets lower boundary of mesh element size (PhySize).
- # @ingroup l3_hypos_blsurf
- def SetPhyMin(self, theVal=-1):
- # Parameter of BLSURF algo
- self.Parameters().SetPhyMin(theVal)
-
- ## Sets upper boundary of mesh element size (PhySize).
- # @ingroup l3_hypos_blsurf
- def SetPhyMax(self, theVal=-1):
- # Parameter of BLSURF algo
- self.Parameters().SetPhyMax(theVal)
-
- ## Sets a way to define maximum angular deflection of mesh from CAD model.
- # @param theGeometricMesh is: 0 (None) or 1 (Custom)
- # @ingroup l3_hypos_blsurf
- def SetGeometricMesh(self, theGeometricMesh=0):
- # Parameter of BLSURF algo
- if self.Parameters().GetPhysicalMesh() == 0: theGeometricMesh = 1
- self.params.SetGeometricMesh(theGeometricMesh)
-
- ## Sets angular deflection (in degrees) of a mesh face from CAD surface.
- # @ingroup l3_hypos_blsurf
- def SetAngleMeshS(self, theVal=_angleMeshS):
- # Parameter of BLSURF algo
- if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS
- self.params.SetAngleMeshS(theVal)
-
- ## Sets angular deflection (in degrees) of a mesh edge from CAD curve.
- # @ingroup l3_hypos_blsurf
- def SetAngleMeshC(self, theVal=_angleMeshS):
- # Parameter of BLSURF algo
- if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS
- self.params.SetAngleMeshC(theVal)
-
- ## Sets lower boundary of mesh element size computed to respect angular deflection.
- # @ingroup l3_hypos_blsurf
- def SetGeoMin(self, theVal=-1):
- # Parameter of BLSURF algo
- self.Parameters().SetGeoMin(theVal)
-
- ## Sets upper boundary of mesh element size computed to respect angular deflection.
- # @ingroup l3_hypos_blsurf
- def SetGeoMax(self, theVal=-1):
- # Parameter of BLSURF algo
- self.Parameters().SetGeoMax(theVal)
-
- ## Sets maximal allowed ratio between the lengths of two adjacent edges.
- # @ingroup l3_hypos_blsurf
- def SetGradation(self, theVal=_gradation):
- # Parameter of BLSURF algo
- if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation
- self.params.SetGradation(theVal)
-
- ## Sets topology usage way.
- # @param way defines how mesh conformity is assured <ul>
- # <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
- # <li>PreProcess or PreProcessPlus - by pre-processing a CAD model</li></ul>
- # @ingroup l3_hypos_blsurf
- def SetTopology(self, way):
- # Parameter of BLSURF algo
- self.Parameters().SetTopology(way)
-
- ## To respect geometrical edges or not.
- # @ingroup l3_hypos_blsurf
- def SetDecimesh(self, toIgnoreEdges=False):
- # Parameter of BLSURF algo
- self.Parameters().SetDecimesh(toIgnoreEdges)
-
- ## Sets verbosity level in the range 0 to 100.
- # @ingroup l3_hypos_blsurf
- def SetVerbosity(self, level):
- # Parameter of BLSURF algo
- self.Parameters().SetVerbosity(level)
-
- ## Sets advanced option value.
- # @ingroup l3_hypos_blsurf
- def SetOptionValue(self, optionName, level):
- # Parameter of BLSURF algo
- self.Parameters().SetOptionValue(optionName,level)
-
- ## Sets an attractor on the chosen face. The mesh size will decrease exponentially with the distance from theAttractor, following the rule h(d) = theEndSize - (theEndSize - theStartSize) * exp [ - ( d / theInfluenceDistance ) ^ 2 ]
- # @param theFace : face on which the attractor will be defined
- # @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially
- # @param theStartSize : mesh size on theAttractor
- # @param theEndSize : maximum size that will be reached on theFace
- # @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high)
- # @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace
- # @ingroup l3_hypos_blsurf
- def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance):
- self.AssureGeomPublished( theFace )
- self.AssureGeomPublished( theAttractor )
- # Parameter of BLSURF algo
- self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance)
-
- ## Unsets an attractor on the chosen face.
- # @param theFace : face on which the attractor has to be removed
- # @ingroup l3_hypos_blsurf
- def UnsetAttractorGeom(self, theFace):
- self.AssureGeomPublished( theFace )
- # Parameter of BLSURF algo
- self.Parameters().SetAttractorGeom(theFace)
-
- ## Sets QuadAllowed flag.
- # Only for algoType == NETGEN(NETGEN_1D2D) || NETGEN_2D || BLSURF
- # @ingroup l3_hypos_netgen l3_hypos_blsurf
- def SetQuadAllowed(self, toAllow=True):
- if self.algoType == NETGEN_2D:
- if not self.params:
- # use simple hyps
- hasSimpleHyps = False
- simpleHyps = ["QuadranglePreference","LengthFromEdges","MaxElementArea"]
- for hyp in self.mesh.GetHypothesisList( self.geom ):
- if hyp.GetName() in simpleHyps:
- hasSimpleHyps = True
- if hyp.GetName() == "QuadranglePreference":
- if not toAllow: # remove QuadranglePreference
- self.mesh.RemoveHypothesis( self.geom, hyp )
- pass
- return
- pass
- pass
- if hasSimpleHyps:
- if toAllow: # add QuadranglePreference
- self.Hypothesis("QuadranglePreference", UseExisting=1, CompareMethod=self.CompareEqualHyp)
- pass
- return
- pass
- pass
- if self.Parameters():
- self.params.SetQuadAllowed(toAllow)
- return
-
- ## Defines hypothesis having several parameters
- #
- # @ingroup l3_hypos_netgen
- def Parameters(self, which=SOLE):
- if not self.params:
- if self.algoType == NETGEN:
- if which == SIMPLE:
- self.params = self.Hypothesis("NETGEN_SimpleParameters_2D", [],
- "libNETGENEngine.so", UseExisting=0)
- else:
- self.params = self.Hypothesis("NETGEN_Parameters_2D", [],
- "libNETGENEngine.so", UseExisting=0)
- elif self.algoType == MEFISTO:
- print "Mefisto algo support no multi-parameter hypothesis"
- elif self.algoType == NETGEN_2D:
- self.params = self.Hypothesis("NETGEN_Parameters_2D_ONLY", [],
- "libNETGENEngine.so", UseExisting=0)
- elif self.algoType == BLSURF:
- self.params = self.Hypothesis("BLSURF_Parameters", [],
- "libBLSURFEngine.so", UseExisting=0)
- else:
- print "Mesh_Triangle with algo type %s does not have such a parameter, check algo type"%self.algoType
- return self.params
-
- ## Sets MaxSize
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetMaxSize(self, theSize):
- if self.Parameters():
- self.params.SetMaxSize(theSize)
-
- ## Sets SecondOrder flag
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetSecondOrder(self, theVal):
- if self.Parameters():
- self.params.SetSecondOrder(theVal)
-
- ## Sets Optimize flag
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetOptimize(self, theVal):
- if self.Parameters():
- self.params.SetOptimize(theVal)
-
- ## Sets Fineness
- # @param theFineness is:
- # VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetFineness(self, theFineness):
- if self.Parameters():
- self.params.SetFineness(theFineness)
-
- ## Sets GrowthRate
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetGrowthRate(self, theRate):
- if self.Parameters():
- self.params.SetGrowthRate(theRate)
-
- ## Sets NbSegPerEdge
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetNbSegPerEdge(self, theVal):
- if self.Parameters():
- self.params.SetNbSegPerEdge(theVal)
-
- ## Sets NbSegPerRadius
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetNbSegPerRadius(self, theVal):
- if self.Parameters():
- self.params.SetNbSegPerRadius(theVal)
-
- ## Sets number of segments overriding value set by SetLocalLength()
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetNumberOfSegments(self, theVal):
- self.Parameters(SIMPLE).SetNumberOfSegments(theVal)
-
- ## Sets number of segments overriding value set by SetNumberOfSegments()
- #
- # Only for algoType == NETGEN
- # @ingroup l3_hypos_netgen
- def SetLocalLength(self, theVal):
- self.Parameters(SIMPLE).SetLocalLength(theVal)
-
- pass
-
-
-# Public class: Mesh_Quadrangle
-# -----------------------------