X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBLSURFPlugin%2FBLSURFPluginBuilder.py;h=f06850f72f37704dbb05219f267b802e8d198cc3;hb=0f2aa28809d72a7bc50330357e283ffbce742b8f;hp=7eb158f830b3633b871d1dca7b8708d80b89b7b2;hpb=ac0ed6b0fef55e276593e4c7afc4a4ba999cd82a;p=plugins%2Fblsurfplugin.git diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py index 7eb158f..f06850f 100644 --- a/src/BLSURFPlugin/BLSURFPluginBuilder.py +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2014 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 @@ -19,18 +19,20 @@ ## # @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 -# 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 @@ -52,9 +54,9 @@ 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): @@ -63,7 +65,7 @@ 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 algorithm for faces" @@ -83,29 +85,29 @@ class BLSURF_Algorithm(Mesh_Algorithm): 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 @@ -114,7 +116,7 @@ class BLSURF_Algorithm(Mesh_Algorithm): # @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: @@ -145,7 +147,7 @@ class BLSURF_Algorithm(Mesh_Algorithm): # @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 @@ -162,7 +164,7 @@ class BLSURF_Algorithm(Mesh_Algorithm): #
  • PreProcess or PreProcessPlus - by pre-processing a CAD model (OBSOLETE: FromCAD will be used)
  • #
  • PreCAD - by pre-processing with PreCAD a CAD model
  • 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) @@ -238,6 +240,22 @@ class BLSURF_Algorithm(Mesh_Algorithm): 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 @@ -432,7 +450,7 @@ class BLSURF_Algorithm(Mesh_Algorithm): def Parameters(self): if not self.params: self.params = self.Hypothesis("MG-CADSurf Parameters", [], - "libBLSURFEngine.so", UseExisting=0) + LIBRARY, UseExisting=0) pass return self.params @@ -566,8 +584,8 @@ class BLSURF_Algorithm(Mesh_Algorithm): ## 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):