X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTEST_PY%2Ftest_unit%2Ftest_cylinders.py;h=2ee368bd9754a795cc1bbef74d9f8c8f36c008ca;hb=8b7cfb4df1df6612a5bd2a9afcb019609148cadf;hp=ef332723303c98b1206b75362f8479d0c4ee4845;hpb=8681e72f844274a0c2fc2cd64bbf2451bd8db77b;p=modules%2Fhexablock.git diff --git a/src/TEST_PY/test_unit/test_cylinders.py b/src/TEST_PY/test_unit/test_cylinders.py index ef33272..2ee368b 100644 --- a/src/TEST_PY/test_unit/test_cylinders.py +++ b/src/TEST_PY/test_unit/test_cylinders.py @@ -1,10 +1,10 @@ # -*- coding: latin-1 -*- -# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# Copyright (C) 2009-2019 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2.1 of the License. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,7 +22,6 @@ import hexablock import os -import geompy #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 @@ -30,33 +29,93 @@ import geompy # ======================================================= test_cylindricals def test_cylindricals () : - doc = hexablock.addDocument ("rind:hexas") + doc = hexablock.addDocument ("cyl:hexas") orig = doc.addVertex (0, 0, 0) vz = doc.addVector (0, 0, 1) vx = doc.addVector (1 ,0, 0) + tdr = [ 1, 1, 1, 1 ] + tda = [ 45, 45, 45, 45, 45, 45, 45, 45 ] + tdl = [ 1, 1, 1 ] + tdr = [ 1, 2, 0.5 ] tda = [ 30, 30, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10, 30, 30, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] tdl = [ 1, 2, 3 ] - tdr = [ 1, 1, 1, 1 ] - tda = [ 45, 45, 45, 45, 45, 45, 45, 45 ] - tdl = [ 1, 1, 1 ] - c1 = doc.makeCylindricals (orig, vx,vz, tdr, tda, tdl, False) - ## c1 = doc.makeCylindrical (orig, vx,vz, 1.0, 360.0, 1.0, 3, 8, 3, False) + + doc.saveVtk ("cylindricals.vtk") + return doc + +# ======================================================= test_cylindrical +def test_cylindrical () : + + doc = hexablock.addDocument ("cyl:hexas") + + orig = doc.addVertex (0, 0, 0) + vz = doc.addVector (0, 0, 1) + vx = doc.addVector (1 ,0, 0) + + nr = 3 + na = 8 + nl = 3 + c1 = doc.makeCylindrical (orig, vx,vz, 1.0, 360.0, 1.0, nr,na,nl, False) doc.saveVtk ("cylindricals.vtk") return doc + +# ======================================================= test_cone +def test_cone () : + + doc = hexablock.addDocument ("cyl:hexas") + + orig = doc.addVertex (0, 0, 0) + ori2 = doc.addVertex (0, 0, 10) + vz = doc.addVector (0, 0, 1) + vx = doc.addVector (1 ,0, 0) + + nr = 2 + na = 8 + nl = 1 + c1 = doc.makeCylindrical (orig, vx,vz, 2.0, 360.0, 5.0, nr,na,nl, False) + c2 = doc.makeCylindrical (ori2, vx,vz, 1.0, 360.0, 5.0, nr,na,nl, False) + + vh0 = c2.getVertexIJK (0, 0, 0) + vh1 = c2.getVertexIJK (1, 0, 0) + + vb0 = c1.getVertexIJK (0, 0, nl) + vb1 = c1.getVertexIJK (1, 0, nl) + + qcible = c2.getQuadIJ (0, 0, 0) + qliste = [] + for ni in range (nr) : + for nj in range (na) : + quad = c1.getQuadIJ (ni, nj, nl) + qliste.append (quad) + quad .setColor (3); + + qcible.setColor (3); + vb0.setColor (5); + vh0.setColor (5); + vb1.setColor (5); + vh1.setColor (5); + + doc.joinQuads (qliste, qcible, vb0, vh0, vb1, vh1, 1) + + doc.saveVtk ("cone.vtk") + return doc + # ================================================================= Begin -doc = test_cylindricals () +#### doc = test_cylindricals () +#### doc = test_cylindrical () +doc = test_cone () law = doc.addLaw("Uniform", 4)