Merge branch 'gni/evolution'

Somebugs in blocFissure are fixed
This commit is contained in:
GERALD NICOLAS 2021-03-29 10:30:39 +02:00
commit d7ce9e283f
104 changed files with 4020 additions and 2477 deletions

View File

@ -38,8 +38,8 @@ crack = 'fissureExtrados.brep'
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,

View File

@ -38,8 +38,8 @@ crack = 'fissureIntrados.brep'
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,

View File

@ -51,6 +51,7 @@ SET(plugin_SCRIPTS
fissureCoude_9.py
fissure_Coude.py
vis_1.py
tube.py
)
# --- rules ---

View File

@ -18,41 +18,37 @@
# 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
@ -63,33 +59,40 @@ class cubeAngle(fissureGenerique):
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)
@ -100,22 +103,28 @@ class cubeAngle(fissureGenerique):
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 \
)

View File

@ -17,12 +17,15 @@
#
# 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
"""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
"""
@ -30,8 +33,8 @@ class cubeAngle2(cubeAngle):
# ---------------------------------------------------------------------------
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
"""
@ -40,21 +43,22 @@ class cubeAngle2(cubeAngle):
# ---------------------------------------------------------------------------
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 \
)

View File

@ -18,13 +18,15 @@
# 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,
@ -35,12 +37,13 @@ dicoParams = dict(nomCas = 'cubeCoin',
# ---------------------------------------------------------------------------
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 \
)

View File

@ -18,13 +18,15 @@
# 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,
@ -35,12 +37,13 @@ dicoParams = dict(nomCas = 'cubeMilieu',
# ---------------------------------------------------------------------------
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 \
)

View File

@ -18,13 +18,15 @@
# 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,
@ -35,12 +37,13 @@ dicoParams = dict(nomCas = 'cubeTransverse',
# ---------------------------------------------------------------------------
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 \
)

View File

@ -18,34 +18,29 @@
# 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):
@ -55,7 +50,7 @@ class cylindre(fissureGenerique):
"""
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
@ -72,28 +67,29 @@ class cylindre(fissureGenerique):
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)
@ -104,22 +100,26 @@ class cylindre(fissureGenerique):
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 \
)

View File

@ -18,57 +18,54 @@
# 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 \
)

View File

@ -18,13 +18,15 @@
# 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,
@ -35,12 +37,13 @@ dicoParams = dict(nomCas = 'disque',
# ---------------------------------------------------------------------------
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 \
)

View File

@ -18,34 +18,29 @@
# 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):
@ -55,10 +50,11 @@ class ellipse_1(fissureGenerique):
# ---------------------------------------------------------------------------
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
@ -71,33 +67,40 @@ class ellipse_1(fissureGenerique):
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)
@ -108,22 +111,29 @@ class ellipse_1(fissureGenerique):
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 \
)

View File

@ -18,60 +18,57 @@
# 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 \
)

View File

@ -18,40 +18,36 @@
# 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
@ -65,33 +61,40 @@ class eprouvetteCourbe(fissureGenerique):
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)
@ -102,22 +105,29 @@ class eprouvetteCourbe(fissureGenerique):
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 \
)

View File

@ -17,13 +17,12 @@
#
# 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
@ -42,17 +41,18 @@ from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
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
@ -72,28 +72,29 @@ class eprouvetteDroite(fissureGenerique):
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)
@ -104,22 +105,26 @@ class eprouvetteDroite(fissureGenerique):
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 \
)

View File

@ -17,62 +17,54 @@
#
# 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 \
)

View File

@ -17,152 +17,332 @@
#
# 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
# -----------------------------------------------------------------------------------------------
#initLog.setDebug()
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]
# -----------------------------------------------------------------------------------------------
from blocFissure.gmu import geomsmesh
from blocFissure.gmu.casStandard import casStandard
problemes = list()
# -----------------------------------------------------------------------------------------------
#initLog.setDebug()
#initLog.setVerbose()
#initLog.setRelease()
#initLog.setPerfTests()
cas=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, 0, 0, 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, 0, 0, 0, 0] # OK
# -----------------------------------------------------------------------------------------------
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
problemes.append(cubeAngle(cas))
l_problemes.append(cubeAngle(n_cas))
cas+=1
n_cas = 1
# genereMateriel : cubeAngle
from blocFissure.CasTests.cubeAngle2 import cubeAngle2
problemes.append(cubeAngle2(cas))
l_problemes.append(cubeAngle2(n_cas))
cas+=1
n_cas = 2
# genereMateriel : cubeFin
from blocFissure.CasTests import cubeCoin
problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, cas))
l_problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "cubeCoin"
cas+=1
n_cas = 3
# genereMateriel : cubeFin
from blocFissure.CasTests import cubeMilieu
problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, cas))
l_problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "cubeMilieu"
cas+=1
n_cas = 4
# genereMateriel : cubeFin
from blocFissure.CasTests import cubeTransverse
problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, cas))
l_problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "cubeTransverse"
cas+=1
n_cas = 5
# genereMateriel : decoupeCylindre
from blocFissure.CasTests.cylindre import cylindre
problemes.append(cylindre(cas))
l_problemes.append(cylindre(n_cas))
cas+=1
n_cas = 6
# genereMateriel : decoupeCylindre
from blocFissure.CasTests.cylindre_2 import cylindre_2
problemes.append(cylindre_2(cas))
l_problemes.append(cylindre_2(n_cas))
cas+=1
n_cas = 7
# genereMateriel : disque_perce
# genereMateriel : ellipse_disque
from blocFissure.CasTests import disquePerce
problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, cas))
l_problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "disquePerce"
cas+=1
n_cas = 8
# genereMateriel: ellipse
# genereMateriel : fissureGauche2
from blocFissure.CasTests.ellipse_1 import ellipse_1
problemes.append(ellipse_1(cas))
l_problemes.append(ellipse_1(n_cas))
cas+=1
n_cas = 9
# genereMateriel: ellipse_probleme
# genereMateriel : fissureGauche2
from blocFissure.CasTests.ellipse_2 import ellipse_2
problemes.append(ellipse_2(cas))
l_problemes.append(ellipse_2(n_cas))
cas+=1
n_cas = 10
# genereMateriel : eprouvetteCourbe
from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
problemes.append(eprouvetteCourbe(cas))
l_problemes.append(eprouvetteCourbe(n_cas))
cas+=1
n_cas = 11
# genereMateriel : eprouvetteDroite
from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
problemes.append(eprouvetteDroite(cas))
l_problemes.append(eprouvetteDroite(n_cas))
cas+=1
n_cas = 12
# genereMateriel : eprouvetteDroite
from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
problemes.append(eprouvetteDroite_2(cas))
l_problemes.append(eprouvetteDroite_2(n_cas))
cas+=1
n_cas = 13
# genereMateriel : fissureGauche
# genereMateriel : fissureGauche2
from blocFissure.CasTests.faceGauche import faceGauche
problemes.append(faceGauche(cas))
l_problemes.append(faceGauche(n_cas))
cas+=1
n_cas = 14
# genereMateriel : aucun
from blocFissure.CasTests.faceGauche_2 import faceGauche_2
problemes.append(faceGauche_2(cas))
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.
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
n_cas = 15
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
problemes.append(fissureCoude_1(cas))
l_problemes.append(fissureCoude_1(n_cas))
cas+=1
n_cas = 16
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
problemes.append(fissureCoude_2(cas))
l_problemes.append(fissureCoude_2(n_cas))
cas+=1
n_cas = 17
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
problemes.append(fissureCoude_3(cas))
l_problemes.append(fissureCoude_3(n_cas))
cas+=1
from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
problemes.append(fissure_Coude_4(cas))
cas+=1
n_cas = 18
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
problemes.append(fissureCoude_4(cas))
l_problemes.append(fissureCoude_4(n_cas))
cas+=1
n_cas = 19
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
problemes.append(fissureCoude_5(cas))
l_problemes.append(fissureCoude_5(n_cas))
cas+=1
n_cas = 20
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
problemes.append(fissureCoude_6(cas))
l_problemes.append(fissureCoude_6(n_cas))
cas+=1
n_cas = 21
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
problemes.append(fissureCoude_7(cas))
l_problemes.append(fissureCoude_7(n_cas))
cas+=1
n_cas = 22
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
problemes.append(fissureCoude_8(cas))
l_problemes.append(fissureCoude_8(n_cas))
cas+=1
n_cas = 23
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
problemes.append(fissureCoude_9(cas))
l_problemes.append(fissureCoude_9(n_cas))
cas+=1
n_cas = 24
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
problemes.append(fissureCoude_10(cas))
l_problemes.append(fissureCoude_10(n_cas))
cas+=1
n_cas = 25
# genereMateriel : aucun
from blocFissure.CasTests.fissure_Coude import fissure_Coude
l_problemes.append(fissure_Coude(n_cas))
#"Mesh_366" has not been computed:
#- global 1D algorithm is missing
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 274, in calcul_cas
#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 137, in executeProbleme
#elementsDefaut, step, mailleur)
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/fissure_Coude.py", line 513, in genereMaillageFissure
#step, mailleur)
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/insereFissureLongue.py", line 435, in insereFissureLongue
#mailleur )
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/insereFissureLongue_c.py", line 82, in insereFissureLongue_c
#raise Exception(text)
n_cas = 26
# genereMateriel : aucun
from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
l_problemes.append(fissure_Coude_4(n_cas))
#"Mesh_375" has not been computed:
#- global 1D algorithm is missing
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 274, in calcul_cas
#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 137, in executeProbleme
#elementsDefaut, step, mailleur)
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/fissure_Coude.py", line 513, in genereMaillageFissure
#step, mailleur)
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/insereFissureLongue.py", line 435, in insereFissureLongue
#mailleur )
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/insereFissureLongue_c.py", line 82, in insereFissureLongue_c
#raise Exception(text)
n_cas = 27
# genereMateriel : vis
from blocFissure.CasTests.vis_1 import vis_1
problemes.append(vis_1(cas))
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.
for iaux, cas in enumerate(problemes):
if torun[iaux]:
logging.critical("=== Execution cas {}".format(iaux))
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:
cas.executeProbleme()
ok_maillage = cas.executeProbleme()
except:
traceback.print_exc()
print("---------------------------------------------------------------------")
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

View File

@ -17,6 +17,7 @@
#
# 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
@ -26,9 +27,7 @@ import math
import GEOM
import SALOMEDS
import SMESH
#import StdMeshers
#import GHS3DPlugin
#import NETGENPlugin
import logging
from blocFissure.gmu.fissureGenerique import fissureGenerique
@ -41,17 +40,18 @@ from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
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
@ -70,28 +70,29 @@ class faceGauche(fissureGenerique):
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)
@ -102,22 +103,26 @@ class faceGauche(fissureGenerique):
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 \
)

View File

@ -17,12 +17,12 @@
#
# 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
@ -42,25 +42,26 @@ from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
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
@ -71,28 +72,29 @@ class faceGauche_2(fissureGenerique):
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)
@ -103,22 +105,26 @@ class faceGauche_2(fissureGenerique):
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 \
)

View File

@ -17,14 +17,21 @@
#
# 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):
@ -89,21 +96,22 @@ class fissureCoude_1(fissureCoude):
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 \
)

View File

@ -17,17 +17,26 @@
#
# 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
@ -89,21 +98,22 @@ class fissureCoude_10(fissureCoude):
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 \
)

View File

@ -17,14 +17,21 @@
#
# 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):
@ -89,21 +96,22 @@ class fissureCoude_2(fissureCoude):
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 \
)

View File

@ -17,14 +17,21 @@
#
# 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):
@ -89,21 +96,22 @@ class fissureCoude_3(fissureCoude):
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 \
)

View File

@ -17,14 +17,21 @@
#
# 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):
@ -89,21 +96,22 @@ class fissureCoude_4(fissureCoude):
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 \
)

View File

@ -17,14 +17,21 @@
#
# 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):
@ -89,21 +96,22 @@ class fissureCoude_5(fissureCoude):
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 \
)

View File

@ -17,11 +17,21 @@
#
# 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):
@ -87,22 +97,22 @@ class fissureCoude_6(fissureCoude):
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)
# ---------------------------------------------------------------------------
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 \
)

View File

@ -17,11 +17,21 @@
#
# 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):
@ -88,21 +98,22 @@ class fissureCoude_7(fissureCoude):
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)
# ---------------------------------------------------------------------------
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 \
)

View File

@ -17,12 +17,21 @@
#
# 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):
@ -89,21 +98,22 @@ class fissureCoude_8(fissureCoude):
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 \
)

View File

@ -17,12 +17,21 @@
#
# 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):
@ -87,21 +96,22 @@ class fissureCoude_9(fissureCoude):
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 \
)

View File

@ -17,6 +17,9 @@
#
# 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
@ -40,12 +43,19 @@ from blocFissure.gmu.insereFissureLongue import insereFissureLongue
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):
@ -256,16 +266,16 @@ class fissure_Coude(fissureGenerique):
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
@ -292,14 +302,15 @@ class fissure_Coude(fissureGenerique):
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']
@ -317,13 +328,8 @@ class fissure_Coude(fissureGenerique):
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:
@ -471,15 +477,16 @@ class fissure_Coude(fissureGenerique):
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,
@ -495,21 +502,26 @@ class fissure_Coude(fissureGenerique):
# ---------------------------------------------------------------------------
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 \
)

View File

@ -17,15 +17,25 @@
#
# 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):
"""
@ -64,10 +74,9 @@ class fissure_Coude_4(fissure_Coude):
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,
@ -80,12 +89,13 @@ class fissure_Coude_4(fissure_Coude):
# ---------------------------------------------------------------------------
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, \
)

View File

@ -0,0 +1,135 @@
# -*- 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 \
)

View File

@ -17,18 +17,15 @@
#
# 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
@ -41,57 +38,66 @@ from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
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)
@ -102,22 +108,29 @@ class vis_1(fissureGenerique):
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 \
)

View File

@ -6,23 +6,30 @@ With GUI
To make the use of « Bloc Fissure » easier, a Graphical User Interface (GUI) was developed.
Inputs are similar to those of :ref:`script mode <script>`. GUI is accessible in the SMESH extension *Add a crack in a mesh*
.. figure:: images/BF_GUI_capture.png
:width: 700
.. image:: images/BF_GUI_capture.png
:scale: 100
:align: center
:alt: Window of the graphical interface
Windows of the graphical interface
Window of the graphical interface
+------------------------------------------------------------------------------------------------------------------+
| GUI parameters |
+======================+===================================+=======================================================+
| **maillageSain** | *[string]* | Relative address of the input structure 3D mesh |
| **Maillage sain** | *[string]* | Relative address of the input structure 3D mesh |
| | ex: mesh/maillage.med | in MED format (base is repertoire de travail) |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **FaceFissure** | *[string]* | Relative address of the input crack geometry |
| | ex: mesh/fissure.brep | in BREP format (base is repertoire de travail) |
| **Face fissure** | *[string]* | Relative address of the input crack geometry in |
| | ex: mesh/fissure.xao | BREP or XAO format (base is repertoire de travail) |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **index edges fond | *[list of integers]* | List of edges number which define the crack front |
| fissure** | ex: [1,2] | |
| **Arêtes fond | *[list of strings]* | Definition of the crack front: |
| fissure** | ex: ["F_1", "F_2"] | If XAO: list of the names of the edge group(s) |
+----------------------+-----------------------------------+-------------------------------------------------------+
| | *[list of integers]* | If BREP (or XAO): list of edges number in GEOM |
| | ex: [1,2] | |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **Distance | *[float]* | Length of influence - distance that defines the |
| d'influence** | ex: 20.0000 | size of the extracted Box around the crack |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **min** | *[float]* | Float defining the minimum size of elements |
| | ex: 1.00000 | to mesh the crack |
@ -30,41 +37,41 @@ Inputs are similar to those of :ref:`script mode <script>`. GUI is accessible in
| **max** | *[float]* | Float defining the maximum size of elements |
| | ex: 10.0000 | to mesh the crack |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **distance | *[float]* | Length of influence - distance that defines the |
| influence** | ex: 20.0000 | size of the extracted Box around the crack |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **rayon pipe** | *[float]* | Radius of the tore around the front |
| **Rayon pipe** | *[float]* | Radius of the tore around the front |
| | ex: 5.00000 | |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **longueur mailles** | *[float]* | Length of the segments of the tore along crack front |
| **Longueur mailles** | *[float]* | Length of the segments of the tore along crack front |
| | ex: 5.00000 | |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **couronnes** | *[integer]* | Number of radial segment of the tore |
| **Couronnes** | *[integer]* | Number of radial segment of the tore |
| | ex: 5 | |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **secteurs** | *[integer]* | Number of sectors of the tore |
| **Secteurs** | *[integer]* | Number of sectors of the tore |
| | ex: 16 | |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **arete face | *[float]* | Mesh size of elements for the Box remeshing |
| **Triangles face | *[float]* | Mesh size of elements for the Box remeshing |
| fissure** | ex: 5.0000 | |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **repertoire de | *[string]* | Absolute address of the directory where files are |
| **pertoire de | *[string]* | Absolute address of the directory where files are |
| travail** | ex: /home/A123456 | saved |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **nom résultat** | *[string]* | Name of the resulting mesh |
| **Nom du résultat** | *[string]* | Name of the resulting mesh |
| | ex: maillage_fissure | |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **mode** | *[choice]* | Verbose mode for Salome messages |
| **Mode** | *[choice]* | Verbose mode for Salome messages |
| | ex: verbose | |
+----------------------+-----------------------------------+-------------------------------------------------------+
.. figure:: images/parametres_GUI.png
.. image:: images/parametres_GUI.png
:width: 350
:align: center
:alt: Tore parameters
Tore parameters
- **Exemple**: fills the panels with a test-case
- **Reset**: clears all the parameters
- **Précédent**: loads the last set of parameters used
@ -73,7 +80,7 @@ Inputs are similar to those of :ref:`script mode <script>`. GUI is accessible in
- **Sauver**: save a .dic file with the active parameters
- **Cancel**: exit GUI
- **Fermer**: exit GUI
- **Sauver**: Launch calculation
- **OK**: Launch calculation

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -6,9 +6,10 @@ For bended pipes
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.
.. figure:: images/Capture_GUI_pipes_2.png
.. image:: images/Capture_GUI_pipes_2.png
:width: 800
:align: center
:alt: Print screen of GUI
Print screen of GUI of the extension *Meshed Pipe with a crack*

View File

@ -10,7 +10,7 @@ In order to illustrate « Bloc Fissure » principle, the simple case of a crack
1. The first step consists in loading the structure mesh (a) as well as the crack surface geometry (b).
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).
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).
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).
@ -63,6 +63,7 @@ The length of influence is important. It defines the size of the extracted Box.
.. image:: images/longueur_influence.png
:width: 600
:align: center
:alt: The length of influence
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.
@ -90,6 +91,7 @@ For similar reasons, crack front edges must exceed from the structure mesh. The
.. image:: images/schema_lignes1.png
:scale: 80
:alt: Crack front edges
5) **Loss of element groups:**

View File

@ -15,10 +15,12 @@ The main command of « Bloc Fissure » is the casStandard function. It has a sin
| **maillageSain** | *[string]* | Absolute address of the input structure 3D mesh |
| | | in MED format |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **BrepFaceFissure** | *[string]* | Absolute address of the input crack geometry |
| | | in BREP format |
| **CAOFaceFissure** | *[string]* | Absolute address of the input crack geometry |
| | | in XAO or BREP format |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **edgeFissIds** | *[list of integers]* | List of edges number which define the crack front |
| **edgeFiss** | *[list of strings]* | List of edges group which define the crack front |
+----------------------+-----------------------------------+-------------------------------------------------------+
| | *[list of integers]* | List of edges number which define the crack front |
+----------------------+-----------------------------------+-------------------------------------------------------+
| **meshBrep** | *[list of 2 floats]* | List of two floats defining respectively minimum and |
| | | maximum size of elements of the crack mesh |
@ -47,6 +49,7 @@ Geometrical parameters of the tore are illustrated :
.. image:: images/parametres.png
:width: 350
:align: center
:alt: Geometrical parameters of the tore
Different levels of verbose are available. Use one of this 4 optional functions to set verbose type:
@ -68,8 +71,8 @@ Different levels of verbose are available. Use one of this 4 optional functions
dicoParams = dict(nomCas = 'cubeFiss',
maillageSain = "/home/A123456/BF/cube.med",
brepFaceFissure = "/home/A123456/BF/fiss.brep",
edgeFissIds = [4],
CAOFaceFissure = "/home/A123456/BF/fiss.xao",
edgeFiss = ["Fond"],
lgInfluence = 20.,
meshBrep = (5.,10.),
rayonPipe = 5.,

View File

@ -92,6 +92,8 @@ All 13 cases are shown Table 2. Two views show the whole cracked structure and a
| :width: 400 | :width: 400 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| tube |
+-------------------------------------------+----------------------------------------------+
.. _pipeTC:
@ -146,13 +148,13 @@ There is no need to generate them again.
2) **To execute only selected test cases**:
modify the file ``execution_Cas.py`` and change::
modify the file ``CasTests/execution_Cas.py`` and change::
runall = False. #old : True
And change from 0 to 1 of the index of the test you want to launch::
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]
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]
then launch the test cases::
@ -162,17 +164,17 @@ The index of each test is the position of the test in the following table, from
2 for cubeCoin... from top to bottom, then from left to right.
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeAngle | cylindre_2 | eprouvetteDroite_2 | fissureCoude_3 | fissureCoude_8 |
| cubeAngle | cylindre_2 | eprouvetteDroite_2 | fissureCoude_3 | fissureCoude_9 |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeAngle2 | disquePerce | faceGauche | fissureCoude_4 | fissureCoude_10 |
| cubeAngle2 | disquePerce | faceGauche | fissureCoude_4 | fissure_Coude |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeCoin | ellipse_1 | faceGauche_2 | fissure_Coude_4 | fissureCoude_10 |
| cubeCoin | ellipse_1 | faceGauche_2 | fissureCoude_5 | fissure_Coude_4 |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeMilieu | ellipse_2 | fissure_Coude | fissureCoude_5 | vis_1 |
| cubeMilieu | ellipse_2 | fissureCoude_1 | fissureCoude_6 | vis_1 |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeTransverse | eprouvetteCourbe | fissureCoude_1 | fissureCoude_6 | |
| cubeTransverse | eprouvetteCourbe | fissureCoude_10 | fissureCoude_7 | tube |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cylindre | eprouvetteDroite | fissureCoude_2 | fissureCoude_7 | |
| cylindre | eprouvetteDroite | fissureCoude_2 | fissureCoude_8 | |
+--------------------+--------------------+--------------------+-----------------+-----------------+
3) **To execute only one test case**::

View File

@ -26,10 +26,10 @@ initLog.setDebug()
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,

View File

@ -93,8 +93,8 @@ from blocFissure.gmu.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube2',
maillageSain = 'boite.med',
brepFaceFissure = "disk.brep",
edgeFissIds = [4],
CAOFaceFissure = "disk.brep",
edgeFiss = [4],
lgInfluence = 50,
meshBrep = (5,10),
rayonPipe = 15,

View File

@ -38,8 +38,8 @@ crack = 'fissureQuartEllipse.brep'
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,

View File

@ -31,6 +31,9 @@ SET(plugin_SCRIPTS
compoundFromList.py
construitEdgesRadialesDebouchantes.py
construitFissureGenerale.py
construitFissureGenerale_a.py
construitFissureGenerale_b.py
construitFissureGenerale_c.py
construitMaillagePipe.py
construitPartitionsPeauFissure.py
creePointsPipePeau.py
@ -72,6 +75,10 @@ SET(plugin_SCRIPTS
insereFissureElliptique.py
insereFissureGenerale.py
insereFissureLongue.py
insereFissureLongue_a.py
insereFissureLongue_b.py
insereFissureLongue_c.py
insereFissureLongue_d.py
listOfExtraFunctions.py
mailleAretesEtJonction.py
mailleFacesFissure.py

View File

@ -27,8 +27,8 @@ from .geomsmesh import smesh
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,
@ -42,24 +42,35 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
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)
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)
@ -72,16 +83,16 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
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:
@ -105,11 +116,11 @@ def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
# -----------------------------------------------------------------------
# --- 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)

View File

@ -17,6 +17,7 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
"""Cas standard"""
import os
from .geomsmesh import geompy, smesh
@ -28,9 +29,6 @@ import math
import GEOM
import SALOMEDS
import SMESH
#import StdMeshers
#import GHS3DPlugin
#import NETGENPlugin
import logging
from .fissureGenerique import fissureGenerique
@ -44,13 +42,14 @@ from .construitFissureGenerale import construitFissureGenerale
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):
@ -66,7 +65,7 @@ class casStandard(fissureGenerique):
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)
@ -117,19 +116,39 @@ class casStandard(fissureGenerique):
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]
@ -150,12 +169,13 @@ class casStandard(fissureGenerique):
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
# ---------------------------------------------------------------------------
@ -163,12 +183,13 @@ class casStandard(fissureGenerique):
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 \
)

View File

@ -25,12 +25,11 @@ from .geomsmesh import geomPublishInFather
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)

View File

@ -17,21 +17,20 @@
#
# 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
@ -95,7 +94,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
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]
@ -118,7 +117,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
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:
@ -134,7 +133,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
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:

View File

@ -17,49 +17,23 @@
#
# 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
@ -70,21 +44,21 @@ from .construitMaillagePipe import construitMaillagePipe
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:
@ -92,10 +66,6 @@ def construitFissureGenerale(maillagesSains,
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']
@ -103,26 +73,8 @@ def construitFissureGenerale(maillagesSains,
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]
@ -145,9 +97,6 @@ def construitFissureGenerale(maillagesSains,
if lgAretesVives == 0:
lgAretesVives = dmoyen
O, OX, OY, OZ = triedreBase()
# --- restriction de la face de fissure au domaine solide :
# partition face fissure étendue par fillings, on garde la face interne
@ -156,8 +105,10 @@ def construitFissureGenerale(maillagesSains,
# --- 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)
@ -174,71 +125,29 @@ def construitFissureGenerale(maillagesSains,
# 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)
@ -252,12 +161,12 @@ def construitFissureGenerale(maillagesSains,
# --- 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
@ -274,81 +183,34 @@ def construitFissureGenerale(maillagesSains,
# --- 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()

View File

@ -0,0 +1,49 @@
# -*- 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

View File

@ -0,0 +1,89 @@
# -*- 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

View File

@ -0,0 +1,124 @@
# -*- 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

View File

@ -17,6 +17,7 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
"""Maillage du pipe"""
import logging
@ -25,9 +26,7 @@ from .geomsmesh import smesh
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")
@ -39,13 +38,13 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
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
# -----------------------------------------------------------------------
@ -54,10 +53,10 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
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]
@ -72,23 +71,25 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
# --- 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)
@ -97,7 +98,7 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
# --- groupes faces debouchantes
if idisk == idisklim[0]:
faces = []
faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
@ -111,7 +112,7 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
faceCircPipe0Group.Add(faces)
if idisk == idisklim[1]:
faces = []
faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
@ -141,24 +142,24 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
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)
@ -172,16 +173,20 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
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 \
)
#if meshPipe:
#text = "Arrêt rapide.\n"
#logging.info(text)
#raise Exception(text)
return (meshPipe, meshPipeGroups, edgesCircPipeGroup)

View File

@ -34,8 +34,8 @@ from .checkDecoupePartition import checkDecoupePartition
# 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é
@ -43,22 +43,22 @@ def construitPartitionsPeauFissure(facesDefaut, fissPipe):
"""
logging.info('start')
partitionsPeauFissFond = []
partitionsPeauFissFond = list()
ipart = 0
for filling in facesDefaut:
part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
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

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import os
import logging
from .geomsmesh import smesh
import SMESH
@ -62,7 +64,7 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
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
@ -80,10 +82,10 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
[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)
@ -100,7 +102,7 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
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

View File

@ -30,55 +30,57 @@ from .fissError import fissError
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)
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:
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)
nb += 1
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):
texte = "La zone à remailler n'est pas détectée correctement.<br>"
@ -87,5 +89,5 @@ def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
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

View File

@ -18,6 +18,8 @@
# 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
@ -27,9 +29,6 @@ import math
import GEOM
import SALOMEDS
import SMESH
#import StdMeshers
#import GHS3DPlugin
#import NETGENPlugin
import logging
from .fissureGenerique import fissureGenerique
@ -48,7 +47,7 @@ class fissureCoude(fissureGenerique):
maillage hexa
"""
nomProbleme = "tuyau_Coude"
nomProbleme = "fissureCoude"
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
@ -70,6 +69,7 @@ class fissureCoude(fissureGenerique):
# ---------------------------------------------------------------------------
def genereGeometrieSaine(self, geomParams):
"""a écrire"""
logging.info("genereGeometrieSaine %s", self.nomCas)
angleCoude = geomParams['angleCoude']
@ -293,16 +293,23 @@ class fissureCoude(fissureGenerique):
smesh.SetName(algo1d_long_p2, "algo1d_long_p2")
smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2")
isDone = maillageSain.Compute()
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)
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.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
@ -335,7 +342,8 @@ class fissureCoude(fissureGenerique):
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)
@ -643,7 +651,8 @@ class fissureCoude(fissureGenerique):
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]
@ -656,7 +665,7 @@ class fissureCoude(fissureGenerique):
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,
@ -669,12 +678,13 @@ class fissureCoude(fissureGenerique):
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
# ---------------------------------------------------------------------------
@ -687,4 +697,3 @@ class fissureCoude(fissureGenerique):
Entity_Quad_Hexa = 8994,
Entity_Quad_Penta = 972,
Entity_Quad_Pyramid = 1038)

View File

@ -17,70 +17,96 @@
#
# 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
@ -95,24 +121,21 @@ class fissureGenerique():
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

View File

@ -32,7 +32,8 @@ from .genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
# -----------------------------------------------------------------------------
# --- création élements géométriques fissure elliptique
def genereElemsFissureElliptique(shapeFissureParams):
def genereElemsFissureElliptique(shapeFissureParams, \
mailleur="MeshGems"):
"""
TODO: a completer
"""
@ -49,7 +50,7 @@ def genereElemsFissureElliptique(shapeFissureParams):
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
@ -70,6 +71,7 @@ def genereElemsFissureElliptique(shapeFissureParams):
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

View File

@ -25,10 +25,17 @@ from salome.smesh import smeshBuilder
# -----------------------------------------------------------------------------
# --- 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)
@ -37,12 +44,24 @@ def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
[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
dans une liste sous la forme : [X0, Y0, Z0, ..., Xn, Yn, Zn]"""
logging.info('start')
meshFissure = smesh.Mesh(facefiss)
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 )
@ -51,15 +70,26 @@ def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
hypo2d.SetFineness( 2 )
hypo2d.SetMinSize( minSize )
hypo2d.SetQuadAllowed( 0 )
isDone = meshFissure.Compute()
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

View File

@ -17,60 +17,74 @@
#
# 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)
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
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:
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")
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_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
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:
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
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)
return ok_maillage

View File

@ -31,23 +31,21 @@ from .fissError import fissError
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):
@ -110,7 +108,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
# --- 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()
@ -127,7 +125,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
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:
@ -138,9 +136,9 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
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)

View File

@ -26,9 +26,9 @@ from .trouveEdgesFissPeau import trouveEdgesFissPeau
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):
"""
"""

View File

@ -26,42 +26,47 @@ from .geomsmesh import geomPublishInFather
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")

View File

@ -17,6 +17,9 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
"""Insertion d'une fissure elliptique"""
import os
import logging
import salome
@ -44,8 +47,8 @@ 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
@ -81,8 +84,8 @@ def insereFissureElliptique(geometriesSaines, maillagesSains,
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]
@ -130,11 +133,10 @@ def insereFissureElliptique(geometriesSaines, maillagesSains,
if step == 7:
return None
[blocPartition, blocp, tore,
[ blocPartition, blocp, tore, \
faceFissure, facesExternes, facesExtBloc, facesExtElli,
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1,
facefis1, ellipsoide1)
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
@ -191,11 +193,11 @@ def insereFissureElliptique(geometriesSaines, maillagesSains,
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,
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)
nbsegFis, dmoyen, lensegEllipsoide) \
if step == 16:
return None

View File

@ -18,6 +18,10 @@
# 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
@ -35,36 +39,28 @@ 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 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
@ -100,8 +96,8 @@ def insereFissureGenerale(maillagesSains,
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]
@ -125,7 +121,7 @@ def insereFissureGenerale(maillagesSains,
# --- 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:
@ -195,18 +191,18 @@ def insereFissureGenerale(maillagesSains,
# 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)
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:
@ -217,8 +213,8 @@ def insereFissureGenerale(maillagesSains,
# --- 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):
@ -243,19 +239,19 @@ def insereFissureGenerale(maillagesSains,
# 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:
@ -272,14 +268,14 @@ def insereFissureGenerale(maillagesSains,
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:
@ -292,20 +288,20 @@ def insereFissureGenerale(maillagesSains,
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
#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]
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)
@ -372,7 +368,7 @@ def insereFissureGenerale(maillagesSains,
# --- 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()
@ -383,7 +379,7 @@ def insereFissureGenerale(maillagesSains,
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:
@ -394,9 +390,9 @@ def insereFissureGenerale(maillagesSains,
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)
@ -406,7 +402,6 @@ def insereFissureGenerale(maillagesSains,
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)
@ -416,8 +411,8 @@ def insereFissureGenerale(maillagesSains,
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)
@ -434,9 +429,9 @@ def insereFissureGenerale(maillagesSains,
# 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"])
@ -459,20 +454,20 @@ def insereFissureGenerale(maillagesSains,
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)
@ -494,9 +489,7 @@ def insereFissureGenerale(maillagesSains,
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)
@ -504,10 +497,10 @@ def insereFissureGenerale(maillagesSains,
[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)
@ -515,9 +508,9 @@ def insereFissureGenerale(maillagesSains,
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
@ -528,8 +521,9 @@ def insereFissureGenerale(maillagesSains,
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
@ -543,10 +537,6 @@ def insereFissureGenerale(maillagesSains,
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)
@ -566,13 +556,12 @@ def insereFissureGenerale(maillagesSains,
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
@ -613,7 +602,7 @@ def insereFissureGenerale(maillagesSains,
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:
@ -631,7 +620,6 @@ def insereFissureGenerale(maillagesSains,
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]
edRadFPiPo[ifil] = edgeRadFacePipePeau # pour chaque face [edge radiale des faces du pipe débouchantes ]
@ -656,9 +644,9 @@ def insereFissureGenerale(maillagesSains,
# --- 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]
@ -667,12 +655,12 @@ def insereFissureGenerale(maillagesSains,
# 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]
@ -705,7 +693,7 @@ def insereFissureGenerale(maillagesSains,
for edff in edgesFondFiss:
lenEdgeFondExt += geompy.BasicProperties(edff)[0]
disfond = []
disfond = list()
for filling in facesDefaut:
disfond.append(geompy.MinDistance(centreFondFiss, filling))
disfond.sort()
@ -720,7 +708,15 @@ def insereFissureGenerale(maillagesSains,
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()
@ -735,16 +731,16 @@ def insereFissureGenerale(maillagesSains,
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:
@ -768,11 +764,11 @@ def insereFissureGenerale(maillagesSains,
# -----------------------------------------------------------------------
# --- 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)
@ -812,22 +808,22 @@ def insereFissureGenerale(maillagesSains,
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:
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
@ -862,11 +858,11 @@ def insereFissureGenerale(maillagesSains,
# --- 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:
@ -901,14 +897,14 @@ def insereFissureGenerale(maillagesSains,
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
@ -922,9 +918,9 @@ def insereFissureGenerale(maillagesSains,
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]
@ -946,18 +942,18 @@ def insereFissureGenerale(maillagesSains,
# --- 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):
@ -978,13 +974,12 @@ def insereFissureGenerale(maillagesSains,
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))
@ -1006,9 +1001,9 @@ def insereFissureGenerale(maillagesSains,
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
@ -1043,13 +1038,13 @@ def insereFissureGenerale(maillagesSains,
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
# -----------------------------------------------------------------------
@ -1058,17 +1053,17 @@ def insereFissureGenerale(maillagesSains,
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)
@ -1076,24 +1071,24 @@ def insereFissureGenerale(maillagesSains,
# --- 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)
@ -1101,7 +1096,7 @@ def insereFissureGenerale(maillagesSains,
# --- groupes faces debouchantes
if idisk == idisklim[0]:
faces = []
faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
@ -1115,7 +1110,7 @@ def insereFissureGenerale(maillagesSains,
faceCircPipe0Group.Add(faces)
if idisk == idisklim[1]:
faces = []
faces = list()
for j in range(nbsegRad):
for k in range(nbsegCercle):
k1 = k+1
@ -1145,15 +1140,15 @@ def insereFissureGenerale(maillagesSains,
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:
@ -1173,16 +1168,16 @@ def insereFissureGenerale(maillagesSains,
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)
@ -1197,16 +1192,24 @@ def insereFissureGenerale(maillagesSains,
# --- 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() )
@ -1216,6 +1219,16 @@ def insereFissureGenerale(maillagesSains,
logging.debug("---------------------------- maillage faces de fissure externes au pipe :%s --------------", len(facesFissExt))
meshFaceFiss = smesh.Mesh(faceFissureExterne)
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 )
@ -1234,13 +1247,19 @@ def insereFissureGenerale(maillagesSains,
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)]
@ -1249,7 +1268,7 @@ def insereFissureGenerale(maillagesSains,
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
@ -1311,9 +1330,19 @@ def insereFissureGenerale(maillagesSains,
putName(algo1d, "algo1d_" + name, ifil)
putName(hypo1d, "hypo1d_" + name, ifil)
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 )
hypo2d.SetMaxSize( dmoyen*0.75 )
hypo2d.SetOptimize( 1 )
hypo2d.SetFineness( 2 )
hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
@ -1322,8 +1351,15 @@ def insereFissureGenerale(maillagesSains,
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)
@ -1351,20 +1387,31 @@ def insereFissureGenerale(maillagesSains,
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")
@ -1377,7 +1424,7 @@ def insereFissureGenerale(maillagesSains,
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']
@ -1388,7 +1435,7 @@ def insereFissureGenerale(maillagesSains,
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)

View File

@ -17,6 +17,9 @@
#
# 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
@ -44,20 +47,22 @@ from .shapeSurFissure import shapeSurFissure
from .regroupeSainEtDefaut import RegroupeSainEtDefaut
from .triedreBase import triedreBase
# -----------------------------------------------------------------------------
# --- procedure complete fissure longue
from .insereFissureLongue_a import insereFissureLongue_a
from .insereFissureLongue_b import insereFissureLongue_b
from .insereFissureLongue_c import insereFissureLongue_c
from .insereFissureLongue_d import insereFissureLongue_d
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
@ -79,8 +84,8 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
#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]
@ -110,7 +115,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- 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)
@ -149,7 +154,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
[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
@ -159,7 +164,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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)
@ -186,7 +191,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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)
@ -201,9 +206,9 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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)
@ -216,7 +221,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- 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)
@ -253,13 +258,13 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
[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')
@ -269,7 +274,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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):
@ -305,8 +310,8 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# 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])
@ -316,13 +321,13 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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)
@ -339,9 +344,9 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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)
@ -353,7 +358,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- faces fissure dans le pipe
facesFissinPipe = []
facesFissinPipe = list()
generFissId = getSubshapeIds(pipeFondFiss, generFiss)
logging.debug("generatrice fissure %s", generFissId)
for face in facesPipeOnplan:
@ -374,7 +379,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- edges de fond de fissure
edgesFondFiss = []
edgesFondFiss = list()
for i, edge in enumerate(edgesInside):
anEdge = geompy.GetInPlace(pipeFondFiss, edge)
logging.debug(" edge %s ", anEdge)
@ -393,7 +398,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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)
@ -408,216 +413,33 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- 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")
meshFaceFiss = \
insereFissureLongue_c ( faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_generFiss, groupEdgesFaceFissPipe, \
profondeur, rayonPipe, \
mailleur )
grp = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE)
# --- maillage meshBoiteDefaut
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
meshBoiteDefaut, group_faceFissInPipe, group_faceFissOutPipe = \
insereFissureLongue_d ( internalBoundary, meshFondFiss, meshFacePeau, meshFaceFiss, \
mailleur )
# 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")
groups = maillageSain.GetGroups()
grps1 = [ grp for grp in groups if grp.GetName() == 'P1']

View File

@ -0,0 +1,145 @@
# -*- 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

View File

@ -0,0 +1,105 @@
# -*- 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

View File

@ -0,0 +1,84 @@
# -*- 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

View File

@ -0,0 +1,79 @@
# -*- 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

View File

@ -50,7 +50,8 @@ def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
# --- 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()
@ -58,8 +59,16 @@ def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
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() )

View File

@ -27,14 +27,24 @@ 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)
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 )
@ -47,17 +57,25 @@ def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFi
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)
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)

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
"""maillage faces de peau"""
import logging
from .geomsmesh import geompy
@ -30,22 +32,23 @@ import SMESH
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
@ -68,14 +71,15 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
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)
@ -84,6 +88,7 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
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)
@ -98,8 +103,9 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
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:
@ -109,6 +115,17 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
putName(algo1d, "algo1d_" + name, ifil)
putName(hypo1d, "hypo1d_" + name, ifil)
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 )
@ -116,14 +133,22 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
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

View File

@ -29,12 +29,13 @@ from .putName import putName
# -----------------------------------------------------------------------------
# --- 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')
@ -43,7 +44,7 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -54,8 +55,8 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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()
@ -64,8 +65,8 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -89,28 +90,28 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -128,22 +129,22 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -158,11 +159,11 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -171,8 +172,8 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -185,8 +186,6 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -194,33 +193,40 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)
@ -230,6 +236,13 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
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)

View File

@ -32,7 +32,7 @@ def orderEdgesFromWire(aWire):
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]
@ -46,7 +46,7 @@ def orderEdgesFromWire(aWire):
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()):
@ -63,7 +63,7 @@ def orderEdgesFromWire(aWire):
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)))
@ -82,9 +82,9 @@ def orderEdgesFromWire(aWire):
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

View File

@ -31,53 +31,65 @@ from .fusionMaillageAttributionDefaut import fusionMaillageDefaut
# --- 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()
#print ("info = {}".format(info))
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) :
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 ])
@ -86,8 +98,8 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones):
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)

View File

@ -36,38 +36,39 @@ from .listOfExtraFunctions import createLinesFromMesh
# -----------------------------------------------------------------------------
# --- groupe de quadrangles de face transformé en face géométrique par filling
def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, centreFondFiss, listOfCorners):
def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, listOfCorners):
""" """
# TODO: rédiger la docstring
logging.info("start")
#fillings = [[], []]
tmpFillings = []
noeuds_bords = []
#bords_Partages = [[], []]
tmpBords = []
fillconts = []
idFilToCont = []
#fillings = [list(), list()]
tmpFillings = list()
noeuds_bords = list()
#bords_Partages = [list(), list()]
tmpBords = list()
fillconts = list()
idFilToCont = list()
facesNonCoupees = []
facesCoupees = []
aretesNonCoupees = []
aretesCoupees = []
facesNonCoupees = list()
facesCoupees = list()
aretesNonCoupees = list()
aretesCoupees = list()
setOfNodes = []
setOfLines = []
listOfEdges = []
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, listOfCorners[0])
lines = createLinesFromMesh(msh)
setOfNodes.append(lines)
for face in setOfNodes:
tmpFace = []
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
@ -83,7 +84,7 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, cent
# 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))
geomPublish(initLog.debug, filling, 'filling_{}'.format(i + 1))
tmpFillings.append(filling)
for face in setOfNodes:
@ -98,26 +99,26 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, cent
tmpBords.append(line)
for i, filling in enumerate(tmpFillings):
tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
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_{0}".format(i + 1))
geomPublish(initLog.debug, filling, "faceNonCoupee_{}".format(i + 1))
facesNonCoupees.append(filling)
else:
geomPublish(initLog.debug, filling, "faceCoupee_{0}".format(i + 1))
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], [], [], geompy.ShapeType["SHELL"], 0, [], 0, True)
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_{0}".format(i + 1))
geomPublish(initLog.debug, filling, "areteNonCoupee_{}".format(i + 1))
aretesNonCoupees.append(filling)
else:
geomPublish(initLog.debug, filling, "areteCoupee_{0}".format(i + 1))
geomPublish(initLog.debug, filling, "areteCoupee_{}".format(i + 1))
aretesCoupees.append(filling)
bords_Partages = aretesCoupees, aretesNonCoupees
@ -133,4 +134,3 @@ def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, cent
# geompy.addToStudyInFather(filling, line, 'line_{0}'.format(j + 1))
return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont

View File

@ -18,17 +18,17 @@
# 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')
@ -36,22 +36,26 @@ def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGe
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:
@ -65,39 +69,46 @@ def RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceGe
# 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

View File

@ -28,8 +28,8 @@ import traceback
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')
@ -39,7 +39,7 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
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:
@ -52,7 +52,7 @@ def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
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")

View File

@ -18,20 +18,17 @@
# 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]

View File

@ -18,20 +18,17 @@
# 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]

View File

@ -18,12 +18,12 @@
#
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)

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import os
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_ihm(fissureCoude):
@ -32,8 +34,8 @@ 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
@ -41,26 +43,26 @@ class fissureCoude_ihm(fissureCoude):
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)
@ -74,41 +76,43 @@ class fissureCoude_ihm(fissureCoude):
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 \
)

View File

@ -22,6 +22,7 @@
# 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
@ -34,7 +35,6 @@ def fissureCoudeDlg(context):
study = context.study
sg = context.sg
import os
#import subprocess
#import tempfile
from qtsalome import QFileDialog, QMessageBox, QPalette, QColor, QDialog
@ -83,35 +83,35 @@ def fissureCoudeDlg(context):
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):
@ -221,13 +221,13 @@ def fissureCoudeDlg(context):
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:
@ -255,7 +255,7 @@ def fissureCoudeDlg(context):
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
@ -308,35 +308,35 @@ def fissureCoudeDlg(context):
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
@ -369,10 +369,10 @@ def fissureCoudeDlg(context):
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'])
@ -385,8 +385,6 @@ def fissureCoudeDlg(context):
self.NOK = NOK
self.accept()
pass
# ----------------------------------------------------------------------------
window = fissureCoudeDialog()
@ -402,5 +400,4 @@ def fissureCoudeDlg(context):
retry = window.checkValues()
else:
print("dialog rejected, exit")
pass

View File

@ -7,20 +7,20 @@
<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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Insertion d'un maillage de fissure dans un maillage hexaédrique sain.&lt;/p&gt;&lt;p&gt;Le maillage sain est fourni sous forme de fichier med.&lt;/p&gt;&lt;p&gt;La face de fissure est décrite par une géométrie dans un fichier brep.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Insertion d'un maillage de fissure dans un maillage hexaédrique sain.&lt;/p&gt;&lt;p&gt;Le maillage sain est fourni sous forme de fichier med.&lt;/p&gt;&lt;p&gt;La face de fissure est décrite par une géométrie dans un fichier de cao au format xao ou brep.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt; 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.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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">
@ -28,14 +28,14 @@
<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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Index des arêtes décrivant le fond de fissure, dans la face de fissure.&lt;/p&gt;&lt;p&gt;Sous forme d'une liste Python.&lt;/p&gt;&lt;p&gt;Exemples : &lt;span style=&quot; font-weight:600; font-style:italic; color:#000080;&quot;&gt;[5,9]&lt;/span&gt; ou&lt;span style=&quot; font-weight:600;&quot;/&gt;&lt;span style=&quot; font-weight:600; font-style:italic; color:#000080;&quot;&gt;[3]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;(On peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Liste des noms des groupes d'arêtes formant le fond de la fissure.&lt;/p&gt;&lt;p&gt;Exemples : &lt;span style=&quot; font-weight:600; font-style:italic; color:#000080;&quot;&gt;["F_1", "F_2"]&lt;/span&gt; ou&lt;span style=&quot; font-weight:600;&quot;/&gt;&lt;span style=&quot; font-weight:600; font-style:italic; color:#000080;&quot;&gt;["Fond"]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Ou liste des index des arêtes décrivant le fond de fissure dans la face de fissure.&lt;/p&gt;&lt;p&gt;Exemples : &lt;span style=&quot; font-weight:600; font-style:italic; color:#000080;&quot;&gt;[5,9]&lt;/span&gt; ou&lt;span style=&quot; font-weight:600;&quot;/&gt;&lt;span style=&quot; font-weight:600; font-style:italic; color:#000080;&quot;&gt;[3]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;(On peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -66,7 +66,7 @@
<item row="1" column="0">
<widget class="QPushButton" name="pb_facefiss">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;sélection du fichier brep (géométrie) décrivant la face de fissure.&lt;/p&gt;&lt;p&gt;Un champ rouge correspond à un fichier inexistant.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;sélection du fichier cao (format xao ou brep) décrivant la face de fissure.&lt;/p&gt;&lt;p&gt;Un champ rouge correspond à un fichier inexistant.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Face fissure</string>
@ -76,7 +76,7 @@
<item row="1" column="1">
<widget class="QLineEdit" name="le_facefiss">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fichier brep de la géométrie décrivant la face de fissure.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fichier cao de la géométrie décrivant la face de fissure (xao ou brep).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -110,7 +110,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Distance influence</string>
<string>Distance d'influence</string>
</property>
</widget>
</item>
@ -209,7 +209,7 @@
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>mode</string>
<string>Mode</string>
</property>
</widget>
</item>
@ -499,7 +499,7 @@
<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>

View File

@ -19,15 +19,17 @@
# 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
@ -44,6 +46,7 @@ def fissureGeneraleDlg(context):
from blocFissure.ihm.fissureGenerale_ui import Ui_Dialog
class fissureGeneraleDialog(QtWidgets.QDialog):
"""classe du dialogue"""
def __init__(self):
print("__init__")
@ -75,28 +78,28 @@ def fissureGeneraleDlg(context):
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])
@ -112,8 +115,7 @@ def fissureGeneraleDlg(context):
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
@ -122,25 +124,40 @@ def fissureGeneraleDlg(context):
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:
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)
edgeFissIdsOK=True
try:
l = dico['edgeFissIds']
for i in l:
if not isinstance(i, int):
print("not isinstance(i, int)")
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
edgeFissIdsOK=False
break
except:
print("except eval")
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
if edgeFissIdsOK:
edgeFissOK=False
else:
incomplet = True
edgeFissOK=False
if edgeFissOK:
self.ui.le_fondfiss.setPalette(self.blackPalette)
else:
self.ui.le_fondfiss.setPalette(self.redPalette)
@ -174,19 +191,19 @@ def fissureGeneraleDlg(context):
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 ---")
@ -198,8 +215,8 @@ def fissureGeneraleDlg(context):
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)
@ -220,7 +237,6 @@ def fissureGeneraleDlg(context):
elif index == 2:
initLog.setDebug(logfile)
def sauver(self):
print("sauver")
fileDiag = QFileDialog(self)
@ -234,8 +250,8 @@ def fissureGeneraleDlg(context):
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")
@ -248,8 +264,8 @@ def fissureGeneraleDlg(context):
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)
@ -306,21 +322,21 @@ def fissureGeneraleDlg(context):
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
@ -366,8 +382,6 @@ def fissureGeneraleDlg(context):
self.ui.lb_calcul.hide()
#self.accept()
pass
# ----------------------------------------------------------------------------
print("main")
@ -383,5 +397,3 @@ def fissureGeneraleDlg(context):
retry = window.checkValues()
else:
print("dialog rejected, exit")
pass

View File

@ -34,8 +34,8 @@ crack = 'fissureSoudureTest.brep'
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,

View File

@ -34,8 +34,8 @@ crack = 'fissureSoudureTest.brep'
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,

View File

@ -34,8 +34,8 @@ crack = 'hue.brep'
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,

View File

@ -34,6 +34,7 @@ SET(plugin_SCRIPTS
fissureGauche2.py
fissureGauche.py
genereMateriel.py
tube.py
vis.py
)

View File

@ -18,31 +18,32 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import sys
"""Cas-test de blocFissure pour un cube"""
import logging
import os
from blocFissure import gmu
import salome
import GEOM
from salome.geom import geomBuilder
import SMESH
from salome.smesh import smeshBuilder
#=============== Options ====================
# 1. NOM_OBJET = nom de l'objet
NOM_OBJET = "CubeAngle"
#============================================
salome.salome_init()
import salome_notebook
import os
from blocFissure import gmu
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
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)
@ -51,10 +52,7 @@ Vertex_2 = geompy.MakeVertex(-5, -5, 90)
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' )
@ -62,29 +60,42 @@ geompy.addToStudy( Disk_1, 'Disk_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')

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import logging
import sys
import salome
@ -109,9 +111,9 @@ geompy.addToStudy( O_1, 'O' )
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
@ -127,10 +129,18 @@ Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
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')
@ -140,7 +150,7 @@ smesh.SetName(ENCASTR_1, 'ENCASTR')
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()

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import logging
import sys
import salome
@ -79,14 +81,14 @@ FissInCylindre = geompy.MakeFaceWires([Curve_2, Arc_1], 1)
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' )
@ -148,6 +150,7 @@ smeshObj_1 = smesh.CreateHypothesis('NumberOfSegments')
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 )
@ -159,9 +162,17 @@ Nb_Segments_2.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()

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import logging
import sys
import salome
@ -76,6 +78,7 @@ from salome.smesh import smeshBuilder
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 )
@ -86,9 +89,17 @@ Nb_Segments_2.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()

View File

@ -71,7 +71,7 @@ geompy.addToStudy( Vertex_4, 'Vertex_4' )
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():

View File

@ -51,7 +51,7 @@ Vertex_2 = geompy.MakeVertex(98, -2, -2)
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' )

View File

@ -69,7 +69,7 @@ geompy.addToStudy( Box_1, 'Box_1' )
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():

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import logging
import sys
import salome
@ -60,7 +62,7 @@ EprouvetteCourbe = geompy.MakeCut(Common_1, Cylinder_3)
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' )
@ -92,6 +94,7 @@ from salome.smesh import smeshBuilder
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 )
@ -103,9 +106,17 @@ Nb_Segments_2.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()

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import logging
import sys
import salome
@ -61,8 +63,8 @@ Plane_2 = geompy.MakePlane(Vertex_1, Line_1, 2000)
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)
@ -79,8 +81,8 @@ Line_7 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_6)
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' )
@ -126,6 +128,7 @@ from salome.smesh import smeshBuilder
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 )
@ -137,9 +140,17 @@ Nb_Segments_2.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()

View File

@ -18,6 +18,8 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import logging
import sys
import salome
@ -76,7 +78,7 @@ Box_2 = geompy.MakeBoxTwoPnt(Vertex_7, Vertex_6)
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' )
@ -121,6 +123,7 @@ from salome.smesh import smeshBuilder
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 )
@ -132,9 +135,17 @@ Nb_Segments_2.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()

Some files were not shown because too many files have changed in this diff Show More