1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2012 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
24 # =======================================
35 # Element of a grid compound by a square with a cylinder on each vertex build by points, edges, faces and solids
50 r3 = demi*math.sqrt(3)
55 piecePoint111 = MakeVertex(ox+rayon , oy, oz)
56 piecePoint211 = MakeVertex(ox+arete-rayon, oy, oz)
57 piecePoint112 = MakeVertex(ox , oy, oz+rayon)
58 piecePoint212 = MakeVertex(ox+arete , oy, oz+rayon)
59 piecePoint113 = MakeVertex(ox , oy, oz+arete-rayon)
60 piecePoint213 = MakeVertex(ox+arete , oy, oz+arete-rayon)
61 piecePoint114 = MakeVertex(ox+rayon , oy, oz+arete)
62 piecePoint214 = MakeVertex(ox+arete-rayon, oy, oz+arete)
64 pieceCenter1 = MakeVertex(ox , oy, oz)
65 pieceCenter2 = MakeVertex(ox+arete , oy, oz)
66 pieceCenter3 = MakeVertex(ox , oy, oz+arete)
67 pieceCenter4 = MakeVertex(ox+arete , oy, oz+arete)
69 piecePass1 = MakeVertex(ox+demi , oy, oz+r3)
70 piecePass2 = MakeVertex(ox+arete-demi , oy, oz+r3)
71 piecePass3 = MakeVertex(ox+arete-demi , oy, oz+arete-r3)
72 piecePass4 = MakeVertex(ox+demi , oy, oz+arete-r3)
77 pieceEdgeSquare1 = MakeEdge(piecePoint111, piecePoint211)
78 pieceEdgeSquare2 = MakeEdge(piecePoint114, piecePoint214)
79 pieceEdgeSquare3 = MakeEdge(piecePoint112, piecePoint113)
80 pieceEdgeSquare4 = MakeEdge(piecePoint212, piecePoint213)
82 pieceEdgeDiagonal1 = MakeEdge(piecePoint111, piecePoint213)
83 pieceEdgeDiagonal2 = MakeEdge(piecePoint112, piecePoint214)
85 pieceEdgeArc1 = MakeArc(piecePoint111, piecePass1, piecePoint112)
86 pieceEdgeArc2 = MakeArc(piecePoint211, piecePass2, piecePoint212)
87 pieceEdgeArc3 = MakeArc(piecePoint213, piecePass3, piecePoint214)
88 pieceEdgeArc4 = MakeArc(piecePoint113, piecePass4, piecePoint114)
93 pieceFace1 = MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1)
94 pieceFace2 = MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2)
96 pieceFace3 = MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2)
101 pieceVector = MakeVectorDXDYDZ(0, 1, 0)
103 pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur)
104 pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur)
105 pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur)
110 c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3])
112 piece = MakeGlueFaces(c_cpd, 1.e-5)
117 piece_id = addToStudy(piece, "ex09_grid4build")
122 smesh.SetCurrentStudy(salome.myStudy)
124 # Create a hexahedral mesh
125 # ------------------------
127 hexa = smesh.Mesh(piece, "ex09_grid4build:hexa")
129 algo = hexa.Segment()
130 algo.NumberOfSegments(6)