From: michael Date: Sun, 13 Dec 2020 09:56:54 +0000 (+0100) Subject: Renamed script that generates the mesh of an hexagonal cavity X-Git-Tag: V9_7_0~97 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb87abd6f2b7ae7e446a1ef3e6d33575cb9d87ee;p=tools%2Fsolverlab.git Renamed script that generates the mesh of an hexagonal cavity --- diff --git a/CDMATH/tests/ressources/2DHexagonWithTriangles/HexagonMesh.py b/CDMATH/tests/ressources/2DHexagonWithTriangles/HexagonMesh.py new file mode 100644 index 0000000..70fc6e7 --- /dev/null +++ b/CDMATH/tests/ressources/2DHexagonWithTriangles/HexagonMesh.py @@ -0,0 +1,41 @@ +from __future__ import division + +from salome.geom import geomBuilder +from salome.smesh import smeshBuilder + +import sys +import os + +from math import pi, cos, sin + +geompy = geomBuilder.New() +smesh = smeshBuilder.New() + + +def create_group_from(name, mother_shape, list_elem, type="EDGE"): + new = geompy.CreateGroup(mother_shape, geompy.ShapeType[type]) + geompy.UnionList(new, list_elem) + new.SetName(name) + geompy.addToStudyInFather(mother_shape, new, name) + return new + + +r = 1. +NumberOfSegments = 200 + +points = [geompy.MakeVertex(r * cos(i * pi / 3), r * sin(i * pi / 3), 0) for i in range(7)] +edges = [geompy.MakeEdge(points[i], points[i + 1]) for i in range(6)] +wire = geompy.MakeWire(edges) +hexa = geompy.MakeFace(wire, True) +geompy.addToStudy(hexa, "Hexagon") +g = create_group_from("Hexagon_boundaries", hexa, [geompy.GetInPlace(hexa, wire, 1)]) + +mesh = smesh.Mesh(hexa, "Hexagon_mesh"+str(NumberOfSegments)) +msurf = mesh.Triangle(algo=smeshBuilder.NETGEN_1D2D) +NETGEN_2D_Simple_Parameters_1 = msurf.Parameters(smeshBuilder.SIMPLE) +NETGEN_2D_Simple_Parameters_1.SetNumberOfSegments( NumberOfSegments ) + +mesh.Group(g) + +mesh.Compute() +mesh.ExportMED("meshHexagonWithTriangles"+str(NumberOfSegments)+".med") diff --git a/CDMATH/tests/ressources/2DHexagonWithTriangles/hexa.py b/CDMATH/tests/ressources/2DHexagonWithTriangles/hexa.py deleted file mode 100644 index 133d676..0000000 --- a/CDMATH/tests/ressources/2DHexagonWithTriangles/hexa.py +++ /dev/null @@ -1,41 +0,0 @@ -from __future__ import division - -from salome.geom import geomBuilder -from salome.smesh import smeshBuilder - -import sys -import os - -from math import pi, cos, sin - -geompy = geomBuilder.New() -smesh = smeshBuilder.New() - - -def create_group_from(name, mother_shape, list_elem, type="EDGE"): - new = geompy.CreateGroup(mother_shape, geompy.ShapeType[type]) - geompy.UnionList(new, list_elem) - new.SetName(name) - geompy.addToStudyInFather(mother_shape, new, name) - return new - - -r = 1. -NumberOfSegments = 200 - -points = [geompy.MakeVertex(r * cos(i * pi / 3), r * sin(i * pi / 3), 0) for i in range(7)] -edges = [geompy.MakeEdge(points[i], points[i + 1]) for i in range(6)] -wire = geompy.MakeWire(edges) -hexa = geompy.MakeFace(wire, True) -geompy.addToStudy(hexa, "hexa") -g = create_group_from("boundaries", hexa, [geompy.GetInPlace(hexa, wire, 1)]) - -mesh = smesh.Mesh(hexa, "mesh") -msurf = mesh.Triangle(algo=smeshBuilder.NETGEN_1D2D) -NETGEN_2D_Simple_Parameters_1 = msurf.Parameters(smeshBuilder.SIMPLE) -NETGEN_2D_Simple_Parameters_1.SetNumberOfSegments( NumberOfSegments ) - -mesh.Group(g) - -mesh.Compute() -mesh.ExportMED("meshHexagonWithTriangles"+str(NumberOfSegments)+".med")