Salome HOME
Copyright update 2022
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPluginBuilder.py
index 682a48f1fb7af420ef41501899443671f4ded44c..ed034ce3ab1785629c8dabe9ec06ae9f98d4e71b 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2022  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
@@ -141,48 +141,27 @@ class HYBRID_Algorithm(Mesh_Algorithm):
             self.SetLayersOnAllWrap( False )
         pass
 
-    """
-    obsolete
-    ## To mesh "holes" in a solid or not. Default is to mesh.
-    #  @param toMesh "mesh holes" flag value
-    def SetToMeshHoles(self, toMesh):
-        self.Parameters().SetToMeshHoles(toMesh)
-        pass
-
-    ## To make groups of volumes of different domains when mesh is generated from skin.
-    #  Default is to make groups.
-    # This option works only (1) for the mesh w/o shape and (2) if GetToMeshHoles() == true
-    #  @param toMesh "mesh holes" flag value
-    def SetToMakeGroupsOfDomains(self, toMakeGroups):
-        self.Parameters().SetToMakeGroupsOfDomains(toMakeGroups)
-        pass
-
-    ## Set Optimization level:
-    #  @param level optimization level, one of the following values
-    #  - None_Optimization
-    #  - Light_Optimization
-    #  - Standard_Optimization
-    #  - StandardPlus_Optimization
-    #  - Strong_Optimization.
-    #  .
-    #  Default is Standard_Optimization
-    def SetOptimizationLevel(self, level):
-        self.Parameters().SetOptimizationLevel(level)
-        pass
-
-    ## Set maximal size of memory to be used by the algorithm (in Megabytes).
-    #  @param MB maximal size of memory
-    def SetMaximumMemory(self, MB):
-        self.Parameters().SetMaximumMemory(MB)
-        pass
-
-    ## Set initial size of memory to be used by the algorithm (in Megabytes) in
-    #  automatic memory adjustment mode.
-    #  @param MB initial size of memory
-    def SetInitialMemory(self, MB):
-        self.Parameters().SetInitialMemory(MB)
+    ## To snap the layers on given surface (use existing surface layers as base for volume layers).
+    #  @param faceIDs faces or face IDs that already have surface layers
+    def SetFacesWithSnapping(self, faceIDs):
+        import GEOM
+        ids = []
+        if not isinstance( faceIDs, list ) and not isinstance( faceIDs, tuple ):
+            faceIDs = [ faceIDs ]
+        for fid in faceIDs:
+            if isinstance( fid, int ):
+                ids.append( fid )
+            elif isinstance( fid, GEOM._objref_GEOM_Object):
+                faces = self.mesh.geompyD.SubShapeAll( fid, self.mesh.geompyD.ShapeType["FACE"])
+                for f in faces:
+                    ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
+            else:
+                raise TypeError("Face should be either ID or GEOM_Object, not %s" % type(fid))
+            pass
+        self.Parameters().SetFacesWithSnapping(ids)
+        if ids:
+            self.SetLayersOnAllWrap( False )
         pass
-    """
 
     ## Set Collision Mode:
     #  @param mode Collision Mode, one of the following values
@@ -236,6 +215,12 @@ class HYBRID_Algorithm(Mesh_Algorithm):
         self.Parameters().SetHeightFirstLayer(heightFirstLayer)
         pass
 
+    ## Sizes of boundary layers are relative to the surface size. Default no
+    #  @param isRelative boolean flag
+    def SetHeightIsRelative(self, isRelative):
+        self.Parameters().SetHeightIsRelative( isRelative )
+        pass
+
     ## To set boundary layers coefficient of geometric progression.
     # Default is 1.0
     # @param boundaryLayersProgression double value
@@ -264,6 +249,12 @@ class HYBRID_Algorithm(Mesh_Algorithm):
         self.Parameters().SetNbOfBoundaryLayers(nbOfBoundaryLayers)
         pass
 
+    ## Set maximum internal angles of boundary elements (in degree)
+    #  @param angle angle in degree
+    def SetBoundaryLayersMaxElemAngle(self, angle):
+        self.Parameters().SetBoundaryLayersMaxElemAngle( angle )
+        pass
+
     ## Set path to working directory.
     #  @param path working directory
     def SetWorkingDirectory(self, path):
@@ -400,18 +391,25 @@ class HYBRID_Algorithm(Mesh_Algorithm):
             pass
         pass
 
+    ## Set advanced option value
+    #  @param optionName option name
+    #  @param optionValue option value
+    def SetOptionValue(self, optionName, optionValue):
+        self.Parameters().SetOptionValue( optionName, optionValue )
+        pass
+
     ## Sets command line option as text.
-    #
-    # OBSOLETE. Use SetAdvancedOption()
-    #  @param option command line option
-    def SetTextOption(self, option):
-        self.Parameters().SetAdvancedOption(option)
+    #  @param optionAndValue command line option in a form "option value"
+    def SetAdvancedOption(self, optionAndValue):
+        self.Parameters().SetAdvancedOption(optionAndValue)
         pass
     
     ## Sets command line option as text.
+    #
+    # OBSOLETE. Use SetAdvancedOption()
     #  @param option command line option
-    def SetAdvancedOption(self, option):
+    def SetTextOption(self, option):
         self.Parameters().SetAdvancedOption(option)
         pass
-    
+   
     pass # end of HYBRID_Algorithm class