-# Public class: Mesh_Segment
-# --------------------------
-
-## Class to define a segment 1D algorithm for discretization
-#
-# More details.
-class Mesh_Segment(Mesh_Algorithm):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- self.Create(mesh, geom, "Regular_1D")
-
- ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
- # @param l for the length of segments that cut an edge
- def LocalLength(self, l):
- hyp = self.Hypothesis("LocalLength", [l])
- hyp.SetLength(l)
- return hyp
-
- ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
- # @param n for the number of segments that cut an edge
- # @param s for the scale factor (optional)
- def NumberOfSegments(self, n, s=[]):
- if s == []:
- hyp = self.Hypothesis("NumberOfSegments", [n])
- else:
- hyp = self.Hypothesis("NumberOfSegments", [n,s])
- hyp.SetDistrType( 1 )
- hyp.SetScaleFactor(s)
- hyp.SetNumberOfSegments(n)
- return hyp
-
- ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
- # @param start for the length of the first segment
- # @param end for the length of the last segment
- def Arithmetic1D(self, start, end):
- hyp = self.Hypothesis("Arithmetic1D", [start, end])
- hyp.SetLength(start, 1)
- hyp.SetLength(end , 0)
- return hyp
-
- ## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
- # @param start for the length of the first segment
- # @param end for the length of the last segment
- def StartEndLength(self, start, end):
- hyp = self.Hypothesis("StartEndLength", [start, end])
- hyp.SetLength(start, 1)
- hyp.SetLength(end , 0)
- return hyp
-
- ## Define "Deflection1D" hypothesis
- # @param d for the deflection
- def Deflection1D(self, d):
- hyp = self.Hypothesis("Deflection1D", [d])
- hyp.SetDeflection(d)
- return hyp
-
- ## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
- # the opposite side in the case of quadrangular faces
- def Propagation(self):
- return self.Hypothesis("Propagation")
-
- ## Define "AutomaticLength" hypothesis
- # @param fineness for the fineness [0-1]
- def AutomaticLength(self, fineness=0):
- hyp = self.Hypothesis("AutomaticLength")
- hyp.SetFineness( fineness )
- return hyp
-
- ## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
- # If the 2D mesher sees that all boundary edges are quadratic ones,
- # it generates quadratic faces, else it generates linear faces using
- # medium nodes as if they were vertex ones.
- # The 3D mesher generates quadratic volumes only if all boundary faces
- # are quadratic ones, else it fails.
- def QuadraticMesh(self):
- hyp = self.Hypothesis("QuadraticMesh")
- return hyp
-
-# Public class: Mesh_Segment_Python
-# ---------------------------------
-
-## Class to define a segment 1D algorithm for discretization with python function
-#
-# More details.
-class Mesh_Segment_Python(Mesh_Segment):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- import Python1dPlugin
- self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
-
- ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
- # @param n for the number of segments that cut an edge
- # @param func for the python function that calculate the length of all segments
- def PythonSplit1D(self, n, func):
- hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so")
- hyp.SetNumberOfSegments(n)
- hyp.SetPythonLog10RatioFunction(func)
- return hyp
-
-# Public class: Mesh_Triangle
-# ---------------------------
-
-## Class to define a triangle 2D algorithm
-#
-# More details.
-class Mesh_Triangle(Mesh_Algorithm):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- self.Create(mesh, geom, "MEFISTO_2D")
-
- ## Define "MaxElementArea" hypothesis to give the maximun area of each triangles
- # @param area for the maximum area of each triangles
- def MaxElementArea(self, area):
- hyp = self.Hypothesis("MaxElementArea", [area])
- hyp.SetMaxElementArea(area)
- return hyp
-
- ## Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
- def LengthFromEdges(self):
- return self.Hypothesis("LengthFromEdges")
-
-# Public class: Mesh_Quadrangle
-# -----------------------------
-
-## Class to define a quadrangle 2D algorithm
-#
-# More details.
-class Mesh_Quadrangle(Mesh_Algorithm):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- self.Create(mesh, geom, "Quadrangle_2D")
-
- ## Define "QuadranglePreference" hypothesis, forcing construction
- # of quadrangles if the number of nodes on opposite edges is not the same
- # in the case where the global number of nodes on edges is even
- def QuadranglePreference(self):
- hyp = self.Hypothesis("QuadranglePreference")
- return hyp
-
-# Public class: Mesh_Tetrahedron
-# ------------------------------
-
-## Class to define a tetrahedron 3D algorithm
-#
-# More details.
-class Mesh_Tetrahedron(Mesh_Algorithm):
-
- ## Private constructor.
- def __init__(self, mesh, algo, geom=0):
- if algo == NETGEN:
- self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
- elif algo == GHS3D:
- import GHS3DPlugin
- self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
-
- ## Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral
- # @param vol for the maximum volume of each tetrahedral
- def MaxElementVolume(self, vol):
- hyp = self.Hypothesis("MaxElementVolume", [vol])
- hyp.SetMaxElementVolume(vol)
- return hyp
-
-# Public class: Mesh_Hexahedron
-# ------------------------------
-
-## Class to define a hexahedron 3D algorithm
-#
-# More details.
-class Mesh_Hexahedron(Mesh_Algorithm):
-
- ## Private constructor.
- def __init__(self, mesh, geom=0):
- self.Create(mesh, geom, "Hexa_3D")
-
-# Public class: Mesh_Netgen
-# ------------------------------
-
-## Class to define a NETGEN-based 2D or 3D algorithm
-# that need no discrete boundary (i.e. independent)
-#
-# More details.
-class Mesh_Netgen(Mesh_Algorithm):
-
- is3D = 0
-
- ## Private constructor.
- def __init__(self, mesh, is3D, geom=0):
- self.is3D = is3D
- if is3D:
- self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
- else:
- self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
-
- ## Define hypothesis containing parameters of the algorithm
- def Parameters(self):
- if self.is3D:
- hyp = self.Hypothesis("NETGEN_Parameters", [], "libNETGENEngine.so")
- else:
- hyp = self.Hypothesis("NETGEN_Parameters_2D", [], "libNETGENEngine.so")
- return hyp
-
-# Public class: Mesh
-# ==================
-
-## Class to define a mesh
-#
-# More details.
-class Mesh:
-
- geom = 0
- mesh = 0