Version: 6.3.1
Data Structures | Functions | Variables

Auxiliary methods and structures

Data Structures

class  smeshDC.PointStructStr
class  smeshDC.PointStructStr6
class  smeshDC.AxisStructStr
class  smeshDC.DirStructStr

Functions

def smeshDC.DegreesToRadians
 Converts an angle from degrees to radians.
def smeshDC.ParsePointStruct
def smeshDC.ParseDirStruct
def smeshDC.ParseAxisStruct
def smeshDC.ParseAngles
 Return list of variable values from salome notebook.
def smeshDC.IsEqual
def smeshDC.GetName
 Gets object name.
def smeshDC.TreatHypoStatus
 Prints error message if a hypothesis was not assigned.
def smeshDC.CheckPlugin
 Check meshing plugin availability.
def smeshDC.AssureGeomPublished
 Private method.
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

int smeshDC.REGULAR = 1
int smeshDC.PYTHON = 2
int smeshDC.COMPOSITE = 3
int smeshDC.SOLE = 0
int smeshDC.SIMPLE = 1
int smeshDC.MEFISTO = 3
int smeshDC.NETGEN = 4
int smeshDC.GHS3D = 5
int smeshDC.FULL_NETGEN = 6
int smeshDC.NETGEN_2D = 7
 smeshDC.NETGEN_1D2D = NETGEN
 smeshDC.NETGEN_1D2D3D = FULL_NETGEN
 smeshDC.NETGEN_FULL = FULL_NETGEN
int smeshDC.Hexa = 8
int smeshDC.Hexotic = 9
int smeshDC.BLSURF = 10
int smeshDC.GHS3DPRL = 11
int smeshDC.QUADRANGLE = 0
int smeshDC.RADIAL_QUAD = 1
 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.VeryCoarse = 0
int smeshDC.Coarse = 1
int smeshDC.Moderate = 2
int smeshDC.Fine = 3
int smeshDC.VeryFine = 4
int smeshDC.Custom = 5
int smeshDC.PrecisionConfusion = 1
string smeshDC.var_separator = ":"
string smeshDC.NO_NAME = "NoName"

Function Documentation

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 494 of file smeshDC.py.

00495                                             :
00496     if not isinstance( geom, geompyDC.GEOM._objref_GEOM_Object ):
00497         return
00498     if not geom.IsSame( mesh.geom ) and not geom.GetStudyEntry():
00499         ## set the study
00500         studyID = mesh.smeshpyD.GetCurrentStudy()._get_StudyId()
00501         if studyID != mesh.geompyD.myStudyId:
00502             mesh.geompyD.init_geom( mesh.smeshpyD.GetCurrentStudy())
00503         ## get a name
00504         if not name and geom.GetShapeType() != geompyDC.GEOM.COMPOUND:
00505             # for all groups SubShapeName() returns "Compound_-1"
00506             name = mesh.geompyD.SubShapeName(geom, mesh.geom)
00507         if not name:
00508             name = "%s_%s"%(geom.GetShapeType(), id(geom)%10000)
00509         ## publish
00510         mesh.geompyD.addToStudyInFather( mesh.geom, geom, name )
00511     return
00512 
# end of l1_auxiliary
def smeshDC.CheckPlugin (   plugin)

Check meshing plugin availability.

Definition at line 475 of file smeshDC.py.

00476                        :
00477     if plugin == NETGEN and noNETGENPlugin:
00478         print "Warning: NETGENPlugin module unavailable"
00479         return False
00480     elif plugin == GHS3D and noGHS3DPlugin:
00481         print "Warning: GHS3DPlugin module unavailable"
00482         return False
00483     elif plugin == GHS3DPRL and noGHS3DPRLPlugin:
00484         print "Warning: GHS3DPRLPlugin module unavailable"
00485         return False
00486     elif plugin == Hexotic and noHexoticPlugin:
00487         print "Warning: HexoticPlugin module unavailable"
00488         return False
00489     elif plugin == BLSURF and noBLSURFPlugin:
00490         print "Warning: BLSURFPlugin module unavailable"
00491         return False
00492     return True

def smeshDC.Mesh.ClearLog (   self) [inherited]

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 1974 of file smeshDC.py.

01975                       :
01976         self.mesh.ClearLog()

def smeshDC.DegreesToRadians (   AngleInDegrees)

Converts an angle from degrees to radians.

Definition at line 208 of file smeshDC.py.

00209                                     :
00210     from math import pi
00211     return AngleInDegrees * pi / 180.0
00212 
# Salome notebook variable separator
def smeshDC.Mesh.GetAutoColor (   self) [inherited]

Gets flag of object auto color mode.

Returns:
True or False

Definition at line 1986 of file smeshDC.py.

01987                           :
01988         return self.mesh.GetAutoColor()

def smeshDC.smeshDC.GetAxisStruct (   self,
  theObj 
) [inherited]

Get AxisStruct from object.

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

Definition at line 594 of file smeshDC.py.

00595                                   :
00596         edges = self.geompyD.SubShapeAll( theObj, geompyDC.ShapeType["EDGE"] )
00597         if len(edges) > 1:
00598             vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geompyDC.ShapeType["VERTEX"] )
00599             vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geompyDC.ShapeType["VERTEX"] )
00600             vertex1 = self.geompyD.PointCoordinates(vertex1)
00601             vertex2 = self.geompyD.PointCoordinates(vertex2)
00602             vertex3 = self.geompyD.PointCoordinates(vertex3)
00603             vertex4 = self.geompyD.PointCoordinates(vertex4)
00604             v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]]
00605             v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]]
00606             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] ]
00607             axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2])
00608             return axis
00609         elif len(edges) == 1:
00610             vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geompyDC.ShapeType["VERTEX"] )
00611             p1 = self.geompyD.PointCoordinates( vertex1 )
00612             p2 = self.geompyD.PointCoordinates( vertex2 )
00613             axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
00614             return axis
00615         return None

def smeshDC.smeshDC.GetCurrentStudy (   self) [inherited]

Gets the current study.

Definition at line 657 of file smeshDC.py.

00658                              :
00659         #return self.GetCurrentStudy()
00660         return SMESH._objref_SMESH_Gen.GetCurrentStudy(self)

def smeshDC.smeshDC.GetDirStruct (   self,
  theVector 
) [inherited]

Gets DirStruct from vector.

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

Definition at line 571 of file smeshDC.py.

00572                                     :
00573         vertices = self.geompyD.SubShapeAll( theVector, geompyDC.ShapeType["VERTEX"] )
00574         if(len(vertices) != 2):
00575             print "Error: vector object is incorrect."
00576             return None
00577         p1 = self.geompyD.PointCoordinates(vertices[0])
00578         p2 = self.geompyD.PointCoordinates(vertices[1])
00579         pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
00580         dirst = DirStruct(pnt)
00581         return dirst

def smeshDC.Mesh.GetId (   self) [inherited]

Gets the internal ID.

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

Definition at line 1992 of file smeshDC.py.

01993                    :
01994         return self.mesh.GetId()

def smeshDC.Mesh.GetIDSource (   self,
  ids,
  elemType 
) [inherited]

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 2018 of file smeshDC.py.

02019                                         :
02020         return self.GetMeshEditor().MakeIDSource(ids, elemType)

def smeshDC.Mesh.GetLastCreatedElems (   self) [inherited]

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 4043 of file smeshDC.py.

04044                                  :
04045         return self.editor.GetLastCreatedElems()
04046 
     ## Creates a hole in a mesh by doubling the nodes of some particular elements
def smeshDC.Mesh.GetLastCreatedNodes (   self) [inherited]

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 4035 of file smeshDC.py.

04036                                  :
04037         return self.editor.GetLastCreatedNodes()

def smeshDC.Mesh.GetLog (   self,
  clearAfterGet 
) [inherited]

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 1968 of file smeshDC.py.

01969                                    :
01970         return self.mesh.GetLog(clearAfterGet)

def smeshDC.Mesh.GetMEDMesh (   self) [inherited]

Gets MED Mesh.

Returns:
an instance of SALOME_MED.MESH

Definition at line 2024 of file smeshDC.py.

02025                         :
02026         return self.mesh.GetMEDMesh()
02027 

def smeshDC.GetName (   obj)

Gets object name.

Definition at line 403 of file smeshDC.py.

Referenced by SMESH_MeshEditor_i.DoubleNodeElemGroupsNew(), SMESH_MeshEditor_i.DoubleNodeGroupsNew(), SMESH_Gen_i.GetHypothesisParameterValues(), and SMESHGUI_FilterDlg.onSelectionDone().

00404                 :
00405     if obj:
00406         # object not null
00407         if isinstance(obj, SALOMEDS._objref_SObject):
00408             # study object
00409             return obj.GetName()
00410         ior  = salome.orb.object_to_string(obj)
00411         if ior:
00412             # CORBA object
00413             studies = salome.myStudyManager.GetOpenStudies()
00414             for sname in studies:
00415                 s = salome.myStudyManager.GetStudyByName(sname)
00416                 if not s: continue
00417                 sobj = s.FindObjectIOR(ior)
00418                 if not sobj: continue
00419                 return sobj.GetName()
00420             if hasattr(obj, "GetName"):
00421                 # unknown CORBA object, having GetName() method
00422                 return obj.GetName()
00423             else:
00424                 # unknown CORBA object, no GetName() method
00425                 return NO_NAME
00426             pass
00427         if hasattr(obj, "GetName"):
00428             # unknown non-CORBA object, having GetName() method
00429             return obj.GetName()
00430         pass
00431     raise RuntimeError, "Null or invalid object"

def smeshDC.smeshDC.GetPointStruct (   self,
  theVertex 
) [inherited]

Gets PointStruct from vertex.

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

Definition at line 563 of file smeshDC.py.

00564                                       :
00565         [x, y, z] = self.geompyD.PointCoordinates(theVertex)
00566         return PointStruct(x,y,z)

def smeshDC.Mesh.GetStudyId (   self) [inherited]

Get the study Id.

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

Definition at line 1998 of file smeshDC.py.

01999                         :
02000         return self.mesh.GetStudyId()

def smeshDC.smeshDC.GetSubShapesId (   self,
  theMainObject,
  theListOfSubObjects 
) [inherited]

From SMESH_Gen interface.

Returns:
the list of integer values

Definition at line 728 of file smeshDC.py.

00729                                                                   :
00730         return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)

def smeshDC.Mesh.HasDuplicatedGroupNamesMED (   self) [inherited]

Checks the group names for duplications.

Consider the maximum group name length stored in MED file.

Returns:
True or False

Definition at line 2005 of file smeshDC.py.

02006                                         :
02007         return self.mesh.HasDuplicatedGroupNamesMED()

def smeshDC.smeshDC.init_smesh (   self,
  theStudy,
  geompyD 
) [inherited]

Sets the current study and Geometry component.

Definition at line 525 of file smeshDC.py.

00526                                          :
00527         self.SetCurrentStudy(theStudy,geompyD)

def smeshDC.smeshDC.IsEmbeddedMode (   self) [inherited]

Gets the current mode.

Definition at line 639 of file smeshDC.py.

00640                             :
00641         #return self.IsEmbeddedMode()
00642         return SMESH._objref_SMESH_Gen.IsEmbeddedMode(self)

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

Definition at line 395 of file smeshDC.py.

00396                                                :
00397     if abs(val1 - val2) < tol:
00398         return True
00399     return False

def smeshDC.smeshDC.MakeDirStruct (   self,
  x,
  y,
  z 
) [inherited]

Makes DirStruct from a triplet.

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

Definition at line 586 of file smeshDC.py.

00587                                  :
00588         pnt = PointStruct(x,y,z)
00589         return DirStruct(pnt)

def smeshDC.Mesh.MeshDimension (   self) [inherited]

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

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

Definition at line 1217 of file smeshDC.py.

01218                            :
01219         shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] )
01220         if len( shells ) > 0 :
01221             return 3
01222         elif self.geompyD.NumberOfFaces( self.geom ) > 0 :
01223             return 2
01224         elif self.geompyD.NumberOfEdges( self.geom ) > 0 :
01225             return 1
01226         else:
01227             return 0;
01228         pass

def smeshDC.ParseAngles (   list)

Return list of variable values from salome notebook.

Definition at line 378 of file smeshDC.py.

00379                      :
00380     Result = []
00381     Parameters = ""
00382     for parameter in list:
00383         if isinstance(parameter,str) and notebook.isVariable(parameter):
00384             Result.append(DegreesToRadians(notebook.get(parameter)))
00385             pass
00386         else:
00387             Result.append(parameter)
00388             pass
00389 
00390         Parameters = Parameters + str(parameter)
00391         Parameters = Parameters + var_separator
00392         pass
00393     Parameters = Parameters[:len(Parameters)-1]
00394     return Result, Parameters

def smeshDC.ParseAxisStruct (   Axis)

Definition at line 369 of file smeshDC.py.

00370                          :
00371     Parameters = 5*var_separator
00372     if isinstance(Axis, AxisStructStr):
00373         Parameters = str(Axis.xStr) + var_separator + str(Axis.yStr) + var_separator + str(Axis.zStr) + var_separator
00374         Parameters += str(Axis.dxStr) + var_separator + str(Axis.dyStr) + var_separator + str(Axis.dzStr)
00375         Axis = AxisStruct(Axis.x, Axis.y, Axis.z, Axis.dx, Axis.dy, Axis.dz)
00376     return Axis, Parameters

def smeshDC.ParseDirStruct (   Dir)

Definition at line 353 of file smeshDC.py.

00354                        :
00355     Parameters = 2*var_separator
00356     if isinstance(Dir, DirStructStr):
00357         pntStr = Dir.pointStruct
00358         if isinstance(pntStr, PointStructStr6):
00359             Parameters = str(pntStr.x1Str) + var_separator + str(pntStr.x2Str) + var_separator
00360             Parameters += str(pntStr.y1Str) + var_separator + str(pntStr.y2Str) + var_separator
00361             Parameters += str(pntStr.z1Str) + var_separator + str(pntStr.z2Str)
00362             Point = PointStruct(pntStr.x2 - pntStr.x1, pntStr.y2 - pntStr.y1, pntStr.z2 - pntStr.z1)
00363         else:
00364             Parameters = str(pntStr.xStr) + var_separator + str(pntStr.yStr) + var_separator + str(pntStr.zStr)
00365             Point = PointStruct(pntStr.x, pntStr.y, pntStr.z)
00366         Dir = DirStruct(Point)
00367     return Dir, Parameters
00368 
# Returns list of variable values from salome notebook
def smeshDC.ParsePointStruct (   Point)

Definition at line 345 of file smeshDC.py.

00346                            :
00347     Parameters = 2*var_separator
00348     if isinstance(Point, PointStructStr):
00349         Parameters = str(Point.xStr) + var_separator + str(Point.yStr) + var_separator + str(Point.zStr)
00350         Point = PointStruct(Point.x, Point.y, Point.z)
00351     return Point, Parameters
00352 
# Returns list of variable values from salome notebook
def smeshDC.Mesh.SetAutoColor (   self,
  theAutoColor 
) [inherited]

Toggles auto color mode on the object.

Parameters:
theAutoColorthe flag which toggles auto color mode.

Definition at line 1980 of file smeshDC.py.

01981                                         :
01982         self.mesh.SetAutoColor(theAutoColor)

def smeshDC.smeshDC.SetBoundaryBoxSegmentation (   self,
  nbSegments 
) [inherited]

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 743 of file smeshDC.py.

00744                                                     :
00745         SMESH._objref_SMESH_Gen.SetBoundaryBoxSegmentation(self,nbSegments)

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

Sets the current study.

Definition at line 645 of file smeshDC.py.

00646                                                          :
00647         #self.SetCurrentStudy(theStudy)
00648         if not geompyD:
00649             import geompy
00650             geompyD = geompy.geom
00651             pass
00652         self.geompyD=geompyD
00653         self.SetGeomEngine(geompyD)
00654         SMESH._objref_SMESH_Gen.SetCurrentStudy(self,theStudy)

def smeshDC.smeshDC.SetEmbeddedMode (   self,
  theMode 
) [inherited]

Sets the current mode.

Definition at line 633 of file smeshDC.py.

00634                                        :
00635         #self.SetEmbeddedMode(theMode)
00636         SMESH._objref_SMESH_Gen.SetEmbeddedMode(self,theMode)

def smeshDC.smeshDC.SetName (   self,
  obj,
  name 
) [inherited]

Sets the given name to the object.

Parameters:
objthe object to rename
namea new object name

Definition at line 623 of file smeshDC.py.

00624                                 :
00625         if isinstance( obj, Mesh ):
00626             obj = obj.GetMesh()
00627         elif isinstance( obj, Mesh_Algorithm ):
00628             obj = obj.GetAlgorithm()
00629         ior  = salome.orb.object_to_string(obj)
00630         SMESH._objref_SMESH_Gen.SetName(self, ior, name)

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

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 2952 of file smeshDC.py.

02953                                                                    :
02954         # Pattern:     5.---------.6
02955         #              /|#       /|
02956         #             / | #     / |
02957         #            /  |  #   /  |
02958         #           /   |   # /   |
02959         # (0,0,1) 4.---------.7   |
02960         #          |    |    |    |
02961         #          |   1.----|----.2
02962         #          |   / *   |   /
02963         #          |  /   *  |  /
02964         #          | /     * | /
02965         #          |/       *|/
02966         # (0,0,0) 0.---------.3
02967         pattern_prism = "!!! Nb of points: \n 8 \n\
02968         !!! Points: \n\
02969         0 0 0  !- 0 \n\
02970         0 1 0  !- 1 \n\
02971         1 1 0  !- 2 \n\
02972         1 0 0  !- 3 \n\
02973         0 0 1  !- 4 \n\
02974         0 1 1  !- 5 \n\
02975         1 1 1  !- 6 \n\
02976         1 0 1  !- 7 \n\
02977         !!! Indices of points of 2 prisms: \n\
02978         0 1 3 4 5 7 \n\
02979         2 3 1 6 7 5 \n"
02980 
02981         pattern = self.smeshpyD.GetPattern()
02982         isDone  = pattern.LoadFromFile(pattern_prism)
02983         if not isDone:
02984             print 'Pattern.LoadFromFile :', pattern.GetErrorCode()
02985             return isDone
02986 
02987         pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001)
02988         isDone = pattern.MakeMesh(self.mesh, False, False)
02989         if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode()
02990 
02991         # Splits quafrangle faces near triangular facets of volumes
02992         self.SplitQuadsNearTriangularFacets()
02993 
02994         return isDone

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

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 2894 of file smeshDC.py.

02895                                                                    :
02896         # Pattern:     5.---------.6
02897         #              /|#*      /|
02898         #             / | #*    / |
02899         #            /  |  # * /  |
02900         #           /   |   # /*  |
02901         # (0,0,1) 4.---------.7 * |
02902         #          |#*  |1   | # *|
02903         #          | # *.----|---#.2
02904         #          |  #/ *   |   /
02905         #          |  /#  *  |  /
02906         #          | /   # * | /
02907         #          |/      #*|/
02908         # (0,0,0) 0.---------.3
02909         pattern_tetra = "!!! Nb of points: \n 8 \n\
02910         !!! Points: \n\
02911         0 0 0  !- 0 \n\
02912         0 1 0  !- 1 \n\
02913         1 1 0  !- 2 \n\
02914         1 0 0  !- 3 \n\
02915         0 0 1  !- 4 \n\
02916         0 1 1  !- 5 \n\
02917         1 1 1  !- 6 \n\
02918         1 0 1  !- 7 \n\
02919         !!! Indices of points of 6 tetras: \n\
02920         0 3 4 1 \n\
02921         7 4 3 1 \n\
02922         4 7 5 1 \n\
02923         6 2 5 7 \n\
02924         1 5 2 7 \n\
02925         2 3 1 7 \n"
02926 
02927         pattern = self.smeshpyD.GetPattern()
02928         isDone  = pattern.LoadFromFile(pattern_tetra)
02929         if not isDone:
02930             print 'Pattern.LoadFromFile :', pattern.GetErrorCode()
02931             return isDone
02932 
02933         pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001)
02934         isDone = pattern.MakeMesh(self.mesh, False, False)
02935         if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode()
02936 
02937         # split quafrangle faces near triangular facets of volumes
02938         self.SplitQuadsNearTriangularFacets()
02939 
02940         return isDone

def smeshDC.Mesh.SplitQuadsNearTriangularFacets (   self) [inherited]

Splits quadrangle faces near triangular facets of volumes.

Definition at line 2856 of file smeshDC.py.

02857                                             :
02858         faces_array = self.GetElementsByType(SMESH.FACE)
02859         for face_id in faces_array:
02860             if self.GetElemNbNodes(face_id) == 4: # quadrangle
02861                 quad_nodes = self.mesh.GetElemNodes(face_id)
02862                 node1_elems = self.GetNodeInverseElements(quad_nodes[1 -1])
02863                 isVolumeFound = False
02864                 for node1_elem in node1_elems:
02865                     if not isVolumeFound:
02866                         if self.GetElementType(node1_elem, True) == SMESH.VOLUME:
02867                             nb_nodes = self.GetElemNbNodes(node1_elem)
02868                             if 3 < nb_nodes and nb_nodes < 7: # tetra or penta, or prism
02869                                 volume_elem = node1_elem
02870                                 volume_nodes = self.mesh.GetElemNodes(volume_elem)
02871                                 if volume_nodes.count(quad_nodes[2 -1]) > 0: # 1,2
02872                                     if volume_nodes.count(quad_nodes[4 -1]) > 0: # 1,2,4
02873                                         isVolumeFound = True
02874                                         if volume_nodes.count(quad_nodes[3 -1]) == 0: # 1,2,4 & !3
02875                                             self.SplitQuad([face_id], False) # diagonal 2-4
02876                                     elif volume_nodes.count(quad_nodes[3 -1]) > 0: # 1,2,3 & !4
02877                                         isVolumeFound = True
02878                                         self.SplitQuad([face_id], True) # diagonal 1-3
02879                                 elif volume_nodes.count(quad_nodes[4 -1]) > 0: # 1,4 & !2
02880                                     if volume_nodes.count(quad_nodes[3 -1]) > 0: # 1,4,3 & !2
02881                                         isVolumeFound = True
02882                                         self.SplitQuad([face_id], True) # diagonal 1-3

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

Prints error message if a hypothesis was not assigned.

Definition at line 433 of file smeshDC.py.

00434                                                       :
00435     if isAlgo:
00436         hypType = "algorithm"
00437     else:
00438         hypType = "hypothesis"
00439         pass
00440     if status == HYP_UNKNOWN_FATAL :
00441         reason = "for unknown reason"
00442     elif status == HYP_INCOMPATIBLE :
00443         reason = "this hypothesis mismatches the algorithm"
00444     elif status == HYP_NOTCONFORM :
00445         reason = "a non-conform mesh would be built"
00446     elif status == HYP_ALREADY_EXIST :
00447         if isAlgo: return # it does not influence anything
00448         reason = hypType + " of the same dimension is already assigned to this shape"
00449     elif status == HYP_BAD_DIM :
00450         reason = hypType + " mismatches the shape"
00451     elif status == HYP_CONCURENT :
00452         reason = "there are concurrent hypotheses on sub-shapes"
00453     elif status == HYP_BAD_SUBSHAPE :
00454         reason = "the shape is neither the main one, nor its subshape, nor a valid group"
00455     elif status == HYP_BAD_GEOMETRY:
00456         reason = "geometry mismatches the expectation of the algorithm"
00457     elif status == HYP_HIDDEN_ALGO:
00458         reason = "it is hidden by an algorithm of an upper dimension, which generates elements of all dimensions"
00459     elif status == HYP_HIDING_ALGO:
00460         reason = "it hides algorithms of lower dimensions by generating elements of all dimensions"
00461     elif status == HYP_NEED_SHAPE:
00462         reason = "Algorithm can't work without shape"
00463     else:
00464         return
00465     hypName = '"' + hypName + '"'
00466     geomName= '"' + geomName+ '"'
00467     if status < HYP_UNKNOWN_FATAL and not geomName =='""':
00468         print hypName, "was assigned to",    geomName,"but", reason
00469     elif not geomName == '""':
00470         print hypName, "was not assigned to",geomName,":", reason
00471     else:
00472         print hypName, "was not assigned:", reason
00473         pass


Variable Documentation

smeshDC.AXIS = SMESH_MeshEditor.AXIS

Definition at line 169 of file smeshDC.py.

Referenced by SMESHGUI_SymmetryDlg.getMirror().

Definition at line 162 of file smeshDC.py.

smeshDC.CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH

Definition at line 174 of file smeshDC.py.

Definition at line 178 of file smeshDC.py.

Definition at line 148 of file smeshDC.py.

Definition at line 182 of file smeshDC.py.

Referenced by SMESHGUI.addVtkFontPref().

Definition at line 180 of file smeshDC.py.

Definition at line 155 of file smeshDC.py.

Definition at line 154 of file smeshDC.py.

Definition at line 163 of file smeshDC.py.

Definition at line 160 of file smeshDC.py.

Definition at line 161 of file smeshDC.py.

smeshDC.LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH

Definition at line 173 of file smeshDC.py.

Referenced by SMESHGUI_SmoothingDlg.ClickOnApply().

Definition at line 152 of file smeshDC.py.

Definition at line 179 of file smeshDC.py.

Definition at line 153 of file smeshDC.py.

Definition at line 157 of file smeshDC.py.

smeshDC.NETGEN_1D2D3D = FULL_NETGEN

Definition at line 158 of file smeshDC.py.

Definition at line 156 of file smeshDC.py.

smeshDC.NETGEN_FULL = FULL_NETGEN

Definition at line 159 of file smeshDC.py.

string smeshDC.NO_NAME = "NoName"

Definition at line 400 of file smeshDC.py.

smeshDC.PLANE = SMESH_MeshEditor.PLANE

Definition at line 170 of file smeshDC.py.

Referenced by SMESHGUI_SymmetryDlg.getMirror().

smeshDC.POINT = SMESH_MeshEditor.POINT

Definition at line 168 of file smeshDC.py.

Referenced by SMESHGUI_SymmetryDlg.getMirror().

Definition at line 196 of file smeshDC.py.

Definition at line 147 of file smeshDC.py.

Definition at line 164 of file smeshDC.py.

Definition at line 165 of file smeshDC.py.

Definition at line 146 of file smeshDC.py.

Definition at line 150 of file smeshDC.py.

Definition at line 149 of file smeshDC.py.

string smeshDC.var_separator = ":"

Definition at line 213 of file smeshDC.py.

Definition at line 177 of file smeshDC.py.

Definition at line 181 of file smeshDC.py.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS