From 8a7a11a6fbd5fde766e0cef043bcd1ca647cc6b4 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Tue, 19 Sep 2017 11:38:41 +0200 Subject: [PATCH] add two salome tests for penta18 --- doc/salome/examples/create_penta_biquad.py | 43 +++++++++++++++ doc/salome/examples/extrusion_penta_biquad.py | 55 +++++++++++++++++++ doc/salome/examples/tests.set | 2 + 3 files changed, 100 insertions(+) create mode 100644 doc/salome/examples/create_penta_biquad.py create mode 100644 doc/salome/examples/extrusion_penta_biquad.py diff --git a/doc/salome/examples/create_penta_biquad.py b/doc/salome/examples/create_penta_biquad.py new file mode 100644 index 000000000..60b1b617c --- /dev/null +++ b/doc/salome/examples/create_penta_biquad.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +unPentaBiQuad = smesh.Mesh() +nodeID = unPentaBiQuad.AddNode( 0, 0, 0 ) +nodeID = unPentaBiQuad.AddNode( 10, 0, 0 ) +nodeID = unPentaBiQuad.AddNode( 0, 10, 0 ) +nodeID = unPentaBiQuad.AddNode( 0, 0, 10 ) +nodeID = unPentaBiQuad.AddNode( 10, 0, 10 ) +nodeID = unPentaBiQuad.AddNode( 0, 10, 10 ) +nodeID = unPentaBiQuad.AddNode( 5, 0, 0 ) +nodeID = unPentaBiQuad.AddNode( 7, 7, 0 ) +nodeID = unPentaBiQuad.AddNode( 0, 5, 0 ) +nodeID = unPentaBiQuad.AddNode( 5, 0, 10 ) +nodeID = unPentaBiQuad.AddNode( 7, 7, 10 ) +nodeID = unPentaBiQuad.AddNode( 0, 5, 10 ) +nodeID = unPentaBiQuad.AddNode( 0, 0, 5 ) +nodeID = unPentaBiQuad.AddNode( 10, 0, 5 ) +nodeID = unPentaBiQuad.AddNode( 0, 10, 5 ) +nodeID = unPentaBiQuad.AddNode( 5, -1, 5 ) +nodeID = unPentaBiQuad.AddNode( 8, 8, 5 ) +nodeID = unPentaBiQuad.AddNode( -1, 5, 5 ) +volID = unPentaBiQuad.AddVolume( [ 4, 5, 6, 1, 2, 3, 10, 11, 12, 7, 8, 9, 13, 14, 15, 16, 17, 18 ] ) + +infos = unPentaBiQuad.GetMeshInfo() +print "Number of biquadratic pentahedrons:", infos[SMESH.Entity_BiQuad_Penta] +if (infos[SMESH.Entity_BiQuad_Penta] != 1): + raise RuntimeError("Bad number of biquadratic pentahedrons: should be 1") + +## Set names of Mesh objects +smesh.SetName(unPentaBiQuad.GetMesh(), 'unPentaBiQuad') + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/extrusion_penta_biquad.py b/doc/salome/examples/extrusion_penta_biquad.py new file mode 100644 index 000000000..90cc2087e --- /dev/null +++ b/doc/salome/examples/extrusion_penta_biquad.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +Divided_Disk_1 = geompy.MakeDividedDisk(100, 1, GEOM.SQUARE) +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( Divided_Disk_1, 'Divided Disk_1' ) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) +aFilterManager = smesh.CreateFilterManager() +Mesh_1 = smesh.Mesh(Divided_Disk_1) +Regular_1D = Mesh_1.Segment() +Number_of_Segments_1 = Regular_1D.NumberOfSegments(6) +Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE) +isDone = Mesh_1.Compute() +aMaxElementLength2D0x5d7fdf0 = aFilterManager.CreateMaxElementLength2D() +isDone = Mesh_1.QuadToTriObject( Mesh_1, ) +Mesh_1.ExtrusionSweepObjects( [ Mesh_1 ], [ Mesh_1 ], [ Mesh_1 ], [ 0, 0, 50 ], 3, 1 ) +Mesh_1.ConvertToQuadratic(0, Mesh_1,True) + +infos = Mesh_1.GetMeshInfo() +print "Number of biquadratic pentahedrons:", infos[SMESH.Entity_BiQuad_Penta] +if (infos[SMESH.Entity_BiQuad_Penta] != 1080): + raise RuntimeError("Bad number of biquadratic pentahedrons: should be 1080") + +## Set names of Mesh objects +smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') +smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') +smesh.SetName(Number_of_Segments_1, 'Number of Segments_1') +smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') + + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/tests.set b/doc/salome/examples/tests.set index d7744d4f8..3319c3208 100644 --- a/doc/salome/examples/tests.set +++ b/doc/salome/examples/tests.set @@ -46,6 +46,7 @@ SET(BAD_TESTS SET(GOOD_TESTS cartesian_algo.py + create_penta_biquad.py creating_meshes_ex02.py creating_meshes_ex04.py creating_meshes_ex06.py @@ -66,6 +67,7 @@ SET(GOOD_TESTS defining_hypotheses_ex15.py defining_hypotheses_ex16.py defining_hypotheses_adaptive1d.py + extrusion_penta_biquad.py filters_ex01.py filters_ex03.py filters_ex04.py -- 2.39.2