Back to index

salome-smesh  6.5.0
Functions | Variables
Auxiliary methods and structures

Functions

def smeshDC.DegreesToRadians
 Converts an angle from degrees to radians.
def smeshDC.ParseParameters
 Return list of variable values from salome notebook.
def smeshDC.ParseAngles
def smeshDC.__initPointStruct
def smeshDC.__initAxisStruct
def smeshDC.IsEqual
def smeshDC.GetName
 Gets object name.
def smeshDC.TreatHypoStatus
 Prints error message if a hypothesis was not assigned.
def smeshDC.AssureGeomPublished
 Private method.
def smeshDC.FirstVertexOnCurve
 Return the first vertex of a geomertical edge by ignoring orienation.
def smeshDC.smeshDC.init_smesh
 Sets the current study and Geometry component.
def smeshDC.smeshDC.GetPointStruct
 Gets PointStruct from vertex.
def smeshDC.smeshDC.GetDirStruct
 Gets DirStruct from vector.
def smeshDC.smeshDC.MakeDirStruct
 Makes DirStruct from a triplet.
def smeshDC.smeshDC.GetAxisStruct
 Get AxisStruct from object.
def smeshDC.smeshDC.SetName
 Sets the given name to the object.
def smeshDC.smeshDC.SetEmbeddedMode
 Sets the current mode.
def smeshDC.smeshDC.IsEmbeddedMode
 Gets the current mode.
def smeshDC.smeshDC.SetCurrentStudy
 Sets the current study.
def smeshDC.smeshDC.GetCurrentStudy
 Gets the current study.
def smeshDC.smeshDC.GetSubShapesId
 From SMESH_Gen interface.
def smeshDC.smeshDC.SetBoundaryBoxSegmentation
 Sets number of segments per diagonal of boundary box of geometry by which default segment length of appropriate 1D hypotheses is defined.
def smeshDC.Mesh.MeshDimension
 Returns the mesh dimension depending on the dimension of the underlying shape.
def smeshDC.Mesh.GetLog
 Returns the log of nodes and elements added or removed since the previous clear of the log.
def smeshDC.Mesh.ClearLog
 Clears the log of nodes and elements added or removed since the previous clear.
def smeshDC.Mesh.SetAutoColor
 Toggles auto color mode on the object.
def smeshDC.Mesh.GetAutoColor
 Gets flag of object auto color mode.
def smeshDC.Mesh.GetId
 Gets the internal ID.
def smeshDC.Mesh.GetStudyId
 Get the study Id.
def smeshDC.Mesh.HasDuplicatedGroupNamesMED
 Checks the group names for duplications.
def smeshDC.Mesh.GetIDSource
 Wrap a list of IDs of elements or nodes into SMESH_IDSource which can be passed as argument to accepting mesh, group or sub-mesh.
def smeshDC.Mesh.GetMEDMesh
 Gets MED Mesh.
def smeshDC.Mesh.SplitQuadsNearTriangularFacets
 Splits quadrangle faces near triangular facets of volumes.
def smeshDC.Mesh.SplitHexaToTetras
 Splits hexahedrons into tetrahedrons.
def smeshDC.Mesh.SplitHexaToPrisms
 Split hexahedrons into prisms.
def smeshDC.Mesh.GetLastCreatedNodes
 If during the last operation of MeshEditor some nodes were created, this method returns the list of their IDs,
if new nodes were not created - returns empty list.
def smeshDC.Mesh.GetLastCreatedElems
 If during the last operation of MeshEditor some elements were created this method returns the list of their IDs,
if new elements were not created - returns empty list.

Variables

 smeshDC.POINT = SMESH_MeshEditor.POINT
 smeshDC.AXIS = SMESH_MeshEditor.AXIS
 smeshDC.PLANE = SMESH_MeshEditor.PLANE
 smeshDC.LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH
 smeshDC.CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH
int smeshDC.PrecisionConfusion = 1
 smeshDC.notebook = salome_notebook.notebook
string smeshDC.var_separator = ":"
string smeshDC.NO_NAME = "NoName"

Function Documentation

def smeshDC.__initAxisStruct (   ax,
  args 
) [private]

Definition at line 170 of file smeshDC.py.

00170 
00171 def __initAxisStruct(ax,*args):
00172     ax.x, ax.y, ax.z, ax.vx, ax.vy, ax.vz, ax.parameters,hasVars = ParseParameters(*args)
00173     pass
00174 SMESH.AxisStruct.__init__ = __initAxisStruct
00175 

Here is the call graph for this function:

def smeshDC.__initPointStruct (   point,
  args 
) [private]

Definition at line 163 of file smeshDC.py.

00163 
00164 def __initPointStruct(point,*args):
00165     point.x, point.y, point.z, point.parameters,hasVars = ParseParameters(*args)
00166     pass
00167 SMESH.PointStruct.__init__ = __initPointStruct
00168 
00169 # Substitute AxisStruct.__init__() to create SMESH.AxisStruct using notebook variables.
# Parameters are stored in AxisStruct.parameters attribute

Here is the call graph for this function:

def smeshDC.AssureGeomPublished (   mesh,
  geom,
  name = '' 
)

Private method.

Add geom (sub-shape of the main shape) into the study if not yet there

Definition at line 256 of file smeshDC.py.

00256 
00257 def AssureGeomPublished(mesh, geom, name=''):
00258     if not isinstance( geom, geompyDC.GEOM._objref_GEOM_Object ):
00259         return
00260     if not geom.IsSame( mesh.geom ) and \
00261            not geom.GetStudyEntry() and \
00262            mesh.smeshpyD.GetCurrentStudy():
00263         ## set the study
00264         studyID = mesh.smeshpyD.GetCurrentStudy()._get_StudyId()
00265         if studyID != mesh.geompyD.myStudyId:
00266             mesh.geompyD.init_geom( mesh.smeshpyD.GetCurrentStudy())
00267         ## get a name
00268         if not name and geom.GetShapeType() != geompyDC.GEOM.COMPOUND:
00269             # for all groups SubShapeName() returns "Compound_-1"
00270             name = mesh.geompyD.SubShapeName(geom, mesh.geom)
00271         if not name:
00272             name = "%s_%s"%(geom.GetShapeType(), id(geom)%10000)
00273         ## publish
00274         mesh.geompyD.addToStudyInFather( mesh.geom, geom, name )
00275     return

Here is the caller graph for this function:

def smeshDC.Mesh.ClearLog (   self)

Clears the log of nodes and elements added or removed since the previous clear.

Must be used immediately after GetLog if clearAfterGet is false.

Definition at line 1742 of file smeshDC.py.

01742 
01743     def ClearLog(self):
01744         self.mesh.ClearLog()

def smeshDC.DegreesToRadians (   AngleInDegrees)

Converts an angle from degrees to radians.

Definition at line 117 of file smeshDC.py.

00117 
00118 def DegreesToRadians(AngleInDegrees):
00119     from math import pi
00120     return AngleInDegrees * pi / 180.0

Return the first vertex of a geomertical edge by ignoring orienation.

Definition at line 277 of file smeshDC.py.

00277 
00278 def FirstVertexOnCurve(edge):
00279     from geompy import SubShapeAll, ShapeType, KindOfShape, PointCoordinates
00280     vv = SubShapeAll( edge, ShapeType["VERTEX"])
00281     if not vv:
00282         raise TypeError, "Given object has no vertices"
00283     if len( vv ) == 1: return vv[0]
00284     info = KindOfShape(edge)
00285     xyz = info[1:4] # coords of the first vertex
00286     xyz1  = PointCoordinates( vv[0] )
00287     xyz2  = PointCoordinates( vv[1] )
00288     dist1, dist2 = 0,0
00289     for i in range(3):
00290         dist1 += abs( xyz[i] - xyz1[i] )
00291         dist2 += abs( xyz[i] - xyz2[i] )
00292     if dist1 < dist2:
00293         return vv[0]
00294     else:
00295         return vv[1]
00296 
# end of l1_auxiliary

Here is the caller graph for this function:

def smeshDC.Mesh.GetAutoColor (   self)

Gets flag of object auto color mode.

Returns:
True or False

Definition at line 1754 of file smeshDC.py.

01754 
01755     def GetAutoColor(self):
01756         return self.mesh.GetAutoColor()

def smeshDC.smeshDC.GetAxisStruct (   self,
  theObj 
)

Get AxisStruct from object.

Parameters:
theObja GEOM object (line or plane)
Returns:
SMESH.AxisStruct

Definition at line 388 of file smeshDC.py.

00388 
00389     def GetAxisStruct(self,theObj):
00390         edges = self.geompyD.SubShapeAll( theObj, geompyDC.ShapeType["EDGE"] )
00391         if len(edges) > 1:
00392             vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geompyDC.ShapeType["VERTEX"] )
00393             vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geompyDC.ShapeType["VERTEX"] )
00394             vertex1 = self.geompyD.PointCoordinates(vertex1)
00395             vertex2 = self.geompyD.PointCoordinates(vertex2)
00396             vertex3 = self.geompyD.PointCoordinates(vertex3)
00397             vertex4 = self.geompyD.PointCoordinates(vertex4)
00398             v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]]
00399             v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]]
00400             normal = [ v1[1]*v2[2]-v2[1]*v1[2], v1[2]*v2[0]-v2[2]*v1[0], v1[0]*v2[1]-v2[0]*v1[1] ]
00401             axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2])
00402             return axis
00403         elif len(edges) == 1:
00404             vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geompyDC.ShapeType["VERTEX"] )
00405             p1 = self.geompyD.PointCoordinates( vertex1 )
00406             p2 = self.geompyD.PointCoordinates( vertex2 )
00407             axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
00408             return axis
00409         return None

Gets the current study.

Definition at line 456 of file smeshDC.py.

00456 
00457     def GetCurrentStudy(self):
00458         #return self.GetCurrentStudy()
00459         return SMESH._objref_SMESH_Gen.GetCurrentStudy(self)

def smeshDC.smeshDC.GetDirStruct (   self,
  theVector 
)

Gets DirStruct from vector.

Parameters:
theVectora GEOM object(vector)
Returns:
SMESH.DirStruct

Definition at line 365 of file smeshDC.py.

00365 
00366     def GetDirStruct(self,theVector):
00367         vertices = self.geompyD.SubShapeAll( theVector, geompyDC.ShapeType["VERTEX"] )
00368         if(len(vertices) != 2):
00369             print "Error: vector object is incorrect."
00370             return None
00371         p1 = self.geompyD.PointCoordinates(vertices[0])
00372         p2 = self.geompyD.PointCoordinates(vertices[1])
00373         pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
00374         dirst = DirStruct(pnt)
00375         return dirst

Here is the call graph for this function:

def smeshDC.Mesh.GetId (   self)

Gets the internal ID.

Returns:
integer value, which is the internal Id of the mesh

Definition at line 1760 of file smeshDC.py.

01760 
01761     def GetId(self):
01762         return self.mesh.GetId()

def smeshDC.Mesh.GetIDSource (   self,
  ids,
  elemType 
)

Wrap a list of IDs of elements or nodes into SMESH_IDSource which can be passed as argument to accepting mesh, group or sub-mesh.

Returns:
an instance of SMESH_IDSource

Definition at line 1786 of file smeshDC.py.

01786 
01787     def GetIDSource(self, ids, elemType):
01788         return self.GetMeshEditor().MakeIDSource(ids, elemType)

Here is the call graph for this function:

Here is the caller graph for this function:

If during the last operation of MeshEditor some elements were created this method returns the list of their IDs,
if new elements were not created - returns empty list.

Returns:
the list of integer values (can be empty)

Definition at line 3781 of file smeshDC.py.

03781 
03782     def GetLastCreatedElems(self):
03783         return self.editor.GetLastCreatedElems()
03784 
     ## Creates a hole in a mesh by doubling the nodes of some particular elements

If during the last operation of MeshEditor some nodes were created, this method returns the list of their IDs,
if new nodes were not created - returns empty list.

Returns:
the list of integer values (can be empty)

Definition at line 3773 of file smeshDC.py.

03773 
03774     def GetLastCreatedNodes(self):
03775         return self.editor.GetLastCreatedNodes()

def smeshDC.Mesh.GetLog (   self,
  clearAfterGet 
)

Returns the log of nodes and elements added or removed since the previous clear of the log.

Parameters:
clearAfterGetlog is emptied after Get (safe if concurrents access)
Returns:
list of log_block structures: commandType number coords indexes

Definition at line 1736 of file smeshDC.py.

01736 
01737     def GetLog(self, clearAfterGet):
01738         return self.mesh.GetLog(clearAfterGet)

def smeshDC.Mesh.GetMEDMesh (   self)

Gets MED Mesh.

Returns:
an instance of SALOME_MED::MESH

Definition at line 1792 of file smeshDC.py.

01792 
01793     def GetMEDMesh(self):
01794         return self.mesh.GetMEDMesh()
01795 

def smeshDC.GetName (   obj)

Gets object name.

Definition at line 184 of file smeshDC.py.

00184 
00185 def GetName(obj):
00186     if obj:
00187         # object not null
00188         if isinstance(obj, SALOMEDS._objref_SObject):
00189             # study object
00190             return obj.GetName()
00191         ior  = salome.orb.object_to_string(obj)
00192         if ior:
00193             # CORBA object
00194             studies = salome.myStudyManager.GetOpenStudies()
00195             for sname in studies:
00196                 s = salome.myStudyManager.GetStudyByName(sname)
00197                 if not s: continue
00198                 sobj = s.FindObjectIOR(ior)
00199                 if not sobj: continue
00200                 return sobj.GetName()
00201             if hasattr(obj, "GetName"):
00202                 # unknown CORBA object, having GetName() method
00203                 return obj.GetName()
00204             else:
00205                 # unknown CORBA object, no GetName() method
00206                 return NO_NAME
00207             pass
00208         if hasattr(obj, "GetName"):
00209             # unknown non-CORBA object, having GetName() method
00210             return obj.GetName()
00211         pass
00212     raise RuntimeError, "Null or invalid object"

Here is the caller graph for this function:

def smeshDC.smeshDC.GetPointStruct (   self,
  theVertex 
)

Gets PointStruct from vertex.

Parameters:
theVertexa GEOM object(vertex)
Returns:
SMESH.PointStruct

Definition at line 357 of file smeshDC.py.

00357 
00358     def GetPointStruct(self,theVertex):
00359         [x, y, z] = self.geompyD.PointCoordinates(theVertex)
00360         return PointStruct(x,y,z)

def smeshDC.Mesh.GetStudyId (   self)

Get the study Id.

Returns:
integer value, which is the study Id of the mesh

Definition at line 1766 of file smeshDC.py.

01766 
01767     def GetStudyId(self):
01768         return self.mesh.GetStudyId()

def smeshDC.smeshDC.GetSubShapesId (   self,
  theMainObject,
  theListOfSubObjects 
)

From SMESH_Gen interface.

Returns:
the list of integer values

Definition at line 550 of file smeshDC.py.

00550 
00551     def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
00552         return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)

Checks the group names for duplications.

Consider the maximum group name length stored in MED file.

Returns:
True or False

Definition at line 1773 of file smeshDC.py.

01773 
01774     def HasDuplicatedGroupNamesMED(self):
01775         return self.mesh.HasDuplicatedGroupNamesMED()

def smeshDC.smeshDC.init_smesh (   self,
  theStudy,
  geompyD 
)

Sets the current study and Geometry component.

Definition at line 319 of file smeshDC.py.

00319 
00320     def init_smesh(self,theStudy,geompyD):
00321         self.SetCurrentStudy(theStudy,geompyD)

Here is the call graph for this function:

Gets the current mode.

Definition at line 433 of file smeshDC.py.

00433 
00434     def IsEmbeddedMode(self):
00435         #return self.IsEmbeddedMode()
00436         return SMESH._objref_SMESH_Gen.IsEmbeddedMode(self)

def smeshDC.IsEqual (   val1,
  val2,
  tol = PrecisionConfusion 
)

Definition at line 176 of file smeshDC.py.

00176 
00177 def IsEqual(val1, val2, tol=PrecisionConfusion):
00178     if abs(val1 - val2) < tol:
00179         return True
00180     return False

def smeshDC.smeshDC.MakeDirStruct (   self,
  x,
  y,
  z 
)

Makes DirStruct from a triplet.

Parameters:
x,y,zvector components
Returns:
SMESH.DirStruct

Definition at line 380 of file smeshDC.py.

00380 
00381     def MakeDirStruct(self,x,y,z):
00382         pnt = PointStruct(x,y,z)
00383         return DirStruct(pnt)

Returns the mesh dimension depending on the dimension of the underlying shape.

Returns:
mesh dimension as an integer value [0,3]

Definition at line 1082 of file smeshDC.py.

01082 
01083     def MeshDimension(self):
01084         shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] )
01085         if len( shells ) > 0 :
01086             return 3
01087         elif self.geompyD.NumberOfFaces( self.geom ) > 0 :
01088             return 2
01089         elif self.geompyD.NumberOfEdges( self.geom ) > 0 :
01090             return 1
01091         else:
01092             return 0;
01093         pass

Here is the caller graph for this function:

def smeshDC.ParseAngles (   args)

Definition at line 158 of file smeshDC.py.

00158 
00159 def ParseAngles(*args):
00160     return ParseParameters( *( args + (DegreesToRadians, )))
00161 
00162 # Substitute PointStruct.__init__() to create SMESH.PointStruct using notebook variables.
# Parameters are stored in PointStruct.parameters attribute

Here is the call graph for this function:

Here is the caller graph for this function:

def smeshDC.ParseParameters (   args)

Return list of variable values from salome notebook.

The last argument, if is callable, is used to modify values got from notebook

Definition at line 128 of file smeshDC.py.

00128 
00129 def ParseParameters(*args):
00130     Result = []
00131     Parameters = ""
00132     hasVariables = False
00133     varModifFun=None
00134     if args and callable( args[-1] ):
00135         args, varModifFun = args[:-1], args[-1]
00136     for parameter in args:
00137 
00138         Parameters += str(parameter) + var_separator
00139 
00140         if isinstance(parameter,str):
00141             # check if there is an inexistent variable name
00142             if not notebook.isVariable(parameter):
00143                 raise ValueError, "Variable with name '" + parameter + "' doesn't exist!!!"
00144             parameter = notebook.get(parameter)
00145             hasVariables = True
00146             if varModifFun:
00147                 parameter = varModifFun(parameter)
00148                 pass
00149             pass
00150         Result.append(parameter)
00151 
00152         pass
00153     Parameters = Parameters[:-1]
00154     Result.append( Parameters )
00155     Result.append( hasVariables )
00156     return Result
00157 
# Parse parameters converting variables to radians

Here is the caller graph for this function:

def smeshDC.Mesh.SetAutoColor (   self,
  theAutoColor 
)

Toggles auto color mode on the object.

Parameters:
theAutoColorthe flag which toggles auto color mode.

Definition at line 1748 of file smeshDC.py.

01748 
01749     def SetAutoColor(self, theAutoColor):
01750         self.mesh.SetAutoColor(theAutoColor)

def smeshDC.smeshDC.SetBoundaryBoxSegmentation (   self,
  nbSegments 
)

Sets number of segments per diagonal of boundary box of geometry by which default segment length of appropriate 1D hypotheses is defined.

Default value is 10

Definition at line 565 of file smeshDC.py.

00565 
00566     def SetBoundaryBoxSegmentation(self, nbSegments):
00567         SMESH._objref_SMESH_Gen.SetBoundaryBoxSegmentation(self,nbSegments)

def smeshDC.smeshDC.SetCurrentStudy (   self,
  theStudy,
  geompyD = None 
)

Sets the current study.

Definition at line 439 of file smeshDC.py.

00439 
00440     def SetCurrentStudy( self, theStudy, geompyD = None ):
00441         #self.SetCurrentStudy(theStudy)
00442         if not geompyD:
00443             import geompy
00444             geompyD = geompy.geom
00445             pass
00446         self.geompyD=geompyD
00447         self.SetGeomEngine(geompyD)
00448         SMESH._objref_SMESH_Gen.SetCurrentStudy(self,theStudy)
00449         global notebook
00450         if theStudy:
00451             notebook = salome_notebook.NoteBook( theStudy )
00452         else:
00453             notebook = salome_notebook.NoteBook( salome_notebook.PseudoStudyForNoteBook() )

Here is the caller graph for this function:

def smeshDC.smeshDC.SetEmbeddedMode (   self,
  theMode 
)

Sets the current mode.

Definition at line 427 of file smeshDC.py.

00427 
00428     def SetEmbeddedMode( self,theMode ):
00429         #self.SetEmbeddedMode(theMode)
00430         SMESH._objref_SMESH_Gen.SetEmbeddedMode(self,theMode)

def smeshDC.smeshDC.SetName (   self,
  obj,
  name 
)

Sets the given name to the object.

Parameters:
objthe object to rename
namea new object name

Definition at line 417 of file smeshDC.py.

00417 
00418     def SetName(self, obj, name):
00419         if isinstance( obj, Mesh ):
00420             obj = obj.GetMesh()
00421         elif isinstance( obj, Mesh_Algorithm ):
00422             obj = obj.GetAlgorithm()
00423         ior  = salome.orb.object_to_string(obj)
00424         SMESH._objref_SMESH_Gen.SetName(self, ior, name)

def smeshDC.Mesh.SplitHexaToPrisms (   self,
  theObject,
  theNode000,
  theNode001 
)

Split hexahedrons into prisms.

Uses the pattern mapping functionality for splitting.

Parameters:
theObjectthe object (mesh, submesh or group) from where the list of hexahedrons is taken;
theNode000,theNode001(within the range [0,7]) gives the orientation of the pattern relatively each hexahedron: keypoint (0,0,0) of the pattern will be mapped into the theNode000-th node of each volume, keypoint (0,0,1) will be mapped into the theNode001-th node of each volume. Edge (0,0,0)-(0,0,1) of used pattern connects two not split corners.
Returns:
TRUE in case of success, FALSE otherwise.

Definition at line 2742 of file smeshDC.py.

02742 
02743     def SplitHexaToPrisms (self, theObject, theNode000, theNode001):
02744         # Pattern:     5.---------.6
02745         #              /|#       /|
02746         #             / | #     / |
02747         #            /  |  #   /  |
02748         #           /   |   # /   |
02749         # (0,0,1) 4.---------.7   |
02750         #          |    |    |    |
02751         #          |   1.----|----.2
02752         #          |   / *   |   /
02753         #          |  /   *  |  /
02754         #          | /     * | /
02755         #          |/       *|/
02756         # (0,0,0) 0.---------.3
02757         pattern_prism = "!!! Nb of points: \n 8 \n\
02758         !!! Points: \n\
02759         0 0 0  !- 0 \n\
02760         0 1 0  !- 1 \n\
02761         1 1 0  !- 2 \n\
02762         1 0 0  !- 3 \n\
02763         0 0 1  !- 4 \n\
02764         0 1 1  !- 5 \n\
02765         1 1 1  !- 6 \n\
02766         1 0 1  !- 7 \n\
02767         !!! Indices of points of 2 prisms: \n\
02768         0 1 3 4 5 7 \n\
02769         2 3 1 6 7 5 \n"
02770 
02771         pattern = self.smeshpyD.GetPattern()
02772         isDone  = pattern.LoadFromFile(pattern_prism)
02773         if not isDone:
02774             print 'Pattern.LoadFromFile :', pattern.GetErrorCode()
02775             return isDone
02776 
02777         pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001)
02778         isDone = pattern.MakeMesh(self.mesh, False, False)
02779         if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode()
02780 
02781         # Splits quafrangle faces near triangular facets of volumes
02782         self.SplitQuadsNearTriangularFacets()
02783 
02784         return isDone

Here is the call graph for this function:

def smeshDC.Mesh.SplitHexaToTetras (   self,
  theObject,
  theNode000,
  theNode001 
)

Splits hexahedrons into tetrahedrons.

This operation uses pattern mapping functionality for splitting.

Parameters:
theObjectthe object from which the list of hexahedrons is taken; this is mesh, submesh or group.
theNode000,theNode001within the range [0,7]; gives the orientation of the pattern relatively each hexahedron: the (0,0,0) key-point of the pattern will be mapped into theNode000-th node of each volume, the (0,0,1) key-point will be mapped into theNode001-th node of each volume. The (0,0,0) key-point of the used pattern corresponds to a non-split corner.
Returns:
TRUE in case of success, FALSE otherwise.

Definition at line 2684 of file smeshDC.py.

02684 
02685     def SplitHexaToTetras (self, theObject, theNode000, theNode001):
02686         # Pattern:     5.---------.6
02687         #              /|#*      /|
02688         #             / | #*    / |
02689         #            /  |  # * /  |
02690         #           /   |   # /*  |
02691         # (0,0,1) 4.---------.7 * |
02692         #          |#*  |1   | # *|
02693         #          | # *.----|---#.2
02694         #          |  #/ *   |   /
02695         #          |  /#  *  |  /
02696         #          | /   # * | /
02697         #          |/      #*|/
02698         # (0,0,0) 0.---------.3
02699         pattern_tetra = "!!! Nb of points: \n 8 \n\
02700         !!! Points: \n\
02701         0 0 0  !- 0 \n\
02702         0 1 0  !- 1 \n\
02703         1 1 0  !- 2 \n\
02704         1 0 0  !- 3 \n\
02705         0 0 1  !- 4 \n\
02706         0 1 1  !- 5 \n\
02707         1 1 1  !- 6 \n\
02708         1 0 1  !- 7 \n\
02709         !!! Indices of points of 6 tetras: \n\
02710         0 3 4 1 \n\
02711         7 4 3 1 \n\
02712         4 7 5 1 \n\
02713         6 2 5 7 \n\
02714         1 5 2 7 \n\
02715         2 3 1 7 \n"
02716 
02717         pattern = self.smeshpyD.GetPattern()
02718         isDone  = pattern.LoadFromFile(pattern_tetra)
02719         if not isDone:
02720             print 'Pattern.LoadFromFile :', pattern.GetErrorCode()
02721             return isDone
02722 
02723         pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001)
02724         isDone = pattern.MakeMesh(self.mesh, False, False)
02725         if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode()
02726 
02727         # split quafrangle faces near triangular facets of volumes
02728         self.SplitQuadsNearTriangularFacets()
02729 
02730         return isDone

Here is the call graph for this function:

Splits quadrangle faces near triangular facets of volumes.

Definition at line 2646 of file smeshDC.py.

02646 
02647     def SplitQuadsNearTriangularFacets(self):
02648         faces_array = self.GetElementsByType(SMESH.FACE)
02649         for face_id in faces_array:
02650             if self.GetElemNbNodes(face_id) == 4: # quadrangle
02651                 quad_nodes = self.mesh.GetElemNodes(face_id)
02652                 node1_elems = self.GetNodeInverseElements(quad_nodes[1 -1])
02653                 isVolumeFound = False
02654                 for node1_elem in node1_elems:
02655                     if not isVolumeFound:
02656                         if self.GetElementType(node1_elem, True) == SMESH.VOLUME:
02657                             nb_nodes = self.GetElemNbNodes(node1_elem)
02658                             if 3 < nb_nodes and nb_nodes < 7: # tetra or penta, or prism
02659                                 volume_elem = node1_elem
02660                                 volume_nodes = self.mesh.GetElemNodes(volume_elem)
02661                                 if volume_nodes.count(quad_nodes[2 -1]) > 0: # 1,2
02662                                     if volume_nodes.count(quad_nodes[4 -1]) > 0: # 1,2,4
02663                                         isVolumeFound = True
02664                                         if volume_nodes.count(quad_nodes[3 -1]) == 0: # 1,2,4 & !3
02665                                             self.SplitQuad([face_id], False) # diagonal 2-4
02666                                     elif volume_nodes.count(quad_nodes[3 -1]) > 0: # 1,2,3 & !4
02667                                         isVolumeFound = True
02668                                         self.SplitQuad([face_id], True) # diagonal 1-3
02669                                 elif volume_nodes.count(quad_nodes[4 -1]) > 0: # 1,4 & !2
02670                                     if volume_nodes.count(quad_nodes[3 -1]) > 0: # 1,4,3 & !2
02671                                         isVolumeFound = True
02672                                         self.SplitQuad([face_id], True) # diagonal 1-3

Here is the call graph for this function:

Here is the caller graph for this function:

def smeshDC.TreatHypoStatus (   status,
  hypName,
  geomName,
  isAlgo 
)

Prints error message if a hypothesis was not assigned.

Definition at line 214 of file smeshDC.py.

00214 
00215 def TreatHypoStatus(status, hypName, geomName, isAlgo):
00216     if isAlgo:
00217         hypType = "algorithm"
00218     else:
00219         hypType = "hypothesis"
00220         pass
00221     if status == HYP_UNKNOWN_FATAL :
00222         reason = "for unknown reason"
00223     elif status == HYP_INCOMPATIBLE :
00224         reason = "this hypothesis mismatches the algorithm"
00225     elif status == HYP_NOTCONFORM :
00226         reason = "a non-conform mesh would be built"
00227     elif status == HYP_ALREADY_EXIST :
00228         if isAlgo: return # it does not influence anything
00229         reason = hypType + " of the same dimension is already assigned to this shape"
00230     elif status == HYP_BAD_DIM :
00231         reason = hypType + " mismatches the shape"
00232     elif status == HYP_CONCURENT :
00233         reason = "there are concurrent hypotheses on sub-shapes"
00234     elif status == HYP_BAD_SUBSHAPE :
00235         reason = "the shape is neither the main one, nor its sub-shape, nor a valid group"
00236     elif status == HYP_BAD_GEOMETRY:
00237         reason = "geometry mismatches the expectation of the algorithm"
00238     elif status == HYP_HIDDEN_ALGO:
00239         reason = "it is hidden by an algorithm of an upper dimension, which generates elements of all dimensions"
00240     elif status == HYP_HIDING_ALGO:
00241         reason = "it hides algorithms of lower dimensions by generating elements of all dimensions"
00242     elif status == HYP_NEED_SHAPE:
00243         reason = "Algorithm can't work without shape"
00244     else:
00245         return
00246     hypName = '"' + hypName + '"'
00247     geomName= '"' + geomName+ '"'
00248     if status < HYP_UNKNOWN_FATAL and not geomName =='""':
00249         print hypName, "was assigned to",    geomName,"but", reason
00250     elif not geomName == '""':
00251         print hypName, "was not assigned to",geomName,":", reason
00252     else:
00253         print hypName, "was not assigned:", reason
00254         pass

Here is the caller graph for this function:


Variable Documentation

smeshDC.AXIS = SMESH_MeshEditor.AXIS

Definition at line 101 of file smeshDC.py.

smeshDC.CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH

Definition at line 106 of file smeshDC.py.

smeshDC.LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH

Definition at line 105 of file smeshDC.py.

string smeshDC.NO_NAME = "NoName"

Definition at line 181 of file smeshDC.py.

smeshDC.notebook = salome_notebook.notebook

Definition at line 122 of file smeshDC.py.

smeshDC.PLANE = SMESH_MeshEditor.PLANE

Definition at line 102 of file smeshDC.py.

smeshDC.POINT = SMESH_MeshEditor.POINT

Definition at line 100 of file smeshDC.py.

Definition at line 108 of file smeshDC.py.

string smeshDC.var_separator = ":"

Definition at line 124 of file smeshDC.py.