Merge from V7_3_BR (09/01/2014)

This commit is contained in:
vsr 2014-01-09 14:20:44 +00:00
parent 2cd148d066
commit 072a73120b
121 changed files with 12657 additions and 6 deletions

View File

@ -69,9 +69,12 @@
#include "SMESH_TryCatch.hxx" // include after OCCT headers!
#include "Utils_ExceptHandlers.hxx"
#ifndef WIN32
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
#else
#include <pthread.h>
#endif
using namespace std;
@ -139,11 +142,23 @@ SMESH_Mesh::SMESH_Mesh():
namespace
{
void deleteMeshDS(SMESHDS_Mesh* meshDS)
#ifndef WIN32
void deleteMeshDS(SMESHDS_Mesh* meshDS)
{
//cout << "deleteMeshDS( " << meshDS << endl;
delete meshDS;
}
#else
static void* deleteMeshDS(void* meshDS)
{
//cout << "deleteMeshDS( " << meshDS << endl;
SMESHDS_Mesh* m = (SMESHDS_Mesh*)meshDS;
if(m) {
delete m;
}
return 0;
}
#endif
}
//=============================================================================
@ -191,9 +206,15 @@ SMESH_Mesh::~SMESH_Mesh()
_myDocument->RemoveMesh( _id );
_myDocument = 0;
if ( _myMeshDS )
// delete _myMeshDS, in a thread in order not to block closing a study with large meshes
if ( _myMeshDS ) {
// delete _myMeshDS, in a thread in order not to block closing a study with large meshes
#ifndef WIN32
boost::thread aThread(boost::bind( & deleteMeshDS, _myMeshDS ));
#else
pthread_t thread;
int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_myMeshDS);
#endif
}
}
//================================================================================

View File

@ -748,10 +748,12 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget
QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this );
QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this );
nbNodesLabel = new QLabel("0", this );
nbElemsLabel = new QLabel("0", this );
#ifndef WIN32
QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this );
freeRAMLabel = new QLabel("", this );
#endif
progressBar = new QProgressBar(this);
progressBar->setMinimum( 0 );
progressBar->setMaximum( 1000 );

View File

@ -20,6 +20,7 @@
ADD_SUBDIRECTORY(MeshCut)
ADD_SUBDIRECTORY(padder)
ADD_SUBDIRECTORY(Verima)
ADD_SUBDIRECTORY(blocFissure)
IF(SALOME_BUILD_GUI)
ADD_SUBDIRECTORY(MGCleanerPlug)

View File

@ -0,0 +1,40 @@
# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
#
# 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.
#
# 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
#
ADD_SUBDIRECTORY(CasTests)
ADD_SUBDIRECTORY(gmu)
ADD_SUBDIRECTORY(materielCasTests)
IF(SALOME_BUILD_GUI)
ADD_SUBDIRECTORY(ihm)
ENDIF(SALOME_BUILD_GUI)
# --- scripts ---
# scripts / static
SET(plugin_SCRIPTS
__init__.py
casStandard.py
exemple.py
exemple2.py
)
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure)

View File

@ -0,0 +1,55 @@
# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
#
# 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.
#
# 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
#
# --- scripts ---
# scripts / static
SET(plugin_SCRIPTS
__init__.py
cubeAngle2.py
cubeAngle.py
cylindre_2.py
cylindre.py
disquePerce.py
ellipse_1.py
ellipse_2.py
eprouvetteCourbe.py
eprouvetteDroite_2.py
eprouvetteDroite.py
execution_Cas.py
faceGauche_2.py
faceGauche.py
fissureCoude_10.py
fissureCoude_1.py
fissureCoude_2.py
fissureCoude_3.py
fissure_Coude_4.py
fissureCoude_4.py
fissureCoude_5.py
fissureCoude_6.py
fissureCoude_7.py
fissureCoude_8.py
fissureCoude_9.py
fissure_Coude.py
vis_1.py
)
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/CasTests)

View File

@ -0,0 +1,103 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class cubeAngle(fissureGenerique):
"""
problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan
"""
nomProbleme = "cubeAngle"
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 20,
rayonPipe = 10)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [4])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 10)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
from cubeAngle import cubeAngle
class cubeAngle2(cubeAngle):
"""
problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan
detection d'un probleme de tolerance sur les edges de jonction pipe et face fissure externe
"""
nomProbleme = "cubeAngle2"
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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
"""
self.shapeFissureParams = dict(lgInfluence = 20,
rayonPipe = 5)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
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)

View File

@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class cylindre(fissureGenerique):
"""
problème de fissure plane sur cylindre, grand fond de fissure en arc de cercle
"""
nomProbleme = "cylindre"
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
"""
génère le maillage de l'objet sain, par chargement d'un fichier med
ici, les paramètres de géométrie et de maillage ne sont pas utiles
"""
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/CylindreSain.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 20,
rayonPipe = 5)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [7])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,15)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 20)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
import os
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
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.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class cylindre_2(cylindre):
"""
problème de fissure plane sur cylindre hexa, fond de fissure complexe : polyline
"""
nomProbleme = "cylindre2"
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"), "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 ,15)
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)

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
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 = [4],
lgInfluence = 10,
meshBrep = (0.5,2.5),
rayonPipe = 1.0,
lenSegPipe = 1.5,
nbSegRad = 6,
nbSegCercle = 16,
areteFaceFissure = 2.5)
# ---------------------------------------------------------------------------
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)

View File

@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class ellipse_1(fissureGenerique):
"""
problème de fissure non plane, débouchante non normale
"""
nomProbleme = "ellipse1"
# # ---------------------------------------------------------------------------
# def genereGeometrieSaine(self, geomParams):
# logging.info("genereGeometrieSaine %s", self.nomCas)
# box = geompy.MakeBox(0, -500, 0, 400, 500, 800, "boiteSaine")
# return [box]
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = 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 insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 50,
rayonPipe = 20)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [4])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 1000)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
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 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.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class ellipse_2(ellipse_1):
"""
problème de fissure non plane, débouchante non normale
"""
nomProbleme = "ellipse2"
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [4])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25)
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)

View File

@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class eprouvetteCourbe(fissureGenerique):
"""
problème de fissure plane coupant 3 faces (éprouvette), faces au débouché non planes, incidence presque normale
"""
nomProbleme = "eprouvetteCourbe"
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbe.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 30,
rayonPipe = 10)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"), "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)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 15)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-
import os
from blocFissure import gmu
from blocFissure.gmu.geomsmesh import geompy, smesh
import os
import math
import GEOM
import SALOMEDS
import SMESH
#import StdMeshers
#import GHS3DPlugin
#import NETGENPlugin
import logging
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.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class eprouvetteDroite(fissureGenerique):
"""
problème de fissure plane coupant 3 faces (éprouvette), débouches normaux, objet plan
"""
nomProbleme = "eprouvetteDroite"
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/eprouvetteDroite.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 30,
rayonPipe = 10,
lenSegPipe = 6)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"), "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)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 15)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
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.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class eprouvetteDroite_2(eprouvetteDroite):
"""
problème de fissure plane coupant 3 faces (éprouvette), débouches non normaux, objet plan
"""
nomProbleme = "eprouvetteDroite2"
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"), "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)
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)

View File

@ -0,0 +1,127 @@
# -*- coding: utf-8 -*-
import sys, traceback
from blocFissure import gmu
from blocFissure.gmu import initLog
#initLog.setDebug()
initLog.setVerbose()
from blocFissure.gmu import geomsmesh
from blocFissure.casStandard import casStandard
problemes = []
cas=0
from blocFissure.CasTests.fissure_Coude import fissure_Coude
problemes.append(fissure_Coude(cas))
cas=1
from blocFissure.CasTests.faceGauche import faceGauche
problemes.append(faceGauche(cas))
cas=2
from blocFissure.CasTests.faceGauche_2 import faceGauche_2
problemes.append(faceGauche_2(cas))
cas=3
from blocFissure.CasTests.ellipse_1 import ellipse_1
problemes.append(ellipse_1(cas))
cas=4
from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
problemes.append(fissure_Coude_4(cas))
cas=5
from blocFissure.CasTests.cylindre import cylindre
problemes.append(cylindre(cas))
cas=6
from blocFissure.CasTests.cylindre_2 import cylindre_2
problemes.append(cylindre_2(cas))
cas=7
from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
problemes.append(eprouvetteCourbe(cas))
cas=8
from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
problemes.append(eprouvetteDroite(cas))
cas=9
from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
problemes.append(eprouvetteDroite_2(cas))
cas=10
from blocFissure.CasTests.cubeAngle import cubeAngle
problemes.append(cubeAngle(cas))
cas=11
from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
problemes.append(fissureCoude_1(cas))
cas=12
from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
problemes.append(fissureCoude_2(cas))
cas=13
from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
problemes.append(fissureCoude_3(cas))
cas=14
from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
problemes.append(fissureCoude_4(cas))
cas=15
from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
problemes.append(fissureCoude_5(cas))
cas=16
from blocFissure.CasTests.ellipse_2 import ellipse_2
problemes.append(ellipse_2(cas))
cas=17
from blocFissure.CasTests.cubeAngle2 import cubeAngle2
problemes.append(cubeAngle2(cas))
cas=18
from blocFissure.CasTests import disquePerce
problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, cas))
cas=19
from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
problemes.append(fissureCoude_6(cas))
cas=20
from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
problemes.append(fissureCoude_7(cas))
cas=21
from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
problemes.append(fissureCoude_8(cas))
cas=22
from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
problemes.append(fissureCoude_9(cas))
cas=23
from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
problemes.append(fissureCoude_10(cas))
cas=24
from blocFissure.CasTests.vis_1 import vis_1
problemes.append(vis_1(cas))
# ---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,]
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
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,]
for i in range(len(problemes)):
if torun[i]:
try:
problemes[i].executeProbleme()
except:
traceback.print_exc()
print "---------------------------------------------------------------------"

View File

@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class faceGauche(fissureGenerique):
"""
problème de fissure non plane, débouchante non normale
"""
nomProbleme = "faceGauche"
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheSain.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 300,
rayonPipe = 20)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"), "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)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 1000)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,106 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class faceGauche_2(fissureGenerique):
"""
problème de fissure non plane, débouchante non normale
"""
nomProbleme = "faceGauche2"
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = 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 insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 100,
rayonPipe = 20)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [12, 4])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 8,
areteFaceFissure = 1000)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_1(fissureCoude):
"""
problème de fissure du Coude :
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 60,
r_cintr = 1200,
l_tube_p1 = 1600,
l_tube_p2 = 1200,
epais = 40,
de = 760)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 3,
n_long_coude = 15,
n_circ_g = 20,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
azimut = 160,
alpha = 20,
longueur = 400,
orientation = 90,
lgInfluence = 50,
elliptique = False,
externe = True)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_10(fissureCoude):
# cas test ASCOU17
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 90,
r_cintr = 1143,
l_tube_p1 = 3200,
l_tube_p2 = 3200,
epais = 35,
de = 762)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 13,
n_ep = 2,
n_long_coude = 20,
n_circ_g = 20,
n_circ_d = 20,
n_long_p2 = 13)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 2.5,
rayonPipe = 1.5,
lenSegPipe = 6,
azimut = 180,
alpha = 45,
longueur = 1196,
orientation = 0,
lgInfluence = 30,
elliptique = False,
externe = False)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_2(fissureCoude):
"""
problème de fissure du Coude :
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 90,
r_cintr = 1200,
l_tube_p1 = 1600,
l_tube_p2 = 1200,
epais = 40,
de = 760)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 3,
n_long_coude = 15,
n_circ_g = 20,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
azimut = 200,
alpha = 40,
longueur = 800,
orientation = 0,
lgInfluence = 50,
elliptique = False,
externe = True)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_3(fissureCoude):
"""
problème de fissure du Coude
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 40,
r_cintr = 654,
l_tube_p1 = 1700,
l_tube_p2 = 1700,
epais = 62.5,
de = 912.4)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 3,
n_long_coude = 30,
n_circ_g = 50,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
azimut = 90,
alpha = 20,
longueur = 240,
orientation = 90,
lgInfluence = 30,
elliptique = False,
externe = False)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_4(fissureCoude):
"""
problème de fissure du Coude : ASCOU09A
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 40,
r_cintr = 654,
l_tube_p1 = 1700,
l_tube_p2 = 1700,
epais = 62.5,
de = 912.4)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 5,
n_long_coude = 30,
n_circ_g = 50,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe =2.5,
azimut = 90,
alpha = 20,
longueur = 240,
orientation = 90,
lgInfluence = 30,
elliptique = False,
externe = True)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_5(fissureCoude):
"""
problème de fissure du Coude :
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 90,
r_cintr = 1200,
l_tube_p1 = 1600,
l_tube_p2 = 1200,
epais = 40,
de = 760)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 3,
n_long_coude = 15,
n_circ_g = 20,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
azimut = 180,
alpha = 40,
longueur = 200,
orientation = 0,
lgInfluence = 50,
elliptique = False,
externe = False)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 5,
nbsegCercle = 6,
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)

View File

@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_6(fissureCoude):
# --- cas ASCOU08
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 40,
r_cintr = 854,
l_tube_p1 = 1700,
l_tube_p2 = 1700,
epais = 62.5,
de = 912.4)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 15,
n_ep = 3,
n_long_coude = 16,
n_circ_g = 30,
n_circ_d = 30,
n_long_p2 = 15)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
azimut = 90,
alpha = 20,
longueur = 133,
orientation = 0,
lgInfluence = 30,
elliptique = False,
externe = True)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_7(fissureCoude):
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 40,
r_cintr = 654,
l_tube_p1 = 1700,
l_tube_p2 = 1700,
epais = 62.5,
de = 912.4)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 15,
n_ep = 3,
n_long_coude = 16,
n_circ_g = 30,
n_circ_d = 30,
n_long_p2 = 15)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
azimut = 0,
alpha = 20,
longueur = 240,
orientation = 0,
lgInfluence = 30,
elliptique = False,
externe = True)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_8(fissureCoude):
# cas test ASCOU15
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 90,
r_cintr = 2290,
l_tube_p1 = 3200,
l_tube_p2 = 3200,
epais = 30.5,
de = 762)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 8,
n_ep = 2,
n_long_coude = 20,
n_circ_g = 20,
n_circ_d = 20,
n_long_p2 = 8)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 8,
rayonPipe = 1,
lenSegPipe = 1.5,
azimut = 180,
alpha = 45,
longueur = 48,
orientation = 0,
lgInfluence = 30,
elliptique = True,
externe = False)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
from blocFissure.gmu.fissureCoude import fissureCoude
class fissureCoude_9(fissureCoude):
# cas test ASCOU19
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 90,
r_cintr = 1144,
l_tube_p1 = 1651,
l_tube_p2 = 1651,
epais = 39,
de = 762)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 4,
n_long_coude = 40,
n_circ_g = 40,
n_circ_d = 40,
n_long_p2 = 16)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2,
lenSegPipe = 6,
azimut = 0,
alpha = 30.8456,
longueur = 240,
orientation = 90,
lgInfluence = 50,
elliptique = False,
externe = False)
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 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)

View File

@ -0,0 +1,496 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureLongue import insereFissureLongue
O, OX, OY, OZ = triedreBase()
class fissure_Coude(fissureGenerique):
"""
problème de fissure du Coude : version de base
maillage hexa
"""
nomProbleme = "tuyau_Coude"
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 60,
r_cintr = 1200,
l_tube_p1 = 1600,
l_tube_p2 = 1200,
epais = 40,
de = 760)
# ---------------------------------------------------------------------------
def genereGeometrieSaine(self, geomParams):
logging.info("genereGeometrieSaine %s", self.nomCas)
angleCoude = geomParams['angleCoude']
r_cintr = geomParams['r_cintr']
l_tube_p1 = geomParams['l_tube_p1']
l_tube_p2 = geomParams['l_tube_p2']
epais = geomParams['epais']
de = geomParams['de']
centre = geompy.MakeVertex(0, 0, -l_tube_p1)
Disk_1 = geompy.MakeDiskPntVecR(centre, OZ, de/2.)
Disk_2 = geompy.MakeDiskPntVecR(centre, OZ, de/2. -epais)
Cut_1 = geompy.MakeCut(Disk_1, Disk_2)
Extrusion_1 = geompy.MakePrismVecH(Cut_1, OZ, l_tube_p1)
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
Revolution_1 = geompy.MakeRevolution(Cut_1, axe, angleCoude*math.pi/180.0)
Rotation_1 = geompy.MakeRotation(Cut_1, axe, angleCoude*math.pi/180.0)
Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0)
Extrusion_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2)
Plane_1 = geompy.MakePlaneLCS(None, 100000, 3)
geompy.addToStudy( Plane_1, "Plane_1" )
geompy.addToStudy( Extrusion_1, "Extrusion_1" )
geompy.addToStudy( Revolution_1, "Revolution_1" )
geompy.addToStudy( Extrusion_2, "Extrusion_2" )
P1 = O
geompy.addToStudy( P1, "P1" )
op2 = geompy.MakeVertex(0, 0, -l_tube_p1)
P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0)
P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2)
geompy.addToStudy( P2, "P2" )
# --- tube coude sain
geometrieSaine = geompy.MakePartition([Extrusion_1, Revolution_1, Extrusion_2, P1, P2], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
geompy.addToStudy( geometrieSaine, self.nomCas )
[P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True)
[ep, circ_g, circ_d, long_p2, long_coude, long_p1] = geompy.Propagate(geometrieSaine)
geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' )
geompy.addToStudyInFather( geometrieSaine, ep, 'ep' )
geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' )
geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' )
geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' )
geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' )
# --- face extremite tube (EXTUBE)
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON)
EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(EXTUBE, facesIds)
geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' )
# --- edge bord extremite tube (BORDTU)
edge1Ids = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, GEOM.ST_ON)
edge2Ids = geompy.GetShapesOnCylinderIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, de/2., GEOM.ST_ON)
edgesIds = []
for edge in edge1Ids:
if edge in edge2Ids:
edgesIds.append(edge)
BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionIDs(BORDTU, edgesIds)
geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' )
# --- face origine tube (CLGV)
pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10)
vec2 = geompy.MakeVector(P2, pp2)
#geompy.addToStudy(vec2, 'vec2')
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(CLGV, facesIds)
geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' )
# --- peau tube interieur (PEAUINT)
extru1 = geompy.MakePrismVecH(Disk_2, OZ, l_tube_p1)
revol1 = geompy.MakeRevolution(Disk_2, axe, angleCoude*math.pi/180.0)
rot1 = geompy.MakeRotation(Disk_2, axe, angleCoude*math.pi/180.0)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
interne = geompy.MakeFuse(extru1, revol1)
interne = geompy.MakeFuse(extru2, interne)
geompy.addToStudy(interne, 'interne')
facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUINT, facesIds)
geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' )
# --- peau tube exterieur (PEAUEXT)
cercle1 = geompy.MakeCircle(centre, OZ, de/2.)
extru1 = geompy.MakePrismVecH(cercle1, OZ, l_tube_p1)
revol1 = geompy.MakeRevolution(cercle1, axe, angleCoude*math.pi/180.0)
rot1 = geompy.MakeRotation(cercle1, axe, angleCoude*math.pi/180.0)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
externe = geompy.MakeFuse(extru1, revol1)
externe = geompy.MakeFuse(extru2, externe)
geompy.addToStudy(externe, 'externe')
facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON)
PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUEXT, facesIds)
geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' )
# --- solide sain
volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"])
COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"])
geompy.UnionIDs(COUDE, volIds)
geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' )
geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE]
return geometriesSaines
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 3,
n_long_coude = 15,
n_circ_g = 20,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
geometrieSaine = geometriesSaines[0]
long_p1 = geometriesSaines[1]
ep = geometriesSaines[2]
long_coude = geometriesSaines[3]
circ_g = geometriesSaines[4]
circ_d = geometriesSaines[5]
long_p2 = geometriesSaines[6]
P1 = geometriesSaines[7]
P2 = geometriesSaines[8]
EXTUBE = geometriesSaines[9]
BORDTU = geometriesSaines[10]
CLGV = geometriesSaines[11]
PEAUINT = geometriesSaines[12]
PEAUEXT = geometriesSaines[13]
COUDE = geometriesSaines[14]
n_long_p1 = meshParams['n_long_p1']
n_ep = meshParams['n_ep']
n_long_coude = meshParams['n_long_coude']
n_circ_g = meshParams['n_circ_g']
n_circ_d = meshParams['n_circ_d']
n_long_p2 = meshParams['n_long_p2']
maillageSain = smesh.Mesh(geometrieSaine)
algo3d = maillageSain.Hexahedron()
algo2d = maillageSain.Quadrangle()
smesh.SetName(algo3d, "algo3d_maillageSain")
smesh.SetName(algo2d, "algo2d_maillageSain")
algo1d_long_p1 = maillageSain.Segment(geom=long_p1)
hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1)
smesh.SetName(algo1d_long_p1, "algo1d_long_p1")
smesh.SetName(hypo1d_long_p1, "hypo1d_long_p1")
algo1d_ep = maillageSain.Segment(geom=ep)
hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep)
smesh.SetName(algo1d_ep, "algo1d_ep")
smesh.SetName(hypo1d_ep, "hypo1d_ep")
algo1d_long_coude = maillageSain.Segment(geom=long_coude)
hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude)
smesh.SetName(algo1d_long_coude, "algo1d_long_coude")
smesh.SetName(hypo1d_long_coude, "hypo1d_long_coude")
algo1d_circ_g = maillageSain.Segment(geom=circ_g)
hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g)
smesh.SetName(algo1d_circ_g, "algo1d_circ_g")
smesh.SetName(hypo1d_circ_g, "hypo1d_circ_g")
algo1d_circ_d = maillageSain.Segment(geom=circ_d)
hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d)
smesh.SetName(algo1d_circ_d, "algo1d_circ_d")
smesh.SetName(hypo1d_circ_d, "hypo1d_circ_d")
algo1d_long_p2 = maillageSain.Segment(geom=long_p2)
hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2)
smesh.SetName(algo1d_long_p2, "algo1d_long_p2")
smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2")
isDone = maillageSain.Compute()
mp1 = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
mp2 = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
ext = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
btu = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
clg = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
pei = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
pex = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
cou = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
return [maillageSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure
profondeur : 0 < profondeur <= épaisseur
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> ellipse, >2*profondeur = fissure longue
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
externe : True : fissure face externe, False : fissure face interne
"""
logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 10,
azimut = 160,
alpha = 20,
longueur = 400,
orientation = 90,
lgInfluence = 0,
elliptique = False,
externe = True)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
logging.info("shapeFissureParams %s", shapeFissureParams)
angleCoude = geomParams['angleCoude']
r_cintr = geomParams['r_cintr']
l_tube_p1 = geomParams['l_tube_p1']
l_tube_p2 = geomParams['l_tube_p2']
epais = geomParams['epais']
de = geomParams['de']
profondeur = shapeFissureParams['profondeur']
azimut = shapeFissureParams['azimut']
alpha = shapeFissureParams['alpha']
longueur = shapeFissureParams['longueur']
orientation = shapeFissureParams['orientation']
externe = shapeFissureParams['externe']
lgInfluence = shapeFissureParams['lgInfluence']
azimut = -azimut # axe inverse / ASCOUF
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
if not lgInfluence:
lgInfluence = profondeur
if longueur > 2*profondeur:
self.fissureLongue=True
else:
self.fissureLongue=False
self.circonferentielle = False
self.longitudinale = False
if self.fissureLongue and (abs(orientation) < 45) :
self.longitudinale = True
elif self.fissureLongue:
self.circonferentielle = True
if self.circonferentielle:
if externe:
raybor = de/2.
rayint = raybor - profondeur
rayext = raybor + profondeur
else:
rayext = de/2. - epais
rayint = raybor + profondeur
rayext = raybor - profondeur
lgfond = longueur -2*profondeur
angle = lgfond/(2*raybor)
pb = geompy.MakeVertex(raybor, 0, 0)
pi = geompy.MakeVertex(rayint, 0, 0)
pe = geompy.MakeVertex(rayext, 0, 0)
pl = geompy.MakeVertex(raybor, profondeur, 0)
pr = geompy.MakeVertex(raybor, -profondeur, 0)
pil = geompy.MakeRotation(pi, OZ, angle)
pll = geompy.MakeRotation(pl, OZ, angle)
pel = geompy.MakeRotation(pe, OZ, angle)
pir = geompy.MakeRotation(pi, OZ, -angle)
prr = geompy.MakeRotation(pr, OZ, -angle)
per = geompy.MakeRotation(pe, OZ, -angle)
arcl = geompy.MakeArc(pil, pll, pel)
arcr = geompy.MakeArc(pir, prr, per)
arci = geompy.MakeArc(pil, pi, pir)
arce = geompy.MakeArc(pel, pe, per)
wire0 = geompy.MakeWire([arcr, arci, arcl])
cercle0 = geompy.MakeCircle(O, OY, profondeur/4.0)
cercle0 = geompy.MakeRotation(cercle0, OY, math.pi/2.0)
cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi)
facetube0 = geompy.MakeFaceWires([cercle0], 1)
facetubel = geompy.MakeRotation(facetube0, OZ, angle)
facetuber = geompy.MakeRotation(facetube0, OZ, -angle)
face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1)
plan0 = geompy.MakePlane(O, OZ, 10000)
geompy.addToStudy( face0, 'facefissOrig' )
face1 = geompy.MakeRotation(face0, OZ, azimut*math.pi/180.)
face2 = geompy.MakeTranslation(face1, 0, 0, -l_tube_p1)
facefiss = geompy.MakeRotation(face2, axe, alpha*math.pi/180.)
geompy.addToStudy( facefiss, 'facefissPlace' )
centre = geompy.MakeRotation(pb, OZ, azimut*math.pi/180.)
centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1)
centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.)
geompy.addToStudy( centre, 'centrefissPlace' )
arcr = geompy.MakeRotation(arcr, OZ, azimut*math.pi/180.)
arcr = geompy.MakeTranslation(arcr, 0, 0, -l_tube_p1)
arcr = geompy.MakeRotation(arcr, axe, alpha*math.pi/180.)
arci = geompy.MakeRotation(arci, OZ, azimut*math.pi/180.)
arci = geompy.MakeTranslation(arci, 0, 0, -l_tube_p1)
arci = geompy.MakeRotation(arci, axe, alpha*math.pi/180.)
arcl = geompy.MakeRotation(arcl, OZ, azimut*math.pi/180.)
arcl = geompy.MakeTranslation(arcl, 0, 0, -l_tube_p1)
arcl = geompy.MakeRotation(arcl, axe, alpha*math.pi/180.)
wiretube = geompy.MakeRotation(wire0, OZ, azimut*math.pi/180.)
wiretube = geompy.MakeTranslation(wiretube, 0, 0, -l_tube_p1)
wiretube = geompy.MakeRotation(wiretube, axe, alpha*math.pi/180.)
geompy.addToStudy(wiretube, 'wiretubePlace' )
facetubel = geompy.MakeRotation(facetubel, OZ, azimut*math.pi/180.)
facetubel = geompy.MakeTranslation(facetubel, 0, 0, -l_tube_p1)
facetubel = geompy.MakeRotation(facetubel, axe, alpha*math.pi/180.)
geompy.addToStudy(facetubel, 'facetubeGauche' )
facetuber = geompy.MakeRotation(facetuber, OZ, azimut*math.pi/180.)
facetuber = geompy.MakeTranslation(facetuber, 0, 0, -l_tube_p1)
facetuber = geompy.MakeRotation(facetuber, axe, alpha*math.pi/180.)
geompy.addToStudy(facetuber, 'facetubeDroit' )
planfiss = geompy.MakeRotation(plan0, OZ, azimut*math.pi/180.)
planfiss = geompy.MakeTranslation(planfiss, 0, 0, -l_tube_p1)
planfiss = geompy.MakeRotation(planfiss, axe, alpha*math.pi/180.)
geompy.addToStudy(planfiss, 'planfissPlace' )
pipefissl = geompy.MakePipe(facetubel, arcl)
pipefissi = geompy.MakePipe(facetubel, arci)
pipefissr = geompy.MakePipe(facetuber, arcr)
pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
geompy.addToStudy(pipefiss, 'pipefissPlace' )
elif self.longitudinale:
if externe:
raybor = r_cintr + de/2.
rayint = raybor - profondeur
rayext = raybor + profondeur
else:
rayext = r_cintr + de/2. - epais
rayint = raybor + profondeur
rayext = raybor - profondeur
lgfond = longueur -2*profondeur
angle = lgfond/(2*raybor)
pb = geompy.MakeVertex(-raybor, 0, 0)
pi = geompy.MakeVertex(-rayint, 0, 0)
pe = geompy.MakeVertex(-rayext, 0, 0)
pl = geompy.MakeVertex(-raybor, 0, -profondeur)
pr = geompy.MakeVertex(-raybor, 0, profondeur)
pil = geompy.MakeRotation(pi, OY, -angle)
pll = geompy.MakeRotation(pl, OY, -angle)
pel = geompy.MakeRotation(pe, OY, -angle)
pir = geompy.MakeRotation(pi, OY, angle)
prr = geompy.MakeRotation(pr, OY, angle)
per = geompy.MakeRotation(pe, OY, angle)
arcl = geompy.MakeArc(pil, pll, pel)
arcr = geompy.MakeArc(pir, prr, per)
arci = geompy.MakeArc(pil, pi, pir)
arce = geompy.MakeArc(pel, pe, per)
geompy.addToStudy( arcl, 'arcl' )
geompy.addToStudy( arcr, 'arcr' )
geompy.addToStudy( arci, 'arci' )
geompy.addToStudy( arce, 'arce' )
wire0 = geompy.MakeWire([arcr, arci, arcl])
cercle0 = geompy.MakeCircle(O, OZ, profondeur/4.0)
#cercle0 = geompy.MakeRotation(cercle0, OZ, math.pi/2.0)
cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi)
geompy.addToStudy( cercle0, 'cercle0' )
facetube0 = geompy.MakeFaceWires([cercle0], 1)
facetubel = geompy.MakeRotation(facetube0, OY, -angle)
facetuber = geompy.MakeRotation(facetube0, OY, angle)
geompy.addToStudy(facetubel , 'facetubel' )
geompy.addToStudy( facetuber, 'facetuber' )
face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1)
plan0 = geompy.MakePlane(O, OY, 10000)
geompy.addToStudy( face0, 'facefissOrig' )
facefiss = geompy.MakeRotation(face0, OY, alpha*math.pi/180.)
geompy.addToStudy( facefiss, 'facefissPlace' )
centre = geompy.MakeRotation(pb, OY, alpha*math.pi/180.)
geompy.addToStudy( centre, 'centrefissPlace' )
arcr = geompy.MakeRotation(arcr, OY, alpha*math.pi/180.)
arci = geompy.MakeRotation(arci, OY, alpha*math.pi/180.)
arcl = geompy.MakeRotation(arcl, OY, alpha*math.pi/180.)
wiretube = geompy.MakeRotation(wire0, OY, alpha*math.pi/180.)
geompy.addToStudy(wiretube, 'wiretubePlace' )
facetubel = geompy.MakeRotation(facetubel, OY, alpha*math.pi/180.)
geompy.addToStudy(facetubel, 'facetubeGauche' )
facetuber = geompy.MakeRotation(facetuber, OY, alpha*math.pi/180.)
geompy.addToStudy(facetubel, 'facetubeDroit' )
planfiss = geompy.MakeRotation(plan0, OY, alpha*math.pi/180.)
geompy.addToStudy(planfiss, 'planfissPlace' )
pipefissl = geompy.MakePipe(facetubel, arcl)
pipefissi = geompy.MakePipe(facetubel, arci)
pipefissr = geompy.MakePipe(facetuber, arcr)
pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
geompy.addToStudy(pipefiss, 'pipefissPlace' )
else:
pass
coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, 5 ,10)
return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, facetubel, facetuber, planfiss, pipefiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegExt = 5,
nbsegGen = 25,
nbsegRad = 5,
scaleRad = 4,
nbsegCercle = 6,
nbsegFis = 20,
lensegEllipso = 1.0)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureLongue(geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
from fissure_Coude import fissure_Coude
class fissure_Coude_4(fissure_Coude):
"""
probleme de fissure du Coude : ASCOU09A
adaptation maillage
"""
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 40,
r_cintr = 654,
l_tube_p1 = 1700,
l_tube_p2 = 1700,
epais = 62.5,
de = 912.4)
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 5,
n_long_coude = 30,
n_circ_g = 50,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure
profondeur : 0 < profondeur <= épaisseur
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> ellipse, >2*profondeur = fissure longue
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 = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
profondeur = 10,
azimut = 90,
alpha = 20,
longueur = 240,
orientation = 90,
lgInfluence = 30,
elliptique = False,
convexe = True,
externe = True)
# ---------------------------------------------------------------------------
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)

View File

@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class vis_1(fissureGenerique):
"""
problème de fissure non plane, débouchante non normale
"""
nomProbleme = "vis_1"
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/visSain.med"))
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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)
self.shapeFissureParams = dict(lgInfluence = 0.6,
rayonPipe = 0.1)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [4, 7, 9])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.1 ,0.2)
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
nbsegCercle = 32,
areteFaceFissure = 0.1)
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
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)

View File

@ -0,0 +1,25 @@
Exécution des exemples et cas tests :
------------------------------------
- lancer salome
- exécuter les instructions suivantes dans la console Python embarquée, ou dans une console Python avec l'environnement SALOME
# les shapes et fichiers med nécessaires aux tests sont créés dans ${SMESH_ROOT_DIR}/share/salome/plugins/smesh/blocFissure/CasTests
# les maillages fissurés sont écrits dans le répertoire d'exécution.
# preparation des shapes et fichiers MED
import sys, os
sys.path.append(os.path.join(os.environ["SMESH_ROOT_DIR"], "share", "salome", "plugins", "smesh"))
from blocFissure.materielCasTests import genereMateriel
# execution exemples
from blocFissure import exemple
from blocFissure import exemple
# execution des cas tests
from blocFissure.CasTests import execution_Cas

View File

View File

@ -0,0 +1,145 @@
# -*- coding: utf-8 -*-
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
from blocFissure.gmu.initEtude import initEtude
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
O, OX, OY, OZ = triedreBase()
class casStandard(fissureGenerique):
"""
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
"""
# ---------------------------------------------------------------------------
def __init__ (self, dicoParams, references = None, numeroCas = 0):
initEtude()
self.references = references
self.dicoParams = dicoParams
if self.dicoParams.has_key('nomCas'):
self.nomCas = self.dicoParams['nomCas']
else:
self.nomCas = 'casStandard'
self.numeroCas = numeroCas
if self.numeroCas != 0:
self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
else:
self.nomProbleme = self.nomCas
if self.dicoParams.has_key('lenSegPipe'):
self.lenSegPipe = self.dicoParams['lenSegPipe']
else:
self.lenSegPipe =self.dicoParams['rayonPipe']
if self.dicoParams.has_key('step'):
step = self.dicoParams['step']
else:
step = -1 # exécuter toutes les étapes
if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
self.executeProbleme(step)
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
smesh.SetName(objetSain.GetMesh(), 'objetSain')
return [objetSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
paramètres de la fissure pour méthode insereFissureGenerale
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 : 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 - idem avec y,z)
"""
logging.info("setParamShapeFissure %s", self.nomCas)
if self.dicoParams.has_key('pointInterieur'):
self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
rayonPipe = self.dicoParams['rayonPipe'],
lenSegPipe = self.lenSegPipe,
pointIn_x = self.dicoParams['pointInterieur'][0],
pointIn_y = self.dicoParams['pointInterieur'][1],
pointIn_z = self.dicoParams['pointInterieur'][2])
else:
self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
rayonPipe = self.dicoParams['rayonPipe'],
lenSegPipe = self.lenSegPipe)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
centre = None
return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
self.maillageFissureParams = dict(nomRep = '.',
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = self.dicoParams['nbSegRad'],
nbsegCercle = self.dicoParams['nbSegCercle'],
areteFaceFissure = self.dicoParams['areteFaceFissure'])
# ---------------------------------------------------------------------------
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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
def setReferencesMaillageFissure(self):
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)

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
import os
from blocFissure import gmu
from blocFissure.gmu import initLog
initLog.setDebug()
#initLog.setVerbose()
from blocFissure.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],
lgInfluence = 20,
meshBrep = (5,10),
rayonPipe = 5,
lenSegPipe = 2.5,
nbSegRad = 5,
nbSegCercle = 32,
areteFaceFissure = 10)
execInstance = casStandard(dicoParams)

View File

@ -0,0 +1,93 @@
# -*- coding: iso-8859-1 -*-
import sys
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New(theStudy)
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)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_1, OZ, 50)
Rotation_1 = geompy.MakeRotation(Box_1, OZ, 45*math.pi/180.0)
geompy.TranslateDXDYDZ(Rotation_1, -50, -250, 0)
Cut_1 = geompy.MakeCut(Disk_1, Rotation_1)
geompy.Export(Cut_1, "disk.brep", "BREP")
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Vertex_1, 'Vertex_1' )
geompy.addToStudy( Disk_1, 'Disk_1' )
geompy.addToStudy( Rotation_1, 'Rotation_1' )
geompy.addToStudy( Cut_1, 'Cut_1' )
###
### SMESH component
###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
from salome.StdMeshers import StdMeshersBuilder
boite = smesh.Mesh(Box_1)
Regular_1D = boite.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = boite.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = boite.Hexahedron(algo=smeshBuilder.Hexa)
isDone = boite.Compute()
smesh.SetName(boite, 'boite')
boite.ExportMED( r'boite.med', 0, SMESH.MED_V2_2, 1 )
## set object names
smesh.SetName(boite.GetMesh(), 'boite')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
import os
from blocFissure import gmu
from blocFissure.gmu import initLog
#initLog.setDebug()
initLog.setVerbose()
from blocFissure.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube2',
maillageSain = 'boite.med',
brepFaceFissure = "disk.brep",
edgeFissIds = [4],
lgInfluence = 20,
meshBrep = (5,10),
rayonPipe = 10,
nbSegRad = 5,
nbSegCercle = 8,
areteFaceFissure = 10)
execInstance = casStandard(dicoParams)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)

View File

@ -0,0 +1,88 @@
# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
#
# 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.
#
# 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
#
# --- scripts ---
# scripts / static
SET(plugin_SCRIPTS
__init__.py
blocDefaut.py
checkDecoupePartition.py
commonSubShapes.py
creeZoneDefautDansObjetSain.py
creeZoneDefautFilling.py
creeZoneDefautGeom.py
creeZoneDefautMaillage.py
distance2.py
eliminateDoubles.py
ellipsoideDefaut.py
enleveDefaut.py
extractionOrienteeMulti.py
extractionOrientee.py
facesCirculaires.py
facesFissure.py
facesToreInBloc.py
facesVolumesToriques.py
findWireEndVertices.py
findWireIntermediateVertices.py
fissureCoude.py
fissureGenerique.py
genereElemsFissureElliptique.py
genereMeshCalculZoneDefaut.py
geomsmesh.py
getCentreFondFiss.py
getStatsMaillageFissure.py
getSubshapeIds.py
initEtude.py
initLog.py
insereFissureElliptique.py
insereFissureGenerale.py
insereFissureLongue.py
meshBlocPart.py
orderEdgesFromWire.py
partitionBlocDefaut.py
partitionVolumeSain.py
peauInterne.py
produitMixte.py
projettePointSurCourbe.py
prolongeVertices.py
prolongeWire.py
propagateTore.py
putName.py
quadranglesToShape.py
regroupeSainEtDefaut.py
rotTrans.py
shapesSurFissure.py
shapeSurFissure.py
sortEdges.py
sortFaces.py
sortGeneratrices.py
sortSolids.py
substractSubShapes.py
testgmu.py
toreFissure.py
triedreBase.py
whichSideMulti.py
whichSide.py
whichSideVertex.py
)
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/gmu)

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
import os
import initLog
#initLog.setDebug()
#initLog.setVerbose()
#initLog.setRelease()
# --- calcul path blocFissure
apath = initLog.__file__
isabs = os.path.isabs(apath)
pathGmu = os.path.split(apath)[0]
if isabs:
pathBloc = os.path.join(pathGmu, '..')
else:
pathBloc = os.path.join(os.getcwd(), pathGmu, '..')
pathBloc = os.path.normpath(pathBloc)

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- bloc defaut
def blocDefaut(blocDim):
"""
Le bloc contenant la fissure est un cube construit centre a l'origine, dont on donne la demi arete.
@param blocdim : demi arete
@return cube (geomObject)
"""
logging.info("start")
geomObj_1 = geompy.MakeVertex(-blocDim, -blocDim, -blocDim)
geomObj_2 = geompy.MakeVertex( blocDim, blocDim, blocDim)
Box = geompy.MakeBoxTwoPnt(geomObj_1, geomObj_2)
#geompy.addToStudy( Box_1, 'Box_1' )
return Box

View File

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- teste si l'opération de partition a produit une modification
def checkDecoupePartition(shapes, part):
"""
Teste si l'opération de partition a produit une découpe
(plus de shapes dans la partition).
Résultat non garanti si recouvrement des shapes d'origine.
@param shapes : liste des shapes d'origine
@param part : résultat de la partition
@return True si la partition a découpé les shapes d'origine
"""
logging.info('start')
# TODO: ShapeInfo donne des résultats faux (deux faces au lieu de une)
isPart = False
orig = {}
for shape in shapes:
info = geompy.ShapeInfo(shape)
logging.debug("shape info %s", info)
for k in ['VERTEX', 'EDGE', 'FACE', 'SOLID']:
if k in orig.keys():
orig[k] += info[k]
else:
orig[k] = info[k]
logging.debug("original shapes info %s", orig)
info = geompy.ShapeInfo(part)
logging.debug("partition info %s", info)
for k in ['VERTEX', 'EDGE', 'FACE', 'SOLID']:
if orig[k] < info[k]:
isPart = True
break
logging.debug("partition modifie l'original %s", isPart)
return isPart

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- subShapes communes à deux listes
def commonSubShapes(obj, sub1, sub2):
"""
liste de subshapes communes
"""
logging.info("start")
idsub1 = {}
subList = []
for s in sub1:
idsub1[geompy.GetSubShapeID(obj, s)] = s
for s in sub2:
idsub = geompy.GetSubShapeID(obj, s)
if idsub in idsub1.keys():
subList.append(s)
logging.debug("subList=%s", subList)
return subList

View File

@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import smesh
import SMESH
import SALOMEDS
from creeZoneDefautMaillage import creeZoneDefautMaillage
from peauInterne import peauInterne
from quadranglesToShape import quadranglesToShape
from creeZoneDefautFilling import creeZoneDefautFilling
from creeZoneDefautGeom import creeZoneDefautGeom
from getCentreFondFiss import getCentreFondFiss
# -----------------------------------------------------------------------------
# ---
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
shapeFissureParams, maillageFissureParams):
"""
TODO: a compléter
"""
logging.info('start')
#smesh.SetCurrentStudy(salome.myStudy)
geometrieSaine = geometriesSaines[0]
maillageSain = maillagesSains[0]
isHexa = maillagesSains[1]
shapeDefaut = shapesFissure[0]
tailleDefaut = shapesFissure[2]
coordsNoeudsFissure = shapesFissure[3]
isElliptique = False
if shapeFissureParams.has_key('elliptique'):
isElliptique = shapeFissureParams['elliptique']
if isElliptique:
if shapeFissureParams.has_key('demiGrandAxe'):
demiGrandAxe = shapeFissureParams['demiGrandAxe']
else:
demiGrandAxe = shapeFissureParams['longueur']
lgExtrusion = 2.0*demiGrandAxe
else:
lgExtrusion = 50.
nomRep = maillageFissureParams['nomRep']
nomFicSain = maillageFissureParams['nomFicSain']
fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
# --- centre de fond de fissure et tangente
edgeFondExt, centreFondFiss, tgtCentre = getCentreFondFiss(shapesFissure)
# --- zone de défaut
nomZones = "zoneDefaut"
[origShapes, verticesShapes, dmoyen] = \
creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut, nomZones, coordsNoeudsFissure)
maillageSain.ExportMED( fichierMaillageSain, 0, SMESH.MED_V2_2, 1 )
logging.debug("fichier maillage sain %s", fichierMaillageSain)
[maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
peauInterne(fichierMaillageSain, nomZones)
facesDefaut = []
centresDefaut = []
normalsDefaut =[]
extrusionsDefaut = []
isPlane = False
if isHexa and not isPlane:
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss)
for filling in fillings:
[faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
facesDefaut.append(faceDefaut)
centresDefaut.append(centreDefaut)
normalsDefaut.append(normalDefaut)
extrusionsDefaut.append(extrusionDefaut)
else:
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
bordsPartages =[]
for face in facesDefaut:
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
fillconts = facesDefaut
idFilToCont = range(len(facesDefaut))
return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, dmoyen, bordsPartages, fillconts, idFilToCont,
maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges,
edgeFondExt, centreFondFiss, tgtCentre]

View File

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- crée zone géométrique défaut a partir d'un filling
def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50):
"""
Construction CAO de la zone à remailler, quand on utilise un filling,
après appel creeZoneDefautMaillage et quadranglesToShape
@param filling : la CAO de la peau du défaut reconstituée
@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)
@return (facesDefaut = filling, centreDefaut, normalDefaut, extrusionDefaut)
"""
logging.info("start")
trace = True
facesDefaut = filling
centreSphere = geompy.MakeCDG(shapeDefaut)
geompy.addToStudy(centreSphere, "cdg_defaut")
centreDefaut = geompy.MakeProjection(centreSphere, filling)
if trace:
geompy.addToStudy(centreDefaut, "centreDefaut")
normalDefaut = geompy.GetNormal(filling, centreDefaut)
if trace:
geompy.addToStudy(normalDefaut, "normalDefaut")
extrusionDefaut = geompy.MakePrismVecH(filling, normalDefaut, -lgExtrusion)
if trace:
geompy.addToStudy(extrusionDefaut, "extrusionDefaut")
return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut

View File

@ -0,0 +1,207 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
from prolongeVertices import prolongeVertices
# -----------------------------------------------------------------------------
# --- zone de defaut, constructions geometrique avec CAO d'origine
def creeZoneDefautGeom(objetSain, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion=50):
"""
Construction CAO de la zone à remailler, quand on utilise la CAO d'origine,
apres appel creeZoneDefautMaillage
@param objetSain : la géometrie de l'objet initial
@param shapeDefaut : objet géometrique représentant la fissure
(selon les cas, un point central, ou une shape plus complexe,
dont on ne garde que les vertices)
@param origShapes : liste id subShapes
@param verticesShapes : listes noeuds de bord
@param dmoyen : longueur arete moyenne bord
@lgExtrusion : distance d'extrusion de la face du defaut
(ne vaut que pour des fissures courtes)
@return (facesDefaut, centreDefaut, normalDefaut, extrusionDefaut)
"""
logging.info("start")
trace = True
faces = []
curves = []
cdgs = []
projs = []
normals = []
extrusions = []
partitions = []
decoupes = []
for ishape, vertices in enumerate(verticesShapes):
aShape = origShapes[ishape]
[face] = geompy.SubShapes(objetSain, [aShape])
faces.append(face)
curve = geompy.MakePolyline(vertices, False)
curves.append(curve)
if trace:
name="poly_%d"%aShape
geompy.addToStudy(curve, name)
#
cdg = geompy.MakeCDG(curve)
cdgs.append(cdg)
if trace:
name="cdgpoly_%d"%aShape
geompy.addToStudy(cdg, name)
#
projCdg = geompy.MakeProjection(cdg, face)
projs.append(projCdg)
if trace:
name="projCdg_%d"%aShape
geompy.addToStudy(projCdg, name)
#
normal = geompy.GetNormal(face, projCdg)
normals.append(normal)
if trace:
name="normal_%d"%aShape
geompy.addToStudy(normal, name)
#
extrusion = geompy.MakePrismVecH2Ways(curve, normal, 10)
extrusions.append(extrusion)
if trace:
name="extrusion_%d"%aShape
geompy.addToStudy(extrusion, name)
#
verticesProlongees = prolongeVertices(vertices)
#
curveprol = geompy.MakePolyline(verticesProlongees, False)
if trace:
name="polyProl_%d"%aShape
geompy.addToStudy(curveprol, name)
#
extruprol = geompy.MakePrismVecH2Ways(curveprol, normal, 10)
if trace:
name="extruProl_%d"%aShape
geompy.addToStudy(extruprol, name)
#
partition = geompy.MakePartition([face], [extruprol], [], [], geompy.ShapeType["FACE"], 0, [], 0)
partitions.append(partition)
if trace:
name="partition_%d"%aShape
geompy.addToStudy(partition, name)
pass
#
centreSphere = geompy.MakeCDG(shapeDefaut)
geompy.addToStudy(centreSphere, "cdg_defaut")
ccurves = geompy.MakeCompound(curves)
gravCenter = geompy.MakeCDG(ccurves)
geompy.addToStudy(gravCenter, "cdg_curves")
for i in range(len(partitions)):
if trace:
logging.debug(" --- original shape %s", origShapes[i])
dists = []
facesToSort = []
subFaces = geompy.ExtractShapes(partitions[i], geompy.ShapeType["FACE"], True)
for aFace in subFaces:
cdg = geompy.MakeCDG(aFace)
distance = geompy.MinDistance(cdg, centreSphere)
dists.append(distance)
facesToSort.append(aFace)
if trace:
logging.debug("distance = %s", distance)
pass
pass
if len(dists) > 0:
minDist = min(dists)
for j,d in enumerate(dists):
if d == minDist:
aFace = facesToSort[j]
name="decoupe_%d"%origShapes[i]
geompy.addToStudy(aFace, name)
decoupes.append(aFace)
break
pass
pass
facesDefaut = decoupes[0]
if len(decoupes) > 1:
facesDefaut = geompy.MakePartition(decoupes, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
geompy.addToStudy(facesDefaut, "facesDefaut")
shells=[]
if len(decoupes) > 1: # plusieurs faces de defaut
subFaces = geompy.ExtractShapes(facesDefaut, geompy.ShapeType["FACE"], True)
# --- regroupe les subFaces en shells connectes
theFaces = list(subFaces) # copy
while len(theFaces) > 0:
logging.debug("------- len(theFaces) %s" , len(theFaces))
theFace = theFaces[0]
logging.debug(" start with face %s",theFaces[0])
theFaces[0:1] = []
aShell = [theFace]
toAdd =[theFace]
while len(toAdd) > 0:
toAdd = []
toRemove = []
for i in range(len(theFaces)):
logging.debug(" try %s", theFaces[i])
for aFace in aShell:
logging.debug(" with %s", aFace)
try:
edge = geompy.GetSharedShapesMulti([aFace, theFaces[i]], geompy.ShapeType["EDGE"])
edgeShared = True
except:
edgeShared = False
if edgeShared:
if theFaces[i] not in toAdd:
toAdd.append(theFaces[i])
toRemove.append(i)
logging.debug(" --- add %s", theFaces[i])
aShell += toAdd
for k in sorted(toRemove, reverse=True):
theFaces[k:k+1] = []
theShell = geompy.MakeShell(aShell)
name = "theShell%d"%len(shells)
geompy.addToStudy(theShell,name)
shells.append(theShell)
#
distances = []
for aShell in shells: # --- trouver le shell en contact avec la fissure
distances.append(geompy.MinDistance(aShell, shapeDefaut))
minDist = min(distances)
for index in range(len(distances)):
if distances[index] == minDist:
break
theShellDefaut = shells[index]
#
else: # --- une seule face de defaut
subFaces = [facesDefaut]
theShellDefaut = geompy.MakeShell(subFaces)
if trace:
geompy.addToStudy(theShellDefaut,"theShellDefaut")
theFaces = geompy.ExtractShapes(theShellDefaut, geompy.ShapeType["FACE"], True)
distances = []
for aFace in theFaces:
distances.append(geompy.MinDistance(aFace, centreSphere))
minDist = min(distances)
for index in range(len(distances)):
if distances[index] == minDist:
break
centreDefaut = geompy.MakeProjection(centreSphere, theFaces[index])
if trace:
geompy.addToStudy(centreDefaut, "centreDefaut")
normalDefaut = geompy.GetNormal(subFaces[index], centreDefaut)
if trace:
geompy.addToStudy(normalDefaut, "normalDefaut")
extrusionDefaut = geompy.MakePrismVecH(theShellDefaut, normalDefaut, -lgExtrusion)
info = geompy.ShapeInfo(extrusionDefaut)
logging.debug("shape info %s", info)
if (info['SOLID'] > 1) or (info['COMPOUND'] > 0) :
solids = geompy.ExtractShapes(extrusionDefaut, geompy.ShapeType["SOLID"], True)
solid0 = solids[0]
for i in range(1,len(solids)):
solid0 = geompy.MakeFuse(solid0, solids[i])
extrusionDefaut = solid0
if trace:
geompy.addToStudy(extrusionDefaut, "extrusionDefaut")
return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut

View File

@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
import math
from distance2 import distance2
# -----------------------------------------------------------------------------
# --- zone de defaut extraite du maillage
def creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut,
nomZones, coordsNoeudsFissure):
"""
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)
@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
"""
logging.info("start")
maillageSain = maillagesSains[0]
isHexa = maillagesSains[1]
lists = maillageSain.CreateHoleSkin(tailleDefaut, shapeDefaut, nomZones, coordsNoeudsFissure)
logging.debug("lists=%s", lists)
trace = True
origShapes = []
verticesShapes = []
cumul = 0 # somme des distances carrées entre point ordonnés (taille des arêtes)
nb = 0 # nombre d'arêtes évaluées
for aList in lists:
aShape = aList[0]
origShapes.append(aShape)
logging.debug(" shapeId %s", aShape)
vertices = []
xyz0 = None
for inode in range(1, len(aList)):
xyz = maillageSain.GetNodeXYZ(aList[inode])
if xyz0 is not None:
cumul += distance2(xyz, xyz0)
nb += 1
xyz0 = xyz
#logging.debug(" node %s %s", aList[inode], xyz)
vertices.append(geompy.MakeVertex(xyz[0], xyz[1], xyz[2]))
pass
verticesShapes.append(vertices)
pass
dmoyen = math.sqrt(cumul/nb) # ~ taille de l'arête moyenne du maillage global
return origShapes, verticesShapes, dmoyen

View File

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
import logging
# -----------------------------------------------------------------------------
# --- calcul de distance carree entre deux points, jeux de coordonnees x,y,z
def distance2(xyz1, xyz2):
"""
carré de la distance entre deux points donnés par des triplets [x,y,z]
"""
#logging.info("start")
d2 = 0
for i in range(3):
d2 += (xyz1[i]-xyz2[i])*(xyz1[i]-xyz2[i])
logging.debug('d2=%s', d2)
return d2
# -----------------------------------------------------------------------------
# --- test unitaire
import unittest
class Test_distance2(unittest.TestCase):
def setUp(self):
self.a=[0, 0, 0]
self.b=[3, 4, 5]
self.c=[-5,-4,-3]
def test_calcul(self):
self.assertEqual(distance2(self.a, self.b), distance2(self.b, self.a))
self.assertEqual(distance2(self.a, self.b), distance2(self.a, self.c))
self.assertEqual(distance2(self.b, self.b), 0)
self.assertEqual(distance2(self.a, self.b), 50)

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- éliminer les doublons d'une liste de subshapes
def eliminateDoubles(obj, subshapes):
"""
éliminer les doublons d'une liste de subshapes
"""
idsubs = {}
for sub in subshapes:
subid = geompy.GetSubShapeID(obj, sub)
if subid in idsubs.keys():
idsubs[subid].append(sub)
else:
idsubs[subid] = [sub]
shortList = []
for k, v in idsubs.iteritems():
shortList.append(v[0])
logging.debug("shortList=%s", shortList)
return shortList

View File

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
import logging
import math
from geomsmesh import geompy
from triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
# -----------------------------------------------------------------------------
# --- ellipsoide defaut
def ellipsoideDefaut(minRad,allonge,rayTore):
"""
Le bloc contenant la fissure est un ellipsoide construit centre a l'origine,
contenant le tore elliptique de fissure
@param minRad :petit rayon
@param allonge :rapport grand rayon / petit rayon
@param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
@return ellipsoide (geomObject)
"""
logging.info("start")
boule = geompy.MakeSphereR(2)
bouler = geompy.MakeRotation(boule, OY, math.pi/2.0)
face = geompy.MakeFaceHW(100, 100, 3)
boulepart = geompy.MakePartition([bouler], [face], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
solids = geompy.ExtractShapes(boulepart, geompy.ShapeType["SOLID"], True)
solid0 = solids[0]
for i in range(1,len(solids)):
solid0 = geompy.MakeFuse(solid0, solids[i])
ellipsoide = geompy.MakeScaleAlongAxes(solid0, O, minRad, minRad*(allonge+2.0)/2.0, minRad) # on limite l'allongement de l'ellipsoide
#geompy.addToStudy( ellipsoide, 'ellipsoide' )
return ellipsoide

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
import logging
# -----------------------------------------------------------------------------
# --- maillage sain sans la zone defaut
def enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges):
"""
Maillage sain sans la zone de defaut
TODO: a completer
"""
logging.info('start')
maillageSain.RemoveGroupWithContents(zoneDefaut)
if zoneDefaut_skin is not None:
maillageSain.RemoveGroupWithContents(zoneDefaut_skin)
if zoneDefaut_internalFaces is not None:
maillageSain.RemoveGroupWithContents(zoneDefaut_internalFaces)
if zoneDefaut_internalEdges is not None:
maillageSain.RemoveGroupWithContents(zoneDefaut_internalEdges)
nbRemoved = maillageSain.RemoveOrphanNodes()
return maillageSain

View File

@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
from whichSide import whichSide
# -----------------------------------------------------------------------------
# --- renvoie l'extraction des shapes d'un objet selon leur position par rapport à la face.
def extractionOrientee(face, obj, ref, shapeType, tol, prefix=""):
"""
renvoie l'extraction des shapes d'un objet selon leur position
par rapport à la face.
shapeType in ["VERTEX", "EDGE", "FACE",...]
"""
logging.info('start')
trace = True
sideRef = whichSide(face, ref)
logging.debug("ref side %s", sideRef)
shapesInside = []
shapesOutside = []
shapesOnside = []
shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False)
i=0
j=0
k=0
prefix = prefix + shapeType
for shape in shapes:
side = whichSide(face, shape, tol)
if side == sideRef:
shapesInside.append(shape)
if trace:
name = prefix + "_Inside%d"%i
geompy.addToStudyInFather(obj, shape, name)
i+=1
elif side == -sideRef:
shapesOutside.append(shape)
if trace:
name = prefix + "_Outside%d"%j
geompy.addToStudyInFather(obj, shape, name)
j+=1
elif side == 0:
shapesOnside.append(shape)
if trace:
name = prefix + "_Onside%d"%k
geompy.addToStudyInFather(obj, shape, name)
k+=1
logging.debug("--- shape was %s", name)
return [shapesInside, shapesOutside, shapesOnside]

View File

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
from whichSideMulti import whichSideMulti
# -----------------------------------------------------------------------------
# --- renvoie l'extraction des shapes d'un objet selon leur position par rapport à la face.
def extractionOrienteeMulti(faces, ifil, obj, centre, shapeType, tol, prefix=""):
"""
renvoie l'extraction des shapes d'un objet selon leur position
par rapport aux faces.
shapeType in ["VERTEX", "EDGE", "FACE",...]
"""
logging.info('start')
trace = True
shapesInside = []
shapesOutside = []
shapesOnside = []
shapes = geompy.ExtractShapes(obj, geompy.ShapeType[shapeType], False)
i=0
j=0
k=0
prefix = prefix + shapeType
for shape in shapes:
side = whichSideMulti(faces, ifil, shape, centre, tol)
if side == 1:
shapesInside.append(shape)
if trace:
name = prefix + "_Inside%d"%i
geompy.addToStudyInFather(obj, shape, name)
i+=1
elif side == -1:
shapesOutside.append(shape)
if trace:
name = prefix + "_Outside%d"%j
geompy.addToStudyInFather(obj, shape, name)
j+=1
elif side == 0:
shapesOnside.append(shape)
if trace:
name = prefix + "_Onside%d"%k
geompy.addToStudyInFather(obj, shape, name)
k+=1
logging.debug("--- shape was %s", name)
return [shapesInside, shapesOutside, shapesOnside]

View File

@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- TORE
## --- faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure
def facesCirculaires(bloc, tore):
"""
Extraction des faces demi circulaires à l'intersection du tore partitionné et de la paroi,
de leur centre, les edges de ces faces situees dans le plan de fissure et un booleen par edge,
indiquant son sens (normal / reversed).
@param bloc : bloc defaut
@param tore : le tore partitionné et coupé
@return (faces, centres, edges, reverses)
"""
logging.info("start")
faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
geompy.addToStudyInFather( tore, faces[0], 'face0' )
geompy.addToStudyInFather( tore, faces[1], 'face1' )
geompy.addToStudyInFather( tore, faces[2], 'face2' )
geompy.addToStudyInFather( tore, faces[3], 'face3' )
centres = [None, None, None, None]
[v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True)
[v1,centres[1],v3] = geompy.ExtractShapes(faces[1], geompy.ShapeType["VERTEX"], True)
[v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True)
[v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True)
geompy.addToStudyInFather( faces[0], centres[0], 'centre0' )
geompy.addToStudyInFather( faces[1], centres[1], 'centre1' )
geompy.addToStudyInFather( faces[2], centres[2], 'centre2' )
geompy.addToStudyInFather( faces[3], centres[3], 'centre3' )
alledges = [None, None, None, None]
alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True)
alledges[1] = geompy.ExtractShapes(faces[1], geompy.ShapeType["EDGE"], True)
alledges[2] = geompy.ExtractShapes(faces[2], geompy.ShapeType["EDGE"], True)
alledges[3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["EDGE"], True)
dicoedge = {}
edges = []
reverses = []
for i in range(len(alledges)):
edgesface = alledges[i]
lenef = []
for j in range(len(edgesface)):
props = geompy.BasicProperties(edgesface[j])
lenef.append(props[0])
pass
maxlen = max(lenef)
for j in range(len(edgesface)):
if lenef[j] < maxlen:
edgid = geompy.GetSubShapeID(tore, edgesface[j])
if not (edgid in dicoedge):
dicoedge[edgid] = edgesface[j]
edges.append(edgesface[j])
named = 'edge_' + str(i) + '_' +str(j)
geompy.addToStudyInFather( faces[i], edgesface[j], named)
vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False)
#firstVertex = geompy.GetFirstVertex(edgesface[j])
if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]):
reverses.append(1)
#print 'reversed ' + str(edgid)
else:
reverses.append(0)
#print 'normal' + str(edgid)
pass
pass
pass
pass
return faces, centres, edges, reverses

View File

@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- faces fissure dans et hors tore, et edges face hors tore
def facesFissure(blocp, faceFissure, extrusionDefaut, genint):
"""
extraction des faces de fissure dans et hors tore, des edges le long du tore et en paroi
@param faceFissure : la face de fissure avec la partie dans le tore elliptique et la partie externe
@return (facefissintore, facefissoutore, edgeint, edgeext)
"""
logging.info('start')
[f0,f1] = geompy.ExtractShapes(faceFissure, geompy.ShapeType["FACE"], True)
ed0 = geompy.ExtractShapes(f0, geompy.ShapeType["EDGE"], True)
ed1 = geompy.ExtractShapes(f1, geompy.ShapeType["EDGE"], True)
if len(ed0) > len(ed1):
facefissintore = f0
facefissoutore = f1
else:
facefissintore = f1
facefissoutore = f0
geompy.addToStudyInFather(faceFissure, facefissintore,'facefissintore')
geompy.addToStudyInFather(faceFissure, facefissoutore,'facefissoutore')
edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN)
edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON)
for i in range(len(edgeint)):
name = "edgeint_%d"%i
geompy.addToStudyInFather(facefissoutore, edgeint[i],name)
for i in range(len(edgeext)):
name = "edgeext_%d"%i
geompy.addToStudyInFather(facefissoutore, edgeext[i],name)
reverext = []
if len(edgeext) > 1:
vertices = geompy.ExtractShapes(genint, geompy.ShapeType["VERTEX"], False)
for i in range(len(edgeext)):
vertedge = geompy.ExtractShapes(edgeext[i], geompy.ShapeType["VERTEX"], False)
if ((geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[0])) or
(geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[1]))):
reverext.append(0)
else:
reverext.append(1)
return facefissintore, facefissoutore, edgeint, edgeext, reverext

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- identification des faces tore et fissure dans le solide hors tore du bloc partitionné
def facesToreInBloc(blocp, facefissoutore, facetore1, facetore2):
"""
identification des faces tore et fissure dans le bloc partitionné : sous shapes du bloc
@param blocp : bloc partitionné
@param facefissoutore : la face de fissure externe au tore
@param facetore1 : face du tore selon la génératrice
@param facetore2 : face du tore selon la génératrice
@return (blocFaceFiss, blocFaceTore1, blocFaceTore2) sous shapes reperées
"""
logging.info('start')
blocFaceFiss = geompy.GetInPlaceByHistory(blocp, facefissoutore)
blocFaceTore1 = geompy.GetInPlaceByHistory(blocp, facetore1)
blocFaceTore2 = geompy.GetInPlaceByHistory(blocp, facetore2)
geompy.addToStudyInFather(blocp, blocFaceFiss,'blocFaceFiss')
geompy.addToStudyInFather(blocp, blocFaceTore1,'blocFaceTore1')
geompy.addToStudyInFather(blocp, blocFaceTore2,'blocFaceTore2')
return blocFaceFiss, blocFaceTore1, blocFaceTore2

View File

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
from extractionOrientee import extractionOrientee
from getSubshapeIds import getSubshapeIds
# -----------------------------------------------------------------------------
# --- TORE
# --- faces toriques et volumes du tore
def facesVolumesToriques(tore, plan, facesDefaut):
"""
Extraction des deux faces et volumes du tore partitionné, qui suivent la génératrice elliptique.
@param tore : le tore partitionné et coupé.
@param plan : le plan de coupe
@return (facetore1,facetore2) les 2 faces selon la génératrice
"""
logging.info("start")
centre = geompy.MakeVertexOnSurface(plan, 0.5, 0.5)
normal = geompy.GetNormal(plan, centre)
reference = geompy.MakeTranslationVector(centre, normal)
[facesInPlan, facesOutPlan, facesOnPlan] = extractionOrientee(plan, tore, reference, "FACE", 1.e-2, "faceTorePlan_")
[facesInSide, facesOutSide, facesOnSide] = extractionOrientee(facesDefaut, tore, reference, "FACE", 1.e-2, "faceTorePeau_")
facesIdInPlan = getSubshapeIds(tore, facesInPlan)
facesIdOutPlan = getSubshapeIds(tore, facesOutPlan)
facesIdOnSide = getSubshapeIds(tore, facesOnSide)
facesIdInSide = getSubshapeIds(tore, facesInSide)
facesIdOutSide = getSubshapeIds(tore, facesOutSide)
#facesIdInOutSide = facesIdInSide + facesIdOutSide
facetore1 = None
faceTore2 = None
for i, faceId in enumerate(facesIdInPlan):
if faceId not in facesIdOnSide:
facetore1 = facesInPlan[i]
break
for i, faceId in enumerate(facesIdOutPlan):
if faceId not in facesIdOnSide:
facetore2 = facesOutPlan[i]
break
#[facetore1,facetore2] = geompy.GetShapesOnShape(pipe0, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
geompy.addToStudyInFather( tore, facetore1, 'facetore1' )
geompy.addToStudyInFather( tore, facetore2, 'facetore2' )
[volumeTore1, volumeTore2] = geompy.ExtractShapes(tore, geompy.ShapeType["SOLID"], True)
geompy.addToStudyInFather( tore, volumeTore1, 'volumeTore1' )
geompy.addToStudyInFather( tore, volumeTore2, 'volumeTore2' )
return facetore1, facetore2, volumeTore1, volumeTore2

View File

@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- trouver les vertices extremites d'un wire
def findWireEndVertices(aWire, getNormals=False):
"""
trouver les vertices extremites d'un wire
calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
"""
logging.info("start")
if geompy.NumberOfEdges(aWire) > 1:
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
else:
edges = [aWire]
vertices = []
idsubs = {}
shortList = []
if getNormals:
normals = []
idnorm = {}
shortNorm = []
for edge in edges:
vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
vertices += vert
if getNormals:
v0 = geompy.MakeVertexOnCurve(edge, 0.0)
n0 = geompy.MakeTangentOnCurve(edge, 0.0)
v1 = geompy.MakeVertexOnCurve(edge, 1.0)
n1 = geompy.MakeTangentOnCurve(edge, 1.0)
dist = geompy.MinDistance(v0, vert[0])
logging.debug("distance %s", dist)
if dist < 1.e-2:
normals += [n0, n1]
else:
normals += [n1, n0]
for i, sub in enumerate(vertices):
subid = geompy.GetSubShapeID(aWire, sub)
if subid in idsubs.keys():
idsubs[subid].append(sub)
else:
idsubs[subid] = [sub]
name='vertex%d'%i
geompy.addToStudyInFather(aWire, sub, name)
if getNormals:
idnorm[subid] = normals[i]
name='norm%d'%i
geompy.addToStudyInFather(aWire, normals[i], name)
logging.debug("idsubs: %s", idsubs)
for k, v in idsubs.iteritems():
if len(v) == 1:
shortList.append(v[0])
if getNormals:
shortNorm.append(idnorm[k])
if getNormals:
return shortList, shortNorm
else:
return shortList

View File

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- trouver les vertices intermediaires d'un wire
def findWireIntermediateVertices(aWire, getNormals=False):
"""
trouver les vertices d'un wire qui ne sont pas aux extremités
calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
"""
logging.info("start")
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
vertices = []
idsubs = {}
shortList = []
if getNormals:
normals = []
idnorm = {}
shortNorm = []
for edge in edges:
vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
vertices += vert
if getNormals:
v0 = geompy.MakeVertexOnCurve(edge, 0.0)
n0 = geompy.MakeTangentOnCurve(edge, 0.0)
v1 = geompy.MakeVertexOnCurve(edge, 1.0)
n1 = geompy.MakeTangentOnCurve(edge, 1.0)
dist = geompy.MinDistance(v0, vert[0])
logging.debug("distance %s", dist)
if dist < 1.e-2:
normals += [n0, n1]
else:
normals += [n1, n0]
for i, sub in enumerate(vertices):
subid = geompy.GetSubShapeID(aWire, sub)
if subid in idsubs.keys():
idsubs[subid].append(sub)
else:
idsubs[subid] = [sub]
name='vertex%d'%i
geompy.addToStudyInFather(aWire, sub, name)
if getNormals:
idnorm[subid] = normals[i]
name='norm%d'%i
geompy.addToStudyInFather(aWire, normals[i], name)
for k, v in idsubs.iteritems():
if len(v) > 1:
shortList.append(v[0])
if getNormals:
shortNorm.append(idnorm[k])
if getNormals:
return shortList, shortNorm
else:
return shortList

View File

@ -0,0 +1,669 @@
# -*- coding: utf-8 -*-
from geomsmesh import geompy, smesh
import math
import GEOM
import SALOMEDS
import SMESH
#import StdMeshers
#import GHS3DPlugin
#import NETGENPlugin
import logging
from fissureGenerique import fissureGenerique
from triedreBase import triedreBase
from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
from insereFissureGenerale import insereFissureGenerale
from sortEdges import sortEdges
O, OX, OY, OZ = triedreBase()
class fissureCoude(fissureGenerique):
"""
problème de fissure du Coude : version de base
maillage hexa
"""
nomProbleme = "tuyau_Coude"
# ---------------------------------------------------------------------------
def setParamGeometrieSaine(self):
"""
Paramètres géométriques du tuyau coudé sain:
angleCoude
r_cintr
l_tube_p1
l_tube_p2
epais
de
"""
self.geomParams = dict(angleCoude = 60,
r_cintr = 1200,
l_tube_p1 = 1600,
l_tube_p2 = 1200,
epais = 40,
de = 760)
# ---------------------------------------------------------------------------
def genereGeometrieSaine(self, geomParams):
logging.info("genereGeometrieSaine %s", self.nomCas)
angleCoude = geomParams['angleCoude']
r_cintr = geomParams['r_cintr']
l_tube_p1 = geomParams['l_tube_p1']
l_tube_p2 = geomParams['l_tube_p2']
epais = geomParams['epais']
de = geomParams['de']
centre = geompy.MakeVertex(0, 0, -l_tube_p1)
diskext = geompy.MakeDiskPntVecR(centre, OZ, de/2.)
diskint = geompy.MakeDiskPntVecR(centre, OZ, de/2. -epais)
couronne = geompy.MakeCut(diskext, diskint)
tube_1 = geompy.MakePrismVecH(couronne, OZ, l_tube_p1)
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
coude = geompy.MakeRevolution(couronne, axe, angleCoude*math.pi/180.0)
Rotation_1 = geompy.MakeRotation(couronne, axe, angleCoude*math.pi/180.0)
Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0)
tube_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2)
plan_y = geompy.MakePlaneLCS(None, 100000, 3)
geompy.addToStudy( plan_y, "plan_y" )
geompy.addToStudy( tube_1, "tube_1" )
geompy.addToStudy( coude, "coude" )
geompy.addToStudy( tube_2, "tube_2" )
P1 = O
geompy.addToStudy( P1, "P1" )
op2 = geompy.MakeVertex(0, 0, -l_tube_p1)
P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0)
P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2)
geompy.addToStudy( P2, "P2" )
# --- tube coude sain
geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
geompy.addToStudy( geometrieSaine, self.nomCas )
[P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True)
xmin = -de -r_cintr -l_tube_p2
zmin = -l_tube_p1 -r_cintr -l_tube_p2 -de
ymax = de +100.
boxypos = geompy.MakeBox(xmin, 0, zmin, ymax, ymax, 100, "boxypos")
boxyneg = geompy.MakeBox(xmin, 0, zmin, ymax, -ymax, 100, "boxyneg")
edgesypos = geompy.GetShapesOnShape(boxypos, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN)
edgesyneg = geompy.GetShapesOnShape(boxyneg, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN)
circ_g = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionList(circ_g, edgesyneg)
circ_d = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionList(circ_d, edgesypos)
edgesy0pos = geompy.GetShapesOnShape(boxypos, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_ONIN)
grpedpos = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionList(grpedpos, edgesy0pos)
grpedy0 = geompy.CutGroups(grpedpos, circ_d, "edges_y0")
boxtub1 = geompy.MakeBox(-de/2.0 -1, -1, -l_tube_p1, de, de, 0, "boxtub1")
edgestub1 = geompy.GetShapesOnShape(boxtub1, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN)
grped = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionList(grped, edgestub1)
long_p1 = geompy.IntersectGroups(grped, grpedy0)
boxtub = geompy.MakeBox(-de/2.0 -1, -1, -l_tube_p1 -l_tube_p2, de, de, -l_tube_p1)
boxtub2 = geompy.MakeRotation(boxtub, axe, angleCoude*math.pi/180.0, "boxttub2")
edgestub2 = geompy.GetShapesOnShape(boxtub2, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN)
grped = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionList(grped, edgestub2)
long_p2 = geompy.IntersectGroups(grped, grpedy0)
boxtub1t = geompy.MakeTranslationVectorDistance(boxtub1, OZ, -l_tube_p1)
facer = geompy.GetShapesOnShape(boxtub1t, boxtub1, geompy.ShapeType["FACE"], GEOM.ST_ONIN, "facer")
boxcoud = geompy.MakeRevolution(facer[0], axe, angleCoude*math.pi/180.0, "boxcoud")
edgescoud = geompy.GetShapesOnShape(boxcoud, geometrieSaine, geompy.ShapeType["EDGE"], GEOM.ST_IN)
grped = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionList(grped, edgescoud)
long_coude = geompy.IntersectGroups(grped, grpedy0)
grped = geompy.CutGroups(grpedy0, long_p1)
grped = geompy.CutGroups(grped, long_p2)
ep = geompy.CutGroups(grped, long_coude)
geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' )
geompy.addToStudyInFather( geometrieSaine, ep, 'ep' )
geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' )
geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' )
geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' )
geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' )
# --- face extremite tube (EXTUBE)
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON)
EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(EXTUBE, facesIds)
geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' )
# --- edge bord extremite tube (BORDTU)
edge1Ids = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, GEOM.ST_ON)
edge2Ids = geompy.GetShapesOnCylinderIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, de/2. -epais, GEOM.ST_ON)
edgesIds = []
for edge in edge1Ids:
if edge in edge2Ids:
edgesIds.append(edge)
BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionIDs(BORDTU, edgesIds)
geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' )
# --- face origine tube (CLGV)
pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10)
vec2 = geompy.MakeVector(P2, pp2)
#geompy.addToStudy(vec2, 'vec2')
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(CLGV, facesIds)
geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' )
# --- peau tube interieur (PEAUINT)
extru1 = geompy.MakePrismVecH(diskint, OZ, l_tube_p1)
revol1 = geompy.MakeRevolution(diskint, axe, angleCoude*math.pi/180.0)
rot1 = geompy.MakeRotation(diskint, axe, angleCoude*math.pi/180.0)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
interne = geompy.MakeFuse(extru1, revol1)
interne = geompy.MakeFuse(extru2, interne)
geompy.addToStudy(interne, 'interne')
facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUINT, facesIds)
geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' )
# --- peau tube exterieur (PEAUEXT)
cercle1 = geompy.MakeCircle(centre, OZ, de/2.)
extru1 = geompy.MakePrismVecH(cercle1, OZ, l_tube_p1)
revol1 = geompy.MakeRevolution(cercle1, axe, angleCoude*math.pi/180.0)
rot1 = geompy.MakeRotation(cercle1, axe, angleCoude*math.pi/180.0)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
externe = geompy.MakeFuse(extru1, revol1)
externe = geompy.MakeFuse(extru2, externe)
geompy.addToStudy(externe, 'externe')
facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON)
PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUEXT, facesIds)
geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' )
# --- solide sain
volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"])
COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"])
geompy.UnionIDs(COUDE, volIds)
geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' )
geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE]
return geometriesSaines
# ---------------------------------------------------------------------------
def setParamMaillageSain(self):
self.meshParams = dict(n_long_p1 = 16,
n_ep = 3,
n_long_coude = 15,
n_circ_g = 20,
n_circ_d = 20,
n_long_p2 = 12)
# ---------------------------------------------------------------------------
def genereMaillageSain(self, geometriesSaines, meshParams):
logging.info("genereMaillageSain %s", self.nomCas)
geometrieSaine = geometriesSaines[0]
long_p1 = geometriesSaines[1]
ep = geometriesSaines[2]
long_coude = geometriesSaines[3]
circ_g = geometriesSaines[4]
circ_d = geometriesSaines[5]
long_p2 = geometriesSaines[6]
P1 = geometriesSaines[7]
P2 = geometriesSaines[8]
EXTUBE = geometriesSaines[9]
BORDTU = geometriesSaines[10]
CLGV = geometriesSaines[11]
PEAUINT = geometriesSaines[12]
PEAUEXT = geometriesSaines[13]
COUDE = geometriesSaines[14]
n_long_p1 = meshParams['n_long_p1']
n_ep = meshParams['n_ep']
n_long_coude = meshParams['n_long_coude']
n_circ_g = meshParams['n_circ_g']
n_circ_d = meshParams['n_circ_d']
n_long_p2 = meshParams['n_long_p2']
maillageSain = smesh.Mesh(geometrieSaine)
algo3d = maillageSain.Hexahedron()
algo2d = maillageSain.Quadrangle()
smesh.SetName(algo3d, "algo3d_maillageSain")
smesh.SetName(algo2d, "algo2d_maillageSain")
algo1d_long_p1 = maillageSain.Segment(geom=long_p1)
hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1)
smesh.SetName(algo1d_long_p1, "algo1d_long_p1")
smesh.SetName(hypo1d_long_p1, "hypo1d_long_p1")
algo1d_ep = maillageSain.Segment(geom=ep)
hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep)
smesh.SetName(algo1d_ep, "algo1d_ep")
smesh.SetName(hypo1d_ep, "hypo1d_ep")
algo1d_long_coude = maillageSain.Segment(geom=long_coude)
hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude)
smesh.SetName(algo1d_long_coude, "algo1d_long_coude")
smesh.SetName(hypo1d_long_coude, "hypo1d_long_coude")
algo1d_circ_g = maillageSain.Segment(geom=circ_g)
hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g)
smesh.SetName(algo1d_circ_g, "algo1d_circ_g")
smesh.SetName(hypo1d_circ_g, "hypo1d_circ_g")
algo1d_circ_d = maillageSain.Segment(geom=circ_d)
hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d)
smesh.SetName(algo1d_circ_d, "algo1d_circ_d")
smesh.SetName(hypo1d_circ_d, "hypo1d_circ_d")
algo1d_long_p2 = maillageSain.Segment(geom=long_p2)
hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2)
smesh.SetName(algo1d_long_p2, "algo1d_long_p2")
smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2")
isDone = maillageSain.Compute()
mp1 = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
mp2 = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
ext = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
btu = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
clg = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
pei = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
pex = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
cou = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
return [maillageSain, True] # True : maillage hexa
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
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)
azimut : entre 0 et 360°
alpha : 0 < alpha < angleCoude
longueur : <=2*profondeur ==> force une fissure elliptique (longueur/profondeur = grand axe/petit axe).
orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
elliptique : True : fissure elliptique (longueur/profondeur = grand axe/petit axe); False : fissure longue (fond de fissure de profondeur constante, demi-cercles aux extrémites)
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
azimut = 160,
alpha = 20,
longueur = 400,
orientation = 90,
lgInfluence = 50,
elliptique = False,
externe = True)
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
logging.info("genereShapeFissure %s", self.nomCas)
logging.info("shapeFissureParams %s", shapeFissureParams)
angleCoude = geomParams['angleCoude']
r_cintr = geomParams['r_cintr']
l_tube_p1 = geomParams['l_tube_p1']
l_tube_p2 = geomParams['l_tube_p2']
epais = geomParams['epais']
de = geomParams['de']
profondeur = shapeFissureParams['profondeur']
azimut = shapeFissureParams['azimut']
alpha = shapeFissureParams['alpha']
longueur = shapeFissureParams['longueur']
orientation = shapeFissureParams['orientation']
externe = shapeFissureParams['externe']
lgInfluence = shapeFissureParams['lgInfluence']
self.elliptique = False
if shapeFissureParams.has_key('elliptique'):
self.elliptique = shapeFissureParams['elliptique']
azimut = -azimut # axe inverse / ASCOUF
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
geompy.addToStudy(axe,"axe")
if not lgInfluence:
lgInfluence = profondeur
if longueur > 2*profondeur:
self.fissureLongue=True
else:
self.fissureLongue=False
self.elliptique = True
self.circonferentielle = False
self.longitudinale = False
if self.fissureLongue and not self.elliptique:
if abs(orientation) < 45 :
self.longitudinale = True
else:
self.circonferentielle = True
nbp1 = 10
if self.circonferentielle:
if externe:
dp = -1.0
raybor = de/2.
rayint = raybor - profondeur
rayext = raybor + profondeur/5.0
else:
dp = 1.0
raybor = de/2. - epais
rayint = raybor + profondeur
rayext = raybor - profondeur/5.0
lgfond = longueur -2*profondeur
angle = lgfond/(2*raybor)
pb = geompy.MakeVertex(raybor, 0, 0)
pi = geompy.MakeVertex(rayint, 0, 0)
pbl = geompy.MakeRotation(pb, OZ, angle)
pbr = geompy.MakeRotation(pb, OZ, -angle)
geompy.addToStudy(pbl,"pbl")
geompy.addToStudy(pbr,"pbr")
pal = geompy.MakeTranslationVector(pbl, OZ)
par = geompy.MakeTranslationVector(pbr, OZ)
axl = geompy.MakeVector(pbl,pal)
axr = geompy.MakeVector(pbr,par)
pil = geompy.MakeRotation(pi, OZ, angle)
pir = geompy.MakeRotation(pi, OZ, -angle)
points = []
nbp = 3*nbp1
for i in range(nbp):
angi = dp*(nbp -i)*(2.0*math.pi/3.0)/nbp
pt = geompy.MakeRotation(pil, axl, angi)
points.append(pt)
for i in range(nbp):
angi = angle -2.0*i*angle/nbp
pt = geompy.MakeRotation(pi, OZ, angi)
points.append(pt)
for i in range(nbp+1):
angi = -dp*i*(2.0*math.pi/3.0)/nbp
pt = geompy.MakeRotation(pir, axr, angi)
points.append(pt)
for i, pt in enumerate(points):
pt = geompy.MakeRotation(pt, OZ, azimut*math.pi/180.)
pt = geompy.MakeTranslation(pt, 0, 0, -l_tube_p1)
pt = geompy.MakeRotation(pt, axe, alpha*math.pi/180.)
points[i] = pt
wire0 = geompy.MakeInterpol(points[0:nbp+1])
wire1 = geompy.MakeInterpol(points[nbp:2*nbp+1])
wire2 = geompy.MakeInterpol(points[2*nbp:3*nbp+1])
#wiretube = geompy.MakeInterpol(points)
wiretube=geompy.MakeWire([wire0,wire1,wire2])
geompy.addToStudy(wiretube,"wiretube")
pe = geompy.MakeVertex(rayext, 0, 0)
pe = geompy.MakeRotation(pe, OZ, azimut*math.pi/180.)
pe = geompy.MakeTranslation(pe, 0, 0, -l_tube_p1)
pe = geompy.MakeRotation(pe, axe, alpha*math.pi/180.)
arce = geompy.MakeArc(points[0], pe, points[-1])
geompy.addToStudy(arce,"arce")
facefiss = geompy.MakeFaceWires([arce, wiretube], 1)
geompy.addToStudy( facefiss, 'facefissPlace' )
pc = geompy.MakeVertex((raybor + rayint)/2.0, 0, 0)
centre = geompy.MakeRotation(pc, OZ, azimut*math.pi/180.)
centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1)
centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.)
geompy.addToStudy( centre, 'centrefissPlace' )
wiretube = geompy.GetInPlace(facefiss, wiretube)
geompy.addToStudy(wiretube, 'wiretubePlace' )
try:
edgetube = geompy.MakeEdgeWire(wiretube)
geompy.addToStudy(edgetube,"edgetube")
except:
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgetube = None
# ---------------------------------------------------------
elif self.longitudinale:
if externe:
raybor = de/2.
dp = -1.0
else:
raybor = de/2. - epais
dp = +1.0
prof = dp * profondeur
lgfond = longueur -2*profondeur
cosaz = math.cos(azimut*math.pi/180.)
sinaz = math.sin(azimut*math.pi/180.)
alfrd = alpha*math.pi/180.
rayxy = r_cintr + raybor*cosaz
angle = lgfond/(2.*rayxy)
logging.debug("longueur: %s, angle: %s, rayon: %s",lgfond, angle, rayxy)
pb = geompy.MakeVertex(raybor*cosaz, raybor*sinaz, -l_tube_p1, "pb")
pi = geompy.MakeTranslation(pb, prof*cosaz, prof*sinaz, 0., "pi")
pbv = geompy.MakeTranslation(pb, -sinaz, cosaz, 0., "pbv")
axb = geompy.MakeVector(pb,pbv, "axb")
pbl = geompy.MakeRotation(pb, axe, alfrd -angle, "pbl")
pbr = geompy.MakeRotation(pb, axe, alfrd +angle, "pbr")
axl = geompy.MakeRotation(axb, axe, alfrd -angle, "axl")
axr = geompy.MakeRotation(axb, axe, alfrd +angle, "axr")
pil = geompy.MakeRotation(pi, axe, alfrd -angle, "pil")
pir = geompy.MakeRotation(pi, axe, alfrd +angle, "pir")
curves = []
points = []
nbp = 3*nbp1
xs = []
totx = 0
for i in range(nbp+2):
x = math.sin(i*math.pi/(nbp+1)) # fonction de répartition des points : distance relative
x2 = x*x
totx += x2
xs.append(totx)
logging.debug("x2: %s, totx: %s", x2, totx)
for i in range(nbp+1):
#posi = nbp -i # répartition équidistante des points sur la courbe
posi = nbp*(1 -xs[i]/totx) # points plus resserrés aux extrémités de la courbe
angi = -dp*posi*(5.0*math.pi/8.0)/nbp
pt = geompy.MakeRotation(pil, axl, angi)
points.append(pt)
curves.append(geompy.MakeInterpol(points))
point0 = points[0]
geompy.addToStudy(curves[-1],"curve0")
# for i, pt in enumerate(points):
# name = "point%d"%i
# geompy.addToStudyInFather(curves[-1], pt, name)
points = []
nbp = 3*nbp1
xs =[]
totx = 0
for i in range(nbp+1):
x = math.sin(i*math.pi/nbp)
#x = 1.0 # répartition équidistante des points sur la courbe
x2 = x*x # points plus resserrés aux extrémités de la courbe
totx += x2
xs.append(totx)
logging.debug("x2: %s, totx: %s", x2, totx)
for i in range(nbp):
angi = alfrd -angle +2.0*angle*xs[i]/totx
pt = geompy.MakeRotation(pi, axe, angi)
points.append(pt)
curves.append(geompy.MakeInterpol(points))
geompy.addToStudy(curves[-1],"curve1")
# for i, pt in enumerate(points):
# name = "point%d"%i
# geompy.addToStudyInFather(curves[-1], pt, name)
points = []
nbp = 3*nbp1
xs = []
totx = 0
for i in range(nbp+2):
x = math.sin(i*math.pi/(nbp+1))
x2 = x*x
totx += x2
xs.append(totx)
logging.debug("x2: %s, totx: %s", x2, totx)
for i in range(nbp+1):
#posi = nbp -i # répartition équidistante des points sur la courbe
posi = nbp*xs[i]/totx # points plus resserrés aux extrémités de la courbe
angi = dp*posi*(5.0*math.pi/8.0)/nbp
pt = geompy.MakeRotation(pir, axr, angi)
points.append(pt)
curves.append(geompy.MakeInterpol(points))
point1 = points[-1]
geompy.addToStudy(curves[-1],"curve2")
# for i, pt in enumerate(points):
# name = "point%d"%i
# geompy.addToStudyInFather(curves[-1], pt, name)
wiretube = geompy.MakeWire(curves)
geompy.addToStudy(wiretube,"wiretube")
try:
edgetube = geompy.MakeEdgeWire(wiretube)
geompy.addToStudy(edgetube,"edgetube")
except:
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgetube = None
pts = []
pts.append(point0)
dpr = prof*math.cos(5.0*math.pi/8.0)
pe = geompy.MakeTranslation(pb, dpr*cosaz, dpr*sinaz, 0., "pe")
for i in range(nbp):
angi = alfrd -angle +2.0*i*angle/nbp
pt = geompy.MakeRotation(pe, axe, angi)
pts.append(pt)
pts.append(point1)
arce = geompy.MakeInterpol(pts)
geompy.addToStudy(arce,"arce")
facefiss = geompy.MakeFaceWires([arce, wiretube], 0)
geompy.addToStudy( facefiss, 'facefissPlace' )
pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.)
centre = geompy.MakeRotation(pc, axe, alfrd)
geompy.addToStudy( centre, 'centrefissPlace' )
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
edgesTriees, minl, maxl = sortEdges(edges)
edges = edgesTriees[:-1] # la plus grande correspond à arce, on l'elimine
wiretube = geompy.MakeWire(edges)
#wiretube = edgesTriees[-1]
geompy.addToStudy(wiretube, 'wiretubePlace' )
# ---------------------------------------------------------
else: # fissure elliptique, longue ou courte
if externe:
raybor = de/2.
dp = -1.0
else:
raybor = de/2. - epais
dp = +1.0
prof = dp * profondeur
cosaz = math.cos(azimut*math.pi/180.)
sinaz = math.sin(azimut*math.pi/180.)
alfrd = alpha*math.pi/180.
pb = geompy.MakeVertex(raybor*cosaz, raybor*sinaz, -l_tube_p1, "pb")
pi = geompy.MakeTranslation(pb, prof*cosaz, prof*sinaz, 0., "pi")
pbv = geompy.MakeTranslation(pb, -profondeur*sinaz, profondeur*cosaz, 0., "pbv")
ayb = geompy.MakeVector(pb,pbv, "ayb")
pb0 = geompy.MakeRotation(pb, axe, alfrd, "pb0")
ay0 = geompy.MakeRotation(ayb, axe, alfrd, "ay0")
pi0 = geompy.MakeRotation(pi, axe, alfrd, "pi0")
az_ = geompy.MakeVector(pi0, pb0, "az_")
az0 = geompy.MakeTranslationVector(az_, az_, "az0") #normale sortante
ax0 = geompy.MakeRotation(ay0, az0, -math.pi/2.0, "ax0")
ax1 = geompy.MakeRotation(ax0, az0, orientation*math.pi/180., "ax1")
ay1 = geompy.MakeRotation(ay0, az0, orientation*math.pi/180., "ay1")
originLCS = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0, "originLCS")
coo = geompy.PointCoordinates(pb0)
cox = geompy.VectorCoordinates(ax1)
coy = geompy.VectorCoordinates(ay1)
localLCS = geompy.MakeMarker(coo[0], coo[1], coo[2], cox[0], cox[1], cox[2], coy[0], coy[1], coy[2], "localLCS")
pco = geompy.MakeVertex(0, 0, -profondeur, "pco")
pao = geompy.MakeRotation(pco, OY, 0.6*math.pi, "pao")
pbo = geompy.MakeRotation(pco, OY, -0.6*math.pi, "pbo")
pce = geompy.MakeVertex(0, 0, 0.1*profondeur,"pce")
arcoo = geompy.MakeArc(pao, pco, pbo, "arcoo")
linoo = geompy.MakeArc(pao, pce, pbo, "linoo")
scalex = longueur/profondeur
arco =geompy.MakeScaleAlongAxes(arcoo, O, scalex, 1., 1., "arco")
lino =geompy.MakeScaleAlongAxes(linoo, O, scalex, 1., 1., "lino")
arci = geompy.MakePosition(arco, originLCS, localLCS, "arci")
arce = geompy.MakePosition(lino, originLCS, localLCS, "arce")
facefiss = geompy.MakeFaceWires([arce, arci], 0)
geompy.addToStudy( facefiss, 'facefissPlace' )
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
edgesTriees, minl, maxl = sortEdges(edges)
edgetube = edgesTriees[-1] # la plus grande correspond à arci
wiretube = edgetube
pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.)
centre = geompy.MakeRotation(pc, axe, alfrd)
geompy.addToStudy( centre, 'centrefissPlace' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, profondeur/2. ,profondeur)
return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, edgetube]
# ---------------------------------------------------------------------------
def setParamMaillageFissure(self):
"""
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 = 5,
nbsegCercle = 6,
areteFaceFissure = 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):
maillageFissure = insereFissureGenerale(maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
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)

View File

@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
from blocFissure import gmu
from blocFissure.gmu.initEtude import initEtude
from blocFissure.gmu.getStatsMaillageFissure import getStatsMaillageFissure
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"
def __init__(self, numeroCas):
initEtude()
self.numeroCas = numeroCas
self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
self.fissureLongue = False
def setParamGeometrieSaine(self):
self.geomParams = {}
def genereGeometrieSaine(self, geomParams):
geometriesSaines = [None]
return geometriesSaines
def setParamMaillageSain(self):
self.meshParams = {}
def genereMaillageSain(self, geometriesSaines, meshParams):
maillagesSains = [None]
return maillagesSains
def setParamShapeFissure(self):
self.shapeFissureParams = {}
def genereShapeFissure(self, geometriesSaines, geomParams, shapeFissureParams):
shapesFissure = [None]
return shapesFissure
def setParamMaillageFissure(self):
self.maillageFissureParams = {}
def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, maillageFissureParams):
elementsDefaut = [None]
return elementsDefaut
def genereMaillageFissure(self, geometriesSaines, maillagesSains, shapesFissure,
maillageFissureParams, elementsDefaut, step):
maillageFissure = None
return maillageFissure
def setReferencesMaillageFissure(self):
referencesMaillageFissure = {}
return referencesMaillageFissure
# ---------------------------------------------------------------------------
def executeProbleme(self, step=-1):
print "executeProbleme", self.nomCas
if step == 0:
return
self.setParamGeometrieSaine()
geometriesSaines = self.genereGeometrieSaine(self.geomParams)
if step == 1:
return
self.setParamMaillageSain()
maillagesSains = self.genereMaillageSain(geometriesSaines, self.meshParams)
if step == 2:
return
self.setParamShapeFissure()
shapesFissure = self.genereShapeFissure(geometriesSaines, self.geomParams, self.shapeFissureParams)
if step == 3:
return
self.setParamMaillageFissure()
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)
self.setReferencesMaillageFissure()
mesures = getStatsMaillageFissure(maillageFissure, self.referencesMaillageFissure, self.maillageFissureParams)

View File

@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
from toreFissure import toreFissure
from ellipsoideDefaut import ellipsoideDefaut
from rotTrans import rotTrans
from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
# -----------------------------------------------------------------------------
# --- création élements géométriques fissure elliptique
def genereElemsFissureElliptique(shapeFissureParams):
"""
TODO: a completer
"""
logging.info('start')
centreDefaut = shapeFissureParams['centreDefaut']
vecteurDefaut = shapeFissureParams['vecteurDefaut']
demiGrandAxe = shapeFissureParams['demiGrandAxe']
demiPetitAxe = shapeFissureParams['demiPetitAxe']
orientation = shapeFissureParams['orientation']
tailleDefaut = shapeFissureParams['taille']
# --- ellipse incomplete : generatrice
allonge = demiGrandAxe/demiPetitAxe
rayonTore = demiPetitAxe/5.0
generatrice, FaceGenFiss, 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
pipe0 = rotTrans(Pipe_1, orientation, centreDefaut, vecteurDefaut)
gener1 = rotTrans(generatrice, orientation, centreDefaut, vecteurDefaut)
pipe1 = rotTrans(Pipe1Part, orientation, centreDefaut, vecteurDefaut)
facefis1 = rotTrans(FaceFissure, orientation, centreDefaut, vecteurDefaut)
plane1 = rotTrans(Plane_1, orientation, centreDefaut, vecteurDefaut)
ellipsoide1 = rotTrans(ellipsoide, orientation, centreDefaut, vecteurDefaut)
geompy.addToStudy( pipe0, 'pipe0' )
geompy.addToStudy( gener1, 'gener1' )
geompy.addToStudy( pipe1, 'pipe1' )
geompy.addToStudy( facefis1, 'facefis1' )
geompy.addToStudy( plane1, 'plane1' )
geompy.addToStudy( ellipsoide1, 'ellipsoide1' )
shapeDefaut = facefis1
xyz_defaut = geompy.PointCoordinates(centreDefaut)
coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefis1, demiPetitAxe/10.0, demiPetitAxe/5.0)
return shapeDefaut, xyz_defaut, tailleDefaut, coordsNoeudsFissure, pipe0, gener1, pipe1, facefis1, plane1, ellipsoide1

View File

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import smesh
from salome.smesh import smeshBuilder
# -----------------------------------------------------------------------------
# --- maillage face de fissure pour identification zone de defaut
def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
"""
TODO: a completer
"""
logging.info('start')
meshFissure = smesh.Mesh(facefiss)
algo2d = meshFissure.Triangle(algo=smeshBuilder.NETGEN_1D2D)
hypo2d = algo2d.Parameters()
hypo2d.SetMaxSize( maxSize )
hypo2d.SetSecondOrder( 0 )
hypo2d.SetOptimize( 1 )
hypo2d.SetFineness( 2 )
hypo2d.SetMinSize( minSize )
hypo2d.SetQuadAllowed( 0 )
isDone = meshFissure.Compute()
smesh.SetName(algo2d, "algo2d_zoneFiss")
smesh.SetName(hypo2d, "hypo1d_zoneFiss")
coordsNoeudsFissure = []
nodeIds = meshFissure.GetNodesId()
for id in nodeIds:
coords = meshFissure.GetNodeXYZ(id)
coordsNoeudsFissure.append(coords[0])
coordsNoeudsFissure.append(coords[1])
coordsNoeudsFissure.append(coords[2])
return coordsNoeudsFissure

View File

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
import logging
logging.info('start')
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
logging.debug("initialisation de geompy et smesh OK")

View File

@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
import bisect
publie = False
def getCentreFondFiss(shapesFissure):
"""
identification du centre de fond de fissure,
transformation fond de fissure en edge unique (seulement pour la procédure insereFissureGenerale).
On distingue le cas d'utilisation de la procédure insereFissureLongue par le nombre d'éléments de shapesFissure.
"""
global publie
logging.debug("start")
fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
if len(shapesFissure) == 6: # procédure insereFissureGenerale, et edge fond de fissure fournie explicitement
edgeFondExt = shapesFissure[5]
else:
edgeFondExt = None
if len(shapesFissure) > 6: # procédure insereFissureLongue (fissure plane, plusieurs edges sur le fond de fissure)
centreFondFiss = shapesFissure[1]
tgtCentre = None
else: # procédure insereFissureGenerale, détermination edge unique et milieu de l'edge
if geompy.NumberOfEdges(fondFiss) > 1:
if geompy.NbShapes(fondFiss, geompy.ShapeType["WIRE"]) > 0: # wire
aWire = fondFiss
else: # compound
edges = geompy.ExtractShapes(fondFiss, geompy.ShapeType["EDGE"], False)
aWire = geompy.MakeWire(edges, 1e-07)
else:
edgeFondExt = fondFiss
aWire = geompy.MakeWire([fondFiss], 1e-07)
if not publie:
geompy.addToStudy(aWire, "wireFondFissExt")
lgWire = geompy.BasicProperties(aWire)[0]
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], True)
lgEdges = [geompy.BasicProperties(ed)[0] for ed in edges]
lgSumEd =[sum(lgEdges[0:i+1]) for i in range(len(lgEdges))]
iedr = bisect.bisect_left(lgSumEd, lgWire/2.0)
iedg = iedr -1
if iedg < 0:
lgOnEdge = lgWire/2.0
else:
lgOnEdge = lgWire/2.0 - lgSumEd[iedg]
logging.debug("lgsumEdges %s", lgSumEd)
logging.debug("id edge: %s, lgOnEdge: %s, lgEdge: %s",iedr, lgOnEdge, lgEdges[iedr])
if iedr > 0: # il y a une edge avant celle du milieu
if geompy.MinDistance(edges[iedr-1], geompy.MakeVertexOnCurve(edges[iedr], 0.0 )) < 1.e-3: # edge orientée croissante
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
else:
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr])
elif iedr < len(edges)-1: # il y a une edge après celle du milieu
if geompy.MinDistance(edges[iedr+1], geompy.MakeVertexOnCurve(edges[iedr], 1.0 )) < 1.e-3: # edge orientée croissante
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
else:
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr])
else: # on ne sait pas comment est orientée l'edge unique, mais ça n'a pas d'importance
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
geompy.addToStudyInFather(aWire, centreFondFiss, "centreFondFiss")
tgtCentre = geompy.MakeTangentOnCurve(edges[iedr], lgOnEdge/ lgEdges[iedr])
if edgeFondExt is None: # fond de fissure non fourni explicitement sous forme d'edge
try:
edgeFondExt = geompy.MakeEdgeWire(aWire, 0.0005, 1e-07)
except:
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgeFondExt = None
if not publie and edgeFondExt is not None:
geompy.addToStudy(edgeFondExt, "edgeFondExt")
publie = True
return edgeFondExt, centreFondFiss, tgtCentre

View File

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
import logging
import SMESH
# -----------------------------------------------------------------------------
# --- statistiques maillage
def getStatsMaillageFissure(maillage, referencesMaillageFissure, maillageFissureParams):
"""
TODO: a completer
"""
logging.debug('start')
nomRep = '.'
if maillageFissureParams.has_key('nomRep'):
nomRep = maillageFissureParams['nomRep']
nomFicFissure = maillageFissureParams['nomFicFissure']
fichierStatMaillageFissure = nomRep + '/' + nomFicFissure + '.res'
fichierNewRef = nomRep + '/' + nomFicFissure + '.new'
logging.debug("fichierStatMaillageFissure=%s", fichierStatMaillageFissure)
OK = False
if maillage is not None:
mesures = maillage.GetMeshInfo()
d= {}
for key, value in mesures.iteritems():
logging.debug( "key: %s value: %s", key, value)
d[str(key)] = value
logging.debug("dico mesures %s", d)
f = open(fichierStatMaillageFissure, 'w')
f2 = open(fichierNewRef, 'w')
OK = True
for key in ('Entity_Quad_Pyramid', 'Entity_Quad_Hexa', 'Entity_Quad_Quadrangle'):
if d[key] != referencesMaillageFissure[key]:
logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
OK = False
else:
logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
f2.write(key + " = " + str(d[key]) + ",\n")
tolerance = 0.05
for key in ('Entity_Quad_Penta', 'Entity_Quad_Tetra', 'Entity_Quad_Triangle', 'Entity_Quad_Edge', 'Entity_Node'):
if (d[key] < (1.0 - tolerance)*referencesMaillageFissure[key]) \
or (d[key] > (1.0 + tolerance)*referencesMaillageFissure[key]):
logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
OK = False
else:
logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
f2.write(key + " = " + str(d[key]) + ",\n")
f.close()
f2.close()
return OK

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- transformation d'une liste de subshapes en une liste d'Id
def getSubshapeIds(obj, subshapes):
"""
transformation d'une liste de subshapes en une liste d'Id
"""
logging.debug("start")
subshapesId = []
for sub in subshapes:
subshapesId.append(geompy.GetSubShapeID(obj, sub))
logging.debug("subshapesId=%s", subshapesId)
return subshapesId

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
import logging
myStudy = None
def initEtude():
"""
creation nouvelle etude salome
"""
import geomsmesh

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
import logging
def setDebug():
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.DEBUG)
logging.info('start Debug')
def setVerbose():
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.INFO)
logging.info('start Verbose')
def setRelease():
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.WARNING)
logging.warning('start Release')
def setUnitTests():
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
logging.critical('start UnitTests')
#logging.basicConfig(filename='myapp.log',
# format='%(asctime)s %(message)s',
# datefmt='%m/%d/%Y %I:%M:%S %p',
# level=logging.DEBUG)

View File

@ -0,0 +1,196 @@
# -*- coding: utf-8 -*-
import logging
import salome
from geomsmesh import geompy
from geomsmesh import smesh
import SMESH
import math
from partitionBlocDefaut import partitionBlocDefaut
from facesVolumesToriques import facesVolumesToriques
from facesCirculaires import facesCirculaires
from propagateTore import propagateTore
from sortGeneratrices import sortGeneratrices
from facesFissure import facesFissure
from facesToreInBloc import facesToreInBloc
from shapeSurFissure import shapeSurFissure
from meshBlocPart import meshBlocPart
from enleveDefaut import enleveDefaut
from regroupeSainEtDefaut import RegroupeSainEtDefaut
from putName import putName
# -----------------------------------------------------------------------------
# --- procedure complete fissure elliptique
def insereFissureElliptique(geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step=-1):
"""
TODO: a completer
"""
logging.info('start')
geometrieSaine = geometriesSaines[0]
maillageSain = maillagesSains[0]
isHexa = maillagesSains[1]
shapeDefaut = shapesFissure[0]
tailleDefaut = shapesFissure[2]
pipe0 = shapesFissure[4]
gener1 = shapesFissure[5]
pipe1 = shapesFissure[6]
facefis1 = shapesFissure[7]
plane1 = shapesFissure[8]
ellipsoide1 = shapesFissure[9]
demiGrandAxe = shapeFissureParams['demiGrandAxe']
demiPetitAxe = shapeFissureParams['demiPetitAxe']
orientation = shapeFissureParams['orientation']
nomRep = maillageFissureParams['nomRep']
nomFicSain = maillageFissureParams['nomFicSain']
nomFicFissure = maillageFissureParams['nomFicFissure']
nbsegExt = maillageFissureParams['nbsegExt'] # 5
nbsegGen = maillageFissureParams['nbsegGen'] # 25
nbsegRad = maillageFissureParams['nbsegRad'] # 5
scaleRad = maillageFissureParams['scaleRad'] # 4
nbsegCercle = maillageFissureParams['nbsegCercle'] # 6
nbsegFis = maillageFissureParams['nbsegFis'] # 20
lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0
fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
facesDefaut = elementsDefaut[0]
centreDefaut = elementsDefaut[1]
normalDefaut = elementsDefaut[2]
extrusionDefaut = elementsDefaut[3]
dmoyen = elementsDefaut[4]
bordsPartages = elementsDefaut[5]
fillconts = elementsDefaut[6]
idFilToCont = elementsDefaut[7]
maillageSain = elementsDefaut[8]
internalBoundary = elementsDefaut[9]
zoneDefaut = elementsDefaut[10]
zoneDefaut_skin = elementsDefaut[11]
zoneDefaut_internalFaces = elementsDefaut[12]
zoneDefaut_internalEdges = elementsDefaut[13]
## --- ellipse incomplete : generatrice
#if step == 5:
#return None
#allonge = demiGrandAxe/demiPetitAxe
#rayonTore = demiPetitAxe/5.0
#generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part = self.toreFissure(demiPetitAxe, allonge, rayonTore)
#ellipsoide = self.ellipsoideDefaut(demiPetitAxe, allonge, rayonTore)
## --- positionnement sur le bloc defaut de generatrice, tore et plan fissure
#if step == 6:
#return None
#pipe0 = self.rotTrans(Pipe_1, orientation, centreDefaut, normalDefaut)
#gener1 = self.rotTrans(generatrice, orientation, centreDefaut, normalDefaut)
#pipe1 = self.rotTrans(Pipe1Part, orientation, centreDefaut, normalDefaut)
#facefis1 = self.rotTrans(FaceFissure, orientation, centreDefaut, normalDefaut)
#plane1 = self.rotTrans(Plane_1, orientation, centreDefaut, normalDefaut)
#ellipsoide1 = self.rotTrans(ellipsoide, orientation, centreDefaut, normalDefaut)
#geompy.addToStudy( pipe0, 'pipe0' )
#geompy.addToStudy( gener1, 'gener1' )
#geompy.addToStudy( pipe1, 'pipe1' )
#geompy.addToStudy( facefis1, 'facefis1' )
#geompy.addToStudy( plane1, 'plane1' )
#geompy.addToStudy( ellipsoide1, 'ellipsoide1' )
# --- partition du bloc défaut par génératrice, tore et plan fissure
if step == 7:
return None
[blocPartition, blocp, tore,
faceFissure, facesExternes, facesExtBloc, facesExtElli,
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1,
facefis1, ellipsoide1)
if not isHexa:
edgesBords = None # maillage sain hexa ==> filling, et maillage edges Bords imposés du maillage sain
# --- TORE
# --- faces toriques du tore
if step == 8:
return None
[facetore1, facetore2, volumeTore1, volumeTore2] = facesVolumesToriques(tore, plane1, facesDefaut)
# --- faces 1/2 circulaires et edges dans le plan de fissure
if step == 9:
return None
[faces, centres, edges, reverses] = facesCirculaires(extrusionDefaut, tore)
# --- recherche et classement des edges du tore par propagate
if step == 10:
return None
[diams, circles, geners] = propagateTore(tore)
# --- tri par longueur des 3 génératrices
if step == 11:
return None
[genext, genint, gencnt] = sortGeneratrices(tore, geners)
# --- faces fissure dans et hors tore, et edges face hors tore
if step == 12:
return None
[facefissintore, facefissoutore, edgeint, edgeext, reverext] = \
facesFissure(ellipsoidep, faceFissure, extrusionDefaut, genint)
# --- identification des faces tore et fissure dans le solide hors tore
if step == 13:
return None
[blocFaceFiss, blocFaceTore1, blocFaceTore2] = \
facesToreInBloc(ellipsoidep, facefissoutore, facetore1, facetore2)
# --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)
#shapesAModifier = self.shapesSurFissure(blocPartition, plane1 faceFissure, gencnt)
if step == 14:
return None
extrusionFaceFissure, normfiss = shapeSurFissure(plane1)
# --- maillage du bloc partitionne
if step == 15:
return None
[bloc1, blocComplet] = \
meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces,
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli,
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords,
nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle,
nbsegFis, dmoyen, lensegEllipsoide)
if step == 16:
return None
maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges)
if step == 17:
return None
maillageComplet = RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceFissure, 'VOLUMES')
if step == 18:
return None
maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 )
putName(maillageComplet, nomFicFissure)
logging.info("fichier maillage fissure : %s", fichierMaillageFissure)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
return maillageComplet

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,656 @@
# -*- coding: utf-8 -*-
import logging
import salome
from geomsmesh import geompy
from geomsmesh import smesh
from salome.smesh import smeshBuilder
import SMESH
import math
from extractionOrientee import extractionOrientee
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 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
# -----------------------------------------------------------------------------
# --- procedure complete fissure longue
def insereFissureLongue(geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step=-1):
"""
TODO: a completer
"""
logging.info('start')
#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
planfiss = shapesFissure[7] # plan de fissure
pipefiss = shapesFissure[8] # pipe, debordant
profondeur = shapeFissureParams['profondeur']
rayonPipe = profondeur/4.0
nomRep = maillageFissureParams['nomRep']
nomFicSain = maillageFissureParams['nomFicSain']
nomFicFissure = maillageFissureParams['nomFicFissure']
#nbsegExt = maillageFissureParams['nbsegExt'] # 5
#nbsegGen = maillageFissureParams['nbsegGen'] # 25
#nbsegRad = maillageFissureParams['nbsegRad'] # 5
#scaleRad = maillageFissureParams['scaleRad'] # 4
#nbsegCercle = maillageFissureParams['nbsegCercle'] # 6
#nbsegFis = maillageFissureParams['nbsegFis'] # 20
#lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0
#fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
facesDefaut = elementsDefaut[0]
#centreDefaut = elementsDefaut[1]
#normalDefaut = elementsDefaut[2]
#extrusionDefaut = elementsDefaut[3]
#dmoyen = elementsDefaut[4]
#bordsPartages = elementsDefaut[5]
#fillconts = elementsDefaut[6]
#idFilToCont = elementsDefaut[7]
maillageSain = elementsDefaut[8]
internalBoundary = elementsDefaut[9]
zoneDefaut = elementsDefaut[10]
zoneDefaut_skin = elementsDefaut[11]
zoneDefaut_internalFaces = elementsDefaut[12]
zoneDefaut_internalEdges = elementsDefaut[13]
facePorteFissure = shapeDefaut
WirePorteFondFissure = wiretube
fillingFaceExterne = facesDefaut[0]
print fillingFaceExterne
geompy.addToStudy(fillingFaceExterne, "fillingFaceExterne")
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
O, OX, OY, OZ = triedreBase()
# -----------------------------------------------------------------------------
# --- peau et face de fissure
# --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée
partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
geompy.addToStudy( partitionPeauFissFond, 'partitionPeauFissFond' )
edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False)
lgmax = 0
imax = 0
for i, edge in enumerate(edges):
props = geompy.BasicProperties(edge)
lg = props[0]
if lg > lgmax:
lgmax = lg
imax = i
edgemax = edges[imax]
geompy.addToStudy(edgemax, 'edgemax')
centreFondFiss = geompy.MakeVertexOnCurve(edgemax, 0.5)
geompy.addToStudy(centreFondFiss, 'centreFondFiss')
tangentFondFiss = geompy.MakeTangentOnCurve(edgemax, 0.5)
geompy.addToStudy(tangentFondFiss, 'tangentFondFiss')
bord1FondFiss = geompy.MakeVertexOnCurve(edgemax, 0.0)
geompy.addToStudy(bord1FondFiss, 'bord1FondFiss')
tangentBord1FondFiss = geompy.MakeTangentOnCurve(edgemax, 0.0)
geompy.addToStudy(tangentBord1FondFiss, 'tangentBord1FondFiss')
bord2FondFiss = geompy.MakeVertexOnCurve(edgemax, 1.0)
geompy.addToStudy(bord2FondFiss, 'bord2FondFiss')
tangentBord2FondFiss = geompy.MakeTangentOnCurve(edgemax, 1.0)
geompy.addToStudy(tangentBord2FondFiss, 'tangentBord2FondFiss')
planBord1 = geompy.MakePlane(bord1FondFiss, tangentBord1FondFiss, 3*rayonPipe)
planBord2 = geompy.MakePlane(bord2FondFiss, tangentBord2FondFiss, 3*rayonPipe)
geompy.addToStudy(planBord1, 'planBord1')
geompy.addToStudy(planBord2, 'planBord2')
[edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[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)
geompy.addToStudy( partitionPeauFissByPipe, 'partitionPeauFissByPipe' )
# --- identification face de peau
[facesPeauFissInside, facesPeauFissOutside, facesPeauFissOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissByPipe, centreFondFiss, "FACE", 0.1, "peauFiss_bord_")
facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFissOnside) # 4 demi disques, une grande face
facePeau = facesPeauSorted[-1] # la plus grande face
geompy.addToStudyInFather(partitionPeauFissByPipe, facePeau, "facePeau")
# --- identification edges de bord face peau
edgesBords = []
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
edgesBords.append(edgepeau)
groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesBords)
geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
# --- identification face fissure externe au pipe et edge commune peau fissure
for face in facesPeauFissInside:
try:
sharedEdges = geompy.GetSharedShapesMulti([facePeau, face], geompy.ShapeType["EDGE"])
if sharedEdges is not None:
faceFiss = face
edgePeauFiss = sharedEdges[0]
geompy.addToStudyInFather(partitionPeauFissByPipe, faceFiss, "faceFiss")
geompy.addToStudyInFather(faceFiss, edgePeauFiss, "edgePeauFiss")
geompy.addToStudyInFather(facePeau, edgePeauFiss, "edgePeauFiss")
break
except:
pass
verticesEdgePeauFiss = geompy.ExtractShapes(edgePeauFiss, geompy.ShapeType["VERTEX"], False)
# --- identification edges demi cercle dans face de peau
edgesFacePeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
edgesFacePeauSorted, minlg, maxlg = sortEdges(edgesFacePeau)
demiCerclesPeau = edgesFacePeauSorted[0:4]
verticesDemiCerclesPeau = []
for i, edge in enumerate(demiCerclesPeau):
name = "demiCerclePeau_%d"%i
geompy.addToStudyInFather(facePeau, edge, name)
verticesDemiCerclesPeau += geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
verticesDemiCerclesPeau = eliminateDoubles(facePeau, verticesDemiCerclesPeau)
for i, vertex in enumerate(verticesDemiCerclesPeau):
name = "verticesDemiCerclesPeau_%d"%i
geompy.addToStudyInFather(facePeau, vertex, name)
verticesOutCercles = substractSubShapes(facePeau, verticesDemiCerclesPeau, verticesEdgePeauFiss)
for i, vertex in enumerate(verticesOutCercles):
name = "verticesOutCercles_%d"%i
geompy.addToStudyInFather(facePeau, vertex, name)
# --- demi cercles regroupés
groupsDemiCerclesPeau = []
for i, vertex in enumerate(verticesEdgePeauFiss):
demis = []
for edge in demiCerclesPeau:
if geompy.MinDistance(vertex, edge) < 1.e-5:
demis.append(edge)
group = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(group, demis)
name = "Cercle%d"%i
geompy.addToStudyInFather(facePeau, group , name)
groupsDemiCerclesPeau.append(group)
# --- identification edges commune pipe face fissure externe au pipe
edgePeauFissId = geompy.GetSubShapeID(partitionPeauFissByPipe, edgePeauFiss)
edgesFaceFiss = geompy.ExtractShapes(faceFiss, geompy.ShapeType["EDGE"], False)
edgesFaceFissPipe = []
for edge in edgesFaceFiss:
if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId:
edgesFaceFissPipe.append(edge)
name = "edgeFaceFissPipe_%d"%len(edgesFaceFissPipe)
geompy.addToStudyInFather(faceFiss, edge, name)
groupEdgesFaceFissPipe = geompy.CreateGroup(faceFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesFaceFissPipe, edgesFaceFissPipe)
geompy.addToStudyInFather(faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe")
# -----------------------------------------------------------------------------
# --- pipe de fond de fissure
wireFondFiss = geompy.MakeWire(edgesInside, 1e-07)
disque = geompy.MakeDiskPntVecR(centreFondFiss, tangentFondFiss, rayonPipe)
[vertex] = geompy.ExtractShapes(disque, geompy.ShapeType["VERTEX"], False)
vertproj = geompy.MakeProjection(vertex, planfiss)
vec1 = geompy.MakeVector(centreFondFiss, vertex)
try:
# si centreFondFiss et vertproj sont proches: exception. Angle = +- 90°
vec2 = geompy.MakeVector(centreFondFiss, vertproj)
angle = geompy.GetAngleRadians(vec1, vec2)
except:
# on utilise la projection du centre sur la peau pour avoir un vecteur non nul
vertproj = geompy.MakeProjection(centreFondFiss, facePeau)
vec2 = geompy.MakeVector(centreFondFiss, vertproj)
angle = geompy.GetAngleRadians(vec1, vec2)
sommetAxe = geompy.MakeTranslationVector(centreFondFiss, tangentFondFiss)
pm = produitMixte(centreFondFiss, vertex, vertproj, sommetAxe)
if pm > 0:
disque = geompy.MakeRotation(disque, tangentFondFiss, angle)
else:
disque = geompy.MakeRotation(disque, tangentFondFiss, -angle)
[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)
#pipe = geompy.MakePipe(disque, WirePorteFondFissure)
#pipe = geompy.MakePartition([pipe],[fillingFaceExterne], [], [], geompy.ShapeType["SOLID"], 0, [], 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)
geompy.addToStudy( disque, 'disque')
geompy.addToStudy( wireFondFiss, 'wireFondFiss')
geompy.addToStudy( pipeFondFiss, 'pipeFondFiss')
VerticesEndFondFiss = findWireEndVertices(wireFondFiss)
for i, v in enumerate(VerticesEndFondFiss):
name = "vertexEndFondFiss_%d"%i
geompy.addToStudyInFather(wireFondFiss, v, name)
VerticesEndPipeFiss = []
for v in VerticesEndFondFiss:
VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v))
for i, v in enumerate(VerticesEndPipeFiss):
name = "vertexEndPipeFiss_%d"%i
geompy.addToStudyInFather(pipeFondFiss, v, name)
geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[0], "PFOR")
geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[1], "PFEX")
if geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[0]) > geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[1]):
a = verticesOutCercles[0]
verticesOutCercles[0] = verticesOutCercles[1]
verticesOutCercles[1] = a
geompy.addToStudyInFather(facePeau, verticesOutCercles[0], "THOR")
geompy.addToStudyInFather(facePeau, verticesOutCercles[1], "THEX")
[facesPipeInside, facesPipeOutside, facesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "FACE", 0.1, "pipe_bord_")
[edgesPipeInside, edgesPipeOutside, edgesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "EDGE", 0.1, "pipe_bord_")
disqueInt1 = geompy.GetInPlaceByHistory(pipeFondFiss, planBord1)
disqueInt2 = geompy.GetInPlaceByHistory(pipeFondFiss, planBord2)
disques = facesPipeOnside + [disqueInt1, disqueInt2]
edgesDiskInt = geompy.ExtractShapes(disqueInt1, geompy.ShapeType["EDGE"], False)
edgesDiskInt = edgesDiskInt +geompy.ExtractShapes(disqueInt2, geompy.ShapeType["EDGE"], False)
edgesSorted, minlg, maxlg = sortEdges(edgesDiskInt) # 4 rayons, 2 demi cercles
centre = geompy.MakeVertexOnSurface(planfiss, 0.5, 0.5)
refpoint = geompy.MakeTranslationVector(centre, geompy.GetNormal(planfiss,centre))
geompy.addToStudy(refpoint, 'refpoint')
[facesPipeInplan, facesPipeOutplan, facesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "FACE", 0.1, "pipe_plan_")
[edgesPipeInplan, edgesPipeOutplan, edgesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "EDGE", 0.1, "pipe_plan_")
# --- rayon disques = (edgesPipeOnside inter edgesPipeOnplan) + rayons disque internes
# demi cercles = edgesPipeOnside moins edgesPipeOnplan + demi cercles disque internes
# generatrices = edgesPipeOnplan moins rayon disques (3 grandes et 6 petites)
edgesIdPipeOnside = getSubshapeIds(pipeFondFiss, edgesPipeOnside)
edgesIdPipeOnplan = getSubshapeIds(pipeFondFiss, edgesPipeOnplan)
rayons = []
demiCercles = []
for i, edgeId in enumerate(edgesIdPipeOnside):
if edgeId in edgesIdPipeOnplan:
rayons.append(edgesPipeOnside[i])
else:
demiCercles.append(edgesPipeOnside[i])
demiCerclesExternes = demiCercles
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 = []
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 = []
for edge in generatrices:
distance = geompy.MinDistance(vertexReference, edge)
logging.debug("distance %s", distance)
if distance < 1.e-5:
generFiss.append(edge)
break
for edge in generatrices:
distance = geompy.MinDistance(generFiss[0], edge)
logging.debug("distance %s", distance)
if distance < 1.e-5:
generFiss.append(edge)
groupGenerFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupGenerFiss, generFiss)
geompy.addToStudyInFather(pipeFondFiss, groupGenerFiss, "GenFiss")
# --- demi cercles externes regroupés
groupsDemiCerclesPipe = []
for i, vertex in enumerate(verticesEdgePeauFiss):
demis = []
for edge in demiCerclesExternes:
if geompy.MinDistance(vertex, edge) < 0.1:
demis.append(edge)
group = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(group, demis)
name = "Cercle%d"%i
geompy.addToStudyInFather(pipeFondFiss, group , name)
groupsDemiCerclesPipe.append(group)
# --- faces fissure dans le pipe
facesFissinPipe = []
generFissId = getSubshapeIds(pipeFondFiss, generFiss)
logging.debug("generatrice fissure %s", generFissId)
for face in facesPipeOnplan:
edges =geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], False)
edgesId = getSubshapeIds(pipeFondFiss, edges)
logging.debug(" edges %s", edgesId)
for i,edgeId in enumerate(edgesId):
if edgeId in generFissId:
logging.debug("face found")
facesFissinPipe.append(face)
name = "faceFissInPipe_%d"%i
geompy.addToStudyInFather(pipeFondFiss, face, name)
break
groupFaceFissInPipe = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["FACE"])
geompy.UnionList(groupFaceFissInPipe, facesFissinPipe)
name = "FaceFissInPipe"
geompy.addToStudyInFather(pipeFondFiss, groupFaceFissInPipe , name)
# --- edges de fond de fissure
edgesFondFiss = []
for i, edge in enumerate(edgesInside):
anEdge = geompy.GetInPlace(pipeFondFiss, edge)
logging.debug(" edge %s ", anEdge)
edgesFondFiss.append(anEdge)
name ="edgeFondFissure_%d"%i
geompy.addToStudyInFather(pipeFondFiss, anEdge, name)
groupEdgeFondFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgeFondFiss, edgesFondFiss)
name = "FONDFISS"
geompy.addToStudyInFather(pipeFondFiss, groupEdgeFondFiss , name)
# -------------------------------------------------------------------------
# --- maillage
# --- edges de bord face defaut à respecter
aFilterManager = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
criteres = []
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres)
bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
smesh.SetName(bordsLibres, 'bordsLibres')
# --- 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"
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
# --- 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])
# --- 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() )
# --- maillage face de fissure
meshFaceFiss = smesh.Mesh(faceFiss)
algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_2D)
hypo2d = algo2d.Parameters()
hypo2d.SetMaxSize( (profondeur - rayonPipe)/math.sqrt(3.0) ) # pour avoir deux couches de triangles equilateraux partout sur la fissure
hypo2d.SetOptimize( 1 )
hypo2d.SetFineness( 2 )
hypo2d.SetMinSize( 2 )
hypo2d.SetQuadAllowed( 0 )
putName(algo2d.GetSubMesh(), "faceFiss")
putName(algo2d, "algo2d_faceFiss")
putName(hypo2d, "hypo2d_faceFiss")
#
algo1d = meshFaceFiss.UseExisting1DElements(geom=edgePeauFiss)
hypo1d = algo1d.SourceEdges([ groupEdgesPeauFiss ],0,0)
putName(algo1d.GetSubMesh(), "edgeFissPeau")
putName(algo1d, "algo1d_edgeFissPeau")
putName(hypo1d, "hypo1d_edgeFissPeau")
#
algo1d = meshFaceFiss.UseExisting1DElements(geom=groupEdgesFaceFissPipe)
hypo1d = algo1d.SourceEdges([ group_generFiss ],0,0)
putName(algo1d.GetSubMesh(), "edgeFissPeau")
putName(algo1d, "algo1d_edgeFissPeau")
putName(hypo1d, "hypo1d_edgeFissPeau")
#
isDone = meshFaceFiss.Compute()
logging.info("meshFaceFiss computed")
grp = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE)
meshBoiteDefaut = smesh.Concatenate([internalBoundary.GetMesh(),
meshFondFiss.GetMesh(),
meshFacePeau.GetMesh(),
meshFaceFiss.GetMesh()],
1, 1, 1e-05,False)
# pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes
# on designe les faces de peau en quadrangles par le groupe "skinFaces"
group_faceFissOutPipe = None
group_faceFissInPipe = None
groups = meshBoiteDefaut.GetGroups()
for grp in groups:
if grp.GetType() == SMESH.FACE:
#if "internalBoundary" in grp.GetName():
# grp.SetName("skinFaces")
if grp.GetName() == "fisOutPi":
group_faceFissOutPipe = grp
elif grp.GetName() == "fisInPi":
group_faceFissInPipe = grp
# le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D
distene=True
if distene:
algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D)
else:
algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
hypo3d = algo3d.MaxElementVolume(1000.0)
putName(algo3d.GetSubMesh(), "boiteDefaut")
putName(algo3d, "algo3d_boiteDefaut")
isDone = meshBoiteDefaut.Compute()
logging.info("meshBoiteDefaut computed")
putName(meshBoiteDefaut, "boiteDefaut")
groups = maillageSain.GetGroups()
grps1 = [ grp for grp in groups if grp.GetName() == 'P1']
grps2 = [ grp for grp in groups if grp.GetName() == 'P2']
coords1 = maillageSain.GetNodeXYZ(grps1[0].GetID(1))
coords2 = maillageSain.GetNodeXYZ(grps2[0].GetID(1))
logging.info("coords1 %s, coords2 %s",coords1, coords2)
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(facePorteFissure)
maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut, extrusionFaceFissure, facePorteFissure, 'COUDE')
groups = maillageComplet.GetGroups()
grps1 = [ grp for grp in groups if grp.GetName() == 'P1']
grps2 = [ grp for grp in groups if grp.GetName() == 'P2']
nodeid1 = maillageComplet.AddNode(coords1[0], coords1[1], coords1[2])
nodeid2 = maillageComplet.AddNode(coords2[0], coords2[1], coords2[2])
grps1[0].Add([nodeid1])
grps2[0].Add([nodeid2])
ma0d1 = maillageComplet.Add0DElement(nodeid1)
ma0d2 = maillageComplet.Add0DElement(nodeid2)
grpma0d1 = maillageComplet.CreateEmptyGroup( SMESH.ELEM0D, 'P1' )
nbAdd = grpma0d1.Add( [ma0d1] )
grpma0d2 = maillageComplet.CreateEmptyGroup( SMESH.ELEM0D, 'P2' )
nbAdd = grpma0d2.Add( [ma0d2] )
# grps = [ grp for grp in groups if grp.GetName() == 'affectedEdges']
# grps[0].SetName('affEdges')
# grps = [ grp for grp in groups if grp.GetName() == 'affectedFaces']
# grps[0].SetName('affFaces')
# grps = [ grp for grp in groups if grp.GetName() == 'affectedVolumes']
# grps[0].SetName('affVols')
maillageComplet.ConvertToQuadratic( 1 )
grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS']
fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
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))
#isDone = maillageComplet.ReorientObject( grps[0] )
fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 )
putName(maillageComplet, nomFicFissure)
logging.info("fichier maillage fissure %s", fichierMaillageFissure)
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
return maillageComplet

View File

@ -0,0 +1,218 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
from geomsmesh import smesh
from salome.smesh import smeshBuilder
import SMESH
from salome.StdMeshers import StdMeshersBuilder
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é
TODO: a completer
"""
logging.info('start')
# --- edges de bord à respecter
aFilterManager = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
criteres = []
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres)
bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
smesh.SetName(bordsLibres, 'bordsLibres')
# --- maillage bloc
bloc1 = smesh.Mesh(blocPartition)
for i in range(len(sharedFaces)):
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces[i])
hypo2d = algo2d.Parameters(which=smesh.SIMPLE)
hypo2d.SetLocalLength(lensegEllipsoide)
hypo2d.LengthFromEdges()
hypo2d.SetAllowQuadrangles(0)
putName(algo2d.GetSubMesh(), "sharedFaces", i)
putName(algo2d, "algo2d_sharedFaces", i)
putName(hypo2d, "hypo2d_sharedFaces", i)
for i in range(len(sharedEdges)):
algo1d = bloc1.Segment(geom=sharedEdges[i])
hypo1d = algo1d.LocalLength(lensegEllipsoide)
putName(algo1d.GetSubMesh(), "sharedEdges", i)
putName(algo1d, "algo1d_sharedEdges", i)
putName(hypo1d, "hypo1d_sharedEdges", i)
declareAlgoEllipsoideFirst = False
if declareAlgoEllipsoideFirst:
algo3d = bloc1.Tetrahedron(algo=smeshBuilder.NETGEN,geom=ellipsoidep)
hypo3d = algo3d.MaxElementVolume(1000.0)
putName(algo3d.GetSubMesh(), "ellipsoide")
putName(algo3d, "algo3d_ellipsoide")
putName(hypo3d, "hypo3d_ellipsoide")
algo3d = bloc1.Prism(geom=tore)
algo2d = bloc1.Quadrangle(geom=tore)
algo1d = bloc1.Segment(geom=tore)
hypo1d = algo1d.NumberOfSegments(nbsegGen)
putName(algo3d.GetSubMesh(), "tore")
putName(algo3d, "algo3d_tore")
putName(algo2d, "algo2d_tore")
putName(algo1d, "algo1d_tore")
putName(hypo1d, "hypo1d_tore")
for i in range(len(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])
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])
if reverses[i] > 0:
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])
hypo1d = algo1d.NumberOfSegments(nbsegCercle)
putName(algo1d.GetSubMesh(), "circles", i)
putName(algo1d, "algo1d_circles", i)
putName(hypo1d, "hypo1d_circles", i)
if len(edgeext) == 1:
densite = int(round(nbsegFis/2))
algo1d = bloc1.Segment(geom=edgeext[0])
hypo1d = algo1d.NumberOfSegments(nbsegFis)
hypo1d.SetDistrType( 2 )
hypo1d.SetConversionMode( 1 )
hypo1d.SetTableFunction( [ 0, densite, 0.4, 1, 0.6, 1, 1, densite ] )
putName(algo1d.GetSubMesh(), "edgeext")
putName(algo1d, "algo1d_edgeext")
putName(hypo1d, "hypo1d_edgeext")
else:
longTotal = 0
longEdgeExts = []
for i in range(len(edgeext)):
props = geompy.BasicProperties(edgeext[i])
longEdgeExts.append(props[0])
longTotal += props[0]
for i in range(len(edgeext)):
local = longTotal/nbsegFis
nbLocal = int(round(nbsegFis*longEdgeExts[i]/longTotal))
densite = int(round(nbLocal/2))
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]) ])
putName(algo1d.GetSubMesh(), "edgeext", i)
putName(algo1d, "algo1d_edgeext", i)
putName(hypo1d, "hypo1d_edgeext", i)
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facefissoutore)
hypo2d = algo2d.LengthFromEdges()
putName(algo2d.GetSubMesh(), "facefissoutore")
putName(algo2d, "algo2d_facefissoutore")
putName(hypo2d, "hypo2d_facefissoutore")
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])
hypo2d = algo2d.MaxElementArea(maxElemArea)
if edgesBords is None:
algo1d = bloc1.Segment(geom=facesExternes[i])
hypo1d = algo1d.NumberOfSegments(1)
putName(algo2d.GetSubMesh(), "facesExternes", i)
putName(algo2d, "algo2d_facesExternes", i)
putName(hypo2d, "hypo2d_facesExternes", i)
if edgesBords is None:
putName(algo1d, "algo1d_facesExternes", i)
putName(hypo1d, "hypo1d_facesExternes", i)
for i in range(len(aretesInternes)):
algo1d = bloc1.Segment(geom=aretesInternes[i])
hypo1d = algo1d.NumberOfSegments(nbsegExt)
putName(algo1d.GetSubMesh(), "aretesInternes", i)
putName(algo1d, "algo1d_aretesInternes", i)
putName(hypo1d, "hypo1d_aretesInternes", i)
if edgesBords is not None:
algo1d = bloc1.UseExisting1DElements(geom=edgesBords)
hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
putName(algo1d.GetSubMesh(), "bordsLibres")
putName(algo1d, "algo1d_bordsLibres")
putName(hypo1d, "hypo1d_bordsLibres")
#isDone = bloc1.Compute()
if not declareAlgoEllipsoideFirst:
algo3d = bloc1.Tetrahedron(algo=smeshBuilder.NETGEN,geom=ellipsoidep)
hypo3d = algo3d.MaxElementVolume(1000.0)
putName(algo3d.GetSubMesh(), "ellipsoide")
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)):
name = "faceCommuneEllipsoideBloc_%d"%i
groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces[i], name, SMESH.FACE))
groups_faceExterneBloc = []
for i in range(len(facesExtBloc)):
name = "faceExterneBloc_%d"%i
groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc[i], name, SMESH.FACE))
skinBlocMeshes = []
for i in range(len(groups_faceCommuneEllipsoideBloc)):
name = "faceCommuneEllipsoideBloc_%d"%i
skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc[i], name, 0, 0))
for i in range(len(groups_faceExterneBloc)):
name = "faceExterneBloc_%d"%i
skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc[i], name, 0, 0))
meshesBloc = [internalBoundary.GetMesh()]
for i in range(len(skinBlocMeshes)):
meshesBloc.append(skinBlocMeshes[i].GetMesh())
blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False)
algo3d = blocMesh.Tetrahedron(algo=smeshBuilder.NETGEN)
hypo3d = algo3d.MaxElementVolume(1000.0)
putName(algo3d.GetSubMesh(), "bloc")
putName(algo3d, "algo3d_bloc")
putName(hypo3d, "hypo3d_bloc")
is_done = blocMesh.Compute()
blocComplet = smesh.Concatenate([bloc1.GetMesh(), blocMesh.GetMesh()], 1, 1, 1e-05,False)
return bloc1, blocComplet

View File

@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- trouver les vertices intermediaires d'un wire
def orderEdgesFromWire(aWire):
"""
fournit les edges ordonnées d'un wire selon ExtractShapes(,,False),
et l'ordre des edges selon le sens de parcours (ordre des indices de la liste d'edges)
"""
logging.info("start")
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
idverts = {}
for i, edge in enumerate(edges):
verts = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
# idverts[(i,0)] = verts[0]
# idverts[(i,1)] = verts[1]
v0 = geompy.MakeVertexOnCurve(edge, 0.0)
dist = geompy.MinDistance(v0, verts[0])
if dist < 1.e-4:
idverts[(i,0)] = verts[0]
idverts[(i,1)] = verts[1]
else:
idverts[(i,0)] = verts[1]
idverts[(i,1)] = verts[0]
idsubs = {}
for kv, sub in idverts.iteritems():
subid = geompy.GetSubShapeID(aWire, sub)
if subid in idsubs.keys():
idsubs[subid].append(kv)
else:
idsubs[subid] = [kv]
debut = -1
fin = -1
for k, kvs in idsubs.iteritems():
if len(kvs) == 1: # une extremité
kv = kvs[0]
if kv[1] == 0:
debut = kv[0]
else:
fin = kv[0]
logging.debug("nombre d'edges: %s, indice edge début: %s, fin: %s",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, range(len(edges))
orderedList = [debut]
while len(orderedList) < len(edges):
bout = orderedList[-1]
vertex = idverts[(bout,1)]
for k, v in idverts.iteritems():
if k[0] not in orderedList:
if geompy.MinDistance(vertex, v) < 1.e-4:
if k[1] == 0:
orderedList.append(k[0])
break
else:
logging.critical("les edges du wire ne sont pas orientées dans le même sens: une edge à l'envers")
return edges, range(len(edges))
logging.debug("liste des edges ordonnées selon le sens de parcours: %s", orderedList)
accessList = 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)
return edges, accessList

View File

@ -0,0 +1,160 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- partition du bloc defaut par generatrice, tore et plan fissure
def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe,
facefis, ellipsoide):
"""
Partition du bloc defaut par la generatrice de l'ellipse,
le tore elliptique, la face plane de fissure
@param volDefaut : le bloc defaut
@param gener : la generatrice de l'ellipse, positionnée dans l'espace
@param pipe : le tore partitionné par le plan de fissure, positionné
dans l'espace
@param facefis : la face plane de la fissure, positionnée dans l'espace
@return (volDefautPart, blocp, tore, faceFissure), le bloc partitionné,
les sous shapes issues de la partition
(le bloc moins le tore, la generatrice, le tore, la face de fissure)
"""
logging.info("start")
volDefautPart = geompy.MakePartition([volDefaut], [pipe, facefis, ellipsoide], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
blocp = geompy.GetInPlaceByHistory(volDefautPart, volDefaut)
#gencnt = geompy.GetInPlaceByHistory(volDefautPart, gener)
tore = geompy.GetInPlaceByHistory(volDefautPart, pipe)
faceFissure = geompy.GetInPlaceByHistory(volDefautPart, facefis)
#ellipsoidep =geompy.GetInPlaceByHistory(volDefautPart, ellipsoide)
geompy.addToStudy( volDefautPart, 'volDefautPart' )
geompy.addToStudyInFather( volDefautPart, tore, 'tore' )
geompy.addToStudyInFather( volDefautPart, faceFissure, 'FACE1' )
#geompy.addToStudyInFather( volDefautPart, gencnt, 'generatrice' )
solids = geompy.ExtractShapes(blocp, geompy.ShapeType["SOLID"], True)
vols = []
for i in range(len(solids)):
props = geompy.BasicProperties(solids[i])
vols.append(props[2])
maxvol = max(vols)
imaxvol = vols.index(maxvol)
blocp = solids[imaxvol]
vols[imaxvol] = 0
maxvol = max(vols)
imaxvol = vols.index(maxvol)
ellipsoidep = solids[imaxvol]
geompy.addToStudyInFather( volDefautPart, blocp, 'bloc' )
geompy.addToStudyInFather( volDefautPart, ellipsoidep, 'ellipsoide' )
sharedFaces = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["FACE"])
for i in range(len(sharedFaces)):
name = "faceCommuneEllipsoideBloc_%d"%i
geompy.addToStudyInFather(blocp, sharedFaces[i], name)
#sharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
allSharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
sharedEdges = []
for i in range(len(allSharedEdges)):
if geompy.NbShapes(allSharedEdges[i], geompy.ShapeType["VERTEX"]) > 1: # edge non degeneree
sharedEdges.append(allSharedEdges[i])
for i in range(len(sharedEdges)):
name = "edgeCommuneEllipsoideBloc_%d"%i
geompy.addToStudyInFather(blocp, sharedEdges[i], name)
facesExternes = []
facesExtBloc = []
facesExtElli = []
faces = geompy.ExtractShapes(facesDefaut, geompy.ShapeType["FACE"], True)
if len(faces) == 0:
faces = [facesDefaut]
for i in range(len(faces)):
faceExt = geompy.GetInPlace(ellipsoidep, faces[i])
if faceExt is not None:
name = "faceExterne_e%d"%i
geompy.addToStudyInFather(ellipsoidep, faceExt, name)
facesExternes.append(faceExt)
facesExtElli.append(faceExt)
faceExt = geompy.GetInPlace(blocp, faces[i])
if faceExt is not None:
name = "faceExterne_b%d"%i
geompy.addToStudyInFather(blocp, faceExt, name)
facesExternes.append(faceExt)
facesExtBloc.append(faceExt)
else:
logging.info(" recherche faces externes par GetShapesOnShape")
vertex = geompy.MakeVertexOnSurface(faces[i], 0.5, 0.5)
normal = geompy.GetNormal(faces[i], vertex)
extrusionFace = geompy.MakePrismVecH(faces[i], normal, 1)
#extrusionFace = geompy.MakePrismVecH2Ways(faces[i], normal, 0.1)
#extrusionFace = geompy.MakeScaleTransform(extrusionFace, vertex, 1.01)
name = "extrusionFace_b%d"%i
geompy.addToStudyInFather(blocp, extrusionFace, name)
#facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ON)
for j in range(len(facesExt)):
name = "faceExterne_b%d_%d"%(i,j)
geompy.addToStudyInFather(blocp, facesExt[j], name)
facesExternes.append(facesExt[j])
facesExtBloc.append(facesExt[j])
if len(facesExtBloc) < len(faces): # toutes les faces externes du bloc n'ont pas été trouvées. TODO eliminer les detections multiples
logging.info(" recherche faces externes par aretes partagees avec faces externes ellipsoide")
facesBloc = geompy.ExtractShapes(blocp, geompy.ShapeType["FACE"], True)
for i in range(len(facesBloc)):
notOnEllipsoide = True
for j in range(len(sharedFaces)): # eliminer les faces communes avec l'ellipsoide
if facesBloc[i].IsSame(sharedFaces[j]):
notOnEllipsoide = False
break
if notOnEllipsoide:
for j in range(len(facesExtElli)): # les faces recherchees ont une ou plusieurs edge communes avec la ou les faces externes de l'ellipsoide
allSharedEdges = []
try:
allSharedEdges += geompy.GetSharedShapesMulti([facesBloc[i], facesExtElli[j]], geompy.ShapeType["EDGE"])
except:
pass
if len(allSharedEdges) > 0:
name = "faceExterne_b%d_%d"%(i,j)
geompy.addToStudyInFather(blocp, facesBloc[i], name)
facesExternes.append(facesBloc[i])
facesExtBloc.append(facesBloc[i])
aretesInternes = []
for i in range(len(facesExternes)):
for j in range(i+1,len(facesExternes)):
shared = []
try:
shared += geompy.GetSharedShapesMulti([facesExternes[i], facesExternes[j]], geompy.ShapeType["EDGE"])
except:
logging.info("no shared edges in %s,%s",i,j)
else:
aretesInternes += shared
for i in range(len(aretesInternes)):
name = "aretesInternes_%d"%i
geompy.addToStudyInFather(blocp, aretesInternes[i], name)
edgesBords = []
for faceExtB in facesExtBloc:
edges = geompy.ExtractShapes(faceExtB, geompy.ShapeType["EDGE"], True)
for i in range(len(edges)):
isInterne = False
for j in range(len(aretesInternes)):
if edges[i].IsSame(aretesInternes[j]):
isInterne = True
break
if not isInterne:
edgesBords.append(edges[i])
name = "edgeBord%d"%i
geompy.addToStudyInFather(blocp,edges[i] , name)
group = None
if len(edgesBords) > 0:
group = geompy.CreateGroup(blocp, geompy.ShapeType["EDGE"])
geompy.UnionList(group, edgesBords)
edgesBords = group
return volDefautPart, blocp, tore, faceFissure, facesExternes, facesExtBloc, facesExtElli, aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords

View File

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- partition volume sain et bloc, face du bloc recevant la fissure
def partitionVolumeSain(volumeSain,boiteDefaut):
"""
Partition du volume complet sur lequel porte le calcul par le cube qui contiendra le defaut
@param volumeSain : volume complet (geomObject)
@param boiteDefaut : cube qui contiendra le defaut, positionné dans l'espace (son centre doit être au voisinage
immediat de la peau de l'objet sain: le tore elliptique debouche de paroi)
@return (volumeSainPart, partieSaine, volDefaut, faceBloc) : volume complet partionné par le cube, partie saine,
bloc du defaut (solide commun au cube et au volume complet), face du bloc defaut correspondant à la paroi.
"""
logging.info("start")
volumeSainPart = geompy.MakePartition([volumeSain], [boiteDefaut], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
[a,b] = geompy.ExtractShapes(volumeSainPart, geompy.ShapeType["SOLID"], True)
volDefaut = geompy.GetInPlaceByHistory(volumeSainPart, boiteDefaut)
if geompy.GetSubShapeID(volumeSainPart,b) == geompy.GetSubShapeID(volumeSainPart,volDefaut):
partieSaine = a
else:
partieSaine = b
faceBloc = geompy.GetShapesOnShapeAsCompound(volumeSain, volDefaut, geompy.ShapeType["FACE"], GEOM.ST_ON)
geompy.addToStudy( volumeSainPart, 'volumeSainPart' )
geompy.addToStudyInFather( volumeSainPart, partieSaine, 'partieSaine' )
geompy.addToStudyInFather( volumeSainPart, volDefaut, 'volDefaut' )
geompy.addToStudyInFather( volDefaut, faceBloc, 'faceBloc' )
return volumeSainPart, partieSaine, volDefaut, faceBloc

View File

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import smesh
import SMESH
# -----------------------------------------------------------------------------
# --- peau interne du defaut dans le maillage sain
def peauInterne(fichierMaillage, nomZones):
"""
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.
"""
logging.info("start")
([maillageSain], status) = smesh.CreateMeshesFromMED(fichierMaillage)
groups = maillageSain.GetGroups()
zoneDefaut = None
for grp in groups:
#print " ",grp.GetName()
if grp.GetName() == nomZones + "_vol":
zoneDefaut = grp
break
zoneDefaut_skin = None
for grp in groups:
if grp.GetName() == nomZones + "_skin":
zoneDefaut_skin = grp
break
zoneDefaut_internalFaces = None
for grp in groups:
if grp.GetName() == nomZones + "_internalFaces":
zoneDefaut_internalFaces = grp
break
zoneDefaut_internalEdges = None
for grp in groups:
if grp.GetName() == nomZones + "_internalEdges":
zoneDefaut_internalEdges = grp
break
nbAdded, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ])
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- calcul de produit mixte pour orientation
def produitMixte(o, p1, p2, p3):
"""
produit mixte de 3 vecteurs a partir d'une origine et 3 points
"""
coordo = geompy.PointCoordinates(o)
coordp1 = geompy.PointCoordinates(p1)
coordp2 = geompy.PointCoordinates(p2)
coordp3 = geompy.PointCoordinates(p3)
u = [coordp1[0] - coordo[0], coordp1[1] - coordo[1], coordp1[2] - coordo[2]]
v = [coordp2[0] - coordo[0], coordp2[1] - coordo[1], coordp2[2] - coordo[2]]
w = [coordp3[0] - coordo[0], coordp3[1] - coordo[1], coordp3[2] - coordo[2]]
pm = (u[0]*v[1]*w[2] + v[0]*w[1]*u[2] + w[0]*u[1]*v[2]) - (u[0]*w[1]*v[2] + v[0]*u[1]*w[2] + w[0]*v[1]*u[2])
logging.debug('pm=%s', pm)
return pm

View File

@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
from geomsmesh import geompy
import logging
import math
# -----------------------------------------------------------------------------
# --- projection d'un point sur une courbe.
def projettePointSurCourbe(pt, edge):
"""
projection d'un point p sur une courbe c
on suppose que la distance (c(u), p) passe par un minimum quand u varie entre 0 et 1
et qu'elle presente pas de minimum local
"""
#logging.debug("start")
dist = []
nbSlices = 50
du = 1.0/nbSlices
for i in range(nbSlices + 1):
p = geompy.MakeVertexOnCurve(edge, du*i)
d = geompy.MinDistance(p,pt)
dist.append((d,i))
dist.sort()
#logging.debug("dist %s", dist)
umin = du*dist[0][1]
umax = du*dist[1][1]
#umin = 0.0
#umax = 1.0
tol = 1.e-8
pmin = geompy.MakeVertexOnCurve(edge, umin)
pmax = geompy.MakeVertexOnCurve(edge, umax)
dmin = geompy.MinDistance(pmin,pt)
dmax = geompy.MinDistance(pmax,pt)
dext = geompy.MinDistance(pmin,pmax)
i=0
while dext > tol and i < 100 :
i = i+1
utest = (umax + umin) / 2.0
ptest = geompy.MakeVertexOnCurve(edge, utest)
dtest = geompy.MinDistance(ptest,pt)
if dmin < dmax:
umax = utest
pmax = ptest
dmax = dtest
else:
umin = utest
pmin = ptest
dmin = dtest
dext = geompy.MinDistance(pmin,pmax)
#logging.debug('umin=%s umax=%s dmin=%s dmax=%s dtest=%s dext=%s', umin,umax,dmin,dmax,dtest,dext)
if abs(utest) < 1.e-7:
utest = 0.0
if abs(1.0-utest) < 1.e-7:
utest = 1.0
logging.debug('u=%s, nbiter=%s dtest=%s dext=%s',utest,i,dtest,dext)
return utest

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- prolongation des segments extremité des polylines, pour la découpe
def prolongeVertices(vertices):
"""
Prolongation des segments extremité d'une polyline définie par un vecteur de points.
Chaque nouvelle extremité est obtenue par symétrie point du voisin de cette ancienne extrémité
(symétrie de centre l'ancienne extrémite) : les segments extremes sont doublés.
@param vertices : liste ordonnée des points (geomObject) de la polyline
@return vertices : liste avec les deux extremités modifiées
"""
logging.info("start")
if len(vertices) < 2:
return vertices
v0 = vertices[0]
v1 = vertices[1]
m0 = geompy.MakeMirrorByPoint(v1, v0)
ve = vertices[-1]
vd = vertices[-2]
m1 = geompy.MakeMirrorByPoint(vd, ve)
vertices[0] = m0
vertices[-1] = m1
return vertices

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- prolongation d'un wire par deux segments tangents
def prolongeWire(aWire, extrem, norms, long):
"""
"""
logging.info("start")
if geompy.NumberOfEdges(aWire) > 1:
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
else:
edges = [aWire]
for i, v1 in enumerate(extrem):
exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)]
dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
dists.sort()
v2 = dists[-1][-1]
#v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long)
edge = geompy.MakeEdge(v1, v2)
edges.append(edge)
name = "extrem%d"%i
#geompy.addToStudy(edge,name)
wireProlonge = geompy.MakeWire(edges)
geompy.addToStudy(wireProlonge, "wireProlonge")
return wireProlonge

View File

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- recherche et classement des edges du tore par propagate
def propagateTore(tore):
"""
Classement des edges du tore par une operation 'propagate'
@param tore partionné et coupé
@return (diams, circles, geners) edges dans le plan de fissure, edges demi circulaires,
edges selon la generatrice (liste de compounds)
"""
logging.info("start")
lencomp = []
compounds = geompy.Propagate(tore)
for i in range(len(compounds)):
#geompy.addToStudyInFather( tore, compounds[i], 'edges' )
props = geompy.BasicProperties(compounds[i])
lencomp.append(props[0])
pass
minlen = min(lencomp)
maxlen = max(lencomp)
diams = []
geners = []
circles = []
for i in range(len(lencomp)):
if (lencomp[i]- minlen)/minlen < 0.01 :
diams.append(compounds[i])
elif (maxlen - lencomp[i])/lencomp[i] < 0.2 :
geners.append(compounds[i])
else:
circles.append(compounds[i])
geompy.addToStudyInFather( tore, diams[0], 'diams0' )
geompy.addToStudyInFather( tore, diams[1], 'diams1' )
geompy.addToStudyInFather( tore, circles[0], 'circles0' )
geompy.addToStudyInFather( tore, circles[1], 'circles1' )
geompy.addToStudyInFather( tore, geners[0], 'geners' )
return diams, circles, geners

View File

@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from geomsmesh import smesh
# -----------------------------------------------------------------------------
# --- nommage des objets mesh (algorithme, hypothèse, subMesh)
def putName(objmesh,name, i=-1):
if i >= 0:
suffix = "_%d"%i
name += suffix
smesh.SetName(objmesh, name)

View File

@ -0,0 +1,323 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
import GEOM
import math
import numpy as np
def mydot(a):
return np.dot(a,a)
# -----------------------------------------------------------------------------
# --- groupe de quadrangles de face transformé en face géométrique par filling
def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss):
"""
groupe de quadrangles de face transformée en faces géométriques par filling
on part de quadrangles définissant une zone a 4 cotés (convexe), et on reconstitue n lignes de p points.
Ces n lignes de p points sont transformées en n courbes géométriques,
à partir desquelles on reconstitue une surface géométrique.
Il peut y avoir plusieurs faces géométriques reconstituées, si on fournit des groupes de quadrangles non connexes.
On détecte les angles vifs, pour conserver des arêtes vives délimitant des faces connexes.
@param meshQuad : maillages constitué de quadrangles constituant une ou plusieurs zones convexes
@return (fillings, noeuds_Bords) : liste de geomObject, listes des bords (bord = liste ordonnée de noeuds (geomObject))
"""
logging.info("start")
isVecteurDefaut = False
if shapeFissureParams.has_key('vecteurDefaut'):
isVecteurDefaut = True
vecteurDefaut = shapeFissureParams['vecteurDefaut']
fillings = [] # les faces reconstituées, découpées selon les arêtes vives
noeuds_bords = [] #
bords_Partages = [] # contient a la fin les courbes correspondant aux arêtes vives
fillconts = [] # les faces reconstituées, sans découpage selon les arêtes vives
idFilToCont = [] # index face découpée vers face sans découpe
iface = 0 # index face découpée
icont = 0 # index face continue
allNodeIds = meshQuad.GetNodesId()
while len(allNodeIds):
nodeIds = allNodeIds
for idNode in nodeIds: # rechercher un coin
elems = meshQuad.GetNodeInverseElements(idNode)
if len(elems) == 1:
# un coin: un noeud, un element quadrangle
elem = elems[0]
break;
idStart = idNode # le noeud de coin
elemStart = elem # l'élément quadrangle au coin
xyz = meshQuad.GetNodeXYZ(idStart)
logging.debug("idStart %s, coords %s", idStart, str(xyz))
nodelines =[] # on va constituer une liste de lignes de points
nextLine = True
ligneFinale = False
while nextLine:
logging.debug("--- une ligne")
idNode = idStart
elem = elemStart
if ligneFinale:
agauche = False # sens de parcours des 4 noeuds d'un quadrangle
nextLine = False
else:
agauche = True
ligneIncomplete = True # on commence une ligne de points
debutLigne = True
nodeline = []
elemline = []
while ligneIncomplete: # compléter la ligne de points
nodeline.append(idNode)
allNodeIds.remove(idNode)
elemline.append(elem)
nodes = meshQuad.GetElemNodes(elem)
i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3)
if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle
if i < 3:
j = i+1
else:
j = 0
if j < 3:
k = j+1
else:
k = 0
else:
if i > 0:
j = i -1
else:
j = 3
if j > 0:
k = j -1
else:
k = 3
isuiv = nodes[j] #noeud suivant
iapres = nodes[k] #noeud opposé
if debutLigne:
debutLigne = False
# précédent a trouver, dernière ligne : précédent au lieu de suivant
if agauche:
if i > 0:
iprec = nodes[i -1]
else:
iprec = nodes[3]
idStart = iprec
elems3 = meshQuad.GetNodeInverseElements(iprec)
if len(elems3) == 1: # autre coin
ligneFinale = True
else:
for elem3 in elems3:
if elem3 != elem:
elemStart = elem3
break
#print nodes, idNode, isuiv, iapres
elems1 = meshQuad.GetNodeInverseElements(isuiv)
elems2 = meshQuad.GetNodeInverseElements(iapres)
ligneIncomplete = False
for elem2 in elems2:
if elems1.count(elem2) and elem2 != elem:
ligneIncomplete = True
idNode = isuiv
elem = elem2
break
if not ligneIncomplete:
nodeline.append(isuiv)
allNodeIds.remove(isuiv)
logging.debug("nodeline %s", nodeline)
logging.debug("elemline %s", elemline)
nodelines.append(nodeline)
# on a constitué une liste de lignes de points connexes
logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
# stockage des coordonnées dans un tableau numpy
mat = np.zeros((len(nodelines), len(nodeline), 3))
for i, ligne in enumerate(nodelines):
for j, nodeId in enumerate(ligne):
mat[i,j] = meshQuad.GetNodeXYZ(nodeId)
logging.debug("matrice de coordonnées: \n%s",mat)
logging.debug("dimensions %s", mat.shape)
# recherche d'angles supérieurs a un seuil sur une ligne : angle entre deux vecteurs successifs
cosmin = math.cos(math.pi/4.) # TODO: angle reference en paramètre
vecx = mat[:, 1:, :] - mat[:, :-1, :] # vecteurs selon direction "x"
vx0 = vecx[:, :-1, :] # vecteurs amont
vx1 = vecx[:, 1:, :] # vecteurs aval
e = np.einsum('ijk,ijk->ij', vx0, vx1) # produit scalaire des vecteurs
f = np.apply_along_axis(mydot, 2, vx0) # normes carrées vecteurs amont
g = np.apply_along_axis(mydot, 2, vx1) # normes carrées vecteurs aval
h = e/(np.sqrt(f*g)) # cosinus
ruptureX = h < cosmin # True si angle > reference
logging.debug("matrice de rupture X: \n%s",ruptureX)
rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2))
logging.debug("colonnes de rupture: %s",rupX)
# recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs
vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y"
vy0 = vecy[:-1, :, :] # vecteurs amont
vy1 = vecy[ 1:, :, :] # vecteurs aval
e = np.einsum('ijk,ijk->ij', vy0, vy1) # produit scalaire des vecteurs
f = np.apply_along_axis(mydot, 2, vy0) # normes carrées vecteurs amont
g = np.apply_along_axis(mydot, 2, vy1) # normes carrées vecteurs aval
h = e/(np.sqrt(f*g)) # cosinus
ruptureY = h < cosmin # True si angle > reference
logging.debug("matrice de rupture Y: \n%s",ruptureY)
rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2))
logging.debug("lignes de rupture: %s",rupY)
if (len(rupX)*len(rupY)) > 0:
logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions,
lors de la reconstitution des faces géométriques dans la zone remaillée""")
mats = []
bordsPartages = []
if (len(rupX)> 0):
rupX.append(mat.shape[1]-1)
for i, index in enumerate(rupX):
imax = index+2
imin = 0
if i > 0:
imin = rupX[i-1] + 1
mats.append(mat[:, imin:imax, :])
if imax == mat.shape[1] + 1:
ifin = 0
else:
ifin = imax
bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
elif (len(rupY)> 0):
rupY.append(mat.shape[0]-1)
for i, index in enumerate(rupY):
imax = index+2
imin = 0
if i > 0:
imin = rupY[i-1] + 1
mats.append(mat[imin:imax, :, :])
if imax == mat.shape[0] + 1:
ifin = 0
else:
ifin = imax
bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
else:
mats.append(mat)
bordsPartages.append([0,0]) # les indices différents de 0 correspondent à des bords partagés
curvconts = []
for nmat, amat in enumerate(mats):
logging.debug("dimensions matrice %s: %s", nmat, amat.shape)
nbLignes = amat.shape[1] # pas de rupture, ou rupture selon des colonnes: on transpose
nbCols = amat.shape[0]
if len(rupY) > 0 : # rupture selon des lignes: pas de transposition
nbLignes = amat.shape[0]
nbCols = amat.shape[1]
curves = []
noeudsBords = []
for i in range(4):
noeudsBords.append([])
k = 0
for i in range(nbLignes):
nodeList = []
for j in range(nbCols):
#logging.debug("point[%s,%s] = (%s, %s, %s)",i,j,amat[i,j,0], amat[i,j,1], amat[i,j,2])
if len(rupY) > 0 : # pas de transposition
node = geompy.MakeVertex(amat[i,j,0], amat[i,j,1], amat[i,j,2])
else: # transposition
node = geompy.MakeVertex(amat[j,i,0], amat[j,i,1], amat[j,i,2])
nodeList.append(node)
if i == 0:
noeudsBords[0].append(node)
#name = "bord0_%d"%k
#geompy.addToStudy( node, name )
if i == (nbLignes -1):
noeudsBords[2].append(node)
#name = "bord2_%d"%k
#geompy.addToStudy( node, name )
if j == 0:
noeudsBords[1].append(node)
#name = "bord1_%d"%k
#geompy.addToStudy( node, name )
if j == (nbCols -1):
noeudsBords[3].append(node)
#name = "bord3_%d"%k
#geompy.addToStudy( node, name )
k += 1
curve = geompy.MakeInterpol(nodeList, False, False)
#name = "curve_%d"%i
#geompy.addToStudy( curve, name )
if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe
curvconts.append(nodeList)
curves.append(curve)
if bordsPartages[nmat][0] :
bordsPartages[nmat][0] = curves[0] # la première ligne est un bord partagé
else:
bordsPartages[nmat][0] = None
if bordsPartages[nmat][1] :
bordsPartages[nmat][1] = curves[-1] # la dernière ligne est un bord partagé
else:
bordsPartages[nmat][1] = None
filling = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
# --- test orientation filling
vertex = geompy.MakeVertexOnSurface(filling, 0.5, 0.5)
normal = geompy.GetNormal(filling, vertex)
if centreFondFiss is not None:
logging.debug("orientation filling a l'aide du centre de fond de fissure")
vecteurDefaut = geompy.MakeVector(centreFondFiss, vertex)
if not isVecteurDefaut:
pointIn_x = 0.0
pointIn_y = 0.0
pointIn_z = 0.0
pointExplicite = False
if shapeFissureParams.has_key('pointIn_x'):
pointExplicite = True
pointIn_x = shapeFissureParams['pointIn_x']
if shapeFissureParams.has_key('pointIn_y'):
pointExplicite = True
pointIn_y = shapeFissureParams['pointIn_y']
if shapeFissureParams.has_key('pointIn_z'):
pointExplicite = True
pointIn_z = shapeFissureParams['pointIn_z']
if pointExplicite:
cdg = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z))
vecteurDefaut = geompy.MakeVector(cdg, vertex)
if shapeFissureParams.has_key('convexe'):
isConvexe = shapeFissureParams['convexe']
logging.debug("orientation filling par indication de convexité %s", isConvexe)
cdg = geompy.MakeCDG(filling)
if isConvexe:
vecteurDefaut = geompy.MakeVector(cdg, vertex)
else:
vecteurDefaut = geompy.MakeVector(vertex, cdg)
if vecteurDefaut is not None:
geompy.addToStudy(normal, "normFillOrig%d"%iface)
geompy.addToStudy(vecteurDefaut, "fromInterieur%d"%iface)
if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0:
filling = geompy.ChangeOrientation(filling)
geompy.addToStudy( filling, "filling%d"%iface )
#geompy.ExportBREP(filling, "filling.brep")
iface = iface+1
fillings.append(filling)
noeuds_bords.append(noeudsBords)
idFilToCont.append(icont)
bords_Partages += bordsPartages
pass # --- loop on mats
# --- reconstruction des faces continues à partir des listes de noeuds
# les courbes doivent suivre la courbure pour éviter les oscillations
if icont == iface - 1: # pas de découpe, on garde la même face
fillcont = fillings[-1]
else:
nbLignes = len(curvconts[0])
curves = []
for i in range(nbLignes):
nodes = [curvconts[j][i] for j in range(len(curvconts))]
curve = geompy.MakeInterpol(nodes, False, False)
curves.append(curve)
fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
geompy.addToStudy( fillcont, "filcont%d"%icont )
fillconts.append(fillcont)
icont = icont+1
pass # --- loop while there are remaining nodes
return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont

View File

@ -0,0 +1,85 @@
# -*- coding: utf-8 -*-
import logging
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
TODO: a completer
"""
logging.info('Concatenation')
maillageComplet = smesh.Concatenate([maillageSain.GetMesh(), blocComplet.GetMesh()], 1, 1, 1e-05,False)
groups = maillageComplet.GetGroups()
grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
faceFissure = grps[0]
grps = [ grp for grp in groups if grp.GetName() == 'nfondfis']
noeudsFondFissure = grps[0]
grps = [ grp for grp in groups if grp.GetName() == 'fisInPi']
fisInPi = grps[0]
grps = [ grp for grp in groups if grp.GetName() == 'fisOutPi']
fisOutPi = grps[0]
# --- TODO: fiabiliser l'orientation dans le cas general
if normal is None:
normal = smesh.MakeDirStruct( 0, 0, 1 )
maillageComplet.Reorient2D( fisInPi, normal, [0,0,0])
maillageComplet.Reorient2D( fisOutPi, normal, [0,0,0])
shapes = []
if extrusionFaceFissure is not None:
subIds = geompy.SubShapeAllIDs(extrusionFaceFissure, geompy.ShapeType["SOLID"])
if len(subIds) > 1:
shapes = geompy.ExtractShapes(extrusionFaceFissure, geompy.ShapeType["SOLID"], False)
else:
shapes = [extrusionFaceFissure]
# else:
# subIds = geompy.SubShapeAllIDs(faceGeomFissure, geompy.ShapeType["FACE"])
# if len(subIds) > 1:
# shapes = geompy.ExtractShapes(faceGeomFissure, geompy.ShapeType["FACE"], False)
# else:
# shapes = [faceGeomFissure]
grpEdges = []
grpFaces = []
grpVolumes = []
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)
affectedGroups = maillageComplet.AffectedElemGroupsInRegion([faceFissure], [noeudsFondFissure], aShape)
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]
affectedFaces.SetName('affFa%d'%i)
grpFaces.append(affectedFaces)
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)
FACE2.SetName( 'FACE2' )
GroupVol = maillageComplet.CreateEmptyGroup( SMESH.VOLUME, nomVolume )
nbAdd = GroupVol.AddFrom( maillageComplet.GetMesh() )
return maillageComplet

View File

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
import math
from triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
# -----------------------------------------------------------------------------
# --- operateur de rotation translation d'un objet centré à l'origine
def rotTrans(objet, orientation, point, normal, trace = False):
"""
Déplacement par rotation translation d'un objet centré à l'origine, vers un point de la surface de la pièce saine
dans laquelle on insère le défaut.
@param objet : objet original centré à l'origine (geomObject)
@param orientation : rotation selon OX de l'objet original (degrés)
@param point : le point qui sera le centre de l'objet déplacé (geomObject), en général sur la surface de la pièce saine
@param normal : la normale à la surface de la pièce saine au point central (geomObject)
@return trans : objet transformé (geomObject)
"""
logging.info("start")
planXY = geompy.MakePlaneLCS(None, 2000, 1)
projXY = geompy.MakeProjection(normal, planXY)
[v1,v2] = geompy.ExtractShapes(projXY, geompy.ShapeType["VERTEX"], False)
xyz1 = geompy.PointCoordinates(v1)
xyz2 = geompy.PointCoordinates(v2)
x = xyz2[0] - xyz1[0]
y = xyz2[1] - xyz1[1]
sinalpha = y / math.sqrt(x*x + y*y)
cosalpha = x / math.sqrt(x*x + y*y)
alpha = math.asin(sinalpha)
if cosalpha < 0:
alpha = math.pi -alpha
beta = geompy.GetAngleRadians(OZ, normal)
[v1,v2] = geompy.ExtractShapes(normal, geompy.ShapeType["VERTEX"], False)
xyz1 = geompy.PointCoordinates(v1)
xyz2 = geompy.PointCoordinates(v2)
z = xyz2[2] - xyz1[2]
if z < 0:
beta = math.pi -beta
rot0 = geompy.MakeRotation(objet, OX, orientation*math.pi/180.0)
rot1 = geompy.MakeRotation(rot0, OZ, alpha)
axe2 = geompy.MakeRotation(OY, OZ, alpha)
rot2 = geompy.MakeRotation(rot1, axe2, beta -math.pi/2.)
logging.debug("alpha",alpha)
logging.debug("beta",beta)
if trace:
geompy.addToStudy( rot1, 'rot1' )
geompy.addToStudy( axe2, 'axe2' )
geompy.addToStudy( rot2, 'rot2' )
xyz = geompy.PointCoordinates(point)
trans = geompy.MakeTranslation(rot2, xyz[0], xyz[1], xyz[2])
return trans

View File

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- construction d'une shape de dectection des éléments à modifier suite à la la duplication des noeuds de la face fissure (d'un coté de la face)
def shapeSurFissure(facesFissure):
"""
TODO: a completer, Normaliser les vecteurs et ponderer par les surfaces...
"""
logging.info('start')
normal = None
subIds = geompy.SubShapeAllIDs(facesFissure, geompy.ShapeType["FACE"])
if len(subIds) > 1:
logging.debug("plusieurs faces de fissure")
faces = geompy.ExtractShapes(facesFissure, geompy.ShapeType["FACE"], False)
extrusions = []
for n,face in enumerate(faces):
vertex = geompy.MakeVertexOnSurface(face, 0.5, 0.5)
normal = geompy.GetNormal(face, vertex)
extrusion = geompy.MakePrismVecH(face, normal, 100)
extrusions.append(extrusion)
extrusionFaceFissure = geompy.MakeCompound(extrusions)
else:
logging.debug("une seule face de fissure")
face = facesFissure
vertex = geompy.MakeVertexOnSurface(face, 0.5, 0.5)
normal = geompy.GetNormal(face, vertex)
extrusionFaceFissure = geompy.MakePrismVecH(facesFissure, normal, 100)
geompy.addToStudy(extrusionFaceFissure, "extrusionFaceFissure")
return extrusionFaceFissure, normal

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)
def shapesSurFissure(blocPartition, plane1, faceFissure, gencnt):
"""
TODO: a completer
"""
logging.info('start')
shapesAModifier = []
vertex = geompy.MakeVertexOnSurface(plane1, 0.5, 0.5)
normal = geompy.GetNormal(plane1, vertex)
extrusion = geompy.MakePrismVecH(plane1, normal, 100)
sharedSolids = []
solids= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("SOLID"), GEOM.ST_ONIN )
for solid in solids:
sharedSolids += geompy.GetSharedShapes(faceFissure, solid, geompy.ShapeType["SOLID"])
logging.debug("sharedSolids %s",sharedSolids)
sharedFaces = []
faces= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("FACE"), GEOM.ST_ONIN )
for face in faces:
sharedFaces += geompy.GetSharedShapes(faceFissure, face, geompy.ShapeType["FACE"])
logging.debug("sharedFaces %s",sharedFaces)
sharedEdges = []
edges= geompy.GetShapesOnBox ( extrusion, blocPartition, geompy.ShapeType("EDGE"), GEOM.ST_ONIN )
for edge in edges:
if not edge.IsSame(gencnt):
sharedEdges += geompy.GetSharedShapes(faceFissure, edge, geompy.ShapeType["EDGE"])
logging.debug("sharedEdges %s",sharedEdges)
shapesAModifier = [ sharedSolids, sharedFaces, sharedEdges]
return shapesAModifier

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- tri par longueur d'edges
def sortEdges(edgesToSort):
"""
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]

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- tri par surface de faces
def sortFaces(facesToSort):
"""
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]

View File

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- tri par longueur des 3 generatrices
def sortGeneratrices(tore, geners):
"""
tri des 3 edges 'génératrices' selon leur longueur.
@param tore
@param les edges 'generatrices'
@return (genext, genint, gencnt) les 3 edges, de la plus grande à la plus petite
"""
logging.info("start")
genx = geompy.ExtractShapes(geners[0], geompy.ShapeType["EDGE"], True)
lenx = []
for i in range(len(genx)):
props = geompy.BasicProperties(genx[i])
lenx.append(props[0])
pass
minlen = min(lenx)
maxlen = max(lenx)
genext=None
gencnt=None
genint=None
for i in range(len(genx)):
if lenx[i] == minlen:
genint = genx[i]
elif lenx[i] == maxlen:
genext = genx[i]
else:
gencnt= genx[i]
pass
geompy.addToStudyInFather( tore, genext, 'genext' )
geompy.addToStudyInFather( tore, genint, 'genint' )
geompy.addToStudyInFather( tore, gencnt, 'gencnt' )
return genext, genint, gencnt

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- tri par volume de solides
def sortSolids(solidsToSort):
"""
tri des solides par volume
"""
logging.info('start')
volSolids = [(geompy.BasicProperties(solid)[2], i, solid) for i, solid in enumerate(solidsToSort)]
volSolids.sort()
solidsSorted = [solid for vol, i, solid in volSolids]
return solidsSorted, volSolids[0][0], volSolids[-1][0]

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- substract a list of subShapes from another
def substractSubShapes(obj, subs, toRemove):
"""
liste de subshapes par difference
"""
logging.info("start")
idToremove = {}
subList = []
for s in toRemove:
idToremove[geompy.GetSubShapeID(obj, s)] = s
for s in subs:
idsub = geompy.GetSubShapeID(obj, s)
if idsub not in idToremove.keys():
subList.append(s)
logging.debug("subList=%s", subList)
return subList

View File

@ -0,0 +1,22 @@
from blocFissure import gmu
from blocFissure.gmu.initEtude import initEtude
initEtude()
from blocFissure.gmu.triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
from blocFissure.gmu.distance2 import distance2
a=[10, 20, 30]
b=[5, 7, 3]
c=distance2(a,b)
import unittest
from blocFissure.gmu import initLog
initLog.setUnitTests()
from blocFissure.gmu import distance2
suite = unittest.TestLoader().loadTestsFromTestCase(distance2.Test_distance2)
unittest.TextTestRunner(verbosity=2).run(suite)

View File

@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
import math
from triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
# -----------------------------------------------------------------------------
# --- tore et plan de fissure
def toreFissure(minRad,allonge,rayTore):
"""
Construction de la geometrie du tore elliptique autour du front de fissure.
L'ellipse est construite dans le plan xoy, axe oy.
@param minRad :petit rayon
@param allonge :rapport grand rayon / petit rayon
@param rayTore :rayon du tore construit autour de la generatrice de l'ellipse
@return (generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part) : ellipse, section du tore,
tore plein, face plane de le fissure, plan de la fissure, tore partitioné par le plan de fissure.
"""
logging.info("start ", minRad, allonge, rayTore)
Vertex_1 = geompy.MakeVertex( minRad, 0, 0)
Vertex_2 = geompy.MakeVertex(-minRad, 0, 0)
Vertex_3 = geompy.MakeRotation(Vertex_1, OZ, 45*math.pi/180.0)
Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1)
#geompy.addToStudy( Vertex_1, 'Vertex_1' )
#geompy.addToStudy( Vertex_2, 'Vertex_2' )
#geompy.addToStudy( Vertex_3, 'Vertex_3' )
#geompy.addToStudy( Arc_1, 'Arc_1' )
#geompy.addToStudy( generatrice, 'generatrice' )
# --- face circulaire sur la generatrice, pour extrusion
Circle_1 = geompy.MakeCircle(O, OY, rayTore)
Rotation_1 = geompy.MakeRotation(Circle_1, OY, -90*math.pi/180.0)
Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0)
FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1)
#geompy.addToStudy( Circle_1, 'Circle_1' )
#geompy.addToStudy( Rotation_1, 'Rotation_1' )
#geompy.addToStudy( Translation_1, 'Translation_1' )
#geompy.addToStudy( FaceGenFiss, 'FaceGenFiss' )
# --- tore extrude
Pipe_1 = geompy.MakePipe(FaceGenFiss, generatrice)
# --- plan fissure, delimite par la generatrice
Scale_1_vertex_3 = geompy.GetSubShape(generatrice, [3])
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3)
FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1)
#geompy.addToStudyInFather( generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
#geompy.addToStudy( Line_1, 'Line_1' )
#geompy.addToStudy( FaceFissure, 'FaceFissure' )
# --- tore coupe en 2 demi tore de section 1/2 disque
Plane_1 = geompy.MakePlane(O, OZ, 2000)
Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
geompy.addToStudy(Pipe1Part , 'Pipe1Part' )
return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part

View File

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# --- origine et vecteurs de base
O = None
OX = None
OY = None
OZ = None
def triedreBase():
"""
definitions globales du triedre de reference,
objets partages par plusieurs methodes
"""
global O, OX, OY, OZ
if O == None:
logging.info("start")
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
return O, OX, OY, OZ

View File

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)
def whichSide(face, obj, tol = 1.e-3):
"""
Position d'un objet par rapport a une face (non nécessairement plane).
L'objet est supposé situé entierement d'un coté de la face,
ou lui appartenant totalement (objets traversants non pris en compte)
renvoie 1 si 'objet est du coté de la normale à la face,
-1 de l'autre coté, 0 si il est sur la face
"""
logging.debug('start')
side = 0
logging.debug("shape info %s", geompy.ShapeInfo(obj))
nbEdges = geompy.NbShapes(obj, geompy.ShapeType["EDGE"]) # --- attention ! pour une seule edge presente, renvoie 2
logging.debug(" nbEdges %s", nbEdges)
nbFaces = geompy.NbShapes(obj, geompy.ShapeType["FACE"]) # --- attention ! pour une seule face presente, renvoie 2
logging.debug(" nbFaces %s", nbFaces)
vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
if nbEdges > 0 and nbFaces == 0: # --- edges
if nbEdges <= 2:
point = geompy.MakeVertexOnCurve(obj, 0.5)
vertices.append(point)
else:
edges = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
for anEdge in edges:
point = geompy.MakeVertexOnCurve(anEdge, 0.5)
vertices.append(point)
elif nbFaces >0: # --- faces
if nbFaces <=2:
point = geompy.MakeVertexOnSurface(obj, 0.5, 0.5)
vertices.append(point)
if nbFaces > 2:
faces = geompy.ExtractShapes(obj, geompy.ShapeType["FACE"], False)
for aFace in faces:
point = geompy.MakeVertexOnSurface(aFace, 0.5, 0.5)
vertices.append(point)
else: # --- vertices
vertices = [obj]
for vertex in vertices:
distance = geompy.MinDistance(vertex, face)
logging.debug(" distance %s", distance)
if distance > tol:
projection = geompy.MakeProjection(vertex, face)
normal = geompy.GetNormal(face, projection)
vect = geompy.MakeVector(projection, vertex)
angle = geompy.GetAngle(normal, vect)
logging.debug(" angle %s", angle)
side = 1
if abs(angle) > 10:
side = -1
break
logging.debug(" side %s", side)
return side

View File

@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)
def whichSideMulti(facerefs, ifil, obj, centre, tol = 1.e-3):
"""
Position d'un objet par rapport a un ensemble de faces (non nécessairement planes).
Ces faces délimitent partiellement un volume, le point "centre" est supposé dans le volume
L'objet est supposé situé entierement d'un coté des faces,
ou appartenant totalement à une face (objets traversants non pris en compte)
renvoie 1 si 'objet est dedans (inside),
-1 dehors (outside), 0 si il est sur une face d'index ifil
"""
logging.debug('start')
side = 0
logging.debug("shape info %s", geompy.ShapeInfo(obj))
nbEdges = geompy.NbShapes(obj, geompy.ShapeType["EDGE"]) # --- attention ! pour une seule edge presente, renvoie 2
logging.debug(" nbEdges %s", nbEdges)
vertices = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
if nbEdges > 0 : # --- edges
if nbEdges <= 2:
point = geompy.MakeVertexOnCurve(obj, 0.5)
vertices.append(point)
else:
edges = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
for anEdge in edges:
point = geompy.MakeVertexOnCurve(anEdge, 0.5)
vertices.append(point)
else: # --- vertices
vertices = [obj]
nbOnRef = 0
nbOnOther = 0
for vertex in vertices:
nbMiss = 0
for i, face in enumerate(facerefs):
distance = geompy.MinDistance(vertex, face)
logging.debug(" distance %s", distance)
if distance > tol:
if geompy.MinDistance(vertex, centre) > tol:
line = geompy.MakeLineTwoPnt(vertex, centre)
else :
side = 1 # le centre est inside...
break
part = geompy.MakePartition([line], [face], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
nbpts = geompy.NbShapes(part,geompy.ShapeType["VERTEX"])
if nbpts > 2:
side = -1 # outside
break
else:
nbMiss += 1
pass # peut-être inside, tester les autres faces
else:
if i == ifil:
nbOnRef +=1 # le point est sur la face de référence, on continue avec les autres points
break
else:
nbOnOther += 1 # le point est sur une autre face, mais il peut aussi être sur la face de référence...
pass # on peut tester les autres faces
if nbMiss == len(facerefs):
side = 1 # inside
if side != 0:
break
if side == 0 and nbOnRef < len(vertices):
side = 1 # inside
logging.debug(" side %s", side)
return side

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même)
def whichSideVertex(face, vertex, tol = 1.e-3):
"""
Position d'un vertex par rapport a une face (non nécessairement plane).
renvoie 1 si le vertex est du coté de la normale à la face,
-1 de l'autre coté, 0 si il est sur la face
"""
#logging.info('start')
side = 0
distance = geompy.MinDistance(vertex, face)
#logging.debug(" distance %s", distance)
if distance > tol:
projection = geompy.MakeProjection(vertex, face)
normal = geompy.GetNormal(face, projection)
vect = geompy.MakeVector(projection, vertex)
angle = geompy.GetAngle(normal, vect)
#logging.debug(" angle %s", angle)
side = 1
if abs(angle) > 10:
side = -1
logging.debug("side %s distance %s", side, distance)
return side

View File

@ -0,0 +1,46 @@
# Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
#
# 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.
#
# 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
#
INCLUDE(UsePyQt4)
# --- scripts ---
# scripts / static
SET(plugin_SCRIPTS
__init__.py
fissureCoude_ihm.py
fissureCoude_plugin.py
)
# --- resources ---
# uic files / to be processed by pyuic
SET(_pyuic_files
fissureCoude.ui
fissureGenerale.ui
)
# scripts / pyuic wrappings
PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# --- rules ---
SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm)
SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm)

View File

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