1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 # =======================================
34 # Element of a grid compound by a square with a cylinder on each vertex build by points, edges, faces and solids
49 r3 = demi*math.sqrt(3)
54 piecePoint111 = MakeVertex(ox+rayon , oy, oz)
55 piecePoint211 = MakeVertex(ox+arete-rayon, oy, oz)
56 piecePoint112 = MakeVertex(ox , oy, oz+rayon)
57 piecePoint212 = MakeVertex(ox+arete , oy, oz+rayon)
58 piecePoint113 = MakeVertex(ox , oy, oz+arete-rayon)
59 piecePoint213 = MakeVertex(ox+arete , oy, oz+arete-rayon)
60 piecePoint114 = MakeVertex(ox+rayon , oy, oz+arete)
61 piecePoint214 = MakeVertex(ox+arete-rayon, oy, oz+arete)
63 pieceCenter1 = MakeVertex(ox , oy, oz)
64 pieceCenter2 = MakeVertex(ox+arete , oy, oz)
65 pieceCenter3 = MakeVertex(ox , oy, oz+arete)
66 pieceCenter4 = MakeVertex(ox+arete , oy, oz+arete)
68 piecePass1 = MakeVertex(ox+demi , oy, oz+r3)
69 piecePass2 = MakeVertex(ox+arete-demi , oy, oz+r3)
70 piecePass3 = MakeVertex(ox+arete-demi , oy, oz+arete-r3)
71 piecePass4 = MakeVertex(ox+demi , oy, oz+arete-r3)
76 pieceEdgeSquare1 = MakeEdge(piecePoint111, piecePoint211)
77 pieceEdgeSquare2 = MakeEdge(piecePoint114, piecePoint214)
78 pieceEdgeSquare3 = MakeEdge(piecePoint112, piecePoint113)
79 pieceEdgeSquare4 = MakeEdge(piecePoint212, piecePoint213)
81 pieceEdgeDiagonal1 = MakeEdge(piecePoint111, piecePoint213)
82 pieceEdgeDiagonal2 = MakeEdge(piecePoint112, piecePoint214)
84 pieceEdgeArc1 = MakeArc(piecePoint111, piecePass1, piecePoint112)
85 pieceEdgeArc2 = MakeArc(piecePoint211, piecePass2, piecePoint212)
86 pieceEdgeArc3 = MakeArc(piecePoint213, piecePass3, piecePoint214)
87 pieceEdgeArc4 = MakeArc(piecePoint113, piecePass4, piecePoint114)
92 pieceFace1 = MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1)
93 pieceFace2 = MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2)
95 pieceFace3 = MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2)
100 pieceVector = MakeVectorDXDYDZ(0, 1, 0)
102 pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur)
103 pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur)
104 pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur)
109 c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3])
111 piece = MakeGlueFaces(c_cpd, 1.e-5)
116 piece_id = addToStudy(piece, "ex09_grid4build")
121 # Create a hexahedral mesh
122 # ------------------------
124 hexa = smesh.Mesh(piece, "ex09_grid4build:hexa")
126 algo = hexa.Segment()
127 algo.NumberOfSegments(6)