blsurfMesh = smesh.Mesh(box,"box: BLSurf mesh")
# create a BLSurf algorithm for faces
-BLSURF = blsurfMesh.Triangle(algo=smesh.BLSURF)
+algo2d = blsurfMesh.Triangle(algo=smesh.BLSURF)
-# get BLSurf algorithm hypothesis
-BLSURF_Parameters = BLSURF.Parameters()
+# optional - set physical mesh to 2 = Size Map
+algo2d.SetPhysicalMesh( 2 )
-# set physical mesh to 2 = Size Map
-BLSURF_Parameters.SetPhysicalMesh( 2 )
-
-# set global mesh size
-BLSURF_Parameters.SetPhySize( 34.641 )
+# optional - set global mesh size
+algo2d.SetPhySize( 34.641 )
# set size on Face_1
-BLSURF_Parameters.SetSizeMap(Face_1, 'def f(u,v): return 10' )
+algo2d.SetSizeMap(Face_1, 'def f(u,v): return 10' )
# set size on Edge_1
-BLSURF_Parameters.SetSizeMap(Edge_1, 'def f(t): return 5' )
+algo2d.SetSizeMap(Edge_1, 'def f(t): return 5' )
# set size on Vertex_1
-BLSURF_Parameters.SetSizeMap(Vertex_1, 'def f(): return 2' )
+algo2d.SetSizeMap(Vertex_1, 'def f(): return 2' )
# compute the mesh
blsurfMesh.Compute()
# Add enforced vertex for Face_1 on (50, 50, 50)
# The projection coordinates will be (50, 50, 0)
-BLSURF_Parameters.SetEnforcedVertex(Face_1, 50, 50, 50)
+algo2d.SetEnforcedVertex(Face_1, 50, 50, 50)
# Add another enforced vertex on (150, 150, 150)
-BLSURF_Parameters.SetEnforcedVertex(Face_1, 150, 150, 150)
+algo2d.SetEnforcedVertex(Face_1, 150, 150, 150)
# Retrieve and print the list of enforced vertices defines on Face_1
-enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
+enfList = algo2d.GetEnforcedVertices(Face_1)
print "List of enforced vertices for Face_1: "
print enfList
blsurfMesh.Compute()
# Remove an enforced vertex and print the list
-BLSURF_Parameters.UnsetEnforcedVertex(Face_1, 50, 50, 50)
-enfList = BLSURF_Parameters.GetEnforcedVertices(Face_1)
+algo2d.UnsetEnforcedVertex(Face_1, 50, 50, 50)
+enfList = algo2d.GetEnforcedVertices(Face_1)
print "List of enforced vertices for Face_1: "
print enfList
blsurfMesh.Compute()
# Remove all enforced vertices defined on Face_1
-BLSURF_Parameters.UnsetEnforcedVertices(Face_1)
+algo2d.UnsetEnforcedVertices(Face_1)
# compute the mesh
blsurfMesh.Compute()
# The size on Wire_1 is 1 and will grow until a maximum of 36.641 (physical size set above)
# The influence distance of the attractor is 20
# The size is kept constant until a distance of 10
-BLSURF_Parameters.SetAttractorGeom(Face_2, Wire_1, 1, 36.641, 20, 10)
+algo2d.SetAttractorGeom(Face_2, Wire_1, 1, 36.641, 20, 10)
# In order to let the attractor control the growing of the mesh let set
# the gradation to its maximum
-BLSURF_Parameters.SetGradation( 2.5 )
+algo2d.SetGradation( 2.5 )
# compute the mesh
blsurfMesh.Compute()
None_Optimization, Light_Optimization, Standard_Optimization, StandardPlus_Optimization, Strong_Optimization = 0,1,2,3,4
# Topology treatment way of BLSURF
-FromCAD, PreProcess, PreProcessPlus = 0,1,2
+FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3
# Element size flag of BLSURF
DefaultSize, DefaultGeom, BLSURF_Custom, SizeMap = 0,0,1,2
# @param way defines how mesh conformity is assured <ul>
# <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
# <li>PreProcess or PreProcessPlus - by pre-processing a CAD model</li></ul>
+ # <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
# @ingroup l3_hypos_blsurf
def SetTopology(self, way):
if self.Parameters():
# Parameter of BLSURF algo
self.params.SetOptionValue(optionName,level)
+ ## Enforced vertices (BLSURF)
+
+ ## To get all the enforced vertices
+ # @ingroup l3_hypos_blsurf
+ def GetAllEnforcedVertices(self):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ return self.params.GetAllEnforcedVertices()
+
+ ## To get all the enforced vertices sorted by face (or group, compound)
+ # @ingroup l3_hypos_blsurf
+ def GetAllEnforcedVerticesByFace(self):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ return self.params.GetAllEnforcedVerticesByFace()
+
+ ## To get all the enforced vertices sorted by coords of input vertices
+ # @ingroup l3_hypos_blsurf
+ def GetAllEnforcedVerticesByCoords(self):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ return self.params.GetAllEnforcedVerticesByCoords()
+
+ ## To get all the coords of input vertices sorted by face (or group, compound)
+ # @ingroup l3_hypos_blsurf
+ def GetAllCoordsByFace(self):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ return self.params.GetAllCoordsByFace()
+
+ ## To get all the enforced vertices on a face (or group, compound)
+ # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
+ # @ingroup l3_hypos_blsurf
+ def GetEnforcedVertices(self, theFace):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ AssureGeomPublished( self.mesh, theFace )
+ return self.params.GetEnforcedVertices(theFace)
+
+ ## To clear all the enforced vertices
+ # @ingroup l3_hypos_blsurf
+ def ClearAllEnforcedVertices(self):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ return self.params.ClearAllEnforcedVertices()
+
## To set an enforced vertex on a face (or group, compound) given the coordinates of a point. If the point is not on the face, it will projected on it. If there is no projection, no enforced vertex is created.
# @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
# @param x : x coordinate
def SetEnforcedVertex(self, theFace, x, y, z):
if self.Parameters():
# Parameter of BLSURF algo
-# self.SetPhysicalMesh(2)
AssureGeomPublished( self.mesh, theFace )
return self.params.SetEnforcedVertex(theFace, x, y, z)
def SetEnforcedVertexNamed(self, theFace, x, y, z, vertexName):
if self.Parameters():
# Parameter of BLSURF algo
-# self.SetPhysicalMesh(2)
AssureGeomPublished( self.mesh, theFace )
return self.params.SetEnforcedVertexNamed(theFace, x, y, z, vertexName)
def SetEnforcedVertexGeom(self, theFace, theVertex):
if self.Parameters():
# Parameter of BLSURF algo
-# self.SetPhysicalMesh(2)
AssureGeomPublished( self.mesh, theFace )
AssureGeomPublished( self.mesh, theVertex )
return self.params.SetEnforcedVertexGeom(theFace, theVertex)
def SetEnforcedVertexWithGroup(self, theFace, x, y, z, groupName):
if self.Parameters():
# Parameter of BLSURF algo
-# self.SetPhysicalMesh(2)
AssureGeomPublished( self.mesh, theFace )
return self.params.SetEnforcedVertexWithGroup(theFace, x, y, z, groupName)
def SetEnforcedVertexNamedWithGroup(self, theFace, x, y, z, vertexName, groupName):
if self.Parameters():
# Parameter of BLSURF algo
-# self.SetPhysicalMesh(2)
AssureGeomPublished( self.mesh, theFace )
return self.params.SetEnforcedVertexNamedWithGroup(theFace, x, y, z, vertexName, groupName)
def SetEnforcedVertexGeomWithGroup(self, theFace, theVertex, groupName):
if self.Parameters():
# Parameter of BLSURF algo
-# self.SetPhysicalMesh(2)
AssureGeomPublished( self.mesh, theFace )
AssureGeomPublished( self.mesh, theVertex )
return self.params.SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName)
AssureGeomPublished( self.mesh, theFace )
return self.params.UnsetEnforcedVertices(theFace)
+ ## Attractors (BLSURF)
+
## Sets an attractor on the chosen face. The mesh size will decrease exponentially with the distance from theAttractor, following the rule h(d) = theEndSize - (theEndSize - theStartSize) * exp [ - ( d / theInfluenceDistance ) ^ 2 ]
# @param theFace : face on which the attractor will be defined
# @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially
AssureGeomPublished( self.mesh, theFace )
self.params.SetAttractorGeom(theFace)
+ ## Size maps (BLSURF)
+
+ ## To set a size map on a face, edge or vertex (or group, compound) given Python function.
+ # If theObject is a face, the function can be: def f(u,v): return u+v
+ # If theObject is an edge, the function can be: def f(t): return t/2
+ # If theObject is a vertex, the function can be: def f(): return 10
+ # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
+ # @param theSizeMap : Size map defined as a string
+ # @ingroup l3_hypos_blsurf
+ def SetSizeMap(self, theObject, theSizeMap):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ AssureGeomPublished( self.mesh, theObject )
+ return self.params.SetSizeMap(theObject, theSizeMap)
+
+ ## To remove a size map defined on a face, edge or vertex (or group, compound)
+ # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
+ # @ingroup l3_hypos_blsurf
+ def UnsetSizeMap(self, theObject):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ AssureGeomPublished( self.mesh, theObject )
+ return self.params.UnsetSizeMap(theObject)
+
+ ## To remove all the size maps
+ # @ingroup l3_hypos_blsurf
+ def ClearSizeMaps(self):
+ if self.Parameters():
+ # Parameter of BLSURF algo
+ return self.params.ClearSizeMaps()
+
+
## Sets QuadAllowed flag.
# Only for algoType == NETGEN(NETGEN_1D2D) || NETGEN_2D || BLSURF
# @ingroup l3_hypos_netgen l3_hypos_blsurf