|
Functions | |
| def | smeshDC::smeshDC.Mesh |
| Creates an empty Mesh. | |
| def | smeshDC::Mesh.__init__ |
| Constructor. | |
| def | smeshDC::Mesh.SetMesh |
| Initializes the Mesh object from an instance of SMESH_Mesh interface. | |
| def | smeshDC::Mesh.GetMesh |
| Returns the mesh, that is an instance of SMESH_Mesh interface. | |
| def | smeshDC::Mesh.GetName |
| Gets the name of the mesh. | |
| def | smeshDC::Mesh.SetName |
| Sets a name to the mesh. | |
| def | smeshDC::Mesh.GetShape |
| Returns the shape associated to the mesh. | |
| def | smeshDC::Mesh.SetShape |
| Associates the given shape to the mesh (entails the recreation of the mesh) | |
| def | smeshDC::Mesh.IsReadyToCompute |
| Returns true if the hypotheses are defined well. | |
| def | smeshDC::Mesh.GetAlgoState |
| Returns errors of hypotheses definition. | |
| def | smeshDC::Mesh.GetGeometryByMeshElement |
| Returns a geometrical object on which the given element was built. | |
| def | smeshDC::Mesh.Compute |
| Computes the mesh and returns the status of the computation. | |
| def | smeshDC::Mesh.GetMeshOrder |
| Return submesh objects list in meshing order. | |
| def | smeshDC::Mesh.SetMeshOrder |
| Return submesh objects list in meshing order. | |
| def | smeshDC::Mesh.Clear |
| Removes all nodes and elements. | |
| def | smeshDC::Mesh.ClearSubMesh |
| Removes all nodes and elements of indicated shape. | |
| def smeshDC.Mesh.__init__ | ( | self, | |
| smeshpyD, | |||
| geompyD, | |||
obj = 0, |
|||
name = 0 |
|||
| ) | [inherited] |
Constructor.
Creates a mesh on the shape obj (or an empty mesh if obj is equal to 0) and sets the GUI name of this mesh to name.
| smeshpyD | an instance of smeshDC class |
| geompyD | an instance of geompyDC class |
| obj | Shape to be meshed or SMESH_Mesh object |
| name | Study name of the mesh |
Definition at line 1108 of file smeshDC.py.
01109 : 01110 self.smeshpyD=smeshpyD 01111 self.geompyD=geompyD 01112 if obj is None: 01113 obj = 0 01114 if obj != 0: 01115 if isinstance(obj, geompyDC.GEOM._objref_GEOM_Object): 01116 self.geom = obj 01117 # publish geom of mesh (issue 0021122) 01118 if not self.geom.GetStudyEntry(): 01119 studyID = smeshpyD.GetCurrentStudy()._get_StudyId() 01120 if studyID != geompyD.myStudyId: 01121 geompyD.init_geom( smeshpyD.GetCurrentStudy()) 01122 pass 01123 geo_name = "%s_%s"%(self.geom.GetShapeType(), id(self.geom)%100) 01124 geompyD.addToStudy( self.geom, geo_name ) 01125 self.mesh = self.smeshpyD.CreateMesh(self.geom) 01126 01127 elif isinstance(obj, SMESH._objref_SMESH_Mesh): 01128 self.SetMesh(obj) 01129 else: 01130 self.mesh = self.smeshpyD.CreateEmptyMesh() 01131 if name != 0: 01132 self.smeshpyD.SetName(self.mesh, name) 01133 elif obj != 0: 01134 self.smeshpyD.SetName(self.mesh, GetName(obj)) 01135 01136 if not self.geom: 01137 self.geom = self.mesh.GetShapeToMesh() 01138 01139 self.editor = self.mesh.GetMeshEditor()
| def smeshDC.Mesh.Clear | ( | self | ) | [inherited] |
Removes all nodes and elements.
Definition at line 1558 of file smeshDC.py.
| def smeshDC.Mesh.ClearSubMesh | ( | self, | |
| geomId | |||
| ) | [inherited] |
Removes all nodes and elements of indicated shape.
Definition at line 1568 of file smeshDC.py.
| def smeshDC.Mesh.Compute | ( | self, | |
geom = 0, |
|||
discardModifs = False |
|||
| ) | [inherited] |
Computes the mesh and returns the status of the computation.
| geom | geomtrical shape on which mesh data should be computed |
| discardModifs | if True and the mesh has been edited since a last total re-compute and that may prevent successful partial re-compute, then the mesh is cleaned before Compute() |
Definition at line 1423 of file smeshDC.py.
01424 : 01425 if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object): 01426 if self.geom == 0: 01427 geom = self.mesh.GetShapeToMesh() 01428 else: 01429 geom = self.geom 01430 ok = False 01431 try: 01432 if discardModifs and self.mesh.HasModificationsToDiscard(): # issue 0020693 01433 self.mesh.Clear() 01434 ok = self.smeshpyD.Compute(self.mesh, geom) 01435 except SALOME.SALOME_Exception, ex: 01436 print "Mesh computation failed, exception caught:" 01437 print " ", ex.details.text 01438 except: 01439 import traceback 01440 print "Mesh computation failed, exception caught:" 01441 traceback.print_exc() 01442 if True:#not ok: 01443 allReasons = "" 01444 01445 # Treat compute errors 01446 computeErrors = self.smeshpyD.GetComputeErrors( self.mesh, geom ) 01447 for err in computeErrors: 01448 shapeText = "" 01449 if self.mesh.HasShapeToMesh(): 01450 try: 01451 mainIOR = salome.orb.object_to_string(geom) 01452 for sname in salome.myStudyManager.GetOpenStudies(): 01453 s = salome.myStudyManager.GetStudyByName(sname) 01454 if not s: continue 01455 mainSO = s.FindObjectIOR(mainIOR) 01456 if not mainSO: continue 01457 if err.subShapeID == 1: 01458 shapeText = ' on "%s"' % mainSO.GetName() 01459 subIt = s.NewChildIterator(mainSO) 01460 while subIt.More(): 01461 subSO = subIt.Value() 01462 subIt.Next() 01463 obj = subSO.GetObject() 01464 if not obj: continue 01465 go = obj._narrow( geompyDC.GEOM._objref_GEOM_Object ) 01466 if not go: continue 01467 ids = go.GetSubShapeIndices() 01468 if len(ids) == 1 and ids[0] == err.subShapeID: 01469 shapeText = ' on "%s"' % subSO.GetName() 01470 break 01471 if not shapeText: 01472 shape = self.geompyD.GetSubShape( geom, [err.subShapeID]) 01473 if shape: 01474 shapeText = " on %s #%s" % (shape.GetShapeType(), err.subShapeID) 01475 else: 01476 shapeText = " on subshape #%s" % (err.subShapeID) 01477 except: 01478 shapeText = " on subshape #%s" % (err.subShapeID) 01479 errText = "" 01480 stdErrors = ["OK", #COMPERR_OK 01481 "Invalid input mesh", #COMPERR_BAD_INPUT_MESH 01482 "std::exception", #COMPERR_STD_EXCEPTION 01483 "OCC exception", #COMPERR_OCC_EXCEPTION 01484 "SALOME exception", #COMPERR_SLM_EXCEPTION 01485 "Unknown exception", #COMPERR_EXCEPTION 01486 "Memory allocation problem", #COMPERR_MEMORY_PB 01487 "Algorithm failed", #COMPERR_ALGO_FAILED 01488 "Unexpected geometry"]#COMPERR_BAD_SHAPE 01489 if err.code > 0: 01490 if err.code < len(stdErrors): errText = stdErrors[err.code] 01491 else: 01492 errText = "code %s" % -err.code 01493 if errText: errText += ". " 01494 errText += err.comment 01495 if allReasons != "":allReasons += "\n" 01496 allReasons += '"%s" failed%s. Error: %s' %(err.algoName, shapeText, errText) 01497 pass 01498 01499 # Treat hyp errors 01500 errors = self.smeshpyD.GetAlgoState( self.mesh, geom ) 01501 for err in errors: 01502 if err.isGlobalAlgo: 01503 glob = "global" 01504 else: 01505 glob = "local" 01506 pass 01507 dim = err.algoDim 01508 name = err.algoName 01509 if len(name) == 0: 01510 reason = '%s %sD algorithm is missing' % (glob, dim) 01511 elif err.state == HYP_MISSING: 01512 reason = ('%s %sD algorithm "%s" misses %sD hypothesis' 01513 % (glob, dim, name, dim)) 01514 elif err.state == HYP_NOTCONFORM: 01515 reason = 'Global "Not Conform mesh allowed" hypothesis is missing' 01516 elif err.state == HYP_BAD_PARAMETER: 01517 reason = ('Hypothesis of %s %sD algorithm "%s" has a bad parameter value' 01518 % ( glob, dim, name )) 01519 elif err.state == HYP_BAD_GEOMETRY: 01520 reason = ('%s %sD algorithm "%s" is assigned to mismatching' 01521 'geometry' % ( glob, dim, name )) 01522 else: 01523 reason = "For unknown reason."+\ 01524 " Revise Mesh.Compute() implementation in smeshDC.py!" 01525 pass 01526 if allReasons != "":allReasons += "\n" 01527 allReasons += reason 01528 pass 01529 if allReasons != "": 01530 print '"' + GetName(self.mesh) + '"',"has not been computed:" 01531 print allReasons 01532 ok = False 01533 elif not ok: 01534 print '"' + GetName(self.mesh) + '"',"has not been computed." 01535 pass 01536 pass 01537 if salome.sg.hasDesktop(): 01538 smeshgui = salome.ImportComponentGUI("SMESH") 01539 smeshgui.Init(self.mesh.GetStudyId()) 01540 smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) ) 01541 salome.sg.updateObjBrowser(1) 01542 pass 01543 return ok
| def smeshDC.Mesh.GetAlgoState | ( | self, | |
| theSubObject | |||
| ) | [inherited] |
Returns errors of hypotheses definition.
The list of errors is empty if everything is OK.
| theSubObject | a subshape of a mesh shape |
Definition at line 1201 of file smeshDC.py.
| def smeshDC.Mesh.GetGeometryByMeshElement | ( | self, | |
| theElementID, | |||
| theGeomName | |||
| ) | [inherited] |
Returns a geometrical object on which the given element was built.
The returned geometrical object, if not nil, is either found in the study or published by this method with the given name
| theElementID | the id of the mesh element |
| theGeomName | the user-defined name of the geometrical object |
Definition at line 1211 of file smeshDC.py.
| def smeshDC.Mesh.GetMesh | ( | self | ) | [inherited] |
Returns the mesh, that is an instance of SMESH_Mesh interface.
Definition at line 1150 of file smeshDC.py.
| def smeshDC.Mesh.GetMeshOrder | ( | self | ) | [inherited] |
Return submesh objects list in meshing order.
Definition at line 1547 of file smeshDC.py.
| def smeshDC.Mesh.GetName | ( | self | ) | [inherited] |
Gets the name of the mesh.
Definition at line 1156 of file smeshDC.py.
| def smeshDC.Mesh.GetShape | ( | self | ) | [inherited] |
Returns the shape associated to the mesh.
Definition at line 1180 of file smeshDC.py.
| def smeshDC.Mesh.IsReadyToCompute | ( | self, | |
| theSubObject | |||
| ) | [inherited] |
Returns true if the hypotheses are defined well.
| theSubObject | a subshape of a mesh shape |
Definition at line 1193 of file smeshDC.py.
| def smeshDC.smeshDC.Mesh | ( | self, | |
obj = 0, |
|||
name = 0 |
|||
| ) | [inherited] |
Creates an empty Mesh.
This mesh can have an underlying geometry.
| obj | the Geometrical object on which the mesh is built. If not defined, the mesh will have no underlying geometry. |
| name | the name for the new mesh. |
Definition at line 534 of file smeshDC.py.
| def smeshDC.Mesh.SetMesh | ( | self, | |
| theMesh | |||
| ) | [inherited] |
Initializes the Mesh object from an instance of SMESH_Mesh interface.
| theMesh | a SMESH_Mesh object |
Definition at line 1143 of file smeshDC.py.
| def smeshDC.Mesh.SetMeshOrder | ( | self, | |
| submeshes | |||
| ) | [inherited] |
Return submesh objects list in meshing order.
Definition at line 1553 of file smeshDC.py.
| def smeshDC.Mesh.SetName | ( | self, | |
| name | |||
| ) | [inherited] |
Sets a name to the mesh.
| name | a new name of the mesh |
Definition at line 1163 of file smeshDC.py.
| def smeshDC.Mesh.SetShape | ( | self, | |
| geom | |||
| ) | [inherited] |
Associates the given shape to the mesh (entails the recreation of the mesh)
| geom | the shape to be meshed (GEOM_Object) |
Definition at line 1186 of file smeshDC.py.