--- /dev/null
+#!/usr/bin/env python\r
+# -*- coding: utf-8 -*-\r
+"""\r
+Test000\r
+Checks the availability of the external plugins :\r
+ 1 NETGENPLUGIN\r
+ 2 GMSHPLUGIN\r
+ 3 MG-CADSURF (BLSURFPLUGIN)\r
+ 4 MG-TETRA (GHS3DPLUGIN)\r
+ 5 MG-HEXA (HEXOTICPLUGIN)\r
+ 6 MG-HYBRID (HYBRIDPLUGIN)\r
+ 7 MG-TETRA-PARALLELE (GHS3DPRLPLUGIN)\r
+Copyright EDF R&D 2017\r
+"""\r
+__revision__ = "V1.0"\r
+#\r
+# Computation of the meshes: T/F\r
+ComputeMeshes = True\r
+\r
+import salome\r
+\r
+salome.salome_init()\r
+theStudy = salome.myStudy\r
+#\r
+import iparameters\r
+IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))\r
+\r
+# fill list AP_MODULES_LIST\r
+IPAR.append("AP_MODULES_LIST", "Geometry")\r
+IPAR.append("AP_MODULES_LIST", "Mesh")\r
+\r
+ERROR = 0\r
+MESSAGE = ""\r
+#\r
+while not ERROR :\r
+\r
+###\r
+### A. GEOM component\r
+###\r
+ import GEOM\r
+ from salome.geom import geomBuilder\r
+ geompy = geomBuilder.New(theStudy)\r
+ O = geompy.MakeVertex(0, 0, 0, "0")\r
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0, "OX")\r
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0, "OY")\r
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1, "OZ")\r
+ BOX = geompy.MakeBoxDXDYDZ(200, 200, 200, "BOX")\r
+\r
+###\r
+### B. SMESH component\r
+###\r
+\r
+ import SMESH\r
+ from salome.smesh import smeshBuilder\r
+\r
+ smesh = smeshBuilder.New(theStudy)\r
+\r
+# B.1. NETGEN\r
+ TEXTE = "NETGEN_1D2D3D"\r
+ MESH_1 = smesh.Mesh(BOX)\r
+ smesh.SetName(MESH_1.GetMesh(), "M_"+TEXTE)\r
+ try :\r
+ NETGEN_2D3D = MESH_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D)\r
+ except :\r
+ MESSAGE += "\nImpossible d'utiliser "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ if ComputeMeshes :\r
+ smesh.SetName(NETGEN_2D3D.GetAlgorithm(), TEXTE)\r
+ OK_COMPUTE = MESH_1.Compute()\r
+ if not OK_COMPUTE :\r
+ MESSAGE += "\nErreur avec "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ print TEXTE+": OK"\r
+\r
+# B.2. Gmsh\r
+ TEXTE = "Gmsh"\r
+ MESH_2 = smesh.Mesh(BOX)\r
+ smesh.SetName(MESH_2.GetMesh(), "M_"+TEXTE)\r
+ try :\r
+ GMSH = MESH_2.Tetrahedron(algo=smeshBuilder.GMSH)\r
+ except :\r
+ MESSAGE += "\nImpossible d'utiliser "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ if ComputeMeshes :\r
+ smesh.SetName(GMSH.GetAlgorithm(), TEXTE)\r
+ OK_COMPUTE = MESH_2.Compute()\r
+ if not OK_COMPUTE :\r
+ MESSAGE += "\nErreur avec "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ print TEXTE+": OK"\r
+\r
+# B.3. MG_CADSurf\r
+ TEXTE = "MG_CADSurf"\r
+ MESH_3 = smesh.Mesh(BOX)\r
+ smesh.SetName(MESH_3.GetMesh(), "M_"+TEXTE)\r
+ try :\r
+ MG_CADSurf = MESH_3.Triangle(algo=smeshBuilder.MG_CADSurf)\r
+ except :\r
+ MESSAGE += "\nImpossible d'utiliser "+TEXTE\r
+ ERROR += 1\r
+# On arrete tout en cas de problème car les suivants en dépendent\r
+ break\r
+ else :\r
+ if ComputeMeshes :\r
+ smesh.SetName(MG_CADSurf.GetAlgorithm(), TEXTE)\r
+ OK_COMPUTE = MESH_3.Compute()\r
+ if not OK_COMPUTE :\r
+ MESSAGE += "\nErreur avec "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ print TEXTE+": OK"\r
+\r
+# B.4. MG_Tetra\r
+ TEXTE = "MG_Tetra"\r
+ MESH_4 = smesh.Mesh(BOX)\r
+ smesh.SetName(MESH_4.GetMesh(), "M_"+TEXTE)\r
+ MG_CADSurf_Te = MESH_4.Triangle(algo=smeshBuilder.MG_CADSurf)\r
+ try :\r
+ MG_Tetra = MESH_4.Tetrahedron(algo=smeshBuilder.MG_Tetra)\r
+ except :\r
+ MESSAGE += "\nImpossible d'utiliser "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ if ComputeMeshes :\r
+ smesh.SetName(MG_Tetra.GetAlgorithm(), TEXTE)\r
+ OK_COMPUTE = MESH_4.Compute()\r
+ if not OK_COMPUTE :\r
+ MESSAGE += "\nErreur avec "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ print TEXTE+": OK"\r
+\r
+# B.5. MG_Hexa\r
+ TEXTE = "MG_Hexa"\r
+ MESH_5 = smesh.Mesh(BOX)\r
+ smesh.SetName(MESH_5.GetMesh(), "M_"+TEXTE)\r
+ MG_CADSurf_He = MESH_5.Triangle(algo=smeshBuilder.MG_CADSurf)\r
+ try :\r
+ MG_Hexa = MESH_5.Hexahedron(algo=smeshBuilder.MG_Hexa)\r
+ except :\r
+ MESSAGE += "\nImpossible d'utiliser "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ if ComputeMeshes :\r
+ smesh.SetName(MG_Hexa.GetAlgorithm(), TEXTE)\r
+ OK_COMPUTE = MESH_5.Compute()\r
+ if not OK_COMPUTE :\r
+ MESSAGE += "\nErreur avec "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ print TEXTE+": OK"\r
+\r
+# B.6. MG_Hybrid\r
+ TEXTE = "MG_Hybrid"\r
+ MESH_6 = smesh.Mesh(BOX)\r
+ smesh.SetName(MESH_6.GetMesh(), "M_"+TEXTE)\r
+ MG_CADSurf_Hy = MESH_6.Triangle(algo=smeshBuilder.MG_CADSurf)\r
+ try :\r
+ MG_Hybrid = MESH_6.Tetrahedron(algo=smeshBuilder.HYBRID)\r
+ except :\r
+ MESSAGE += "\nImpossible d'utiliser "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ if ComputeMeshes :\r
+ smesh.SetName(MG_Hybrid.GetAlgorithm(), TEXTE)\r
+ OK_COMPUTE = MESH_6.Compute()\r
+ if not OK_COMPUTE :\r
+ MESSAGE += "\nErreur avec "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ print TEXTE+": OK"\r
+\r
+# B.7. MG_Tetra_Parallel\r
+ TEXTE = "MG_Tetra_Parallel"\r
+ MESH_7 = smesh.Mesh(BOX)\r
+ smesh.SetName(MESH_7.GetMesh(), "M_"+TEXTE)\r
+ MG_CADSurf_Tp = MESH_7.Triangle(algo=smeshBuilder.MG_CADSurf)\r
+ try :\r
+ MG_Tetra_Parallel = MESH_7.Tetrahedron(algo=smeshBuilder.MG_Tetra_Parallel)\r
+ except :\r
+ MESSAGE += "\nImpossible d'utiliser "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ if ComputeMeshes :\r
+ smesh.SetName(MG_Tetra_Parallel.GetAlgorithm(), TEXTE)\r
+ OK_COMPUTE = MESH_7.Compute()\r
+ if not OK_COMPUTE :\r
+ MESSAGE += "\nErreur avec "+TEXTE\r
+ ERROR += 1\r
+ else :\r
+ print TEXTE+": OK"\r
+\r
+ break\r
+\r
+###\r
+### C. End\r
+###\r
+if ERROR :\r
+ raise Exception("\n\nNombre d'erreurs : %d" % ERROR + MESSAGE + "\n")\r
+else :\r
+ print "\nAucun problème\n"\r
+\r