1 # -*- coding: utf-8 -*-
4 from geomsmesh import smesh
6 from geomsmesh import geompy
8 # -----------------------------------------------------------------------------
9 # --- maillage complet et fissure
11 def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGeomFissure, nomVolume, normal = None):
13 Maillage sain sans la zone de defaut
16 logging.info('Concatenation')
18 maillageComplet = smesh.Concatenate([maillageSain.GetMesh(), blocComplet.GetMesh()], 1, 1, 1e-05,False)
20 groups = maillageComplet.GetGroups()
21 grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
23 grps = [ grp for grp in groups if grp.GetName() == 'nfondfis']
24 noeudsFondFissure = grps[0]
25 grps = [ grp for grp in groups if grp.GetName() == 'fisInPi']
27 grps = [ grp for grp in groups if grp.GetName() == 'fisOutPi']
30 # --- TODO: fiabiliser l'orientation dans le cas general
32 normal = smesh.MakeDirStruct( 0, 0, 1 )
33 maillageComplet.Reorient2D( fisInPi, normal, [0,0,0])
34 maillageComplet.Reorient2D( fisOutPi, normal, [0,0,0])
37 if extrusionFaceFissure is not None:
38 subIds = geompy.SubShapeAllIDs(extrusionFaceFissure, geompy.ShapeType["SOLID"])
40 shapes = geompy.ExtractShapes(extrusionFaceFissure, geompy.ShapeType["SOLID"], False)
42 shapes = [extrusionFaceFissure]
44 # subIds = geompy.SubShapeAllIDs(faceGeomFissure, geompy.ShapeType["FACE"])
46 # shapes = geompy.ExtractShapes(faceGeomFissure, geompy.ShapeType["FACE"], False)
48 # shapes = [faceGeomFissure]
54 shapes = [None] # calcul uniquement avec les normales des faces mailles de la fissure
55 for i, aShape in enumerate(shapes):
56 logging.info('Detection elements affectes par le dedoublement de la face %d'%i)
57 affectedGroups = maillageComplet.AffectedElemGroupsInRegion([faceFissure], [noeudsFondFissure], aShape)
58 grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedEdges']
59 affectedEdges = grps[0]
60 affectedEdges.SetName('affEd%d'%i)
61 grpEdges.append(affectedEdges)
62 grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedFaces']
63 affectedFaces = grps[0]
64 affectedFaces.SetName('affFa%d'%i)
65 grpFaces.append(affectedFaces)
66 grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedVolumes']
67 affectedVolumes = grps[0]
68 affectedVolumes.SetName('affVo%d'%i)
69 grpVolumes.append(affectedVolumes)
70 logging.info("union des groupes d'edges")
71 affectedEdges = maillageComplet.UnionListOfGroups(grpEdges, 'affEdges')
72 logging.info("union des groupes de faces")
73 affectedFaces = maillageComplet.UnionListOfGroups(grpFaces, 'affFaces')
74 logging.info("union des groupes de volumes")
75 affectedVolumes = maillageComplet.UnionListOfGroups(grpVolumes, 'affVols')
76 for grp in affectedGroups:
77 logging.debug("nom groupe %s",grp.GetName())
78 [ FACE2, FACE2_nodes ] = maillageComplet.DoubleNodeElemGroups([faceFissure], [noeudsFondFissure], affectedGroups, True, True)
79 FACE2.SetName( 'FACE2' )
81 GroupVol = maillageComplet.CreateEmptyGroup( SMESH.VOLUME, nomVolume )
82 nbAdd = GroupVol.AddFrom( maillageComplet.GetMesh() )
84 return maillageComplet