1 # -*- coding: latin-1 -*-
2 # Copyright (C) 2009-2013 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Francis KLOSS - 2011 - CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France
22 # ========================================================================================
27 # Construire le modèle de blocs
28 # =============================
35 doc = hexablock.addDocument("default")
37 # Construire la grille sphérique
38 # ------------------------------
40 centre = doc.addVertex(0, 0, 0)
42 vecteur_x = doc.addVector(1, 0, 0)
43 vecteur_y = doc.addVector(0, 1, 0)
44 vecteur_z = doc.addVector(0, 0, 1)
46 grille = doc.makeCartesian(centre, vecteur_x, vecteur_y, vecteur_z, 4, 3, 2)
48 # Associer une arête, puis couper cettee arête
49 # --------------------------------------------
51 arete = grille.getEdgeJ(0, 1, 0)
53 sommet_a = arete.getVertex(0)
54 sommet_b = arete.getVertex(1)
64 mx = (ax+bx)/2.0 - 0.25
68 vertex_d = geompy.MakeVertex(ax, ay, az)
69 vertex_m = geompy.MakeVertex(mx, my, mz)
70 vertex_f = geompy.MakeVertex(bx, by, bz)
72 edge = geompy.MakeArc(vertex_d, vertex_m, vertex_f)
73 geompy.addToStudy(edge, "arc")
74 geompy.addToStudy(vertex_d, "debut")
75 geompy.addToStudy(vertex_m, "milieu")
76 geompy.addToStudy(vertex_f, "fin")
78 sommet_a.setAssociation(vertex_d)
79 sommet_b.setAssociation(vertex_f)
81 arete.addAssociation(edge, 0, 1)
83 elements = doc.cut(arete, 4)
85 # Définir la loi de maillage sur les propagations
86 # -----------------------------------------------
88 l = doc.addLaw("Uniform", 5)
89 n = doc.countPropagation()
92 p = doc.getPropagation(i)
97 maillage = hexablock.mesh (doc)
99 # Afficher des informations
100 # -------------------------
102 print "Sur le document:"
103 print "nombre de sommets du modèle de bloc: ", doc.countUsedVertex()
104 print "nombre d'arêtes du modèle de bloc: ", doc.countUsedEdge()
105 print "nombre de quadrangles du modèle de bloc: ", doc.countUsedQuad()
106 print "nombre de blocs du modèle de bloc: ", doc.countUsedHexa()
108 print "Sur le maillage:"
109 print " - Nombre de noeuds : ", maillage.NbNodes()
110 print " - Nombre de segments : ", maillage.NbEdges()
111 print " - Nombre de quadrangles: ", maillage.NbQuadrangles()
112 print " - Nombre d'hexaèdres : ", maillage.NbHexas()