-# Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
##
# @package BLSURFPluginBuilder
-# Python API for the BLSURF meshing plug-in module.
+# Python API for the MG-CADSurf meshing plug-in module.
from salome.smesh.smesh_algorithm import Mesh_Algorithm
-from salome.smesh.smeshBuilder import AssureGeomPublished
-# Topology treatment way of BLSURF
+LIBRARY = "libBLSURFEngine.so"
+
+# Topology treatment way of MG-CADSurf
FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3
-# Element size flag of BLSURF
-DefaultSize, DefaultGeom, BLSURF_GlobalSize, BLSURF_LocalSize = 0,0,1,2
+# Element size flag of MG-CADSurf
+DefaultSize, DefaultGeom, MG_CADSURF_GlobalSize, MG_CADSURF_LocalSize = 0,0,1,2
# Retrocompatibility
-BLSURF_Custom, SizeMap = BLSURF_GlobalSize, BLSURF_LocalSize
-
+MG_CADSURF_Custom, SizeMap = MG_CADSURF_GlobalSize, MG_CADSURF_LocalSize
+BLSURF_Custom, BLSURF_GlobalSize, BLSURF_LocalSize = MG_CADSURF_Custom, MG_CADSURF_GlobalSize, MG_CADSURF_LocalSize
# import BLSURFPlugin module if possible
noBLSURFPlugin = 0
# Mesh algo type identifiers
#----------------------------
-## Algorithm type: BLSurf triangle 2D algorithm, see BLSURF_Algorithm
-BLSURF = "BLSURF"
+## Algorithm type: MG-CADSurf triangle algorithm, see BLSURF_Algorithm
+MG_CADSurf = "MG-CADSurf"
+BLSURF = MG_CADSurf
#----------------------
# Algorithms
#----------------------
-## BLSurf 2D algorithm.
+## MG-CADSurf 2D algorithm.
#
-# It can be created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.BLSURF,geom=0)
+# It can be created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.MG-CADSurf,geom=0)
#
class BLSURF_Algorithm(Mesh_Algorithm):
meshMethod = "Triangle"
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
- algoType = BLSURF
+ algoType = MG_CADSurf
## doc string of the method
# @internal
- docHelper = "Creates triangle 2D algorithm for faces"
+ docHelper = "Creates triangle algorithm for faces"
_anisotropic_ratio = 0
_bad_surface_element_aspect_ratio = 1000
Mesh_Algorithm.__init__(self)
if noBLSURFPlugin:
print "Warning: BLSURFPlugin module unavailable"
- self.Create(mesh, geom, BLSURF, "libBLSURFEngine.so")
+ self.Create(mesh, geom, BLSURF, LIBRARY)
self.params=None
self.geompyD = mesh.geompyD
#self.SetPhysicalMesh() - PAL19680
pass
## Sets a way to define size of mesh elements to generate.
- # @param thePhysicalMesh is: DefaultSize, BLSURF_Custom or SizeMap.
+ # @param thePhysicalMesh is: DefaultSize, MG_CADSURF_Custom or SizeMap.
def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize):
physical_size_mode = thePhysicalMesh
if self.Parameters().GetGeometricMesh() == DefaultGeom:
if physical_size_mode == DefaultSize:
- physical_size_mode = BLSURF_GlobalSize
+ physical_size_mode = MG_CADSURF_GlobalSize
self.Parameters().SetPhysicalMesh(physical_size_mode)
pass
## Sets a way to define maximum angular deflection of mesh from CAD model.
- # @param theGeometricMesh is: DefaultGeom (0)) or BLSURF_GlobalSize (1))
+ # @param theGeometricMesh is: DefaultGeom (0)) or MG_CADSURF_GlobalSize (1))
def SetGeometricMesh(self, theGeometricMesh=DefaultGeom):
geometric_size_mode = theGeometricMesh
if self.Parameters().GetPhysicalMesh() == DefaultSize:
if geometric_size_mode == DefaultGeom:
- geometric_size_mode = BLSURF_GlobalSize
+ geometric_size_mode = MG_CADSURF_GlobalSize
self.Parameters().SetGeometricMesh(geometric_size_mode)
pass
# @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
def SetPhySize(self, theVal, isRelative = False):
if self.Parameters().GetPhysicalMesh() == DefaultSize:
- self.SetPhysicalMesh(BLSURF_GlobalSize)
+ self.SetPhysicalMesh(MG_CADSURF_GlobalSize)
if isRelative:
self.Parameters().SetPhySizeRel(theVal)
else:
## Sets upper boundary of mesh element size.
# @param theVal : global maximal cell size desired.
# @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
- def SetMaxSize(self, theVal=-1):
+ def SetMaxSize(self, theVal=-1, isRelative = False):
if isRelative:
self.Parameters().SetMaxSizeRel(theVal)
else:
# @param theVal value of angular deflection
def SetAngleMesh(self, theVal=_geometric_approximation):
if self.Parameters().GetGeometricMesh() == DefaultGeom:
- self.SetGeometricMesh(BLSURF_GlobalSize)
+ self.SetGeometricMesh(MG_CADSURF_GlobalSize)
self.Parameters().SetAngleMesh(theVal)
pass
# <li>PreProcess or PreProcessPlus - by pre-processing a CAD model (OBSOLETE: FromCAD will be used)</li>
# <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
def SetTopology(self, way):
- if way != PreCAD:
+ if way != PreCAD and way != FromCAD:
print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way
way = FromCAD
self.Parameters().SetTopology(way)
self.SetTopology(PreCAD)
self.Parameters().SetPreCADOptionValue(optionName,optionValue)
pass
+
+ ## Adds custom advanced option value.
+ # @param optionName custom advanced option name
+ # @param level custom advanced option value
+ def AddOption(self, optionName, level):
+ self.Parameters().AddOption(optionName,level)
+ pass
+
+ ## Adds custom advanced PreCAD option value.
+ # @param optionName custom name of the option
+ # @param optionValue value of the option
+ def AddPreCADOption(self, optionName, optionValue):
+ if self.Parameters().GetTopology() != PreCAD:
+ self.SetTopology(PreCAD)
+ self.Parameters().AddPreCADOption(optionName,optionValue)
+ pass
## Sets GMF file for export at computation
# @param fileName GMF file name
## 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
def GetEnforcedVertices(self, theFace):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
return self.Parameters().GetEnforcedVertices(theFace)
# @param vertexName : name of the enforced vertex
# @param groupName : name of the group
def SetEnforcedVertex(self, theFace, x, y, z, vertexName = "", groupName = ""):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
if vertexName == "":
if groupName == "":
# @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
# @param groupName : name of the group
def SetEnforcedVertexGeom(self, theFace, theVertex, groupName = ""):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
AssureGeomPublished( self.mesh, theVertex )
if groupName == "":
# @param y : y coordinate
# @param z : z coordinate
def UnsetEnforcedVertex(self, theFace, x, y, z):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
return self.Parameters().UnsetEnforcedVertex(theFace, x, y, z)
# @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex
# @param theVertex : GEOM vertex (or group, compound) to remove.
def UnsetEnforcedVertexGeom(self, theFace, theVertex):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
AssureGeomPublished( self.mesh, theVertex )
return self.Parameters().UnsetEnforcedVertexGeom(theFace, theVertex)
## To remove all enforced vertices on a given face.
# @param theFace : face (or group/compound of faces) on which to remove all enforced vertices
def UnsetEnforcedVertices(self, theFace):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
return self.Parameters().UnsetEnforcedVertices(theFace)
# @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high)
# @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace
def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
AssureGeomPublished( self.mesh, theAttractor )
self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance)
## Unsets an attractor on the chosen face.
# @param theFace : face on which the attractor has to be removed
def UnsetAttractorGeom(self, theFace):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theFace )
self.Parameters().SetAttractorGeom(theFace)
pass
# @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
def SetSizeMap(self, theObject, theSizeMap):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theObject )
self.Parameters().SetSizeMap(theObject, theSizeMap)
pass
# @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
# @param theSizeMap : Size map defined as a double
def SetConstantSizeMap(self, theObject, theSizeMap):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theObject )
self.Parameters().SetConstantSizeMap(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
def UnsetSizeMap(self, theObject):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, theObject )
self.Parameters().UnsetSizeMap(theObject)
pass
# @return hypothesis object
def Parameters(self):
if not self.params:
- self.params = self.Hypothesis("BLSURF_Parameters", [],
- "libBLSURFEngine.so", UseExisting=0)
+ self.params = self.Hypothesis("MG-CADSurf Parameters", [],
+ LIBRARY, UseExisting=0)
pass
return self.params
## Define periodicity between two groups of edges, without faces, given a transformation function.
# This uses the basic BLSURF API for each edge and each vertex.
- # @param theFace1 : GEOM edge (or group, compound) to associate with theEdge2
- # @param theFace2 : GEOM edge (or group, compound) associated with theEdge1
+ # @param theEdge1 : GEOM edge (or group, compound) to associate with theEdge2
+ # @param theEdge2 : GEOM edge (or group, compound) associated with theEdge1
# @param f_transf : python function defining the transformation between an object of theEdge1
# into an object of theFace2
def AddAdvancedEdgesPeriodicity(self, theEdge1, theEdge2, f_transf):