1 # Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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/
20 # CEA/LGLS 2004-2005, Francis KLOSS (OCC)
21 # =======================================
30 # grid compound of 3 x 3 elements
31 # an element is compound of 3 cylinders concentriques
32 # an element is centered in a square of the grid
33 # the smaller cylinder is a hole
35 # prism the grid, and mesh it in hexahedral way
58 e_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
60 e_hauteur = 2*g_hauteur
61 e_centre = MakeVertex(g_x, g_y-g_hauteur, g_z)
62 e_dir = MakeVectorDXDYDZ(0, 1, 0)
64 e_cyl1 = MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur)
66 e_blo1 = MakeCut(e_boite, e_cyl1)
68 e_cyl2 = MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur)
70 e_blo2 = MakeCut(e_cyl1, e_cyl2)
72 e_cyl3 = MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur)
74 e_blo3 = MakeCut(e_cyl2, e_cyl3)
76 # Partition and repair
77 # --------------------
80 p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim))
81 p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim))
83 p_part = MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], ShapeType["SOLID"])
85 p_element = RemoveExtraEdges(p_part)
90 grid = MakeMultiTranslation2D(p_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
92 piece = MakeGlueFaces(grid, 1e-5)
97 piece_id = addToStudy(piece, "ex11_grid3partition")
102 # Create a hexahedral mesh
103 # ------------------------
105 hexa = smesh.Mesh(piece, "ex11_grid3partition:hexa")
107 algo = hexa.Segment()
108 algo.NumberOfSegments(3)