Back to index

salome-smesh  6.5.0
Functions
1D Meshing Hypotheses
Defining hypotheses
Collaboration diagram for 1D Meshing Hypotheses:

Functions

def smeshDC.Mesh_Algorithm.ReversedEdgeIndices
 Transform a list of ether edges or tuples (edge 1st_vertex_of_edge) into a list acceptable to SetReversedEdges() of some 1D hypotheses.
def StdMeshersDC.StdMeshersDC_Segment.LocalLength
 Defines "LocalLength" hypothesis to cut an edge in several segments with the same length.
def StdMeshersDC.StdMeshersDC_Segment.MaxSize
 Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value.
def StdMeshersDC.StdMeshersDC_Segment.NumberOfSegments
 Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments.
def StdMeshersDC.StdMeshersDC_Segment.Arithmetic1D
 Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length.
def StdMeshersDC.StdMeshersDC_Segment.FixedPoints1D
 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.
def StdMeshersDC.StdMeshersDC_Segment.StartEndLength
 Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length.
def StdMeshersDC.StdMeshersDC_Segment.Deflection1D
 Defines "Deflection1D" hypothesis.
def StdMeshersDC.StdMeshersDC_Segment.AutomaticLength
 Defines "AutomaticLength" hypothesis.
def StdMeshersDC.StdMeshersDC_Segment_Python.PythonSplit1D
 Defines "PythonSplit1D" hypothesis.

Function Documentation

def StdMeshersDC.StdMeshersDC_Segment.Arithmetic1D (   self,
  start,
  end,
  reversedEdges = [],
  UseExisting = 0 
)

Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length.

Parameters:
startdefines the length of the first segment
enddefines the length of the last segment
reversedEdgesis a list of edges to mesh using reversed orientation. A list item can also be a tuple (edge 1st_vertex_of_edge)
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - creates a new one
Returns:
an instance of StdMeshers_Arithmetic1D hypothesis

Definition at line 162 of file StdMeshersDC.py.

00162 
00163     def Arithmetic1D(self, start, end, reversedEdges=[], UseExisting=0):
00164         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
00165             reversedEdges, UseExisting = [], reversedEdges
00166         reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
00167         entry = self.MainShapeEntry()
00168         compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
00169                                       IsEqual(hyp.GetLength(0), args[1]) and \
00170                                       hyp.GetReversedEdges() == args[2]  and \
00171                                       (not args[2] or hyp.GetObjectEntry() == args[3]))
00172         hyp = self.Hypothesis("Arithmetic1D", [start, end, reversedEdgeInd, entry],
00173                               UseExisting=UseExisting, CompareMethod=compFun)
00174         hyp.SetStartLength(start)
00175         hyp.SetEndLength(end)
00176         hyp.SetReversedEdges( reversedEdgeInd )
00177         hyp.SetObjectEntry( entry )
00178         return hyp

Here is the call graph for this function:

def StdMeshersDC.StdMeshersDC_Segment.AutomaticLength (   self,
  fineness = 0,
  UseExisting = 0 
)

Defines "AutomaticLength" hypothesis.

Parameters:
finenessfor the fineness [0-1]
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - create a new one

Definition at line 257 of file StdMeshersDC.py.

00257 
00258     def AutomaticLength(self, fineness=0, UseExisting=0):
00259         compFun = lambda hyp, args: IsEqual(hyp.GetFineness(), args[0])
00260         hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting,
00261                               CompareMethod=compFun)
00262         hyp.SetFineness( fineness )
00263         return hyp

Here is the call graph for this function:

def StdMeshersDC.StdMeshersDC_Segment.Deflection1D (   self,
  d,
  UseExisting = 0 
)

Defines "Deflection1D" hypothesis.

Parameters:
dfor the deflection
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - create a new one

Definition at line 240 of file StdMeshersDC.py.

00240 
00241     def Deflection1D(self, d, UseExisting=0):
00242         compFun = lambda hyp, args: IsEqual(hyp.GetDeflection(), args[0])
00243         hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting, CompareMethod=compFun)
00244         hyp.SetDeflection(d)
00245         return hyp

Here is the call graph for this function:

def StdMeshersDC.StdMeshersDC_Segment.FixedPoints1D (   self,
  points,
  nbSegs = [1],
  reversedEdges = [],
  UseExisting = 0 
)

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.

Parameters:
pointsdefines the list of parameters on curve
nbSegsdefines the list of numbers of segments
reversedEdgesis a list of edges to mesh using reversed orientation. A list item can also be a tuple (edge 1st_vertex_of_edge)
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - creates a new one
Returns:
an instance of StdMeshers_Arithmetic1D hypothesis

Definition at line 192 of file StdMeshersDC.py.

00192 
00193     def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
00194         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
00195             reversedEdges, UseExisting = [], reversedEdges
00196         reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
00197         entry = self.MainShapeEntry()
00198         compFun = lambda hyp, args: ( hyp.GetPoints() == args[0] and \
00199                                       hyp.GetNbSegments() == args[1] and \
00200                                       hyp.GetReversedEdges() == args[2] and \
00201                                       (not args[2] or hyp.GetObjectEntry() == args[3]))
00202         hyp = self.Hypothesis("FixedPoints1D", [points, nbSegs, reversedEdgeInd, entry],
00203                               UseExisting=UseExisting, CompareMethod=compFun)
00204         hyp.SetPoints(points)
00205         hyp.SetNbSegments(nbSegs)
00206         hyp.SetReversedEdges(reversedEdgeInd)
00207         hyp.SetObjectEntry(entry)
00208         return hyp

Here is the call graph for this function:

def StdMeshersDC.StdMeshersDC_Segment.LocalLength (   self,
  l,
  UseExisting = 0,
  p = 1e-07 
)

Defines "LocalLength" hypothesis to cut an edge in several segments with the same length.

Parameters:
lfor the length of segments that cut an edge
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - creates a new one
pprecision, 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.
Returns:
an instance of StdMeshers_LocalLength hypothesis

Definition at line 75 of file StdMeshersDC.py.

00075 
00076     def LocalLength(self, l, UseExisting=0, p=1e-07):
00077         comFun=lambda hyp, args: IsEqual(hyp.GetLength(), args[0]) and IsEqual(hyp.GetPrecision(), args[1])
00078         hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting, CompareMethod=comFun)
00079         hyp.SetLength(l)
00080         hyp.SetPrecision(p)
00081         return hyp

Here is the call graph for this function:

def StdMeshersDC.StdMeshersDC_Segment.MaxSize (   self,
  length = 0.0,
  UseExisting = 0 
)

Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value.

Parameters:
lengthis optional maximal allowed length of segment, if it is omitted the preestimated length is used that depends on geometry size
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - creates a new one
Returns:
an instance of StdMeshers_MaxLength hypothesis

Definition at line 89 of file StdMeshersDC.py.

00089 
00090     def MaxSize(self, length=0.0, UseExisting=0):
00091         hyp = self.Hypothesis("MaxLength", [length], UseExisting=UseExisting)
00092         if length > 0.0:
00093             # set given length
00094             hyp.SetLength(length)
00095         if not UseExisting:
00096             # set preestimated length
00097             gen = self.mesh.smeshpyD
00098             initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
00099                                                        self.mesh.GetMesh(), self.mesh.GetShape(),
00100                                                        False) # <- byMesh
00101             preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
00102             if preHyp:
00103                 hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )
00104                 pass
00105             pass
00106         hyp.SetUsePreestimatedLength( length == 0.0 )
00107         return hyp

Here is the call graph for this function:

def StdMeshersDC.StdMeshersDC_Segment.NumberOfSegments (   self,
  n,
  s = [],
  reversedEdges = [],
  UseExisting = 0 
)

Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments.

Parameters:
nfor the number of segments that cut an edge
sfor the scale factor (optional)
reversedEdgesis a list of edges to mesh using reversed orientation. A list item can also be a tuple (edge 1st_vertex_of_edge)
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - create a new one
Returns:
an instance of StdMeshers_NumberOfSegments hypothesis

Definition at line 117 of file StdMeshersDC.py.

00117 
00118     def NumberOfSegments(self, n, s=[], reversedEdges=[], UseExisting=0):
00119         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
00120             reversedEdges, UseExisting = [], reversedEdges
00121         entry = self.MainShapeEntry()
00122         reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
00123         if s == []:
00124             hyp = self.Hypothesis("NumberOfSegments", [n, reversedEdgeInd, entry],
00125                                   UseExisting=UseExisting,
00126                                   CompareMethod=self._compareNumberOfSegments)
00127         else:
00128             hyp = self.Hypothesis("NumberOfSegments", [n,s, reversedEdgeInd, entry],
00129                                   UseExisting=UseExisting,
00130                                   CompareMethod=self._compareNumberOfSegments)
00131             hyp.SetDistrType( 1 )
00132             hyp.SetScaleFactor(s)
00133         hyp.SetNumberOfSegments(n)
00134         hyp.SetReversedEdges( reversedEdgeInd )
00135         hyp.SetObjectEntry( entry )
00136         return hyp

Here is the call graph for this function:

def StdMeshersDC.StdMeshersDC_Segment_Python.PythonSplit1D (   self,
  n,
  func,
  UseExisting = 0 
)

Defines "PythonSplit1D" hypothesis.

Parameters:
nfor the number of segments that cut an edge
funcfor the python function that calculates the length of all segments
UseExistingif ==true - searches for the existing hypothesis created with the same parameters, else (default) - creates a new one

Definition at line 362 of file StdMeshersDC.py.

00362 
00363     def PythonSplit1D(self, n, func, UseExisting=0):
00364         compFun = lambda hyp, args: False
00365         hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so",
00366                               UseExisting=UseExisting, CompareMethod=compFun)
00367         hyp.SetNumberOfSegments(n)
00368         hyp.SetPythonLog10RatioFunction(func)
00369         return hyp
00370 
00371 # Public class: Mesh_Triangle_MEFISTO
00372 # -----------------------------------

Here is the call graph for this function:

def smeshDC.Mesh_Algorithm.ReversedEdgeIndices (   self,
  reverseList 
)

Transform a list of ether edges or tuples (edge 1st_vertex_of_edge) into a list acceptable to SetReversedEdges() of some 1D hypotheses.

Definition at line 4264 of file smeshDC.py.

04264 
04265     def ReversedEdgeIndices(self, reverseList):
04266         resList = []
04267         geompy = self.mesh.geompyD
04268         for i in reverseList:
04269             if isinstance( i, int ):
04270                 s = geompy.SubShapes(self.mesh.geom, [i])[0]
04271                 if s.GetShapeType() != geompyDC.GEOM.EDGE:
04272                     raise TypeError, "Not EDGE index given"
04273                 resList.append( i )
04274             elif isinstance( i, geompyDC.GEOM._objref_GEOM_Object ):
04275                 if i.GetShapeType() != geompyDC.GEOM.EDGE:
04276                     raise TypeError, "Not an EDGE given"
04277                 resList.append( geompy.GetSubShapeID(self.mesh.geom, i ))
04278             elif len( i ) > 1:
04279                 e = i[0]
04280                 v = i[1]
04281                 if not isinstance( e, geompyDC.GEOM._objref_GEOM_Object ) or \
04282                    not isinstance( v, geompyDC.GEOM._objref_GEOM_Object ):
04283                     raise TypeError, "A list item must be a tuple (edge 1st_vertex_of_edge)"
04284                 if v.GetShapeType() == geompyDC.GEOM.EDGE and \
04285                    e.GetShapeType() == geompyDC.GEOM.VERTEX:
04286                     v,e = e,v
04287                 if e.GetShapeType() != geompyDC.GEOM.EDGE or \
04288                    v.GetShapeType() != geompyDC.GEOM.VERTEX:
04289                     raise TypeError, "A list item must be a tuple (edge 1st_vertex_of_edge)"
04290                 vFirst = FirstVertexOnCurve( e )
04291                 tol    = geompy.Tolerance( vFirst )[-1]
04292                 if geompy.MinDistance( v, vFirst ) > 1.5*tol:
04293                     resList.append( geompy.GetSubShapeID(self.mesh.geom, e ))
04294             else:
04295                 raise TypeError, "Item must be either an edge or tuple (edge 1st_vertex_of_edge)"
04296         return resList
04297 

Here is the call graph for this function:

Here is the caller graph for this function:

def StdMeshersDC.StdMeshersDC_Segment.StartEndLength (   self,
  start,
  end,
  reversedEdges = [],
  UseExisting = 0 
)

Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length.

Parameters:
startdefines the length of the first segment
enddefines the length of the last segment
reversedEdgesis a list of edges to mesh using reversed orientation. A list item can also be a tuple (edge 1st_vertex_of_edge)
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - creates a new one
Returns:
an instance of StdMeshers_StartEndLength hypothesis

Definition at line 218 of file StdMeshersDC.py.

00218 
00219     def StartEndLength(self, start, end, reversedEdges=[], UseExisting=0):
00220         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
00221             reversedEdges, UseExisting = [], reversedEdges
00222         reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
00223         entry = self.MainShapeEntry()
00224         compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
00225                                       IsEqual(hyp.GetLength(0), args[1]) and \
00226                                       hyp.GetReversedEdges() == args[2]  and \
00227                                       (not args[2] or hyp.GetObjectEntry() == args[3]))
00228         hyp = self.Hypothesis("StartEndLength", [start, end, reversedEdgeInd, entry],
00229                               UseExisting=UseExisting, CompareMethod=compFun)
00230         hyp.SetStartLength(start)
00231         hyp.SetEndLength(end)
00232         hyp.SetReversedEdges( reversedEdgeInd )
00233         hyp.SetObjectEntry( entry )
00234         return hyp

Here is the call graph for this function: