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