]> SALOME platform Git repositories - plugins/ghs3dprlplugin.git/commitdiff
Salome HOME
comment examples/ghs3dprh_multithread_cube_one_face.py cvw/fix_for_7927
authorChristian Van Wambeke <christian.van-wambeke@cea.fr>
Wed, 26 Feb 2020 09:51:29 +0000 (10:51 +0100)
committerChristian Van Wambeke <christian.van-wambeke@cea.fr>
Wed, 26 Feb 2020 09:51:29 +0000 (10:51 +0100)
example/ghs3dprh_multithread_cube_one_face.py [deleted file]
examples/ghs3dprh_multithread_cube_one_face.py [new file with mode: 0644]

diff --git a/example/ghs3dprh_multithread_cube_one_face.py b/example/ghs3dprh_multithread_cube_one_face.py
deleted file mode 100644 (file)
index 5899c3a..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/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()
diff --git a/examples/ghs3dprh_multithread_cube_one_face.py b/examples/ghs3dprh_multithread_cube_one_face.py
new file mode 100644 (file)
index 0000000..27f72f8
--- /dev/null
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+
+"""
+| usage:
+| salome/File/Load_script ${GHS3DPRLPLUGIN_ROOT_DIR}/example
+|
+| result should be a tetrahedric meshed cube with one group of faces named Group_1
+| - with .SetMultithread(0) in 4 files med
+|   with mg-tetra_hpc.exe mpi results files are in /tmp/DOMAIN_*.med
+| - with .SetMultithread(1) in 1 file med
+|   with mg-tetra_hpc.exe multithread result files are in /tmp/DOMAIN_1.med
+"""
+
+###
+### 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'...')
+
+
+###
+### 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 ) # MPI: 4 files, Multithread: 4 threads
+MG_Tetra_HPC_Parameters_1.SetKeepFiles( 1 )
+MG_Tetra_HPC_Parameters_1.SetBackground( 0 )
+# Multithread: have to load only one file DOMAIN_1.med
+# MPI: have to load 4 file DOMAIN_1.med -> DOMAIN_4.med
+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()