diff --git a/src/Mod/Fem/femmesh/gmshtools.py b/src/Mod/Fem/femmesh/gmshtools.py index 801104de94..d77260b4cf 100644 --- a/src/Mod/Fem/femmesh/gmshtools.py +++ b/src/Mod/Fem/femmesh/gmshtools.py @@ -125,6 +125,19 @@ class GmshTools(): else: self.algorithm3D = "1" + # RecombinationAlgorithm + algoRecombo = self.mesh_obj.RecombinationAlgorithm + if algoRecombo == "Simple": + self.RecombinationAlgorithm = "0" + elif algoRecombo == "Blossom": + self.RecombinationAlgorithm = "1" + elif algoRecombo == "Simple full-quad": + self.RecombinationAlgorithm = "2" + elif algoRecombo == "Blossom full-quad": + self.RecombinationAlgorithm = "3" + else: + self.algoRecombo = "0" + # HighOrderOptimize optimizers = self.mesh_obj.HighOrderOptimize if optimizers == "None": @@ -766,8 +779,15 @@ class GmshTools(): ) geo.write("\n") if hasattr(self.mesh_obj, "RecombineAll") and self.mesh_obj.RecombineAll is True: - geo.write("// other mesh options\n") + geo.write("// recombination for surfaces\n") geo.write("Mesh.RecombineAll = 1;\n") + if hasattr(self.mesh_obj, "Recombine3DAll") and self.mesh_obj.Recombine3DAll is True: + geo.write("// recombination for volumes\n") + geo.write("Mesh.Recombine3DAll = 1;\n") + if ( (hasattr(self.mesh_obj, "RecombineAll") and self.mesh_obj.RecombineAll is True) + or (hasattr(self.mesh_obj, "Recombine3DAll") and self.mesh_obj.Recombine3DAll is True)): + geo.write("// recombination algorithm\n") + geo.write("Mesh.RecombinationAlgorithm = " + self.RecombinationAlgorithm + ";\n") geo.write("\n") geo.write("// optimize the mesh\n") diff --git a/src/Mod/Fem/femobjects/mesh_gmsh.py b/src/Mod/Fem/femobjects/mesh_gmsh.py index cc1167a0b8..9feeef7737 100644 --- a/src/Mod/Fem/femobjects/mesh_gmsh.py +++ b/src/Mod/Fem/femobjects/mesh_gmsh.py @@ -60,6 +60,12 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject): "R-tree", "HXT" ] + known_mesh_RecombinationAlgorithms = [ + "Simple", + "Blossom", + "Simple full-quad", + "Blossom full-quad" + ] known_mesh_HighOrderOptimizers = [ "None", "Optimization", @@ -169,7 +175,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject): "App::PropertyBool", "OptimizeStd", "FEM Gmsh Mesh Params", - "Optimize tetra elements" + "Optimize tetrahedral elements" ) obj.OptimizeStd = True @@ -201,6 +207,25 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject): ) obj.RecombineAll = False + if not hasattr(obj, "Recombine3DAll"): + obj.addProperty( + "App::PropertyBool", + "Recombine3DAll", + "FEM Gmsh Mesh Params", + "Apply recombination algorithm to all volumes" + ) + obj.Recombine3DAll = False + + if not hasattr(obj, "RecombinationAlgorithm"): + obj.addProperty( + "App::PropertyEnumeration", + "RecombinationAlgorithm", + "FEM Gmsh Mesh Params", + "Recombination algorithm" + ) + obj.RecombinationAlgorithm = MeshGmsh.known_mesh_RecombinationAlgorithms + obj.RecombinationAlgorithm = "Simple" + if not hasattr(obj, "CoherenceMesh"): obj.addProperty( "App::PropertyBool",