1 # Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # @package StdMeshersBuilder
22 # Python API for the standard meshing plug-in module.
24 from salome.smesh.smesh_algorithm import Mesh_Algorithm
27 #----------------------------
28 # Mesh algo type identifiers
29 #----------------------------
31 ## Algorithm type: Regular 1D algorithm, see StdMeshersBuilder_Segment
32 REGULAR = "Regular_1D"
33 ## Algorithm type: Python 1D algorithm, see StdMeshersBuilder_Segment_Python
35 ## Algorithm type: Composite segment 1D algorithm, see StdMeshersBuilder_CompositeSegment
36 COMPOSITE = "CompositeSegment_1D"
37 ## Algorithm type: Triangle MEFISTO 2D algorithm, see StdMeshersBuilder_Triangle_MEFISTO
38 MEFISTO = "MEFISTO_2D"
39 ## Algorithm type: Hexahedron 3D (i-j-k) algorithm, see StdMeshersBuilder_Hexahedron
41 ## Algorithm type: Quadrangle 2D algorithm, see StdMeshersBuilder_Quadrangle
42 QUADRANGLE = "Quadrangle_2D"
43 ## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersBuilder_RadialQuadrangle1D2D
44 RADIAL_QUAD = "RadialQuadrangle_1D2D"
45 ## Algorithm type: Quadrangle (Medial Axis Projection) 1D-2D algorithm, see StdMeshersBuilder_QuadMA_1D2D
46 QUAD_MA_PROJ = "QuadFromMedialAxis_1D2D"
47 ## Algorithm type: Polygon Per Face 2D algorithm, see StdMeshersBuilder_PolygonPerFace
48 POLYGON = "PolygonPerFace_2D"
50 # import items of enums
51 for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e))
52 for e in StdMeshers.VLExtrusionMethod._items: exec('%s = StdMeshers.%s'%(e,e))
54 #----------------------
56 #----------------------
58 ## Defines segment 1D algorithm for edges discretization.
60 # It can be created by calling smeshBuilder.Mesh.Segment(geom=0)
62 # @ingroup l3_algos_basic
63 class StdMeshersBuilder_Segment(Mesh_Algorithm):
65 ## name of the dynamic method in smeshBuilder.Mesh class
67 meshMethod = "Segment"
68 ## type of algorithm used with helper function in smeshBuilder.Mesh class
71 ## flag pointing whether this algorithm should be used by default in dynamic method
72 # of smeshBuilder.Mesh class
75 ## doc string of the method
77 docHelper = "Creates segment 1D algorithm for edges"
79 ## Private constructor.
80 # @param mesh parent mesh object algorithm is assigned to
81 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
82 # if it is @c 0 (default), the algorithm is assigned to the main shape
83 def __init__(self, mesh, geom=0):
84 Mesh_Algorithm.__init__(self)
85 self.Create(mesh, geom, self.algoType)
88 ## Defines "LocalLength" hypothesis to cut an edge in several segments with the same length
89 # @param l for the length of segments that cut an edge
90 # @param UseExisting if ==true - searches for an existing hypothesis created with
91 # the same parameters, else (default) - creates a new one
92 # @param p precision, used for calculation of the number of segments.
93 # The precision should be a positive, meaningful value within the range [0,1].
94 # In general, the number of segments is calculated with the formula:
95 # nb = ceil((edge_length / l) - p)
96 # Function ceil rounds its argument to the higher integer.
97 # So, p=0 means rounding of (edge_length / l) to the higher integer,
98 # p=0.5 means rounding of (edge_length / l) to the nearest integer,
99 # p=1 means rounding of (edge_length / l) to the lower integer.
100 # Default value is 1e-07.
101 # @return an instance of StdMeshers_LocalLength hypothesis
102 # @ingroup l3_hypos_1dhyps
103 def LocalLength(self, l, UseExisting=0, p=1e-07):
104 from salome.smesh.smeshBuilder import IsEqual
105 comFun=lambda hyp, args: IsEqual(hyp.GetLength(), args[0]) and IsEqual(hyp.GetPrecision(), args[1])
106 hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting, CompareMethod=comFun)
111 ## Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value
112 # @param length is optional maximal allowed length of segment, if it is omitted
113 # the preestimated length is used that depends on geometry size
114 # @param UseExisting if ==true - searches for an existing hypothesis created with
115 # the same parameters, else (default) - creates a new one
116 # @return an instance of StdMeshers_MaxLength hypothesis
117 # @ingroup l3_hypos_1dhyps
118 def MaxSize(self, length=0.0, UseExisting=0):
119 hyp = self.Hypothesis("MaxLength", [length], UseExisting=UseExisting)
122 hyp.SetLength(length)
124 # set preestimated length
125 gen = self.mesh.smeshpyD
126 initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
127 self.mesh.GetMesh(), self.mesh.GetShape(),
129 preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
131 hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )
134 hyp.SetUsePreestimatedLength( length == 0.0 )
137 ## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
138 # @param n for the number of segments that cut an edge
139 # @param s for the scale factor (optional)
140 # @param reversedEdges is a list of edges to mesh using reversed orientation.
141 # A list item can also be a tuple (edge, 1st_vertex_of_edge)
142 # @param UseExisting if ==true - searches for an existing hypothesis created with
143 # the same parameters, else (default) - create a new one
144 # @return an instance of StdMeshers_NumberOfSegments hypothesis
145 # @ingroup l3_hypos_1dhyps
146 def NumberOfSegments(self, n, s=[], reversedEdges=[], UseExisting=0):
147 if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
148 reversedEdges, UseExisting = [], reversedEdges
149 entry = self.MainShapeEntry()
150 reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
152 hyp = self.Hypothesis("NumberOfSegments", [n, reversedEdgeInd, entry],
153 UseExisting=UseExisting,
154 CompareMethod=self._compareNumberOfSegments)
156 hyp = self.Hypothesis("NumberOfSegments", [n,s, reversedEdgeInd, entry],
157 UseExisting=UseExisting,
158 CompareMethod=self._compareNumberOfSegments)
159 hyp.SetScaleFactor(s)
160 hyp.SetNumberOfSegments(n)
161 hyp.SetReversedEdges( reversedEdgeInd )
162 hyp.SetObjectEntry( entry )
167 # Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
168 def _compareNumberOfSegments(self, hyp, args):
169 if hyp.GetNumberOfSegments() == args[0]:
171 if hyp.GetReversedEdges() == args[1]:
172 if not args[1] or hyp.GetObjectEntry() == args[2]:
175 from salome.smesh.smeshBuilder import IsEqual
176 if hyp.GetReversedEdges() == args[2]:
177 if not args[2] or hyp.GetObjectEntry() == args[3]:
178 if hyp.GetDistrType() == 1:
179 if IsEqual(hyp.GetScaleFactor(), args[1]):
183 ## Defines "Adaptive" hypothesis to cut an edge into segments keeping segment size
184 # within the given range and considering (1) deflection of segments from the edge
185 # and (2) distance from segments to closest edges and faces to have segment length
186 # not longer than two times shortest distances to edges and faces.
187 # @param minSize defines the minimal allowed segment length
188 # @param maxSize defines the maximal allowed segment length
189 # @param deflection defines the maximal allowed distance from a segment to an edge
190 # @param UseExisting if ==true - searches for an existing hypothesis created with
191 # the same parameters, else (default) - creates a new one
192 # @return an instance of StdMeshers_Adaptive1D hypothesis
193 # @ingroup l3_hypos_1dhyps
194 def Adaptive(self, minSize, maxSize, deflection, UseExisting=False):
195 from salome.smesh.smeshBuilder import IsEqual
196 compFun = lambda hyp, args: ( IsEqual(hyp.GetMinSize(), args[0]) and \
197 IsEqual(hyp.GetMaxSize(), args[1]) and \
198 IsEqual(hyp.GetDeflection(), args[2]))
199 hyp = self.Hypothesis("Adaptive1D", [minSize, maxSize, deflection],
200 UseExisting=UseExisting, CompareMethod=compFun)
201 hyp.SetMinSize(minSize)
202 hyp.SetMaxSize(maxSize)
203 hyp.SetDeflection(deflection)
206 ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
207 # that changes in arithmetic progression
208 # @param start defines the length of the first segment
209 # @param end defines the length of the last segment
210 # @param reversedEdges is a list of edges to mesh using reversed orientation.
211 # A list item can also be a tuple (edge, 1st_vertex_of_edge)
212 # @param UseExisting if ==true - searches for an existing hypothesis created with
213 # the same parameters, else (default) - creates a new one
214 # @return an instance of StdMeshers_Arithmetic1D hypothesis
215 # @ingroup l3_hypos_1dhyps
216 def Arithmetic1D(self, start, end, reversedEdges=[], UseExisting=0):
217 if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
218 reversedEdges, UseExisting = [], reversedEdges
219 reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
220 entry = self.MainShapeEntry()
221 from salome.smesh.smeshBuilder import IsEqual
222 compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
223 IsEqual(hyp.GetLength(0), args[1]) and \
224 hyp.GetReversedEdges() == args[2] and \
225 (not args[2] or hyp.GetObjectEntry() == args[3]))
226 hyp = self.Hypothesis("Arithmetic1D", [start, end, reversedEdgeInd, entry],
227 UseExisting=UseExisting, CompareMethod=compFun)
228 hyp.SetStartLength(start)
229 hyp.SetEndLength(end)
230 hyp.SetReversedEdges( reversedEdgeInd )
231 hyp.SetObjectEntry( entry )
234 ## Defines "GeometricProgression" hypothesis to cut an edge in several
235 # segments with a length that changes in Geometric progression
236 # @param start defines the length of the first segment
237 # @param ratio defines the common ratio of the geometric progression
238 # @param reversedEdges is a list of edges to mesh using reversed orientation.
239 # A list item can also be a tuple (edge, 1st_vertex_of_edge)
240 # @param UseExisting if ==true - searches for an existing hypothesis created with
241 # the same parameters, else (default) - creates a new one
242 # @return an instance of StdMeshers_Geometric1D hypothesis
243 # @ingroup l3_hypos_1dhyps
244 def GeometricProgression(self, start, ratio, reversedEdges=[], UseExisting=0):
245 reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
246 entry = self.MainShapeEntry()
247 from salome.smesh.smeshBuilder import IsEqual
248 compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
249 IsEqual(hyp.GetLength(0), args[1]) and \
250 hyp.GetReversedEdges() == args[2] and \
251 (not args[2] or hyp.GetObjectEntry() == args[3]))
252 hyp = self.Hypothesis("GeometricProgression", [start, ratio, reversedEdgeInd, entry],
253 UseExisting=UseExisting, CompareMethod=compFun)
254 hyp.SetStartLength( start )
255 hyp.SetCommonRatio( ratio )
256 hyp.SetReversedEdges( reversedEdgeInd )
257 hyp.SetObjectEntry( entry )
260 ## Defines "FixedPoints1D" hypothesis to cut an edge using parameter
261 # on curve from 0 to 1 (additionally it is neecessary to check
262 # orientation of edges and create list of reversed edges if it is
263 # needed) and sets numbers of segments between given points (default
264 # values are equals 1
265 # @param points defines the list of parameters on curve
266 # @param nbSegs defines the list of numbers of segments
267 # @param reversedEdges is a list of edges to mesh using reversed orientation.
268 # A list item can also be a tuple (edge, 1st_vertex_of_edge)
269 # @param UseExisting if ==true - searches for an existing hypothesis created with
270 # the same parameters, else (default) - creates a new one
271 # @return an instance of StdMeshers_FixedPoints1D hypothesis
272 # @ingroup l3_hypos_1dhyps
273 def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
274 if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
275 reversedEdges, UseExisting = [], reversedEdges
276 reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
277 entry = self.MainShapeEntry()
278 compFun = lambda hyp, args: ( hyp.GetPoints() == args[0] and \
279 hyp.GetNbSegments() == args[1] and \
280 hyp.GetReversedEdges() == args[2] and \
281 (not args[2] or hyp.GetObjectEntry() == args[3]))
282 hyp = self.Hypothesis("FixedPoints1D", [points, nbSegs, reversedEdgeInd, entry],
283 UseExisting=UseExisting, CompareMethod=compFun)
284 hyp.SetPoints(points)
285 hyp.SetNbSegments(nbSegs)
286 hyp.SetReversedEdges(reversedEdgeInd)
287 hyp.SetObjectEntry(entry)
290 ## Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
291 # @param start defines the length of the first segment
292 # @param end defines the length of the last segment
293 # @param reversedEdges is a list of edges to mesh using reversed orientation.
294 # A list item can also be a tuple (edge, 1st_vertex_of_edge)
295 # @param UseExisting if ==true - searches for an existing hypothesis created with
296 # the same parameters, else (default) - creates a new one
297 # @return an instance of StdMeshers_StartEndLength hypothesis
298 # @ingroup l3_hypos_1dhyps
299 def StartEndLength(self, start, end, reversedEdges=[], UseExisting=0):
300 if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
301 reversedEdges, UseExisting = [], reversedEdges
302 reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
303 entry = self.MainShapeEntry()
304 from salome.smesh.smeshBuilder import IsEqual
305 compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
306 IsEqual(hyp.GetLength(0), args[1]) and \
307 hyp.GetReversedEdges() == args[2] and \
308 (not args[2] or hyp.GetObjectEntry() == args[3]))
309 hyp = self.Hypothesis("StartEndLength", [start, end, reversedEdgeInd, entry],
310 UseExisting=UseExisting, CompareMethod=compFun)
311 hyp.SetStartLength(start)
312 hyp.SetEndLength(end)
313 hyp.SetReversedEdges( reversedEdgeInd )
314 hyp.SetObjectEntry( entry )
317 ## Defines "Deflection1D" hypothesis
318 # @param d for the deflection
319 # @param UseExisting if ==true - searches for an existing hypothesis created with
320 # the same parameters, else (default) - create a new one
321 # @ingroup l3_hypos_1dhyps
322 def Deflection1D(self, d, UseExisting=0):
323 from salome.smesh.smeshBuilder import IsEqual
324 compFun = lambda hyp, args: IsEqual(hyp.GetDeflection(), args[0])
325 hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting, CompareMethod=compFun)
329 ## Defines "Propagation" hypothesis that propagates 1D hypotheses
330 # from an edge where this hypothesis is assigned to
331 # on all other edges that are at the opposite side in case of quadrangular faces
332 # This hypothesis should be assigned to an edge to propagate a hypothesis from.
333 # @ingroup l3_hypos_additi
334 def Propagation(self):
335 return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
337 ## Defines "Propagation of Node Distribution" hypothesis that propagates
338 # distribution of nodes from an edge where this hypothesis is assigned to,
339 # to opposite edges of quadrangular faces, so that number of segments on all these
340 # edges will be the same, as well as relations between segment lengths.
341 # @ingroup l3_hypos_additi
342 def PropagationOfDistribution(self):
343 return self.Hypothesis("PropagOfDistribution", UseExisting=1,
344 CompareMethod=self.CompareEqualHyp)
346 ## Defines "AutomaticLength" hypothesis
347 # @param fineness for the fineness [0-1]
348 # @param UseExisting if ==true - searches for an existing hypothesis created with the
349 # same parameters, else (default) - create a new one
350 # @ingroup l3_hypos_1dhyps
351 def AutomaticLength(self, fineness=0, UseExisting=0):
352 from salome.smesh.smeshBuilder import IsEqual
353 compFun = lambda hyp, args: IsEqual(hyp.GetFineness(), args[0])
354 hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting,
355 CompareMethod=compFun)
356 hyp.SetFineness( fineness )
359 ## Defines "SegmentLengthAroundVertex" hypothesis
360 # @param length for the segment length
361 # @param vertex for the length localization: the vertex index [0,1] | vertex object.
362 # Any other integer value means that the hypothesis will be set on the
363 # whole 1D shape, where Mesh_Segment algorithm is assigned.
364 # @param UseExisting if ==true - searches for an existing hypothesis created with
365 # the same parameters, else (default) - creates a new one
366 # @ingroup l3_algos_segmarv
367 def LengthNearVertex(self, length, vertex=0, UseExisting=0):
369 store_geom = self.geom
370 if type(vertex) is types.IntType:
371 if vertex == 0 or vertex == 1:
372 from salome.geom import geomBuilder
373 vertex = self.mesh.geompyD.ExtractShapes(self.geom, geomBuilder.geomBuilder.ShapeType["VERTEX"],True)[vertex]
381 if self.geom is None:
382 raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape"
383 from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus
384 AssureGeomPublished( self.mesh, self.geom )
385 name = GetName(self.geom)
387 algo = self.FindAlgorithm("SegmentAroundVertex_0D", self.mesh.smeshpyD)
389 algo = self.mesh.smeshpyD.CreateHypothesis("SegmentAroundVertex_0D", "libStdMeshersEngine.so")
391 status = self.mesh.mesh.AddHypothesis(self.geom, algo)
392 TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True, self.mesh)
394 from salome.smesh.smeshBuilder import IsEqual
395 comFun = lambda hyp, args: IsEqual(hyp.GetLength(), args[0])
396 hyp = self.Hypothesis("SegmentLengthAroundVertex", [length], UseExisting=UseExisting,
397 CompareMethod=comFun)
398 self.geom = store_geom
399 hyp.SetLength( length )
402 ## Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
403 # If the 2D mesher sees that all boundary edges are quadratic,
404 # it generates quadratic faces, else it generates linear faces using
405 # medium nodes as if they are vertices.
406 # The 3D mesher generates quadratic volumes only if all boundary faces
407 # are quadratic, else it fails.
409 # @ingroup l3_hypos_additi
410 def QuadraticMesh(self):
411 hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
414 pass # end of StdMeshersBuilder_Segment class
416 ## Segment 1D algorithm for discretization of a set of adjacent edges as one edge.
418 # It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.COMPOSITE,geom=0)
420 # @ingroup l3_algos_basic
421 class StdMeshersBuilder_CompositeSegment(StdMeshersBuilder_Segment):
423 ## name of the dynamic method in smeshBuilder.Mesh class
425 meshMethod = "Segment"
426 ## type of algorithm used with helper function in smeshBuilder.Mesh class
429 ## flag pointing whether this algorithm should be used by default in dynamic method
430 # of smeshBuilder.Mesh class
433 ## doc string of the method
435 docHelper = "Creates segment 1D algorithm for edges"
437 ## Private constructor.
438 # @param mesh parent mesh object algorithm is assigned to
439 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
440 # if it is @c 0 (default), the algorithm is assigned to the main shape
441 def __init__(self, mesh, geom=0):
442 self.Create(mesh, geom, self.algoType)
445 pass # end of StdMeshersBuilder_CompositeSegment class
447 ## Defines a segment 1D algorithm for discretization of edges with Python function
449 # It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.PYTHON,geom=0)
451 # @ingroup l3_algos_basic
452 class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
454 ## name of the dynamic method in smeshBuilder.Mesh class
456 meshMethod = "Segment"
457 ## type of algorithm used with helper function in smeshBuilder.Mesh class
460 ## doc string of the method
462 docHelper = "Creates segment 1D algorithm for edges"
464 ## Private constructor.
465 # @param mesh parent mesh object algorithm is assigned to
466 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
467 # if it is @c 0 (default), the algorithm is assigned to the main shape
468 def __init__(self, mesh, geom=0):
469 import Python1dPlugin
470 self.Create(mesh, geom, self.algoType, "libPython1dEngine.so")
473 ## Defines "PythonSplit1D" hypothesis
474 # @param n for the number of segments that cut an edge
475 # @param func for the python function that calculates the length of all segments
476 # @param UseExisting if ==true - searches for the existing hypothesis created with
477 # the same parameters, else (default) - creates a new one
478 # @ingroup l3_hypos_1dhyps
479 def PythonSplit1D(self, n, func, UseExisting=0):
480 compFun = lambda hyp, args: False
481 hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so",
482 UseExisting=UseExisting, CompareMethod=compFun)
483 hyp.SetNumberOfSegments(n)
484 hyp.SetPythonLog10RatioFunction(func)
487 pass # end of StdMeshersBuilder_Segment_Python class
489 ## Triangle MEFISTO 2D algorithm
491 # It is created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.MEFISTO,geom=0)
493 # @ingroup l3_algos_basic
494 class StdMeshersBuilder_Triangle_MEFISTO(Mesh_Algorithm):
496 ## name of the dynamic method in smeshBuilder.Mesh class
498 meshMethod = "Triangle"
499 ## type of algorithm used with helper function in smeshBuilder.Mesh class
502 ## flag pointing whether this algorithm should be used by default in dynamic method
503 # of smeshBuilder.Mesh class
506 ## doc string of the method
508 docHelper = "Creates triangle 2D algorithm for faces"
510 ## Private constructor.
511 # @param mesh parent mesh object algorithm is assigned to
512 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
513 # if it is @c 0 (default), the algorithm is assigned to the main shape
514 def __init__(self, mesh, geom=0):
515 Mesh_Algorithm.__init__(self)
516 self.Create(mesh, geom, self.algoType)
519 ## Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle
520 # @param area for the maximum area of each triangle
521 # @param UseExisting if ==true - searches for an existing hypothesis created with the
522 # same parameters, else (default) - creates a new one
524 # @ingroup l3_hypos_2dhyps
525 def MaxElementArea(self, area, UseExisting=0):
526 from salome.smesh.smeshBuilder import IsEqual
527 comparator = lambda hyp, args: IsEqual(hyp.GetMaxElementArea(), args[0])
528 hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
529 CompareMethod=comparator)
530 hyp.SetMaxElementArea(area)
533 ## Defines "LengthFromEdges" hypothesis to build triangles
534 # based on the length of the edges taken from the wire
536 # @ingroup l3_hypos_2dhyps
537 def LengthFromEdges(self):
538 hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
541 pass # end of StdMeshersBuilder_Triangle_MEFISTO class
543 ## Defines a quadrangle 2D algorithm
545 # It is created by calling smeshBuilder.Mesh.Quadrangle(geom=0)
547 # @ingroup l3_algos_basic
548 class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
550 ## name of the dynamic method in smeshBuilder.Mesh class
552 meshMethod = "Quadrangle"
553 ## type of algorithm used with helper function in smeshBuilder.Mesh class
555 algoType = QUADRANGLE
556 ## flag pointing whether this algorithm should be used by default in dynamic method
557 # of smeshBuilder.Mesh class
560 ## doc string of the method
562 docHelper = "Creates quadrangle 2D algorithm for faces"
563 ## hypothesis associated with algorithm
567 ## Private constructor.
568 # @param mesh parent mesh object algorithm is assigned to
569 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
570 # if it is @c 0 (default), the algorithm is assigned to the main shape
571 def __init__(self, mesh, geom=0):
572 Mesh_Algorithm.__init__(self)
573 self.Create(mesh, geom, self.algoType)
576 ## Defines "QuadrangleParameters" hypothesis
577 # @param quadType defines the algorithm of transition between differently descretized
578 # sides of a geometrical face:
579 # - QUAD_STANDARD - both triangles and quadrangles are possible in the transition
580 # area along the finer meshed sides.
581 # - QUAD_TRIANGLE_PREF - only triangles are built in the transition area along the
582 # finer meshed sides.
583 # - QUAD_QUADRANGLE_PREF - only quadrangles are built in the transition area along
584 # the finer meshed sides, iff the total quantity of segments on
585 # all four sides of the face is even (divisible by 2).
586 # - QUAD_QUADRANGLE_PREF_REVERSED - same as QUAD_QUADRANGLE_PREF but the transition
587 # area is located along the coarser meshed sides.
588 # - QUAD_REDUCED - only quadrangles are built and the transition between the sides
589 # is made gradually, layer by layer. This type has a limitation on
590 # the number of segments: one pair of opposite sides must have the
591 # same number of segments, the other pair must have an even difference
592 # between the numbers of segments on the sides.
593 # @param triangleVertex: vertex of a trilateral geometrical face, around which triangles
594 # will be created while other elements will be quadrangles.
595 # Vertex can be either a GEOM_Object or a vertex ID within the
597 # @param enfVertices: list of shapes defining positions where nodes (enforced nodes)
598 # must be created by the mesher. Shapes can be of any type,
599 # vertices of given shapes define positions of enforced nodes.
600 # Only vertices successfully projected to the face are used.
601 # @param enfPoints: list of points giving positions of enforced nodes.
602 # Point can be defined either as SMESH.PointStruct's
603 # ([SMESH.PointStruct(x1,y1,z1), SMESH.PointStruct(x2,y2,z2),...])
604 # or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]).
605 # In the case if the defined QuadrangleParameters() refer to a sole face,
606 # all given points must lie on this face, else the mesher fails.
607 # @param UseExisting: if \c True - searches for the existing hypothesis created with
608 # the same parameters, else (default) - creates a new one
609 # @ingroup l3_hypos_quad
610 def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0,
611 enfVertices=[],enfPoints=[],UseExisting=0):
613 vertexID = triangleVertex
614 if isinstance( triangleVertex, GEOM._objref_GEOM_Object ):
615 vertexID = self.mesh.geompyD.GetSubShapeID( self.mesh.geom, triangleVertex )
616 if isinstance( enfVertices, int ) and not enfPoints and not UseExisting:
617 # a call of old syntax, before inserting enfVertices and enfPoints before UseExisting
618 UseExisting, enfVertices = enfVertices, []
619 pStructs, xyz = [], []
621 if isinstance( p, SMESH.PointStruct ):
622 xyz.append(( p.x, p.y, p.z ))
625 xyz.append(( p[0], p[1], p[2] ))
626 pStructs.append( SMESH.PointStruct( p[0], p[1], p[2] ))
628 compFun = lambda hyp,args: \
629 hyp.GetQuadType() == args[0] and \
630 (hyp.GetTriaVertex()==args[1] or ( hyp.GetTriaVertex()<1 and args[1]<1)) and \
631 ((hyp.GetEnforcedNodes()) == (args[2],args[3])) # True w/o enfVertices only
632 entries = [ shape.GetStudyEntry() for shape in enfVertices ]
633 self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID,entries,xyz],
634 UseExisting = UseExisting, CompareMethod=compFun)
636 if self.params.GetQuadType() != quadType:
637 self.params.SetQuadType(quadType)
639 self.params.SetTriaVertex( vertexID )
640 from salome.smesh.smeshBuilder import AssureGeomPublished
641 for v in enfVertices:
642 AssureGeomPublished( self.mesh, v )
643 self.params.SetEnforcedNodes( enfVertices, pStructs )
646 ## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
647 # quadrangles are built in the transition area along the finer meshed sides,
648 # iff the total quantity of segments on all four sides of the face is even.
649 # @param reversed if True, transition area is located along the coarser meshed sides.
650 # @param UseExisting: if ==true - searches for the existing hypothesis created with
651 # the same parameters, else (default) - creates a new one
652 # @ingroup l3_hypos_quad
653 def QuadranglePreference(self, reversed=False, UseExisting=0):
655 return self.QuadrangleParameters(QUAD_QUADRANGLE_PREF_REVERSED,UseExisting=UseExisting)
656 return self.QuadrangleParameters(QUAD_QUADRANGLE_PREF,UseExisting=UseExisting)
658 ## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
659 # triangles are built in the transition area along the finer meshed sides.
660 # @param UseExisting: if ==true - searches for the existing hypothesis created with
661 # the same parameters, else (default) - creates a new one
662 # @ingroup l3_hypos_quad
663 def TrianglePreference(self, UseExisting=0):
664 return self.QuadrangleParameters(QUAD_TRIANGLE_PREF,UseExisting=UseExisting)
666 ## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
667 # quadrangles are built and the transition between the sides is made gradually,
668 # layer by layer. This type has a limitation on the number of segments: one pair
669 # of opposite sides must have the same number of segments, the other pair must
670 # have an even difference between the numbers of segments on the sides.
671 # @param UseExisting: if ==true - searches for the existing hypothesis created with
672 # the same parameters, else (default) - creates a new one
673 # @ingroup l3_hypos_quad
674 def Reduced(self, UseExisting=0):
675 return self.QuadrangleParameters(QUAD_REDUCED,UseExisting=UseExisting)
677 ## Defines "QuadrangleParams" hypothesis with QUAD_STANDARD type of quadrangulation
678 # @param vertex: vertex of a trilateral geometrical face, around which triangles
679 # will be created while other elements will be quadrangles.
680 # Vertex can be either a GEOM_Object or a vertex ID within the
682 # @param UseExisting: if ==true - searches for the existing hypothesis created with
683 # the same parameters, else (default) - creates a new one
684 # @ingroup l3_hypos_quad
685 def TriangleVertex(self, vertex, UseExisting=0):
686 return self.QuadrangleParameters(QUAD_STANDARD,vertex,UseExisting)
688 pass # end of StdMeshersBuilder_Quadrangle class
690 ## Defines a hexahedron 3D algorithm
692 # It is created by calling smeshBuilder.Mesh.Hexahedron(geom=0)
694 # @ingroup l3_algos_basic
695 class StdMeshersBuilder_Hexahedron(Mesh_Algorithm):
697 ## name of the dynamic method in smeshBuilder.Mesh class
699 meshMethod = "Hexahedron"
700 ## type of algorithm used with helper function in smeshBuilder.Mesh class
703 ## flag pointing whether this algorithm should be used by default in dynamic method
704 # of smeshBuilder.Mesh class
707 ## doc string of the method
709 docHelper = "Creates hexahedron 3D algorithm for volumes"
711 ## Private constructor.
712 # @param mesh parent mesh object algorithm is assigned to
713 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
714 # if it is @c 0 (default), the algorithm is assigned to the main shape
715 def __init__(self, mesh, geom=0):
716 Mesh_Algorithm.__init__(self)
717 self.Create(mesh, geom, Hexa)
720 pass # end of StdMeshersBuilder_Hexahedron class
722 ## Defines a projection 1D algorithm
724 # It is created by calling smeshBuilder.Mesh.Projection1D(geom=0)
726 # @ingroup l3_algos_proj
727 class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
729 ## name of the dynamic method in smeshBuilder.Mesh class
731 meshMethod = "Projection1D"
732 ## type of algorithm used with helper function in smeshBuilder.Mesh class
734 algoType = "Projection_1D"
735 ## flag pointing whether this algorithm should be used by default in dynamic method
736 # of smeshBuilder.Mesh class
739 ## doc string of the method
741 docHelper = "Creates projection 1D algorithm for edges"
743 ## Private constructor.
744 # @param mesh parent mesh object algorithm is assigned to
745 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
746 # if it is @c 0 (default), the algorithm is assigned to the main shape
747 def __init__(self, mesh, geom=0):
748 Mesh_Algorithm.__init__(self)
749 self.Create(mesh, geom, self.algoType)
752 ## Defines "Source Edge" hypothesis, specifying a meshed edge, from where
753 # a mesh pattern is taken, and, optionally, the association of vertices
754 # between the source edge and a target edge (to which a hypothesis is assigned)
755 # @param edge from which nodes distribution is taken
756 # @param mesh from which nodes distribution is taken (optional)
757 # @param srcV a vertex of \a edge to associate with \a tgtV (optional)
758 # @param tgtV a vertex of \a the edge to which the algorithm is assigned,
759 # to associate with \a srcV (optional)
760 # @param UseExisting if ==true - searches for the existing hypothesis created with
761 # the same parameters, else (default) - creates a new one
762 def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0):
763 from salome.smesh.smeshBuilder import AssureGeomPublished, Mesh
764 AssureGeomPublished( self.mesh, edge )
765 AssureGeomPublished( self.mesh, srcV )
766 AssureGeomPublished( self.mesh, tgtV )
767 hyp = self.Hypothesis("ProjectionSource1D", [edge,mesh,srcV,tgtV],
769 # it does not seem to be useful to reuse the existing "SourceEdge" hypothesis
770 #UseExisting=UseExisting, CompareMethod=self.CompareSourceEdge)
771 hyp.SetSourceEdge( edge )
772 if not mesh is None and isinstance(mesh, Mesh):
773 mesh = mesh.GetMesh()
774 hyp.SetSourceMesh( mesh )
775 hyp.SetVertexAssociation( srcV, tgtV )
778 pass # end of StdMeshersBuilder_Projection1D class
780 ## Defines a projection 2D algorithm
782 # It is created by calling smeshBuilder.Mesh.Projection2D(geom=0)
784 # @ingroup l3_algos_proj
785 class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
787 ## name of the dynamic method in smeshBuilder.Mesh class
789 meshMethod = "Projection2D"
790 ## type of algorithm used with helper function in smeshBuilder.Mesh class
792 algoType = "Projection_2D"
793 ## flag pointing whether this algorithm should be used by default in dynamic method
794 # of smeshBuilder.Mesh class
797 ## doc string of the method
799 docHelper = "Creates projection 2D algorithm for faces"
801 ## Private constructor.
802 # @param mesh parent mesh object algorithm is assigned to
803 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
804 # if it is @c 0 (default), the algorithm is assigned to the main shape
805 def __init__(self, mesh, geom=0):
806 Mesh_Algorithm.__init__(self)
807 self.Create(mesh, geom, self.algoType)
810 ## Defines "Source Face" hypothesis, specifying a meshed face, from where
811 # a mesh pattern is taken, and, optionally, the association of vertices
812 # between the source face and the target face (to which a hypothesis is assigned)
813 # @param face from which the mesh pattern is taken
814 # @param mesh from which the mesh pattern is taken (optional)
815 # @param srcV1 a vertex of \a face to associate with \a tgtV1 (optional)
816 # @param tgtV1 a vertex of \a the face to which the algorithm is assigned,
817 # to associate with \a srcV1 (optional)
818 # @param srcV2 a vertex of \a face to associate with \a tgtV1 (optional)
819 # @param tgtV2 a vertex of \a the face to which the algorithm is assigned,
820 # to associate with \a srcV2 (optional)
821 # @param UseExisting if ==true - forces the search for the existing hypothesis created with
822 # the same parameters, else (default) - forces the creation a new one
824 # Note: all association vertices must belong to one edge of a face
825 def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None,
826 srcV2=None, tgtV2=None, UseExisting=0):
827 from salome.smesh.smeshBuilder import Mesh
828 if isinstance(mesh, Mesh):
829 mesh = mesh.GetMesh()
830 for geom in [ face, srcV1, tgtV1, srcV2, tgtV2 ]:
831 from salome.smesh.smeshBuilder import AssureGeomPublished
832 AssureGeomPublished( self.mesh, geom )
833 hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
834 UseExisting=0, toAdd=False)
835 # it does not seem to be useful to reuse the existing "SourceFace" hypothesis
836 #UseExisting=UseExisting, CompareMethod=self.CompareSourceFace)
837 hyp.SetSourceFace( face )
838 hyp.SetSourceMesh( mesh )
839 hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
840 self.mesh.AddHypothesis(hyp, self.geom)
843 pass # end of StdMeshersBuilder_Projection2D class
845 ## Defines a projection 1D-2D algorithm
847 # It is created by calling smeshBuilder.Mesh.Projection1D2D(geom=0)
849 # @ingroup l3_algos_proj
850 class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D):
852 ## name of the dynamic method in smeshBuilder.Mesh class
854 meshMethod = "Projection1D2D"
855 ## type of algorithm used with helper function in smeshBuilder.Mesh class
857 algoType = "Projection_1D2D"
858 ## doc string of the method
860 docHelper = "Creates projection 1D-2D algorithm for faces"
862 ## Private constructor.
863 # @param mesh parent mesh object algorithm is assigned to
864 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
865 # if it is @c 0 (default), the algorithm is assigned to the main shape
866 def __init__(self, mesh, geom=0):
867 StdMeshersBuilder_Projection2D.__init__(self, mesh, geom)
870 pass # end of StdMeshersBuilder_Projection1D2D class
872 ## Defines a projection 3D algorithm
874 # It is created by calling smeshBuilder.Mesh.Projection3D(geom=0)
876 # @ingroup l3_algos_proj
877 class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
879 ## name of the dynamic method in smeshBuilder.Mesh class
881 meshMethod = "Projection3D"
882 ## type of algorithm used with helper function in smeshBuilder.Mesh class
884 algoType = "Projection_3D"
885 ## doc string of the method
887 docHelper = "Creates projection 3D algorithm for volumes"
889 ## Private constructor.
890 # @param mesh parent mesh object algorithm is assigned to
891 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
892 # if it is @c 0 (default), the algorithm is assigned to the main shape
893 def __init__(self, mesh, geom=0):
894 Mesh_Algorithm.__init__(self)
895 self.Create(mesh, geom, self.algoType)
898 ## Defines the "Source Shape 3D" hypothesis, specifying a meshed solid, from where
899 # the mesh pattern is taken, and, optionally, the association of vertices
900 # between the source and the target solid (to which a hipothesis is assigned)
901 # @param solid from where the mesh pattern is taken
902 # @param mesh from where the mesh pattern is taken (optional)
903 # @param srcV1 a vertex of \a solid to associate with \a tgtV1 (optional)
904 # @param tgtV1 a vertex of \a the solid where the algorithm is assigned,
905 # to associate with \a srcV1 (optional)
906 # @param srcV2 a vertex of \a solid to associate with \a tgtV1 (optional)
907 # @param tgtV2 a vertex of \a the solid to which the algorithm is assigned,
908 # to associate with \a srcV2 (optional)
909 # @param UseExisting - if ==true - searches for the existing hypothesis created with
910 # the same parameters, else (default) - creates a new one
912 # Note: association vertices must belong to one edge of a solid
913 def SourceShape3D(self, solid, mesh=0, srcV1=0, tgtV1=0,
914 srcV2=0, tgtV2=0, UseExisting=0):
915 for geom in [ solid, srcV1, tgtV1, srcV2, tgtV2 ]:
916 from salome.smesh.smeshBuilder import AssureGeomPublished
917 AssureGeomPublished( self.mesh, geom )
918 hyp = self.Hypothesis("ProjectionSource3D",
919 [solid,mesh,srcV1,tgtV1,srcV2,tgtV2],
921 # seems to be not really useful to reuse existing "SourceShape3D" hypothesis
922 #UseExisting=UseExisting, CompareMethod=self.CompareSourceShape3D)
923 hyp.SetSource3DShape( solid )
924 from salome.smesh.smeshBuilder import Mesh
925 if isinstance(mesh, Mesh):
926 mesh = mesh.GetMesh()
928 hyp.SetSourceMesh( mesh )
929 if srcV1 and srcV2 and tgtV1 and tgtV2:
930 hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
931 #elif srcV1 or srcV2 or tgtV1 or tgtV2:
934 pass # end of StdMeshersBuilder_Projection3D class
936 ## Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism"
937 # depending on geometry
939 # It is created by calling smeshBuilder.Mesh.Prism(geom=0)
941 # @ingroup l3_algos_3dextr
942 class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
944 ## name of the dynamic method in smeshBuilder.Mesh class
947 ## type of algorithm used with helper function in smeshBuilder.Mesh class
949 algoType = "Prism_3D"
950 ## doc string of the method
952 docHelper = "Creates prism 3D algorithm for volumes"
954 ## Private constructor.
955 # @param mesh parent mesh object algorithm is assigned to
956 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
957 # if it is @c 0 (default), the algorithm is assigned to the main shape
958 def __init__(self, mesh, geom=0):
959 Mesh_Algorithm.__init__(self)
964 from salome.geom import geomBuilder
965 nbSolids = len( geomBuilder.geom.SubShapeAll( shape, geomBuilder.geomBuilder.ShapeType["SOLID"] ))
966 nbShells = len( geomBuilder.geom.SubShapeAll( shape, geomBuilder.geomBuilder.ShapeType["SHELL"] ))
967 if nbSolids == 0 or nbSolids == nbShells:
968 self.Create(mesh, geom, "Prism_3D")
971 self.algoType = "RadialPrism_3D"
972 self.Create(mesh, geom, "RadialPrism_3D")
973 self.distribHyp = None #self.Hypothesis("LayerDistribution", UseExisting=0)
978 ## Return 3D hypothesis holding the 1D one
979 def Get3DHypothesis(self):
980 if self.algoType != "RadialPrism_3D":
981 print "Prism_3D algorith doesn't support any hyposesis"
983 return self.distribHyp
985 ## Private method creating a 1D hypothesis and storing it in the LayerDistribution
986 # hypothesis. Returns the created hypothesis
987 def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
988 if self.algoType != "RadialPrism_3D":
989 print "Prism_3D algorith doesn't support any hyposesis"
991 if not self.nbLayers is None:
992 self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
993 self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
994 study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
995 self.mesh.smeshpyD.SetCurrentStudy( None )
996 hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
997 self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
998 if not self.distribHyp:
999 self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0)
1000 self.distribHyp.SetLayerDistribution( hyp )
1003 ## Defines "NumberOfLayers" hypothesis, specifying the number of layers of
1004 # prisms to build between the inner and outer shells
1005 # @param n number of layers
1006 # @param UseExisting if ==true - searches for the existing hypothesis created with
1007 # the same parameters, else (default) - creates a new one
1008 def NumberOfLayers(self, n, UseExisting=0):
1009 if self.algoType != "RadialPrism_3D":
1010 print "Prism_3D algorith doesn't support any hyposesis"
1012 self.mesh.RemoveHypothesis( self.distribHyp, self.geom )
1013 from salome.smesh.smeshBuilder import IsEqual
1014 compFun = lambda hyp, args: IsEqual(hyp.GetNumberOfLayers(), args[0])
1015 self.nbLayers = self.Hypothesis("NumberOfLayers", [n], UseExisting=UseExisting,
1016 CompareMethod=compFun)
1017 self.nbLayers.SetNumberOfLayers( n )
1018 return self.nbLayers
1020 ## Defines "LocalLength" hypothesis, specifying the segment length
1021 # to build between the inner and the outer shells
1022 # @param l the length of segments
1023 # @param p the precision of rounding
1024 def LocalLength(self, l, p=1e-07):
1025 if self.algoType != "RadialPrism_3D":
1026 print "Prism_3D algorith doesn't support any hyposesis"
1028 hyp = self.OwnHypothesis("LocalLength", [l,p])
1033 ## Defines "NumberOfSegments" hypothesis, specifying the number of layers of
1034 # prisms to build between the inner and the outer shells.
1035 # @param n the number of layers
1036 # @param s the scale factor (optional)
1037 def NumberOfSegments(self, n, s=[]):
1038 if self.algoType != "RadialPrism_3D":
1039 print "Prism_3D algorith doesn't support any hyposesis"
1042 hyp = self.OwnHypothesis("NumberOfSegments", [n])
1044 hyp = self.OwnHypothesis("NumberOfSegments", [n,s])
1045 hyp.SetScaleFactor(s)
1046 hyp.SetNumberOfSegments(n)
1049 ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
1050 # to build between the inner and the outer shells with a length that changes
1051 # in arithmetic progression
1052 # @param start the length of the first segment
1053 # @param end the length of the last segment
1054 def Arithmetic1D(self, start, end ):
1055 if self.algoType != "RadialPrism_3D":
1056 print "Prism_3D algorith doesn't support any hyposesis"
1058 hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
1059 hyp.SetLength(start, 1)
1060 hyp.SetLength(end , 0)
1063 ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
1064 # to build between the inner and the outer shells with a length that changes
1065 # in Geometric progression
1066 # @param start the length of the first segment
1067 # @param ratio the common ratio of the geometric progression
1068 def GeometricProgression(self, start, ratio ):
1069 if self.algoType != "RadialPrism_3D":
1070 print "Prism_3D algorith doesn't support any hyposesis"
1072 hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
1073 hyp.SetStartLength( start )
1074 hyp.SetCommonRatio( ratio )
1077 ## Defines "StartEndLength" hypothesis, specifying distribution of segments
1078 # to build between the inner and the outer shells as geometric length increasing
1079 # @param start for the length of the first segment
1080 # @param end for the length of the last segment
1081 def StartEndLength(self, start, end):
1082 if self.algoType != "RadialPrism_3D":
1083 print "Prism_3D algorith doesn't support any hyposesis"
1085 hyp = self.OwnHypothesis("StartEndLength", [start, end])
1086 hyp.SetLength(start, 1)
1087 hyp.SetLength(end , 0)
1090 ## Defines "AutomaticLength" hypothesis, specifying the number of segments
1091 # to build between the inner and outer shells
1092 # @param fineness defines the quality of the mesh within the range [0-1]
1093 def AutomaticLength(self, fineness=0):
1094 if self.algoType != "RadialPrism_3D":
1095 print "Prism_3D algorith doesn't support any hyposesis"
1097 hyp = self.OwnHypothesis("AutomaticLength")
1098 hyp.SetFineness( fineness )
1101 pass # end of StdMeshersBuilder_Prism3D class
1103 ## Defines a Prism 3D algorithm
1105 # It is created by calling smeshBuilder.Mesh.Prism(geom=0)
1107 # @ingroup l3_algos_3dextr
1108 class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D):
1110 ## name of the dynamic method in smeshBuilder.Mesh class
1112 meshMethod = "Prism"
1113 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1115 algoType = "RadialPrism_3D"
1116 ## doc string of the method
1118 docHelper = "Creates Raial Prism 3D algorithm for volumes"
1120 ## Private constructor.
1121 # @param mesh parent mesh object algorithm is assigned to
1122 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1123 # if it is @c 0 (default), the algorithm is assigned to the main shape
1124 def __init__(self, mesh, geom=0):
1125 Mesh_Algorithm.__init__(self)
1130 self.Create(mesh, geom, "RadialPrism_3D")
1131 self.distribHyp = None
1132 self.nbLayers = None
1135 ## Base class for algorithms supporting radial distribution hypotheses
1137 class StdMeshersBuilder_RadialAlgorithm(Mesh_Algorithm):
1140 Mesh_Algorithm.__init__(self)
1142 self.distribHyp = None #self.Hypothesis("LayerDistribution2D", UseExisting=0)
1143 self.nbLayers = None
1146 ## Return 2D hypothesis holding the 1D one
1147 def Get2DHypothesis(self):
1148 if not self.distribHyp:
1149 self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0)
1150 return self.distribHyp
1152 ## Private method creating a 1D hypothesis and storing it in the LayerDistribution
1153 # hypothesis. Returns the created hypothesis
1154 def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
1156 self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
1157 if self.distribHyp is None:
1158 self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0)
1160 self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
1161 study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
1162 self.mesh.smeshpyD.SetCurrentStudy( None )
1163 hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
1164 self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
1165 self.distribHyp.SetLayerDistribution( hyp )
1168 ## Defines "NumberOfLayers" hypothesis, specifying the number of layers
1169 # @param n number of layers
1170 # @param UseExisting if ==true - searches for the existing hypothesis created with
1171 # the same parameters, else (default) - creates a new one
1172 def NumberOfLayers(self, n, UseExisting=0):
1174 self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
1175 from salome.smesh.smeshBuilder import IsEqual
1176 compFun = lambda hyp, args: IsEqual(hyp.GetNumberOfLayers(), args[0])
1177 self.nbLayers = self.Hypothesis("NumberOfLayers2D", [n], UseExisting=UseExisting,
1178 CompareMethod=compFun)
1179 self.nbLayers.SetNumberOfLayers( n )
1180 return self.nbLayers
1182 ## Defines "LocalLength" hypothesis, specifying the segment length
1183 # @param l the length of segments
1184 # @param p the precision of rounding
1185 def LocalLength(self, l, p=1e-07):
1186 hyp = self.OwnHypothesis("LocalLength", [l,p])
1191 ## Defines "NumberOfSegments" hypothesis, specifying the number of layers
1192 # @param n the number of layers
1193 # @param s the scale factor (optional)
1194 def NumberOfSegments(self, n, s=[]):
1196 hyp = self.OwnHypothesis("NumberOfSegments", [n])
1198 hyp = self.OwnHypothesis("NumberOfSegments", [n,s])
1199 hyp.SetDistrType( 1 )
1200 hyp.SetScaleFactor(s)
1201 hyp.SetNumberOfSegments(n)
1204 ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
1205 # with a length that changes in arithmetic progression
1206 # @param start the length of the first segment
1207 # @param end the length of the last segment
1208 def Arithmetic1D(self, start, end ):
1209 hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
1210 hyp.SetLength(start, 1)
1211 hyp.SetLength(end , 0)
1214 ## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
1215 # with a length that changes in Geometric progression
1216 # @param start the length of the first segment
1217 # @param ratio the common ratio of the geometric progression
1218 def GeometricProgression(self, start, ratio ):
1219 hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
1220 hyp.SetStartLength( start )
1221 hyp.SetCommonRatio( ratio )
1224 ## Defines "StartEndLength" hypothesis, specifying distribution of segments
1225 # as geometric length increasing
1226 # @param start for the length of the first segment
1227 # @param end for the length of the last segment
1228 def StartEndLength(self, start, end):
1229 hyp = self.OwnHypothesis("StartEndLength", [start, end])
1230 hyp.SetLength(start, 1)
1231 hyp.SetLength(end , 0)
1234 ## Defines "AutomaticLength" hypothesis, specifying the number of segments
1235 # @param fineness defines the quality of the mesh within the range [0-1]
1236 def AutomaticLength(self, fineness=0):
1237 hyp = self.OwnHypothesis("AutomaticLength")
1238 hyp.SetFineness( fineness )
1241 pass # end of StdMeshersBuilder_RadialQuadrangle1D2D class
1243 ## Defines a Radial Quadrangle 1D-2D algorithm
1245 # It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.RADIAL_QUAD,geom=0)
1247 # @ingroup l2_algos_radialq
1248 class StdMeshersBuilder_RadialQuadrangle1D2D(StdMeshersBuilder_RadialAlgorithm):
1250 ## name of the dynamic method in smeshBuilder.Mesh class
1252 meshMethod = "Quadrangle"
1253 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1255 algoType = RADIAL_QUAD
1256 ## doc string of the method
1258 docHelper = "Creates quadrangle 1D-2D algorithm for faces having a shape of disk or a disk segment"
1260 ## Private constructor.
1261 # @param mesh parent mesh object algorithm is assigned to
1262 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1263 # if it is @c 0 (default), the algorithm is assigned to the main shape
1264 def __init__(self, mesh, geom=0):
1265 StdMeshersBuilder_RadialAlgorithm.__init__(self)
1266 self.Create(mesh, geom, self.algoType)
1268 self.distribHyp = None #self.Hypothesis("LayerDistribution2D", UseExisting=0)
1269 self.nbLayers = None
1273 ## Defines a Quadrangle (Medial Axis Projection) 1D-2D algorithm
1275 # It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.QUAD_MA_PROJ,geom=0)
1277 # @ingroup l2_algos_quad_ma
1278 class StdMeshersBuilder_QuadMA_1D2D(StdMeshersBuilder_RadialAlgorithm):
1280 ## name of the dynamic method in smeshBuilder.Mesh class
1282 meshMethod = "Quadrangle"
1283 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1285 algoType = QUAD_MA_PROJ
1286 ## doc string of the method
1288 docHelper = "Creates quadrangle 1D-2D algorithm for faces"
1290 ## Private constructor.
1291 # @param mesh parent mesh object algorithm is assigned to
1292 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1293 # if it is @c 0 (default), the algorithm is assigned to the main shape
1294 def __init__(self, mesh, geom=0):
1295 StdMeshersBuilder_RadialAlgorithm.__init__(self)
1296 self.Create(mesh, geom, self.algoType)
1301 ## Defines a Polygon Per Face 2D algorithm
1303 # It is created by calling smeshBuilder.Mesh.Polygon(geom=0)
1305 # @ingroup l2_algos_quad_ma
1306 class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
1308 ## name of the dynamic method in smeshBuilder.Mesh class
1310 meshMethod = "Polygon"
1311 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1314 ## flag pointing whether this algorithm should be used by default in dynamic method
1315 # of smeshBuilder.Mesh class
1318 ## doc string of the method
1320 docHelper = "Creates polygon 2D algorithm for faces"
1322 ## Private constructor.
1323 # @param mesh parent mesh object algorithm is assigned to
1324 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1325 # if it is @c 0 (default), the algorithm is assigned to the main shape
1326 def __init__(self, mesh, geom=0):
1327 Mesh_Algorithm.__init__(self)
1328 self.Create(mesh, geom, self.algoType)
1333 ## Defines a Use Existing Elements 1D algorithm
1335 # It is created by calling smeshBuilder.Mesh.UseExisting1DElements(geom=0)
1337 # @ingroup l3_algos_basic
1338 class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
1340 ## name of the dynamic method in smeshBuilder.Mesh class
1342 meshMethod = "UseExisting1DElements"
1343 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1345 algoType = "Import_1D"
1346 ## flag pointing whether this algorithm should be used by default in dynamic method
1347 # of smeshBuilder.Mesh class
1350 ## doc string of the method
1352 docHelper = "Creates 1D algorithm for edges with reusing of existing mesh elements"
1354 ## Private constructor.
1355 # @param mesh parent mesh object algorithm is assigned to
1356 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1357 # if it is @c 0 (default), the algorithm is assigned to the main shape
1358 def __init__(self, mesh, geom=0):
1359 Mesh_Algorithm.__init__(self)
1360 self.Create(mesh, geom, self.algoType)
1363 ## Defines "Source edges" hypothesis, specifying groups of edges to import
1364 # @param groups list of groups of edges
1365 # @param toCopyMesh if True, the whole mesh \a groups belong to is imported
1366 # @param toCopyGroups if True, all groups of the mesh \a groups belong to are imported
1367 # @param UseExisting if ==true - searches for the existing hypothesis created with
1368 # the same parameters, else (default) - creates a new one
1369 def SourceEdges(self, groups, toCopyMesh=False, toCopyGroups=False, UseExisting=False):
1370 for group in groups:
1371 from salome.smesh.smeshBuilder import AssureGeomPublished
1372 AssureGeomPublished( self.mesh, group )
1373 compFun = lambda hyp, args: ( hyp.GetSourceEdges() == args[0] and \
1374 hyp.GetCopySourceMesh() == args[1], args[2] )
1375 hyp = self.Hypothesis("ImportSource1D", [groups, toCopyMesh, toCopyGroups],
1376 UseExisting=UseExisting, CompareMethod=compFun)
1377 hyp.SetSourceEdges(groups)
1378 hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups)
1381 pass # end of StdMeshersBuilder_UseExistingElements_1D class
1383 ## Defines a Use Existing Elements 1D-2D algorithm
1385 # It is created by calling smeshBuilder.Mesh.UseExisting2DElements(geom=0)
1387 # @ingroup l3_algos_basic
1388 class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
1390 ## name of the dynamic method in smeshBuilder.Mesh class
1392 meshMethod = "UseExisting2DElements"
1393 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1395 algoType = "Import_1D2D"
1396 ## flag pointing whether this algorithm should be used by default in dynamic method
1397 # of smeshBuilder.Mesh class
1400 ## doc string of the method
1402 docHelper = "Creates 1D-2D algorithm for faces with reusing of existing mesh elements"
1404 ## Private constructor.
1405 # @param mesh parent mesh object algorithm is assigned to
1406 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1407 # if it is @c 0 (default), the algorithm is assigned to the main shape
1408 def __init__(self, mesh, geom=0):
1409 Mesh_Algorithm.__init__(self)
1410 self.Create(mesh, geom, self.algoType)
1413 ## Defines "Source faces" hypothesis, specifying groups of faces to import
1414 # @param groups list of groups of faces
1415 # @param toCopyMesh if True, the whole mesh \a groups belong to is imported
1416 # @param toCopyGroups if True, all groups of the mesh \a groups belong to are imported
1417 # @param UseExisting if ==true - searches for the existing hypothesis created with
1418 # the same parameters, else (default) - creates a new one
1419 def SourceFaces(self, groups, toCopyMesh=False, toCopyGroups=False, UseExisting=False):
1421 compFun = lambda hyp, args: ( hyp.GetSourceFaces() == args[0] and \
1422 hyp.GetCopySourceMesh() == args[1], args[2] )
1423 hyp = self.Hypothesis("ImportSource2D", [groups, toCopyMesh, toCopyGroups],
1424 UseExisting=UseExisting, CompareMethod=compFun, toAdd=False)
1425 if groups and isinstance( groups, SMESH._objref_SMESH_GroupBase ):
1427 hyp.SetSourceFaces(groups)
1428 hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups)
1429 self.mesh.AddHypothesis(hyp, self.geom)
1432 pass # end of StdMeshersBuilder_UseExistingElements_1D2D class
1434 ## Defines a Body Fitting 3D algorithm
1436 # It is created by calling smeshBuilder.Mesh.BodyFitted(geom=0)
1438 # @ingroup l3_algos_basic
1439 class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
1441 ## name of the dynamic method in smeshBuilder.Mesh class
1443 meshMethod = "BodyFitted"
1444 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1446 algoType = "Cartesian_3D"
1447 ## flag pointing whether this algorithm should be used by default in dynamic method
1448 # of smeshBuilder.Mesh class
1451 ## doc string of the method
1453 docHelper = "Creates Body Fitting 3D algorithm for volumes"
1455 ## Private constructor.
1456 # @param mesh parent mesh object algorithm is assigned to
1457 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1458 # if it is @c 0 (default), the algorithm is assigned to the main shape
1459 def __init__(self, mesh, geom=0):
1460 self.Create(mesh, geom, self.algoType)
1464 ## Defines "Body Fitting parameters" hypothesis
1465 # @param xGridDef is definition of the grid along the X asix.
1466 # It can be in either of two following forms:
1467 # - Explicit coordinates of nodes, e.g. [-1.5, 0.0, 3.1] or range( -100,200,10)
1468 # - Functions f(t) defining grid spacing at each point on grid axis. If there are
1469 # several functions, they must be accompanied by relative coordinates of
1470 # points dividing the whole shape into ranges where the functions apply; points
1471 # coodrinates should vary within (0.0, 1.0) range. Parameter \a t of the spacing
1472 # function f(t) varies from 0.0 to 1.0 witin a shape range.
1474 # - "10.5" - defines a grid with a constant spacing
1475 # - [["1", "1+10*t", "11"] [0.1, 0.6]] - defines different spacing in 3 ranges.
1476 # @param yGridDef defines the grid along the Y asix the same way as \a xGridDef does.
1477 # @param zGridDef defines the grid along the Z asix the same way as \a xGridDef does.
1478 # @param sizeThreshold (> 1.0) defines a minimal size of a polyhedron so that
1479 # a polyhedron of size less than hexSize/sizeThreshold is not created.
1480 # @param implEdges enables implementation of geometrical edges into the mesh.
1481 def SetGrid(self, xGridDef, yGridDef, zGridDef, sizeThreshold=4.0, implEdges=False):
1483 compFun = lambda hyp, args: False
1484 self.hyp = self.Hypothesis("CartesianParameters3D",
1485 [xGridDef, yGridDef, zGridDef, sizeThreshold],
1486 UseExisting=False, CompareMethod=compFun)
1487 if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
1488 self.mesh.AddHypothesis( self.hyp, self.geom )
1490 for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef] ):
1491 if not gridDef: raise ValueError, "Empty grid definition"
1492 if isinstance( gridDef, str ):
1493 self.hyp.SetGridSpacing( [gridDef], [], axis )
1494 elif isinstance( gridDef[0], str ):
1495 self.hyp.SetGridSpacing( gridDef, [], axis )
1496 elif isinstance( gridDef[0], int ) or \
1497 isinstance( gridDef[0], float ):
1498 self.hyp.SetGrid(gridDef, axis )
1500 self.hyp.SetGridSpacing( gridDef[0], gridDef[1], axis )
1501 self.hyp.SetSizeThreshold( sizeThreshold )
1502 self.hyp.SetToAddEdges( implEdges )
1505 ## Defines custom directions of axes of the grid
1506 # @param xAxis either SMESH.DirStruct or a vector, or 3 vector components
1507 # @param yAxis either SMESH.DirStruct or a vector, or 3 vector components
1508 # @param zAxis either SMESH.DirStruct or a vector, or 3 vector components
1509 def SetAxesDirs( self, xAxis, yAxis, zAxis ):
1511 if hasattr( xAxis, "__getitem__" ):
1512 xAxis = self.mesh.smeshpyD.MakeDirStruct( xAxis[0],xAxis[1],xAxis[2] )
1513 elif isinstance( xAxis, GEOM._objref_GEOM_Object ):
1514 xAxis = self.mesh.smeshpyD.GetDirStruct( xAxis )
1515 if hasattr( yAxis, "__getitem__" ):
1516 yAxis = self.mesh.smeshpyD.MakeDirStruct( yAxis[0],yAxis[1],yAxis[2] )
1517 elif isinstance( yAxis, GEOM._objref_GEOM_Object ):
1518 yAxis = self.mesh.smeshpyD.GetDirStruct( yAxis )
1519 if hasattr( zAxis, "__getitem__" ):
1520 zAxis = self.mesh.smeshpyD.MakeDirStruct( zAxis[0],zAxis[1],zAxis[2] )
1521 elif isinstance( zAxis, GEOM._objref_GEOM_Object ):
1522 zAxis = self.mesh.smeshpyD.GetDirStruct( zAxis )
1524 self.hyp = self.Hypothesis("CartesianParameters3D")
1525 if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
1526 self.mesh.AddHypothesis( self.hyp, self.geom )
1527 self.hyp.SetAxesDirs( xAxis, yAxis, zAxis )
1530 ## Automatically defines directions of axes of the grid at which
1531 # a number of generated hexahedra is maximal
1532 # @param isOrthogonal defines whether the axes mush be orthogonal
1533 def SetOptimalAxesDirs(self, isOrthogonal=True):
1535 self.hyp = self.Hypothesis("CartesianParameters3D")
1536 if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
1537 self.mesh.AddHypothesis( self.hyp, self.geom )
1538 x,y,z = self.hyp.ComputeOptimalAxesDirs( self.geom, isOrthogonal )
1539 self.hyp.SetAxesDirs( x,y,z )
1542 ## Sets/unsets a fixed point. The algorithm makes a plane of the grid pass
1543 # through the fixed point in each direction at which the grid is defined
1545 # @param p coordinates of the fixed point. Either SMESH.PointStruct or
1546 # a vertex or 3 components of coordinates.
1547 # @param toUnset defines whether the fixed point is defined or removed.
1548 def SetFixedPoint( self, p, toUnset=False ):
1551 if not self.hyp: return
1552 p = SMESH.PointStruct(0,0,0)
1553 elif hasattr( p, "__getitem__" ):
1554 p = SMESH.PointStruct( p[0],p[1],p[2] )
1555 elif isinstance( p, GEOM._objref_GEOM_Object ):
1556 p = self.mesh.smeshpyD.GetPointStruct( p )
1558 self.hyp = self.Hypothesis("CartesianParameters3D")
1559 if not self.mesh.IsUsedHypothesis( self.hyp, self.geom ):
1560 self.mesh.AddHypothesis( self.hyp, self.geom )
1561 self.hyp.SetFixedPoint( p, toUnset )
1565 pass # end of StdMeshersBuilder_Cartesian_3D class
1567 ## Defines a stub 1D algorithm, which enables "manual" creation of nodes and
1568 # segments usable by 2D algoritms
1570 # It is created by calling smeshBuilder.Mesh.UseExistingSegments(geom=0)
1572 # @ingroup l3_algos_basic
1573 class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
1575 ## name of the dynamic method in smeshBuilder.Mesh class
1577 meshMethod = "UseExistingSegments"
1578 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1580 algoType = "UseExisting_1D"
1581 ## doc string of the method
1583 docHelper = "Creates 1D algorithm allowing batch meshing of edges"
1585 ## Private constructor.
1586 # @param mesh parent mesh object algorithm is assigned to
1587 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1588 # if it is @c 0 (default), the algorithm is assigned to the main shape
1589 def __init__(self, mesh, geom=0):
1590 self.Create(mesh, geom, self.algoType)
1593 pass # end of StdMeshersBuilder_UseExisting_1D class
1595 ## Defines a stub 2D algorithm, which enables "manual" creation of nodes and
1596 # faces usable by 3D algoritms
1598 # It is created by calling smeshBuilder.Mesh.UseExistingFaces(geom=0)
1600 # @ingroup l3_algos_basic
1601 class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm):
1603 ## name of the dynamic method in smeshBuilder.Mesh class
1605 meshMethod = "UseExistingFaces"
1606 ## type of algorithm used with helper function in smeshBuilder.Mesh class
1608 algoType = "UseExisting_2D"
1609 ## doc string of the method
1611 docHelper = "Creates 2D algorithm allowing batch meshing of faces"
1613 ## Private constructor.
1614 # @param mesh parent mesh object algorithm is assigned to
1615 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
1616 # if it is @c 0 (default), the algorithm is assigned to the main shape
1617 def __init__(self, mesh, geom=0):
1618 self.Create(mesh, geom, self.algoType)
1621 pass # end of StdMeshersBuilder_UseExisting_2D class