Salome HOME
Copyright update 2022
[modules/smesh.git] / src / Tools / blocFissure / gmu / insereFissureLongue_f.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2022  EDF R&D
3 #
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.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 """Insertion de fissure longue - maillage meshBoiteDefaut"""
21
22 import logging
23
24 from salome.smesh import smeshBuilder
25 import SMESH
26
27 from .geomsmesh import smesh
28
29 from .putName import putName
30
31 def insereFissureLongue_f (internalBoundary, meshFondFiss, meshFacePeau, meshFaceFiss, \
32                            mailleur="MeshGems", nro_cas=None):
33   """maillage meshBoiteDefaut"""
34   logging.info('start')
35   logging.info("Usage du mailleur %s pour le cas n°%s", mailleur, nro_cas)
36
37   meshBoiteDefaut = smesh.Concatenate( [internalBoundary.GetMesh(), \
38                                         meshFondFiss.GetMesh(), \
39                                         meshFacePeau.GetMesh(), \
40                                         meshFaceFiss.GetMesh()], \
41                                         1, 1, 1e-05,False )
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()
47   for grp in groups:
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
55
56   # le maillage NETGEN ne passe pas toujours ==> on force l'usage de MG_Tetra
57   mailleur = "MeshGems"
58   logging.info("Maillage avec %s", mailleur)
59   if ( mailleur == "MeshGems"):
60     algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.MG_Tetra)
61   else:
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)
69
70   is_done = meshBoiteDefaut.Compute()
71   text = "meshBoiteDefaut.Compute"
72   if is_done:
73     logging.info(text+" OK")
74   else:
75     text = "Erreur au calcul du maillage.\n" + text
76     logging.info(text)
77     raise Exception(text)
78
79   return meshBoiteDefaut, group_faceFissInPipe, group_faceFissOutPipe