1 # -*- coding: utf-8 -*-
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 """maillage faces de fissure"""
25 from salome.smesh import smeshBuilder
27 from .geomsmesh import smesh
29 from .putName import putName
31 def mailleFacesFissure(faceFissureExterne, \
32 edgesPipeFissureExterneC, edgesPeauFissureExterneC, \
33 meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad, \
35 """maillage faces de fissure"""
38 meshFaceFiss = smesh.Mesh(faceFissureExterne)
39 logging.info("Maillage avec %s", mailleur)
40 if ( mailleur == "MeshGems"):
41 algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.MG_CADSurf)
42 hypo2d = algo2d.Parameters()
43 hypo2d.SetPhySize( areteFaceFissure )
44 hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
45 hypo2d.SetMaxSize( areteFaceFissure*3. )
46 hypo2d.SetChordalError( areteFaceFissure*0.25 )
47 hypo2d.SetVerbosity( 0 )
49 algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
50 hypo2d = algo2d.Parameters()
51 hypo2d.SetMaxSize( areteFaceFissure )
52 hypo2d.SetSecondOrder( 0 )
53 hypo2d.SetOptimize( 1 )
54 hypo2d.SetFineness( 2 )
55 hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
56 hypo2d.SetQuadAllowed( 0 )
57 putName(algo2d.GetSubMesh(), "faceFiss")
58 putName(algo2d, "algo2d_faceFiss")
59 putName(hypo2d, "hypo2d_faceFiss")
61 texte = "Récupération des arêtes de '{}'".format(edgesPipeFissureExterneC.GetName())
63 algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
64 hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
65 putName(algo1d.GetSubMesh(), "edgeFissPeau")
66 putName(algo1d, "algo1d_edgeFissPeau")
67 putName(hypo1d, "hypo1d_edgeFissPeau")
69 grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
70 grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
71 grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
73 is_done = meshFaceFiss.Compute()
74 text = "meshFaceFiss.Compute"
76 logging.info(text+" OK")
78 text = "Erreur au calcul du maillage.\n" + text
82 return (meshFaceFiss, grpFaceFissureExterne, grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne)