From: Frederic Pons Date: Tue, 21 Feb 2023 13:59:44 +0000 (+0100) Subject: Check result of Compute() in test and examples X-Git-Tag: V9_11_0a1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1ade5b188481247c04b3cecbe8405588f78c6803;p=modules%2Fsmesh.git Check result of Compute() in test and examples --- diff --git a/doc/examples/a3DmeshOnModified2Dmesh.py b/doc/examples/a3DmeshOnModified2Dmesh.py index fb49f873c..4e830b7f4 100644 --- a/doc/examples/a3DmeshOnModified2Dmesh.py +++ b/doc/examples/a3DmeshOnModified2Dmesh.py @@ -48,15 +48,19 @@ algo_2D.SetMinSize( 7. ) # 2) Compute 2D mesh isDone = Mesh_1.Compute() +if not isDone: + raise Exception("Error when computing Mesh") # 3) Split quadrangles into triangles -isDone = Mesh_1.SplitQuadObject( Mesh_1, Diag13=True ) +Mesh_1.SplitQuadObject( Mesh_1, Diag13=True ) # 4) Define a 3D mesher Mesh_1.Tetrahedron() # 5) Compute 3D mesh -Mesh_1.Compute() +isDone = Mesh_1.Compute() +if not isDone: + raise Exception("Error when computing Mesh") if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() diff --git a/doc/examples/cartesian_algo.py b/doc/examples/cartesian_algo.py index 584d66715..690aaff8a 100644 --- a/doc/examples/cartesian_algo.py +++ b/doc/examples/cartesian_algo.py @@ -25,7 +25,7 @@ coords = list(range(-100,100,10)) cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000) # compute the mesh -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("nb hexahedra",mesh.NbHexas()) print("nb tetrahedra",mesh.NbTetras()) print("nb polyhedra",mesh.NbPolyhedrons()) @@ -34,7 +34,7 @@ print() # define the grid by setting constant spacing cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("nb hexahedra",mesh.NbHexas()) print("nb tetrahedra",mesh.NbTetras()) print("nb polyhedra",mesh.NbPolyhedrons()) @@ -44,7 +44,7 @@ print() # activate creation of faces cartHyp.SetToCreateFaces( True ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("nb hexahedra",mesh.NbHexas()) print("nb tetrahedra",mesh.NbTetras()) print("nb polyhedra",mesh.NbPolyhedrons()) @@ -53,7 +53,7 @@ print() # enable consideration of shared faces cartHyp.SetToConsiderInternalFaces( True ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("nb hexahedra",mesh.NbHexas()) print("nb tetrahedra",mesh.NbTetras()) print("nb polyhedra",mesh.NbPolyhedrons()) @@ -64,7 +64,7 @@ print() spaceFuns = ["5","10+10*t"] cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("nb hexahedra",mesh.NbHexas()) print("nb tetrahedra",mesh.NbTetras()) print("nb polyhedra",mesh.NbPolyhedrons()) @@ -85,24 +85,24 @@ spc = "0.1" # spacing mesh = smesh_builder.Mesh( box, "custom axes") algo = mesh.BodyFitted() algo.SetGrid( spc, spc, spc, 10000 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("Default axes") print(" nb hex:",mesh.NbHexas()) # set axes using edges of the box algo.SetAxesDirs( xDir, [-0.1,1,0], zDir ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("Manual axes") print(" nb hex:",mesh.NbHexas()) # set optimal orthogonal axes algo.SetOptimalAxesDirs( isOrthogonal=True ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("Optimal orthogonal axes") print(" nb hex:",mesh.NbHexas()) # set optimal non-orthogonal axes algo.SetOptimalAxesDirs( isOrthogonal=False ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("Optimal non-orthogonal axes") print(" nb hex:",mesh.NbHexas()) diff --git a/doc/examples/create_dual_mesh.py b/doc/examples/create_dual_mesh.py index 08dfea822..d65e9bd16 100644 --- a/doc/examples/create_dual_mesh.py +++ b/doc/examples/create_dual_mesh.py @@ -45,15 +45,14 @@ Mesh_1 = smesh.Mesh(Sphere_1,'Mesh_1') status = Mesh_1.AddHypothesis( Sphere_1, NETGEN_3D_Parameters_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") # Creating Dual mesh dual_Mesh_1 = smesh.CreateDualMesh( Mesh_1, 'dual_Mesh_1', True) - assert(dual_Mesh_1.NbPolyhedrons() > 0) assert(dual_Mesh_1.NbTetras() == 0) - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() diff --git a/doc/examples/creating_meshes_ex01.py b/doc/examples/creating_meshes_ex01.py index e5cb0e934..0a174d8a3 100644 --- a/doc/examples/creating_meshes_ex01.py +++ b/doc/examples/creating_meshes_ex01.py @@ -27,8 +27,7 @@ algo3D.MaxElementVolume(900.) # compute the mesh ret = tetra.Compute() -if ret == 0: - print("problem when computing the mesh") -else: - print("mesh computed") - pass +if not ret: + raise Exception("problem when computing the mesh") + +print("mesh computed") diff --git a/doc/examples/creating_meshes_ex02.py b/doc/examples/creating_meshes_ex02.py index 676708c68..bb0358837 100644 --- a/doc/examples/creating_meshes_ex02.py +++ b/doc/examples/creating_meshes_ex02.py @@ -52,11 +52,11 @@ mesh.Hexahedron() surfaces = geom_builder.SubShapeAll(box, geom_builder.ShapeType["FACE"]) # method 1: no sub-mesh is created -mesh.Compute( surfaces[0] ) +if not mesh.Compute( surfaces[0] ): raise Exception("Error when computing Mesh") # method 2: a sub-mesh is created submesh = mesh.GetSubMesh( surfaces[2], "submesh 2" ) -submesh.Compute() +if not submesh.Compute(): raise Exception("Error when computing Mesh") # compute the whole mesh -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/creating_meshes_ex03.py b/doc/examples/creating_meshes_ex03.py index 03a1804a1..88b3d0b1a 100644 --- a/doc/examples/creating_meshes_ex03.py +++ b/doc/examples/creating_meshes_ex03.py @@ -35,14 +35,17 @@ mesh.Triangle(geom=Face_3) # get existing sub-mesh priority order: F1 -> F2 -> F3 [[SubMesh_F1, SubMesh_F3, SubMesh_F2]] = mesh.GetMeshOrder() isDone = mesh.Compute() +if not isDone: raise Exception("Error when computing Mesh") print("Nb elements at initial order of sub-meshes:", mesh.NbElements()) # set new sub-mesh order: F2 -> F1 -> F3 isDone = mesh.SetMeshOrder([[SubMesh_F2, SubMesh_F1, SubMesh_F3]]) isDone = mesh.Compute() +if not isDone: raise Exception("Error when computing Mesh") print("Nb elements at new order of sub-meshes:", mesh.NbElements()) # compute with other sub-mesh order: F3 -> F2 -> F1 isDone = mesh.SetMeshOrder([[SubMesh_F3, SubMesh_F2, SubMesh_F1]]) isDone = mesh.Compute() +if not isDone: raise Exception("Error when computing Mesh") print("Nb elements at another order of sub-meshes:", mesh.NbElements()) diff --git a/doc/examples/creating_meshes_ex04.py b/doc/examples/creating_meshes_ex04.py index 3298e971c..405fcd9ee 100644 --- a/doc/examples/creating_meshes_ex04.py +++ b/doc/examples/creating_meshes_ex04.py @@ -41,19 +41,19 @@ hyp3 = algo_local.Arithmetic1D(1, 6) hyp4 = algo_local.Propagation() # compute the mesh -tria.Compute() +if not tria.Compute(): raise Exception("Error when computing Mesh") PrintMeshInfo(tria) # remove a local hypothesis tria.RemoveHypothesis(hyp4, edge) # compute the mesh -tria.Compute() +if not tria.Compute(): raise Exception("Error when computing Mesh") PrintMeshInfo(tria) # change the value of the 2D hypothesis hyp2.SetMaxElementArea(2.) # compute the mesh -tria.Compute() +if not tria.Compute(): raise Exception("Error when computing Mesh") PrintMeshInfo(tria) diff --git a/doc/examples/creating_meshes_ex05.py b/doc/examples/creating_meshes_ex05.py index 5c2ab863b..4f4f6d171 100644 --- a/doc/examples/creating_meshes_ex05.py +++ b/doc/examples/creating_meshes_ex05.py @@ -24,7 +24,7 @@ tetra.Triangle() tetra.Tetrahedron() # compute the mesh -tetra.Compute() +if not tetra.Compute(): raise Exception("Error when computing Mesh") # export the mesh in a MED file medFile = tempfile.NamedTemporaryFile(suffix=".med").name diff --git a/doc/examples/creating_meshes_ex06.py b/doc/examples/creating_meshes_ex06.py index a460eeb8b..0d706851e 100644 --- a/doc/examples/creating_meshes_ex06.py +++ b/doc/examples/creating_meshes_ex06.py @@ -113,7 +113,7 @@ algo.Propagation() hexa.Quadrangle() hexa.Hexahedron() -hexa.Compute() +if not hexa.Compute(): raise Exception("Error when computing Mesh") hexa.Group(group_a) hexa.Group(group_b) diff --git a/doc/examples/creating_meshes_ex07.py b/doc/examples/creating_meshes_ex07.py index 4a181c237..d0d4c8e9f 100644 --- a/doc/examples/creating_meshes_ex07.py +++ b/doc/examples/creating_meshes_ex07.py @@ -46,7 +46,7 @@ algo1D_1=Mesh_inf.Segment() algo1D_1.NumberOfSegments(10) algo2D_1=Mesh_inf.Quadrangle() algo3D_1=Mesh_inf.Hexahedron() -Mesh_inf.Compute() +if not Mesh_inf.Compute(): raise Exception("Error when computing Mesh") # create a group on the top face Gsup1=Mesh_inf.Group(Fsup1, "Sup") @@ -59,7 +59,7 @@ algo1D_2=Mesh_sup.Segment() algo1D_2.NumberOfSegments(5) algo2D_2=Mesh_sup.Quadrangle() algo3D_2=Mesh_sup.Hexahedron() -Mesh_sup.Compute() +if not Mesh_sup.Compute(): raise Exception("Error when computing Mesh") # create a group on the top face Gsup2=Mesh_sup.Group(Fsup2, "Sup") diff --git a/doc/examples/creating_meshes_ex08.py b/doc/examples/creating_meshes_ex08.py index 71fdff73b..aa6714339 100644 --- a/doc/examples/creating_meshes_ex08.py +++ b/doc/examples/creating_meshes_ex08.py @@ -20,7 +20,7 @@ localAlgo = mesh.Triangle(face) mesh.Segment().NumberOfSegments( 3 ) mesh.Quadrangle() mesh.Prism() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # objects to copy fGroup = mesh.GroupOnGeom( face, "2D on face") @@ -56,4 +56,4 @@ smallBox = geom_builder.MakeScaleAlongAxes( box, None, 1, 0.5, 0.5 ) cutBox = geom_builder.MakeCut( box, smallBox, theName="box - smallBox" ) ok, newMesh, groups, submehses, hyps, invIDs = smesh_builder.CopyMeshWithGeom( mesh, cutBox, "cutBox" ) -newMesh.Compute() +if not newMesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/creating_parallel_mesh.py b/doc/examples/creating_parallel_mesh.py index 6b9006e0c..809d8ef69 100644 --- a/doc/examples/creating_parallel_mesh.py +++ b/doc/examples/creating_parallel_mesh.py @@ -113,14 +113,18 @@ def run_test(nbox=2, boxsize=100): print("Starting sequential compute") 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 print("Starting parallel compute") 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/doc/examples/defining_hypotheses_adaptive1d.py b/doc/examples/defining_hypotheses_adaptive1d.py index d28342a19..e0f567a2a 100644 --- a/doc/examples/defining_hypotheses_adaptive1d.py +++ b/doc/examples/defining_hypotheses_adaptive1d.py @@ -31,4 +31,4 @@ deflection = 0.05 mesh = smesh_builder.Mesh( shape ) mesh.Segment().Adaptive( minSize, maxSize, deflection ) mesh.Triangle().MaxElementArea( 300 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex01.py b/doc/examples/defining_hypotheses_ex01.py index 734c7ea02..48571de5f 100644 --- a/doc/examples/defining_hypotheses_ex01.py +++ b/doc/examples/defining_hypotheses_ex01.py @@ -40,4 +40,4 @@ hexa.Quadrangle() hexa.Hexahedron() # compute the mesh -hexa.Compute() +if not hexa.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex02.py b/doc/examples/defining_hypotheses_ex02.py index 29e15745d..b98b1a185 100644 --- a/doc/examples/defining_hypotheses_ex02.py +++ b/doc/examples/defining_hypotheses_ex02.py @@ -43,4 +43,4 @@ algo_local = hexa.Segment(e_arc) algo_local.Deflection1D(1.0) # compute the mesh -hexa.Compute() +if not hexa.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex03.py b/doc/examples/defining_hypotheses_ex03.py index 21be409db..56be06dee 100644 --- a/doc/examples/defining_hypotheses_ex03.py +++ b/doc/examples/defining_hypotheses_ex03.py @@ -40,4 +40,4 @@ algo_local.StartEndLength(1, 6) algo_local.Propagation() # compute the mesh -hexa.Compute() +if not hexa.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex04.py b/doc/examples/defining_hypotheses_ex04.py index 043ff1e44..f27cb3b4c 100644 --- a/doc/examples/defining_hypotheses_ex04.py +++ b/doc/examples/defining_hypotheses_ex04.py @@ -40,4 +40,4 @@ algo_local.LocalLength(2.) algo_local.Propagation() # compute the mesh -hexa.Compute() +if not hexa.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex05.py b/doc/examples/defining_hypotheses_ex05.py index 4b2d1a75b..e18ccebb8 100644 --- a/doc/examples/defining_hypotheses_ex05.py +++ b/doc/examples/defining_hypotheses_ex05.py @@ -40,4 +40,4 @@ algo = tria_mesh.Triangle() algo.MaxElementArea(100) # compute the mesh -tria_mesh.Compute() +if not tria_mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex06.py b/doc/examples/defining_hypotheses_ex06.py index aa0cb45bf..351dc795c 100644 --- a/doc/examples/defining_hypotheses_ex06.py +++ b/doc/examples/defining_hypotheses_ex06.py @@ -31,6 +31,6 @@ algo3D.MaxElementVolume(200.) # compute the mesh ret = tetra.Compute() if ret == 0: - print("problem when computing the mesh") -else: - print("Computation succeeded") + raise Exception("problem when computing the mesh") + +print("Computation succeeded") diff --git a/doc/examples/defining_hypotheses_ex07.py b/doc/examples/defining_hypotheses_ex07.py index 7295778f0..3cc6860bc 100644 --- a/doc/examples/defining_hypotheses_ex07.py +++ b/doc/examples/defining_hypotheses_ex07.py @@ -33,4 +33,4 @@ algo2D = tria.Triangle() algo2D.LengthFromEdges() # compute the mesh -tria.Compute() +if not tria.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex08.py b/doc/examples/defining_hypotheses_ex08.py index 43d77f1c2..d59d4430f 100644 --- a/doc/examples/defining_hypotheses_ex08.py +++ b/doc/examples/defining_hypotheses_ex08.py @@ -39,7 +39,7 @@ algo_local.Arithmetic1D(1, 4) algo_local.Propagation() # compute the mesh which contains prisms -hexa.Compute() +if not hexa.Compute(): raise Exception("Error when computing Mesh") # create another mesh on the box mesh = smesh_builder.Mesh(box, "Propagation of distribution of nodes") @@ -60,4 +60,4 @@ algo_local.Arithmetic1D(1, 4) algo_local.PropagationOfDistribution() # compute the mesh which contains hexahedra only -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex09.py b/doc/examples/defining_hypotheses_ex09.py index 9646d1707..cb02c912e 100644 --- a/doc/examples/defining_hypotheses_ex09.py +++ b/doc/examples/defining_hypotheses_ex09.py @@ -29,7 +29,7 @@ algo3D = hexa.Hexahedron() algo1D.Arithmetic1D(1, 4) # compute the mesh -hexa.Compute() +if not hexa.Compute(): raise Exception("Error when computing Mesh") # 2. Create a tetrahedral mesh on the box tetra = smesh_builder.Mesh(box, "Box : tetrahedrical mesh") @@ -48,4 +48,4 @@ algo1D.Arithmetic1D(1, 4) algo2D.LengthFromEdges() # compute the mesh -tetra.Compute() +if not tetra.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex10.py b/doc/examples/defining_hypotheses_ex10.py index 0a1b3d85c..92e0f1163 100644 --- a/doc/examples/defining_hypotheses_ex10.py +++ b/doc/examples/defining_hypotheses_ex10.py @@ -47,7 +47,7 @@ src_mesh.Segment().NumberOfSegments(9,10) src_mesh.Quadrangle() src_mesh.Hexahedron() src_mesh.Triangle(f1) # triangular sub-mesh -src_mesh.Compute() +if not src_mesh.Compute(): raise Exception("Error when computing Mesh") # Mesh the box using projection algorithms @@ -75,7 +75,7 @@ proj2D.SourceFace( f2 ) # 3D hypotheses to project prisms from the source to the target mesh proj3D = tgt_mesh.Projection3D() proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 ) -tgt_mesh.Compute() +if not tgt_mesh.Compute(): raise Exception("Error when computing Mesh") # Move the source mesh to visually compare the two meshes src_mesh.TranslateObject( src_mesh, smesh_builder.MakeDirStruct( 210, 0, 0 ), Copy=False) diff --git a/doc/examples/defining_hypotheses_ex11.py b/doc/examples/defining_hypotheses_ex11.py index 86796723f..0fb36d3c6 100644 --- a/doc/examples/defining_hypotheses_ex11.py +++ b/doc/examples/defining_hypotheses_ex11.py @@ -29,9 +29,9 @@ geom_builder.addToStudyInFather( box, Face_2, 'Face_2' ) src_mesh = smesh_builder.Mesh(Face_1, "Source mesh") src_mesh.Segment().NumberOfSegments(15) src_mesh.Triangle() -src_mesh.Compute() +if not src_mesh.Compute(): raise Exception("Error when computing Mesh") # Mesh the target mesh using the algorithm Projection1D2D tgt_mesh = smesh_builder.Mesh(Face_2, "Target mesh") tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh) -tgt_mesh.Compute() +if not tgt_mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex12.py b/doc/examples/defining_hypotheses_ex12.py index d7f9ff5b6..d391b5f21 100644 --- a/doc/examples/defining_hypotheses_ex12.py +++ b/doc/examples/defining_hypotheses_ex12.py @@ -37,4 +37,4 @@ Mesh_1.AddHypothesis(Fixed_points_1D_1) Regular_1D = Mesh_1.Segment() Quadrangle_2D = Mesh_1.Quadrangle() # Compute mesh -Mesh_1.Compute() +if not Mesh_1.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex13.py b/doc/examples/defining_hypotheses_ex13.py index f1b359e50..0ef0433d8 100644 --- a/doc/examples/defining_hypotheses_ex13.py +++ b/doc/examples/defining_hypotheses_ex13.py @@ -24,7 +24,7 @@ radial_Quad_algo = mesh.Quadrangle(algo=smeshBuilder.RADIAL_QUAD) # The Radial Quadrange algorithm can work without any hypothesis # In this case it uses "Default Nb of Segments" preferences parameter to discretize edges # So by default there will be 15 segments in both radial and circular directions -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # The Radial Quadrange uses global or local 1d hypotheses if it does # not have its own hypotheses. @@ -32,9 +32,9 @@ mesh.Compute() # So that there will be 5 radial layers and 10 circular segments global_Nb_Segments = mesh.Segment().NumberOfSegments(5) local_Nb_Segments = mesh.Segment(circle).NumberOfSegments(10) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Define own parameters of Radial Quadrange algorithm # The number of radial layers will be 4 radial_Quad_algo.NumberOfLayers( 4 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex14.py b/doc/examples/defining_hypotheses_ex14.py index accc5879b..bc7ce0b99 100644 --- a/doc/examples/defining_hypotheses_ex14.py +++ b/doc/examples/defining_hypotheses_ex14.py @@ -28,4 +28,4 @@ Nb_Segments_1 = Regular_1D.NumberOfSegments(10) Quadrangle_2D = Mesh_1.Quadrangle().TriangleVertex( triaVertex ) # Compute the mesh -Mesh_1.Compute() +if not Mesh_1.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex15.py b/doc/examples/defining_hypotheses_ex15.py index d1c711844..06ec83c19 100644 --- a/doc/examples/defining_hypotheses_ex15.py +++ b/doc/examples/defining_hypotheses_ex15.py @@ -36,8 +36,8 @@ Regular_1D_1 = Mesh_1.Segment(geom=Edge_2) Nb_Segments_2 = Regular_1D_1.NumberOfSegments(10) # Compute mesh (with Quadrangle Preference type) -isDone = Mesh_1.Compute() +if not Mesh_1.Compute(): raise Exception("Error when computing Mesh") # Change type to Reduced and compute again Quadrangle_Parameters_1.SetQuadType( smeshBuilder.QUAD_REDUCED ) -isDone = Mesh_1.Compute() +if not Mesh_1.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex16.py b/doc/examples/defining_hypotheses_ex16.py index 850bc4865..c3fb9ec5b 100644 --- a/doc/examples/defining_hypotheses_ex16.py +++ b/doc/examples/defining_hypotheses_ex16.py @@ -33,7 +33,7 @@ geom_builder.addToStudyInFather( boxes[1], midFace1, "middle Face") srcMesh = smesh_builder.Mesh(boxes[0], "source mesh") # box coloser to CS origin nSeg1 = srcMesh.Segment().NumberOfSegments(4) srcMesh.Quadrangle() -srcMesh.Compute() +if not srcMesh.Compute(): raise Exception("Error when computing Mesh") srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE ) # Import faces from midFace0 to the target mesh @@ -43,8 +43,8 @@ importAlgo = tgtMesh.UseExisting2DElements(midFace1) import2hyp = importAlgo.SourceFaces( [srcFaceGroup] ) tgtMesh.Segment().NumberOfSegments(3) tgtMesh.Quadrangle() -tgtMesh.Compute() +if not tgtMesh.Compute(): raise Exception("Error when computing Mesh") # Import the whole source mesh with groups import2hyp.SetCopySourceMesh(True,True) -tgtMesh.Compute() +if not tgtMesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_ex17.py b/doc/examples/defining_hypotheses_ex17.py index 917ddd487..9861b2ac4 100644 --- a/doc/examples/defining_hypotheses_ex17.py +++ b/doc/examples/defining_hypotheses_ex17.py @@ -43,7 +43,7 @@ layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor, ignoreFaces, # optional groupName = groupName) # optional -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # retrieve boundary prisms created by mesh.Compute() boundaryGroup = mesh.GetGroupByName( layersHyp.GetGroupName() )[0] @@ -65,7 +65,7 @@ mesh.Segment().NumberOfSegments( 5 ) vlHyp = mesh.Triangle().ViscousLayers2D( 2, 3, 1.5, edgeIds, isEdgesToIgnore=True, # optional groupName=groupName) # optional -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # retrieve boundary elements created by mesh.Compute() quadrangles = mesh.GetGroupByName( vlHyp.GetGroupName() )[0] @@ -74,4 +74,4 @@ print( "Nb boundary quadrangles", quadrangles.Size() ) # viscous layers will be created on 3 edges, as we pass isEdgesToIgnore=False vlHyp.SetEdges( edgeIds, False ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/defining_hypotheses_len_near_vertex.py b/doc/examples/defining_hypotheses_len_near_vertex.py index f2f024ffd..5fca17b5b 100644 --- a/doc/examples/defining_hypotheses_len_near_vertex.py +++ b/doc/examples/defining_hypotheses_len_near_vertex.py @@ -28,4 +28,4 @@ mesh.Hexahedron() # define refinement near vertices algo1d.LengthNearVertex( 0.2 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/filters_ex09.py b/doc/examples/filters_ex09.py index d78f685ba..30bf3d9e9 100644 --- a/doc/examples/filters_ex09.py +++ b/doc/examples/filters_ex09.py @@ -15,7 +15,7 @@ face = geom_builder.MakeFaceHW(100, 100, 1, theName="quadrangle") mesh = smesh_builder.Mesh(face) mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(25) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # get all free borders filter = smesh_builder.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders) diff --git a/doc/examples/filters_ex10.py b/doc/examples/filters_ex10.py index 8f27a7c18..741bfe188 100644 --- a/doc/examples/filters_ex10.py +++ b/doc/examples/filters_ex10.py @@ -16,7 +16,7 @@ geom_builder.addToStudy( face, "quadrangle" ) mesh = smesh_builder.Mesh(face) mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(25) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # get all faces with free edges filter = smesh_builder.GetFilter(SMESH.FACE, SMESH.FT_FreeEdges) diff --git a/doc/examples/filters_ex16.py b/doc/examples/filters_ex16.py index 9b9f5523e..01b2fa468 100644 --- a/doc/examples/filters_ex16.py +++ b/doc/examples/filters_ex16.py @@ -16,7 +16,7 @@ mesh = smesh_builder.Mesh( box, "Box" ) mesh.Segment().NumberOfSegments(10) mesh.Quadrangle() mesh.Hexahedron() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # copy all elements with translation and Merge nodes mesh.TranslateObject( mesh, smesh_builder.MakeDirStruct( 10,0,0), Copy=True ) mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) ) diff --git a/doc/examples/filters_ex17.py b/doc/examples/filters_ex17.py index 43a5af866..9d6c27c75 100644 --- a/doc/examples/filters_ex17.py +++ b/doc/examples/filters_ex17.py @@ -16,7 +16,7 @@ mesh = smesh_builder.Mesh( box, "Box" ) mesh.Segment().NumberOfSegments(10) mesh.Quadrangle() mesh.Hexahedron() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # copy all elements with translation mesh.TranslateObject( mesh, [10,0,0], Copy=True ) # create a filter to find nodes equal within tolerance of 1e-5 diff --git a/doc/examples/filters_ex18.py b/doc/examples/filters_ex18.py index f5c0e7d3b..22369a418 100644 --- a/doc/examples/filters_ex18.py +++ b/doc/examples/filters_ex18.py @@ -16,7 +16,7 @@ mesh = smesh_builder.Mesh( box, "Box" ) mesh.Segment().NumberOfSegments(10) mesh.Quadrangle() mesh.Hexahedron() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # copy all elements with translation and merge nodes mesh.TranslateObject( mesh, [10,0,0], Copy=True ) mesh.MergeNodes( mesh.FindCoincidentNodes( 1e-5 )) diff --git a/doc/examples/filters_ex39.py b/doc/examples/filters_ex39.py index b66a8d0b7..587138ea0 100644 --- a/doc/examples/filters_ex39.py +++ b/doc/examples/filters_ex39.py @@ -34,7 +34,7 @@ v000 = geom_builder.MakeVertex( 100,100,0, theName='v000' ) # can use box sub-ve v001 = geom_builder.GetVertexNearPoint( box1, geom_builder.MakeVertex(100,100,100), theName='v001') ijkAlgo.Renumber([ smeshBuilder.BlockCS( box1, v000, v001 ) ]) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Create filters with FT_ConnectedElements criterion by pointing a domain in different ways: diff --git a/doc/examples/generate_flat_elements.py b/doc/examples/generate_flat_elements.py index b632fce21..f816da018 100644 --- a/doc/examples/generate_flat_elements.py +++ b/doc/examples/generate_flat_elements.py @@ -44,7 +44,7 @@ Mesh_1 = smesh_builder.Mesh(Partition_1) Mesh_1.Segment().NumberOfSegments(15) Mesh_1.Triangle().LengthFromEdges() Mesh_1.Tetrahedron() -Mesh_1.Compute() +if not Mesh_1.Compute(): raise Exception("Error when computing Mesh") # relevant groups of volumes and faces diff --git a/doc/examples/grouping_elements_ex02.py b/doc/examples/grouping_elements_ex02.py index e3ddd4e22..fff4b4041 100644 --- a/doc/examples/grouping_elements_ex02.py +++ b/doc/examples/grouping_elements_ex02.py @@ -33,7 +33,7 @@ quadra.Quadrangle() algo1D.NumberOfSegments(7) # compute the mesh -quadra.Compute() +if not quadra.Compute(): raise Exception("Error when computing Mesh") # create SMESH group on the face with name "SMESHGroup1" aSmeshGroup1 = quadra.GroupOnGeom(face, "SMESHGroup1") diff --git a/doc/examples/grouping_elements_ex03.py b/doc/examples/grouping_elements_ex03.py index 2de59d734..2c592aebd 100644 --- a/doc/examples/grouping_elements_ex03.py +++ b/doc/examples/grouping_elements_ex03.py @@ -16,7 +16,7 @@ box = geom_builder.MakeBoxDXDYDZ(10,10,10) mesh = smesh_builder.Mesh(box,"Quad mesh") hyp1D = mesh.Segment().StartEndLength( 1, 4 ) mesh.Quadrangle() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # create a group on filter selecting faces of medium size critaria = [ \ @@ -30,7 +30,7 @@ print("Group on filter contains %s elements" % filtGroup.Size()) # group on filter is updated if the mesh is modified hyp1D.SetStartLength( 2.5 ) hyp1D.SetEndLength( 2.5 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("After mesh change, group on filter contains %s elements" % filtGroup.Size()) # set a new filter defining the group diff --git a/doc/examples/measurements_ex01.py b/doc/examples/measurements_ex01.py index a0c9991a8..9e1053db2 100644 --- a/doc/examples/measurements_ex01.py +++ b/doc/examples/measurements_ex01.py @@ -27,8 +27,8 @@ mesh2 = smesh_builder.Mesh(box2, 'box2') mesh2.Segment().NumberOfSegments(5) mesh2.Triangle().MaxElementArea(20) -mesh1.Compute() -mesh2.Compute() +if not mesh1.Compute(): raise Exception("Error when computing Mesh") +if not mesh2.Compute(): raise Exception("Error when computing Mesh") # compute min distance from grp1 to the origin (not available yet) smesh_builder.MinDistance(mesh1) diff --git a/doc/examples/measurements_ex02.py b/doc/examples/measurements_ex02.py index 33bffbaea..e4d8338c6 100644 --- a/doc/examples/measurements_ex02.py +++ b/doc/examples/measurements_ex02.py @@ -27,8 +27,8 @@ mesh2 = smesh_builder.Mesh(box2, 'box2') mesh2.Segment().NumberOfSegments(5) mesh2.Triangle().MaxElementArea(20) -mesh1.Compute() -mesh2.Compute() +if not mesh1.Compute(): raise Exception("Error when computing Mesh") +if not mesh2.Compute(): raise Exception("Error when computing Mesh") # compute bounding box for mesh1 mesh1.BoundingBox() diff --git a/doc/examples/measurements_ex03.py b/doc/examples/measurements_ex03.py index 44d2f6e71..77a59ee60 100644 --- a/doc/examples/measurements_ex03.py +++ b/doc/examples/measurements_ex03.py @@ -19,7 +19,7 @@ submesh_1d = mesh.Segment().NumberOfSegments(5) submesh_2d = mesh.Quadrangle() submesh_3d = mesh.Hexahedron() submesh_2d_face = mesh.Triangle(face) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # create a group diff --git a/doc/examples/mechanic.py b/doc/examples/mechanic.py index 902ce7184..37a372e6f 100644 --- a/doc/examples/mechanic.py +++ b/doc/examples/mechanic.py @@ -83,4 +83,4 @@ mesh.Quadrangle(sub_face4) # finally compute whole mesh -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/mesh_3d.py b/doc/examples/mesh_3d.py index 69bd3f0e1..0041b612c 100644 --- a/doc/examples/mesh_3d.py +++ b/doc/examples/mesh_3d.py @@ -73,7 +73,7 @@ algo3d = tetra.Tetrahedron() algo3d.MaxElementVolume(100) # Compute the mesh -tetra.Compute() +if not tetra.Compute(): raise Exception("Error when computing Mesh") # Create a mesh group of all triangles generated on geom faces present in faces_group group = tetra.Group(faces_group) diff --git a/doc/examples/modifying_meshes_ex11.py b/doc/examples/modifying_meshes_ex11.py index 268ec1235..4555823c8 100644 --- a/doc/examples/modifying_meshes_ex11.py +++ b/doc/examples/modifying_meshes_ex11.py @@ -16,7 +16,7 @@ mesh = smesh_builder.Mesh(box, 'box') mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(5) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") print("After Compute(): %s nodes, %s faces" % ( mesh.NbNodes(), mesh.NbFaces())) # remove nodes #246 and #255 diff --git a/doc/examples/modifying_meshes_ex15.py b/doc/examples/modifying_meshes_ex15.py index cd058178a..5b570e396 100644 --- a/doc/examples/modifying_meshes_ex15.py +++ b/doc/examples/modifying_meshes_ex15.py @@ -14,7 +14,7 @@ box = geom_builder.MakeBoxDXDYDZ(200, 200, 200) mesh = smesh_builder.Mesh( box ) mesh.Segment().AutomaticLength(0.1) mesh.Quadrangle() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # find node at (0,0,0) which is located on a geom vertex node000 = None diff --git a/doc/examples/modifying_meshes_ex23.py b/doc/examples/modifying_meshes_ex23.py index 673569516..acfb7570d 100644 --- a/doc/examples/modifying_meshes_ex23.py +++ b/doc/examples/modifying_meshes_ex23.py @@ -46,7 +46,7 @@ def Mesh1D(shape1d, nbSeg, name): algo = mesh1d_tool.Segment() hyp = algo.NumberOfSegments(nbSeg) isDone = mesh1d_tool.Compute() - if not isDone: print('Mesh ', name, ': computation failed') + if not isDone: raise Exception('Mesh %s: computation failed' % name) return mesh1d_tool # Create a mesh with six nodes, seven edges and two quadrangle faces diff --git a/doc/examples/modifying_meshes_ex25.py b/doc/examples/modifying_meshes_ex25.py index 39250d3a3..b01e6be15 100644 --- a/doc/examples/modifying_meshes_ex25.py +++ b/doc/examples/modifying_meshes_ex25.py @@ -28,7 +28,7 @@ algo1D.NumberOfSegments(3) Mesh_1.Quadrangle() isDone = Mesh_1.Compute() -if not isDone: print('Mesh Mesh_1 : computation failed') +if not isDone: raise Exception('Mesh Mesh_1 : computation failed') # build a triangle mesh on Face_2 Mesh_2 = smesh_builder.Mesh(Face_2) @@ -39,7 +39,7 @@ algo2D = Mesh_2.Triangle() algo2D.MaxElementArea(240) isDone = Mesh_2.Compute() -if not isDone: print('Mesh Mesh_2 : computation failed') +if not isDone: raise Exception('Mesh Mesh_2 : computation failed') # create a 2d pattern pattern = smesh_builder.GetPattern() @@ -60,7 +60,7 @@ Mesh_3.Segment().NumberOfSegments(1) Mesh_3.Quadrangle() Mesh_3.Hexahedron() isDone = Mesh_3.Compute() -if not isDone: print('Mesh Mesh_3 : computation failed') +if not isDone: raise Exception('Mesh Mesh_3 : computation failed') # create a 3d pattern (hexahedrons) pattern_hexa = smesh_builder.GetPattern() @@ -103,7 +103,7 @@ Mesh_4.Segment().NumberOfSegments(1) Mesh_4.Quadrangle() Mesh_4.Hexahedron() isDone = Mesh_4.Compute() -if not isDone: print('Mesh Mesh_4 : computation failed') +if not isDone: raise Exception('Mesh Mesh_4 : computation failed') # create another 3d pattern (pyramids) pattern_pyra = smesh_builder.GetPattern() diff --git a/doc/examples/modifying_meshes_ex26.py b/doc/examples/modifying_meshes_ex26.py index b837d6a9c..1a8ea2a23 100644 --- a/doc/examples/modifying_meshes_ex26.py +++ b/doc/examples/modifying_meshes_ex26.py @@ -23,7 +23,7 @@ Mesh.Tetrahedron() # compute mesh -Mesh.Compute() +if not Mesh.Compute(): raise Exception("Error when computing Mesh") # convert to quadratic # theForce3d = 1; this results in the medium node lying at the diff --git a/doc/examples/notebook_smesh.py b/doc/examples/notebook_smesh.py index 8d90ad382..9e65604ee 100644 --- a/doc/examples/notebook_smesh.py +++ b/doc/examples/notebook_smesh.py @@ -37,7 +37,7 @@ algo3D = tetra.Tetrahedron() algo3D.MaxElementVolume("MaxElementVolume") # compute the mesh -ret = tetra.Compute() +if not tetra.Compute(): raise Exception("Error when computing Mesh") # translate the mesh point = SMESH.PointStruct("Offset", 0., 0.) diff --git a/doc/examples/prism_3d_algo.py b/doc/examples/prism_3d_algo.py index 20ab781e8..481fdad01 100644 --- a/doc/examples/prism_3d_algo.py +++ b/doc/examples/prism_3d_algo.py @@ -72,4 +72,4 @@ mesh.Segment(bigQuad).LocalLength( 3 ) mesh.Triangle(bigQuad) # compute the mesh -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/quad_medial_axis_algo.py b/doc/examples/quad_medial_axis_algo.py index 450827bd4..669cfd8ad 100644 --- a/doc/examples/quad_medial_axis_algo.py +++ b/doc/examples/quad_medial_axis_algo.py @@ -29,4 +29,4 @@ algo1d.NumberOfSegments( circNbSeg ) # division of circle edges algo2d = mesh.Quadrangle( smeshBuilder.QUAD_MA_PROJ ) algo2d.StartEndLength( circleLen2 / circNbSeg, circleLen1 / circNbSeg ) # radial division -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/quality_controls_defl.py b/doc/examples/quality_controls_defl.py index 42c04a315..e9c4074b0 100644 --- a/doc/examples/quality_controls_defl.py +++ b/doc/examples/quality_controls_defl.py @@ -20,7 +20,7 @@ mesh = smesh_builder.Mesh( Fuse, "Deflection_2D") algo = mesh.Segment() algo.LocalLength(35) algo = mesh.Triangle() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # get min and max deflection minMax = mesh.GetMinMax( SMESH.FT_Deflection2D ) diff --git a/doc/examples/quality_controls_ex01.py b/doc/examples/quality_controls_ex01.py index dda1aca12..76b8be68c 100644 --- a/doc/examples/quality_controls_ex01.py +++ b/doc/examples/quality_controls_ex01.py @@ -23,7 +23,7 @@ algo = mesh.Segment() algo.NumberOfSegments(5) algo = mesh.Triangle() algo.MaxElementArea(20.) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # criterion : free borders aFilter = smesh_builder.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders) diff --git a/doc/examples/quality_controls_ex02.py b/doc/examples/quality_controls_ex02.py index 3b48bf305..e4c6c5213 100644 --- a/doc/examples/quality_controls_ex02.py +++ b/doc/examples/quality_controls_ex02.py @@ -23,7 +23,7 @@ algo = mesh.Segment() algo.NumberOfSegments(5) algo = mesh.Triangle() algo.MaxElementArea(20.) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Criterion : Borders at multi-connection nb_conn = 2 diff --git a/doc/examples/quality_controls_ex03.py b/doc/examples/quality_controls_ex03.py index 9958d7115..cfe71c97b 100644 --- a/doc/examples/quality_controls_ex03.py +++ b/doc/examples/quality_controls_ex03.py @@ -23,7 +23,7 @@ algo = mesh.Segment() algo.NumberOfSegments(5) algo = mesh.Triangle() algo.MaxElementArea(20.) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Criterion : Length > 3. length_margin = 3. diff --git a/doc/examples/quality_controls_ex05.py b/doc/examples/quality_controls_ex05.py index 4559cb897..008ee2fbc 100644 --- a/doc/examples/quality_controls_ex05.py +++ b/doc/examples/quality_controls_ex05.py @@ -18,7 +18,7 @@ idbox = geom_builder.addToStudy(box, "box") mesh = smesh_builder.Mesh(box, "Mesh_free_nodes") mesh.Segment().NumberOfSegments(10) mesh.Triangle().MaxElementArea(150.) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Remove some elements to obtain free nodes # Criterion : AREA < 80. diff --git a/doc/examples/quality_controls_ex06.py b/doc/examples/quality_controls_ex06.py index 7ecbc5ba3..22d6a9b10 100644 --- a/doc/examples/quality_controls_ex06.py +++ b/doc/examples/quality_controls_ex06.py @@ -42,7 +42,7 @@ Mesh_1 = smesh_builder.Mesh(Partition_1) Mesh_1.Segment().MaxSize(34.641) Mesh_1.Triangle() Mesh_1.Tetrahedron() -Mesh_1.Compute() +if not Mesh_1.Compute(): raise Exception("Error when computing Mesh") # create a group of free faces aFilter = smesh_builder.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces ) diff --git a/doc/examples/quality_controls_ex07.py b/doc/examples/quality_controls_ex07.py index ce88f3773..5b1b695fb 100644 --- a/doc/examples/quality_controls_ex07.py +++ b/doc/examples/quality_controls_ex07.py @@ -16,7 +16,7 @@ geom_builder.addToStudy( box, "box" ) mesh = smesh_builder.Mesh(box) mesh.Segment().NumberOfSegments(3) mesh.Quadrangle() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # remove 2 faces allFaces = mesh.GetElementsByType(SMESH.FACE) diff --git a/doc/examples/quality_controls_ex11.py b/doc/examples/quality_controls_ex11.py index 1b08179f1..731b3b01f 100644 --- a/doc/examples/quality_controls_ex11.py +++ b/doc/examples/quality_controls_ex11.py @@ -23,7 +23,7 @@ algo = mesh.Segment() algo.NumberOfSegments(5) algo = mesh.Triangle() algo.MaxElementArea(20.) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Criterion : Length 2D > 5.7 length_margin = 5.7 diff --git a/doc/examples/quality_controls_ex12.py b/doc/examples/quality_controls_ex12.py index a76fa3543..1e875a8ca 100644 --- a/doc/examples/quality_controls_ex12.py +++ b/doc/examples/quality_controls_ex12.py @@ -23,7 +23,7 @@ algo = mesh.Segment() algo.NumberOfSegments(5) algo = mesh.Triangle() algo.MaxElementArea(20.) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Criterion : MULTI-CONNECTION 2D = 3 nb_conn = 3 diff --git a/doc/examples/radial_prism_3d_algo.py b/doc/examples/radial_prism_3d_algo.py index a2623d846..a84ecc829 100644 --- a/doc/examples/radial_prism_3d_algo.py +++ b/doc/examples/radial_prism_3d_algo.py @@ -33,4 +33,4 @@ mesh.Projection1D2D( faces[1] ).SourceFace( faces[0] ) # projection faces[0] -> prism_algo.NumberOfSegments( 4, 5. ) # compute the mesh -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/split_biquad.py b/doc/examples/split_biquad.py index 90d544e36..a8e51ed24 100644 --- a/doc/examples/split_biquad.py +++ b/doc/examples/split_biquad.py @@ -24,7 +24,7 @@ mesh = smesh_builder.Mesh( shape ) mesh.Segment().NumberOfSegments(1) mesh.Quadrangle() mesh.Triangle( ff[1] ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # make group of quadrangles and extrude them into a hexahedron quadGroup = mesh.Group( ff[0], "quads") diff --git a/doc/examples/test_homard_adapt.py b/doc/examples/test_homard_adapt.py index 0e250eee0..9f3672b63 100644 --- a/doc/examples/test_homard_adapt.py +++ b/doc/examples/test_homard_adapt.py @@ -40,7 +40,7 @@ smeshhomard.SetLogInFile(True) smeshhomard.SetLogFile(log_file_1) smeshhomard.SetRemoveLogOnSuccess(False) smeshhomard.SetVerboseLevel(3) -smeshhomard.Compute() +if not smeshhomard.Compute(): raise Exception("Error when computing Mesh") if osp.isfile(output_med_1): os.remove(output_med_1) @@ -79,7 +79,7 @@ smeshhomard.SetLogInFile(True) smeshhomard.SetLogFile(log_file_2) smeshhomard.SetRemoveLogOnSuccess(True) smeshhomard.SetVerboseLevel(0) -smeshhomard.Compute() +if not smeshhomard.Compute(): raise Exception("Error when computing Mesh") if osp.isfile(output_med_2): print("Test Uniform refinement Case 2: Error: output med file has not been removed") diff --git a/doc/examples/test_uniform_refinement.py b/doc/examples/test_uniform_refinement.py index 96139e01b..b0e12e370 100644 --- a/doc/examples/test_uniform_refinement.py +++ b/doc/examples/test_uniform_refinement.py @@ -42,7 +42,7 @@ smeshhomard.SetLogInFile(True) smeshhomard.SetLogFile(log_file_1) smeshhomard.SetRemoveLogOnSuccess(False) smeshhomard.SetVerboseLevel(3) -smeshhomard.Compute() +if not smeshhomard.Compute(): raise Exception("Error when computing Mesh") if osp.isfile(output_med_1): os.remove(output_med_1) @@ -85,7 +85,7 @@ smeshhomard.SetLogInFile(True) smeshhomard.SetLogFile(log_file_2) smeshhomard.SetRemoveLogOnSuccess(True) smeshhomard.SetVerboseLevel(0) -smeshhomard.Compute() +if not smeshhomard.Compute(): raise Exception("Error when computing Mesh") if osp.isfile(output_med_2): print("Test Uniform refinement Case 2: Error: output med file has not been removed") diff --git a/doc/examples/transforming_meshes_ex03.py b/doc/examples/transforming_meshes_ex03.py index 07c8bb86a..750040b2b 100644 --- a/doc/examples/transforming_meshes_ex03.py +++ b/doc/examples/transforming_meshes_ex03.py @@ -18,7 +18,7 @@ Regular_1D = Mesh1.Segment() Nb_Segments_1 = Regular_1D.NumberOfSegments(3) Nb_Segments_1.SetDistrType( 0 ) Quadrangle_2D = Mesh1.Quadrangle() -isDone = Mesh1.Compute() +if not Mesh1.Compute(): raise Exception("Error when computing Mesh") #Perform scale operation for the whole mesh and creation of a new mesh newMesh = Mesh1.ScaleMakeMesh(Mesh1,SMESH.PointStruct(100,100,200),[0.5,0.3,0.7],True,"ScaledMesh") diff --git a/doc/examples/transforming_meshes_ex06.py b/doc/examples/transforming_meshes_ex06.py index 2600cb734..72fd27d40 100644 --- a/doc/examples/transforming_meshes_ex06.py +++ b/doc/examples/transforming_meshes_ex06.py @@ -40,7 +40,7 @@ algo1D.NumberOfSegments(6) algo2D = trias.Triangle() algo2D.LengthFromEdges() -trias.Compute() +if not trias.Compute(): raise Exception("Error when computing Mesh") # create a group of all triangles currently present in the mesh faceTriGroup = trias.Group( face1, "face triangles" ) @@ -49,7 +49,7 @@ faceTriGroup = trias.Group( face1, "face triangles" ) circlemesh = smesh_builder.Mesh(circle, "Path mesh") algo = circlemesh.Segment() algo.NumberOfSegments(10) -circlemesh.Compute() +if not circlemesh.Compute(): raise Exception("Error when computing Mesh") # extrusion of the mesh trias.ExtrusionAlongPath([], circlemesh, circle, 1, MakeGroups=True ) diff --git a/doc/examples/transforming_meshes_ex07.py b/doc/examples/transforming_meshes_ex07.py index db7a6cb7c..e54dec1a3 100644 --- a/doc/examples/transforming_meshes_ex07.py +++ b/doc/examples/transforming_meshes_ex07.py @@ -35,7 +35,7 @@ algo_local = mesh.Segment(edge1) algo_local.Arithmetic1D(1, 4) algo_local.Propagation() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # sew border to side # FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder, diff --git a/doc/examples/transforming_meshes_ex08.py b/doc/examples/transforming_meshes_ex08.py index 3de67b9df..50249a7e1 100644 --- a/doc/examples/transforming_meshes_ex08.py +++ b/doc/examples/transforming_meshes_ex08.py @@ -35,7 +35,7 @@ algo_local = mesh.Segment(edge1) algo_local.Arithmetic1D(1, 4) algo_local.Propagation() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # sew conform free borders # FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2 diff --git a/doc/examples/transforming_meshes_ex09.py b/doc/examples/transforming_meshes_ex09.py index 19ab5ed95..7941b29f9 100644 --- a/doc/examples/transforming_meshes_ex09.py +++ b/doc/examples/transforming_meshes_ex09.py @@ -24,7 +24,7 @@ mesh = smesh_builder.Mesh(shape, "Two faces : quadrangle mesh") mesh.Segment().Arithmetic1D( 0.1, 0.4 ) mesh.Segment(q1).NumberOfSegments( 5 ) mesh.Quadrangle() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # sew free borders diff --git a/doc/examples/transforming_meshes_ex10.py b/doc/examples/transforming_meshes_ex10.py index 36c2f5c22..317a61bb1 100644 --- a/doc/examples/transforming_meshes_ex10.py +++ b/doc/examples/transforming_meshes_ex10.py @@ -30,7 +30,7 @@ algo_local = mesh.Segment(EdgesList[8]) algo_local.NumberOfSegments(4) algo_local.Propagation() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # sew side elements diff --git a/doc/examples/transforming_meshes_ex11.py b/doc/examples/transforming_meshes_ex11.py index 5fddd3015..a08d21f52 100644 --- a/doc/examples/transforming_meshes_ex11.py +++ b/doc/examples/transforming_meshes_ex11.py @@ -21,7 +21,7 @@ mesh.Quadrangle() mesh.Hexahedron() # Compute mesh -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Duplicate nodes only diff --git a/doc/examples/transforming_meshes_ex13.py b/doc/examples/transforming_meshes_ex13.py index d8fade895..8ee0260b7 100644 --- a/doc/examples/transforming_meshes_ex13.py +++ b/doc/examples/transforming_meshes_ex13.py @@ -25,7 +25,7 @@ mesh = smesh_builder.Mesh( shape, "test_Reorient2D") mesh.AutomaticHexahedralization(0.5) localAlgo = mesh.Segment(faces[0]) localAlgo.NumberOfSegments( 11 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") group = mesh.Group( faces[1] ) vec = geom_builder.MakeVectorDXDYDZ( 1, 1, 1 ) diff --git a/doc/examples/use_existing_faces.py b/doc/examples/use_existing_faces.py index 4cdb9f26a..ef13199b6 100644 --- a/doc/examples/use_existing_faces.py +++ b/doc/examples/use_existing_faces.py @@ -101,7 +101,7 @@ geom_builder.addToStudy( f2, "f2" ) # compute 1D mesh mesh = smesh_builder.Mesh( box ) mesh.Segment().NumberOfSegments( 5 ) -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # compute 2D mesh mesh.Quadrangle() @@ -109,8 +109,8 @@ mesh.UseExistingFaces(f1) # UseExistingFaces() allows using my2DMeshing(); mesh.UseExistingFaces(f2) # assign UseExistingFaces() BEFORE calling my2DMeshing()! my2DMeshing(f1, mesh) my2DMeshing(f2, mesh) -assert mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # compute 3D mesh mesh.Prism() -assert mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") diff --git a/doc/examples/viewing_meshes_ex01.py b/doc/examples/viewing_meshes_ex01.py index e75f036a3..ded69ba88 100644 --- a/doc/examples/viewing_meshes_ex01.py +++ b/doc/examples/viewing_meshes_ex01.py @@ -32,11 +32,11 @@ Regular_1D_1_1 = tetra.Segment(geom=Face_1) Nb_Segments_1 = Regular_1D_1_1.NumberOfSegments(5) Nb_Segments_1.SetDistrType( 0 ) Quadrangle_2D = tetra.Quadrangle(geom=Face_1) -isDone = tetra.Compute() +if not tetra.Compute(): raise Exception("Error when computing Mesh") submesh = Regular_1D_1_1.GetSubMesh() # compute the mesh -tetra.Compute() +if not tetra.Compute(): raise Exception("Error when computing Mesh") # Creation of group group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' ) diff --git a/doc/examples/viewing_meshes_ex02.py b/doc/examples/viewing_meshes_ex02.py index a2f2ed17a..ddaba327b 100644 --- a/doc/examples/viewing_meshes_ex02.py +++ b/doc/examples/viewing_meshes_ex02.py @@ -16,7 +16,7 @@ box = geom_builder.MakeBoxDXDYDZ(100,100,100) # Create a mesh mesh = smesh_builder.Mesh(box,"Mesh") mesh.AutomaticHexahedralization() -mesh.Compute() +if not mesh.Compute(): raise Exception("Error when computing Mesh") # Create a point x,y,z = 0, 0, 1 diff --git a/src/SMESH_PY/smeshstudytools.py b/src/SMESH_PY/smeshstudytools.py index 859b5c25c..8d2edd729 100644 --- a/src/SMESH_PY/smeshstudytools.py +++ b/src/SMESH_PY/smeshstudytools.py @@ -203,6 +203,8 @@ def TEST_createBoxMesh(): Hexa_3D = smesh.CreateHypothesis('Hexa_3D') status = boxmesh.AddHypothesis(Hexa_3D) isDone = boxmesh.Compute() + if not isDone: + raise Exception("Error when computing Mesh") smesh.SetName(boxmesh.GetMesh(), 'boxmesh') if salome.sg.hasDesktop(): 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_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