1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2014-2021 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, or (at your option) any later version.
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
20 """Géométrie et maillage de base nécessaire au cas-test :
29 from salome.smesh import smeshBuilder
30 from salome.StdMeshers import StdMeshersBuilder
35 from blocFissure import gmu
36 from blocFissure.gmu.geomsmesh import geompy
37 from blocFissure.gmu.geomsmesh import geomPublish
38 from blocFissure.gmu.geomsmesh import geomPublishInFather
40 from blocFissure.gmu.triedreBase import triedreBase
41 from blocFissure.gmu.putName import putName
42 from blocFissure.gmu import initLog
48 O, OX, OY, OZ = triedreBase()
50 Cylinder_1 = geompy.MakeCylinderRH(100, 300)
51 Cylinder_2 = geompy.MakeCylinderRH(600, 200)
52 Cut_1 = geompy.MakeCut(Cylinder_2, Cylinder_1)
53 Face_1 = geompy.MakeFaceHW(500, 1500, 3)
54 Disque = geompy.MakePartition([Cut_1], [Face_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
55 [Compound_1, Compound_2, Compound_3, Compound_4] = geompy.Propagate(Disque)
56 geompy.addToStudy( Disque, 'Disque' )
57 geompy.addToStudyInFather( Disque, Compound_1, 'Compound_1' )
58 geompy.addToStudyInFather( Disque, Compound_2, 'Compound_2' )
59 geompy.addToStudyInFather( Disque, Compound_3, 'Compound_3' )
60 geompy.addToStudyInFather( Disque, Compound_4, 'Compound_4' )
62 geomPublish(initLog.debug, Cylinder_1, 'Cylinder_1' )
63 geomPublish(initLog.debug, Cylinder_2, 'Cylinder_2' )
64 geomPublish(initLog.debug, Cut_1, 'Cut_1' )
65 geomPublish(initLog.debug, Face_1, 'Face_1' )
71 smesh = smeshBuilder.New()
72 Disque_1 = smesh.Mesh(Disque)
73 putName(Disque_1.GetMesh(), 'Disque')
75 Regular_1D = Disque_1.Segment()
76 Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
77 Nb_Segments_1.SetDistrType( 0 )
78 Hexa_3D = Disque_1.Hexahedron(algo=smeshBuilder.Hexa)
79 Regular_1D_1 = Disque_1.Segment(geom=Compound_3)
80 Nb_Segments_2 = Regular_1D_1.NumberOfSegments(20)
81 Nb_Segments_2.SetDistrType( 0 )
82 Regular_1D_2 = Disque_1.Segment(geom=Compound_4)
83 status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4)
84 Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
87 #smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
88 #smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
89 #smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
90 putName(Nb_Segments_1, 'Nb. Segments_1', i_pref='Disque')
91 putName(Nb_Segments_2, 'Nb. Segments_2', i_pref='Disque')
93 is_done = Disque_1.Compute()
94 text = "Disque_1.Compute"
96 logging.info(text+" OK")
98 text = "Erreur au calcul du maillage.\n" + text
100 raise Exception(text)
102 Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "disque.med"))
104 if salome.sg.hasDesktop():
105 salome.sg.updateObjBrowser()