X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=example%2Fghs3dprh_multithread_cube_one_face.py;fp=example%2Fghs3dprh_multithread_cube_one_face.py;h=5899c3a04970482de29a6f3e3e6cb83db7adfea6;hb=f2dd979943d3ec1026c73a9927f2b429002de4fa;hp=0000000000000000000000000000000000000000;hpb=e4fe9f86f4133e4010eecc123184cd1939615406;p=plugins%2Fghs3dprlplugin.git diff --git a/example/ghs3dprh_multithread_cube_one_face.py b/example/ghs3dprh_multithread_cube_one_face.py new file mode 100644 index 0000000..5899c3a --- /dev/null +++ b/example/ghs3dprh_multithread_cube_one_face.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python + +### +### This file is generated automatically by SALOME v9.4.0 with dump python functionality +### + +import sys +import salome + +salome.salome_init() +import salome_notebook +notebook = salome_notebook.NoteBook() +sys.path.insert(0, r'/volatile2/wambeke/SALOME-master-CO7-SRC') + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New() + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"]) +geompy.UnionIDs(Group_1, [13]) +[Group_1] = geompy.GetExistingSubObjects(Box_1, False) +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudyInFather( Box_1, Group_1, 'Group_1' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New() +#smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations: + # multiples meshes built in parallel, complex and numerous mesh edition (performance) + +Mesh_1 = smesh.Mesh(Box_1) +NETGEN_1D_2D = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_1D2D) +NETGEN_2D_Simple_Parameters_1 = NETGEN_1D_2D.Parameters(smeshBuilder.SIMPLE) +NETGEN_2D_Simple_Parameters_1.SetNumberOfSegments( 8 ) +NETGEN_2D_Simple_Parameters_1.SetMaxElementArea( 1200 ) +NETGEN_2D_Simple_Parameters_1.SetAllowQuadrangles( 0 ) +MG_Tetra_HPC = Mesh_1.Tetrahedron(algo=smeshBuilder.MG_Tetra_Parallel) +MG_Tetra_HPC_Parameters_1 = MG_Tetra_HPC.Parameters() +MG_Tetra_HPC_Parameters_1.SetMEDName( 'DOMAIN' ) +MG_Tetra_HPC_Parameters_1.SetNbPart( 4 ) +MG_Tetra_HPC_Parameters_1.SetKeepFiles( 1 ) +MG_Tetra_HPC_Parameters_1.SetBackground( 0 ) +MG_Tetra_HPC_Parameters_1.SetMultithread( 1 ) +MG_Tetra_HPC_Parameters_1.SetGradation( 1.05 ) +MG_Tetra_HPC_Parameters_1.SetMinSize( 0 ) +MG_Tetra_HPC_Parameters_1.SetMaxSize( 0 ) +Group_1_1 = Mesh_1.GroupOnGeom(Group_1,'Group_1',SMESH.FACE) +isDone = Mesh_1.Compute() +[ Group_1_1 ] = Mesh_1.GetGroups() +([SKIN_INITIAL], status) = smesh.CreateMeshesFromMED(r'/tmp/DOMAIN_skin.med') +[ Group_1_2, Group_Of_All_Faces, Group_Of_All_Edges, Group_Of_All_Nodes ] = SKIN_INITIAL.GetGroups() +([DOMAIN_1], status) = smesh.CreateMeshesFromMED(r'/tmp/DOMAIN_1.med') +[ All_Faces, Group_1_3, Skin_Group_Of_All_Faces, New_Tetrahedra, All_Nodes, New_Nodes ] = DOMAIN_1.GetGroups() + + +## Set names of Mesh objects +smesh.SetName(Group_Of_All_Edges, 'Group_Of_All_Edges') +smesh.SetName(All_Nodes, 'All_Nodes') +smesh.SetName(New_Nodes, 'New_Nodes') +smesh.SetName(NETGEN_1D_2D.GetAlgorithm(), 'NETGEN 1D-2D') +smesh.SetName(MG_Tetra_HPC.GetAlgorithm(), 'MG-Tetra_HPC') +smesh.SetName(Group_Of_All_Nodes, 'Group_Of_All_Nodes') +smesh.SetName(MG_Tetra_HPC_Parameters_1, 'MG-Tetra_HPC Parameters_1') +smesh.SetName(NETGEN_2D_Simple_Parameters_1, 'NETGEN 2D Simple Parameters_1') +smesh.SetName(Group_1_1, 'Group_1') +smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') +smesh.SetName(DOMAIN_1.GetMesh(), 'DOMAIN_1') +smesh.SetName(SKIN_INITIAL.GetMesh(), 'SKIN_INITIAL') +smesh.SetName(New_Tetrahedra, 'New_Tetrahedra') +smesh.SetName(Group_1_3, 'Group_1') +smesh.SetName(Skin_Group_Of_All_Faces, 'Skin_Group_Of_All_Faces') +smesh.SetName(All_Faces, 'All_Faces') +smesh.SetName(Group_Of_All_Faces, 'Group_Of_All_Faces') +smesh.SetName(Group_1_2, 'Group_1') + + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser()