# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2014 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
Layer_Growth_Inward, Layer_Growth_Outward = 0,1
# Mesh with element type Tetra Dominant or hexa Dominant in the remaining volume (outside layers).
-Generation_Tetra_Dominant, Generation_Hexa_Dominant = 0,1
+Generation_Tetra_Dominant, Generation_Hexa_Dominant, Generation_Cartesian_Core = 0,1,2
#----------------------------
# Mesh algo type identifiers
#----------------------------
## Algorithm type: HYBRID tetra-hexahedron 3D algorithm, see HYBRID_Algorithm
-HYBRID = "HYBRID_3D"
+MG_Hybrid = "HYBRID_3D"
+HYBRID = MG_Hybrid
-## Tetrahedron HYBRID 3D algorithm
+## MG-Hybrid 3D algorithm
#
# It can be created by calling smeshBuilder.Mesh.Tetrahedron( smeshBuilder.HYBRID, geom=0 )
class HYBRID_Algorithm(Mesh_Algorithm):
meshMethod = "Tetrahedron"
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
- algoType = HYBRID
+ algoType = MG_Hybrid
## doc string of the method in smeshBuilder.Mesh class
# @internal
docHelper = "Creates tetrahedron 3D algorithm for volumes"
# if it is @c 0 (default), the algorithm is assigned to the main shape
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
- if noHYBRIDPlugin: print "Warning: HYBRIDPlugin module unavailable"
+ if noHYBRIDPlugin: print("Warning: HYBRIDPlugin module unavailable")
self.Create(mesh, geom, self.algoType, "libHYBRIDEngine.so")
self.params = None
pass
self.Parameters().SetLayersOnAllWrap(toMesh)
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)
+ ## To mesh layers on given faces.
+ # @param faceIDs faces or face IDs to construct boundary layers on
+ def SetFacesWithLayers(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().SetFacesWithLayers(ids)
+ if ids:
+ self.SetLayersOnAllWrap( False )
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)
+ ## To imprint the layers on given faces.
+ # @param faceIDs faces or face IDs to imprint the boundary layers on
+ def SetFacesWithImprinting(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().SetFacesWithImprinting(ids)
+ if ids:
+ self.SetLayersOnAllWrap( False )
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
# @param mode, one of the following values
# - Generation_Tetra_Dominant
# - Generation_Hexa_Dominant
+ # - Generation_Cartesian_Core
# .
# Default is Generation_Tetra_Dominant
def SetElementGeneration(self, mode):
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
self.Parameters().SetBoundaryLayersProgression(boundaryLayersProgression)
pass
+ ## Set core elements size.
+ # Default is 0.0
+ # @param CoreSize double value
+ def SetCoreSize(self, CoreSize):
+ self.Parameters().SetCoreSize(CoreSize)
+ pass
+
## To set multinormals angle threshold at opening ridges.
# Default is 30.0
# @param multinormalsAngle double value
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):
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.
+ # @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 SetTextOption(self, option):
- self.Parameters().SetTextOption(option)
+ self.Parameters().SetAdvancedOption(option)
pass
-
+
pass # end of HYBRID_Algorithm class