1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020 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 """Insertion de fissure longue - maillage meshBoiteDefaut"""
25 from salome.smesh import smeshBuilder
28 from .geomsmesh import smesh
30 from .putName import putName
32 def insereFissureLongue_f (internalBoundary, meshFondFiss, meshFacePeau, meshFaceFiss, \
33 mailleur="MeshGems", nro_cas=-1):
34 """maillage meshBoiteDefaut"""
36 logging.info("Usage du mailleur %s pour le cas n°%d", mailleur, nro_cas)
38 meshBoiteDefaut = smesh.Concatenate( [internalBoundary.GetMesh(), \
39 meshFondFiss.GetMesh(), \
40 meshFacePeau.GetMesh(), \
41 meshFaceFiss.GetMesh()], \
43 # pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes
44 # on designe les faces de peau en quadrangles par le groupe "skinFaces"
45 group_faceFissOutPipe = None
46 group_faceFissInPipe = None
47 groups = meshBoiteDefaut.GetGroups()
49 if grp.GetType() == SMESH.FACE:
50 #if "internalBoundary" in grp.GetName():
51 # grp.SetName("skinFaces")
52 if grp.GetName() == "fisOutPi":
53 group_faceFissOutPipe = grp
54 elif grp.GetName() == "fisInPi":
55 group_faceFissInPipe = grp
57 # le maillage NETGEN ne passe pas toujours ==> on force l'usage de MG_Tetra
59 logging.info("Maillage avec %s", mailleur)
60 if ( mailleur == "MeshGems"):
61 algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.MG_Tetra)
63 algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
64 hypo3d = algo3d.MaxElementVolume(1000.0)
65 hypo3d.SetVerboseLevel( 0 )
66 hypo3d.SetStandardOutputLog( 0 )
67 hypo3d.SetRemoveLogOnSuccess( 1 )
68 putName(algo3d.GetSubMesh(), "boiteDefaut", i_pref=nro_cas)
69 putName(algo3d, "algo3d_boiteDefaut", i_pref=nro_cas)
70 putName(meshBoiteDefaut, "boiteDefaut", i_pref=nro_cas)
72 is_done = meshBoiteDefaut.Compute()
73 text = "meshBoiteDefaut.Compute"
75 logging.info(text+" OK")
77 text = "Erreur au calcul du maillage.\n" + text
81 return meshBoiteDefaut, group_faceFissInPipe, group_faceFissOutPipe