X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBLSURFPlugin%2FBLSURFPluginBuilder.py;h=f0a9a757b456659b1ea057eacdb035abb6934b1b;hb=6063373ca22880b042a7a09aa30fd83fe2582130;hp=19b197b59cd5f4b9695b53792967fb41315b570f;hpb=39a511ecf82c16aaf62f33ed709f8aa032e2a639;p=plugins%2Fblsurfplugin.git diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py index 19b197b..f0a9a75 100644 --- a/src/BLSURFPlugin/BLSURFPluginBuilder.py +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2016 CEA/DEN, EDF R&D +# Copyright (C) 2007-2023 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 @@ -42,6 +42,8 @@ BLSURF_Custom, BLSURF_GlobalSize, BLSURF_LocalSize = MG_CADSURF_Custom, MG_CADSU noBLSURFPlugin = 0 try: import BLSURFPlugin + from BLSURFPlugin import MG_EnforcedMesh1D + except ImportError: noBLSURFPlugin = 1 pass @@ -198,16 +200,50 @@ class BLSURF_Algorithm(Mesh_Algorithm): self.Parameters().SetTopology(way) pass - ## To respect geometrical edges or not. - # @param toIgnoreEdges "ignore edges" flag value - def SetDecimesh(self, toIgnoreEdges=False): - if toIgnoreEdges: - self.SetOptionValue("respect_geometry","0") - else: - self.SetOptionValue("respect_geometry","1") - pass + ## Activate/deactivate surface proximity computation + # @param toUse boolean flag + # + def SetSurfaceProximity(self, toUse ): + self.Parameters().SetSurfaceProximity(toUse) + return + + ## Set number of surface element layers to be generated due to surface proximity + # @param nbLayers number of layers + # + def SetNbSurfaceProximityLayers(self, nbLayers ): + self.Parameters().SetNbSurfaceProximityLayers( nbLayers ) + return - ## Sets verbosity level in the range 0 to 100. + ## Set coefficient by which size of element refined due to surface proximity is increased + # @param ratio proximity coefficient + # + def SetSurfaceProximityRatio(self, ratio ): + self.Parameters().SetSurfaceProximityRatio(ratio) + return + + ## Activate/deactivate volume proximity computation + # @param toUse boolean flag + # + def SetVolumeProximity(self, toUse ): + self.Parameters().SetVolumeProximity(toUse) + return + + ## Set number of surface element layers to be generated due to volume proximity + # @param nbLayers number of layers + # + def SetNbVolumeProximityLayers(self, nbLayers ): + self.Parameters().SetNbVolumeProximityLayers(nbLayers) + return + + ## Set coefficient by which size of element refined due to volume proximity is increased + # @param ratio proximity coefficient + # + def SetVolumeProximityRatio(self, ratio ): + self.Parameters().SetVolumeProximityRatio(ratio) + return + + + ## Sets verbosity level in the range 0 to 10. # @param level verbosity level def SetVerbosity(self, level): self.Parameters().SetVerbosity(level) @@ -220,6 +256,8 @@ class BLSURF_Algorithm(Mesh_Algorithm): # combination with the gradation option. # def SetEnforceCadEdgesSize( self, toEnforce ): + if not version_less(self.Parameters().GetMeshGemsVersion(), '2.10'): + print("Warning: method SetEnforceCadEdgesSize() is deprecated") self.Parameters().SetEnforceCadEdgesSize( toEnforce ) ## Set jacobian_rectification_respect_geometry parameter @@ -260,6 +298,8 @@ class BLSURF_Algorithm(Mesh_Algorithm): # can set this parameter to 0 # def SetMaxNumberOfPointsPerPatch( self, nb ): + if not version_less(self.Parameters().GetMeshGemsVersion(), '2.10'): + print("Warning: method SetMaxNumberOfPointsPerPatch() is deprecated") self.Parameters().SetMaxNumberOfPointsPerPatch( nb ) ## Set max_number_of_threads parameter @@ -342,6 +382,28 @@ class BLSURF_Algorithm(Mesh_Algorithm): def SetTags( self, howToTreat ): self.Parameters().SetTags( howToTreat ) + ## Activate/deactivate fully patch independent meshing + # @param isIndependent boolean flag + # + # This feature can only be used if the @a tags parameter is set to "respect". + # By default this option deactivated. + # + def SetPatchIndependent( self, isIndependent ): + self.SetOptionValue( "allow_patch_independent", "yes" if isIndependent else "no" ) + + ## Set to preserve lines defined by a sharp angle in the input discrete geometry + # @param toCompute boolean flag + # + # If this option is deactivated, MeshGems-CADSurf will not try to preserve lines + # defined by a sharp angle in the input discrete geometry. Only input ridges, free + # edges, non manifold edges and separation betwen zones with different attributes + # will be respected (if tags is set to respect). + # By default this option activated. + # + def SetComputeRidges( self, toCompute ): + self.SetOptionValue( "compute_ridges", "yes" if toCompute else "no" ) + + ## Activate removal of the tiny edges from the generated # mesh when it improves the local mesh quality, without taking into account the # tags (attributes) specifications. @@ -592,6 +654,21 @@ class BLSURF_Algorithm(Mesh_Algorithm): def GetInternalEnforcedVertexAllFacesGroup(self): return self.Parameters().GetInternalEnforcedVertexAllFacesGroup() + #----------------------------------------- + # Enforced mesh + #----------------------------------------- + + ## Set enforced 1D meshes + # @param enfMeshes : list of smeshBuilder.MG_EnforcedMesh1D structures + # + # Example: cadsurf.SetEnforcedMeshes([ smeshBuilder.MG_EnforcedMesh1D( mesh1D, "Group 1D")] + def SetEnforcedMeshes( self, enfMeshes ): + from salome.smesh.smeshBuilder import Mesh + for em in enfMeshes: + if isinstance( em.mesh, Mesh ): + em.mesh = em.mesh.GetMesh() + return self.Parameters().SetEnforcedMeshes( enfMeshes ) + #----------------------------------------- # Attractors #----------------------------------------- @@ -754,66 +831,8 @@ class BLSURF_Algorithm(Mesh_Algorithm): self.Parameters().SetHyperPatches( hpl ) return - #===================== - # Obsolete methods - #===================== - # - # SALOME 6.6.0 - # - - ## Sets lower boundary of mesh element size (PhySize). - def SetPhyMin(self, theVal=-1): - """ - Obsolete function. Use SetMinSize. - """ - print("Warning: SetPhyMin is obsolete. Please use SetMinSize") - self.SetMinSize(theVal) - pass - - ## Sets upper boundary of mesh element size (PhySize). - def SetPhyMax(self, theVal=-1): - """ - Obsolete function. Use SetMaxSize. - """ - print("Warning: SetPhyMax is obsolete. Please use SetMaxSize") - self.SetMaxSize(theVal) - pass - - ## Sets angular deflection (in degrees) of a mesh face from CAD surface. - def SetAngleMeshS(self, theVal=_geometric_approximation): - """ - Obsolete function. Use SetAngleMesh. - """ - print("Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh") - self.SetAngleMesh(theVal) - pass - - ## Sets angular deflection (in degrees) of a mesh edge from CAD curve. - def SetAngleMeshC(self, theVal=_geometric_approximation): - """ - Obsolete function. Use SetAngleMesh. - """ - print("Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh") - self.SetAngleMesh(theVal) - pass - - ## Sets lower boundary of mesh element size computed to respect angular deflection. - def SetGeoMin(self, theVal=-1): - """ - Obsolete function. Use SetMinSize. - """ - print("Warning: SetGeoMin is obsolete. Please use SetMinSize") - self.SetMinSize(theVal) - pass - - ## Sets upper boundary of mesh element size computed to respect angular deflection. - def SetGeoMax(self, theVal=-1): - """ - Obsolete function. Use SetMaxSize. - """ - print("Warning: SetGeoMax is obsolete. Please use SetMaxSize") - self.SetMaxSize(theVal) - pass - - pass # end of BLSURF_Algorithm class + +def version_less(version: str, ref_version: str): + from re import split + return [int(i) for i in split('[.-]', version)] < [int(i) for i in re.split('[.-]', ref_version)]