dicoParams = dict(nomCas = 'fissTuyau',
maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
- brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
- edgeFissIds = [4],
+ CAOFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFiss = [4],
lgInfluence = 12,
meshBrep = (0.05, 2.0),
rayonPipe = 1.0,
dicoParams = dict(nomCas = 'fissTuyau',
maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
- brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
- edgeFissIds = [4],
+ CAOFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFiss = [4],
lgInfluence = 14,
meshBrep = (0.05, 2.0),
rayonPipe = 1.0,
fissureCoude_9.py
fissure_Coude.py
vis_1.py
+ tube.py
)
# --- rules ---
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import os
-from blocFissure import gmu
-from blocFissure.gmu.geomsmesh import geompy, smesh
+"""problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan"""
-import math
-import GEOM
-import SALOMEDS
-import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
+import os
import logging
+from blocFissure import gmu
+from blocFissure.gmu.geomsmesh import geompy, smesh
from blocFissure.gmu.fissureGenerique import fissureGenerique
-
-from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
-O, OX, OY, OZ = triedreBase()
+import GEOM
+import SALOMEDS
+import SMESH
class cubeAngle(fissureGenerique):
- """
- problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan
- """
+ """problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan"""
nomProbleme = "cubeAngle"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
- logging.info("genereMaillageSain %s", self.nomCas)
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'))
- smesh.SetName(objetSain.GetMesh(), 'objetSain')
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med"))
+ smesh.SetName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme))
return [objetSain, True] # True : maillage hexa
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
- logging.info("setParamShapeFissure %s", self.nomCas)
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
self.shapeFissureParams = dict(lgInfluence = 20,
rayonPipe = 10)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
+ """Importe la géométrie de la fissure"""
+ texte = "genereShapeFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [3])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10, mailleur)
centre = None
+
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ texte = "setParamMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 10)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+ texte = "genereMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 204,
- Entity_Quad_Triangle = 336,
- Entity_Quad_Edge = 278,
- Entity_Quad_Penta = 96,
- Entity_Quad_Hexa = 3651,
- Entity_Node = 20490,
- Entity_Quad_Tetra = 1877,
- Entity_Quad_Quadrangle = 1702)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 1630, \
+ Entity_Quad_Hexa = 3523, \
+ Entity_Node = 18874, \
+ Entity_Quad_Edge = 261, \
+ Entity_Quad_Triangle = 190, \
+ Entity_Quad_Tetra = 1322, \
+ Entity_Quad_Pyramid = 172, \
+ Entity_Quad_Penta = 64 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure plane coupant 2 faces (angle)"""
+
+import os
from .cubeAngle import cubeAngle
class cubeAngle2(cubeAngle):
- """
- problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan
- detection d'un probleme de tolerance sur les edges de jonction pipe et face fissure externe
+ """problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan
+
+ detection d'un probleme de tolerance sur les edges de jonction pipe et face fissure externe
"""
nomProbleme = "cubeAngle2"
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
- """
- paramètres de la fissure pour méthode construitFissureGenerale
+ """paramètres de la fissure pour méthode construitFissureGenerale
+
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 32,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 748,
- Entity_Quad_Triangle = 1228,
- Entity_Quad_Edge = 351,
- Entity_Quad_Penta = 640,
- Entity_Quad_Hexa = 5827,
- Entity_Node = 42865,
- Entity_Quad_Tetra = 9216,
- Entity_Quad_Quadrangle = 2518)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 2350, \
+ Entity_Quad_Hexa = 5315, \
+ Entity_Node = 38196, \
+ Entity_Quad_Edge = 345, \
+ Entity_Quad_Triangle = 1214, \
+ Entity_Quad_Tetra = 7772, \
+ Entity_Quad_Pyramid = 620, \
+ Entity_Quad_Penta = 512 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure plane coupant le cube dans un coin"""
+
import os
from blocFissure import gmu
-dicoParams = dict(nomCas = 'cubeCoin',
- maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
- brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"),
- edgeFissIds = [6],
+dicoParams = dict(nomCas = "cubeCoin",
+ maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"),
+ CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Coin.brep"),
+ edgeFiss = [3],
lgInfluence = 50,
meshBrep = (5,10),
rayonPipe = 10,
# ---------------------------------------------------------------------------
-referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Hexa = 0,
- Entity_Node = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Quadrangle = 0)
-
+referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 2740, \
+ Entity_Quad_Hexa = 7420, \
+ Entity_Node = 46394, \
+ Entity_Quad_Edge = 323, \
+ Entity_Quad_Triangle = 486, \
+ Entity_Quad_Tetra = 8512, \
+ Entity_Quad_Pyramid = 460, \
+ Entity_Quad_Penta = 80 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure plane coupant le cube au milieu"""
+
import os
from blocFissure import gmu
-dicoParams = dict(nomCas = 'cubeMilieu',
- maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
- brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"),
- edgeFissIds = [6],
+dicoParams = dict(nomCas = "cubeMilieu",
+ maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"),
+ CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Milieu.brep"),
+ edgeFiss = [3],
lgInfluence = 50,
meshBrep = (5,10),
rayonPipe = 10,
# ---------------------------------------------------------------------------
-referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Hexa = 0,
- Entity_Node = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Quadrangle = 0)
-
+referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 3140, \
+ Entity_Quad_Hexa = 7120, \
+ Entity_Node = 61414, \
+ Entity_Quad_Edge = 346, \
+ Entity_Quad_Triangle = 818, \
+ Entity_Quad_Tetra = 19117, \
+ Entity_Quad_Pyramid = 990, \
+ Entity_Quad_Penta = 230 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure plane coupant le cube au milieu"""
+
import os
from blocFissure import gmu
-dicoParams = dict(nomCas = 'cubeTransverse',
- maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
- brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"),
- edgeFissIds = [6],
+dicoParams = dict(nomCas = "cubeTransverse",
+ maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"),
+ CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Transverse.brep"),
+ edgeFiss = [6],
lgInfluence = 50,
meshBrep = (5,10),
rayonPipe = 10,
# ---------------------------------------------------------------------------
-referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Hexa = 0,
- Entity_Node = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Quadrangle = 0)
-
+referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 2900, \
+ Entity_Quad_Hexa = 7000, \
+ Entity_Node = 58430, \
+ Entity_Quad_Edge = 390, \
+ Entity_Quad_Triangle = 1228, \
+ Entity_Quad_Tetra = 17567, \
+ Entity_Quad_Pyramid = 780, \
+ Entity_Quad_Penta = 200 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import os
-from blocFissure import gmu
-from blocFissure.gmu.geomsmesh import geompy, smesh
+"""problème de fissure plane sur cylindre, grand fond de fissure en arc de cercle"""
-import math
-import GEOM
-import SALOMEDS
-import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
+import os
import logging
+from blocFissure import gmu
+from blocFissure.gmu.geomsmesh import geompy, smesh
from blocFissure.gmu.fissureGenerique import fissureGenerique
-
-from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
-O, OX, OY, OZ = triedreBase()
+import GEOM
+import SALOMEDS
+import SMESH
class cylindre(fissureGenerique):
- """
- problème de fissure plane sur cylindre, grand fond de fissure en arc de cercle
- """
+ """problème de fissure plane sur cylindre, grand fond de fissure en arc de cercle"""
nomProbleme = "cylindre"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
"""
logging.info("genereMaillageSain %s", self.nomCas)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/CylindreSain.med"))
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "CylindreSain.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
rayonPipe = 5)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre2.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [6])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15, mailleur)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 20)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1270,
- Entity_Quad_Triangle = 1260,
- Entity_Quad_Edge = 758,
- Entity_Quad_Penta = 496,
- Entity_Quad_Hexa = 18814,
- Entity_Node = 113313,
- Entity_Quad_Tetra = 20469,
- Entity_Quad_Quadrangle = 7280)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 6920, \
+ Entity_Quad_Hexa = 18174, \
+ Entity_Node = 104349, \
+ Entity_Quad_Edge = 718, \
+ Entity_Quad_Triangle = 952, \
+ Entity_Quad_Tetra = 16691, \
+ Entity_Quad_Pyramid = 1110, \
+ Entity_Quad_Penta = 336 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure plane sur cylindre hexa, fond de fissure complexe : polyline"""
+
import os
+import logging
+
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
+from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-import math
import GEOM
import SALOMEDS
import SMESH
-import logging
from .cylindre import cylindre
-from blocFissure.gmu.triedreBase import triedreBase
-from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
-
-O, OX, OY, OZ = triedreBase()
-
class cylindre_2(cylindre):
- """
- problème de fissure plane sur cylindre hexa, fond de fissure complexe : polyline
- """
+ """problème de fissure plane sur cylindre hexa, fond de fissure complexe : polyline"""
+
nomProbleme = "cylindre2"
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [3])
+ geompy.UnionIDs(fondFiss, [6])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15, mailleur)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1334,
- Entity_Quad_Triangle = 1432,
- Entity_Quad_Edge = 785,
- Entity_Quad_Penta = 560,
- Entity_Quad_Hexa = 19070,
- Entity_Node = 114290,
- Entity_Quad_Tetra = 19978,
- Entity_Quad_Quadrangle = 7424)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 7028, \
+ Entity_Quad_Hexa = 18366, \
+ Entity_Node = 105035, \
+ Entity_Quad_Edge = 735, \
+ Entity_Quad_Triangle = 1056, \
+ Entity_Quad_Tetra = 16305, \
+ Entity_Quad_Pyramid = 1158, \
+ Entity_Quad_Penta = 384 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""disque percé"""
+
import os
from blocFissure import gmu
dicoParams = dict(nomCas = 'disque',
- maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/disque.med'),
- brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"),
- edgeFissIds = [3],
+ maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "disque.med"),
+ CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_disque.brep"),
+ edgeFiss = [3],
lgInfluence = 10,
meshBrep = (0.5,2.5),
rayonPipe = 1.0,
# ---------------------------------------------------------------------------
-referencesMaillageFissure = dict(Entity_Quad_Pyramid = 610,
- Entity_Quad_Triangle = 1284,
- Entity_Quad_Edge = 393,
- Entity_Quad_Penta = 592,
- Entity_Quad_Hexa = 6952,
- Entity_Node = 51119,
- Entity_Quad_Tetra = 11672,
- Entity_Quad_Quadrangle = 3000)
-
+referencesMaillageFissure = dict ( \
+ Entity_Quad_Quadrangle = 2748, \
+ Entity_Quad_Hexa = 6232, \
+ Entity_Node = 43889, \
+ Entity_Quad_Edge = 376, \
+ Entity_Quad_Triangle = 1366, \
+ Entity_Quad_Tetra = 9112, \
+ Entity_Quad_Pyramid = 466, \
+ Entity_Quad_Penta = 448 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import os
-from blocFissure import gmu
-from blocFissure.gmu.geomsmesh import geompy, smesh
+"""problème de fissure non plane, débouchante non normale"""
-import math
-import GEOM
-import SALOMEDS
-import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
+import os
import logging
+from blocFissure import gmu
+from blocFissure.gmu.geomsmesh import geompy, smesh
from blocFissure.gmu.fissureGenerique import fissureGenerique
-
-from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
-O, OX, OY, OZ = triedreBase()
+import GEOM
+import SALOMEDS
+import SMESH
class ellipse_1(fissureGenerique):
- """
- problème de fissure non plane, débouchante non normale
- """
+ """problème de fissure non plane, débouchante non normale"""
nomProbleme = "ellipse1"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# # ---------------------------------------------------------------------------
# def genereGeometrieSaine(self, geomParams):
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
- logging.info("genereMaillageSain %s", self.nomCas)
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/boiteSaine.med"))
- smesh.SetName(objetSain.GetMesh(), 'objetSain')
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med"))
+ smesh.SetName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme))
return [objetSain, True] # True : maillage hexa
convexe : optionnel, True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
pointIn_x : optionnel, coordonnée x d'un point dans le solide sain (pour orienter la face)
"""
- logging.info("setParamShapeFissure %s", self.nomCas)
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
self.shapeFissureParams = dict(lgInfluence = 50,
rayonPipe = 20)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
+ """Importe la géométrie de la fissure"""
+ texte = "genereShapeFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [3])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25, mailleur)
centre = None
+
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ texte = "setParamMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 1000)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ texte = "genereMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 175,
- Entity_Quad_Triangle = 298,
- Entity_Quad_Edge = 248,
- Entity_Quad_Penta = 96,
- Entity_Quad_Hexa = 3699,
- Entity_Node = 20741,
- Entity_Quad_Tetra = 1979,
- Entity_Quad_Quadrangle = 1694)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 1748, \
+ Entity_Quad_Hexa = 3795, \
+ Entity_Node = 21939, \
+ Entity_Quad_Edge = 256, \
+ Entity_Quad_Triangle = 360, \
+ Entity_Quad_Tetra = 2425, \
+ Entity_Quad_Pyramid = 199, \
+ Entity_Quad_Penta = 120 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure non plane, débouchante non normale"""
+
import os
+import logging
+
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
+from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-import math
import GEOM
import SALOMEDS
import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
-import logging
from .ellipse_1 import ellipse_1
-from blocFissure.gmu.triedreBase import triedreBase
-from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
-
-O, OX, OY, OZ = triedreBase()
-
class ellipse_2(ellipse_1):
- """
- problème de fissure non plane, débouchante non normale
- """
+ """problème de fissure non plane, débouchante non normale"""
nomProbleme = "ellipse2"
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
+ """Importe la géométrie de la fissure"""
+ texte = "genereShapeFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1_pb.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [3])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25, mailleur)
centre = None
+
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 159,
- Entity_Quad_Triangle = 438,
- Entity_Quad_Edge = 249,
- Entity_Quad_Penta = 80,
- Entity_Quad_Hexa = 3635,
- Entity_Node = 20519,
- Entity_Quad_Tetra = 1973,
- Entity_Quad_Quadrangle = 1658)
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 1748, \
+ Entity_Quad_Hexa = 3795, \
+ Entity_Node = 22219, \
+ Entity_Quad_Edge = 258, \
+ Entity_Quad_Triangle = 434, \
+ Entity_Quad_Tetra = 2574, \
+ Entity_Quad_Pyramid = 199, \
+ Entity_Quad_Penta = 120 \
+ )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import os
-from blocFissure import gmu
-from blocFissure.gmu.geomsmesh import geompy, smesh
+"""problème de fissure plane coupant 3 faces (éprouvette), faces au débouché non planes, incidence presque normale"""
-import math
-import GEOM
-import SALOMEDS
-import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
+import os
import logging
+from blocFissure import gmu
+from blocFissure.gmu.geomsmesh import geompy, smesh
from blocFissure.gmu.fissureGenerique import fissureGenerique
-
-from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
-O, OX, OY, OZ = triedreBase()
+import GEOM
+import SALOMEDS
+import SMESH
class eprouvetteCourbe(fissureGenerique):
- """
- problème de fissure plane coupant 3 faces (éprouvette), faces au débouché non planes, incidence presque normale
- """
+ """problème de fissure plane coupant 3 faces (éprouvette), faces au débouché non planes, incidence presque normale"""
nomProbleme = "eprouvetteCourbe"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
- logging.info("genereMaillageSain %s", self.nomCas)
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"))
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbe.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face)
"""
- logging.info("setParamShapeFissure %s", self.nomCas)
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
self.shapeFissureParams = dict(lgInfluence = 30,
rayonPipe = 10)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
+ """Importe la géométrie de la fissure"""
+ texte = "genereShapeFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbeFiss.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [8])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10, mailleur)
centre = None
+
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ texte = "setParamMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 15)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ texte = "genereMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 618,
- Entity_Quad_Triangle = 1224,
- Entity_Quad_Edge = 578,
- Entity_Quad_Penta = 168,
- Entity_Quad_Hexa = 18342,
- Entity_Node = 98170,
- Entity_Quad_Tetra = 10809,
- Entity_Quad_Quadrangle = 5408)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 5318, \
+ Entity_Quad_Hexa = 18182, \
+ Entity_Node = 94472, \
+ Entity_Quad_Edge = 539, \
+ Entity_Quad_Triangle = 828, \
+ Entity_Quad_Tetra = 9024, \
+ Entity_Quad_Pyramid = 578, \
+ Entity_Quad_Penta = 128 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure plane coupant 3 faces (éprouvette), débouches normaux, objet plan"""
import os
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
-import os
-import math
import GEOM
import SALOMEDS
import SMESH
O, OX, OY, OZ = triedreBase()
class eprouvetteDroite(fissureGenerique):
- """
- problème de fissure plane coupant 3 faces (éprouvette), débouches normaux, objet plan
- """
+ """problème de fissure plane coupant 3 faces (éprouvette), débouches normaux, objet plan"""
nomProbleme = "eprouvetteDroite"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/eprouvetteDroite.med"))
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "eprouvetteDroite.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
lenSegPipe = 6)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss_1.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [8])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10, mailleur)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 15)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 368,
- Entity_Quad_Triangle = 798,
- Entity_Quad_Edge = 491,
- Entity_Quad_Penta = 88,
- Entity_Quad_Hexa = 9692,
- Entity_Node = 52652,
- Entity_Quad_Tetra = 5093,
- Entity_Quad_Quadrangle = 3750)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 3768, \
+ Entity_Quad_Hexa = 9724, \
+ Entity_Node = 52337, \
+ Entity_Quad_Edge = 457, \
+ Entity_Quad_Triangle = 570, \
+ Entity_Quad_Tetra = 4919, \
+ Entity_Quad_Pyramid = 376, \
+ Entity_Quad_Penta = 96 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure plane coupant 3 faces (éprouvette), débouches non normaux, objet plan"""
import os
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
-import math
import GEOM
import SALOMEDS
import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
import logging
from .eprouvetteDroite import eprouvetteDroite
-from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
-
-O, OX, OY, OZ = triedreBase()
class eprouvetteDroite_2(eprouvetteDroite):
- """
- problème de fissure plane coupant 3 faces (éprouvette), débouches non normaux, objet plan
- """
+ """problème de fissure plane coupant 3 faces (éprouvette), débouches non normaux, objet plan"""
- nomProbleme = "eprouvetteDroite2"
+ nomProbleme = "eprouvetteDroite_2"
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss_2.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [10])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10, mailleur)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 396,
- Entity_Quad_Triangle = 1084,
- Entity_Quad_Edge = 510,
- Entity_Quad_Penta = 96,
- Entity_Quad_Hexa = 9504,
- Entity_Node = 55482,
- Entity_Quad_Tetra = 7545,
- Entity_Quad_Quadrangle = 3724)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 3724, \
+ Entity_Quad_Hexa = 9504, \
+ Entity_Node = 54049, \
+ Entity_Quad_Edge = 478, \
+ Entity_Quad_Triangle = 724, \
+ Entity_Quad_Tetra = 6766, \
+ Entity_Quad_Pyramid = 396, \
+ Entity_Quad_Penta = 96 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Lancement des cas-tests de blocFissure"""
-import sys, traceback
+import traceback
import logging
from blocFissure import gmu
from blocFissure.gmu import initLog
+from blocFissure.gmu import geomsmesh
+from blocFissure.gmu.casStandard import casStandard
# -----------------------------------------------------------------------------------------------
#initLog.setDebug()
-initLog.setVerbose()
+#initLog.setVerbose()
#initLog.setRelease()
#initLog.setPerfTests()
-# ---tous les cas en sequence, ou les cas selectionnés ...
-runall = True
-if runall:
- torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
-else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29
- torun = [ 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+# ---tous les cas en séquence, ou les cas sélectionnés ...
+TORUNOK = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # OK
+# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
+#RUNALL = False
+RUNALL = True
+if RUNALL:
+ TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
+# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
+else:
+ TORUNPB = list()
+ for IAUX in TORUNOK:
+ TORUNPB.append((IAUX+1)%2)
+ print ("TORUN = {} # OK".format(TORUNOK))
+ print ("TORUN = {} # PB".format(TORUNPB))
+# genereMateriel
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # aucun
+ TORUN = [ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeAngle
+ TORUN = [ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeFin
+ TORUN = [ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # decoupeCylindre
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # disque_perce + ellipse_disque
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # ellipse + fissureGauche2
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # ellipse_probleme + fissureGauche2
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteCourbe
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteDroite
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche + fissureGauche2
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] # vis
+ TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] # tube
+# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
+ TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # OK
# -----------------------------------------------------------------------------------------------
-from blocFissure.gmu import geomsmesh
-from blocFissure.gmu.casStandard import casStandard
-
-problemes = list()
-
-cas=0
-from blocFissure.CasTests.cubeAngle import cubeAngle
-problemes.append(cubeAngle(cas))
-
-cas+=1
-from blocFissure.CasTests.cubeAngle2 import cubeAngle2
-problemes.append(cubeAngle2(cas))
-
-cas+=1
-from blocFissure.CasTests import cubeCoin
-problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, cas))
-
-cas+=1
-from blocFissure.CasTests import cubeMilieu
-problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, cas))
-
-cas+=1
-from blocFissure.CasTests import cubeTransverse
-problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, cas))
-
-cas+=1
-from blocFissure.CasTests.cylindre import cylindre
-problemes.append(cylindre(cas))
-
-cas+=1
-from blocFissure.CasTests.cylindre_2 import cylindre_2
-problemes.append(cylindre_2(cas))
-
-cas+=1
-from blocFissure.CasTests import disquePerce
-problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, cas))
-
-cas+=1
-from blocFissure.CasTests.ellipse_1 import ellipse_1
-problemes.append(ellipse_1(cas))
-
-cas+=1
-from blocFissure.CasTests.ellipse_2 import ellipse_2
-problemes.append(ellipse_2(cas))
-
-cas+=1
-from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
-problemes.append(eprouvetteCourbe(cas))
-
-cas+=1
-from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
-problemes.append(eprouvetteDroite(cas))
-
-cas+=1
-from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
-problemes.append(eprouvetteDroite_2(cas))
-
-cas+=1
-from blocFissure.CasTests.faceGauche import faceGauche
-problemes.append(faceGauche(cas))
-
-cas+=1
-from blocFissure.CasTests.faceGauche_2 import faceGauche_2
-problemes.append(faceGauche_2(cas))
-
-cas+=1
-from blocFissure.CasTests.fissure_Coude import fissure_Coude
-problemes.append(fissure_Coude(cas))
-
-cas+=1
-from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
-problemes.append(fissure_Coude_4(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
-problemes.append(fissureCoude_1(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
-problemes.append(fissureCoude_2(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
-problemes.append(fissureCoude_3(cas))
-
-cas+=1
-from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
-problemes.append(fissure_Coude_4(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
-problemes.append(fissureCoude_4(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
-problemes.append(fissureCoude_5(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
-problemes.append(fissureCoude_6(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
-problemes.append(fissureCoude_7(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
-problemes.append(fissureCoude_8(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
-problemes.append(fissureCoude_9(cas))
-
-cas+=1
-from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
-problemes.append(fissureCoude_10(cas))
-
-cas+=1
-from blocFissure.CasTests.vis_1 import vis_1
-problemes.append(vis_1(cas))
-
-for iaux, cas in enumerate(problemes):
- if torun[iaux]:
- logging.critical("=== Execution cas {}".format(iaux))
- try:
- cas.executeProbleme()
- except:
- traceback.print_exc()
- print("---------------------------------------------------------------------")
+def caract_l_problemes ():
+ """Caractérisation des problèmes"""
+ d_aux = dict()
+ l_problemes = list()
+
+ n_cas = 0
+ # genereMateriel : cubeAngle
+ from blocFissure.CasTests.cubeAngle import cubeAngle
+ l_problemes.append(cubeAngle(n_cas))
+
+ n_cas = 1
+ # genereMateriel : cubeAngle
+ from blocFissure.CasTests.cubeAngle2 import cubeAngle2
+ l_problemes.append(cubeAngle2(n_cas))
+
+ n_cas = 2
+ # genereMateriel : cubeFin
+ from blocFissure.CasTests import cubeCoin
+ l_problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, n_cas))
+ d_aux[n_cas] = "cubeCoin"
+
+ n_cas = 3
+ # genereMateriel : cubeFin
+ from blocFissure.CasTests import cubeMilieu
+ l_problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, n_cas))
+ d_aux[n_cas] = "cubeMilieu"
+
+ n_cas = 4
+ # genereMateriel : cubeFin
+ from blocFissure.CasTests import cubeTransverse
+ l_problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, n_cas))
+ d_aux[n_cas] = "cubeTransverse"
+
+ n_cas = 5
+ # genereMateriel : decoupeCylindre
+ from blocFissure.CasTests.cylindre import cylindre
+ l_problemes.append(cylindre(n_cas))
+
+ n_cas = 6
+ # genereMateriel : decoupeCylindre
+ from blocFissure.CasTests.cylindre_2 import cylindre_2
+ l_problemes.append(cylindre_2(n_cas))
+
+ n_cas = 7
+ # genereMateriel : disque_perce
+ # genereMateriel : ellipse_disque
+ from blocFissure.CasTests import disquePerce
+ l_problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, n_cas))
+ d_aux[n_cas] = "disquePerce"
+
+ n_cas = 8
+ # genereMateriel: ellipse
+ # genereMateriel : fissureGauche2
+ from blocFissure.CasTests.ellipse_1 import ellipse_1
+ l_problemes.append(ellipse_1(n_cas))
+
+ n_cas = 9
+ # genereMateriel: ellipse_probleme
+ # genereMateriel : fissureGauche2
+ from blocFissure.CasTests.ellipse_2 import ellipse_2
+ l_problemes.append(ellipse_2(n_cas))
+
+ n_cas = 10
+ # genereMateriel : eprouvetteCourbe
+ from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
+ l_problemes.append(eprouvetteCourbe(n_cas))
+
+ n_cas = 11
+ # genereMateriel : eprouvetteDroite
+ from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
+ l_problemes.append(eprouvetteDroite(n_cas))
+
+ n_cas = 12
+ # genereMateriel : eprouvetteDroite
+ from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
+ l_problemes.append(eprouvetteDroite_2(n_cas))
+
+ n_cas = 13
+ # genereMateriel : fissureGauche
+ # genereMateriel : fissureGauche2
+ from blocFissure.CasTests.faceGauche import faceGauche
+ l_problemes.append(faceGauche(n_cas))
+
+ n_cas = 14
+ # genereMateriel : aucun
+ from blocFissure.CasTests.faceGauche_2 import faceGauche_2
+ l_problemes.append(faceGauche_2(n_cas))
+ #"boiteDefaut" has not been computed:
+ #- "algo3d_boiteDefaut" failed. Error: Algorithm failed. Presumably, the surface mesh is not compatible with the domain being processed (warning).
+ #An edge is unique (i.e., bounds a hole in the surface).
+ #The surface mesh includes at least one hole. The domain is not well defined.
+ #See /tmp/GHS3D_18605_10269264.log for more information
+ #Traceback (most recent call last):
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 222, in <module>
+ #ok_maillage = cas.executeProbleme()
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/fissureGenerique.py", line 122, in executeProbleme
+ #self.maillageFissureParams, elementsDefaut, step)
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/faceGauche_2.py", line 108, in genereMaillageFissure
+ #maillageFissureParams, elementsDefaut, step)
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/construitFissureGenerale.py", line 330, in construitFissureGenerale
+ #raise Exception(text)
+ #Exception: Erreur au calcul du maillage.
+
+ n_cas = 15
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
+ l_problemes.append(fissureCoude_1(n_cas))
+
+ n_cas = 16
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
+ l_problemes.append(fissureCoude_2(n_cas))
+
+ n_cas = 17
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
+ l_problemes.append(fissureCoude_3(n_cas))
+
+ n_cas = 18
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
+ l_problemes.append(fissureCoude_4(n_cas))
+
+ n_cas = 19
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
+ l_problemes.append(fissureCoude_5(n_cas))
+
+ n_cas = 20
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
+ l_problemes.append(fissureCoude_6(n_cas))
+
+ n_cas = 21
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
+ l_problemes.append(fissureCoude_7(n_cas))
+
+ n_cas = 22
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
+ l_problemes.append(fissureCoude_8(n_cas))
+
+ n_cas = 23
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
+ l_problemes.append(fissureCoude_9(n_cas))
+
+ n_cas = 24
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
+ l_problemes.append(fissureCoude_10(n_cas))
+
+ n_cas = 25
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissure_Coude import fissure_Coude
+ l_problemes.append(fissure_Coude(n_cas))
+
+ n_cas = 26
+ # genereMateriel : aucun
+ from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
+ l_problemes.append(fissure_Coude_4(n_cas))
+
+ n_cas = 27
+ # genereMateriel : vis
+ from blocFissure.CasTests.vis_1 import vis_1
+ l_problemes.append(vis_1(n_cas))
+ #"Mesh_22" has not been computed:
+ #- "algo2d_faceFiss" failed on FACE #2. Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
+ #- "algo1d_edgeFissPeau" failed on EDGE #9. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
+ #Traceback (most recent call last):
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 233, in <module>
+ #ok_maillage = cas.executeProbleme()
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/fissureGenerique.py", line 122, in executeProbleme
+ #self.maillageFissureParams, elementsDefaut, step)
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/vis_1.py", line 116, in genereMaillageFissure
+ #maillageFissureParams, elementsDefaut, step)
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/construitFissureGenerale.py", line 282, in construitFissureGenerale
+ #meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad)
+ #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/mailleFacesFissure.py", line 69, in mailleFacesFissure
+ #raise Exception(text)
+ #Exception: Erreur au calcul du maillage.
+
+ n_cas = 28
+ # genereMateriel : tube
+ from blocFissure.CasTests.tube import tube
+ l_problemes.append(tube(n_cas))
+ #"Mesh_13" has not been computed:
+ #- "algo2d_facePeau_0" failed on "FACE_12 to mesh". Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
+ #- "algo1d_cercle1_0" failed on EDGE #20. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
+ #- "algo1d_cercle1_0" failed on EDGE #17. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
+ #- "algo1d_cercle1_0" failed on EDGE #15. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
+ #- "algo1d_cercle1_0" failed on EDGE #12. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
+
+ return l_problemes, d_aux
+#=============================================================
+def calcul_cas (n_cas, cas, d_aux, ligne):
+ """Calcul d'un cas"""
+ texte = ""
+ if n_cas in d_aux:
+ nom = d_aux[n_cas]
+ else:
+ nom = cas.nomProbleme
+ texte_a = "\n=== Exécution du cas n° {}, '{}'".format(n_cas,nom)
+ logging.critical(ligne+texte_a)
+ try:
+ ok_maillage = cas.executeProbleme()
+ except:
+ traceback.print_exc()
+ texte = "Problème avec le cas n° {}, '{}'\n".format(n_cas,nom)
+ ok_maillage = False
+ print(ligne)
+ return ok_maillage, texte
+#=============================================================
+def calcul_tout (l_problemes, d_aux):
+ """Calcul de tous les cas"""
+
+ ligne = "---------------------------------------------------------------------"
+ texte = ""
+ nb_cas_ok = 0
+ nb_cas_nook = 0
+ for n_cas, cas in enumerate(l_problemes):
+ #print ("Cas n° {}, '{}'".format(n_cas,cas.nomProbleme))
+ if TORUN[n_cas]:
+ ok_maillage, texte_a = calcul_cas (n_cas, cas, d_aux, ligne)
+ texte += texte_a
+ if ok_maillage:
+ nb_cas_ok += 1
+ else:
+ nb_cas_nook += 1
+ print(ligne)
+
+ nb_cas = nb_cas_nook + nb_cas_ok
+ if ( nb_cas > 1):
+ if nb_cas_nook:
+ texte += ". Nombre de cas_tests OK : {}\n".format(nb_cas_ok)
+ texte += ". Nombre de cas_tests NOOK : {}\n".format(nb_cas_nook)
+ else:
+ texte += "Les {} tests se sont bien passés.\n".format(nb_cas)
+ print (texte+ligne)
+
+ return
+#=============================================================
+#=============================================================
+
+while True:
+
+ L_PROBLEMES, D_AUX = caract_l_problemes()
+
+ if ( len(L_PROBLEMES) != len(TORUN) ):
+ TEXTE = "\nNombre de problèmes définis : {}\n".format(len(L_PROBLEMES))
+ TEXTE += "Longueur de la liste 'TORUN' : {}\n".format(len(TORUN))
+ TEXTE += "\t==> Incohérence de programmation à corriger dans {}".format(__name__)
+ print (TEXTE)
+ break
+
+ calcul_tout (L_PROBLEMES, D_AUX)
+
+ break
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure non plane, débouchante non normale"""
import os
from blocFissure import gmu
import GEOM
import SALOMEDS
import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
+
import logging
from blocFissure.gmu.fissureGenerique import fissureGenerique
O, OX, OY, OZ = triedreBase()
class faceGauche(fissureGenerique):
- """
- problème de fissure non plane, débouchante non normale
- """
+ """problème de fissure non plane, débouchante non normale"""
nomProbleme = "faceGauche"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheSain.med"))
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheSain.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
rayonPipe = 20)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheFiss.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [6])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,50)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,50, mailleur)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 1000)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1284,
- Entity_Quad_Triangle = 2336,
- Entity_Quad_Edge = 758,
- Entity_Quad_Penta = 984,
- Entity_Quad_Hexa = 6416,
- Entity_Node = 85673,
- Entity_Quad_Tetra = 35990,
- Entity_Quad_Quadrangle = 4285)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 3997, \
+ Entity_Quad_Hexa = 5904, \
+ Entity_Node = 77735, \
+ Entity_Quad_Edge = 725, \
+ Entity_Quad_Triangle = 2176, \
+ Entity_Quad_Tetra = 32320, \
+ Entity_Quad_Pyramid = 1156, \
+ Entity_Quad_Penta = 856 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure non plane, débouchante non normale"""
import os
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
-import math
import GEOM
import SALOMEDS
import SMESH
O, OX, OY, OZ = triedreBase()
class faceGauche_2(fissureGenerique):
- """
- problème de fissure non plane, débouchante non normale
- """
+ """problème de fissure non plane, débouchante non normale"""
- nomProbleme = "faceGauche2"
+ nomProbleme = "faceGauche_2"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/boiteSaine.med"))
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
- """
- paramètres de la fissure pour méthode construitFissureGenerale
+ """paramètres de la fissure pour méthode construitFissureGenerale
+
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
rayonPipe = 20)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2FissCoupe.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [14, 9])
+ geompy.UnionIDs(fondFiss, [4, 12])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25, mailleur)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 1000)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 859,
- Entity_Quad_Triangle = 634,
- Entity_Quad_Edge = 323,
- Entity_Quad_Penta = 288,
- Entity_Quad_Hexa = 3435,
- Entity_Node = 44095,
- Entity_Quad_Tetra = 18400,
- Entity_Quad_Quadrangle = 2542)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 2542, \
+ Entity_Quad_Hexa = 3435, \
+ Entity_Node = 44095, \
+ Entity_Quad_Edge = 323, \
+ Entity_Quad_Triangle = 634, \
+ Entity_Quad_Tetra = 18400, \
+ Entity_Quad_Pyramid = 859, \
+ Entity_Quad_Penta = 288 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_1(fissureCoude):
- """
- problème de fissure du Coude :
- adaptation maillage
- """
+ """problème de fissure du Coude : adaptation maillage"""
+
+ nomProbleme = "fissureCoude_1"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 6,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 77917,
- Entity_Quad_Edge = 975,
- Entity_Quad_Triangle = 2182,
- Entity_Quad_Quadrangle = 6842,
- Entity_Quad_Tetra = 20135,
- Entity_Quad_Hexa = 8994,
- Entity_Quad_Penta = 972,
- Entity_Quad_Pyramid = 1038)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 6042, \
+ Entity_Quad_Hexa = 7794, \
+ Entity_Node = 65337, \
+ Entity_Quad_Edge = 874, \
+ Entity_Quad_Triangle = 2058, \
+ Entity_Quad_Tetra = 16037, \
+ Entity_Quad_Pyramid = 738, \
+ Entity_Quad_Penta = 672 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude - cas test ASCOU17"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_10(fissureCoude):
- # cas test ASCOU17
+ """Fissure dans un coude - cas test ASCOU17"""
+ nomProbleme = "fissureCoude_10"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
- Paramètres géométriques du tuyau coudé sain:
+ Paramètres géométriques du tuyau coudé sain
angleCoude
r_cintr
l_tube_p1
externe = False)
# ---------------------------------------------------------------------------
-
+
def setParamMaillageFissure(self):
"""
Paramètres du maillage de la fissure pour le tuyau coudé
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 3,
nbsegCercle = 8,
areteFaceFissure = 2.5)
-
+
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 93352,
- Entity_Quad_Edge = 1456,
- Entity_Quad_Triangle = 8934,
- Entity_Quad_Quadrangle = 6978,
- Entity_Quad_Tetra = 31147,
- Entity_Quad_Hexa = 6972,
- Entity_Quad_Penta = 1600,
- Entity_Quad_Pyramid = 1696)
-
+ self.referencesMaillageFissure = dict ( \
+ Entity_Quad_Quadrangle = 6160, \
+ Entity_Quad_Hexa = 5864, \
+ Entity_Node = 78012, \
+ Entity_Quad_Edge = 1346, \
+ Entity_Quad_Triangle = 9022, \
+ Entity_Quad_Tetra = 24341, \
+ Entity_Quad_Pyramid = 1232, \
+ Entity_Quad_Penta = 1136 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_2(fissureCoude):
- """
- problème de fissure du Coude :
- adaptation maillage
- """
+ """problème de fissure du Coude : adaptation maillage"""
+
+ nomProbleme = "fissureCoude_2"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 6,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 132120,
- Entity_Quad_Edge = 1411,
- Entity_Quad_Triangle = 5342,
- Entity_Quad_Quadrangle = 9524,
- Entity_Quad_Tetra = 40902,
- Entity_Quad_Hexa = 12981,
- Entity_Quad_Penta = 1980,
- Entity_Quad_Pyramid = 2064)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 7828, \
+ Entity_Quad_Hexa = 10437, \
+ Entity_Node = 101695, \
+ Entity_Quad_Edge = 1199, \
+ Entity_Quad_Triangle = 4230, \
+ Entity_Quad_Tetra = 30013, \
+ Entity_Quad_Pyramid = 1428, \
+ Entity_Quad_Penta = 1344 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_3(fissureCoude):
- """
- problème de fissure du Coude
- adaptation maillage
- """
+ """problème de fissure du Coude - adaptation maillage"""
+
+ nomProbleme = "fissureCoude_3"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 6,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 98643,
- Entity_Quad_Edge = 1130,
- Entity_Quad_Triangle = 1476,
- Entity_Quad_Quadrangle = 11100,
- Entity_Quad_Tetra = 15993,
- Entity_Quad_Hexa = 14508,
- Entity_Quad_Penta = 624,
- Entity_Quad_Pyramid = 788)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 10604, \
+ Entity_Quad_Hexa = 13764, \
+ Entity_Node = 89087, \
+ Entity_Quad_Edge = 1065, \
+ Entity_Quad_Triangle = 1326, \
+ Entity_Quad_Tetra = 12185, \
+ Entity_Quad_Pyramid = 602, \
+ Entity_Quad_Penta = 438 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude - ASCOU09A"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_4(fissureCoude):
- """
- problème de fissure du Coude : ASCOU09A
- adaptation maillage
- """
+ """problème de fissure du Coude : ASCOU09A - adaptation maillage"""
+
+ nomProbleme = "fissureCoude_4"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 6,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 133832,
- Entity_Quad_Edge = 1133,
- Entity_Quad_Triangle = 1498,
- Entity_Quad_Quadrangle = 11892,
- Entity_Quad_Tetra = 18401,
- Entity_Quad_Hexa = 22412,
- Entity_Quad_Penta = 600,
- Entity_Quad_Pyramid = 816)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 11428, \
+ Entity_Quad_Hexa = 21716, \
+ Entity_Node = 124663, \
+ Entity_Quad_Edge = 1073, \
+ Entity_Quad_Triangle = 1330, \
+ Entity_Quad_Tetra = 14665, \
+ Entity_Quad_Pyramid = 642, \
+ Entity_Quad_Penta = 426 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_5(fissureCoude):
- """
- problème de fissure du Coude :
- adaptation maillage
- """
+ """problème de fissure du Coude : - adaptation maillage"""
+
+ nomProbleme = "fissureCoude_5"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 55217,
- Entity_Quad_Edge = 762,
- Entity_Quad_Triangle = 1586,
- Entity_Quad_Quadrangle = 5610,
- Entity_Quad_Tetra = 11468,
- Entity_Quad_Hexa = 7200,
- Entity_Quad_Penta = 516,
- Entity_Quad_Pyramid = 552)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 5366, \
+ Entity_Quad_Hexa = 7120, \
+ Entity_Node = 54832, \
+ Entity_Quad_Edge = 722, \
+ Entity_Quad_Triangle = 1570, \
+ Entity_Quad_Tetra = 11747, \
+ Entity_Quad_Pyramid = 532, \
+ Entity_Quad_Penta = 496 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude - ASCOU08"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_6(fissureCoude):
-# --- cas ASCOU08
+ """ASCOU08"""
+
+ nomProbleme = "fissureCoude_6"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
externe = True)
# ---------------------------------------------------------------------------
-
+
def setParamMaillageFissure(self):
"""
Paramètres du maillage de la fissure pour le tuyau coudé
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 12,
- areteFaceFissure = 5)
+ areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 63783,
- Entity_Quad_Edge = 831,
- Entity_Quad_Triangle = 742,
- Entity_Quad_Quadrangle = 7480,
- Entity_Quad_Tetra = 8084,
- Entity_Quad_Hexa = 10080,
- Entity_Quad_Penta = 456,
- Entity_Quad_Pyramid = 500)
-
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 7392, \
+ Entity_Quad_Hexa = 9888, \
+ Entity_Node = 62571, \
+ Entity_Quad_Edge = 833, \
+ Entity_Quad_Triangle = 1048, \
+ Entity_Quad_Tetra = 7723, \
+ Entity_Quad_Pyramid = 452, \
+ Entity_Quad_Penta = 408 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_7(fissureCoude):
+ """fissure dans un coude"""
+ nomProbleme = "fissureCoude_7"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
externe = True)
# ---------------------------------------------------------------------------
-
+
def setParamMaillageFissure(self):
"""
Paramètres du maillage de la fissure pour le tuyau coudé
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 12,
- areteFaceFissure = 5)
+ areteFaceFissure = 5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 75580,
- Entity_Quad_Edge = 899,
- Entity_Quad_Triangle = 1158,
- Entity_Quad_Quadrangle = 8022,
- Entity_Quad_Tetra = 13162,
- Entity_Quad_Hexa = 11272,
- Entity_Quad_Penta = 756,
- Entity_Quad_Pyramid = 812)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 7758, \
+ Entity_Quad_Hexa = 10696, \
+ Entity_Node = 71535, \
+ Entity_Quad_Edge = 882, \
+ Entity_Quad_Triangle = 1378, \
+ Entity_Quad_Tetra = 10847, \
+ Entity_Quad_Pyramid = 668, \
+ Entity_Quad_Penta = 612 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude - ASCOU16"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_8(fissureCoude):
- # cas test ASCOU15
+ """cas test ASCOU16"""
+ nomProbleme = "fissureCoude_8"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
externe = False)
# ---------------------------------------------------------------------------
-
+
def setParamMaillageFissure(self):
"""
Paramètres du maillage de la fissure pour le tuyau coudé
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 4,
nbsegCercle = 16,
areteFaceFissure = 5)
-
+
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 50627,
- Entity_Quad_Edge = 666,
- Entity_Quad_Triangle = 1498,
- Entity_Quad_Quadrangle = 4747,
- Entity_Quad_Tetra = 13225,
- Entity_Quad_Hexa = 5464,
- Entity_Quad_Penta = 864,
- Entity_Quad_Pyramid = 880)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 4572, \
+ Entity_Quad_Hexa = 5128, \
+ Entity_Node = 45641, \
+ Entity_Quad_Edge = 648, \
+ Entity_Quad_Triangle = 1282, \
+ Entity_Quad_Tetra = 11122, \
+ Entity_Quad_Pyramid = 768, \
+ Entity_Quad_Penta = 752 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude - ASCOU19"""
+
+import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_9(fissureCoude):
- # cas test ASCOU19
+ """cas test ASCOU19"""
+ nomProbleme = "fissureCoude_9"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 6,
nbsegCercle = 20,
areteFaceFissure = 2.5)
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 162936,
- Entity_Quad_Edge = 1254,
- Entity_Quad_Triangle = 3238,
- Entity_Quad_Quadrangle = 15088,
- Entity_Quad_Tetra = 19305,
- Entity_Quad_Hexa = 27472,
- Entity_Quad_Penta = 920,
- Entity_Quad_Pyramid = 1056)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 14864, \
+ Entity_Quad_Hexa = 26772, \
+ Entity_Node = 156163, \
+ Entity_Quad_Edge = 1237, \
+ Entity_Quad_Triangle = 3178, \
+ Entity_Quad_Tetra = 16952, \
+ Entity_Quad_Pyramid = 916, \
+ Entity_Quad_Penta = 780 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude"""
+
+import os
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
O, OX, OY, OZ = triedreBase()
class fissure_Coude(fissureGenerique):
- """
- problème de fissure du Coude : version de base
+ """problème de fissure du Coude : version de base
+
maillage hexa
"""
- nomProbleme = "tuyau_Coude"
+ nomProbleme = "fissure_Coude"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
+ circonferentielle = False
+ longitudinale = False
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
smesh.SetName(algo1d_long_p2, "algo1d_long_p2")
smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2")
- isDone = maillageSain.Compute()
+ _ = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
+ _ = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
+ _ = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
+ _ = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
- mp1 = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
- mp2 = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
- ext = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
- btu = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
- clg = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
- pei = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
- pex = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
- cou = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
+ _ = maillageSain.Compute()
return [maillageSain, True] # True : maillage hexa
externe = True)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
logging.info("shapeFissureParams %s", shapeFissureParams)
- angleCoude = geomParams['angleCoude']
+ #angleCoude = geomParams['angleCoude']
r_cintr = geomParams['r_cintr']
l_tube_p1 = geomParams['l_tube_p1']
- l_tube_p2 = geomParams['l_tube_p2']
+ #l_tube_p2 = geomParams['l_tube_p2']
epais = geomParams['epais']
de = geomParams['de']
if not lgInfluence:
lgInfluence = profondeur
- if longueur > 2*profondeur:
- self.fissureLongue=True
- else:
- self.fissureLongue=False
+ self.fissureLongue = bool(longueur > 2*profondeur)
- self.circonferentielle = False
- self.longitudinale = False
if self.fissureLongue and (abs(orientation) < 45) :
self.longitudinale = True
elif self.fissureLongue:
else:
pass
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, 5 ,10)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, 5 ,10, mailleur)
return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, facetubel, facetuber, planfiss, pipefiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegExt = 5,
nbsegGen = 25,
nbsegRad = 5,
# ---------------------------------------------------------------------------
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureLongue(geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = insereFissureLongue(geometriesSaines, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 77491,
- Entity_Quad_Edge = 1006,
- Entity_Quad_Triangle = 2412,
- Entity_Quad_Quadrangle = 6710,
- Entity_Quad_Tetra = 20853,
- Entity_Quad_Hexa = 8656,
- Entity_Quad_Penta = 1176,
- Entity_Quad_Pyramid = 1232)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 6710, \
+ Entity_Quad_Hexa = 8656, \
+ Entity_Node = 76807, \
+ Entity_Quad_Edge = 1006, \
+ Entity_Quad_Triangle = 2342, \
+ Entity_Quad_Tetra = 20392, \
+ Entity_Quad_Pyramid = 1232, \
+ Entity_Quad_Penta = 1176 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Fissure dans un coude - ASCOU09A"""
+
+import os
from .fissure_Coude import fissure_Coude
class fissure_Coude_4(fissure_Coude):
- """
- probleme de fissure du Coude : ASCOU09A
+ """probleme de fissure du Coude : ASCOU09A
+
adaptation maillage
"""
+ nomProbleme = "fissure_Coude_4"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
+
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
externe : True : fissure face externe, False : fissure face interne
"""
- print("setParamShapeFissure", self.nomCas)
- self.shapeFissureParams = dict(nomRep = '.',
+ self.shapeFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
profondeur = 10,
azimut = 90,
alpha = 20,
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 948,
- Entity_Quad_Triangle = 1562,
- Entity_Quad_Edge = 1192,
- Entity_Quad_Penta = 732,
- Entity_Quad_Hexa = 22208,
- Entity_Node = 133418,
- Entity_Quad_Tetra = 18759,
- Entity_Quad_Quadrangle = 11852)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 11852, \
+ Entity_Quad_Hexa = 22208, \
+ Entity_Node = 133418, \
+ Entity_Quad_Edge = 1192, \
+ Entity_Quad_Triangle = 1562, \
+ Entity_Quad_Tetra = 18759, \
+ Entity_Quad_Pyramid = 948, \
+ Entity_Quad_Penta = 732, \
+ )
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""problème de fissure plane dans un tube ; passage par fichier xao"""
+
+import os
+import logging
+
+from blocFissure import gmu
+from blocFissure.gmu.geomsmesh import geompy, smesh
+from blocFissure.gmu.fissureGenerique import fissureGenerique
+from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
+from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
+
+import GEOM
+import SALOMEDS
+import SMESH
+
+class tube(fissureGenerique):
+ """problème de fissure plane dans un tube"""
+
+ nomProbleme = "tube"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageSain(self, geometriesSaines, meshParams):
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
+
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "Tube.med"))
+ smesh.SetName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme))
+
+ return [objetSain, True] # True : maillage hexa
+
+ # ---------------------------------------------------------------------------
+ def setParamShapeFissure(self):
+ """
+ paramètres de la fissure pour méthode construitFissureGenerale
+ lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
+ rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
+ """
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
+ self.shapeFissureParams = dict(lgInfluence = 0.4,
+ rayonPipe = 0.05)
+
+ # ---------------------------------------------------------------------------
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
+ """Importe la géométrie de la fissure"""
+ texte = "genereShapeFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+
+ lgInfluence = shapeFissureParams['lgInfluence']
+
+ (_, shellFiss, _, l_groups, _) = geompy.ImportXAO(os.path.join(gmu.pathBloc, "materielCasTests", "TubeFiss.xao"))
+ l_aux = list()
+ for group in l_groups:
+ if ( group.GetName() in ("Group_1","Group_2","Group_3") ):
+ l_aux.append(group)
+ fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
+ geompy.UnionList(fondFiss, l_aux )
+ geompy.addToStudy( shellFiss, 'shellFiss' )
+ geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
+
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.025, 0.1, mailleur)
+
+ centre = None
+
+ return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
+
+ # ---------------------------------------------------------------------------
+ def setParamMaillageFissure(self):
+ texte = "setParamMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+ self.maillageFissureParams = dict(nomRep = os.curdir,
+ nomFicSain = self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
+ nbsegRad = 5,
+ nbsegCercle = 8,
+ areteFaceFissure = 0.5)
+
+ # ---------------------------------------------------------------------------
+ def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
+ elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
+ return elementsDefaut
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ texte = "genereMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
+ return maillageFissure
+
+ # ---------------------------------------------------------------------------
+ def setReferencesMaillageFissure(self):
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 1630, \
+ Entity_Quad_Hexa = 3523, \
+ Entity_Node = 18874, \
+ Entity_Quad_Edge = 261, \
+ Entity_Quad_Triangle = 190, \
+ Entity_Quad_Tetra = 1322, \
+ Entity_Quad_Pyramid = 172, \
+ Entity_Quad_Penta = 64 \
+ )
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""problème de fissure non plane, débouchante non normale"""
import os
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
-import math
import GEOM
import SALOMEDS
import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
import logging
from blocFissure.gmu.fissureGenerique import fissureGenerique
O, OX, OY, OZ = triedreBase()
class vis_1(fissureGenerique):
- """
- problème de fissure non plane, débouchante non normale
- """
+ """problème de fissure non plane, débouchante non normale"""
nomProbleme = "vis_1"
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
+ referencesMaillageFissure = dict()
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
- logging.info("genereMaillageSain %s", self.nomCas)
+ texte = "genereMaillageSain pour '{}'".format(self.nomCas)
+ logging.info(texte)
- ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/visSain.med"))
- smesh.SetName(objetSain.GetMesh(), 'objetSain')
+ ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "visSain.med"))
+ smesh.SetName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme))
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
- """
- paramètres de la fissure pour méthode construitFissureGenerale
+ """paramètres de la fissure pour méthode construitFissureGenerale
+
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face)
"""
- logging.info("setParamShapeFissure %s", self.nomCas)
+ texte = "setParamShapeFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
self.shapeFissureParams = dict(lgInfluence = 0.6,
rayonPipe = 0.1)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
+ """Importe la géométrie de la fissure et crée le groupe du fond de la fissure"""
+ texte = "genereShapeFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"))
+ shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "visFiss.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [6, 8])
+ geompy.UnionIDs(fondFiss, [6, 8, 3])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.1 ,0.2)
+ mailleur = self.mailleur2d3d()
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.1 ,0.2, mailleur)
centre = None
+
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
+ texte = "setParamMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
+ nomFicFissure = self.nomCas + "_fissure",
nbsegRad = 5,
nbsegCercle = 32,
areteFaceFissure = 0.1)
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+
+ texte = "genereMaillageFissure pour '{}'".format(self.nomCas)
+ logging.info(texte)
+
+ mailleur = self.mailleur2d3d()
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1284,
- Entity_Quad_Triangle = 2336,
- Entity_Quad_Edge = 758,
- Entity_Quad_Penta = 984,
- Entity_Quad_Hexa = 6416,
- Entity_Node = 85673,
- Entity_Quad_Tetra = 35990,
- Entity_Quad_Quadrangle = 4285)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 4285 ,\
+ Entity_Quad_Hexa = 6416, \
+ Entity_Node = 85673, \
+ Entity_Quad_Edge = 758, \
+ Entity_Quad_Triangle = 2336, \
+ Entity_Quad_Tetra = 35990, \
+ Entity_Quad_Pyramid = 1284, \
+ Entity_Quad_Penta = 984 \
+ )
To make the use of « Bloc Fissure » easier, a Graphical User Interface (GUI) was developed.\r
Inputs are similar to those of :ref:`script mode <script>`. GUI is accessible in the SMESH extension *Add a crack in a mesh*\r
\r
-.. figure:: images/BF_GUI_capture.png\r
- :width: 700\r
+.. image:: images/BF_GUI_capture.png\r
+ :scale: 100\r
:align: center\r
+ :alt: Window of the graphical interface\r
\r
- Windows of the graphical interface\r
+Window of the graphical interface\r
\r
+------------------------------------------------------------------------------------------------------------------+\r
| GUI parameters |\r
+======================+===================================+=======================================================+\r
-| **maillageSain** | *[string]* | Relative address of the input structure 3D mesh |\r
+| **Maillage sain** | *[string]* | Relative address of the input structure 3D mesh |\r
| | ex: mesh/maillage.med | in MED format (base is repertoire de travail) |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **FaceFissure** | *[string]* | Relative address of the input crack geometry |\r
-| | ex: mesh/fissure.brep | in BREP format (base is repertoire de travail) |\r
+| **Face fissure** | *[string]* | Relative address of the input crack geometry in |\r
+| | ex: mesh/fissure.xao | BREP or XAO format (base is repertoire de travail) |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **index edges fond | *[list of integers]* | List of edges number which define the crack front |\r
-| fissure** | ex: [1,2] | |\r
+| **Arêtes fond | *[list of strings]* | Definition of the crack front: |\r
+| fissure** | ex: ["F_1", "F_2"] | If XAO: list of the names of the edge group(s) |\r
++----------------------+-----------------------------------+-------------------------------------------------------+\r
+| | *[list of integers]* | If BREP (or XAO): list of edges number in GEOM |\r
+| | ex: [1,2] | |\r
++----------------------+-----------------------------------+-------------------------------------------------------+\r
+| **Distance | *[float]* | Length of influence - distance that defines the |\r
+| d'influence** | ex: 20.0000 | size of the extracted Box around the crack |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
| **min** | *[float]* | Float defining the minimum size of elements |\r
| | ex: 1.00000 | to mesh the crack |\r
| **max** | *[float]* | Float defining the maximum size of elements |\r
| | ex: 10.0000 | to mesh the crack |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **distance | *[float]* | Length of influence - distance that defines the |\r
-| influence** | ex: 20.0000 | size of the extracted Box around the crack |\r
-+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **rayon pipe** | *[float]* | Radius of the tore around the front |\r
+| **Rayon pipe** | *[float]* | Radius of the tore around the front |\r
| | ex: 5.00000 | |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **longueur mailles** | *[float]* | Length of the segments of the tore along crack front |\r
+| **Longueur mailles** | *[float]* | Length of the segments of the tore along crack front |\r
| | ex: 5.00000 | |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **couronnes** | *[integer]* | Number of radial segment of the tore |\r
+| **Couronnes** | *[integer]* | Number of radial segment of the tore |\r
| | ex: 5 | |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **secteurs** | *[integer]* | Number of sectors of the tore |\r
+| **Secteurs** | *[integer]* | Number of sectors of the tore |\r
| | ex: 16 | |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **arete face | *[float]* | Mesh size of elements for the Box remeshing |\r
+| **Triangles face | *[float]* | Mesh size of elements for the Box remeshing |\r
| fissure** | ex: 5.0000 | |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **repertoire de | *[string]* | Absolute address of the directory where files are |\r
+| **Répertoire de | *[string]* | Absolute address of the directory where files are |\r
| travail** | ex: /home/A123456 | saved |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **nom résultat** | *[string]* | Name of the resulting mesh |\r
+| **Nom du résultat** | *[string]* | Name of the resulting mesh |\r
| | ex: maillage_fissure | |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **mode** | *[choice]* | Verbose mode for Salome messages |\r
+| **Mode** | *[choice]* | Verbose mode for Salome messages |\r
| | ex: verbose | |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
\r
-.. figure:: images/parametres_GUI.png\r
+.. image:: images/parametres_GUI.png\r
:width: 350\r
:align: center\r
+ :alt: Tore parameters\r
+\r
+Tore parameters\r
\r
- Tore parameters\r
\r
+- **Exemple**: fills the panels with a test-case\r
\r
- **Reset**: clears all the parameters\r
\r
\r
- **Sauver**: save a .dic file with the active parameters\r
\r
-- **Cancel**: exit GUI\r
+- **Fermer**: exit GUI\r
\r
-- **Sauver**: Launch calculation\r
+- **OK**: Launch calculation\r
\r
Cracked bended pipes being a common encountered case, a specific module was developed with a Graphic User Interface (GUI). GUI is accessible in the SMESH extension *Meshed Pipe with a crack*. Compared to the classical use of « Bloc Fissure », this extension also generate the pipe mesh and the crack geometry from geometrical information.\r
\r
\r
-.. figure:: images/Capture_GUI_pipes_2.png\r
+.. image:: images/Capture_GUI_pipes_2.png\r
:width: 800\r
:align: center\r
+ :alt: Print screen of GUI\r
\r
Print screen of GUI of the extension *Meshed Pipe with a crack*\r
\r
\r
1. The first step consists in loading the structure mesh (a) as well as the crack surface geometry (b).\r
\r
-2. The crack is then meshed (c). A length criterion defines the size of the extracted « Box ». This length is called the length of influence. Every element having a node within this zone is included in the « Box ». A second operation adds elements in the Box in order to have continuous faces (d).\r
+2. The crack is then meshed (c). A length criterion defines the size of the extracted « Box ». This length is called the length of influence. Every element of the structure mesh having a node within this zone is included in the « Box ». A second operation adds those elements in the Box in order to have continuous faces (d).\r
\r
3. A geometrical Box is reconstructed from the extracted Box mesh. The reconstruction is limited to faces which intersect the crack (e). A torus is created following the crack front (f).\r
\r
.. image:: images/longueur_influence.png\r
:width: 600\r
:align: center\r
+ :alt: The length of influence\r
\r
Every element having a node at a smaller distance to the crack than the length of influence is selected. Then a filling algorithm fulfill the Box with elements to get a Box. The Box is not limited to rectangular shapes. See the section on :ref:`test cases <test_cases>` to see examples.\r
\r
\r
.. image:: images/schema_lignes1.png\r
:scale: 80\r
+ :alt: Crack front edges\r
\r
5) **Loss of element groups:**\r
\r
| **maillageSain** | *[string]* | Absolute address of the input structure 3D mesh |\r
| | | in MED format |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **BrepFaceFissure** | *[string]* | Absolute address of the input crack geometry |\r
-| | | in BREP format |\r
+| **CAOFaceFissure** | *[string]* | Absolute address of the input crack geometry |\r
+| | | in XAO or BREP format |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
-| **edgeFissIds** | *[list of integers]* | List of edges number which define the crack front |\r
+| **edgeFiss** | *[list of strings]* | List of edges group which define the crack front |\r
++----------------------+-----------------------------------+-------------------------------------------------------+\r
+| | *[list of integers]* | List of edges number which define the crack front |\r
+----------------------+-----------------------------------+-------------------------------------------------------+\r
| **meshBrep** | *[list of 2 floats]* | List of two floats defining respectively minimum and |\r
| | | maximum size of elements of the crack mesh |\r
.. image:: images/parametres.png\r
:width: 350\r
:align: center\r
+ :alt: Geometrical parameters of the tore\r
\r
Different levels of verbose are available. Use one of this 4 optional functions to set verbose type:\r
\r
\r
dicoParams = dict(nomCas = 'cubeFiss',\r
maillageSain = "/home/A123456/BF/cube.med",\r
- brepFaceFissure = "/home/A123456/BF/fiss.brep",\r
- edgeFissIds = [4],\r
+ CAOFaceFissure = "/home/A123456/BF/fiss.xao",\r
+ edgeFiss = ["Fond"],\r
lgInfluence = 20.,\r
meshBrep = (5.,10.),\r
rayonPipe = 5.,\r
| :width: 400 | :width: 400 |\r
| :align: center | :align: center |\r
+-------------------------------------------+----------------------------------------------+\r
+| tube |\r
++-------------------------------------------+----------------------------------------------+\r
\r
.. _pipeTC:\r
\r
\r
2) **To execute only selected test cases**:\r
\r
-modify the file ``execution_Cas.py`` and change::\r
+modify the file ``CasTests/execution_Cas.py`` and change::\r
\r
runall = False. #old : True\r
\r
And change from 0 to 1 of the index of the test you want to launch::\r
\r
- torun = [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\r
+ torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\r
\r
then launch the test cases::\r
\r
2 for cubeCoin... from top to bottom, then from left to right.\r
\r
+--------------------+--------------------+--------------------+-----------------+-----------------+\r
-| cubeAngle | cylindre_2 | eprouvetteDroite_2 | fissureCoude_3 | fissureCoude_8 |\r
+| cubeAngle | cylindre_2 | eprouvetteDroite_2 | fissureCoude_3 | fissureCoude_9 |\r
+--------------------+--------------------+--------------------+-----------------+-----------------+\r
-| cubeAngle2 | disquePerce | faceGauche | fissureCoude_4 | fissureCoude_10 |\r
+| cubeAngle2 | disquePerce | faceGauche | fissureCoude_4 | fissure_Coude |\r
+--------------------+--------------------+--------------------+-----------------+-----------------+\r
-| cubeCoin | ellipse_1 | faceGauche_2 | fissure_Coude_4 | fissureCoude_10 |\r
+| cubeCoin | ellipse_1 | faceGauche_2 | fissureCoude_5 | fissure_Coude_4 |\r
+--------------------+--------------------+--------------------+-----------------+-----------------+\r
-| cubeMilieu | ellipse_2 | fissure_Coude | fissureCoude_5 | vis_1 |\r
+| cubeMilieu | ellipse_2 | fissureCoude_1 | fissureCoude_6 | vis_1 |\r
+--------------------+--------------------+--------------------+-----------------+-----------------+\r
-| cubeTransverse | eprouvetteCourbe | fissureCoude_1 | fissureCoude_6 | |\r
+| cubeTransverse | eprouvetteCourbe | fissureCoude_10 | fissureCoude_7 | tube |\r
+--------------------+--------------------+--------------------+-----------------+-----------------+\r
-| cylindre | eprouvetteDroite | fissureCoude_2 | fissureCoude_7 | |\r
+| cylindre | eprouvetteDroite | fissureCoude_2 | fissureCoude_8 | |\r
+--------------------+--------------------+--------------------+-----------------+-----------------+\r
\r
3) **To execute only one test case**::\r
from blocFissure.gmu.casStandard import casStandard
-dicoParams = dict(nomCas = 'angleCube',
- maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'),
- brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"),
- edgeFissIds = [4],
+dicoParams = dict(nomCas = "angleCube",
+ maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med"),
+ CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep"),
+ edgeFiss = [4],
lgInfluence = 20,
meshBrep = (5,10),
rayonPipe = 5,
dicoParams = dict(nomCas = 'angleCube2',
maillageSain = 'boite.med',
- brepFaceFissure = "disk.brep",
- edgeFissIds = [4],
+ CAOFaceFissure = "disk.brep",
+ edgeFiss = [4],
lgInfluence = 50,
meshBrep = (5,10),
rayonPipe = 15,
dicoParams = dict(nomCas = 'fissTuyau',
maillageSain = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(mesh),
- brepFaceFissure = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(crack),
- edgeFissIds = [9],
+ CAOFaceFissure = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(crack),
+ edgeFiss = [9],
lgInfluence = 250,
meshBrep = (10, 50),
rayonPipe = 35,
execInstance = casStandard(dicoParams)
if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser()
\ No newline at end of file
+ salome.sg.updateObjBrowser()
compoundFromList.py
construitEdgesRadialesDebouchantes.py
construitFissureGenerale.py
+ construitFissureGenerale_a.py
+ construitFissureGenerale_b.py
+ construitFissureGenerale_c.py
construitMaillagePipe.py
construitPartitionsPeauFissure.py
creePointsPipePeau.py
insereFissureElliptique.py
insereFissureGenerale.py
insereFissureLongue.py
+ insereFissureLongue_a.py
+ insereFissureLongue_b.py
+ insereFissureLongue_c.py
+ insereFissureLongue_d.py
listOfExtraFunctions.py
mailleAretesEtJonction.py
mailleFacesFissure.py
from .geomsmesh import geompy
from .geomsmesh import smesh
-
-def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
+
+def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
centreFondFiss, wireFondFiss, wirePipeFiss,
lenSegPipe, rayonPipe, nbsegCercle, nbsegRad):
- """
- preparation maillage du pipe :
+ """preparation maillage du pipe :
+
- détections des points a respecter : jonction des edges/faces constituant
la face de fissure externe au pipe
- points sur les edges de fond de fissure et edges pipe/face fissure,
- - vecteurs tangents au fond de fissure (normal au disque maillé)
+ - vecteurs tangents au fond de fissure (normal au disque maillé)
"""
-
+
logging.info('start')
- # --- option de maillage selon le rayon de courbure du fond de fissure
+ # --- option de maillage selon le rayon de courbure du fond de fissure
lenEdgeFondExt = 0
for edff in edgesFondFiss:
lenEdgeFondExt += geompy.BasicProperties(edff)[0]
-
- disfond = []
+
+ disfond = list()
for filling in facesDefaut:
disfond.append(geompy.MinDistance(centreFondFiss, filling))
disfond.sort()
rcourb = disfond[0]
+ texte = "rcourb: {}, lenEdgeFondExt: {}, lenSegPipe: {}".format(rcourb, lenEdgeFondExt, lenSegPipe)
+ logging.info(texte)
nbSegQuart = 5 # on veut 5 segments min sur un quart de cercle
alpha = math.pi/(4*nbSegQuart)
deflexion = rcourb*(1.0 -math.cos(alpha))
lgmin = lenSegPipe*0.25
- lgmax = lenSegPipe*1.5
- logging.debug("rcourb: %s, lenFond:%s, deflexion: %s, lgmin: %s, lgmax: %s", rcourb, lenEdgeFondExt, deflexion, lgmin, lgmax)
+ lgmax = lenSegPipe*1.5
+ texte = "==> deflexion: {}, lgmin: {}, lgmax: {}".format(deflexion, lgmin, lgmax)
+ logging.info(texte)
meshFondExt = smesh.Mesh(wireFondFiss)
algo1d = meshFondExt.Segment()
hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
- isDone = meshFondExt.Compute()
-
- ptGSdic = {} # dictionnaire [paramètre sur la courbe] --> point géométrique
+
+ is_done = meshFondExt.Compute()
+ text = "calculePointsAxiauxPipe meshFondExt.Compute"
+ if is_done:
+ logging.info(text)
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ ptGSdic = dict() # dictionnaire [paramètre sur la courbe] --> point géométrique
allNodeIds = meshFondExt.GetNodesId()
for nodeId in allNodeIds:
xyz = meshFondExt.GetNodeXYZ(nodeId)
edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt
#logging.debug("nodeId %s, u %s", nodeId, str(u))
- usort = sorted(ptGSdic)
+ usort = sorted(ptGSdic)
logging.debug("nombre de points obtenus par deflexion %s",len(usort))
-
- centres = []
- origins = []
- normals = []
+
+ centres = list()
+ origins = list()
+ normals = list()
for edu in usort:
ied = edu[1]
u = edu[2]
vertcx = ptGSdic[edu]
norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u)
plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
- part = geompy.MakePartition([plan], [wirePipeFiss], [], [], geompy.ShapeType["VERTEX"], 0, [], 0)
+ part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
if len(liste) == 5: # 4 coins du plan plus intersection recherchée
for point in liste:
# geompy.addToStudyInFather(wireFondFiss, plan, name)
# --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau
-
+
logging.debug("nbsegCercle %s", nbsegCercle)
-
+
# -----------------------------------------------------------------------
# --- points géométriques
-
- gptsdisks = [] # vertices géométrie de tous les disques
- raydisks = [[] for i in range(nbsegCercle)]
- for i in range(len(centres)): # boucle sur les disques
- gptdsk = [] # vertices géométrie d'un disque
- vertcx = centres[i]
+
+ gptsdisks = list() # vertices géométrie de tous les disques
+ raydisks = [list() for i in range(nbsegCercle)]
+ for i, centres_i in enumerate(centres): # boucle sur les disques
+ gptdsk = list() # vertices géométrie d'un disque
+ vertcx = centres_i
vertpx = origins[i]
normal = normals[i]
vec1 = geompy.MakeVector(vertcx, vertpx)
-
+
points = [vertcx] # les points du rayon de référence
for j in range(nbsegRad):
pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*float(rayonPipe)/nbsegRad)
pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
rayon = geompy.MakeLineTwoPnt(vertcx, pt)
raydisks[0].append(rayon)
-
+
for k in range(nbsegCercle-1):
angle = (k+1)*2*math.pi/nbsegCercle
pts = [vertcx] # les points d'un rayon obtenu par rotation
gptdsk.append(pts)
ray = geompy.MakeRotation(rayon, normal, angle)
raydisks[k+1].append(ray)
-
+
gptsdisks.append(gptdsk)
-
+
return (centres, gptsdisks, raydisks)
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Cas standard"""
import os
from .geomsmesh import geompy, smesh
import GEOM
import SALOMEDS
import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
import logging
from .fissureGenerique import fissureGenerique
O, OX, OY, OZ = triedreBase()
class casStandard(fissureGenerique):
- """
- problème de fissure standard, défini par :
+ """problème de fissure standard, défini par :
+
- un maillage sain (hexaèdres),
- une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé
- les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
- les paramètres de maillage de la fissure
"""
+ referencesMaillageFissure = None
# ---------------------------------------------------------------------------
def __init__ (self, dicoParams, references = None, numeroCas = 0):
if 'reptrav' in self.dicoParams:
self.reptrav = self.dicoParams['reptrav']
else:
- self.reptrav = '.'
+ self.reptrav = os.curdir
self.numeroCas = numeroCas
if self.numeroCas != 0:
self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
self.dicoParams['aretesVives'] = 0
if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
self.executeProbleme(step)
-
+
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
lenSegPipe = self.lenSegPipe)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
lgInfluence = shapeFissureParams['lgInfluence']
- shellFiss = geompy.ImportBREP( self.dicoParams['brepFaceFissure'])
+# Contrôle de 'brepFaceFissure' pour les anciennes versions
+ if ( 'brepFaceFissure' in self.dicoParams ):
+ self.dicoParams['CAOFaceFissure'] = self.dicoParams['brepFaceFissure']
+ cao_file = self.dicoParams['CAOFaceFissure']
+ suffix = os.path.basename(cao_file).split(".")[-1]
+ if ( suffix.upper() == "BREP" ):
+ shellFiss = geompy.ImportBREP(cao_file)
+ elif ( suffix.upper() == "XAO" ):
+ (_, shellFiss, _, l_groups, _) = geompy.ImportXAO(cao_file)
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
+# Contrôle de 'edgeFissIds' pour les anciennes versions
+ if ( 'edgeFissIds' in self.dicoParams ):
+ self.dicoParams['edgeFiss'] = self.dicoParams['edgeFissIds']
+ if isinstance(self.dicoParams['edgeFiss'][0],int):
+ geompy.UnionIDs(fondFiss, self.dicoParams['edgeFiss'] )
+ else:
+ l_groups = geompy.GetGroups(shellFiss)
+ l_aux = list()
+ for group in l_groups:
+ if ( group.GetName() in self.dicoParams['edgeFiss'] ):
+ l_aux.append(group)
+ geompy.UnionList(fondFiss, l_aux )
geomPublish(initLog.debug, shellFiss, 'shellFiss' )
geomPublishInFather(initLog.debug, shellFiss, fondFiss, 'fondFiss' )
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1], \
+ mailleur)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
if self.references is not None:
self.referencesMaillageFissure = self.references
else:
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Hexa = 0,
- Entity_Node = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Quadrangle = 0)
-
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 0, \
+ Entity_Quad_Hexa = 0, \
+ Entity_Node = 0, \
+ Entity_Quad_Edge = 0, \
+ Entity_Quad_Triangle = 0, \
+ Entity_Quad_Tetra = 0, \
+ Entity_Quad_Pyramid = 0, \
+ Entity_Quad_Penta = 0 \
+ )
from . import initLog
def compoundFromList(elements, nom=None):
- """
-
- """
+ """compoundFromList"""
+
logging.debug('start')
- shapeList = []
+ shapeList = list()
for a in elements:
if not isinstance(a, list):
shapeList.append(a)
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Construit les arêtes débouchantes"""
import logging
from .geomsmesh import geompy
from .geomsmesh import geomPublish
-from .geomsmesh import geomPublishInFather
+#from .geomsmesh import geomPublishInFather
from . import initLog
import GEOM
from .sortEdges import sortEdges
def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
facesPipePeau, edgeRadFacePipePeau, nbsegCercle):
- """
- construction des listes d'edges radiales sur chaque extrémité débouchante
- """
+ """construction des listes d'edges radiales sur chaque extrémité débouchante"""
logging.info('start')
# --- listes de nappes radiales en filling à chaque extrémité débouchante
vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
if len(vs) > 2:
eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
- [edsorted, minl,maxl] = sortEdges(eds)
+ [edsorted, _, maxl] = sortEdges(eds)
edge = edsorted[-1]
else:
maxl = geompy.BasicProperties(edge)[0]
logging.debug(" edges issues de la partition: %s", ednouv)
for ii, ed in enumerate(ednouv):
geomPublish(initLog.debug, ed, "ednouv%d"%ii)
- [edsorted, minl,maxl] = sortEdges(ednouv)
+ [edsorted, _, maxl] = sortEdges(ednouv)
logging.debug(" longueur edge trouvée: %s", maxl)
edge = edsorted[-1]
else:
logging.debug("nombre vertex candidats %s", len(vxnouv))
if len(vxnouv) >= 2:
eds = [geompy.MakeEdge(vxnouv[j],vxnouv[(j+1)%len(vxnouv)]) for j in range(len(vxnouv))]
- [edsorted2, minl,maxl] = sortEdges(eds)
+ [edsorted2, _, maxl] = sortEdges(eds)
edge = edsorted2[-1]
logging.debug("lg edge: %s", maxl)
else:
geomPublish(initLog.debug, edge, name)
listEdges.append(edges)
- return (listEdges, idFacesDebouchantes)
\ No newline at end of file
+ return (listEdges, idFacesDebouchantes)
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""procédure complète de construction d'une fissure générale"""
import logging
import salome
from .geomsmesh import geompy
-from .geomsmesh import geomPublish
from .geomsmesh import geomPublishInFather
from . import initLog
import GEOM
from .geomsmesh import smesh
from salome.smesh import smeshBuilder
import SMESH
-import math
-import bisect
-import traceback
-
-# from extractionOrientee import extractionOrientee
-# from extractionOrienteeMulti import extractionOrienteeMulti
-# from sortFaces import sortFaces
-#from sortEdges import sortEdges
-# from eliminateDoubles import eliminateDoubles
-# from substractSubShapes import substractSubShapes
-# from produitMixte import produitMixte
-# from findWireEndVertices import findWireEndVertices
-#from findWireIntermediateVertices import findWireIntermediateVertices
+
from .orderEdgesFromWire import orderEdgesFromWire
-# from getSubshapeIds import getSubshapeIds
-from .putName import putName
-# from distance2 import distance2
-from .enleveDefaut import enleveDefaut
-from .shapeSurFissure import shapeSurFissure
-from .regroupeSainEtDefaut import RegroupeSainEtDefaut
-from .triedreBase import triedreBase
-# from checkDecoupePartition import checkDecoupePartition
-# from whichSide import whichSide
-# from whichSideMulti import whichSideMulti
-#from whichSideVertex import whichSideVertex
-#from projettePointSurCourbe import projettePointSurCourbe
-# from prolongeWire import prolongeWire
from .restreintFaceFissure import restreintFaceFissure
from .partitionneFissureParPipe import partitionneFissureParPipe
from .construitPartitionsPeauFissure import construitPartitionsPeauFissure
from .compoundFromList import compoundFromList
-from .identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
from .identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
from .calculePointsAxiauxPipe import calculePointsAxiauxPipe
from .elimineExtremitesPipe import elimineExtremitesPipe
from .mailleAretesEtJonction import mailleAretesEtJonction
from .mailleFacesFissure import mailleFacesFissure
from .mailleFacesPeau import mailleFacesPeau
-from .fissError import fissError
+
+from .construitFissureGenerale_a import construitFissureGenerale_a
+from .construitFissureGenerale_b import construitFissureGenerale_b
+from .construitFissureGenerale_c import construitFissureGenerale_c
# -----------------------------------------------------------------------------
-# --- procédure complète fissure générale
-
-def construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step=-1):
- """
- TODO: a completer
- """
+
+def construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step=-1, mailleur="MeshGems"):
+ """procédure complète fissure générale"""
logging.info('start')
-
+ logging.info("Usage du mailleur %s", mailleur)
+
shapeDefaut = shapesFissure[0] # faces de fissure, débordant
- fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
rayonPipe = shapeFissureParams['rayonPipe']
if 'lenSegPipe' in shapeFissureParams:
else:
lenSegPipe = rayonPipe
- nomRep = maillageFissureParams['nomRep']
- nomFicSain = maillageFissureParams['nomFicSain']
- nomFicFissure = maillageFissureParams['nomFicFissure']
-
nbsegRad = maillageFissureParams['nbsegRad'] # nombre de couches selon un rayon du pipe
nbsegCercle = maillageFissureParams['nbsegCercle'] # nombre de secteur dans un cercle du pipe
areteFaceFissure = maillageFissureParams['areteFaceFissure']
if 'aretesVives' in maillageFissureParams:
lgAretesVives = maillageFissureParams['aretesVives']
- pointIn_x = 0.0
- pointIn_y = 0.0
- pointIn_z = 0.0
- isPointInterne = False
- if 'pointIn_x' in shapeFissureParams:
- pointIn_x = shapeFissureParams['pointIn_x']
- isPointInterne = True
- if 'pointIn_y' in shapeFissureParams:
- pointIn_y = shapeFissureParams['pointIn_y']
- isPointInterne = True
- if 'pointIn_z' in shapeFissureParams:
- pointIn_z = shapeFissureParams['pointIn_z']
- isPointInterne = True
- if isPointInterne:
- pointInterne = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
- else:
- pointInterne = None
-
- #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
- fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
+# Point interne
+ pointInterne = construitFissureGenerale_a (geompy, shapeFissureParams)
# fillings des faces en peau
facesDefaut = elementsDefaut[0]
centreFondFiss = elementsDefaut[15]
#tgtCentre = elementsDefaut[16]
if lgAretesVives == 0:
- lgAretesVives = dmoyen
-
-
- O, OX, OY, OZ = triedreBase()
+ lgAretesVives = dmoyen
# --- restriction de la face de fissure au domaine solide :
# partition face fissure étendue par fillings, on garde la face interne
-
+
facesPortFissure = restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne)
-
+
# --- pipe de fond de fissure, prolongé, partition face fissure par pipe
# identification des edges communes pipe et face fissure
-
- (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) = partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe)
+
+ (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) = \
+ partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe)
edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
+
for i,edge in enumerate(edgesFondFiss):
geomPublishInFather(initLog.debug, wireFondFiss, edge, "edgeFondFiss%d"%i)
-
+
# --- peau et face de fissure
#
# --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée
# liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
partitionsPeauFissFond = construitPartitionsPeauFissure(facesDefaut, fissPipe)
-
+
# --- arêtes vives détectées (dans quadranglesToShapeNoCorner
# et quadranglesToShapeWithCorner)
-
+
aretesVivesC = compoundFromList(bordsPartages, "areteVive")
- aretesVivesCoupees = [] # ensembles des arêtes vives identifiées sur les faces de peau dans l'itération sur partitionsPeauFissFond
-
+ aretesVivesCoupees = list() # ensemble des arêtes vives identifiées sur les faces de peau dans l'itération sur partitionsPeauFissFond
+
# --- inventaire des faces de peau coupées par la fissure
- # pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
- # 0, 1 ou plus edges de la face de fissure externe au pipe
-
- nbFacesFilling = len(partitionsPeauFissFond)
-
- ptEdgeFond = [ [] for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
- fsPipePeau = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
- edRadFPiPo = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ]
- fsFissuExt = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe]
- edFisExtPe = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
- edFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
- facesPeaux = [None for i in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
- edCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
- ptCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
- gpedgeBord = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
- gpedgeVifs = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings
- edFissPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
- ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
-
- for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
- if partitionPeauFissFond is not None:
- dataPPFF,aretesVivesCoupees = identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
- edgesFondFiss, wireFondFiss, aretesVivesC,
- facesDefaut, centreFondFiss, rayonPipe,
- aretesVivesCoupees)
- ptEdgeFond[ifil] = dataPPFF['endsEdgeFond']
- fsPipePeau[ifil] = dataPPFF['facesPipePeau']
- edRadFPiPo[ifil] = dataPPFF['edgeRadFacePipePeau']
- fsFissuExt[ifil] = dataPPFF['facesFissExt']
- edFisExtPe[ifil] = dataPPFF['edgesFissExtPeau']
- edFisExtPi[ifil] = dataPPFF['edgesFissExtPipe']
- facesPeaux[ifil] = dataPPFF['facePeau']
- edCircPeau[ifil] = dataPPFF['edgesCircPeau']
- ptCircPeau[ifil] = dataPPFF['verticesCircPeau']
- gpedgeBord[ifil] = dataPPFF['groupEdgesBordPeau']
- gpedgeVifs[ifil] = dataPPFF['bordsVifs']
- edFissPeau[ifil] = dataPPFF['edgesFissurePeau']
- ptFisExtPi[ifil] = dataPPFF['verticesPipePeau']
-
- facesPipePeau = []
- edgeRadFacePipePeau = []
- for ifil in range(nbFacesFilling):
- facesPipePeau += fsPipePeau[ifil]
- edgeRadFacePipePeau += edRadFPiPo[ifil]
-
- for i, avc in enumerate(aretesVivesCoupees):
- name = "areteViveCoupee%d"%i
- geomPublish(initLog.debug, avc, name)
-
+
+ ptEdgeFond, fsFissuExt, edFisExtPe, edFisExtPi, \
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, ptFisExtPi, \
+ edgeRadFacePipePeau, facesPipePeau = \
+ construitFissureGenerale_b( partitionsPeauFissFond, \
+ edgesPipeFiss, edgesFondFiss, wireFondFiss, aretesVivesC, \
+ facesDefaut, centreFondFiss, rayonPipe, aretesVivesCoupees )
+
# --- identification des faces et edges de fissure externe pour maillage
-
- (faceFissureExterne, edgesPipeFissureExterneC,
- wirePipeFissureExterne, edgesPeauFissureExterneC) = identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe,
- edFisExtPi, edgesPipeFiss)
+
+ (faceFissureExterne, edgesPipeFissureExterneC, wirePipeFissureExterne, edgesPeauFissureExterneC) = \
+ identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss)
# --- preparation maillage du pipe :
# - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
# - points sur les edges de fond de fissure et edges pipe/face fissure,
# - vecteurs tangents au fond de fissure (normal au disque maillé)
-
- (centres, gptsdisks, raydisks) = calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
- centreFondFiss, wireFondFiss, wirePipeFiss,
+
+ (centres, gptsdisks, raydisks) = calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut, \
+ centreFondFiss, wireFondFiss, wirePipeFiss, \
lenSegPipe, rayonPipe, nbsegCercle, nbsegRad)
-
+
# --- recherche des points en trop (externes au volume à remailler)
- # - on associe chaque extrémité du pipe à une face filling
+ # - on associe chaque extrémité du pipe à une face filling
# - on part des disques aux extrémités du pipe
# - pour chaque disque, on prend les vertices de géométrie,
# on marque leur position relative à la face.
# - on s'arrete quand tous les noeuds sont dedans
-
+
(idFillingFromBout, idisklim, idiskout) = elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle)
# --- construction des listes d'edges radiales sur chaque extrémité débouchante
-
- (listEdges, idFacesDebouchantes) = construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
+
+ (listEdges, idFacesDebouchantes) = construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, \
facesPipePeau, edgeRadFacePipePeau, nbsegCercle)
-
+
# --- création des points du maillage du pipe sur la face de peau
-
- (gptsdisks, idisklim) = creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
+
+ (gptsdisks, idisklim) = creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout, \
ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad)
-
+
# --- ajustement precis des points sur edgesPipeFissureExterneC
-
+
gptsdisks = ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim)
-
+
# --- maillage effectif du pipe
(meshPipe, meshPipeGroups, edgesCircPipeGroup) = construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad)
-
+
# --- edges de bord, faces défaut à respecter
-
+
(internalBoundary, bordsLibres, grpAretesVives) = mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives)
# --- maillage faces de fissure
-
- (meshFaceFiss, grpFaceFissureExterne,
- grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne) = mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
- meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad)
+
+ (meshFaceFiss, _, grpEdgesPeauFissureExterne, _) = \
+ mailleFacesFissure(faceFissureExterne, \
+ edgesPipeFissureExterneC, edgesPeauFissureExterneC, \
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad, \
+ mailleur)
# --- maillage faces de peau
-
- meshesFacesPeau = mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
- facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
- bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
- edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad)
+
+ meshesFacesPeau = mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives, \
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad, \
+ mailleur)
# --- regroupement des maillages du défaut
- listMeshes = [internalBoundary.GetMesh(),
- meshPipe.GetMesh(),
- meshFaceFiss.GetMesh()]
- for mp in meshesFacesPeau:
- listMeshes.append(mp.GetMesh())
+ listMeshes = [internalBoundary.GetMesh(), meshPipe.GetMesh(), meshFaceFiss.GetMesh()]
+ for mfpeau in meshesFacesPeau:
+ listMeshes.append(mfpeau.GetMesh())
meshBoiteDefaut = smesh.Concatenate(listMeshes, 1, 1, 1e-05,False)
- # pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
- # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
- group_faceFissOutPipe = None
- group_faceFissInPipe = None
- groups = meshBoiteDefaut.GetGroups()
- for grp in groups:
- if grp.GetType() == SMESH.FACE:
- if grp.GetName() == "fisOutPi":
- group_faceFissOutPipe = grp
- elif grp.GetName() == "fisInPi":
- group_faceFissInPipe = grp
-
- # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D
- distene=True
- if distene:
- algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D)
- else:
- algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
- hypo3d = algo3d.MaxElementVolume(1000.0)
- putName(algo3d.GetSubMesh(), "boiteDefaut")
- putName(algo3d, "algo3d_boiteDefaut")
- isDone = meshBoiteDefaut.Compute()
- putName(meshBoiteDefaut, "boiteDefaut")
- logging.info("meshBoiteDefaut fini")
-
- faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' )
- maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
- zoneDefaut_internalFaces, zoneDefaut_internalEdges)
- putName(maillageSain, nomFicSain+"_coupe")
- extrusionFaceFissure, normfiss = shapeSurFissure(facesPortFissure)
- maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut,
- None, None, 'COMPLET', normfiss)
-
- logging.info("conversion quadratique")
- maillageComplet.ConvertToQuadratic( 1 )
- logging.info("groupes")
- groups = maillageComplet.GetGroups()
- grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS']
- fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
-
- logging.info("réorientation face de fissure FACE1")
- grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
- nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
-
- logging.info("réorientation face de fissure FACE2")
- plansim = geompy.MakePlane(O, normfiss, 10000)
- fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
- grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
- nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
- fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
-
- logging.info("export maillage fini")
- maillageComplet.ExportMED(fichierMaillageFissure)
- putName(maillageComplet, nomFicFissure)
- logging.info("fichier maillage fissure %s", fichierMaillageFissure)
+
+# Maillage complet
+ maillageComplet = construitFissureGenerale_c( maillageSain, meshBoiteDefaut, \
+ zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges, \
+ facesPortFissure, \
+ maillageFissureParams, \
+ mailleur )
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()
logging.info("maillage fissure fini")
-
+
return maillageComplet
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""construction de la fissure générale - le point interne"""
+
+import logging
+
+# -----------------------------------------------------------------------------
+
+def construitFissureGenerale_a (geompy, shapeFissureParams):
+ """construction de la fissure générale - le point interne"""
+ logging.info('start')
+
+ point_in_x = 0.0
+ point_in_y = 0.0
+ point_in_z = 0.0
+ is_point_interne = False
+ if 'pointIn_x' in shapeFissureParams:
+ point_in_x = shapeFissureParams['pointIn_x']
+ is_point_interne = True
+ if 'pointIn_y' in shapeFissureParams:
+ point_in_y = shapeFissureParams['pointIn_y']
+ is_point_interne = True
+ if 'pointIn_z' in shapeFissureParams:
+ point_in_z = shapeFissureParams['pointIn_z']
+ is_point_interne = True
+
+ if is_point_interne:
+ pointInterne = geompy.MakeVertex(point_in_x, point_in_y, point_in_z)
+ else:
+ pointInterne = None
+
+ return pointInterne
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""construction de la fissure générale - inventaire des faces de peau coupées par la fissure"""
+
+import logging
+from .geomsmesh import geomPublish
+from . import initLog
+
+from .identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
+
+# -----------------------------------------------------------------------------
+
+def construitFissureGenerale_b( partitionsPeauFissFond, \
+ edgesPipeFiss, edgesFondFiss, wireFondFiss, aretesVivesC, \
+ facesDefaut, centreFondFiss, rayonPipe, aretesVivesCoupees ):
+ """construction de la fissure générale - inventaire des faces de peau coupées par la fissure
+
+pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
+ 0, 1 ou plus edges de la face de fissure externe au pipe
+ """
+ logging.info('start')
+
+ nbFacesFilling = len(partitionsPeauFissFond)
+ texte = "nbFacesFilling : {} ".format(nbFacesFilling)
+ logging.info(texte)
+
+ ptEdgeFond = [ list() for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ fsPipePeau = [ list() for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
+ edRadFPiPo = [ list() for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ fsFissuExt = [ list() for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe]
+ edFisExtPe = [ list() for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edFisExtPi = [ list() for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
+ facesPeaux = [None for i in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
+ edCircPeau = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ ptCircPeau = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ gpedgeBord = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ gpedgeVifs = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings
+ edFissPeau = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ ptFisExtPi = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+
+ for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
+ if partitionPeauFissFond is not None:
+ dataPPFF,aretesVivesCoupees = identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, \
+ edgesPipeFiss, edgesFondFiss, wireFondFiss, aretesVivesC, \
+ facesDefaut, centreFondFiss, rayonPipe, aretesVivesCoupees)
+ ptEdgeFond[ifil] = dataPPFF['endsEdgeFond']
+ fsPipePeau[ifil] = dataPPFF['facesPipePeau']
+ edRadFPiPo[ifil] = dataPPFF['edgeRadFacePipePeau']
+ fsFissuExt[ifil] = dataPPFF['facesFissExt']
+ edFisExtPe[ifil] = dataPPFF['edgesFissExtPeau']
+ edFisExtPi[ifil] = dataPPFF['edgesFissExtPipe']
+ facesPeaux[ifil] = dataPPFF['facePeau']
+ edCircPeau[ifil] = dataPPFF['edgesCircPeau']
+ ptCircPeau[ifil] = dataPPFF['verticesCircPeau']
+ gpedgeBord[ifil] = dataPPFF['groupEdgesBordPeau']
+ gpedgeVifs[ifil] = dataPPFF['bordsVifs']
+ edFissPeau[ifil] = dataPPFF['edgesFissurePeau']
+ ptFisExtPi[ifil] = dataPPFF['verticesPipePeau']
+
+ facesPipePeau = list()
+ edgeRadFacePipePeau = list()
+ for ifil in range(nbFacesFilling):
+ facesPipePeau += fsPipePeau[ifil]
+ edgeRadFacePipePeau += edRadFPiPo[ifil]
+
+ for i, avc in enumerate(aretesVivesCoupees):
+ name = "areteViveCoupee%d"%i
+ geomPublish(initLog.debug, avc, name)
+
+ return ptEdgeFond, fsFissuExt, edFisExtPe, edFisExtPi, facesPeaux, edCircPeau, \
+ ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, ptFisExtPi, \
+ edgeRadFacePipePeau, facesPipePeau
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""construction de la fissure générale - maillage"""
+
+import os
+
+import logging
+import salome
+from .geomsmesh import geompy
+import GEOM
+from .geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from .putName import putName
+from .enleveDefaut import enleveDefaut
+from .shapeSurFissure import shapeSurFissure
+from .regroupeSainEtDefaut import RegroupeSainEtDefaut
+from .triedreBase import triedreBase
+
+# -----------------------------------------------------------------------------
+
+def construitFissureGenerale_c(maillageSain, meshBoiteDefaut, \
+ zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges, \
+ facesPortFissure, \
+ maillageFissureParams, \
+ mailleur="MeshGems"):
+ """construction de la fissure générale - maillage"""
+ logging.info('start')
+ logging.info("Usage du mailleur %s", mailleur)
+
+ nomRep = maillageFissureParams['nomRep']
+ nomFicSain = maillageFissureParams['nomFicSain']
+ nomFicFissure = maillageFissureParams['nomFicFissure']
+
+ O, _, _, _ = triedreBase()
+
+ # pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
+ # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
+ group_faceFissOutPipe = None
+ group_faceFissInPipe = None
+ groups = meshBoiteDefaut.GetGroups()
+ for grp in groups:
+ if grp.GetType() == SMESH.FACE:
+ if grp.GetName() == "fisOutPi":
+ group_faceFissOutPipe = grp
+ elif grp.GetName() == "fisInPi":
+ group_faceFissInPipe = grp
+
+ # le maillage NETGEN ne passe pas toujours ==> on force l'usage de MG_Tetra
+ mailleur = "MeshGems"
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+ else:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
+ hypo3d = algo3d.MaxElementVolume(1000.0)
+ hypo3d.SetVerboseLevel( 0 )
+ hypo3d.SetStandardOutputLog( 0 )
+ hypo3d.SetRemoveLogOnSuccess( 1 )
+ putName(algo3d.GetSubMesh(), "boiteDefaut")
+ putName(algo3d, "algo3d_boiteDefaut")
+ putName(meshBoiteDefaut, "boiteDefaut")
+
+ is_done = meshBoiteDefaut.Compute()
+ text = "meshBoiteDefaut.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ _ = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], \
+ 'FACE1' )
+ maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
+ zoneDefaut_internalFaces, zoneDefaut_internalEdges)
+ putName(maillageSain, nomFicSain+"_coupe")
+ _, normfiss = shapeSurFissure(facesPortFissure)
+ maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut, \
+ None, None, 'COMPLET', normfiss)
+
+ logging.info("conversion quadratique")
+ maillageComplet.ConvertToQuadratic( 1 )
+ logging.info("groupes")
+ groups = maillageComplet.GetGroups()
+ grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS']
+ _ = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
+
+ logging.info("réorientation face de fissure FACE1")
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
+ _ = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
+
+ logging.info("réorientation face de fissure FACE2")
+ plansim = geompy.MakePlane(O, normfiss, 10000)
+ fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
+ _ = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
+ _ = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
+
+ logging.info("export maillage fini")
+ fichierMaillageFissure = os.path.join (nomRep , '{}.med'.format(nomFicFissure))
+ maillageComplet.ExportMED(fichierMaillageFissure)
+ putName(maillageComplet, nomFicFissure)
+ logging.info("fichier maillage fissure %s", fichierMaillageFissure)
+
+ return maillageComplet
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Maillage du pipe"""
import logging
import SMESH
def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
- """
- maillage effectif du pipe
- """
+ """maillage effectif du pipe"""
logging.info('start')
meshPipe = smesh.Mesh(None, "meshPipe")
fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1")
faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0")
faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1")
-
- mptsdisks = [] # vertices maillage de tous les disques
- mEdges = [] # identifiants edges maillage fond de fissure
- mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe
- mFaces = [] # identifiants faces maillage fissure
- mVols = [] # identifiants volumes maillage pipe
-
- mptdsk = None
+
+ mptsdisks = list() # vertices maillage de tous les disques
+ mEdges = list() # identifiants edges maillage fond de fissure
+ mEdgeFaces = list() # identifiants edges maillage edge face de fissure externe
+ mFaces = list() # identifiants faces maillage fissure
+ mVols = list() # identifiants volumes maillage pipe
+
+ mptdsk = list()
for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
-
+
# -----------------------------------------------------------------------
# --- points
-
+
gptdsk = gptsdisks[idisk]
if idisk > idisklim[0]:
oldmpts = mptdsk
- mptdsk = [] # vertices maillage d'un disque
+ mptdsk = list() # vertices maillage d'un disque
for k in range(nbsegCercle):
points = gptdsk[k]
- mptids = []
+ mptids = list()
for j, pt in enumerate(points):
if j == 0 and k > 0:
id = mptdsk[0][0]
mptids.append(id)
mptdsk.append(mptids)
mptsdisks.append(mptdsk)
-
+
# -----------------------------------------------------------------------
# --- groupes edges cercles debouchants
-
+
if idisk == idisklim[0]:
- pts = []
+ pts = list()
for k in range(nbsegCercle):
pts.append(mptdsk[k][-1])
- edges = []
- for k in range(len(pts)):
- k1 = (k+1)%len(pts)
+ edges = list()
+ nb_pts = len(pts)
+ for k in range(nb_pts):
+ k1 = (k+1)%nb_pts
idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
edges.append(idEdge)
edgeCircPipe0Group.Add(edges)
-
+
if idisk == idisklim[1]:
- pts = []
+ pts = list()
for k in range(nbsegCercle):
pts.append(mptdsk[k][-1])
- edges = []
- for k in range(len(pts)):
- k1 = (k+1)%len(pts)
+ edges = list()
+ nb_pts = len(pts)
+ for k in range(nb_pts):
+ k1 = (k+1)%nb_pts
idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
edges.append(idEdge)
edgeCircPipe1Group.Add(edges)
-
+
# -----------------------------------------------------------------------
# --- groupes faces debouchantes
-
+
if idisk == idisklim[0]:
- faces = []
+ faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
faceCircPipe0Group.Add(faces)
if idisk == idisklim[1]:
- faces = []
+ faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
faces.append(idf)
faceCircPipe1Group.Add(faces)
-
+
# -----------------------------------------------------------------------
# --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
-
+
if idisk == idisklim[0]:
mEdges.append(0)
mEdgeFaces.append(0)
ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]])
mEdgeFaces.append(ide2)
edgeFaceFissGroup.Add([ide2])
- idFaces = []
- idVols = []
-
+ idFaces = list()
+ idVols = list()
+
for j in range(nbsegRad):
idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]])
faceFissGroup.Add([idf])
idFaces.append(idf)
-
- idVolCercle = []
+
+ idVolCercle = list()
for k in range(nbsegCercle):
k1 = k+1
if k == nbsegCercle-1:
k1 = 0
if j == 0:
- idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1],
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], \
oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1]])
else:
- idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j],
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j], \
oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]])
idVolCercle.append(idv)
- idVols.append(idVolCercle)
-
+ idVols.append(idVolCercle)
+
mFaces.append(idFaces)
mVols.append(idVols)
nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
- meshPipeGroups = dict(fondFissGroup = fondFissGroup,
- nodesFondFissGroup = nodesFondFissGroup,
- faceFissGroup = faceFissGroup,
- edgeFaceFissGroup = edgeFaceFissGroup,
- edgeCircPipe0Group = edgeCircPipe0Group,
- edgeCircPipe1Group = edgeCircPipe1Group,
- faceCircPipe0Group = faceCircPipe0Group,
- faceCircPipe1Group = faceCircPipe1Group,
- pipeFissGroup = pipeFissGroup,
- edgesCircPipeGroup = edgesCircPipeGroup
+ meshPipeGroups = dict(fondFissGroup = fondFissGroup, \
+ nodesFondFissGroup = nodesFondFissGroup, \
+ faceFissGroup = faceFissGroup, \
+ edgeFaceFissGroup = edgeFaceFissGroup, \
+ edgeCircPipe0Group = edgeCircPipe0Group, \
+ edgeCircPipe1Group = edgeCircPipe1Group, \
+ faceCircPipe0Group = faceCircPipe0Group, \
+ faceCircPipe1Group = faceCircPipe1Group, \
+ pipeFissGroup = pipeFissGroup, \
+ edgesCircPipeGroup = edgesCircPipeGroup \
)
-
- return (meshPipe, meshPipeGroups, edgesCircPipeGroup)
\ No newline at end of file
+
+ #if meshPipe:
+ #text = "Arrêt rapide.\n"
+ #logging.info(text)
+ #raise Exception(text)
+ return (meshPipe, meshPipeGroups, edgesCircPipeGroup)
# liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
def construitPartitionsPeauFissure(facesDefaut, fissPipe):
- """
- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
+ """partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
+
Il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure.
@param facesDefaut liste de faces externes
@param fissPipe partition face de fissure etendue par pipe prolongé
@return partitionsPeauFissFond : liste de partitions face externe - fissure (None quand pas d'intersection)
"""
-
+
logging.info('start')
- partitionsPeauFissFond = []
+ partitionsPeauFissFond = list()
ipart = 0
- for filling in facesDefaut:
- part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ for filling in facesDefaut:
+ part = geompy.MakePartition([fissPipe, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
isPart = checkDecoupePartition([fissPipe, filling], part)
if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
otherFD = [fd for fd in facesDefaut if fd != filling]
- if len(otherFD) > 0:
- fissPipePart = geompy.MakePartition([fissPipe], otherFD, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ if otherFD:
+ fissPipePart = geompy.MakePartition([fissPipe], otherFD, list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
else:
fissPipePart = fissPipe
- part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ part = geompy.MakePartition([fissPipePart, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
partitionsPeauFissFond.append(part)
geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
else:
partitionsPeauFissFond.append(None)
- ipart = ipart +1
+ ipart += 1
- return partitionsPeauFissFond
\ No newline at end of file
+ return partitionsPeauFissFond
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import os
+
import logging
from .geomsmesh import smesh
import SMESH
nomRep = maillageFissureParams['nomRep']
nomFicSain = maillageFissureParams['nomFicSain']
- fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
+ fichierMaillageSain = os.path.join (nomRep , '{}.med'.format(nomFicSain))
# --- centre de fond de fissure et tangente
[maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
peauInterne(fichierMaillageSain, shapeDefaut, nomZones)
- facesDefaut = []
- centresDefaut = []
- normalsDefaut =[]
- extrusionsDefaut = []
+ facesDefaut = list()
+ centresDefaut = list()
+ normalsDefaut = list()
+ extrusionsDefaut = list()
isPlane = False
if isHexa and not isPlane:
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
else:
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
- bordsPartages = []
+ bordsPartages = list()
for face in facesDefaut:
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
fillconts = facesDefaut
def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
nomZones, coordsNoeudsFissure):
- """
- Identification de la zone à remailler, opérations sur le maillage
- de l'objet sain.
+ """Identification de la zone à remailler, opérations sur le maillage de l'objet sain.
+
La zone à remailler est définie à partir d'un objet géométrique
ou à partir d'un jeu de points et d'une distance d'influence.
@param maillagesSains : (le maillage de l'objet initial, booleen isHexa)
@param shapeDefaut : objet géométrique représentant la fissure
- (selon les cas, un point central, ou une shape plus complexe,
- dont on ne garde que les vertices)
+ (selon les cas, un point central, ou une shape plus complexe, dont on ne garde que les vertices)
@param tailleDefaut : distance d'influence définissant la zone à remailler:
tous les éléments du maillage initial qui pénètrent dans cette zone
sont détectés
@param nomZones : préfixe des noms de groupes créés dans le maillage initial. S'il y a un groupe de noeuds
@coordsNoeudsFissure : jeu de points donné par une liste (x1,y1,z1, x2,y2,z2, ...)
- @return (origShapes, verticesShapes, dmoyen) liste id subShapes,
- listes noeuds de bord, longueur arête moyenne bord
+ @return (origShapes, verticesShapes, dmoyen) liste id subShapes, listes noeuds de bord, longueur arête moyenne bord
"""
logging.info("start")
-
+ logging.debug("distance d'influence (tailleDefaut) = %f" % tailleDefaut)
+ #print (" shapeDefaut : {}".format(shapeDefaut))
+ #print (" nomZones : {}".format(nomZones))
+
maillageSain = maillagesSains[0]
isHexa = maillagesSains[1]
lists = maillageSain.CreateHoleSkin(tailleDefaut, shapeDefaut, nomZones, coordsNoeudsFissure)
- logging.debug("lists=%s", lists)
+ #print("lists = {}".format(lists))
trace = True
- origShapes = []
- verticesShapes = []
+ origShapes = list()
+ verticesShapes = list()
- cumul = 0 # somme des distances carrées entre point ordonnés (taille des arêtes)
- nb = 0 # nombre d'arêtes évaluées
+ cumul = 0. # somme des distances carrées entre point ordonnés (taille des arêtes)
+ nb = 0 # nombre d'arêtes évaluées
for aList in lists:
aShape = aList[0]
origShapes.append(aShape)
- logging.debug(" shapeId %s", aShape)
- vertices = []
- xyz0 = None
- for inode in range(1, len(aList)):
- xyz = maillageSain.GetNodeXYZ(aList[inode])
- if xyz0 is not None:
- cumul += distance2(xyz, xyz0)
- nb += 1
+ vertices = list()
+ xyz0 = maillageSain.GetNodeXYZ(aList[1])
+ ###vertices.append(geompy.MakeVertex(xyz0[0], xyz0[1], xyz0[2])) pourquoi pas le premier ?
+ #print (" node 0 {} : {}".format(aList[1],xyz0))
+ #print (xyz0)
+ for node in aList[2:]:
+ xyz = maillageSain.GetNodeXYZ(node)
+ #print (" node {} : {}".format(node,xyz))
+ cumul += distance2(xyz, xyz0)
xyz0 = xyz
- #logging.debug(" node %s %s", aList[inode], xyz)
+ #logging.debug(" node %s %s", node, xyz)
vertices.append(geompy.MakeVertex(xyz[0], xyz[1], xyz[2]))
- pass
+ nb += len(aList) - 2
verticesShapes.append(vertices)
- pass
+ #print ("nb = {}".format(nb))
+ #print ("cumul = {}".format(cumul))
- if (nb == 0) :
+ if (nb == 0):
texte = "La zone à remailler n'est pas détectée correctement.<br>"
texte += "Cause possible :<ul>"
texte += "<li>La distance d'influence est trop petite. "
texte += "L'ordre de grandeur minimal correspond à la taille des mailles du maillage sain dans la zone à remailler.</li></ul>"
raise fissError(traceback.extract_stack(),texte)
- dmoyen = math.sqrt(cumul/nb) # ~ taille de l'arête moyenne du maillage global
+ dmoyen = math.sqrt(cumul/float(nb)) # ~ taille de l'arête moyenne du maillage global
return origShapes, verticesShapes, dmoyen
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import os
+
from .geomsmesh import geompy, smesh
from .geomsmesh import geomPublish
from .geomsmesh import geomPublishInFather
import GEOM
import SALOMEDS
import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
import logging
from .fissureGenerique import fissureGenerique
maillage hexa
"""
- nomProbleme = "tuyau_Coude"
+ nomProbleme = "fissureCoude"
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
# ---------------------------------------------------------------------------
def genereGeometrieSaine(self, geomParams):
+ """a écrire"""
logging.info("genereGeometrieSaine %s", self.nomCas)
angleCoude = geomParams['angleCoude']
smesh.SetName(algo1d_long_p2, "algo1d_long_p2")
smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2")
- isDone = maillageSain.Compute()
-
- mp1 = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
- mp2 = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
- ext = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
- btu = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
- clg = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
- pei = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
- pex = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
- cou = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
+ is_done = maillageSain.Compute()
+ text = "maillageSain.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ _ = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
+ _ = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
+ _ = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
+ _ = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
+ _ = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
return [maillageSain, True] # True : maillage hexa
externe = True)
# ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+ mailleur="MeshGems"):
logging.info("genereShapeFissure %s", self.nomCas)
logging.info("shapeFissureParams %s", shapeFissureParams)
centre = geompy.MakeRotation(pc, axe, alfrd)
geomPublish(initLog.debug, centre, 'centrefissPlace' )
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, profondeur/2. ,profondeur)
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, profondeur/2. ,profondeur, \
+ mailleur)
return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, edgetube]
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
+ self.maillageFissureParams = dict(nomRep = os.curdir,
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
return elementsDefaut
# ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = construitFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+ maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step, mailleur)
return maillageFissure
# ---------------------------------------------------------------------------
Entity_Quad_Hexa = 8994,
Entity_Quad_Penta = 972,
Entity_Quad_Pyramid = 1038)
-
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""fissureGenerique"""
import logging
from blocFissure import gmu
-from blocFissure.gmu.initEtude import initEtude
-from blocFissure.gmu.getStatsMaillageFissure import getStatsMaillageFissure
+from .initEtude import initEtude
+from .getStatsMaillageFissure import getStatsMaillageFissure
+
+class fissureGenerique(object):
+ """classe générique problème fissure:
-class fissureGenerique():
- """
- classe générique problème fissure:
génération géométrie et maillage sain
définition et positionnement d'une fissure
génération d'un bloc défaut inséré dans le maillage sain
"""
- nomProbleme = "generique"
+ nomProbleme = "fissureGenerique"
+ geomParams = dict()
+ meshParams = dict()
+ shapeFissureParams = dict()
+ maillageFissureParams = dict()
def __init__(self, numeroCas):
initEtude()
self.numeroCas = numeroCas
self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
self.fissureLongue = False
+ self.referencesMaillageFissure = None
def setParamGeometrieSaine(self):
- self.geomParams = {}
+ """setParamGeometrieSaine"""
+ self.geomParams = dict()
def genereGeometrieSaine(self, geomParams):
+ """genereGeometrieSaine"""
geometriesSaines = [None]
return geometriesSaines
def setParamMaillageSain(self):
- self.meshParams = {}
+ """setParamMaillageSain"""
+ self.meshParams = dict()
def genereMaillageSain(self, geometriesSaines, meshParams):
+ """genereMaillageSain"""
maillagesSains = [None]
return maillagesSains
def setParamShapeFissure(self):
- self.shapeFissureParams = {}
+ """setParamShapeFissure"""
+ self.shapeFissureParams = dict()
- def genereShapeFissure(self, geometriesSaines, geomParams, shapeFissureParams):
+ def genereShapeFissure(self, geometriesSaines, geomParams, shapeFissureParams, mailleur="MeshGems"):
+ """genereShapeFissure"""
shapesFissure = [None]
return shapesFissure
def setParamMaillageFissure(self):
- self.maillageFissureParams = {}
+ """setParamMaillageFissure"""
+ self.maillageFissureParams = dict()
- def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, maillageFissureParams):
+ def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
+ """genereZoneDefaut"""
elementsDefaut = [None]
return elementsDefaut
- def genereMaillageFissure(self, geometriesSaines, maillagesSains, shapesFissure,
- maillageFissureParams, elementsDefaut, step):
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, step, \
+ mailleur="MeshGems"):
+ """genereMaillageFissure"""
maillageFissure = None
return maillageFissure
def setReferencesMaillageFissure(self):
- referencesMaillageFissure = {}
+ """setReferencesMaillageFissure"""
+ referencesMaillageFissure = dict()
return referencesMaillageFissure
+ def mailleur2d3d(self):
+ """Le mailleur : NETGEN ou MeshGems"""
+ #mailleur = "MeshGems"
+ mailleur = "NETGEN"
+ return mailleur
+
# ---------------------------------------------------------------------------
def executeProbleme(self, step=-1):
- logging.info(" --- executeProbleme %s", self.nomCas)
+ """executeProbleme"""
+ texte = " --- fissureGenerique.executeProbleme pour '{}', step = {}".format(self.nomCas,step)
+ logging.info(texte)
if step == 0:
return
return
self.setParamShapeFissure()
- shapesFissure = self.genereShapeFissure(geometriesSaines, self.geomParams, self.shapeFissureParams)
+ mailleur = self.mailleur2d3d()
+ shapesFissure = self.genereShapeFissure(geometriesSaines, self.geomParams, self.shapeFissureParams, mailleur)
if step == 3:
return
self.setParamMaillageFissure()
- elementsDefaut = self.genereZoneDefaut(geometriesSaines, maillagesSains, shapesFissure, self.shapeFissureParams, self.maillageFissureParams)
+ elementsDefaut = self.genereZoneDefaut(geometriesSaines, maillagesSains, \
+ shapesFissure, self.shapeFissureParams, self.maillageFissureParams)
if step == 4:
return
- maillageFissure = self.genereMaillageFissure(geometriesSaines, maillagesSains,
- shapesFissure, self.shapeFissureParams,
- self.maillageFissureParams, elementsDefaut, step)
+ maillageFissure = self.genereMaillageFissure(geometriesSaines, maillagesSains, \
+ shapesFissure, self.shapeFissureParams, self.maillageFissureParams, \
+ elementsDefaut, step, mailleur)
self.setReferencesMaillageFissure()
- mesures = getStatsMaillageFissure(maillageFissure, self.referencesMaillageFissure, self.maillageFissureParams)
-
-
-
-
-
-
+ ok_maillage = getStatsMaillageFissure(maillageFissure, self.referencesMaillageFissure, self.maillageFissureParams)
+ return ok_maillage
# -----------------------------------------------------------------------------
# --- création élements géométriques fissure elliptique
-def genereElemsFissureElliptique(shapeFissureParams):
+def genereElemsFissureElliptique(shapeFissureParams, \
+ mailleur="MeshGems"):
"""
TODO: a completer
"""
logging.info('start')
-
+
centreDefaut = shapeFissureParams['centreDefaut']
vecteurDefaut = shapeFissureParams['vecteurDefaut']
demiGrandAxe = shapeFissureParams['demiGrandAxe']
allonge = demiGrandAxe/demiPetitAxe
rayonTore = demiPetitAxe/5.0
- generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part = toreFissure(demiPetitAxe, allonge, rayonTore)
+ generatrice, _, Pipe_1, FaceFissure, Plane_1, Pipe1Part = toreFissure(demiPetitAxe, allonge, rayonTore)
ellipsoide = ellipsoideDefaut(demiPetitAxe, allonge, rayonTore)
# --- positionnement sur le bloc defaut de generatrice, tore et plan fissure
shapeDefaut = facefis1
xyz_defaut = geompy.PointCoordinates(centreDefaut)
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefis1, demiPetitAxe/10.0, demiPetitAxe/5.0)
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefis1, demiPetitAxe/10.0, demiPetitAxe/5.0, \
+ mailleur)
return shapeDefaut, xyz_defaut, tailleDefaut, coordsNoeudsFissure, pipe0, gener1, pipe1, facefis1, plane1, ellipsoide1
# -----------------------------------------------------------------------------
# --- maillage face de fissure pour identification zone de defaut
-def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
- """
- -Permet de générer un maillage sur l'objet géométrique 'facefiss' via
- l'algorithme NETGEN_1D2D :
+def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize, \
+ mailleur="MeshGems"):
+ """Maillage de l'objet géométrique 'facefiss'
+
+. Avec l'algorithme MG_CADSurf :
+ -SetMaxSize = dimension max d'un élément (maxSize)
+ -SetSecondOrder = élément quadratique (Y=1, N=0)
+ -SetOptimize = élément régulier (Y=1, N=0)
+ -SetFineness = finesse du maillage
+
+. Avec l'algorithme NETGEN_1D2D :
-SetMaxSize = dimension max d'un élément (maxSize)
-SetSecondOrder = élément quadratique (Y=1, N=0)
-SetOptimize = élément régulier (Y=1, N=0)
[0, 1, 2, 3, 4, 5 ]
-SetMinSize = dimension min d'un élément (minSize)
-SetQuadAllowed = permission quadrangle dans maillage triangle
- -On récupère les coordonnées de chaque noeud de la fissure qu'on stocke
+
+-On récupère les coordonnées de chaque noeud de la fissure qu'on stocke
dans une liste sous la forme : [X0, Y0, Z0, ..., Xn, Yn, Zn]"""
-
+
logging.info('start')
meshFissure = smesh.Mesh(facefiss)
- algo2d = meshFissure.Triangle(algo=smeshBuilder.NETGEN_1D2D)
- hypo2d = algo2d.Parameters()
- hypo2d.SetMaxSize( maxSize )
- hypo2d.SetSecondOrder( 0 )
- hypo2d.SetOptimize( 1 )
- hypo2d.SetFineness( 2 )
- hypo2d.SetMinSize( minSize )
- hypo2d.SetQuadAllowed( 0 )
- isDone = meshFissure.Compute()
+ text = "Maillage de '{}' avec {}".format(facefiss.GetName(),mailleur)
+ logging.info(text)
+ if ( mailleur == "MeshGems"):
+ algo2d = meshFissure.Triangle(algo=smeshBuilder.MG_CADSurf)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetPhySize( maxSize )
+ hypo2d.SetMinSize( maxSize/4. )
+ hypo2d.SetMaxSize( maxSize*2. )
+ hypo2d.SetChordalError( maxSize*0.25 )
+ hypo2d.SetVerbosity( 0 )
+ else:
+ algo2d = meshFissure.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( maxSize )
+ hypo2d.SetSecondOrder( 0 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( minSize )
+ hypo2d.SetQuadAllowed( 0 )
smesh.SetName(algo2d, "algo2d_zoneFiss")
smesh.SetName(hypo2d, "hypo1d_zoneFiss")
- coordsNoeudsFissure = []
+ is_done = meshFissure.Compute()
+ text = "meshFissure.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ coordsNoeudsFissure = list()
nodeIds = meshFissure.GetNodesId()
- for id in nodeIds:
- coords = meshFissure.GetNodeXYZ(id)
+ for indice in nodeIds:
+ coords = meshFissure.GetNodeXYZ(indice)
coordsNoeudsFissure.append(coords[0])
coordsNoeudsFissure.append(coords[1])
coordsNoeudsFissure.append(coords[2])
+
+ logging.info('end')
+
return coordsNoeudsFissure
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Statistiques maillage"""
+import os
import logging
import SMESH
-# -----------------------------------------------------------------------------
-# --- statistiques maillage
def getStatsMaillageFissure(maillage, referencesMaillageFissure, maillageFissureParams):
- """
- TODO: a completer
- """
+ """"Statistiques maillage"""
+
logging.debug('start')
- nomRep = '.'
if 'nomRep' in maillageFissureParams:
nomRep = maillageFissureParams['nomRep']
-
+ else:
+ nomRep = os.path.curdir
+
nomFicFissure = maillageFissureParams['nomFicFissure']
- fichierStatMaillageFissure = nomRep + '/' + nomFicFissure + '.res'
- fichierNewRef = nomRep + '/' + nomFicFissure + '.new'
+ fichierStatMaillageFissure = os.path.join(nomRep, "{}.res".format(nomFicFissure))
+ fichierNewRef = os.path.join(nomRep, "{}.new".format(nomFicFissure))
logging.debug("fichierStatMaillageFissure=%s", fichierStatMaillageFissure)
- OK = False
+ ok_maillage = False
if maillage is not None:
mesures = maillage.GetMeshInfo()
- d= {}
+ d_resu = dict()
for key, value in mesures.items():
logging.debug( "key: %s value: %s", key, value)
- d[str(key)] = value
- logging.debug("dico mesures %s", d)
+ d_resu[str(key)] = value
+ logging.debug("dico mesures %s", d_resu)
+
+ text_2 = ""
+ ok_maillage = True
+ with open(fichierStatMaillageFissure, "w") as fic_stat :
+ for key in ('Entity_Quad_Quadrangle', 'Entity_Quad_Hexa'):
+ if d_resu[key] != referencesMaillageFissure[key]:
+ text = "Ecart"
+ ok_maillage = False
+ else:
+ text = "Valeur_OK"
+ text += ": {} reference: {} calcul: {}".format(key,referencesMaillageFissure[key],d_resu[key])
+ logging.info(text)
+ fic_stat.write(text+"\n")
+ text_2 += " {} = {}, \\\n".format(key,d_resu[key])
+ tolerance = 0.05
+ for key in ('Entity_Node', 'Entity_Quad_Edge', 'Entity_Quad_Triangle', 'Entity_Quad_Tetra', 'Entity_Quad_Pyramid', 'Entity_Quad_Penta'):
+ if (d_resu[key] < (1.0 - tolerance)*referencesMaillageFissure[key]) \
+ or (d_resu[key] > (1.0 + tolerance)*referencesMaillageFissure[key]):
+ text = "Ecart"
+ ok_maillage = False
+ else:
+ text = "Valeur_OK"
+ text += ": {} reference: {} calcul: {}".format(key,referencesMaillageFissure[key],d_resu[key])
+ logging.info(text)
+ fic_stat.write(text+"\n")
+ text_2 += " {} = {}, \\\n".format(key,d_resu[key])
+
+ if ok_maillage:
+ text = "Calcul cohérent avec la référence."
+ else:
+ text = "Calcul différent de la référence.\n"
+ text += "Voir le fichier {}\n".format(fichierStatMaillageFissure)
+ text += "La nouvelle référence est disponible dans le fichier :\n{}\n".format(fichierNewRef)
+ text += "Il faut l'insérer pour créer le dictionnaire 'referencesMaillageFissure' dans le paramétrage du cas."
+# Résultats de référence pour intégration dans le python du cas pour une mise à jour
+ with open(fichierNewRef, "w") as fic_info :
+ fic_info.write(text_2[:-4]+" \\")
+
+ print (text)
- f = open(fichierStatMaillageFissure, 'w')
- f2 = open(fichierNewRef, 'w')
- OK = True
- for key in ('Entity_Quad_Pyramid', 'Entity_Quad_Hexa', 'Entity_Quad_Quadrangle'):
- if d[key] != referencesMaillageFissure[key]:
- logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
- f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
- OK = False
- else:
- logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
- f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
- f2.write(key + " = " + str(d[key]) + ",\n")
- tolerance = 0.05
- for key in ('Entity_Quad_Penta', 'Entity_Quad_Tetra', 'Entity_Quad_Triangle', 'Entity_Quad_Edge', 'Entity_Node'):
- if (d[key] < (1.0 - tolerance)*referencesMaillageFissure[key]) \
- or (d[key] > (1.0 + tolerance)*referencesMaillageFissure[key]):
- logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
- f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
- OK = False
- else:
- logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
- f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
- f2.write(key + " = " + str(d[key]) + ",\n")
- f.close()
- f2.close()
- return OK
+ return ok_maillage
from .produitMixte import produitMixte
from .whichSide import whichSide
-
-def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
- edgesFondIn, edgesFondFiss, wireFondFiss,
- aretesVivesC, fillingFaceExterne,
- edgesPipeIn, verticesPipePeau, rayonPipe,
+
+def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, \
+ edgesFondIn, edgesFondFiss, wireFondFiss, \
+ aretesVivesC, fillingFaceExterne, \
+ edgesPipeIn, verticesPipePeau, rayonPipe, \
facesInside, facesOnside):
- """
- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
- """
-
+ """elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)"""
+
logging.info('start')
-
- verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
- pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
- cercles = [] # les cercles de generation des pipes débouchant (même indice)
- facesFissExt = [] # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
- edgesFissExtPeau = [] # edges des faces de fissure externe sur la peau (même indice)
- edgesFissExtPipe = [] # edges des faces de fissure externe sur le pipe (même indice)
+
+ verticesEdgesFondIn = list() # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
+ pipexts = list() # les segments de pipe associés au points de fond de fissure débouchants (même indice)
+ cercles = list() # les cercles de generation des pipes débouchant (même indice)
+ facesFissExt = list() # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
+ edgesFissExtPeau = list() # edges des faces de fissure externe sur la peau (même indice)
+ edgesFissExtPipe = list() # edges des faces de fissure externe sur le pipe (même indice)
#logging.debug("edgesFondIn %s", edgesFondIn)
for iedf, edge in enumerate(edgesFondIn):
# La partition filling / pipe reconstruit échoue.
# - Si on partitionne le filling avec un simple pipe obtenu par extrusion droite du cercle,
# cela donne un point en trop sur le cercle.
- # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
- # les pipes reconstruits
+ # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
+ # les pipes reconstruits
logging.debug("angle=%s", angle)
#if abs(angle) > 1.e-7:
sommetAxe = geompy.MakeTranslationVector(centre, norm)
locPt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0)
sidePt0 = whichSide(faceTestPeau, locPt0)
sidePt1 = whichSide(faceTestPeau, locPt1)
- logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
+ logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
normFace = geompy.GetNormal(faceTestPeau, ptPeau)
inclPipe = abs(geompy.GetAngleRadians(norm, normFace))
lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(inclPipe)))
logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", inclPipe*180/math.pi, lgp)
-
+
# --- position des points extremite du pipe sur l'edge debouchante
# il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante
- locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
edgesLocSorted.sort()
geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%d"%iedf)
geomPublishInFather(initLog.debug, wireFondFiss, p2, "p2_%d"%iedf)
- edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
for edp in edps:
if geompy.MinDistance(centre, edp) < 1.e-3:
for ifa, face in enumerate(facesInside):
logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)")
- edgesPeauFis = []
- edgesPipeFis = []
- edgesPipeFnd = []
+ edgesPeauFis = list()
+ edgesPipeFis = list()
+ edgesPipeFnd = list()
try:
edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
logging.debug(" faces onside %s",edgesPeauFis)
if dist < 1.e-3:
break
- return (verticesEdgesFondIn, pipexts, cercles, facesFissExt, edgesFissExtPeau, edgesFissExtPipe)
\ No newline at end of file
+ return (verticesEdgesFondIn, pipexts, cercles, facesFissExt, edgesFissExtPeau, edgesFissExtPipe)
from .identifieFacesPeau import identifieFacesPeau
from .identifieEdgesPeau import identifieEdgesPeau
-def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
- edgesFondFiss, wireFondFiss, aretesVivesC,
- facesDefaut, centreFondFiss, rayonPipe,
+def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss, \
+ edgesFondFiss, wireFondFiss, aretesVivesC, \
+ facesDefaut, centreFondFiss, rayonPipe, \
aretesVivesCoupees):
"""
"""
fillingFaceExterne = facesDefaut[ifil]
logging.debug("traitement partitionPeauFissFond %s", ifil)
-
+
# --- identification edges fond de fissure, edges pipe sur la face de fissure, edges prolongées
# edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
-
+
(edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside) = identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
edgesPipeFiss, edgesFondFiss, aretesVivesC,
fillingFaceExterne, centreFondFiss)
-
+
# --- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
-
+
(verticesEdgesFondIn, pipexts, cercles,
facesFissExt, edgesFissExtPeau, edgesFissExtPipe) = identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
edgesFondIn, edgesFondFiss, wireFondFiss,
if len(verticesPipePeau) == 0: # aucune extrémité du pipe sur cette face de peau
edgesFissExtPeau = trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau)
-
+
# --- inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
-
+
(facePeau, facesPeauSorted, edgesPeauFondIn) = identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
verticesEdgesFondIn, pipexts, cercles,
fillingFaceExterne, centreFondFiss)
-
+
# --- identification précise des edges et disques des faces de peau selon index extremité fissure
-
+
(endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
bordsVifs, edgesFissurePeau, aretesVivesCoupees) = identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted,
edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees)
-
+
dataPPFF = dict(endsEdgeFond = endsEdgeFond, # pour chaque face [points edge fond de fissure aux débouchés du pipe]
facesPipePeau = facesPipePeau, # pour chaque face [faces du pipe débouchantes]
edgeRadFacePipePeau = edgeRadFacePipePeau, # pour chaque face [edge radiale des faces du pipe débouchantes ]
bordsVifs = bordsVifs, # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
edgesFissurePeau = edgesFissurePeau, # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
verticesPipePeau = verticesPipePeau # pour chaque face de peau : [point commun edFissPeau edCircPeau]
- )
+ )
return dataPPFF, aretesVivesCoupees
-
+
from . import initLog
def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss):
- """
- identification des faces et edges de fissure externe pour maillage
- """
+ """identification des faces et edges de fissure externe pour maillage"""
logging.info('start')
-
- facesFissExt = []
- edgesFissExtPeau = []
- edgesFissExtPipe = []
+
+ logging.debug("---------------------------- fsFissuExt : {} ".format(fsFissuExt))
+ facesFissExt = list()
+ edgesFissExtPeau = list()
+ edgesFissExtPipe = list()
for ifil in range(len(fsFissuExt)): # TODO: éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?)
facesFissExt += fsFissuExt[ifil]
edgesFissExtPeau += edFisExtPe[ifil]
edgesFissExtPipe += edFisExtPi[ifil]
- logging.debug("---------------------------- identification faces de fissure externes au pipe :%s ", len(facesFissExt))
+ logging.debug("---------------------------- identification faces de fissure externes au pipe : {}".format(len(facesFissExt)))
# regroupement des faces de fissure externes au pipe.
-
- if len(facesFissExt) > 1:
+
+ if not facesFissExt:
+ logging.info("---------------------------- fsFissuExt : {} ".format(fsFissuExt))
+ raise Exception("stop identifieFacesEdgesFissureExterne ; aucune face de fissure externe au pipe n'a été trouvée.")
+
+ elif len(facesFissExt) > 1:
faceFissureExterne = geompy.MakePartition(facesFissExt, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
# edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
# il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
(isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne)
- edgesBordFFE = []
+ edgesBordFFE = list()
for bound in closedFreeBoundaries:
edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE]
- logging.debug("edgesBordFFEid %s", edgesBordFFEid)
+ logging.debug("edgesBordFFEid {}".format(edgesBordFFEid))
edgesPPE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
edgesPPEid = [ geompy.GetSubShapeID(faceFissureExterne, ed) for ed in edgesPPE]
- logging.debug("edgesPPEid %s", edgesPPEid)
+ logging.debug("edgesPPEid {}".format(edgesPPEid))
edgesPFE = [ edid[0] for edid in edgesBordFFEid if edid[1] not in edgesPPEid] # on garde toutes les edges de bord non en contact avec le pipe
- logging.debug("edgesPFE %s", edgesPFE)
+ logging.debug("edgesPFE {}".format(edgesPFE))
edgesPeauFissureExterneC = geompy.MakeCompound(edgesPFE)
+
else:
faceFissureExterne = facesFissExt[0]
edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau)
edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe)
+
wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False))
geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne")
geomPublishInFather(initLog.debug, faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
geomPublishInFather(initLog.debug, faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
-
- return (faceFissureExterne, edgesPipeFissureExterneC, wirePipeFissureExterne, edgesPeauFissureExterneC)
\ No newline at end of file
+
+ return (faceFissureExterne, edgesPipeFissureExterneC, wirePipeFissureExterne, edgesPeauFissureExterneC)
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Insertion d'une fissure elliptique"""
+
+import os
import logging
import salome
from .enleveDefaut import enleveDefaut
from .regroupeSainEtDefaut import RegroupeSainEtDefaut
from .putName import putName
-
+
# -----------------------------------------------------------------------------
# --- procedure complete fissure elliptique
-def insereFissureElliptique(geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
+def insereFissureElliptique(geometriesSaines, maillagesSains, \
+ shapesFissure, shapeFissureParams, \
maillageFissureParams, elementsDefaut, step=-1):
"""
TODO: a completer
nbsegFis = maillageFissureParams['nbsegFis'] # 20
lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0
- fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
- fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
+ fichierMaillageSain = os.path.join(nomRep, '{}.med'.format(nomFicSain))
+ fichierMaillageFissure = os.path.join(nomRep, '{}.med'.format(nomFicFissure))
facesDefaut = elementsDefaut[0]
centreDefaut = elementsDefaut[1]
if step == 7:
return None
- [blocPartition, blocp, tore,
- faceFissure, facesExternes, facesExtBloc, facesExtElli,
- aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
- partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1,
- facefis1, ellipsoide1)
+ [ blocPartition, blocp, tore, \
+ faceFissure, facesExternes, facesExtBloc, facesExtElli,
+ aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
+ partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, facefis1, ellipsoide1)
if not isHexa:
edgesBords = None # maillage sain hexa ==> filling, et maillage edges Bords imposés du maillage sain
return None
[bloc1, blocComplet] = \
- meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces,
- gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli,
- aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords,
- nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle,
- nbsegFis, dmoyen, lensegEllipsoide)
+ meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
+ gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
+ aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
+ nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle,
+ nbsegFis, dmoyen, lensegEllipsoide) \
if step == 16:
return None
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""procédure complète fissure générale"""
+
+import os
+
import logging
import salome
from .geomsmesh import geompy
from .extractionOrienteeMulti import extractionOrienteeMulti
from .sortFaces import sortFaces
from .sortEdges import sortEdges
-from .eliminateDoubles import eliminateDoubles
from .substractSubShapes import substractSubShapes
from .produitMixte import produitMixte
from .findWireEndVertices import findWireEndVertices
from .findWireIntermediateVertices import findWireIntermediateVertices
from .orderEdgesFromWire import orderEdgesFromWire
-from .getSubshapeIds import getSubshapeIds
from .putName import putName
-from .distance2 import distance2
from .enleveDefaut import enleveDefaut
from .shapeSurFissure import shapeSurFissure
from .regroupeSainEtDefaut import RegroupeSainEtDefaut
from .triedreBase import triedreBase
from .checkDecoupePartition import checkDecoupePartition
from .whichSide import whichSide
-from .whichSideMulti import whichSideMulti
from .whichSideVertex import whichSideVertex
from .projettePointSurCourbe import projettePointSurCourbe
from .prolongeWire import prolongeWire
#from getCentreFondFiss import getCentreFondFiss
-# -----------------------------------------------------------------------------
-# --- procédure complète fissure générale
-
def insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step=-1):
- """
- TODO: a completer
- """
+ maillageFissureParams, elementsDefaut, \
+ step=-1, mailleur="MeshGems"):
+ """ TODO: a completer"""
logging.info('start')
-
+
shapeDefaut = shapesFissure[0] # faces de fissure, débordant
fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
if isPointInterne:
pointInterne = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
- #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
- fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
+ #fichierMaillageSain = os.path.join(nomRep, '{}.med'.format(nomFicSain))
+ fichierMaillageFissure = os.path.join(nomRep, '{}.med'.format(nomFicFissure))
# fillings des faces en peau
facesDefaut = elementsDefaut[0]
# --- restriction de la face de fissure au domaine solide :
# partition face fissure étendue par fillings, on garde la plus grande face
- partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, list(), list(), geompy.ShapeType["FACE"], 0, [], 0)
geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut')
facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False)
if isPointInterne:
facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande
logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
facesPortFissure = facesPartShapeDefautSorted[-1] #= global
-
+
geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
O, OX, OY, OZ = triedreBase()
-
+
# -----------------------------------------------------------------------------
# --- pipe de fond de fissure, prolongé, partition face fissure par pipe
# identification des edges communes pipe et face fissure
-
+
if geompy.NumberOfFaces(shapeDefaut) == 1:
plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000)
shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0) #= local
#fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe')
#geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
-
+
extrem, norms = findWireEndVertices(fondFiss, True)
logging.debug("extrem: %s, norm: %s",extrem, norms)
cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe)
geomPublish(initLog.debug, fissPipe, 'fissPipe')
partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss) #= local
geomPublish(initLog.debug, partPipe, 'partPipe')
-
+
edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"]) #= global
for i, edge in enumerate(edgesPipeFiss):
name = "edgePipe%d"%i
wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
logging.debug("wirePipeFiss construit sous forme de compound")
geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss")
-
+
wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss)
edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"])
for i, edge in enumerate(edgesFondFiss):
name = "edgeFondFiss%d"%i
geomPublishInFather(initLog.debug,fissPipe, edge, name)
wireFondFiss = geompy.MakeWire(edgesFondFiss) #= global
- geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
+ geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
# -----------------------------------------------------------------------------
# --- peau et face de fissure
# liste de faces externes : facesDefaut
# liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
- partitionsPeauFissFond = [] #= global
+ partitionsPeauFissFond = list() #= global
ipart = 0
- for filling in facesDefaut:
- part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ for filling in facesDefaut:
+ part = geompy.MakePartition([fissPipe, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
isPart = checkDecoupePartition([fissPipe, filling], part)
if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
otherFD = [fd for fd in facesDefaut if fd != filling]
if len(otherFD) > 0:
- fissPipePart = geompy.MakePartition([fissPipe], otherFD, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ fissPipePart = geompy.MakePartition([fissPipe], otherFD, list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
else:
fissPipePart = fissPipe
- part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ part = geompy.MakePartition([fissPipePart, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
partitionsPeauFissFond.append(part)
geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
else:
partitionsPeauFissFond.append(None)
ipart = ipart +1
-
-
+
+
# --- arêtes vives détectées (dans quadranglesToShapeNoCorner
# et quadranglesToShapeWithCorner)
-
- aretesVives = []
- aretesVivesCoupees = [] #= global
+
+ aretesVives = list()
+ aretesVivesCoupees = list() #= global
ia = 0
for a in bordsPartages:
if not isinstance(a, list):
- aretesVives.append(a)
+ aretesVives.append(a)
+ name = "areteVive%d"%ia
+ geomPublish(initLog.debug, a, name)
+ ia += 1
+ else:
+ if a[0] is not None:
+ aretesVives.append(a[0])
name = "areteVive%d"%ia
- geomPublish(initLog.debug, a, name)
+ geomPublish(initLog.debug, a[0], name)
ia += 1
- else:
- if a[0] is not None:
- aretesVives.append(a[0])
- name = "areteVive%d"%ia
- geomPublish(initLog.debug, a[0], name)
- ia += 1
aretesVivesC = None #= global
if len(aretesVives) > 0:
aretesVivesC =geompy.MakeCompound(aretesVives)
-
+
# -------------------------------------------------------
# --- inventaire des faces de peau coupées par la fissure
# pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
# 0, 1 ou plus edges de la face de fissure externe au pipe
-
+
nbFacesFilling = len(partitionsPeauFissFond)
- ptEdgeFond = [ [] for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
- fsPipePeau = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
- edRadFPiPo = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ]
- fsFissuExt = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe]
- edFisExtPe = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
- edFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
+ ptEdgeFond = [ list() for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ fsPipePeau = [ list() for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
+ edRadFPiPo = [ list() for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ fsFissuExt = [ list() for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe]
+ edFisExtPe = [ list() for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edFisExtPi = [ list() for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
facesPeaux = [None for i in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
- edCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
- ptCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ edCircPeau = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ ptCircPeau = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
gpedgeBord = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
gpedgeVifs = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings
- edFissPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
- ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
-
+ edFissPeau = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ ptFisExtPi = [ list() for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+
for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
if partitionPeauFissFond is not None:
fillingFaceExterne = facesDefaut[ifil]
# -----------------------------------------------------------------------
# --- identification edges fond de fissure, edges pipe sur la face de fissure,
# edges prolongées
-
+
edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss)) #= local
geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss)) #= local
geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesFondC, "edgesFondFiss")
-
+
if aretesVivesC is None: #= global facesInside facesOnside
- [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
- [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+ [edgesInside, _, _] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, _, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
else:
- [edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
- [facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
-
+ [edgesInside, _, _] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, _, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+
edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"]) #= global
- verticesPipePeau = [] #= global
+ verticesPipePeau = list() #= global
for i, edge in enumerate(edgesPipeIn):
try:
logging.debug("edgePipeIn%s coupe les faces OnSide", i)
except:
logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i)
- #edgesFondOut = [] #= inutile
- edgesFondIn =[] #= global
- if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
+ #edgesFondOut = list() #= inutile
+ edgesFondIn =list() #= global
+ if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
#tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
- #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+ #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
- verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
- pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
- cercles = [] # les cercles de generation des pipes débouchant (même indice)
- facesFissExt = [] # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
- edgesFissExtPeau = [] # edges des faces de fissure externe sur la peau (même indice)
- edgesFissExtPipe = [] # edges des faces de fissure externe sur le pipe (même indice)
+ verticesEdgesFondIn = list() # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
+ pipexts = list() # les segments de pipe associés au points de fond de fissure débouchants (même indice)
+ cercles = list() # les cercles de generation des pipes débouchant (même indice)
+ facesFissExt = list() # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
+ edgesFissExtPeau = list() # edges des faces de fissure externe sur la peau (même indice)
+ edgesFissExtPipe = list() # edges des faces de fissure externe sur le pipe (même indice)
#logging.debug("edgesFondIn %s", edgesFondIn)
edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
# La partition filling / pipe reconstruit échoue.
# - Si on partitionne le filling avec un simple pipe obtenu par extrusion droite du cercle,
# cela donne un point en trop sur le cercle.
- # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
- # les pipes reconstruits
+ # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
+ # les pipes reconstruits
logging.debug("angle=%s", angle)
#if abs(angle) > 1.e-7:
sommetAxe = geompy.MakeTranslationVector(centre, norm)
locPt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0)
sidePt0 = whichSide(faceTestPeau, locPt0)
sidePt1 = whichSide(faceTestPeau, locPt1)
- logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
+ logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
normFace = geompy.GetNormal(faceTestPeau, ptPeau)
inclPipe = abs(geompy.GetAngleRadians(norm, normFace))
lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(inclPipe)))
logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", inclPipe*180/math.pi, lgp)
-
+
# --- position des points extremite du pipe sur l'edge debouchante
# il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante
- locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
edgesLocSorted.sort()
geomPublishInFather(initLog.debug,wireFondFiss, p1, "p1_%d"%iedf)
geomPublishInFather(initLog.debug,wireFondFiss, p2, "p2_%d"%iedf)
- edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
for edp in edps:
if geompy.MinDistance(centre, edp) < 1.e-3:
for face in facesInside:
logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)")
- edgesPeauFis = []
- edgesPipeFis = []
- edgesPipeFnd = []
+ edgesPeauFis = list()
+ edgesPipeFis = list()
+ edgesPipeFnd = list()
try:
edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
logging.debug(" faces onside %s",edgesPeauFis)
logging.debug(" edgesFondIn %s ", edgesPipeFnd)
except:
logging.debug(" pb edges communes %s %s %s",edgesPeauFis, edgesPipeFis, edgesPipeFnd)
- pass
if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
dist = geompy.MinDistance(geompy.MakeCompound(edgesPeauFis), ptPeau)
logging.debug(" test distance extrémité reference %s", dist)
name="faceFissExt%d"%iedf
geomPublishInFather(initLog.debug,partitionPeauFissFond, face, name)
dist = 1.
- for ipe, edpe in enumerate(edgesPeauFis):
- for ipi, edpi in enumerate(edgesPipeFis):
+ for _, edpe in enumerate(edgesPeauFis):
+ for _, edpi in enumerate(edgesPipeFis):
dist = geompy.MinDistance(edpe, edpi)
if dist < 1.e-3:
edgesFissExtPeau.append(edpe)
# il faut recenser les edges de fissure sur la face de peau
j = 0
for face in facesInside:
- edgesPeauFis = []
- edgesPipeFis = []
- edgesPipeFnd = []
+ edgesPeauFis = list()
+ edgesPipeFis = list()
+ edgesPipeFnd = list()
try:
edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
name="edgesFissExtPeau%d"%j
geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
j += 1
-
+
# -----------------------------------------------------------------------
# --- identification faces de peau : face de peau percée du pipe, extrémités du pipe
# La partition avec le pipe peut créer un vertex (et un edge) de trop sur le cercle projeté,
# quand le cercle est très proche de la face.
# dans ce cas, la projection du cercle sur la face suivie d'une partition permet
# d'éviter le point en trop
-
+
facesAndFond = facesOnside
facesAndFond.append(wireFondFiss)
try:
- partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, list(), list(), geompy.ShapeType["FACE"], 0, list(), 1)
except:
logging.debug("probleme partition face pipe, contournement avec MakeSection")
- sections = []
+ sections = list()
for pipext in pipexts:
sections.append(geompy.MakeSection(facesOnside[0], pipext))
- partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, [], [], geompy.ShapeType["FACE"], 0, [], 1)
-
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, list(), list(), geompy.ShapeType["FACE"], 0, list(), 1)
+
# contrôle edge en trop sur edges circulaires
if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
- edgeEnTrop = []
+ edgeEnTrop = list()
outilPart = pipexts
facesPeau = geompy.ExtractShapes(partitionPeauByPipe, geompy.ShapeType["FACE"], False)
- facesPeauSorted, minsur, maxsurf = sortFaces(facesPeau)
+ facesPeauSorted, _, _ = sortFaces(facesPeau)
for i, face in enumerate(facesPeauSorted[:-1]): # on ne teste que la ou les petites faces "circulaires"
nbv = geompy.NumberOfEdges(face)
logging.debug("nombre d'edges sur face circulaire: %s", nbv)
j = 1-i
if bad:
outilPart[j] = geompy.MakeProjection(cercles[j],facesOnside[0])
- pass
- partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, [], [], geompy.ShapeType["FACE"], 0, [], 1)
- pass
-
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, list(), list(), geompy.ShapeType["FACE"], 0, list(), 1)
+
name="partitionPeauByPipe%d"%ifil
geomPublish(initLog.debug, partitionPeauByPipe, name)
[edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
[facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3)
-
+
if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
- facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFondOn)
+ facesPeauSorted, _, _ = sortFaces(facesPeauFondOn)
facePeau = facesPeauSorted[-1] # la plus grande face
else:
- facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ facePeau =geompy.MakePartition(facesPeauFondOn, list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 1)
name="facePeau%d"%ifil
geomPublish(initLog.debug, facePeau, name)
-
+
facesPipePeau = [None for i in range(len(edgesFissExtPipe))]
endsEdgeFond = [None for i in range(len(edgesFissExtPipe))]
edgeRadFacePipePeau = [None for i in range(len(edgesFissExtPipe))]
-
- edgesListees = []
- edgesCircPeau = []
- verticesCircPeau = []
+
+ edgesListees = list()
+ edgesCircPeau = list()
+ verticesCircPeau = list()
if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
-
+
for face in facesPeauSorted[:-1]: # la ou les faces débouchantes, pas la grande face de peau
logging.debug("examen face debouchante circulaire")
for i,efep in enumerate(edgesFissExtPipe):
if dist < 1e-3:
for ik, edpfi in enumerate(edgesPeauFondIn):
if geompy.MinDistance(face, edpfi) < 1e-3:
+ ikok = ik
break
- sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[ik]], geompy.ShapeType["VERTEX"])
+ sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[ikok]], geompy.ShapeType["VERTEX"])
nameFace = "facePipePeau%d"%i
nameVert = "endEdgeFond%d"%i
nameEdge = "edgeRadFacePipePeau%d"%i
edgeRadFacePipePeau[i] = edge
geomPublish(initLog.debug, edge, nameEdge)
break
- pass
- pass
- pass
- pass
-
+
# --- edges circulaires de la face de peau et points de jonction de la face externe de fissure
logging.debug("facesPipePeau: %s", facesPipePeau)
edgesCircPeau = [None for i in range(len(facesPipePeau))]
- verticesCircPeau = [None for i in range(len(facesPipePeau))]
+ verticesCircPeau = [None for i in range(len(facesPipePeau))]
for i,fcirc in enumerate(facesPipePeau):
edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"])
grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
verticesCircPeau[i] = grpVertCircPeau
name = "pointEdgeCirc%d"%i
geomPublishInFather(initLog.debug,facePeau, grpVertCircPeau, name)
- pass
- pass # --- au moins une extrémité du pipe sur cette face de peau
+ # --- au moins une extrémité du pipe sur cette face de peau
# --- edges de bord de la face de peau
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
- edgesBords = []
+ edgesBords = list()
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
name = "edgepeau%d"%i
aretesVivesCoupees += edv
logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
geomPublishInFather(initLog.debug,facePeau, groupEdgesBordPeau , "EdgesBords")
-
+
# --- edges de la face de peau partagées avec la face de fissure
-
+
edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
edges = substractSubShapes(facePeau, edgesPeau, edgesListees)
- edgesFissurePeau = []
+ edgesFissurePeau = list()
if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
edgesFissurePeau = [None for i in range(len(verticesCircPeau))] # edges associés aux extrémités du pipe, en premier
for edge in edges:
edgesFissurePeau.append(edge)
name = "edgeFissurePeau%d"%i
geomPublishInFather(initLog.debug,facePeau, edge, name)
-
ptEdgeFond[ifil] = endsEdgeFond # pour chaque face [points edge fond de fissure aux débouchés du pipe]
fsPipePeau[ifil] = facesPipePeau # pour chaque face [faces du pipe débouchantes]
# -----------------------------------------------------------------------
# fin de la boucle sur les faces de filling
# -----------------------------------------------------------------------
-
+
for i, avc in enumerate(aretesVivesCoupees):
name = "areteViveCoupee%d"%i
geomPublish(initLog.debug, avc, name)
-
+
# --- identification des faces et edges de fissure externe pour maillage
-
- facesFissExt = []
- edgesFissExtPeau = []
- edgesFissExtPipe = []
+
+ facesFissExt = list()
+ edgesFissExtPeau = list()
+ edgesFissExtPipe = list()
for ifil in range(nbFacesFilling): # TODO: éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?)
facesFissExt += fsFissuExt[ifil]
edgesFissExtPeau += edFisExtPe[ifil]
edgesFissExtPipe += edFisExtPi[ifil]
logging.debug("---------------------------- identification faces de fissure externes au pipe :%s ", len(facesFissExt))
# regroupement des faces de fissure externes au pipe.
-
+
if len(facesFissExt) > 1:
- faceFissureExterne = geompy.MakePartition(facesFissExt, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ faceFissureExterne = geompy.MakePartition(facesFissExt, list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
# edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
# il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
(isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne)
- edgesBordFFE = []
+ edgesBordFFE = list()
for bound in closedFreeBoundaries:
edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE]
geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne")
geomPublishInFather(initLog.debug,faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
geomPublishInFather(initLog.debug,faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
-
+
logging.debug("---------------------------- Preparation Maillage du Pipe --------------")
# -----------------------------------------------------------------------
# --- preparation maillage du pipe :
# - points sur les edges de fond de fissure et edges pipe/face fissure,
# - vecteurs tangents au fond de fissure (normal au disque maillé)
- # --- option de maillage selon le rayon de courbure du fond de fissure
+ # --- option de maillage selon le rayon de courbure du fond de fissure
lenEdgeFondExt = 0
for edff in edgesFondFiss:
lenEdgeFondExt += geompy.BasicProperties(edff)[0]
-
- disfond = []
+
+ disfond = list()
for filling in facesDefaut:
disfond.append(geompy.MinDistance(centreFondFiss, filling))
disfond.sort()
alpha = math.pi/(4*nbSegQuart)
deflexion = rcourb*(1.0 -math.cos(alpha))
lgmin = lenSegPipe*0.25
- lgmax = lenSegPipe*1.5
- logging.debug("rcourb: %s, lenFond:%s, deflexion: %s, lgmin: %s, lgmax: %s", rcourb, lenEdgeFondExt, deflexion, lgmin, lgmax)
+ lgmax = lenSegPipe*1.5
+ logging.debug("rcourb: %s, lenFond:%s, deflexion: %s, lgmin: %s, lgmax: %s", rcourb, lenEdgeFondExt, deflexion, lgmin, lgmax)
meshFondExt = smesh.Mesh(wireFondFiss)
algo1d = meshFondExt.Segment()
hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
- isDone = meshFondExt.Compute()
-
+
+ is_done = meshFondExt.Compute()
+ text = "meshFondExt.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
ptGSdic = {} # dictionnaire [paramètre sur la courbe] --> point géométrique
allNodeIds = meshFondExt.GetNodesId()
for nodeId in allNodeIds:
edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt
#logging.debug("nodeId %s, u %s", nodeId, str(u))
- usort = sorted(ptGSdic)
+ usort = sorted(ptGSdic)
logging.debug("nombre de points obtenus par deflexion %s",len(usort))
-
- centres = []
- origins = []
- normals = []
+
+ centres = list()
+ origins = list()
+ normals = list()
for edu in usort:
ied = edu[1]
u = edu[2]
vertcx = ptGSdic[edu]
norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u)
plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
- part = geompy.MakePartition([plan], [wirePipeFiss], [], [], geompy.ShapeType["VERTEX"], 0, [], 0)
+ part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
if len(liste) == 5: # 4 coins du plan plus intersection recherchée
for point in liste:
# geomPublishInFather(initLog.debug,wireFondFiss, plan, name)
# --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau
-
+
logging.debug("nbsegCercle %s", nbsegCercle)
-
+
# -----------------------------------------------------------------------
# --- points géométriques
-
- gptsdisks = [] # vertices géométrie de tous les disques
- raydisks = [[] for i in range(nbsegCercle)]
- for i in range(len(centres)): # boucle sur les disques
- gptdsk = [] # vertices géométrie d'un disque
- vertcx = centres[i]
+
+ gptsdisks = list() # vertices géométrie de tous les disques
+ raydisks = [list() for i in range(nbsegCercle)]
+ for i, centres_i in enumerate(centres): # boucle sur les disques
+ gptdsk = list() # vertices géométrie d'un disque
+ vertcx = centres_i
vertpx = origins[i]
normal = normals[i]
vec1 = geompy.MakeVector(vertcx, vertpx)
-
+
points = [vertcx] # les points du rayon de référence
for j in range(nbsegRad):
pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*float(rayonPipe)/nbsegRad)
pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
rayon = geompy.MakeLineTwoPnt(vertcx, pt)
raydisks[0].append(rayon)
-
+
for k in range(nbsegCercle-1):
angle = (k+1)*2*math.pi/nbsegCercle
pts = [vertcx] # les points d'un rayon obtenu par rotation
gptdsk.append(pts)
ray = geompy.MakeRotation(rayon, normal, angle)
raydisks[k+1].append(ray)
-
- gptsdisks.append(gptdsk)
-
+
+ gptsdisks.append(gptdsk)
+
# -----------------------------------------------------------------------
# --- recherche des points en trop (externes au volume à remailler)
- # - on associe chaque extrémité du pipe à une face filling
+ # - on associe chaque extrémité du pipe à une face filling
# - on part des disques aux extrémités du pipe
# - pour chaque disque, on prend les vertices de géométrie,
# on marque leur position relative à la face.
# - on s'arrete quand tous les noeuds sont dedans
-
+
logging.debug("---------------------------- recherche des points du pipe a éliminer --------------")
pt0 = centres[0]
pt1 = centres[-1]
idFillingFromBout = [None, None] # contiendra l'index du filling pour les extrémités 0 et 1
for ifil in range(nbFacesFilling):
- for ipt, pt in enumerate(ptEdgeFond[ifil]): # il y a un ou deux points débouchant sur cette face
+ for _, pt in enumerate(ptEdgeFond[ifil]): # il y a un ou deux points débouchant sur cette face
if geompy.MinDistance(pt,pt0) < geompy.MinDistance(pt,pt1): # TODO: trouver plus fiable pour les cas tordus...
idFillingFromBout[0] = ifil
- else:
+ else:
idFillingFromBout[1] = ifil
logging.debug("association bouts du pipe - faces de filling: %s", idFillingFromBout)
-
- facesPipePeau = []
- edgeRadFacePipePeau = []
+
+ facesPipePeau = list()
+ edgeRadFacePipePeau = list()
for ifil in range(nbFacesFilling):
facesPipePeau += fsPipePeau[ifil]
edgeRadFacePipePeau += edRadFPiPo[ifil]
-
+
logging.debug("recherche des disques de noeuds complètement internes")
- idisklim = [] # indices des premier et dernier disques internes
- idiskout = [] # indices des premier et dernier disques externes
+ idisklim = list() # indices des premier et dernier disques internes
+ idiskout = list() # indices des premier et dernier disques externes
for bout in range(2):
if bout == 0:
idisk = -1
outside = False
numout = idisk -inc # le disque précédent était dehors
else:
- inside = False # ce point est dehors
+ inside = False # ce point est dehors
if not inside and not outside:
break
idisklim.append(idisk) # premier et dernier disques internes
idiskout.append(numout) # premier et dernier disques externes
-
+
# --- listes de nappes radiales en filling à chaque extrémité débouchante
facesDebouchantes = [False, False]
idFacesDebouchantes = [-1, -1] # contiendra les indices des faces disque débouchantes (facesPipePeau)
- listNappes =[]
+ listNappes =list()
for i, idisk in enumerate(idisklim):
numout = idiskout[i]
logging.debug("extremité %s, indices disques interne %s, externe %s",i, idisk, numout)
- nappes = []
+ nappes = list()
if (idisk != 0) and (idisk != len(gptsdisks)-1): # si extrémité débouchante
for k in range(nbsegCercle):
if i == 0:
geomPublish(initLog.debug, nappe, name)
facesDebouchantes[i] = True
listNappes.append(nappes)
-
+
# --- mise en correspondance avec les indices des faces disque débouchantes (facesPipePeau)
for i, nappes in enumerate(listNappes):
if facesDebouchantes[i]:
logging.debug("idFacesDebouchantes: %s", idFacesDebouchantes)
# --- construction des listes d'edges radiales sur chaque extrémité débouchante
- listEdges = []
+ listEdges = list()
for i, nappes in enumerate(listNappes):
- id = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
- if id < 0:
- listEdges.append([])
+ indice = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if indice < 0:
+ listEdges.append(list())
else:
- face = facesPipePeau[id]
- edges = [edgeRadFacePipePeau[id]]
+ face = facesPipePeau[indice]
+ edges = [edgeRadFacePipePeau[indice]]
for k, nappe in enumerate(nappes):
if k > 0:
obj = geompy.MakeSection(face, nappes[k]) # normalement une edge, parfois un compound d'edges dont un tout petit
maxl = geompy.BasicProperties(edge)[0]
if maxl < 0.01: # problème MakeSection
logging.debug("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl)
- partNappeFace = geompy.MakePartition([face, nappes[k]], [] , [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ partNappeFace = geompy.MakePartition([face, nappes[k]], list() , list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
edps= geompy.ExtractShapes(partNappeFace, geompy.ShapeType["EDGE"], False)
- ednouv = []
+ ednouv = list()
for ii, ed in enumerate(edps):
vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False)
distx = [geompy.MinDistance(vx, face) for vx in vxs]
for ii, ed in enumerate(ednouv):
geomPublish(initLog.debug, ed, "ednouv%d"%ii)
[edsorted, minl,maxl] = sortEdges(ednouv)
- logging.debug(" longueur edge trouvée: %s", maxl)
+ logging.debug(" longueur edge trouvée: %s", maxl)
edge = edsorted[-1]
edges.append(edge)
name = 'edgeEndPipe%d'%k
# --- création des points du maillage du pipe sur la face de peau
for i, edges in enumerate(listEdges):
- id = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
- if id >= 0:
- gptdsk = []
- if id > 0: # id vaut 0 ou 1
- id = -1 # si id vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
- centre = ptEdgeFond[idFillingFromBout[i]][id]
- name = "centre%d"%id
+ indice = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if indice >= 0:
+ gptdsk = list()
+ if indice > 0: # indice vaut 0 ou 1
+ indice = -1 # si indice vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
+ centre = ptEdgeFond[idFillingFromBout[i]][indice]
+ name = "centre%d"%indice
geomPublish(initLog.debug, centre, name)
- vertPipePeau = ptFisExtPi[idFillingFromBout[i]][id]
+ vertPipePeau = ptFisExtPi[idFillingFromBout[i]][indice]
geomPublishInFather(initLog.debug,centre, vertPipePeau, "vertPipePeau")
grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes
- edgesCirc = []
+ edgesCirc = list()
for grpEdgesCirc in grpsEdgesCirc:
edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False)
for k, edge in enumerate(edges):
bout = extrCircs[0]
else:
bout = extrCircs[1]
- pass
else:
bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u)
name ="bout%d"%k
geomPublishInFather(initLog.debug,centre, bout, name)
# enregistrement des points dans la structure
- points = []
+ points = list()
for j in range(nbsegRad +1):
u = j/float(nbsegRad)
points.append(geompy.MakeVertexOnCurve(edge, u))
idisklim[1] = idisklim[1] +1
# --- ajustement precis des points sur edgesPipeFissureExterneC
-
+
edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe)
idiskmin = idisklim[0] + 1 # on ne prend pas le disque sur la peau, déjà ajusté
idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté
- idiskint = []
+ idiskint = list()
for vtx in verticesPFE:
- distPtVt = []
+ distPtVt = list()
for idisk in range(idiskmin, idiskmax):
gptdsk = gptsdisks[idisk]
pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
u = projettePointSurCourbe(pt, edgePFE)
ptproj = geompy.MakeVertexOnCurve(edgePFE, u)
gptsdisks[idisk][0][-1] = ptproj
-
+
# -----------------------------------------------------------------------
# --- maillage effectif du pipe
edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1")
faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0")
faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1")
- mptsdisks = [] # vertices maillage de tous les disques
- mEdges = [] # identifiants edges maillage fond de fissure
- mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe
- mFaces = [] # identifiants faces maillage fissure
- mVols = [] # identifiants volumes maillage pipe
+ mptsdisks = list() # vertices maillage de tous les disques
+ mEdges = list() # identifiants edges maillage fond de fissure
+ mEdgeFaces = list() # identifiants edges maillage edge face de fissure externe
+ mFaces = list() # identifiants faces maillage fissure
+ mVols = list() # identifiants volumes maillage pipe
- mptdsk = None
+ mptdsk = list()
for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
-
+
# -----------------------------------------------------------------------
# --- points
-
+
gptdsk = gptsdisks[idisk]
if idisk > idisklim[0]:
oldmpts = mptdsk
- mptdsk = [] # vertices maillage d'un disque
+ mptdsk = list() # vertices maillage d'un disque
for k in range(nbsegCercle):
points = gptdsk[k]
- mptids = []
+ mptids = list()
for j, pt in enumerate(points):
if j == 0 and k > 0:
- id = mptdsk[0][0]
+ indice = mptdsk[0][0]
else:
coords = geompy.PointCoordinates(pt)
- id = meshPipe.AddNode(coords[0], coords[1], coords[2])
- mptids.append(id)
+ indice = meshPipe.AddNode(coords[0], coords[1], coords[2])
+ mptids.append(indice)
mptdsk.append(mptids)
mptsdisks.append(mptdsk)
-
+
# -----------------------------------------------------------------------
# --- groupes edges cercles debouchants
-
+
if idisk == idisklim[0]:
- pts = []
+ pts = list()
for k in range(nbsegCercle):
pts.append(mptdsk[k][-1])
- edges = []
- for k in range(len(pts)):
+ edges = list()
+ for k, pts_k in enumerate(pts):
k1 = (k+1)%len(pts)
- idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ idEdge = meshPipe.AddEdge([pts_k, pts[k1]])
edges.append(idEdge)
edgeCircPipe0Group.Add(edges)
-
+
if idisk == idisklim[1]:
- pts = []
+ pts = list()
for k in range(nbsegCercle):
pts.append(mptdsk[k][-1])
- edges = []
- for k in range(len(pts)):
+ edges = list()
+ for k, pts_k in enumerate(pts):
k1 = (k+1)%len(pts)
- idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ idEdge = meshPipe.AddEdge([pts_k, pts[k1]])
edges.append(idEdge)
edgeCircPipe1Group.Add(edges)
-
+
# -----------------------------------------------------------------------
# --- groupes faces debouchantes
-
+
if idisk == idisklim[0]:
- faces = []
+ faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
faceCircPipe0Group.Add(faces)
if idisk == idisklim[1]:
- faces = []
+ faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
faces.append(idf)
faceCircPipe1Group.Add(faces)
-
+
# -----------------------------------------------------------------------
# --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
-
+
if idisk == idisklim[0]:
mEdges.append(0)
mEdgeFaces.append(0)
ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]])
mEdgeFaces.append(ide2)
edgeFaceFissGroup.Add([ide2])
- idFaces = []
- idVols = []
-
+ idFaces = list()
+ idVols = list()
+
for j in range(nbsegRad):
idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]])
faceFissGroup.Add([idf])
idFaces.append(idf)
-
- idVolCercle = []
+
+ idVolCercle = list()
for k in range(nbsegCercle):
k1 = k+1
if k == nbsegCercle-1:
idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j],
oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]])
idVolCercle.append(idv)
- idVols.append(idVolCercle)
-
+ idVols.append(idVolCercle)
+
mFaces.append(idFaces)
mVols.append(idVols)
pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
nbAdd = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
- nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
+ nb, _, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
# --- fin du maillage du pipe
# -----------------------------------------------------------------------
# --- edges de bord, faces défaut à respecter
- aFilterManager = smesh.CreateFilterManager()
+ _ = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
- criteres = []
+ criteres = list()
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres)
nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
# --- maillage des éventuelles arêtes vives entre faces reconstruites
-
- if len(aretesVivesCoupees) > 0:
+
+ if aretesVivesCoupees:
+
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment()
- hypo1d = algo1d.LocalLength(dmoyen,[],1e-07)
+ hypo1d = algo1d.LocalLength(dmoyen,list(),1e-07)
putName(algo1d.GetSubMesh(), "aretesVives")
putName(algo1d, "algo1d_aretesVives")
putName(hypo1d, "hypo1d_aretesVives")
- isDone = meshAretesVives.Compute()
- logging.info("aretesVives fini")
+
+ is_done = meshAretesVives.Compute()
+ text = "meshAretesVives.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
# -----------------------------------------------------------------------
# --- maillage faces de fissure
-
+
logging.debug("---------------------------- maillage faces de fissure externes au pipe :%s --------------", len(facesFissExt))
meshFaceFiss = smesh.Mesh(faceFissureExterne)
- algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
- hypo2d = algo2d.Parameters()
- hypo2d.SetMaxSize( areteFaceFissure )
- hypo2d.SetSecondOrder( 0 )
- hypo2d.SetOptimize( 1 )
- hypo2d.SetFineness( 2 )
- hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
- hypo2d.SetQuadAllowed( 0 )
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.MG_CADSurf)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetPhySize( areteFaceFissure )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetMaxSize( areteFaceFissure*3. )
+ hypo2d.SetChordalError( areteFaceFissure*0.25 )
+ hypo2d.SetVerbosity( 0 )
+ else:
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( areteFaceFissure )
+ hypo2d.SetSecondOrder( 0 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
putName(algo2d.GetSubMesh(), "faceFiss")
putName(algo2d, "algo2d_faceFiss")
putName(hypo2d, "hypo2d_faceFiss")
-
+
algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
hypo1d = algo1d.SourceEdges([ edgeFaceFissGroup ],0,0)
putName(algo1d.GetSubMesh(), "edgeFissPeau")
putName(algo1d, "algo1d_edgeFissPeau")
putName(hypo1d, "hypo1d_edgeFissPeau")
-
- isDone = meshFaceFiss.Compute()
- logging.info("meshFaceFiss fini")
grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
+ is_done = meshFaceFiss.Compute()
+ text = "meshFaceFiss.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
# --- maillage faces de peau
-
+
boutFromIfil = [None for i in range(nbFacesFilling)]
if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
boutFromIfil[idFillingFromBout[0]] = 0
boutFromIfil[idFillingFromBout[1]] = 1
-
+
logging.debug("---------------------------- maillage faces de peau --------------")
- meshesFacesPeau = []
+ meshesFacesPeau = list()
for ifil in range(nbFacesFilling):
meshFacePeau = None
if partitionsPeauFissFond[ifil] is None: # face de peau maillage sain intacte
-
+
# --- edges de bord de la face de filling
filling = facesDefaut[ifil]
edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False)
groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesFilling)
geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords")
-
+
meshFacePeau = smesh.Mesh(facesDefaut[ifil])
-
+
algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
putName(algo1d, "algo1d_bordsLibres", ifil)
putName(hypo1d, "hypo1d_bordsLibres", ifil)
-
+
else:
-
+
facePeau = facesPeaux[ifil] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
edgesCircPeau = edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
verticesCircPeau = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
meshFacePeau = smesh.Mesh(facePeau)
-
+
algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
putName(algo1d, "algo1d_bordsLibres", ifil)
putName(hypo1d, "hypo1d_bordsLibres", ifil)
-
+
algo1d = meshFacePeau.UseExisting1DElements(geom=geompy.MakeCompound(edgesFissurePeau))
hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0)
putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil)
putName(algo1d, "algo1d_edgePeauFiss", ifil)
putName(hypo1d, "hypo1d_edgePeauFiss", ifil)
-
+
if bordsVifs is not None:
algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs)
hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0)
putName(algo1d.GetSubMesh(), "bordsVifs", ifil)
putName(algo1d, "algo1d_bordsVifs", ifil)
putName(hypo1d, "hypo1d_bordsVifs", ifil)
-
+
for i, edgeCirc in enumerate(edgesCircPeau):
if edgeCirc is not None:
algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc)
putName(algo1d.GetSubMesh(), name, ifil)
putName(algo1d, "algo1d_" + name, ifil)
putName(hypo1d, "hypo1d_" + name, ifil)
-
- algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D)
- hypo2d = algo2d.Parameters()
- hypo2d.SetMaxSize( dmoyen )
- hypo2d.SetOptimize( 1 )
- hypo2d.SetFineness( 2 )
- hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
- hypo2d.SetQuadAllowed( 0 )
+
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.MG_CADSurf)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetPhySize( dmoyen )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetMaxSize( dmoyen*3. )
+ hypo2d.SetChordalError( dmoyen*0.25 )
+ hypo2d.SetVerbosity( 0 )
+ else:
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( dmoyen*0.75 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
putName(algo2d.GetSubMesh(), "facePeau", ifil)
putName(algo2d, "algo2d_facePeau", ifil)
putName(hypo2d, "hypo2d_facePeau", ifil)
-
- isDone = meshFacePeau.Compute()
- logging.info("meshFacePeau %d fini", ifil)
+
+ is_done = meshFacePeau.Compute()
+ text = "meshFacePeau {} Compute".format(ifil)
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil )
nbAdd = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
meshesFacesPeau.append(meshFacePeau)
elif grp.GetName() == "fisInPi":
group_faceFissInPipe = grp
- # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D
- distene=True
- if distene:
- algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D)
+ # le maillage NETGEN ne passe pas toujours ==> on force l'usage de MG_Tetra
+ mailleur = "MeshGems"
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.MG_Tetra)
else:
algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
hypo3d = algo3d.MaxElementVolume(1000.0)
+ hypo3d.SetVerboseLevel( 0 )
+ hypo3d.SetStandardOutputLog( 0 )
+ hypo3d.SetRemoveLogOnSuccess( 1 )
putName(algo3d.GetSubMesh(), "boiteDefaut")
putName(algo3d, "algo3d_boiteDefaut")
- isDone = meshBoiteDefaut.Compute()
putName(meshBoiteDefaut, "boiteDefaut")
- logging.info("meshBoiteDefaut fini")
-
- faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' )
+
+ is_done = meshBoiteDefaut.Compute()
+ text = "meshBoiteDefaut.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ _ = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' )
maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
zoneDefaut_internalFaces, zoneDefaut_internalEdges)
putName(maillageSain, nomFicSain+"_coupe")
logging.info("groupes")
groups = maillageComplet.GetGroups()
grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS']
- fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
+ _ = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
logging.info("réorientation face de fissure FACE1")
grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
- fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
+ _ = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
logging.info("export maillage fini")
maillageComplet.ExportMED(fichierMaillageFissure)
salome.sg.updateObjBrowser()
logging.info("maillage fissure fini")
-
+
return maillageComplet
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""procédure complète de construction d'une fissure longue"""
+
+import os
import logging
import salome
from .regroupeSainEtDefaut import RegroupeSainEtDefaut
from .triedreBase import triedreBase
+from .insereFissureLongue_a import insereFissureLongue_a
+from .insereFissureLongue_b import insereFissureLongue_b
+from .insereFissureLongue_c import insereFissureLongue_c
+from .insereFissureLongue_d import insereFissureLongue_d
+
# -----------------------------------------------------------------------------
-# --- procedure complete fissure longue
-
-def insereFissureLongue(geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step=-1):
- """
- TODO: a completer
- """
+
+def insereFissureLongue(geometriesSaines, \
+ shapesFissure, shapeFissureParams, \
+ maillageFissureParams, elementsDefaut, \
+ step=-1, mailleur="MeshGems"):
+ """procedure complete fissure longue"""
logging.info('start')
+ logging.info("Usage du mailleur %s", mailleur)
#geometrieSaine = geometriesSaines[0]
- #maillageSain = maillagesSains[0]
- #isHexa = maillagesSains[1]
shapeDefaut = shapesFissure[0] # face de fissure, debordant
#tailleDefaut = shapesFissure[2]
wiretube = shapesFissure[4] # wire fond de fissure, debordant
#nbsegFis = maillageFissureParams['nbsegFis'] # 20
#lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0
- #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
- fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
+ #fichierMaillageSain = os.path.join(nomRep, '{}.med'.format(nomFicSain))
+ fichierMaillageFissure = os.path.join(nomRep, '{}.med'.format(nomFicFissure))
facesDefaut = elementsDefaut[0]
#centreDefaut = elementsDefaut[1]
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
O, OX, OY, OZ = triedreBase()
-
+
# -----------------------------------------------------------------------------
# --- peau et face de fissure
# --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée
- partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
geomPublish(initLog.debug, partitionPeauFissFond, 'partitionPeauFissFond' )
edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False)
[facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
# --- partition peau -face fissure - pipe fond de fissure prolongé
- partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
geomPublish(initLog.debug, partitionPeauFissByPipe, 'partitionPeauFissByPipe' )
# --- identification face de peau
geomPublishInFather(initLog.debug,partitionPeauFissByPipe, facePeau, "facePeau")
# --- identification edges de bord face peau
- edgesBords = []
+ edgesBords = list()
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
edgesBords.append(edgepeau)
edgesFacePeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
edgesFacePeauSorted, minlg, maxlg = sortEdges(edgesFacePeau)
demiCerclesPeau = edgesFacePeauSorted[0:4]
- verticesDemiCerclesPeau = []
+ verticesDemiCerclesPeau = list()
for i, edge in enumerate(demiCerclesPeau):
name = "demiCerclePeau_%d"%i
geomPublishInFather(initLog.debug,facePeau, edge, name)
geomPublishInFather(initLog.debug,facePeau, vertex, name)
# --- demi cercles regroupés
- groupsDemiCerclesPeau = []
+ groupsDemiCerclesPeau = list()
for i, vertex in enumerate(verticesEdgePeauFiss):
- demis = []
+ demis = list()
for edge in demiCerclesPeau:
if geompy.MinDistance(vertex, edge) < 1.e-5:
demis.append(edge)
# --- identification edges commune pipe face fissure externe au pipe
edgePeauFissId = geompy.GetSubShapeID(partitionPeauFissByPipe, edgePeauFiss)
edgesFaceFiss = geompy.ExtractShapes(faceFiss, geompy.ShapeType["EDGE"], False)
- edgesFaceFissPipe = []
+ edgesFaceFissPipe = list()
for edge in edgesFaceFiss:
if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId:
edgesFaceFissPipe.append(edge)
[vertexReference] = geompy.ExtractShapes(disque, geompy.ShapeType["VERTEX"], False)
pipeFondFiss = geompy.MakePipe(disque, wireFondFiss)
- pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+ pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], list(), list(), geompy.ShapeType["SOLID"], 0, list(), 0)
#pipe = geompy.MakePipe(disque, WirePorteFondFissure)
- #pipe = geompy.MakePartition([pipe],[fillingFaceExterne], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+ #pipe = geompy.MakePartition([pipe],[fillingFaceExterne], list(), list(), geompy.ShapeType["SOLID"], 0, list(), 0)
#pipes = geompy.ExtractShapes(pipe, geompy.ShapeType["SOLID"], False)
#pipesSorted, volmin, volmax = sortSolids(pipes)
#pipeFondFiss = pipesSorted[-1]
- #pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
+ #pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], list(), list(), geompy.ShapeType["SOLID"], 0, list(), 0)
geomPublish(initLog.debug, disque, 'disque')
geomPublish(initLog.debug, wireFondFiss, 'wireFondFiss')
for i, v in enumerate(VerticesEndFondFiss):
name = "vertexEndFondFiss_%d"%i
geomPublishInFather(initLog.debug,wireFondFiss, v, name)
- VerticesEndPipeFiss = []
+ VerticesEndPipeFiss = list()
for v in VerticesEndFondFiss:
VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v))
for i, v in enumerate(VerticesEndPipeFiss):
# generatrices = edgesPipeOnplan moins rayon disques (3 grandes et 6 petites)
edgesIdPipeOnside = getSubshapeIds(pipeFondFiss, edgesPipeOnside)
edgesIdPipeOnplan = getSubshapeIds(pipeFondFiss, edgesPipeOnplan)
- rayons = []
- demiCercles = []
+ rayons = list()
+ demiCercles = list()
for i, edgeId in enumerate(edgesIdPipeOnside):
if edgeId in edgesIdPipeOnplan:
rayons.append(edgesPipeOnside[i])
rayons = rayons + edgesSorted[:4] # les 4 plus petits sont les rayons
demiCercles = demiCercles + edgesSorted[4:] # les suivants sont les arcs de cercle
rayonsId = getSubshapeIds(pipeFondFiss, rayons)
- generatrices = []
+ generatrices = list()
for i, edgeId in enumerate(edgesIdPipeOnplan):
if edgeId not in rayonsId:
generatrices.append(edgesPipeOnplan[i])
# --- generatrices en contact avec la face fissure externe au pipe
- generFiss = []
+ generFiss = list()
for edge in generatrices:
distance = geompy.MinDistance(vertexReference, edge)
logging.debug("distance %s", distance)
geomPublishInFather(initLog.debug,pipeFondFiss, groupGenerFiss, "GenFiss")
# --- demi cercles externes regroupés
- groupsDemiCerclesPipe = []
+ groupsDemiCerclesPipe = list()
for i, vertex in enumerate(verticesEdgePeauFiss):
- demis = []
+ demis = list()
for edge in demiCerclesExternes:
if geompy.MinDistance(vertex, edge) < 0.1:
demis.append(edge)
# --- faces fissure dans le pipe
- facesFissinPipe = []
+ facesFissinPipe = list()
generFissId = getSubshapeIds(pipeFondFiss, generFiss)
logging.debug("generatrice fissure %s", generFissId)
for face in facesPipeOnplan:
# --- edges de fond de fissure
- edgesFondFiss = []
+ edgesFondFiss = list()
for i, edge in enumerate(edgesInside):
anEdge = geompy.GetInPlace(pipeFondFiss, edge)
logging.debug(" edge %s ", anEdge)
aFilterManager = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
- criteres = []
+ criteres = list()
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres)
# --- maillage pipe fond fissure
- meshFondFiss = smesh.Mesh(pipeFondFiss)
- algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.QUADRANGLE)
- algo3d = meshFondFiss.Prism()
- putName(algo3d.GetSubMesh(), "pipe")
- putName(algo3d, "algo3d_pipe")
- putName(algo2d, "algo2d_pipe")
-
- for i, face in enumerate(disques):
- algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.RADIAL_QUAD,geom=face)
- putName(algo2d.GetSubMesh(), "disque", i)
- putName(algo2d, "algo2d_disque", i)
-
- for i, edge in enumerate(rayons):
- algo1d = meshFondFiss.Segment(geom=edge)
- hypo1d = algo1d.NumberOfSegments(4)
- putName(algo1d.GetSubMesh(), "rayon", i)
- putName(algo1d, "algo1d_rayon", i)
- putName(hypo1d, "hypo1d_rayon", i)
-
- for i, edge in enumerate(demiCercles):
- algo1d = meshFondFiss.Segment(geom=edge)
- hypo1d = algo1d.NumberOfSegments(6)
- putName(algo1d.GetSubMesh(), "demiCercle", i)
- putName(algo1d, "algo1d_demiCercle", i)
- putName(hypo1d, "hypo1d_demiCercle", i)
-
- generSorted, minlg, maxlg = sortEdges(generatrices)
- nbSegGenLong = int(math.sqrt(3.0)*maxlg/(profondeur - rayonPipe)) # on veut 2 triangles equilateraux dans la largeur de la face
- nbSegGenBout = 6
- logging.info("min %s, max %s, nombre de segments %s, nombre de generatrices %s", minlg, maxlg, nbSegGenLong, len(generSorted))
- for i, edge in enumerate(generSorted):
- algo1d = meshFondFiss.Segment(geom=edge)
- if i < 6:
- hypo1d = algo1d.NumberOfSegments(nbSegGenBout)
- else:
- hypo1d = algo1d.NumberOfSegments(nbSegGenLong)
- putName(algo1d.GetSubMesh(), "generatrice", i)
- putName(algo1d, "algo1d_generatrice", i)
- putName(hypo1d, "hypo1d_generatrice", i)
- isDone = meshFondFiss.Compute()
- logging.info("meshFondFiss computed")
-
- disks = []
- for i, face in enumerate(disques[:4]):
- name = "disk%d"%i
- disks.append(meshFondFiss.GroupOnGeom(face, name, SMESH.FACE))
- peauext_pipe = meshFondFiss.GetMesh().UnionListOfGroups( disks, 'PEAUEXT' )
-
- grpPFOR = meshFondFiss.GroupOnGeom(VerticesEndPipeFiss[0], "PFOR", SMESH.NODE)
- grpPFEX = meshFondFiss.GroupOnGeom(VerticesEndPipeFiss[1], "PFEX", SMESH.NODE)
-
- grp = meshFondFiss.GroupOnGeom(groupFaceFissInPipe, "fisInPi", SMESH.FACE)
- group_edgeFondFiss = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "FONDFISS", SMESH.EDGE)
- noeudsFondFissure = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "nfondfis", SMESH.NODE)
- groups_demiCercles = []
- groupnodes_demiCercles = []
- for i, group in enumerate(groupsDemiCerclesPipe):
- name = "Cercle%d"%i
- groups_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.EDGE))
- name = "nCercle%d"%i
- groupnodes_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.NODE))
- group_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.EDGE)
- groupnode_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.NODE)
- grpNode0 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[0], "Node0")
- grpNode1 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[1], "Node1")
- idNode0 = grpNode0.GetID(1)
- idNode1 = grpNode1.GetID(1)
- coordsMesh = []
- coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode0))
- coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode1))
- coordsGeom = []
- for vertex in verticesEdgePeauFiss:
- coord = geompy.PointCoordinates(vertex);
- if distance2(coord, coordsMesh[0]) < 0.1:
- meshFondFiss.MoveNode(idNode0, coord[0], coord[1], coord[2])
- if distance2(coord, coordsMesh[1]) < 0.1:
- meshFondFiss.MoveNode(idNode1, coord[0], coord[1], coord[2])
-
- for groupNodes in groupnodes_demiCercles:
- for idNode in groupNodes.GetListOfID():
- coordMesh = meshFondFiss.GetNodeXYZ(idNode)
- vertex = geompy.MakeVertex(coordMesh[0], coordMesh[1], coordMesh[2])
- minDist = 100000
- minCoord = None
- imin = -1
- for i, edge in enumerate(demiCerclesPeau):
- discoord = geompy.MinDistanceComponents(vertex, edge)
- if discoord[0] <minDist:
- minDist = discoord[0]
- minCoord = discoord[1:]
- imin = i
- if imin >= 0 and minDist > 1.E-6:
- logging.debug("node id moved : %s distance=%s", idNode, minDist)
- meshFondFiss.MoveNode(idNode, coordMesh[0] + minCoord[0], coordMesh[1] + minCoord[1], coordMesh[2] + minCoord[2])
-
+ meshFondFiss, groups_demiCercles, group_generFiss, nbSegGenLong, nbSegGenBout = \
+ insereFissureLongue_a (pipeFondFiss, disques, rayons, demiCercles, demiCerclesPeau, generatrices, \
+ VerticesEndPipeFiss, verticesEdgePeauFiss, \
+ groupFaceFissInPipe, groupEdgeFondFiss, groupsDemiCerclesPipe, groupGenerFiss, \
+ profondeur, rayonPipe, distance2)
# --- maillage face de peau
- meshFacePeau = smesh.Mesh(facePeau)
- algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_2D)
- hypo2d = algo2d.Parameters()
- hypo2d.SetMaxSize( 1000 )
- hypo2d.SetOptimize( 1 )
- hypo2d.SetFineness( 2 )
- hypo2d.SetMinSize( 2 )
- hypo2d.SetQuadAllowed( 0 )
- putName(algo2d.GetSubMesh(), "facePeau")
- putName(algo2d, "algo2d_facePeau")
- putName(hypo2d, "hypo2d_facePeau")
- #
- lenEdgePeauFiss = geompy.BasicProperties(edgePeauFiss)[0]
- frac = profondeur/lenEdgePeauFiss
- nbSeg = nbSegGenLong +2*nbSegGenBout
- ratio = (nbSegGenBout/float(profondeur)) / (nbSegGenLong/lenEdgePeauFiss)
- logging.info("lenEdgePeauFiss %s, profondeur %s, nbSegGenLong %s, nbSegGenBout %s, frac %s, ratio %s", lenEdgePeauFiss, profondeur, nbSegGenLong, nbSegGenBout, frac, ratio)
- algo1d = meshFacePeau.Segment(geom=edgePeauFiss)
- hypo1d = algo1d.NumberOfSegments(nbSeg,[],[ ])
- hypo1d.SetDistrType( 2 )
- hypo1d.SetConversionMode( 1 )
- hypo1d.SetTableFunction( [ 0, ratio, frac, 1, (1.-frac), 1, 1, ratio ] )
- putName(algo1d.GetSubMesh(), "edgePeauFiss")
- putName(algo1d, "algo1d_edgePeauFiss")
- putName(hypo1d, "hypo1d_edgePeauFiss")
- #
- algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
- hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
- putName(algo1d.GetSubMesh(), "bordsLibres")
- putName(algo1d, "algo1d_bordsLibres")
- putName(hypo1d, "hypo1d_bordsLibres")
- #
- for i in range(2):
- algo1d = meshFacePeau.UseExisting1DElements(geom=groupsDemiCerclesPeau[i])
- hypo1d = algo1d.SourceEdges([ groups_demiCercles[i] ],0,0)
- putName(algo1d.GetSubMesh(), "DemiCercles", i)
- putName(algo1d, "algo1d_groupDemiCercles", i)
- putName(hypo1d, "hypo1d_groupDemiCercles", i)
- #
- isDone = meshFacePeau.Compute()
- logging.info("meshFacePeau computed")
- grpTHOR = meshFacePeau.GroupOnGeom(verticesOutCercles[0], "THOR", SMESH.NODE)
- grpTHEX = meshFacePeau.GroupOnGeom(verticesOutCercles[1], "THEX", SMESH.NODE)
-
- groupEdgesPeauFiss = meshFacePeau.GroupOnGeom(edgePeauFiss, "PeauFis", SMESH.EDGE)
-
- peauext_face = meshFacePeau.CreateEmptyGroup( SMESH.FACE, 'PEAUEXT' )
- nbAdd = peauext_face.AddFrom( meshFacePeau.GetMesh() )
-
+ meshFacePeau, groupEdgesPeauFiss = \
+ insereFissureLongue_b ( facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibres, \
+ groupsDemiCerclesPeau, groups_demiCercles, verticesOutCercles, \
+ nbSegGenLong, nbSegGenBout, profondeur, \
+ mailleur )
# --- maillage face de fissure
- meshFaceFiss = smesh.Mesh(faceFiss)
- algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_2D)
- hypo2d = algo2d.Parameters()
- hypo2d.SetMaxSize( (profondeur - rayonPipe)/math.sqrt(3.0) ) # pour avoir deux couches de triangles equilateraux partout sur la fissure
- hypo2d.SetOptimize( 1 )
- hypo2d.SetFineness( 2 )
- hypo2d.SetMinSize( 2 )
- hypo2d.SetQuadAllowed( 0 )
- putName(algo2d.GetSubMesh(), "faceFiss")
- putName(algo2d, "algo2d_faceFiss")
- putName(hypo2d, "hypo2d_faceFiss")
- #
- algo1d = meshFaceFiss.UseExisting1DElements(geom=edgePeauFiss)
- hypo1d = algo1d.SourceEdges([ groupEdgesPeauFiss ],0,0)
- putName(algo1d.GetSubMesh(), "edgeFissPeau")
- putName(algo1d, "algo1d_edgeFissPeau")
- putName(hypo1d, "hypo1d_edgeFissPeau")
- #
- algo1d = meshFaceFiss.UseExisting1DElements(geom=groupEdgesFaceFissPipe)
- hypo1d = algo1d.SourceEdges([ group_generFiss ],0,0)
- putName(algo1d.GetSubMesh(), "edgeFissPeau")
- putName(algo1d, "algo1d_edgeFissPeau")
- putName(hypo1d, "hypo1d_edgeFissPeau")
- #
- isDone = meshFaceFiss.Compute()
- logging.info("meshFaceFiss computed")
-
- grp = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE)
-
- meshBoiteDefaut = smesh.Concatenate([internalBoundary.GetMesh(),
- meshFondFiss.GetMesh(),
- meshFacePeau.GetMesh(),
- meshFaceFiss.GetMesh()],
- 1, 1, 1e-05,False)
- # pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes
- # on designe les faces de peau en quadrangles par le groupe "skinFaces"
- group_faceFissOutPipe = None
- group_faceFissInPipe = None
- groups = meshBoiteDefaut.GetGroups()
- for grp in groups:
- if grp.GetType() == SMESH.FACE:
- #if "internalBoundary" in grp.GetName():
- # grp.SetName("skinFaces")
- if grp.GetName() == "fisOutPi":
- group_faceFissOutPipe = grp
- elif grp.GetName() == "fisInPi":
- group_faceFissInPipe = grp
-
- # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D
- distene=True
- if distene:
- algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D)
- else:
- algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
- hypo3d = algo3d.MaxElementVolume(1000.0)
- putName(algo3d.GetSubMesh(), "boiteDefaut")
- putName(algo3d, "algo3d_boiteDefaut")
- isDone = meshBoiteDefaut.Compute()
- logging.info("meshBoiteDefaut computed")
- putName(meshBoiteDefaut, "boiteDefaut")
+ meshFaceFiss = \
+ insereFissureLongue_c ( faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_generFiss, groupEdgesFaceFissPipe, \
+ profondeur, rayonPipe, \
+ mailleur )
+
+ # --- maillage meshBoiteDefaut
+
+ meshBoiteDefaut, group_faceFissInPipe, group_faceFissOutPipe = \
+ insereFissureLongue_d ( internalBoundary, meshFondFiss, meshFacePeau, meshFaceFiss, \
+ mailleur )
+
groups = maillageSain.GetGroups()
grps1 = [ grp for grp in groups if grp.GetName() == 'P1']
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()
- return maillageComplet
\ No newline at end of file
+ return maillageComplet
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""Insertion de fissure longue - maillage pipe fond fissure"""
+
+import logging
+import salome
+from .geomsmesh import geompy
+from .geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from .sortEdges import sortEdges
+from .putName import putName
+
+import math
+
+def insereFissureLongue_a (pipeFondFiss, disques, rayons, demiCercles, demiCerclesPeau, generatrices, \
+ VerticesEndPipeFiss, verticesEdgePeauFiss, \
+ groupFaceFissInPipe, groupEdgeFondFiss, groupsDemiCerclesPipe, groupGenerFiss, \
+ profondeur, rayonPipe, distance2):
+ """maillage pipe fond fissure"""
+ logging.info('start')
+
+ meshFondFiss = smesh.Mesh(pipeFondFiss)
+ algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+ algo3d = meshFondFiss.Prism()
+ putName(algo3d.GetSubMesh(), "pipe")
+ putName(algo3d, "algo3d_pipe")
+ putName(algo2d, "algo2d_pipe")
+
+ for i, face in enumerate(disques):
+ algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.RADIAL_QUAD,geom=face)
+ putName(algo2d.GetSubMesh(), "disque", i)
+ putName(algo2d, "algo2d_disque", i)
+
+ for i, edge in enumerate(rayons):
+ algo1d = meshFondFiss.Segment(geom=edge)
+ hypo1d = algo1d.NumberOfSegments(4)
+ putName(algo1d.GetSubMesh(), "rayon", i)
+ putName(algo1d, "algo1d_rayon", i)
+ putName(hypo1d, "hypo1d_rayon", i)
+
+ for i, edge in enumerate(demiCercles):
+ algo1d = meshFondFiss.Segment(geom=edge)
+ hypo1d = algo1d.NumberOfSegments(6)
+ putName(algo1d.GetSubMesh(), "demiCercle", i)
+ putName(algo1d, "algo1d_demiCercle", i)
+ putName(hypo1d, "hypo1d_demiCercle", i)
+
+ generSorted, minlg, maxlg = sortEdges(generatrices)
+ nbSegGenLong = int(math.sqrt(3.0)*maxlg/(profondeur - rayonPipe)) # on veut 2 triangles equilateraux dans la largeur de la face
+ nbSegGenBout = 6
+ logging.info("min %s, max %s, nombre de segments %s, nombre de generatrices %s", minlg, maxlg, nbSegGenLong, len(generSorted))
+ for i, edge in enumerate(generSorted):
+ algo1d = meshFondFiss.Segment(geom=edge)
+ if i < 6:
+ hypo1d = algo1d.NumberOfSegments(nbSegGenBout)
+ else:
+ hypo1d = algo1d.NumberOfSegments(nbSegGenLong)
+ putName(algo1d.GetSubMesh(), "generatrice", i)
+ putName(algo1d, "algo1d_generatrice", i)
+ putName(hypo1d, "hypo1d_generatrice", i)
+
+ disks = list()
+ for i, face in enumerate(disques[:4]):
+ name = "disk%d"%i
+ disks.append(meshFondFiss.GroupOnGeom(face, name, SMESH.FACE))
+ _ = meshFondFiss.GetMesh().UnionListOfGroups( disks, 'PEAUEXT' )
+
+ _ = meshFondFiss.GroupOnGeom(VerticesEndPipeFiss[0], "PFOR", SMESH.NODE)
+ _ = meshFondFiss.GroupOnGeom(VerticesEndPipeFiss[1], "PFEX", SMESH.NODE)
+
+ _ = meshFondFiss.GroupOnGeom(groupFaceFissInPipe, "fisInPi", SMESH.FACE)
+ _ = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "FONDFISS", SMESH.EDGE)
+ _ = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "nfondfis", SMESH.NODE)
+
+ groups_demiCercles = list()
+ groupnodes_demiCercles = list()
+ for i, group in enumerate(groupsDemiCerclesPipe):
+ name = "Cercle%d"%i
+ groups_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.EDGE))
+ name = "nCercle%d"%i
+ groupnodes_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.NODE))
+ group_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.EDGE)
+ groupnode_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.NODE)
+
+ is_done = meshFondFiss.Compute()
+ text = "meshFondFiss.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ grpNode0 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[0], "Node0")
+ grpNode1 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[1], "Node1")
+ idNode0 = grpNode0.GetID(1)
+ idNode1 = grpNode1.GetID(1)
+ coordsMesh = list()
+ coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode0))
+ coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode1))
+
+ for vertex in verticesEdgePeauFiss:
+ coord = geompy.PointCoordinates(vertex)
+ if distance2(coord, coordsMesh[0]) < 0.1:
+ meshFondFiss.MoveNode(idNode0, coord[0], coord[1], coord[2])
+ if distance2(coord, coordsMesh[1]) < 0.1:
+ meshFondFiss.MoveNode(idNode1, coord[0], coord[1], coord[2])
+
+ for groupNodes in groupnodes_demiCercles:
+ for idNode in groupNodes.GetListOfID():
+ coordMesh = meshFondFiss.GetNodeXYZ(idNode)
+ vertex = geompy.MakeVertex(coordMesh[0], coordMesh[1], coordMesh[2])
+ minDist = 100000
+ minCoord = None
+ imin = -1
+ for i, edge in enumerate(demiCerclesPeau):
+ discoord = geompy.MinDistanceComponents(vertex, edge)
+ if discoord[0] <minDist:
+ minDist = discoord[0]
+ minCoord = discoord[1:]
+ imin = i
+ if imin >= 0 and minDist > 1.E-6:
+ logging.debug("node id moved : %s distance=%s", idNode, minDist)
+ meshFondFiss.MoveNode(idNode, coordMesh[0] + minCoord[0], coordMesh[1] + minCoord[1], coordMesh[2] + minCoord[2])
+
+ return meshFondFiss, groups_demiCercles, group_generFiss, nbSegGenLong, nbSegGenBout
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""Insertion de fissure longue - maillage face de peau"""
+
+import logging
+import salome
+from .geomsmesh import geompy
+from .geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from .putName import putName
+
+def insereFissureLongue_b (facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibres, \
+ groupsDemiCerclesPeau, groups_demiCercles, verticesOutCercles, \
+ nbSegGenLong, nbSegGenBout, profondeur, \
+ mailleur="MeshGems"):
+ """maillage face de peau"""
+ logging.info('start')
+
+ meshFacePeau = smesh.Mesh(facePeau)
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.MG_CADSurf)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetPhySize( 1000 )
+ hypo2d.SetMinSize( 100 )
+ hypo2d.SetMaxSize( 3000. )
+ hypo2d.SetChordalError( 250. )
+ hypo2d.SetVerbosity( 0 )
+ else:
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( 1000 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( 2 )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "facePeau")
+ putName(algo2d, "algo2d_facePeau")
+ putName(hypo2d, "hypo2d_facePeau")
+ #
+ lenEdgePeauFiss = geompy.BasicProperties(edgePeauFiss)[0]
+ frac = profondeur/lenEdgePeauFiss
+ nbSeg = nbSegGenLong +2*nbSegGenBout
+ ratio = (nbSegGenBout/float(profondeur)) / (nbSegGenLong/lenEdgePeauFiss)
+ logging.info("lenEdgePeauFiss %s, profondeur %s, nbSegGenLong %s, nbSegGenBout %s, frac %s, ratio %s", lenEdgePeauFiss, profondeur, nbSegGenLong, nbSegGenBout, frac, ratio)
+
+ algo1d = meshFacePeau.Segment(geom=edgePeauFiss)
+ hypo1d = algo1d.NumberOfSegments(nbSeg,list(),[ ])
+ hypo1d.SetDistrType( 2 )
+ hypo1d.SetConversionMode( 1 )
+ hypo1d.SetTableFunction( [ 0, ratio, frac, 1, (1.-frac), 1, 1, ratio ] )
+ putName(algo1d.GetSubMesh(), "edgePeauFiss")
+ putName(algo1d, "algo1d_edgePeauFiss")
+ putName(hypo1d, "hypo1d_edgePeauFiss")
+ #
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
+ hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsLibres")
+ putName(algo1d, "algo1d_bordsLibres")
+ putName(hypo1d, "hypo1d_bordsLibres")
+ #
+ for i in range(2):
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupsDemiCerclesPeau[i])
+ hypo1d = algo1d.SourceEdges([ groups_demiCercles[i] ],0,0)
+ putName(algo1d.GetSubMesh(), "DemiCercles", i)
+ putName(algo1d, "algo1d_groupDemiCercles", i)
+ putName(hypo1d, "hypo1d_groupDemiCercles", i)
+
+ _ = meshFacePeau.GroupOnGeom(verticesOutCercles[0], "THOR", SMESH.NODE)
+ _ = meshFacePeau.GroupOnGeom(verticesOutCercles[1], "THEX", SMESH.NODE)
+
+ groupEdgesPeauFiss = meshFacePeau.GroupOnGeom(edgePeauFiss, "PeauFis", SMESH.EDGE)
+
+ is_done = meshFacePeau.Compute()
+ text = "meshFacePeau.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ peauext_face = meshFacePeau.CreateEmptyGroup( SMESH.FACE, 'PEAUEXT' )
+ _ = peauext_face.AddFrom( meshFacePeau.GetMesh() )
+
+ return meshFacePeau, groupEdgesPeauFiss
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""Insertion de fissure longue - maillage face de fissure"""
+
+import logging
+import salome
+from .geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from .putName import putName
+
+import math
+
+def insereFissureLongue_c (faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_generFiss, groupEdgesFaceFissPipe, \
+ profondeur, rayonPipe, \
+ mailleur="MeshGems"):
+ """maillage face de fissure"""
+ logging.info('start')
+
+ meshFaceFiss = smesh.Mesh(faceFiss)
+ mesh_size = (profondeur - rayonPipe)/math.sqrt(3.0) # pour avoir deux couches de triangles equilateraux partout sur la fissure
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.MG_CADSurf)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetPhySize( mesh_size )
+ hypo2d.SetMinSize( mesh_size/10. )
+ hypo2d.SetMaxSize( mesh_size*3. )
+ hypo2d.SetChordalError( mesh_size*0.25 )
+ hypo2d.SetVerbosity( 0 )
+ else:
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( mesh_size )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( 2 )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "faceFiss")
+ putName(algo2d, "algo2d_faceFiss")
+ putName(hypo2d, "hypo2d_faceFiss")
+ #
+ algo1d = meshFaceFiss.UseExisting1DElements(geom=edgePeauFiss)
+ hypo1d = algo1d.SourceEdges([ groupEdgesPeauFiss ],0,0)
+ putName(algo1d.GetSubMesh(), "edgeFissPeau")
+ putName(algo1d, "algo1d_edgeFissPeau")
+ putName(hypo1d, "hypo1d_edgeFissPeau")
+ #
+ algo1d = meshFaceFiss.UseExisting1DElements(geom=groupEdgesFaceFissPipe)
+ hypo1d = algo1d.SourceEdges([ group_generFiss ],0,0)
+ putName(algo1d.GetSubMesh(), "edgeFissPeau")
+ putName(algo1d, "algo1d_edgeFissPeau")
+ putName(hypo1d, "hypo1d_edgeFissPeau")
+
+ _ = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE)
+
+ is_done = meshFaceFiss.Compute()
+ text = "meshFaceFiss.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ return meshFaceFiss
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""Insertion de fissure longue - maillage meshBoiteDefaut"""
+
+import logging
+import salome
+from .geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from .putName import putName
+
+def insereFissureLongue_d (internalBoundary, meshFondFiss, meshFacePeau, meshFaceFiss, \
+ mailleur="MeshGems"):
+ """maillage meshBoiteDefaut"""
+ logging.info('start')
+ logging.info("insereFissureLongue_d (%s)", mailleur)
+
+ meshBoiteDefaut = smesh.Concatenate( [internalBoundary.GetMesh(), \
+ meshFondFiss.GetMesh(), \
+ meshFacePeau.GetMesh(), \
+ meshFaceFiss.GetMesh()], \
+ 1, 1, 1e-05,False)
+ # pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes
+ # on designe les faces de peau en quadrangles par le groupe "skinFaces"
+ group_faceFissOutPipe = None
+ group_faceFissInPipe = None
+ groups = meshBoiteDefaut.GetGroups()
+ for grp in groups:
+ if grp.GetType() == SMESH.FACE:
+ #if "internalBoundary" in grp.GetName():
+ # grp.SetName("skinFaces")
+ if grp.GetName() == "fisOutPi":
+ group_faceFissOutPipe = grp
+ elif grp.GetName() == "fisInPi":
+ group_faceFissInPipe = grp
+
+ # le maillage NETGEN ne passe pas toujours ==> on force l'usage de MG_Tetra
+ mailleur = "MeshGems"
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+ else:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
+ hypo3d = algo3d.MaxElementVolume(1000.0)
+ hypo3d.SetVerboseLevel( 0 )
+ hypo3d.SetStandardOutputLog( 0 )
+ hypo3d.SetRemoveLogOnSuccess( 1 )
+ putName(algo3d.GetSubMesh(), "boiteDefaut")
+ putName(algo3d, "algo3d_boiteDefaut")
+ putName(meshBoiteDefaut, "boiteDefaut")
+
+ is_done = meshBoiteDefaut.Compute()
+ text = "meshBoiteDefaut.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ return meshBoiteDefaut, group_faceFissInPipe, group_faceFissOutPipe
import SMESH
from .putName import putName
-
+
def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
"""
edges de bord, faces défaut à respecter
nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
# --- maillage des éventuelles arêtes vives entre faces reconstruites
-
+
grpAretesVives = None
- if len(aretesVivesCoupees) > 0:
+ if aretesVivesCoupees:
+
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment()
putName(algo1d.GetSubMesh(), "aretesVives")
putName(algo1d, "algo1d_aretesVives")
putName(hypo1d, "hypo1d_aretesVives")
- isDone = meshAretesVives.Compute()
- logging.info("aretesVives fini")
+
+ is_done = meshAretesVives.Compute()
+ text = "meshAretesVives.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
- return (internalBoundary, bordsLibres, grpAretesVives)
\ No newline at end of file
+ return (internalBoundary, bordsLibres, grpAretesVives)
import SMESH
from .putName import putName
-
-def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
- meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad):
- """
- maillage faces de fissure
- """
+
+def mailleFacesFissure(faceFissureExterne, \
+ edgesPipeFissureExterneC, edgesPeauFissureExterneC, \
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad, \
+ mailleur="MeshGems"):
+ """maillage faces de fissure"""
logging.info('start')
meshFaceFiss = smesh.Mesh(faceFissureExterne)
- algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
- hypo2d = algo2d.Parameters()
- hypo2d.SetMaxSize( areteFaceFissure )
- hypo2d.SetSecondOrder( 0 )
- hypo2d.SetOptimize( 1 )
- hypo2d.SetFineness( 2 )
- hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
- hypo2d.SetQuadAllowed( 0 )
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.MG_CADSurf)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetPhySize( areteFaceFissure )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetMaxSize( areteFaceFissure*3. )
+ hypo2d.SetChordalError( areteFaceFissure*0.25 )
+ hypo2d.SetVerbosity( 0 )
+ else:
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( areteFaceFissure )
+ hypo2d.SetSecondOrder( 0 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
putName(algo2d.GetSubMesh(), "faceFiss")
putName(algo2d, "algo2d_faceFiss")
putName(hypo2d, "hypo2d_faceFiss")
-
+
+ texte = "Récupération des arêtes de '{}'".format(edgesPipeFissureExterneC.GetName())
+ logging.info(texte)
algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
putName(algo1d.GetSubMesh(), "edgeFissPeau")
putName(algo1d, "algo1d_edgeFissPeau")
putName(hypo1d, "hypo1d_edgeFissPeau")
-
- isDone = meshFaceFiss.Compute()
- logging.info("meshFaceFiss fini")
grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
- return (meshFaceFiss, grpFaceFissureExterne, grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne)
\ No newline at end of file
+ is_done = meshFaceFiss.Compute()
+ text = "meshFaceFiss.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ return (meshFaceFiss, grpFaceFissureExterne, grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""maillage faces de peau"""
+
import logging
from .geomsmesh import geompy
from .putName import putName
-def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
- facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
- bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
- edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad):
- """
- maillage faces de peau
- """
+def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives, \
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad, \
+ mailleur="MeshGems"):
+ """maillage faces de peau"""
logging.info('start')
+ logging.info(mailleur)
nbFacesFilling = len(partitionsPeauFissFond)
boutFromIfil = [None for i in range(nbFacesFilling)]
if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
boutFromIfil[idFillingFromBout[0]] = 0
boutFromIfil[idFillingFromBout[1]] = 1
-
- logging.debug("---------------------------- maillage faces de peau --------------")
- meshesFacesPeau = []
+
+ logging.info("---------------------------- maillage faces de peau --------------")
+ logging.info("nbFacesFilling = %d", nbFacesFilling)
+ meshesFacesPeau = list()
for ifil in range(nbFacesFilling):
meshFacePeau = None
if partitionsPeauFissFond[ifil] is None: # face de peau maillage sain intacte
groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesFilling)
geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords")
-
+
meshFacePeau = smesh.Mesh(facesDefaut[ifil])
-
+
algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
putName(algo1d, "algo1d_bordsLibres", ifil)
putName(hypo1d, "hypo1d_bordsLibres", ifil)
-
+
else:
-
- logging.debug("meshFacePeau %d coupée par la fissure", ifil)
+
+ logging.info("meshFacePeau %d coupée par la fissure", ifil)
facePeau = facesPeaux[ifil] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
edgesCircPeau = edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
- verticesCircPeau = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ _ = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
groupEdgesBordPeau = gpedgeBord[ifil] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
bordsVifs = gpedgeVifs[ifil] # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ logging.info("a")
meshFacePeau = smesh.Mesh(facePeau)
-
+
algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
putName(algo1d, "algo1d_bordsLibres", ifil)
putName(hypo1d, "hypo1d_bordsLibres", ifil)
-
+
+ logging.info("b")
algo1d = meshFacePeau.UseExisting1DElements(geom=geompy.MakeCompound(edgesFissurePeau))
hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0)
putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil)
putName(algo1d, "algo1d_edgePeauFiss", ifil)
putName(hypo1d, "hypo1d_edgePeauFiss", ifil)
-
+
if bordsVifs is not None:
algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs)
hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0)
putName(algo1d.GetSubMesh(), "bordsVifs", ifil)
putName(algo1d, "algo1d_bordsVifs", ifil)
putName(hypo1d, "hypo1d_bordsVifs", ifil)
-
+
for i, edgeCirc in enumerate(edgesCircPeau):
+ logging.info("i = {}".format(i))
if edgeCirc is not None:
- algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc)
+ algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc) # addToStudy() failed ?
if boutFromIfil[ifil] is None:
hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i] ],0,0)
else:
putName(algo1d.GetSubMesh(), name, ifil)
putName(algo1d, "algo1d_" + name, ifil)
putName(hypo1d, "hypo1d_" + name, ifil)
-
- algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D)
- hypo2d = algo2d.Parameters()
- hypo2d.SetMaxSize( dmoyen )
- hypo2d.SetOptimize( 1 )
- hypo2d.SetFineness( 2 )
- hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
- hypo2d.SetQuadAllowed( 0 )
+
+ logging.info("c")
+ logging.info("Maillage avec %s", mailleur)
+ if ( mailleur == "MeshGems"):
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.MG_CADSurf)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetPhySize( dmoyen )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetMaxSize( dmoyen*2. )
+ hypo2d.SetChordalError( dmoyen*0.25 )
+ hypo2d.SetVerbosity( 0 )
+ else:
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( dmoyen )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
+ logging.info("d")
putName(algo2d.GetSubMesh(), "facePeau", ifil)
putName(algo2d, "algo2d_facePeau", ifil)
putName(hypo2d, "hypo2d_facePeau", ifil)
-
- isDone = meshFacePeau.Compute()
- logging.info("meshFacePeau %d fini", ifil)
+
+ is_done = meshFacePeau.Compute()
+ text = "meshFacePeau {} .Compute".format(ifil)
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil )
- nbAdd = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
+ _ = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
meshesFacesPeau.append(meshFacePeau)
- return meshesFacesPeau
\ No newline at end of file
+ return meshesFacesPeau
# -----------------------------------------------------------------------------
# --- maillage du bloc partitionne
-def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces,
- gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli,
- aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords,
- nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegFis, dmoyen, lensegEllipsoide):
- """
- Maillage du bloc partitionné
+def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
+ gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
+ aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
+ nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegFis, dmoyen, lensegEllipsoide, \
+ mailleur="MeshGems"):
+ """Maillage du bloc partitionné
+
TODO: a completer
"""
logging.info('start')
aFilterManager = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
- criteres = []
+ criteres = list()
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres)
bloc1 = smesh.Mesh(blocPartition)
- for i in range(len(sharedFaces)):
- algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces[i])
+ for i, sharedFaces_i in enumerate(sharedFaces):
+ algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces_i)
hypo2d = algo2d.Parameters(which=smesh.SIMPLE)
hypo2d.SetLocalLength(lensegEllipsoide)
hypo2d.LengthFromEdges()
putName(algo2d, "algo2d_sharedFaces", i)
putName(hypo2d, "hypo2d_sharedFaces", i)
- for i in range(len(sharedEdges)):
- algo1d = bloc1.Segment(geom=sharedEdges[i])
+ for i, sharedEdges_i in enumerate(sharedEdges):
+ algo1d = bloc1.Segment(geom=sharedEdges_i)
hypo1d = algo1d.LocalLength(lensegEllipsoide)
putName(algo1d.GetSubMesh(), "sharedEdges", i)
putName(algo1d, "algo1d_sharedEdges", i)
putName(algo1d, "algo1d_tore")
putName(hypo1d, "hypo1d_tore")
- for i in range(len(faces)):
- algo2d = bloc1.Quadrangle(geom=faces[i])
+ for i, faces_i in enumerate(faces):
+ algo2d = bloc1.Quadrangle(geom=faces_i)
hypo2d = smesh.CreateHypothesis('QuadrangleParams')
hypo2d.SetTriaVertex( geompy.GetSubShapeID(blocPartition,centres[i]) )
hypo2d.SetQuadType( StdMeshersBuilder.QUAD_STANDARD )
- status = bloc1.AddHypothesis(hypo2d,faces[i])
+ status = bloc1.AddHypothesis(hypo2d,faces_i)
putName(algo2d.GetSubMesh(), "faces", i)
putName(algo2d, "algo2d_faces", i)
putName(hypo2d, "hypo2d_faces", i)
- for i in range(len(edges)):
- algo1d = bloc1.Segment(geom=edges[i])
+ for i, edges_i in enumerate(edges):
+ algo1d = bloc1.Segment(geom=edges_i)
if reverses[i] > 0:
- hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges[i]) ])
+ hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges_i) ])
else:
hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ ])
putName(algo1d.GetSubMesh(), "edges", i)
putName(algo1d, "algo1d_edges", i)
putName(hypo1d, "hypo1d_edges", i)
- for i in range(len(circles)):
- algo1d = bloc1.Segment(geom=circles[i])
+ for i, circles_i in enumerate(circles):
+ algo1d = bloc1.Segment(geom=circles_i)
hypo1d = algo1d.NumberOfSegments(nbsegCercle)
putName(algo1d.GetSubMesh(), "circles", i)
putName(algo1d, "algo1d_circles", i)
putName(hypo1d, "hypo1d_edgeext")
else:
longTotal = 0
- longEdgeExts = []
- for i in range(len(edgeext)):
- props = geompy.BasicProperties(edgeext[i])
+ longEdgeExts = list()
+ for i, edgeext_i in enumerate(edgeext):
+ props = geompy.BasicProperties(edgeext_i)
longEdgeExts.append(props[0])
longTotal += props[0]
- for i in range(len(edgeext)):
+ for i, edgeext_i in enumerate(edgeext):
local = longTotal/nbsegFis
nbLocal = int(round(nbsegFis*longEdgeExts[i]/longTotal))
densite = int(round(nbLocal/2))
- algo1d = bloc1.Segment(geom=edgeext[i])
+ algo1d = bloc1.Segment(geom=edgeext_i)
hypo1d = algo1d.NumberOfSegments(nbLocal)
hypo1d.SetDistrType( 2 )
hypo1d.SetConversionMode( 1 )
hypo1d.SetTableFunction( [ 0, densite, 0.8, 1, 1, 1 ] )
if reverext[i]:
- hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext[i]) ])
+ hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext_i) ])
putName(algo1d.GetSubMesh(), "edgeext", i)
putName(algo1d, "algo1d_edgeext", i)
putName(hypo1d, "hypo1d_edgeext", i)
maxElemArea = 0.5*dmoyen*dmoyen
logging.debug("dmoyen %s, maxElemArea %s", dmoyen, maxElemArea)
- for i in range(len(facesExternes)):
- algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes[i])
+ for i, facesExternes_i in enumerate(facesExternes):
+ algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes_i)
hypo2d = algo2d.MaxElementArea(maxElemArea)
if edgesBords is None:
- algo1d = bloc1.Segment(geom=facesExternes[i])
+ algo1d = bloc1.Segment(geom=facesExternes_i)
hypo1d = algo1d.NumberOfSegments(1)
putName(algo2d.GetSubMesh(), "facesExternes", i)
putName(algo2d, "algo2d_facesExternes", i)
putName(algo1d, "algo1d_facesExternes", i)
putName(hypo1d, "hypo1d_facesExternes", i)
- for i in range(len(aretesInternes)):
- algo1d = bloc1.Segment(geom=aretesInternes[i])
+ for i, aretesInternes_i in enumerate(aretesInternes):
+ algo1d = bloc1.Segment(geom=aretesInternes_i)
hypo1d = algo1d.NumberOfSegments(nbsegExt)
putName(algo1d.GetSubMesh(), "aretesInternes", i)
putName(algo1d, "algo1d_aretesInternes", i)
putName(algo1d, "algo1d_bordsLibres")
putName(hypo1d, "hypo1d_bordsLibres")
- #isDone = bloc1.Compute()
-
if not declareAlgoEllipsoideFirst:
algo3d = bloc1.Tetrahedron(algo=smeshBuilder.NETGEN,geom=ellipsoidep)
hypo3d = algo3d.MaxElementVolume(1000.0)
putName(algo3d, "algo3d_ellipsoide")
putName(hypo3d, "hypo3d_ellipsoide")
- isDone = bloc1.Compute()
-
- nbRemoved = bloc1.RemoveOrphanNodes()
-
faceFissure1 = bloc1.GroupOnGeom(faceFissure,'FACE1',SMESH.FACE)
noeudsFondFissure = bloc1.GroupOnGeom(gencnt,'nfondfis',SMESH.NODE)
- groups_faceCommuneEllipsoideBloc = []
- for i in range(len(sharedFaces)):
+ groups_faceCommuneEllipsoideBloc = list()
+ for i, sharedFaces_i in enumerate(sharedFaces):
name = "faceCommuneEllipsoideBloc_%d"%i
- groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces[i], name, SMESH.FACE))
- groups_faceExterneBloc = []
- for i in range(len(facesExtBloc)):
+ groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces_i, name, SMESH.FACE))
+ groups_faceExterneBloc = list()
+ for i, facesExtBloc_i in enumerate(facesExtBloc):
name = "faceExterneBloc_%d"%i
- groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc[i], name, SMESH.FACE))
+ groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc_i, name, SMESH.FACE))
- skinBlocMeshes = []
- for i in range(len(groups_faceCommuneEllipsoideBloc)):
+ is_done = bloc1.Compute()
+ text = "bloc1.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ nbRemoved = bloc1.RemoveOrphanNodes()
+
+ skinBlocMeshes = list()
+ for i, groups_faceCommuneEllipsoideBloc_i in enumerate(groups_faceCommuneEllipsoideBloc):
name = "faceCommuneEllipsoideBloc_%d"%i
- skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc[i], name, 0, 0))
- for i in range(len(groups_faceExterneBloc)):
+ skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc_i, name, 0, 0))
+ for i, groups_faceExterneBloc_i in enumerate(groups_faceExterneBloc):
name = "faceExterneBloc_%d"%i
- skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc[i], name, 0, 0))
+ skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc_i, name, 0, 0))
meshesBloc = [internalBoundary.GetMesh()]
- for i in range(len(skinBlocMeshes)):
- meshesBloc.append(skinBlocMeshes[i].GetMesh())
+ for i, skinBlocMeshes_i in enumerate(skinBlocMeshes):
+ meshesBloc.append(skinBlocMeshes_i.GetMesh())
blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False)
algo3d = blocMesh.Tetrahedron(algo=smeshBuilder.NETGEN)
putName(hypo3d, "hypo3d_bloc")
is_done = blocMesh.Compute()
+ text = "blocMesh.Compute"
+ if is_done:
+ logging.info(text+" OK")
+ else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
blocComplet = smesh.Concatenate([bloc1.GetMesh(), blocMesh.GetMesh()], 1, 1, 1e-05,False)
- return bloc1, blocComplet
\ No newline at end of file
+ return bloc1, blocComplet
logging.info("start")
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
- idverts = {}
+ idverts = dict()
for i, edge in enumerate(edges):
verts = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
# idverts[(i,0)] = verts[0]
idverts[(i,0)] = verts[1]
idverts[(i,1)] = verts[0]
- idsubs = {}
+ idsubs = dict()
for kv, sub in idverts.items():
subid = geompy.GetSubShapeID(aWire, sub)
if subid in list(idsubs.keys()):
debut = kv[0]
else:
fin = kv[0]
- logging.debug("nombre d'edges: %s, indice edge début: %s, fin: %s",len(edges), debut, fin)
+ logging.debug("nombre d'edges: {}, indice edge début: {}, fin: {}".format(len(edges), debut, fin))
if debut < 0:
logging.critical("les edges du wire ne sont pas orientées dans le même sens: pas de début trouvé")
return edges, list(range(len(edges)))
logging.critical("les edges du wire ne sont pas orientées dans le même sens: une edge à l'envers")
return edges, list(range(len(edges)))
- logging.debug("liste des edges ordonnées selon le sens de parcours: %s", orderedList)
+ logging.debug("liste des edges ordonnées selon le sens de parcours : {}".format(orderedList))
accessList = list(range(len(orderedList)))
for i,k in enumerate(orderedList):
accessList[k] = i
- logging.info("position ordonnée des edges selon le sens de parcours: %s", accessList)
+ logging.info("position ordonnée des edges selon le sens de parcours : {}".format(accessList))
return edges, accessList
# --- peau interne du defaut dans le maillage sain
def peauInterne(fichierMaillage, shapeDefaut, nomZones):
- """
- Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage)
+ """Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage)
+
On récupère le volume et la peau de la zone de défaut, les éventuelles faces et arêtes internes de cette zone.
+ Remarque : intérêt du passage par fichierMaillage plutôt que par maillageSain ?
"""
logging.info("start")
([maillageSain], status) = smesh.CreateMeshesFromMED(fichierMaillage)
groups = maillageSain.GetGroups()
+ #print ("groupes :")
+ #for grp in groups:
+ #print ("\t{}".format(grp.GetName()))
zoneDefaut = None
for grp in groups:
logging.debug("groupe %s",grp.GetName())
if grp.GetName() == nomZones + "_vol":
zoneDefaut = grp
break
+ #print ("zoneDefaut = {}".format(zoneDefaut))
zoneDefaut_skin = None
for grp in groups:
if grp.GetName() == nomZones + "_skin":
zoneDefaut_skin = grp
break
+ #print ("zoneDefaut_skin = {}".format(zoneDefaut_skin))
zoneDefaut_internalFaces = None
for grp in groups:
if grp.GetName() == nomZones + "_internalFaces":
zoneDefaut_internalFaces = grp
break
+ #print ("zoneDefaut_internalFaces = {}".format(zoneDefaut_internalFaces))
zoneDefaut_internalEdges = None
for grp in groups:
if grp.GetName() == nomZones + "_internalEdges":
zoneDefaut_internalEdges = grp
break
-
+ #print ("zoneDefaut_internalEdges = {}".format(zoneDefaut_internalEdges))
+
# --- Le groupe ZoneDefaut ne doit contenir que des Hexaèdres"
-
- info=maillageSain.GetMeshInfo(zoneDefaut)
- keys = list(info.keys()); keys.sort()
- nbelem=0
- nbhexa=0
- for i in keys:
- #print " %s : %d" % ( i, info[i] )
- nbelem+=info[i]
- if "Entity_Hexa" in str(i):
- nbhexa+=info[i]
- if (nbelem == 0) or (nbhexa < nbelem) :
+
+ info = maillageSain.GetMeshInfo(zoneDefaut)
+ #print ("info = {}".format(info))
+ nbelem = 0
+ nbhexa = 0
+ for entity_type in info:
+ #print (". {} : {})".format(entity_type, info[entity_type]))
+ nbelem += info[entity_type]
+ if ("Entity_Hexa" == str(entity_type)):
+ nbhexa += info[entity_type]
+ nbhexa += info[entity_type]
+ #print ("==> nbelem = {}, nbhexa = {}".format(nbelem,nbhexa))
+
+ if ( (nbelem == 0) or (nbhexa < nbelem) ):
+ print ("==> nbelem = {}, nbhexa = {}".format(nbelem,nbhexa))
texte = "La zone a remailler est incorrecte.<br>"
texte += "Causes possibles :<ul>"
texte += "<li>Les mailles à enlever dans le maillage sain n'ont pas été détectées.</li>"
texte += "<li>Certaines faces du maillage sain sont à l'envers : les normales aux faces en paroi de volume doivent être sortantes.</li>"
- texte += "<li>Il n'y a pas que des Hexaèdres réglés linéaires dans la zone à remailler (notamment mailles quadratiques, tetraèdres non traités)</li></ul>"
+ texte += "<li>Il n'y a pas que des hexaèdres réglés linéaires dans la zone à remailler (notamment mailles quadratiques, tetraèdres non traités)</li></ul>"
raise fissError(traceback.extract_stack(),texte)
nbAdded, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ])
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
-
+
maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
listOfCorner = lookForCorner(maillageDefautCible)
- logging.debug("listOfCorner = %s", listOfCorner)
- if len(listOfCorner) > 0:
+ logging.debug("listOfCorner = {}".format(listOfCorner))
+ if listOfCorner:
logging.info("présence de coins à la surface externe de la zone à reconstruire")
zoneDefaut_skin, internalBoundary = fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner)
# -----------------------------------------------------------------------------
# --- groupe de quadrangles de face transformé en face géométrique par filling
-def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, centreFondFiss, listOfCorners):
- """ """
- # TODO: rédiger la docstring
-
- logging.info("start")
-
- #fillings = [[], []]
- tmpFillings = []
- noeuds_bords = []
- #bords_Partages = [[], []]
- tmpBords = []
- fillconts = []
- idFilToCont = []
-
- facesNonCoupees = []
- facesCoupees = []
- aretesNonCoupees = []
- aretesCoupees = []
-
- setOfNodes = []
- setOfLines = []
- listOfEdges = []
- # On crée une liste contenant le maillage de chaque face.
- listOfNewMeshes = createNewMeshesFromCorner(meshQuad, listOfCorners)
- for msh in listOfNewMeshes:
- # On crée une liste de noeuds correspondant aux faces suivant
- # le modèle liste[face][ligne][noeud].
- lines = createLinesFromMesh(msh, listOfCorners[0])
- setOfNodes.append(lines)
-
- for face in setOfNodes:
- tmpFace = []
- for line in face:
- # On possède l'information 'ID' de chaque noeud composant chaque
- # ligne de chaque face. A partir de l'ID, on crée un vertex. Un
- # ensemble de vertices constitue une ligne. Un ensemble de lignes
- # constitue une face.
- tmpCoords = [meshQuad.GetNodeXYZ(node) for node in line]
- tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
- line = geompy.MakeInterpol(tmpPoints, False, False)
- tmpFace.append(line)
- setOfLines.append(tmpFace)
-
- for i, face in enumerate(setOfLines):
- # A partir des lignes de chaque face,
- # on recrée un objet GEOM temporaire par filling.
- filling = geompy.MakeFilling(geompy.MakeCompound(face), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
- geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
- tmpFillings.append(filling)
-
- for face in setOfNodes:
- # On prend la première ligne qui correspond aux bords partagés
- listOfEdges.append(face[0])
-
- for edge in listOfEdges:
- # On utilise les points de bords pour créer des aretes vives
- tmpCoords = [meshQuad.GetNodeXYZ(node) for node in list(edge)]
- tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
- line = geompy.MakeInterpol(tmpPoints, False, False)
- tmpBords.append(line)
-
- for i, filling in enumerate(tmpFillings):
- tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
- tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
- tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
- if len(tmpExplodeRef) == len(tmpExplodeNum):
- geomPublish(initLog.debug, filling, "faceNonCoupee_{0}".format(i + 1))
- facesNonCoupees.append(filling)
- else:
- geomPublish(initLog.debug, filling, "faceCoupee_{0}".format(i + 1))
- facesCoupees.append(filling)
- fillings = facesCoupees, facesNonCoupees
-
- for i, filling in enumerate(tmpBords):
- tmpPartition = geompy.MakePartition([shapeDefaut], [filling], [], [], geompy.ShapeType["SHELL"], 0, [], 0, True)
- tmpExplodeRef = geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["VERTEX"], True)
- tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(tmpPartition, geompy.ShapeType["VERTEX"], True)
- if len(tmpExplodeRef) == len(tmpExplodeNum):
- geomPublish(initLog.debug, filling, "areteNonCoupee_{0}".format(i + 1))
- aretesNonCoupees.append(filling)
- else:
- geomPublish(initLog.debug, filling, "areteCoupee_{0}".format(i + 1))
- aretesCoupees.append(filling)
- bords_Partages = aretesCoupees, aretesNonCoupees
-
+def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, listOfCorners):
+ """ """
+ # TODO: rédiger la docstring
+
+ logging.info("start")
+
+ #fillings = [list(), list()]
+ tmpFillings = list()
+ noeuds_bords = list()
+ #bords_Partages = [list(), list()]
+ tmpBords = list()
+ fillconts = list()
+ idFilToCont = list()
+
+ facesNonCoupees = list()
+ facesCoupees = list()
+ aretesNonCoupees = list()
+ aretesCoupees = list()
+
+ setOfNodes = list()
+ setOfLines = list()
+ listOfEdges = list()
+ # On crée une liste contenant le maillage de chaque face.
+ listOfNewMeshes = createNewMeshesFromCorner(meshQuad, listOfCorners)
+ for msh in listOfNewMeshes:
+ # On crée une liste de noeuds correspondant aux faces suivant
+ # le modèle liste[face][ligne][noeud].
+ #lines = createLinesFromMesh(msh, listOfCorners[0])
+ lines = createLinesFromMesh(msh)
+ setOfNodes.append(lines)
+
+ for face in setOfNodes:
+ tmpFace = list()
+ for line in face:
+ # On possède l'information 'ID' de chaque noeud composant chaque
+ # ligne de chaque face. A partir de l'ID, on crée un vertex. Un
+ # ensemble de vertices constitue une ligne. Un ensemble de lignes
+ # constitue une face.
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in line]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpFace.append(line)
+ setOfLines.append(tmpFace)
+
+ for i, face in enumerate(setOfLines):
+ # A partir des lignes de chaque face,
+ # on recrée un objet GEOM temporaire par filling.
+ filling = geompy.MakeFilling(geompy.MakeCompound(face), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ geomPublish(initLog.debug, filling, 'filling_{}'.format(i + 1))
+ tmpFillings.append(filling)
+
+ for face in setOfNodes:
+ # On prend la première ligne qui correspond aux bords partagés
+ listOfEdges.append(face[0])
+
+ for edge in listOfEdges:
+ # On utilise les points de bords pour créer des aretes vives
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in list(edge)]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpBords.append(line)
+
+ for i, filling in enumerate(tmpFillings):
+ tmpPartition = geompy.MakePartition([filling], [shapeDefaut], list(), list(), geompy.ShapeType["FACE"], 0, list(), 0, True)
+ tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ geomPublish(initLog.debug, filling, "faceNonCoupee_{}".format(i + 1))
+ facesNonCoupees.append(filling)
+ else:
+ geomPublish(initLog.debug, filling, "faceCoupee_{}".format(i + 1))
+ facesCoupees.append(filling)
+ fillings = facesCoupees, facesNonCoupees
+
+ for i, filling in enumerate(tmpBords):
+ tmpPartition = geompy.MakePartition([shapeDefaut], [filling], list(), list(), geompy.ShapeType["SHELL"], 0, list(), 0, True)
+ tmpExplodeRef = geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["VERTEX"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(tmpPartition, geompy.ShapeType["VERTEX"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ geomPublish(initLog.debug, filling, "areteNonCoupee_{}".format(i + 1))
+ aretesNonCoupees.append(filling)
+ else:
+ geomPublish(initLog.debug, filling, "areteCoupee_{}".format(i + 1))
+ aretesCoupees.append(filling)
+ bords_Partages = aretesCoupees, aretesNonCoupees
+
# TODO: A enlever
# for i, face in enumerate(setOfLines):
-# for j, line in enumerate(face):
-# geomPublish(initLog.debug, line, 'face{0}_ligne{1}'.format(i + 1, j + 1))
+# for j, line in enumerate(face):
+# geomPublish(initLog.debug, line, 'face{0}_ligne{1}'.format(i + 1, j + 1))
- #TODO: A enlever
+#TODO: A enlever
# for i, filling in enumerate(fillings[0]):
-# geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
-# for j, line in enumerate(setOfLines[i]):
-# geompy.addToStudyInFather(filling, line, 'line_{0}'.format(j + 1))
-
- return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
-
\ No newline at end of file
+# geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
+# for j, line in enumerate(setOfLines[i]):
+# geompy.addToStudyInFather(filling, line, 'line_{0}'.format(j + 1))
+
+ return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Maillage sain sans la zone de defaut"""
+
import logging
+
+from .geomsmesh import geompy
from .geomsmesh import smesh
import SMESH
-from .geomsmesh import geompy
-
-# -----------------------------------------------------------------------------
-# --- maillage complet et fissure
def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGeomFissure, nomVolume, normal = None):
- """
- Maillage sain sans la zone de defaut
+ """Maillage sain sans la zone de defaut
+
TODO: a completer
"""
logging.info('Concatenation')
maillageComplet = smesh.Concatenate([maillageSain.GetMesh(), blocComplet.GetMesh()], 1, 1, 1e-05,False)
groups = maillageComplet.GetGroups()
- grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
- faceFissure = grps[0]
- grps = [ grp for grp in groups if grp.GetName() == 'nfondfis']
- noeudsFondFissure = grps[0]
- grps = [ grp for grp in groups if grp.GetName() == 'fisInPi']
- fisInPi = grps[0]
- grps = [ grp for grp in groups if grp.GetName() == 'fisOutPi']
- fisOutPi = grps[0]
+ for grp in groups:
+ grp_nom = grp.GetName()
+ if ( grp_nom == "FACE1" ):
+ faceFissure = grp
+ elif ( grp_nom == "nfondfis" ):
+ noeudsFondFissure = grp
+ elif ( grp_nom == "fisInPi" ):
+ fisInPi = grp
+ elif ( grp_nom == "fisOutPi" ):
+ fisOutPi = grp
# --- TODO: fiabiliser l'orientation dans le cas general
if normal is None:
normal = smesh.MakeDirStruct( 0, 0, 1 )
+ logging.debug('après normal = {}'.format(normal))
maillageComplet.Reorient2D( fisInPi, normal, [0,0,0])
+ logging.debug('après Reorient2D In')
maillageComplet.Reorient2D( fisOutPi, normal, [0,0,0])
-
- shapes = []
+
+ shapes = list()
if extrusionFaceFissure is not None:
subIds = geompy.SubShapeAllIDs(extrusionFaceFissure, geompy.ShapeType["SOLID"])
if len(subIds) > 1:
# shapes = geompy.ExtractShapes(faceGeomFissure, geompy.ShapeType["FACE"], False)
# else:
# shapes = [faceGeomFissure]
-
- grpEdges = []
- grpFaces = []
- grpVolumes = []
+
+ grpEdges = list()
+ grpFaces = list()
+ grpVolumes = list()
if len(shapes) == 0:
shapes = [None] # calcul uniquement avec les normales des faces mailles de la fissure
for i, aShape in enumerate(shapes):
- logging.info('Detection elements affectes par le dedoublement de la face %d'%i)
+ texte = "Detection elements affectes par le dedoublement de la face n° {}".format(i)
+ logging.debug(texte)
affectedGroups = maillageComplet.AffectedElemGroupsInRegion([faceFissure], [noeudsFondFissure], aShape)
- grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedEdges']
- affectedEdges = grps[0]
+ for grp in affectedGroups:
+ grp_nom = grp.GetName()
+ if ( grp_nom == "affectedEdges" ):
+ affectedEdges = grp
+ elif ( grp_nom == "affectedFaces" ):
+ affectedFaces = grp
+ elif ( grp_nom == "affectedVolumes" ):
+ affectedVolumes = grp
+ #grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedEdges']
+ #affectedEdges = grps[0]
affectedEdges.SetName('affEd%d'%i)
grpEdges.append(affectedEdges)
- grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedFaces']
- affectedFaces = grps[0]
+ #grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedFaces']
+ #affectedFaces = grps[0]
affectedFaces.SetName('affFa%d'%i)
grpFaces.append(affectedFaces)
- grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedVolumes']
- affectedVolumes = grps[0]
+ #grps = [ grp for grp in affectedGroups if grp.GetName() == 'affectedVolumes']
+ #affectedVolumes = grps[0]
affectedVolumes.SetName('affVo%d'%i)
grpVolumes.append(affectedVolumes)
- logging.info("union des groupes d'edges")
affectedEdges = maillageComplet.UnionListOfGroups(grpEdges, 'affEdges')
- logging.info("union des groupes de faces")
affectedFaces = maillageComplet.UnionListOfGroups(grpFaces, 'affFaces')
- logging.info("union des groupes de volumes")
affectedVolumes = maillageComplet.UnionListOfGroups(grpVolumes, 'affVols')
for grp in affectedGroups:
- logging.debug("nom groupe %s",grp.GetName())
- [ FACE2, FACE2_nodes ] = maillageComplet.DoubleNodeElemGroups([faceFissure], [noeudsFondFissure], affectedGroups, True, True)
+ texte = "Traitement du groupe '{}'".format(grp.GetName())
+ logging.debug(texte)
+ [ FACE2, _ ] = maillageComplet.DoubleNodeElemGroups([faceFissure], [noeudsFondFissure], affectedGroups, True, True)
FACE2.SetName( 'FACE2' )
+ # Groupe de toutes les mailles volumiques
GroupVol = maillageComplet.CreateEmptyGroup( SMESH.VOLUME, nomVolume )
- nbAdd = GroupVol.AddFrom( maillageComplet.GetMesh() )
+ _ = GroupVol.AddFrom( maillageComplet.GetMesh() )
return maillageComplet
-
from .fissError import fissError
def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
- """
- restriction de la face de fissure au domaine solide
+ """restriction de la face de fissure au domaine solide
+
partition face fissure étendue par fillings
"""
logging.info('start')
if pointInterne is not None:
distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)]
distfaces.sort()
- logging.debug("selection de la face la plus proche du point interne, distance=%s",distfaces[0][0])
+ logging.debug("selection de la face la plus proche du point interne, distance={}".format(distfaces[0][0]))
facesPortFissure = distfaces[0][2]
else:
try:
texte += "<li>le prémaillage de la face de fissure est trop grossier, les mailles à enlever dans le maillage sain "
texte += "n'ont pas toutes été détectées.</li></ul>"
raise fissError(traceback.extract_stack(),texte)
- logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
+ logging.debug("surfaces faces fissure étendue, min {}, max {}".format(minSurf, maxSurf))
facesPortFissure = facesPartShapeDefautSorted[-1]
-
+
geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
return facesPortFissure
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""tri par longueur d'edges"""
+
import logging
from .geomsmesh import geompy
-# -----------------------------------------------------------------------------
-# --- tri par longueur d'edges
-
def sortEdges(edgesToSort):
- """
- tri des edges par longueur
- """
+ """tri des edges par longueur"""
logging.info('start')
- lenEdges = [(geompy.BasicProperties(edge)[0], i, edge) for i, edge in enumerate(edgesToSort)]
- lenEdges.sort()
- edgesSorted = [edge for length, i, edge in lenEdges]
- return edgesSorted, lenEdges[0][0], lenEdges[-1][0]
+ l_length = [(geompy.BasicProperties(edge)[0], i, edge) for i, edge in enumerate(edgesToSort)]
+ l_length.sort()
+ edgesSorted = [edge for length, i, edge in l_length]
+ return edgesSorted, l_length[0][0], l_length[-1][0]
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""tri par surface de faces"""
+
import logging
from .geomsmesh import geompy
-# -----------------------------------------------------------------------------
-# --- tri par surface de faces
-
def sortFaces(facesToSort):
- """
- tri des faces par surface
- """
+ """tri des faces par surface"""
logging.info('start')
- surFaces = [(geompy.BasicProperties(face)[1], i, face) for i, face in enumerate(facesToSort)]
- surFaces.sort()
- facesSorted = [face for surf, i, face in surFaces]
- return facesSorted, surFaces[0][0], surFaces[-1][0]
+ l_surfaces = [(geompy.BasicProperties(face)[1], i, face) for i, face in enumerate(facesToSort)]
+ l_surfaces.sort()
+ facesSorted = [face for surf, i, face in l_surfaces]
+ return facesSorted, l_surfaces[0][0], l_surfaces[-1][0]
#
from blocFissure import gmu
-from blocFissure.gmu.initEtude import initEtude
+from .initEtude import initEtude
initEtude()
-from blocFissure.gmu.triedreBase import triedreBase
+from .triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
-from blocFissure.gmu.distance2 import distance2
+from .distance2 import distance2
a=[10, 20, 30]
b=[5, 7, 3]
c=distance2(a,b)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import os
+
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_ihm(fissureCoude):
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
- """
- Paramètres géométriques du tuyau coudé sain:
+ """Paramètres géométriques du tuyau coudé sain:
+
angleCoude
r_cintr
l_tube_p1
epais
de
"""
- self.geomParams = dict(angleCoude = self.dico['angle'],
- r_cintr = self.dico['rCintr'],
- l_tube_p1 = self.dico['lTubeP1'],
- l_tube_p2 = self.dico['lTubeP2'],
- epais = self.dico['epais'],
+ self.geomParams = dict(angleCoude = self.dico['angle'], \
+ r_cintr = self.dico['rCintr'], \
+ l_tube_p1 = self.dico['lTubeP1'], \
+ l_tube_p2 = self.dico['lTubeP2'], \
+ epais = self.dico['epais'], \
de = self.dico['dext'])
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
- self.meshParams = dict(n_long_p1 = self.dico['nbAxeTubeP1'],
- n_ep = self.dico['nbEpaisseur'],
- n_long_coude = self.dico['nbAxeCoude'],
- n_circ_g = self.dico['nbCirconf'],
- n_circ_d = self.dico['nbCirconf'],
+ self.meshParams = dict(n_long_p1 = self.dico['nbAxeTubeP1'], \
+ n_ep = self.dico['nbEpaisseur'], \
+ n_long_coude = self.dico['nbAxeCoude'], \
+ n_circ_g = self.dico['nbCirconf'], \
+ n_circ_d = self.dico['nbCirconf'], \
n_long_p2 = self.dico['nbAxeTubeP2'])
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
- """
- paramètres de la fissure pour le tuyau coude
+ """paramètres de la fissure pour le tuyau coude
+
profondeur : 0 < profondeur <= épaisseur
rayonPipe : rayon du pipe correspondant au maillage rayonnant
lenSegPipe : longueur des mailles rayonnantes le long du fond de fissure (= rayonPipe par défaut)
externe : True : fissure face externe, False : fissure face interne
"""
print("setParamShapeFissure", self.nomCas)
- self.shapeFissureParams = dict(profondeur = self.dico['profondeur'],
- rayonPipe = self.dico['rayonTore'],
- lenSegPipe = self.dico['lenSegPipe'],
- azimut = self.dico['azimut'],
- alpha = self.dico['posiAngul'],
- longueur = self.dico['longueur'],
- orientation = self.dico['orientation'],
- lgInfluence = self.dico['influence'],
- elliptique = self.dico['cbForceEllipse'],
+ self.shapeFissureParams = dict(profondeur = self.dico['profondeur'], \
+ rayonPipe = self.dico['rayonTore'], \
+ lenSegPipe = self.dico['lenSegPipe'], \
+ azimut = self.dico['azimut'], \
+ alpha = self.dico['posiAngul'], \
+ longueur = self.dico['longueur'], \
+ orientation = self.dico['orientation'], \
+ lgInfluence = self.dico['influence'], \
+ elliptique = self.dico['cbForceEllipse'], \
externe = self.dico['rbFissExt'])
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
- """
- Paramètres du maillage de la fissure pour le tuyau coudé
+ """Paramètres du maillage de la fissure pour le tuyau coudé
+
Voir également setParamShapeFissure, paramètres rayonPipe et lenSegPipe.
nbSegRad = nombre de couronnes
nbSegCercle = nombre de secteurs
areteFaceFissure = taille cible de l'arête des triangles en face de fissure.
"""
- self.maillageFissureParams = dict(nomRep = '.',
- nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
- nbsegRad = self.dico['nbCouronnes'],
- nbsegCercle = self.dico['nbSecteurs'],
+ self.maillageFissureParams = dict(nomRep = os.curdir, \
+ nomFicSain = self.nomCas, \
+ nomFicFissure = 'fissure_' + self.nomCas, \
+ nbsegRad = self.dico['nbCouronnes'], \
+ nbsegCercle = self.dico['nbSecteurs'], \
areteFaceFissure = self.dico['aretesFaceFissure'])
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
- self.referencesMaillageFissure = dict(Entity_Node = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Quadrangle = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Hexa = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Pyramid = 0)
+ self.referencesMaillageFissure = dict( \
+ Entity_Quad_Quadrangle = 0, \
+ Entity_Quad_Hexa = 0, \
+ Entity_Node = 0, \
+ Entity_Quad_Edge = 0, \
+ Entity_Quad_Triangle = 0, \
+ Entity_Quad_Tetra = 0, \
+ Entity_Quad_Pyramid = 0, \
+ Entity_Quad_Penta = 0 \
+ )
# if you already have plugins defined in a salome_plugins.py file, add this file at the end.
# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
+import os
import math
import sys
import traceback
# get context study, salomeGui
study = context.study
sg = context.sg
-
- import os
+
#import subprocess
#import tempfile
from qtsalome import QFileDialog, QMessageBox, QPalette, QColor, QDialog
from blocFissure.ihm.fissureCoude_ui import Ui_Dialog
-
+
class fissureCoudeDialog(QDialog):
-
+
def __init__(self):
QDialog.__init__(self)
# Set up the user interface from Designer.
self.ui = Ui_Dialog()
self.ui.setupUi(self)
-
+
self.blackPalette = self.ui.dsb_angle.palette()
self.redPalette = QPalette()
self.redPalette.setColor(QPalette.Text, QColor(255,0,0))
self.NOK = False
-
+
self.initDefaut()
self.initDialog(self.defaut)
self.ui.dsb_angle.setSpecialValueText("saisie_obligatoire")
self.ui.dsb_aretesFaceFissure.setSpecialValueText("automatique")
self.ui.dsb_influence.setSpecialValueText("automatique")
self.ui.lb_calcul.hide()
-
+
# Connect up the buttons.
self.ui.pb_valPrec.clicked.connect(self.readValPrec)
self.ui.pb_reset.clicked.connect(self.resetVal)
self.ui.pb_sauver.clicked.connect(self.sauver)
self.ui.buttonBox.accepted.disconnect(self.accept)
self.ui.buttonBox.accepted.connect(self.execute)
-
+
def initDefaut(self):
- self.defaut = dict(
- angle = -181.0,
- rCintr = 0.0,
- lTubeP1 = 0.0,
- lTubeP2 = 0.0,
- epais = 0.0,
- dext = 0.0,
- profondeur = 0.0,
- longueur = 0.0,
- azimut = -181.0,
- orientation = -1.0,
- posiAngul = -181.0,
- absCurv = 0.0,
- nbTranches = 7,
- nbCouronnes = 1,
- nbSecteurs = 3,
- cbOptDiscrSain = False,
- cbOptDiscrFiss = False,
- rbPosiAngul = True,
- rbFissExt = True,
- cbForceEllipse = False,
- nbAxeTubeP1 = 15,
- nbAxeTubeP2 = 15,
- nbAxeCoude = 10,
- nbCirconf = 20,
- nbEpaisseur = 3,
- rayonTore = 2.0,
- aretesFaceFissure = 0.0,
- influence = 0.0,
+ self.defaut = dict( \
+ angle = -181.0, \
+ rCintr = 0.0, \
+ lTubeP1 = 0.0, \
+ lTubeP2 = 0.0, \
+ epais = 0.0, \
+ dext = 0.0, \
+ profondeur = 0.0, \
+ longueur = 0.0, \
+ azimut = -181.0, \
+ orientation = -1.0, \
+ posiAngul = -181.0, \
+ absCurv = 0.0, \
+ nbTranches = 7, \
+ nbCouronnes = 1, \
+ nbSecteurs = 3, \
+ cbOptDiscrSain = False, \
+ cbOptDiscrFiss = False, \
+ rbPosiAngul = True, \
+ rbFissExt = True, \
+ cbForceEllipse = False, \
+ nbAxeTubeP1 = 15, \
+ nbAxeTubeP2 = 15, \
+ nbAxeCoude = 10, \
+ nbCirconf = 20, \
+ nbEpaisseur = 3, \
+ rayonTore = 2.0, \
+ aretesFaceFissure = 0.0, \
+ influence = 0.0, \
)
-
+
def initDialog(self, dico):
self.ui.dsb_angle.setValue(dico['angle'])
self.ui.dsb_rCintr.setValue(dico['rCintr'])
self.ui.cb_forceEllipse.setChecked(dico['cbForceEllipse'])
incomplet = self.testval(dico)
pass
-
+
def testval(self, dico):
incomplet = False
if dico['angle'] < -180.0:
incomplet = True
else:
self.ui.dsb_angle.setPalette(self.blackPalette)
-
+
if dico['rCintr'] == 0.0:
self.ui.dsb_rCintr.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_rCintr.setPalette(self.blackPalette)
-
- if dico['lTubeP1'] == 0.0:
+
+ if dico['lTubeP1'] == 0.0:
self.ui.dsb_lTubeP1.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_lTubeP1.setPalette(self.blackPalette)
-
- if dico['lTubeP2'] == 0.0:
+
+ if dico['lTubeP2'] == 0.0:
self.ui.dsb_lTubeP2.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_lTubeP2.setPalette(self.blackPalette)
-
- if dico['epais'] == 0.0:
+
+ if dico['epais'] == 0.0:
self.ui.dsb_epais.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_epais.setPalette(self.blackPalette)
-
- if dico['dext'] == 0.0:
+
+ if dico['dext'] == 0.0:
self.ui.dsb_dext.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_dext.setPalette(self.blackPalette)
-
- if dico['profondeur'] == 0.0:
+
+ if dico['profondeur'] == 0.0:
self.ui.dsb_profondeur.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_profondeur.setPalette(self.blackPalette)
-
- if dico['longueur'] == 0.0:
+
+ if dico['longueur'] == 0.0:
self.ui.dsb_longueur.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_longueur.setPalette(self.blackPalette)
-
- if dico['azimut'] < -180.0:
+
+ if dico['azimut'] < -180.0:
self.ui.dsb_azimut.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_azimut.setPalette(self.blackPalette)
-
- if dico['orientation'] < 0.0:
+
+ if dico['orientation'] < 0.0:
self.ui.dsb_orientation.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_orientation.setPalette(self.blackPalette)
-
- if dico['posiAngul'] < -180.0 and dico['rbPosiAngul'] == True:
+
+ if ( ( dico['posiAngul'] < -180.0 ) and dico['rbPosiAngul'] ):
self.ui.dsb_posiAngul.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_posiAngul.setPalette(self.blackPalette)
-
- if dico['absCurv'] == 0.0 and dico['rbPosiAngul'] == False:
+
+ if ( ( dico['absCurv'] == 0.0 ) and ( not dico['rbPosiAngul'] ) ):
self.ui.dsb_absCurv.setPalette(self.redPalette)
incomplet = True
else:
self.ui.dsb_absCurv.setPalette(self.blackPalette)
-
- if dico['nbTranches'] == 7:
+
+ if dico['nbTranches'] == 7:
self.ui.sb_nbTranches.setPalette(self.redPalette)
incomplet = True
else:
self.ui.sb_nbTranches.setPalette(self.blackPalette)
-
- if dico['nbCouronnes'] == 1:
+
+ if dico['nbCouronnes'] == 1:
self.ui.sb_nbCouronne.setPalette(self.redPalette)
incomplet = True
else:
self.ui.sb_nbCouronne.setPalette(self.blackPalette)
-
- if dico['nbSecteurs'] == 3:
+
+ if dico['nbSecteurs'] == 3:
self.ui.sb_nbSecteur.setPalette(self.redPalette)
incomplet = True
else:
self.ui.sb_nbSecteur.setPalette(self.blackPalette)
-
+
print("incomplet: ", incomplet)
return incomplet
-
+
def fileDefault(self):
- filedef = os.path.expanduser("~/.config/salome/dialogFissureCoude.dic")
+ filedef = os.path.expanduser( os.path.join(os.environ["HOME"],".config", "salome", "dialogFissureCoude.dic") )
print(filedef)
return filedef
-
+
def writeDefault(self, dico):
filedef = self.fileDefault()
with open(filedef, 'w') as f:
- f.write(str(dico))
-
+ f.write(str(dico))
+
def readValPrec(self):
filedef = self.fileDefault()
if os.path.exists(filedef):
with open(filedef, 'r') as f:
- txt = f.read()
+ txt = f.read()
dico = eval(txt)
print(dico)
self.initDialog(dico)
def resetVal(self):
#self.initDefaut()
self.initDialog(self.defaut)
-
+
def sauver(self):
print("sauver")
fileDiag = QFileDialog(self)
filedef = fileNames[0]
dico = self.creeDico()
with open(filedef, 'w') as f:
- f.write(str(dico))
-
+ f.write(str(dico))
+
def recharger(self):
print("recharger")
fileDiag = QFileDialog(self)
print(filedef)
if os.path.exists(filedef):
with open(filedef, 'r') as f:
- txt = f.read()
+ txt = f.read()
dico = eval(txt)
print(dico)
self.initDialog(dico)
-
+
def creeDico(self):
- dico = dict(
- angle = self.ui.dsb_angle.value(),
- rCintr = self.ui.dsb_rCintr.value(),
- lTubeP1 = self.ui.dsb_lTubeP1.value(),
- lTubeP2 = self.ui.dsb_lTubeP2.value(),
- epais = self.ui.dsb_epais.value(),
- dext = self.ui.dsb_dext.value(),
- profondeur = self.ui.dsb_profondeur.value(),
- longueur = self.ui.dsb_longueur.value(),
- azimut = self.ui.dsb_azimut.value(),
- orientation = self.ui.dsb_orientation.value(),
- posiAngul = self.ui.dsb_posiAngul.value(),
- absCurv = self.ui.dsb_absCurv.value(),
- nbTranches = self.ui.sb_nbTranches.value(),
- nbCouronnes = self.ui.sb_nbCouronne.value(),
- nbSecteurs = self.ui.sb_nbSecteur.value(),
- cbOptDiscrSain = self.ui.cb_optDiscrSain.isChecked(),
- cbOptDiscrFiss = self.ui.cb_optDiscrFiss.isChecked(),
- rbPosiAngul = self.ui.rb_posiAngul.isChecked(),
- rbFissExt = self.ui.rb_fissExt.isChecked(),
- cbForceEllipse = self.ui.cb_forceEllipse.isChecked(),
- nbAxeTubeP1 = self.ui.sb_nbAxeTubeP1.value(),
- nbAxeTubeP2 = self.ui.sb_nbAxeTubeP2.value(),
- nbAxeCoude = self.ui.sb_nbAxeCoude.value(),
- nbCirconf = self.ui.sb_nbCirconf.value(),
- nbEpaisseur = self.ui.sb_nbEpaisseur.value(),
- rayonTore = self.ui.dsb_rayonTore.value(),
- aretesFaceFissure = self.ui.dsb_aretesFaceFissure.value(),
- influence = self.ui.dsb_influence.value(),
+ dico = dict( \
+ angle = self.ui.dsb_angle.value(), \
+ rCintr = self.ui.dsb_rCintr.value(), \
+ lTubeP1 = self.ui.dsb_lTubeP1.value(), \
+ lTubeP2 = self.ui.dsb_lTubeP2.value(), \
+ epais = self.ui.dsb_epais.value(), \
+ dext = self.ui.dsb_dext.value(), \
+ profondeur = self.ui.dsb_profondeur.value(), \
+ longueur = self.ui.dsb_longueur.value(), \
+ azimut = self.ui.dsb_azimut.value(), \
+ orientation = self.ui.dsb_orientation.value(), \
+ posiAngul = self.ui.dsb_posiAngul.value(), \
+ absCurv = self.ui.dsb_absCurv.value(), \
+ nbTranches = self.ui.sb_nbTranches.value(), \
+ nbCouronnes = self.ui.sb_nbCouronne.value(), \
+ nbSecteurs = self.ui.sb_nbSecteur.value(), \
+ cbOptDiscrSain = self.ui.cb_optDiscrSain.isChecked(), \
+ cbOptDiscrFiss = self.ui.cb_optDiscrFiss.isChecked(), \
+ rbPosiAngul = self.ui.rb_posiAngul.isChecked(), \
+ rbFissExt = self.ui.rb_fissExt.isChecked(), \
+ cbForceEllipse = self.ui.cb_forceEllipse.isChecked(), \
+ nbAxeTubeP1 = self.ui.sb_nbAxeTubeP1.value(), \
+ nbAxeTubeP2 = self.ui.sb_nbAxeTubeP2.value(), \
+ nbAxeCoude = self.ui.sb_nbAxeCoude.value(), \
+ nbCirconf = self.ui.sb_nbCirconf.value(), \
+ nbEpaisseur = self.ui.sb_nbEpaisseur.value(), \
+ rayonTore = self.ui.dsb_rayonTore.value(), \
+ aretesFaceFissure = self.ui.dsb_aretesFaceFissure.value(), \
+ influence = self.ui.dsb_influence.value(), \
)
print(dico)
return dico
-
+
def checkValues(self):
return self.NOK
from blocFissure.gmu import geomsmesh
from blocFissure.gmu.casStandard import casStandard
from blocFissure.ihm.fissureCoude_ihm import fissureCoude_ihm
-
+
dico = self.creeDico()
NOK = self.testval(dico)
if not(NOK):
if dico['aretesFaceFissure'] == 0:
dico['aretesFaceFissure'] = (areteMinAngle + areteMinCirco)/2.0
print('aretesFaceFissure', dico['aretesFaceFissure'])
- if dico['rbPosiAngul'] == False:
+ if not dico['rbPosiAngul']:
rmoy = (dico['dext'] - dico['epais'])/2.0
eta = 1
- if dico['rbFissExt'] == False:
+ if not dico['rbFissExt']:
eta = -1
dico['posiAngul'] = (180.0/math.pi)*dico['absCurv']/(dico['rCintr']+(rmoy+eta*dico['epais']/2.0)*math.cos(math.pi*dico['azimut']/180.))
print('posiAngul' , dico['posiAngul'])
-
+
self.writeDefault(dico)
self.ui.lb_calcul.show()
probleme = fissureCoude_ihm(0)
probleme.executeProbleme()
self.NOK = NOK
self.accept()
-
- pass
# ----------------------------------------------------------------------------
-
+
window = fissureCoudeDialog()
# window.ui.dsb_tolerance.setValue(0.01)
retry = True
retry = window.checkValues()
else:
print("dialog rejected, exit")
- pass
-
+
<x>0</x>
<y>0</y>
<width>664</width>
- <height>624</height>
+ <height>681</height>
</rect>
</property>
<property name="windowTitle">
<string>Insertion de fissure dans un maillage sain</string>
</property>
<property name="toolTip">
- <string><html><head/><body><p>Insertion d'un maillage de fissure dans un maillage hexaédrique sain.</p><p>Le maillage sain est fourni sous forme de fichier med.</p><p>La face de fissure est décrite par une géométrie dans un fichier brep.</p><p>La ou les arêtes de fond de fissure sont données par leurs index dans la face de fissure du point de vue de GEOM.</p><p>La procédure identifie des mailles saines à enlever et à remailler, construit un maillage régulier rayonnant autour de la ligne de fond de fissure, reconstitue les faces externes en triangles, complète la zone à remailler en tétraèdres.</p></body></html></string>
+ <string><html><head/><body><p>Insertion d'un maillage de fissure dans un maillage hexaédrique sain.</p><p>Le maillage sain est fourni sous forme de fichier med.</p><p>La face de fissure est décrite par une géométrie dans un fichier de cao au format xao ou brep.</p><p>Si le format xao est utilisé, le fond de la fissure est identifiable par les noms du ou des groupes d'arêtes créés sur ce fond.</p><p> Avec le format brep, le fond de fissure est donné par les index des arêtes du fond dans la face de fissure du point de vue de GEOM. Cela est également possible pour un format xao.</p><p>La procédure identifie des mailles saines à enlever et à remailler, construit un maillage régulier rayonnant autour de la ligne de fond de fissure, reconstitue les faces externes en triangles, complète la zone à remailler en tétraèdres.</p></body></html></string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
- <string>Maillage sain et géometries de fissure</string>
+ <string>Maillage sain et géométries de fissure</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<item>
<widget class="QLabel" name="label">
<property name="text">
- <string>Index arêtes fond de fissure</string>
+ <string>Arêtes fond de fissure</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_fondfiss">
<property name="toolTip">
- <string><html><head/><body><p>Index des arêtes décrivant le fond de fissure, dans la face de fissure.</p><p>Sous forme d'une liste Python.</p><p>Exemples : <span style=" font-weight:600; font-style:italic; color:#000080;">[5,9]</span> ou<span style=" font-weight:600;"/><span style=" font-weight:600; font-style:italic; color:#000080;">[3]</span></p><p>(On peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)</p></body></html></string>
+ <string><html><head/><body><p>Liste des noms des groupes d'arêtes formant le fond de la fissure.</p><p>Exemples : <span style=" font-weight:600; font-style:italic; color:#000080;">["F_1", "F_2"]</span> ou<span style=" font-weight:600;"/><span style=" font-weight:600; font-style:italic; color:#000080;">["Fond"]</span></p><p>Ou liste des index des arêtes décrivant le fond de fissure dans la face de fissure.</p><p>Exemples : <span style=" font-weight:600; font-style:italic; color:#000080;">[5,9]</span> ou<span style=" font-weight:600;"/><span style=" font-weight:600; font-style:italic; color:#000080;">[3]</span></p><p>(On peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)</p></body></html></string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pb_facefiss">
<property name="toolTip">
- <string><html><head/><body><p>sélection du fichier brep (géométrie) décrivant la face de fissure.</p><p>Un champ rouge correspond à un fichier inexistant.</p></body></html></string>
+ <string><html><head/><body><p>sélection du fichier cao (format xao ou brep) décrivant la face de fissure.</p><p>Un champ rouge correspond à un fichier inexistant.</p></body></html></string>
</property>
<property name="text">
<string>Face fissure</string>
<item row="1" column="1">
<widget class="QLineEdit" name="le_facefiss">
<property name="toolTip">
- <string><html><head/><body><p>Fichier brep de la géométrie décrivant la face de fissure.</p></body></html></string>
+ <string><html><head/><body><p>Fichier cao de la géométrie décrivant la face de fissure (xao ou brep).</p></body></html></string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
- <string>Distance influence</string>
+ <string>Distance d'influence</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
- <string>mode</string>
+ <string>Mode</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pb_nomres">
<property name="text">
- <string>Nom résultat</string>
+ <string>Nom du résultat</string>
</property>
</widget>
</item>
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+"""Pilotage de la fenêtre de dialogue"""
+
# if you already have plugins defined in a salome_plugins.py file, add this file at the end.
# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
-import sys, traceback
-import math
+import sys
+import traceback
from blocFissure import gmu
def fissureGeneraleDlg(context):
- # get context study, salomeGui
+ """get context study, salomeGui"""
study = context.study
sg = context.sg
from blocFissure.ihm.fissureGenerale_ui import Ui_Dialog
class fissureGeneraleDialog(QtWidgets.QDialog):
+ """classe du dialogue"""
def __init__(self):
print("__init__")
self.ui.bb_OkCancel.accepted.connect(self.execute)
def initDefaut(self):
- self.defaut = dict(
- nomCas = 'angleCube',
- maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'),
- brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"),
- edgeFissIds = [4],
- lgInfluence = 20,
- meshBrep = (5,10),
- rayonPipe = 5,
- lenSegPipe = 2.5,
- nbSegRad = 5,
- nbSegCercle = 32,
- areteFaceFissure = 10,
- areteVives = 0,
- reptrav = '.',
- nomres = 'maillage_avec_fissure',
+ self.defaut = dict( \
+ nomCas = "angleCube", \
+ maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med"), \
+ CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep"), \
+ edgeFiss = [3], \
+ lgInfluence = 20, \
+ meshBrep = (5,10), \
+ rayonPipe = 5, \
+ lenSegPipe = 2.5, \
+ nbSegRad = 5, \
+ nbSegCercle = 32, \
+ areteFaceFissure = 10, \
+ areteVives = 0, \
+ reptrav = os.curdir, \
+ nomres = "maillage_avec_fissure", \
verbosite = 0)
def initDialog(self, dico):
self.ui.le_maillage.setText(dico['maillageSain'])
- self.ui.le_facefiss.setText(dico['brepFaceFissure'])
- self.ui.le_fondfiss.setText(str(dico['edgeFissIds']))
+ self.ui.le_facefiss.setText(dico['CAOFaceFissure'])
+ self.ui.le_fondfiss.setText(str(dico['edgeFiss']))
self.ui.dsb_influence.setValue(dico['lgInfluence'])
self.ui.dsb_meshBrepMin.setValue(dico['meshBrep'][0])
self.ui.dsb_meshBrepMax.setValue(dico['meshBrep'][1])
self.ui.le_reptrav.setText(os.path.abspath(dico['reptrav']))
self.ui.le_nomres.setText(os.path.split(dico['nomres'])[1])
self.ui.cb_log.setCurrentIndex(dico['verbosite'])
- incomplet = self.testval(dico)
- pass
+ #incomplet = self.testval(dico)
def testval(self, dico):
incomplet = False
incomplet = True
else:
self.ui.le_maillage.setPalette(self.blackPalette)
- if not os.path.lexists(dico['brepFaceFissure']):
+ cao_file = dico['CAOFaceFissure']
+ if not os.path.lexists(cao_file):
self.ui.le_facefiss.setPalette(self.redPalette)
incomplet = True
else:
- self.ui.le_facefiss.setPalette(self.blackPalette)
- edgeFissIdsOK=True
- try:
- l = dico['edgeFissIds']
- for i in l:
- if not isinstance(i, int):
- print("not isinstance(i, int)")
+ suffix = os.path.basename(cao_file).split(".")[-1]
+ if ( suffix.upper() not in ("BREP","XAO") ):
+ print ("Suffixe inconnu pour le fichier {}".format(cao_file))
+ self.ui.le_facefiss.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.le_facefiss.setPalette(self.blackPalette)
+ if dico['edgeFiss']:
+ edgeFissOK=True
+ param_0 = dico['edgeFiss'][0]
+ type_param_id = type(param_0)
+ for param in dico['edgeFiss'][1:]:
+ if not isinstance(param,type_param_id):
+ print ("La donnée {} n'est pas du même type que la première de la liste : {}.".format(param,type(param)))
+ incomplet = True
+ edgeFissOK=False
+ if edgeFissOK:
+ if isinstance(param_0, int):
+ pass
+ elif isinstance(param_0, str):
+ pass
+ else:
+ print("Il faut une liste de noms de groupes d'arêtes ou une liste d'IDs d'arêtes.")
incomplet = True
- edgeFissIdsOK=False
- break
- except:
- print("except eval")
+ edgeFissOK=False
+ else:
incomplet = True
- edgeFissIdsOK=False
- if edgeFissIdsOK:
+ edgeFissOK=False
+ if edgeFissOK:
self.ui.le_fondfiss.setPalette(self.blackPalette)
else:
self.ui.le_fondfiss.setPalette(self.redPalette)
return incomplet
def fileDefault(self):
- filedef = os.path.expanduser("~/.config/salome/dialogFissureGenerale.dic")
+ filedef = os.path.expanduser( os.path.join(os.environ["HOME"], ".config", "salome", "dialogFissureGenerale.dic") )
print(filedef)
return filedef
def writeDefault(self, dico):
filedef = self.fileDefault()
- with open(filedef, 'w') as f:
- f.write(str(dico))
+ with open(filedef, 'w') as fichier:
+ fichier.write(str(dico))
def genereExemples(self):
- maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med')
- brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep")
- if (os.path.exists(maillageSain) and os.path.exists(brepFaceFissure)):
+ maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med")
+ CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep")
+ if (os.path.exists(maillageSain) and os.path.exists(CAOFaceFissure )):
self.initDialog(self.defaut)
else:
self.ui.lb_calcul.setText("--- Generation exemples en cours ---")
def readValPrec(self):
filedef = self.fileDefault()
if os.path.exists(filedef):
- with open(filedef, 'r') as f:
- txt = f.read()
+ with open(filedef, 'r') as fichier:
+ txt = fichier.read()
dico = eval(txt)
print(dico)
self.initDialog(dico)
elif index == 2:
initLog.setDebug(logfile)
-
def sauver(self):
print("sauver")
fileDiag = QFileDialog(self)
if filedef[-4:] not in ['.dic']:
filedef += '.dic'
dico = self.creeDico()
- with open(filedef, 'w') as f:
- f.write(str(dico))
+ with open(filedef, 'w') as fichier:
+ fichier.write(str(dico))
def recharger(self):
print("recharger")
filedef = fileNames[0]
print(filedef)
if os.path.exists(filedef):
- with open(filedef, 'r') as f:
- txt = f.read()
+ with open(filedef, 'r') as fichier:
+ txt = fichier.read()
dico = eval(txt)
print(dico)
self.initDialog(dico)
self.ui.le_nomres.setText(nomres)
def creeDico(self):
- dico = dict(
- maillageSain = str(self.ui.le_maillage.text()),
- brepFaceFissure = str(self.ui.le_facefiss.text()),
- edgeFissIds = eval(str(self.ui.le_fondfiss.text())),
- lgInfluence = self.ui.dsb_influence.value(),
- meshBrep = [self.ui.dsb_meshBrepMin.value(),self.ui.dsb_meshBrepMax.value()],
- rayonPipe = self.ui.dsb_rayonPipe.value(),
- lenSegPipe = self.ui.dsb_lenSegPipe.value(),
- nbSegRad = self.ui.sb_couronnes.value(),
- nbSegCercle = self.ui.sb_secteurs.value(),
- areteFaceFissure = self.ui.dsb_areteFaceFissure.value(),
- aretesVives = self.ui.dsb_aretesVives.value(),
- reptrav = str(self.ui.le_reptrav.text()),
- nomres = str(self.ui.le_nomres.text()),
- verbosite = self.ui.cb_log.currentIndex()
+ dico = dict( \
+ maillageSain = str(self.ui.le_maillage.text()), \
+ CAOFaceFissure = str(self.ui.le_facefiss.text()), \
+ edgeFiss = eval(str(self.ui.le_fondfiss.text())), \
+ lgInfluence = self.ui.dsb_influence.value(), \
+ meshBrep = [self.ui.dsb_meshBrepMin.value(),self.ui.dsb_meshBrepMax.value()], \
+ rayonPipe = self.ui.dsb_rayonPipe.value(), \
+ lenSegPipe = self.ui.dsb_lenSegPipe.value(), \
+ nbSegRad = self.ui.sb_couronnes.value(), \
+ nbSegCercle = self.ui.sb_secteurs.value(), \
+ areteFaceFissure = self.ui.dsb_areteFaceFissure.value(), \
+ aretesVives = self.ui.dsb_aretesVives.value(), \
+ reptrav = str(self.ui.le_reptrav.text()), \
+ nomres = str(self.ui.le_nomres.text()), \
+ verbosite = self.ui.cb_log.currentIndex() \
)
print(dico)
return dico
self.ui.lb_calcul.hide()
#self.accept()
- pass
-
# ----------------------------------------------------------------------------
print("main")
retry = window.checkValues()
else:
print("dialog rejected, exit")
- pass
-
dicoParams = dict(nomCas = 'casTestCoinTriple',
maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
- brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
- edgeFissIds = [4],
+ CAOFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFiss = [4],
lgInfluence = 30,
meshBrep = (5,10),
rayonPipe = 5,
dicoParams = dict(nomCas = 'casTestCoinTriple',
maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
- brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
- edgeFissIds = [4],
+ CAOFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFiss = [4],
lgInfluence = 30,
meshBrep = (5,10),
rayonPipe = 10,
dicoParams = dict(nomCas = 'testAubry',
maillageSain = '/local00/home/I48174/Bureau/{0}'.format(mesh),
- brepFaceFissure = '/local00/home/I48174/Bureau/{0}'.format(crack),
- edgeFissIds = [8],
+ CAOFaceFissure = '/local00/home/I48174/Bureau/{0}'.format(crack),
+ edgeFiss = [8],
lgInfluence = 0.01,
meshBrep = (0.0002,0.003),
rayonPipe = 0.005,
fissureGauche2.py
fissureGauche.py
genereMateriel.py
+ tube.py
vis.py
)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import sys
-import salome
-
-salome.salome_init()
-
-import salome_notebook
+"""Cas-test de blocFissure pour un cube"""
+import logging
import os
-from blocFissure import gmu
-###
-### GEOM component
-###
+from blocFissure import gmu
+import salome
import GEOM
from salome.geom import geomBuilder
-import math
-import SALOMEDS
+import SMESH
+from salome.smesh import smeshBuilder
+#=============== Options ====================
+# 1. NOM_OBJET = nom de l'objet
+NOM_OBJET = "CubeAngle"
+#============================================
+
+salome.salome_init()
+
+###
+### GEOM component
+###
geompy = geomBuilder.New()
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Vertex_1 = geompy.MakeVertex(0, 0, 100)
Vertex_3 = geompy.MakeVertex(65, 65, 110)
Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Common_1 = geompy.MakeCommon(Disk_1, Box_2)
-geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"))
-geompy.addToStudy( O, 'O' )
-geompy.addToStudy( OX, 'OX' )
-geompy.addToStudy( OY, 'OY' )
+
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Vertex_1, 'Vertex_1' )
geompy.addToStudy( Vertex_2, 'Vertex_2' )
geompy.addToStudy( Vertex_3, 'Vertex_3' )
geompy.addToStudy( Box_2, 'Box_2' )
-geompy.addToStudy( Common_1, 'Common_1' )
+geompy.addToStudy( Common_1, NOM_OBJET )
+
+ficcao = os.path.join(gmu.pathBloc, "materielCasTests", "{}Fiss.brep".format(NOM_OBJET))
+text = ".. Exportation de la géométrie de la fissure dans le fichier '{}'".format(ficcao)
+logging.info(text)
+geompy.ExportBREP(Common_1, ficcao)
###
### SMESH component
###
-import SMESH, SALOMEDS
-from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
-from salome.StdMeshers import StdMeshersBuilder
Mesh_1 = smesh.Mesh(Box_1)
+smesh.SetName(Mesh_1, NOM_OBJET)
Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
-isDone = Mesh_1.Compute()
-smesh.SetName(Mesh_1, 'Mesh_1')
-Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngle.med"))
+
+is_done = Mesh_1.Compute()
+text = "Mesh_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ficmed = os.path.join(gmu.pathBloc, "materielCasTests","{}.med".format(NOM_OBJET))
+text = ".. Archivage du maillage dans le fichier '{}'".format(ficmed)
+logging.info(text)
+Mesh_1.ExportMED(ficmed)
## set object names
-smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
geompy.addToStudy( OX_1, 'OX' )
geompy.addToStudy( OY_1, 'OY' )
geompy.addToStudy( OZ_1, 'OZ' )
-geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"))
-geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"))
-geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"))
+geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Transverse.brep"))
+geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Coin.brep"))
+geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Milieu.brep"))
###
### SMESH component
Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = cubeFin_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = cubeFin_1.Hexahedron(algo=smeshBuilder.Hexa)
-isDone = cubeFin_1.Compute()
DEPL_1 = cubeFin_1.GroupOnGeom(DEPL,'DEPL',SMESH.FACE)
ENCASTR_1 = cubeFin_1.GroupOnGeom(ENCASTR,'ENCASTR',SMESH.FACE)
+is_done = cubeFin_1.Compute()
+text = "cubeFin_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
## Set names of Mesh objects
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(cubeFin_1.GetMesh(), 'cubeFin')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
-cubeFin_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/cubeFin.med"))
+cubeFin_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"))
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
Divided_Cylinder_1 = geompy.MakeDividedCylinder(145, 800, GEOM.SQUARE)
CylindreSain = geompy.MakeRotation(Divided_Cylinder_1, OZ, 45*math.pi/180.0)
[Compound_1, vertical, radial, Compound_4] = geompy.Propagate(CylindreSain)
-geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"))
+geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre.brep"))
Vertex_12 = geompy.MakeVertex(0, -145, 500)
Circle_2 = geompy.MakeCircle(Vertex_12, None, 145)
Face_1 = geompy.MakeFaceWires([Circle_2], 1)
Vertex_13 = geompy.MakeVertex(0, 0, 500)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_13, OZ_1, 170)
FissInCylindre2 = geompy.MakeCommon(Face_1, Disk_1)
-geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"))
+geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests", "FissInCylindre2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
smeshObj_1.SetNumberOfSegments( 5 )
smeshObj_1.SetDistrType( 0 )
CylindreSain_1 = smesh.Mesh(CylindreSain)
+smesh.SetName(CylindreSain_1, 'CylindreSain')
Regular_1D = CylindreSain_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15,[],[ ])
Nb_Segments_1.SetDistrType( 0 )
Regular_1D_2 = CylindreSain_1.Segment(geom=radial)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(6,[],[ ])
Nb_Segments_3.SetDistrType( 0 )
-isDone = CylindreSain_1.Compute()
-smesh.SetName(CylindreSain_1, 'CylindreSain')
-CylindreSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests//CylindreSain.med"))
+
+is_done = CylindreSain_1.Compute()
+text = "CylindreSain_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+CylindreSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "CylindreSain.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
Disque_1 = smesh.Mesh(Disque)
+smesh.SetName(Disque_1, 'Disque')
Regular_1D = Disque_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
Nb_Segments_1.SetDistrType( 0 )
Regular_1D_2 = Disque_1.Segment(geom=Compound_4)
status = Disque_1.AddHypothesis(Nb_Segments_2,Compound_4)
Quadrangle_2D = Disque_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
-isDone = Disque_1.Compute()
-smesh.SetName(Disque_1, 'Disque')
-Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/disque.med"))
+
+is_done = Disque_1.Compute()
+text = "Disque_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+Disque_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "disque.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( ellipse1, 'ellipse1' )
geompy.addToStudyInFather( ellipse1, fondFiss, 'fondFiss' )
-geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"))
+geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1.brep"))
if salome.sg.hasDesktop():
Vertex_3 = geompy.MakeVertex(120, 2, 60)
Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Ellipse_disque = geompy.MakeCommon(Box_1, Scale_1)
-geompy.ExportBREP(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"))
+geompy.ExportBREP(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_disque.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( ellipse1, 'ellipse1_pb' )
-geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"))
+geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1_pb.brep"))
if salome.sg.hasDesktop():
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -110.000000 85.000000:T 220.000000 0.000000:T 0.000000 75.000000:T -220.000000 0.000000:WW", geomObj_1 )
SectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
-geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
+geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbeFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
EprouvetteCourbe_1 = smesh.Mesh(EprouvetteCourbe)
+smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe')
Regular_1D = EprouvetteCourbe_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(50)
Nb_Segments_1.SetDistrType( 0 )
Regular_1D_2 = EprouvetteCourbe_1.Segment(geom=Compound_y)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(25)
Nb_Segments_3.SetDistrType( 0 )
-isDone = EprouvetteCourbe_1.Compute()
-smesh.SetName(EprouvetteCourbe_1, 'EprouvetteCourbe')
-EprouvetteCourbe_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"))
+
+is_done = EprouvetteCourbe_1.Compute()
+text = "EprouvetteCourbe_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+EprouvetteCourbe_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbe.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
geomObj_4 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_2 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:T 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 20.000000:WW", Plane_2 )
SectionInclinee = geompy.MakeFaceWires([Sketch_2], 1)
-geompy.ExportBREP(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"))
-geompy.ExportBREP(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"))
+geompy.ExportBREP(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFissPb1.brep"))
+geompy.ExportBREP(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss2.brep"))
Vertex_2 = geompy.MakeVertex(110, -10, 200)
Vertex_3 = geompy.MakeVertex(110, 80, 200)
Vertex_4 = geompy.MakeVertex(-10, 80, 200)
Face_1_vertex_9 = geompy.GetSubShape(Face_1, [9])
Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Face_1_vertex_9)
Face_2 = geompy.MakeFaceWires([Line_5, Line_6, Line_7, Line_8], 1)
-geompy.ExportBREP(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"))
-geompy.ExportBREP(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"))
+geompy.ExportBREP(Face_1, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss_1.brep"))
+geompy.ExportBREP(Face_2, os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteDroiteFiss_2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
eprouvetteDroite_1 = smesh.Mesh(eprouvetteDroite)
+smesh.SetName(eprouvetteDroite_1, 'eprouvetteDroite')
Regular_1D = eprouvetteDroite_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(50,[],[ ])
Nb_Segments_1.SetDistrType( 0 )
Regular_1D_2 = eprouvetteDroite_1.Segment(geom=Compound_x)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,[],[ ])
Nb_Segments_3.SetDistrType( 0 )
-isDone = eprouvetteDroite_1.Compute()
-smesh.SetName(eprouvetteDroite_1, 'eprouvetteDroite')
-eprouvetteDroite_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/eprouvetteDroite.med"))
+
+is_done = eprouvetteDroite_1.Compute()
+text = "eprouvetteDroite_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+eprouvetteDroite_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "eprouvetteDroite.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
Common_1 = geompy.MakeCommon(Box_2, Cut_2)
objetSain = geompy.MakePartition([Common_1], [Plane_1, Plane_2, Plane_3], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
[hauteurs, epaisseurs, Compound_3, Compound_4, Compound_5, Compound_6] = geompy.Propagate(objetSain)
-geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"))
+geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
objetSain_1 = smesh.Mesh(objetSain)
+smesh.SetName(objetSain_1, 'objetSain')
Regular_1D = objetSain_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(10,[],[ ])
Nb_Segments_1.SetDistrType( 0 )
Regular_1D_2 = objetSain_1.Segment(geom=epaisseurs)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(5,[],[ ])
Nb_Segments_3.SetDistrType( 0 )
-isDone = objetSain_1.Compute()
-smesh.SetName(objetSain_1, 'objetSain')
-objetSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheSain.med"))
+
+is_done = objetSain_1.Compute()
+text = "objetSain_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+objetSain_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheSain.med"))
SubMesh_1 = Regular_1D_1.GetSubMesh()
SubMesh_2 = Regular_1D_2.GetSubMesh()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
Partition_1 = geompy.MakePartition([Extrusion_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[Face_1,Face_2] = geompy.SubShapes(Partition_1, [18, 13])
FaceFissExt = geompy.MakeFuse(Face_2, Face_1)
-geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2Fiss.brep"))
+geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2Fiss.brep"))
Vertex_2 = geompy.MakeVertex(0, -500, 0)
Vertex_3 = geompy.MakeVertex(400, 500, 800)
objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
-geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"))
+geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests", "faceGauche2FissCoupe.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
smesh = smeshBuilder.New()
from salome.StdMeshers import StdMeshersBuilder
Mesh_1 = smesh.Mesh(objetSain)
+smesh.SetName(Mesh_1, 'Mesh_1')
Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15,[],[ ])
Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = Mesh_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = Mesh_1.Hexahedron(algo=smeshBuilder.Hexa)
-isDone = Mesh_1.Compute()
-smesh.SetName(Mesh_1, 'Mesh_1')
-Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/boiteSaine.med"))
+
+is_done = Mesh_1.Compute()
+text = "Mesh_1.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+Mesh_1.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med"))
## set object names
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
#
from blocFissure.materielCasTests import cubeAngle
+from blocFissure.materielCasTests import cubeFin
from blocFissure.materielCasTests import decoupeCylindre
+from blocFissure.materielCasTests import disque_perce
+from blocFissure.materielCasTests import ellipse_disque
+from blocFissure.materielCasTests import ellipse
+from blocFissure.materielCasTests import ellipse_probleme
from blocFissure.materielCasTests import eprouvetteCourbe
from blocFissure.materielCasTests import eprouvetteDroite
from blocFissure.materielCasTests import fissureGauche
from blocFissure.materielCasTests import fissureGauche2
-from blocFissure.materielCasTests import ellipse
-from blocFissure.materielCasTests import ellipse_probleme
-from blocFissure.materielCasTests import disque_perce
-from blocFissure.materielCasTests import ellipse_disque
from blocFissure.materielCasTests import vis
-from blocFissure.materielCasTests import cubeFin
+from blocFissure.materielCasTests import tube
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2020 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""Cas-test de blocFissure sur un tube"""
+__revision__ = "V02.06"
+
+import logging
+import os
+
+from blocFissure import gmu
+
+import salome
+from SketchAPI import *
+from salome.shaper import model
+import SHAPERSTUDY
+import SMESH
+from salome.smesh import smeshBuilder
+
+#=============== Options ====================
+# 1. NOM_OBJET = nom de l'objet
+NOM_OBJET = "Tube"
+# 2. CAO
+# 2.1. Le tube : rayon intérieur, rayon extérieur, hauteur
+RAYON_INT = 9.84
+RAYON_EXT = 11.11
+HAUTEUR = 50.
+# 2.2. La fissure :
+F_L_1 = 80.
+F_THETA_1 = 3.
+F_C_1 = 1.04
+F_L_2 = 20.
+F_C_3 = 0.99
+# 3. Maillage
+# Nombre de segments du tube
+NB_S_E = 4
+NB_S_H = 60
+NB_S_P = 30
+#============================================
+
+salome.salome_init()
+
+###
+### SHAPER component
+###
+
+model.begin()
+partSet = model.moduleDocument()
+
+### Create Part
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "R_I", "%f" % RAYON_INT)
+model.addParameter(Part_1_doc, "R_E", "%f" % RAYON_EXT)
+model.addParameter(Part_1_doc, "H", "%f" % HAUTEUR)
+model.addParameter(Part_1_doc, "F_L_1", "{}".format(F_L_1))
+model.addParameter(Part_1_doc, "F_THETA_1", "{}".format(F_THETA_1))
+model.addParameter(Part_1_doc, "F_R_1", "{}*{}".format(F_C_1,RAYON_INT))
+model.addParameter(Part_1_doc, "F_L_2", "{}".format(F_L_2))
+model.addParameter(Part_1_doc, "F_D_3", "{}*{}".format(F_C_3,RAYON_INT))
+
+### Create Sketch
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+
+### Create SketchLine
+SketchLine_1 = Sketch_1.addLine(11.11, -22.82842712474619, 9.84, -22.82842712474619)
+
+### Create SketchLine
+SketchLine_2 = Sketch_1.addLine(9.84, -22.82842712474619, 9.84, 27.17157287525381)
+
+### Create SketchLine
+SketchLine_3 = Sketch_1.addLine(9.84, 27.17157287525381, 11.11, 27.17157287525381)
+
+### Create SketchLine
+SketchLine_4 = Sketch_1.addLine(11.11, 27.17157287525381, 11.11, -22.82842712474619)
+Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+Sketch_1.setHorizontal(SketchLine_1.result())
+Sketch_1.setVertical(SketchLine_2.result())
+Sketch_1.setHorizontal(SketchLine_3.result())
+Sketch_1.setVertical(SketchLine_4.result())
+Sketch_1.setLength(SketchLine_4.result(), "H")
+
+### Create SketchProjection
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.endPoint(), "R_I")
+Sketch_1.setHorizontalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.startPoint(), "R_E")
+model.do()
+
+### Create Revolution
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 180, 0)
+Revolution_1.result().setName("Tube")
+Revolution_1.result().setTransparency(0.37)
+
+### Create Sketch
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
+
+### Create SketchArc
+SketchArc_1 = Sketch_2.addArc(-80, 0, 10.10993798722564, 4.722461741385164, 10.10993798722563, -4.722461741385561, True)
+
+### Create SketchProjection
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_5 = SketchProjection_2.createdFeature()
+Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_5.result())
+
+### Create SketchProjection
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_2 = SketchProjection_3.createdFeature()
+Sketch_2.setHorizontalDistance(SketchArc_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "F_L_1")
+
+### Create SketchPoint
+SketchPoint_3 = Sketch_2.addPoint(10.2336, 0)
+SketchPoint_3.setAuxiliary(True)
+Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_1.results()[1])
+Sketch_2.setMiddlePoint(SketchPoint_3.coordinates(), SketchArc_1.results()[1])
+Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_5.result())
+
+### Create SketchProjection
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_4 = SketchProjection_4.createdFeature()
+Sketch_2.setHorizontalDistance(SketchPoint_3.coordinates(), SketchAPI_Point(SketchPoint_4).coordinates(), "F_R_1")
+
+### Create SketchLine
+SketchLine_6 = Sketch_2.addLine(-80, 0, 10.10993798722564, 4.722461741385164)
+SketchLine_6.setAuxiliary(True)
+Sketch_2.setCoincident(SketchArc_1.center(), SketchLine_6.startPoint())
+Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_6.endPoint())
+
+### Create SketchConstraintAngle
+Sketch_2.setAngle(SketchLine_5.result(), SketchLine_6.result(), "F_THETA_1", type = "Direct")
+
+### Create SketchEllipticArc
+SketchEllipticArc_1 = Sketch_2.addEllipticArc(-20, 8.956370781951521e-27, -10.21629725685072, 9.783702743149284, 10.10993798723031, 4.722461741243296, 9.7416, 8.052073253504034, False)
+[SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchPoint_8, SketchPoint_9, SketchPoint_10, SketchPoint_11, SketchLine_7, SketchLine_8] = \
+ SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+Sketch_2.setCoincident(SketchEllipticArc_1.startPoint(), SketchLine_6.endPoint())
+Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_5.result())
+Sketch_2.setTangent(SketchEllipticArc_1.result(), SketchArc_1.results()[1])
+
+### Create SketchProjection
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_12 = SketchProjection_5.createdFeature()
+Sketch_2.setHorizontalDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchAPI_Point(SketchPoint_12).coordinates(), "F_L_2")
+
+### Create SketchConstraintAngle
+Sketch_2.setAngle(SketchLine_5.result(), SketchLine_7.result(), 45, type = "Supplementary")
+
+### Create SketchProjection
+SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_13 = SketchProjection_6.createdFeature()
+Sketch_2.setHorizontalDistance(SketchEllipticArc_1.endPoint(), SketchAPI_Point(SketchPoint_13).coordinates(), "F_D_3")
+
+### Create SketchConstraintMirror
+SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_5.result(), [SketchEllipticArc_1.result()])
+[SketchEllipticArc_2] = SketchConstraintMirror_1.mirrored()
+
+### Create SketchLine
+SketchLine_9 = Sketch_2.addLine(9.7416, 8.052073253504034, 9.7416, -8.052073253504034)
+Sketch_2.setCoincident(SketchEllipticArc_1.endPoint(), SketchLine_9.startPoint())
+Sketch_2.setCoincident(SketchAPI_EllipticArc(SketchEllipticArc_2).endPoint(), SketchLine_9.endPoint())
+model.do()
+
+### Create Face
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2r-SketchEllipticArc_1f-SketchLine_9f-SketchEllipticArc_2f")])
+Face_1.result().setName("Fissure")
+
+### Create Group
+Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchEllipticArc_1")])
+
+### Create Group
+Group_2 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchArc_1_2")])
+
+### Create Group
+Group_3 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchEllipticArc_2")])
+
+### Create Group
+Group_4 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "Fissure/Modified_Edge&Sketch_2/SketchLine_9")])
+
+### Create Group
+Group_5 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Tube/Generated_Face&Sketch_1/SketchLine_1][Tube/From_Face]")])
+Group_5.setName("Epaisseur")
+Group_5.result().setName("Epaisseur")
+
+### Create Group
+Group_6 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Tube/Generated_Face&Sketch_1/SketchLine_4][Tube/From_Face]")])
+Group_6.setName("Hauteur")
+Group_6.result().setName("Hauteur")
+
+### Create Group
+Group_7 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Tube/Generated_Face&Sketch_1/SketchLine_4][Tube/Generated_Face&Sketch_1/SketchLine_1]")])
+Group_7.setName("Peripherie")
+Group_7.result().setName("Peripherie")
+
+### Create Export
+ficcao = os.path.join(gmu.pathBloc, "materielCasTests", "{}Fiss.xao".format(NOM_OBJET))
+text = ".. Exportation de la géométrie de la fissure dans le fichier '{}'".format(ficcao)
+logging.info(text)
+_ = model.exportToXAO(Part_1_doc, ficcao, model.selection("FACE", "Fissure"), 'XAO')
+
+model.end()
+
+###
+### SHAPERSTUDY component
+###
+
+model.publishToShaperStudy()
+
+l_aux = SHAPERSTUDY.shape(model.featureStringId(Revolution_1))
+objet = l_aux[0]
+l_groups = l_aux[1:]
+
+###
+### SMESH component
+###
+
+smesh = smeshBuilder.New()
+Maillage_tube = smesh.Mesh(objet)
+smesh.SetName(Maillage_tube, NOM_OBJET)
+
+for groupe in l_groups:
+ groupe_nom = groupe.GetName()
+ if ( groupe_nom[:1] == "E" ):
+ group_e = groupe
+ elif ( groupe_nom[:1] == "H" ):
+ group_h = groupe
+ elif ( groupe_nom[:1] == "P" ):
+ group_p = groupe
+ _ = Maillage_tube.GroupOnGeom(groupe,groupe_nom,SMESH.EDGE)
+
+Regular_1D = Maillage_tube.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(NB_S_P)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = Maillage_tube.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+Hexa_3D = Maillage_tube.Hexahedron(algo=smeshBuilder.Hexa)
+
+Regular_1D_1 = Maillage_tube.Segment(geom=group_e)
+Number_of_Segments_1 = Regular_1D_1.NumberOfSegments(NB_S_E)
+Propagation_of_1D_Hyp = Regular_1D_1.Propagation()
+
+Regular_1D_2 = Maillage_tube.Segment(geom=group_h)
+Number_of_Segments_2 = Regular_1D_2.NumberOfSegments(NB_S_H)
+Propagation_of_1D_Hyp_1 = Regular_1D_2.Propagation()
+
+is_done = Maillage_tube.Compute()
+text = "Maillage_tube.Compute"
+if is_done:
+ logging.info(text+" OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+ficmed = os.path.join(gmu.pathBloc, "materielCasTests","{}.med".format(NOM_OBJET))
+text = ".. Archivage du maillage dans le fichier '{}'".format(ficmed)
+logging.info(text)
+Maillage_tube.ExportMED(ficmed)
+
+## set object names
+smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
+smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
+smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
+smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+import logging
+
import sys
import salome
import os
from blocFissure import gmu
+logging.info('start')
+
###
### GEOM component
###
Fissure = geompy.MakeCommonList([Extrusion_1, Revolution_2], True)
fondFiss = geompy.CreateGroup(Fissure, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [9, 7, 4])
-geompy.ExportBREP(Fissure, os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"))
+geompy.ExportBREP(Fissure, os.path.join(gmu.pathBloc, "materielCasTests", "visFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
### SMESH component
###
+logging.info("Maillage de {}".format(coupe_vis.GetName()))
+
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
+
coupe_vis_1 = smesh.Mesh(coupe_vis)
Regular_1D = coupe_vis_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(30)
Regular_1D_2 = coupe_vis_1.Segment(geom=section)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,1,[ 7, 11, 16, 23 ])
-isDone = coupe_vis_1.Compute()
-isDone = coupe_vis_1.SplitQuad( [ 691 ], 1 )
+
tige_1 = coupe_vis_1.GroupOnGeom(tige,'tige',SMESH.EDGE)
section_1 = coupe_vis_1.GroupOnGeom(section,'section',SMESH.EDGE)
tige_haute_1 = coupe_vis_1.GroupOnGeom(tige_haute,'tige_haute',SMESH.EDGE)
conge_1 = coupe_vis_1.GroupOnGeom(conge,'conge',SMESH.EDGE)
appui_1 = coupe_vis_1.GroupOnGeom(appui,'appui',SMESH.EDGE)
p_imp_1 = coupe_vis_1.GroupOnGeom(p_imp,'p_imp',SMESH.EDGE)
+
+is_done = coupe_vis_1.Compute()
+text = "coupe_vis_1.Compute"
+if is_done:
+ logging.debug(text+" : OK")
+else:
+ text = "Erreur au calcul du maillage.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
+# Découpage en 2 triangles du quadrangle dans l'angle
+cg_x=0.972772
+cg_y=104.835
+cg_z=0.
+l_ids = coupe_vis_1.FindElementsByPoint( cg_x,cg_y,cg_z, SMESH.FACE )
+if ( len(l_ids) != 1 ):
+ text = "Maillage {}.\nImpossible de trouver l'élément proche de ({},{},{}).".format(coupe_vis.GetName(),cg_x,cg_y,cg_z)
+ raise Exception(text)
+isDone = coupe_vis_1.SplitQuad( l_ids, 1 )
+text = "SplitQuad de l'élément n° {} du maillage de {}".format(l_ids[0],coupe_vis.GetName())
+if isDone:
+ logging.debug(text+" : OK")
+else:
+ text = "Erreur.\n" + text
+ logging.info(text)
+ raise Exception(text)
+
visHex80 = smesh.CopyMesh( coupe_vis_1, 'visHex80', 1, 0)
-[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2 ] = visHex80.GetGroups()
-[ tige_rotated, section_rotated, tige_haute_rotated, rond_rotated, tete_rotated, section_tete_rotated, conge_rotated, appui_rotated, p_imp_rotated, tige_top, section_top, tige_haute_top, rond_top, tete_top, section_tete_top, conge_top, appui_top, p_imp_top ] = visHex80.RotationSweepObjects( [ visHex80 ], [ visHex80 ], [ visHex80 ], SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), 0.0785398, 40, 1e-05, 1 )
-[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top ] = visHex80.GetGroups()
+
+_ = visHex80.RotationSweepObjects( [ visHex80 ], [ visHex80 ], [ visHex80 ], SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), 0.0785398, 40, 1e-05, 1 )
+
+[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, \
+ tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, \
+ rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, \
+ conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top ] = visHex80.GetGroups()
Sub_mesh_1 = Regular_1D_1.GetSubMesh()
Sub_mesh_2 = Regular_1D_2.GetSubMesh()
-visHex80.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests/visSain.med"))
-
+visHex80.ExportMED(os.path.join(gmu.pathBloc, "materielCasTests", "visSain.med"))
## Set names of Mesh objects
smesh.SetName(tige_2, 'tige')