From: Frederic Pons Date: Tue, 21 Feb 2023 13:59:44 +0000 (+0100) Subject: Check result of Compute() in test X-Git-Tag: V9_11_0a1~10^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7fe1146f763ec80776fca02aac97bec8c3997b87;p=modules%2Fsmesh.git Check result of Compute() in test --- diff --git a/test/PAL_MESH_041_mesh.py b/test/PAL_MESH_041_mesh.py index 48ad9342f..9c486e840 100644 --- a/test/PAL_MESH_041_mesh.py +++ b/test/PAL_MESH_041_mesh.py @@ -100,8 +100,11 @@ smesh.SetName(hypArea200, "Max. Element Area") print("---------------------Compute the mesh") -ret = mesh.Compute() -print(ret) +isDone = mesh.Compute() +print(isDone) +if not isDone: + raise Exception("Error when computing Mesh") + salome.sg.updateObjBrowser() diff --git a/test/PAL_MESH_043_2D.py b/test/PAL_MESH_043_2D.py index 0e29c9232..19566aa47 100644 --- a/test/PAL_MESH_043_2D.py +++ b/test/PAL_MESH_043_2D.py @@ -76,8 +76,13 @@ hypNbSeg2 = algoReg2.NumberOfSegments(34) smesh.SetName(hypNbSeg2, "NumberOfSegments 2") # compute meshes -mesh1.Compute() -mesh2.Compute() +isDone = mesh1.Compute() +if not isDone: + raise Exception("Error when computing Mesh") + +isDone = mesh2.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # ---- udate object browser diff --git a/test/PAL_MESH_043_3D.py b/test/PAL_MESH_043_3D.py index 8879bac61..306da9a56 100644 --- a/test/PAL_MESH_043_3D.py +++ b/test/PAL_MESH_043_3D.py @@ -86,8 +86,13 @@ smesh.SetName(hypNbSeg2, "NumberOfSegments_" + str(numberOfSegments2)) # compute meshes -mesh1.Compute() -mesh2.Compute() +isDone = mesh1.Compute() +if not isDone: + raise Exception("Error when computing Mesh") + +isDone = mesh2.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # ---- update object browser salome.sg.updateObjBrowser() diff --git a/test/SMESH_BelongToGeom.py b/test/SMESH_BelongToGeom.py index f26a923fc..761036aa4 100644 --- a/test/SMESH_BelongToGeom.py +++ b/test/SMESH_BelongToGeom.py @@ -29,7 +29,8 @@ def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theEl aName = str(theSubShape) geompy.addToStudyInFather(theShape,theSubShape,aName) - theMeshGen.Compute(theMesh,theShape) + if not theMeshGen.Compute(theMesh,theShape): + raise Exception("Error when computing Mesh") aFilterMgr = theMeshGen.CreateFilterManager() aFilter = aFilterMgr.CreateFilter() @@ -48,7 +49,9 @@ def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType): aName = str(theSubShape) geompy.addToStudyInFather(theShape,theSubShape,aName) - theMesh.Compute() + if not theMesh.Compute(): + raise Exception("Error when computing Mesh") + aFilter = smesh.GetFilter(theElemType, SMESH.FT_BelongToGeom, theSubShape) return aFilter.GetElementsId(theMesh.GetMesh()) diff --git a/test/SMESH_BuildCompound.py b/test/SMESH_BuildCompound.py index 2592404bd..b700769f8 100644 --- a/test/SMESH_BuildCompound.py +++ b/test/SMESH_BuildCompound.py @@ -73,7 +73,9 @@ algo1D_1=Mesh_inf.Segment() algo1D_1.NumberOfSegments(10) algo2D_1=Mesh_inf.Quadrangle() algo3D_1=Mesh_inf.Hexahedron() -Mesh_inf.Compute() +isDone = Mesh_inf.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # create a group on the top face Gsup1=Mesh_inf.Group(Fsup1, "Sup") @@ -86,7 +88,9 @@ algo1D_2=Mesh_sup.Segment() algo1D_2.NumberOfSegments(5) algo2D_2=Mesh_sup.Quadrangle() algo3D_2=Mesh_sup.Hexahedron() -Mesh_sup.Compute() +isDone = Mesh_sup.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # create a group on the top face Gsup2=Mesh_sup.Group(Fsup2, "Sup") diff --git a/test/SMESH_GroupFromGeom.py b/test/SMESH_GroupFromGeom.py index e4d3e2816..dbddea1e4 100644 --- a/test/SMESH_GroupFromGeom.py +++ b/test/SMESH_GroupFromGeom.py @@ -28,7 +28,9 @@ from SMESH_test1 import * # Compute the mesh created in SMESH_test1 -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Create geometry groups on plane: aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"]) diff --git a/test/SMESH_GroupFromGeom2.py b/test/SMESH_GroupFromGeom2.py index 7dfb236a7..d980821bb 100644 --- a/test/SMESH_GroupFromGeom2.py +++ b/test/SMESH_GroupFromGeom2.py @@ -34,7 +34,9 @@ from SMESH_test1 import * # Compute the mesh created in SMESH_test1 -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Create geometry groups on plane: aGeomGroup1 = geompy.CreateGroup(face , geompy.ShapeType["FACE"]) @@ -70,7 +72,10 @@ print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) print(" ") print("Re-compute mesh, contents of aGroupOnShell changes again:") -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") + print("aGroupOnShell size =", aGroupOnShell.Size()) print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) diff --git a/test/SMESH_GroupLyingOnGeom.py b/test/SMESH_GroupLyingOnGeom.py index 8af4bfa6a..06ff15131 100644 --- a/test/SMESH_GroupLyingOnGeom.py +++ b/test/SMESH_GroupLyingOnGeom.py @@ -39,7 +39,9 @@ def BuildGroupLyingOn(theMesh, theElemType, theName, theShape): #Example from SMESH_test1 import * -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # First way BuildGroupLyingOn(mesh.GetMesh(), SMESH.FACE, "Group of faces lying on edge #1", edge ) diff --git a/test/SMESH_Nut.py b/test/SMESH_Nut.py index 884d7e12e..0d56b7b42 100644 --- a/test/SMESH_Nut.py +++ b/test/SMESH_Nut.py @@ -147,7 +147,9 @@ smesh.SetName(hVolume, "MaxElementVolume_"+str(theMaxElementVolume)) print("-------------------------- compute the mesh of the mechanic piece") -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") print("Information about the Nut:") print("Number of nodes : ", mesh.NbNodes()) diff --git a/test/SMESH_ParallelCompute.py b/test/SMESH_ParallelCompute.py index fccec1300..eec5a7aad 100644 --- a/test/SMESH_ParallelCompute.py +++ b/test/SMESH_ParallelCompute.py @@ -102,13 +102,17 @@ def run_test(nbox=2, boxsize=100): start = time.monotonic() is_done = seq_mesh.Compute() - assert is_done + if not is_done: + raise Exception("Error when computing Mesh") + stop = time.monotonic() time_seq = stop-start start = time.monotonic() is_done = par_mesh.Compute() - assert is_done + if not is_done: + raise Exception("Error when computing Mesh") + stop = time.monotonic() time_par = stop-start diff --git a/test/SMESH_Partition1_tetra.py b/test/SMESH_Partition1_tetra.py index 81c0db42d..c1921fc1c 100644 --- a/test/SMESH_Partition1_tetra.py +++ b/test/SMESH_Partition1_tetra.py @@ -169,19 +169,18 @@ smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) print("-------------------------- compute the mesh of alveole ") ret = mesh.Compute() - -if ret != 0: - log=mesh.GetLog(0) # no erase trace - # for linelog in log: - # print(linelog) - print("Information about the Mesh_mechanic:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of tetrahedrons: ", mesh.NbTetras()) -else: - print("problem when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +log = mesh.GetLog(0) # no erase trace +# for linelog in log: +# print(linelog) +print("Information about the Mesh_mechanic:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_Sphere.py b/test/SMESH_Sphere.py index b61ecc2c6..42cad6739 100644 --- a/test/SMESH_Sphere.py +++ b/test/SMESH_Sphere.py @@ -116,6 +116,8 @@ algo = my_hexa.Segment() algo.NumberOfSegments(NbSeg) my_hexa.Quadrangle() my_hexa.Hexahedron() -my_hexa.Compute() +isDone = my_hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") salome.sg.updateObjBrowser() diff --git a/test/SMESH_box.py b/test/SMESH_box.py index a681a7503..8b9886566 100644 --- a/test/SMESH_box.py +++ b/test/SMESH_box.py @@ -68,6 +68,8 @@ alg3D.SetName("algo3D") # compute mesh -box_mesh.Compute() +isDone = box_mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") sg.updateObjBrowser() diff --git a/test/SMESH_box2_tetra.py b/test/SMESH_box2_tetra.py index 1a1ac3a7a..d39cd1014 100644 --- a/test/SMESH_box2_tetra.py +++ b/test/SMESH_box2_tetra.py @@ -124,18 +124,18 @@ smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) print("-------------------------- compute shell") ret = mesh.Compute() print(ret) -if ret != 0: - log = mesh.GetLog(0) # no erase trace - # for linelog in log: - # print(linelog) - print("Information about the MeshBox2:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of tetrahedrons: ", mesh.NbTetras()) -else: - print("probleme when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +log = mesh.GetLog(0) # no erase trace +# for linelog in log: +# print(linelog) +print("Information about the MeshBox2:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_box3_tetra.py b/test/SMESH_box3_tetra.py index 696adefc7..bc665aaf8 100644 --- a/test/SMESH_box3_tetra.py +++ b/test/SMESH_box3_tetra.py @@ -134,18 +134,18 @@ smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) print("-------------------------- compute shell") ret = mesh.Compute() print(ret) -if ret != 0: - log = mesh.GetLog(0) # no erase trace - # for linelog in log: - # print(linelog) - print("Information about the MeshBox3:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of tetrahedrons: ", mesh.NbTetras()) -else: - print("probleme when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +log = mesh.GetLog(0) # no erase trace +# for linelog in log: +# print(linelog) +print("Information about the MeshBox3:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_box_tetra.py b/test/SMESH_box_tetra.py index 6174766aa..2eab3d227 100644 --- a/test/SMESH_box_tetra.py +++ b/test/SMESH_box_tetra.py @@ -93,18 +93,18 @@ smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) print("-------------------------- compute the mesh of the box") ret = mesh.Compute() print(ret) -if ret != 0: - log = mesh.GetLog(0) # no erase trace - # for linelog in log: - # print(linelog) - print("Information about the MeshBox:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of tetrahedrons: ", mesh.NbTetras()) -else: - print("probleme when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +log = mesh.GetLog(0) # no erase trace +# for linelog in log: +# print(linelog) +print("Information about the MeshBox:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_create_dual_mesh_adapt.py b/test/SMESH_create_dual_mesh_adapt.py index e24cafbde..d701478ff 100644 --- a/test/SMESH_create_dual_mesh_adapt.py +++ b/test/SMESH_create_dual_mesh_adapt.py @@ -73,6 +73,8 @@ top_1 = Mesh_1.GroupOnGeom(top,'top',SMESH.FACE) middle_1 = Mesh_1.GroupOnGeom(middle,'middle',SMESH.FACE) bottom_1 = Mesh_1.GroupOnGeom(bottom,'bottom',SMESH.FACE) isDone = Mesh_1.Compute() +if not isDone: + raise Exception("Error when computing Mesh") [ top_1, middle_1, bottom_1 ] = Mesh_1.GetGroups() diff --git a/test/SMESH_create_dual_mesh_tpipe.py b/test/SMESH_create_dual_mesh_tpipe.py index 28bc26a4f..fce3c252a 100644 --- a/test/SMESH_create_dual_mesh_tpipe.py +++ b/test/SMESH_create_dual_mesh_tpipe.py @@ -83,6 +83,8 @@ algo3d = Mesh_1.Tetrahedron(algo=smeshBuilder.NETGEN_3D) algo3d.MaxElementVolume(0.0002) isDone = Mesh_1.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Create groups d_geom_groups = {} diff --git a/test/SMESH_demo_hexa2_upd.py b/test/SMESH_demo_hexa2_upd.py index a05a5bf9d..3973405a4 100644 --- a/test/SMESH_demo_hexa2_upd.py +++ b/test/SMESH_demo_hexa2_upd.py @@ -180,21 +180,20 @@ salome.sg.updateObjBrowser() print("-------------------------- compute the mesh of the volume") -ret=mesh.Compute() - +ret = mesh.Compute() print(ret) -if ret != 0: -## log=mesh.GetLog(0) # no erase trace -## for linelog in log: -## print linelog - print("Information about the MeshBox :") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of tetrahedrons: ", mesh.NbTetras()) -else: - print("problem when Computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +##log=mesh.GetLog(0) # no erase trace +##for linelog in log: +## print linelog +print("Information about the MeshBox :") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_fixation_hexa.py b/test/SMESH_fixation_hexa.py index 70736bff8..e0ebe778c 100644 --- a/test/SMESH_fixation_hexa.py +++ b/test/SMESH_fixation_hexa.py @@ -85,18 +85,18 @@ hexa3D.SetName("Hexa_3D") print("-------------------------- compute compshell") ret = mesh.Compute() print(ret) -if ret != 0: - log = mesh.GetLog(0) # no erase trace - # for linelog in log: - # print(linelog) - print("Information about the MeshcompShel:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of quadrangles : ", mesh.NbQuadrangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of hexahedrons : ", mesh.NbHexas()) -else: - print("problem when Computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +log = mesh.GetLog(0) # no erase trace +# for linelog in log: +# print(linelog) +print("Information about the MeshcompShel:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of quadrangles : ", mesh.NbQuadrangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of hexahedrons : ", mesh.NbHexas()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_fixation_netgen.py b/test/SMESH_fixation_netgen.py index 0da15f6db..ed3f3f4ad 100644 --- a/test/SMESH_fixation_netgen.py +++ b/test/SMESH_fixation_netgen.py @@ -64,16 +64,15 @@ netgen.SetFineness( smeshBuilder.Fine ) print("-------------------------- compute mesh") ret = mesh.Compute() print(ret) -if ret != 0: - print("Information about the MeshcompShel:") - print("Number of nodes : ", mesh.GetMesh().NbNodes()) - print("Number of edges : ", mesh.GetMesh().NbEdges()) - print("Number of faces : ", mesh.GetMesh().NbFaces()) - print("Number of triangles : ", mesh.GetMesh().NbTriangles()) - print("Number of volumes : ", mesh.GetMesh().NbVolumes()) - print("Number of tetrahedrons : ", mesh.GetMesh().NbTetras()) - -else: - print("problem when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +print("Information about the MeshcompShel:") +print("Number of nodes : ", mesh.GetMesh().NbNodes()) +print("Number of edges : ", mesh.GetMesh().NbEdges()) +print("Number of faces : ", mesh.GetMesh().NbFaces()) +print("Number of triangles : ", mesh.GetMesh().NbTriangles()) +print("Number of volumes : ", mesh.GetMesh().NbVolumes()) +print("Number of tetrahedrons : ", mesh.GetMesh().NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_fixation_tetra.py b/test/SMESH_fixation_tetra.py index 15d2f7755..21187f67f 100644 --- a/test/SMESH_fixation_tetra.py +++ b/test/SMESH_fixation_tetra.py @@ -96,19 +96,18 @@ smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) print("-------------------------- compute compshell") ret = mesh.Compute(mesh) print(ret) -if ret != 0: - log = mesh.GetLog(0) # no erase trace - # for linelog in log: - # print(linelog) - print("Information about the MeshcompShel:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of tetrahedrons : ", mesh.NbTetras()) - -else: - print("problem when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +log = mesh.GetLog(0) # no erase trace +# for linelog in log: +# print(linelog) +print("Information about the MeshcompShel:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons : ", mesh.NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_flight_skin.py b/test/SMESH_flight_skin.py index e0762fc75..8ccafed36 100644 --- a/test/SMESH_flight_skin.py +++ b/test/SMESH_flight_skin.py @@ -94,17 +94,17 @@ smesh.SetName(hypLengthFromEdge,"LengthFromEdge") print("-------------------------- compute the skin flight") ret = mesh.Compute() print(ret) -if ret != 0: - log = mesh.GetLog(0) # no erase trace - # for linelog in log: - # print(linelog) - print("Information about the Mesh_mechanic_tetra:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of volumes : ", mesh.NbVolumes()) -else: - print("probleme when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +log = mesh.GetLog(0) # no erase trace +# for linelog in log: +# print(linelog) +print("Information about the Mesh_mechanic_tetra:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of volumes : ", mesh.NbVolumes()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_freebord.py b/test/SMESH_freebord.py index 90e2f1226..bee8167c2 100644 --- a/test/SMESH_freebord.py +++ b/test/SMESH_freebord.py @@ -59,8 +59,9 @@ algoMef = mesh.Triangle() hypArea = algoMef.MaxElementArea(20) -mesh.Compute() - +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Criterion : Free edges. Create group. diff --git a/test/SMESH_hexaedre.py b/test/SMESH_hexaedre.py index d3141cdd3..929242d3a 100644 --- a/test/SMESH_hexaedre.py +++ b/test/SMESH_hexaedre.py @@ -87,15 +87,15 @@ for edges in edgeGroups: # loop on groups of logically parallel edges # ---- compute mesh print("-------------------------- compute mesh") ok = mesh.Compute() -if ok: - print("Information about the Mesh:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of quadrangles : ", mesh.NbQuadrangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of hexahedrons : ", mesh.NbHexas()) -else: - print("problem when Computing the mesh") +if not ok: + raise Exception("Error when computing Mesh") + +print("Information about the Mesh:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of quadrangles : ", mesh.NbQuadrangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of hexahedrons : ", mesh.NbHexas()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_mechanic.py b/test/SMESH_mechanic.py index ec7be0498..584a6c691 100644 --- a/test/SMESH_mechanic.py +++ b/test/SMESH_mechanic.py @@ -177,7 +177,9 @@ smesh.SetName(algo.GetSubMesh(), "SubMeshFace4") print("-------------------------- compute the mesh of the mechanic piece") -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") print("Information about the Mesh_mechanic:") print("Number of nodes : ", mesh.NbNodes()) diff --git a/test/SMESH_mechanic_editor.py b/test/SMESH_mechanic_editor.py index d1c4abedc..a82694b61 100644 --- a/test/SMESH_mechanic_editor.py +++ b/test/SMESH_mechanic_editor.py @@ -181,7 +181,9 @@ submesh4 = algo.GetSubMesh() print("-------------------------- compute the mesh of the mechanic piece") -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") print("Information about the Mesh_mechanic:") print("Number of nodes : ", mesh.NbNodes()) diff --git a/test/SMESH_mechanic_netgen.py b/test/SMESH_mechanic_netgen.py index 918fa118a..7a0365a30 100644 --- a/test/SMESH_mechanic_netgen.py +++ b/test/SMESH_mechanic_netgen.py @@ -122,17 +122,16 @@ netgen.SetQuadAllowed( 1 ) print("-------------------------- compute mesh") ret = mesh.Compute() print(ret) -if ret != 0: - print("Information about the MeshcompShel:") - print("Number of nodes : ", mesh.NbNodes()) - print("Number of edges : ", mesh.NbEdges()) - print("Number of faces : ", mesh.NbFaces()) - print("Number of triangles : ", mesh.NbTriangles()) - print("Number of quadrangles : ", mesh.NbQuadrangles()) - print("Number of volumes : ", mesh.NbVolumes()) - print("Number of tetrahedrons : ", mesh.NbTetras()) - -else: - print("problem when computing the mesh") +if not ret: + raise Exception("Error when computing Mesh") + +print("Information about the MeshcompShel:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of quadrangles : ", mesh.NbQuadrangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons : ", mesh.NbTetras()) salome.sg.updateObjBrowser() diff --git a/test/SMESH_mechanic_tetra.py b/test/SMESH_mechanic_tetra.py index d7b88ddfd..902cb7139 100644 --- a/test/SMESH_mechanic_tetra.py +++ b/test/SMESH_mechanic_tetra.py @@ -147,7 +147,9 @@ smesh.SetName(hypVolume, "maxElementVolume_" + str(maxElementVolume)) print("-------------------------- compute the mesh of the mechanic piece") -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") print("Information about the Mesh_mechanic_tetra:") print("Number of nodes : ", mesh.NbNodes()) diff --git a/test/SMESH_test.py b/test/SMESH_test.py index bf71253cc..059663e3c 100644 --- a/test/SMESH_test.py +++ b/test/SMESH_test.py @@ -94,6 +94,9 @@ face = salome.IDToObject(idf) ret = mesh.Compute(face) print(ret) +if not ret: + raise Exception("Error when computing Mesh") + log = [] #mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after for a in log: print("-------") diff --git a/test/SMESH_test1_AndDisplay.py b/test/SMESH_test1_AndDisplay.py index eda63d90f..a5cd78a61 100644 --- a/test/SMESH_test1_AndDisplay.py +++ b/test/SMESH_test1_AndDisplay.py @@ -109,7 +109,9 @@ print(hypArea2.GetId()) print(hypArea2.GetMaxElementArea()) smesh.SetName(hypArea2, "MaxElementArea_500") -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") salome.sg.updateObjBrowser() diff --git a/test/SMESH_test2.py b/test/SMESH_test2.py index 1bc3d99b6..55fde9e8e 100644 --- a/test/SMESH_test2.py +++ b/test/SMESH_test2.py @@ -31,6 +31,9 @@ from SMESH_test1 import * print("-------------------------- compute box") ret = mesh.Compute() print(ret) +if not ret: + raise Exception("Error when computing Mesh") + log = mesh.GetLog(0); # no erase trace # for linelog in log: # print(linelog) diff --git a/test/SMESH_test4.py b/test/SMESH_test4.py index c97b20ddb..b03967142 100644 --- a/test/SMESH_test4.py +++ b/test/SMESH_test4.py @@ -66,7 +66,9 @@ algo4.MaxElementArea(100) submesh = algo4.GetSubMesh() smesh.SetName(submesh, "SubMeshFace") -mesh.Compute() +isDone = mesh.Compute() +if not isDone: + raise Exception("Error when computing Mesh") faces = submesh.GetElementsByType(SMESH.FACE) if len(faces) > 1: diff --git a/test/basic_geom_smesh_without_session.py b/test/basic_geom_smesh_without_session.py index 9626ff9eb..c9084f8aa 100644 --- a/test/basic_geom_smesh_without_session.py +++ b/test/basic_geom_smesh_without_session.py @@ -44,7 +44,8 @@ smesh.SetEnablePublish( True ) # Set to False to avoid publish in study if not n Mesh_1 = smesh.Mesh(Box_1) NETGEN_1D_2D_3D = Mesh_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D) isDone = Mesh_1.Compute() - +if not isDone: + raise Exception("Error when computing Mesh") ## Set names of Mesh objects smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D') diff --git a/test/basic_shaper_smesh_without_session.py b/test/basic_shaper_smesh_without_session.py index 54594a194..16a7a6795 100644 --- a/test/basic_shaper_smesh_without_session.py +++ b/test/basic_shaper_smesh_without_session.py @@ -64,7 +64,8 @@ NETGEN_3D_Parameters_1.SetFuseEdges( 1 ) NETGEN_3D_Parameters_1.SetQuadAllowed( 0 ) NETGEN_3D_Parameters_1.SetCheckChartBoundary( 152 ) isDone = Mesh_1.Compute() - +if not isDone: + raise Exception("Error when computing Mesh") ## Set names of Mesh objects smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D') diff --git a/test/basic_smesh_output_with_mc_field.py b/test/basic_smesh_output_with_mc_field.py index f900b96c2..8b2727d94 100644 --- a/test/basic_smesh_output_with_mc_field.py +++ b/test/basic_smesh_output_with_mc_field.py @@ -76,6 +76,8 @@ class SMESHExportOfFieldsInMemory(unittest.TestCase): Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa) isDone = Mesh_1.Compute() + if not isDone: + raise Exception("Error when computing Mesh") smesh.SetName(Mesh_1, 'Mesh_1') #### Mesh_1.ExportMED( r'Mesh_with_one_field_on_cells.med', 0, 41, 1, Mesh_1.GetMesh(), 1, [ Field_1_1 ], '',-1 ) @@ -165,6 +167,8 @@ class SMESHExportOfFieldsInMemory(unittest.TestCase): Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa) isDone = Mesh_1.Compute() + if not isDone: + raise Exception("Error when computing Mesh") smesh.SetName(Mesh_1, 'Mesh_1') # 23th of june 2021 : Bug both in ExportMED and in ExportMEDCoupling diff --git a/test/doublenodes_polyhedra.py b/test/doublenodes_polyhedra.py index 7a28ea7b2..ae85b6147 100644 --- a/test/doublenodes_polyhedra.py +++ b/test/doublenodes_polyhedra.py @@ -174,6 +174,8 @@ def createMesh(algo): algo_1d_sub.Propagation() isDone = Mesh_1.Compute() + if not isDone: + raise Exception("Error when computing Mesh") nb_nodes = Mesh_1.NbNodes() # Create 2 cracks by two calls of DoubleNodeElemGroups diff --git a/test/ex01_cube2build.py b/test/ex01_cube2build.py index 44fe5a9d5..033be24e2 100644 --- a/test/ex01_cube2build.py +++ b/test/ex01_cube2build.py @@ -318,7 +318,9 @@ algo.Propagation() # Compute the mesh # ---------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex02_cube2primitive.py b/test/ex02_cube2primitive.py index 9344c2462..dc9becc08 100644 --- a/test/ex02_cube2primitive.py +++ b/test/ex02_cube2primitive.py @@ -120,7 +120,9 @@ hexa.Hexahedron() # Compute the mesh # ---------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex03_cube2partition.py b/test/ex03_cube2partition.py index 109644f7a..eb89f5574 100644 --- a/test/ex03_cube2partition.py +++ b/test/ex03_cube2partition.py @@ -107,7 +107,9 @@ hexa.Hexahedron() # Compute the mesh # ---------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex04_cube5tetraHexa.py b/test/ex04_cube5tetraHexa.py index 9c6a0219b..145b952ae 100644 --- a/test/ex04_cube5tetraHexa.py +++ b/test/ex04_cube5tetraHexa.py @@ -112,7 +112,9 @@ localMesh(box_tetra2, 0) # Mesh calculus # ------------- -mixed.Compute() +isDone = mixed.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex05_hole1build.py b/test/ex05_hole1build.py index 8b577eb93..3a740f29f 100644 --- a/test/ex05_hole1build.py +++ b/test/ex05_hole1build.py @@ -147,7 +147,9 @@ hexa.Hexahedron() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex06_hole1boolean.py b/test/ex06_hole1boolean.py index 3bc2de2bd..0450b65b8 100644 --- a/test/ex06_hole1boolean.py +++ b/test/ex06_hole1boolean.py @@ -164,7 +164,9 @@ algo4.Propagation() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex07_hole1partition.py b/test/ex07_hole1partition.py index 53da036ac..062028113 100644 --- a/test/ex07_hole1partition.py +++ b/test/ex07_hole1partition.py @@ -104,7 +104,9 @@ hexa.Hexahedron() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex08_hole2build.py b/test/ex08_hole2build.py index f9582e227..81bb03a7e 100644 --- a/test/ex08_hole2build.py +++ b/test/ex08_hole2build.py @@ -137,7 +137,9 @@ hexa.Hexahedron() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex09_grid4build.py b/test/ex09_grid4build.py index 1754c13d6..f79919cbe 100644 --- a/test/ex09_grid4build.py +++ b/test/ex09_grid4build.py @@ -140,7 +140,9 @@ hexa.Hexahedron() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex10_grid4geometry.py b/test/ex10_grid4geometry.py index a24262894..6b258074c 100644 --- a/test/ex10_grid4geometry.py +++ b/test/ex10_grid4geometry.py @@ -102,7 +102,9 @@ hexa.Hexahedron() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex11_grid3partition.py b/test/ex11_grid3partition.py index 15775a8f1..4de0dfea4 100644 --- a/test/ex11_grid3partition.py +++ b/test/ex11_grid3partition.py @@ -123,7 +123,9 @@ hexa.Hexahedron() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex12_grid17partition.py b/test/ex12_grid17partition.py index 3d4b67b66..fb940d59b 100644 --- a/test/ex12_grid17partition.py +++ b/test/ex12_grid17partition.py @@ -143,7 +143,9 @@ hexa.Hexahedron() # Mesh calculus # ------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") t3= time.time() diff --git a/test/ex13_hole1partial.py b/test/ex13_hole1partial.py index 19361cea2..81efeea9d 100644 --- a/test/ex13_hole1partial.py +++ b/test/ex13_hole1partial.py @@ -256,7 +256,9 @@ local(cyl_x+d, cyl_y+d, box_dz, 10) # Compute the mesh # ---------------- -hexa.Compute() +isDone = hexa.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # Update object browser # --------------------- diff --git a/test/ex14_cyl1holed.py b/test/ex14_cyl1holed.py index da5b52d12..dd52befcf 100644 --- a/test/ex14_cyl1holed.py +++ b/test/ex14_cyl1holed.py @@ -141,7 +141,9 @@ while m_i