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