X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2FCasTests%2Fvis_1.py;h=6de374e8815212b28787be728b8dd5755af2864c;hp=cc7c6a1fdde860285f5a21baaf0669866425f497;hb=ff873c8b10f4cc15316f4ee7e1331ec1b4e0c1ab;hpb=7a65c9fad427b1ccba6b9ccae612296e5092a324 diff --git a/src/Tools/blocFissure/CasTests/vis_1.py b/src/Tools/blocFissure/CasTests/vis_1.py index cc7c6a1fd..6de374e88 100644 --- a/src/Tools/blocFissure/CasTests/vis_1.py +++ b/src/Tools/blocFissure/CasTests/vis_1.py @@ -1,20 +1,35 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2014-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +"""problème de fissure non plane, débouchante non normale""" +import logging import os + from blocFissure import gmu +from blocFissure.gmu import initLog from blocFissure.gmu.geomsmesh import geompy, smesh +from blocFissure.gmu.geomsmesh import geomPublish +from blocFissure.gmu.geomsmesh import geomPublishInFather -import math -import GEOM -import SALOMEDS -import SMESH -#import StdMeshers -#import GHS3DPlugin -#import NETGENPlugin -import logging - +from blocFissure.gmu.putName import putName from blocFissure.gmu.fissureGenerique import fissureGenerique - from blocFissure.gmu.triedreBase import triedreBase from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain @@ -23,83 +38,100 @@ from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale O, OX, OY, OZ = triedreBase() class vis_1(fissureGenerique): - """ - problème de fissure non plane, débouchante non normale - """ + """problème de fissure non plane, débouchante non normale""" nomProbleme = "vis_1" + shapeFissureParams = dict() + maillageFissureParams = dict() + referencesMaillageFissure = dict() # --------------------------------------------------------------------------- def genereMaillageSain(self, geometriesSaines, meshParams): - logging.info("genereMaillageSain %s", self.nomCas) + texte = "genereMaillageSain pour '{}'".format(self.nomCas) + logging.info(texte) - ([objetSain], status) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests/visSain.med")) - smesh.SetName(objetSain.GetMesh(), 'objetSain') + ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "visSain.med")) + putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa # --------------------------------------------------------------------------- def setParamShapeFissure(self): - """ - paramètres de la fissure pour méthode construitFissureGenerale + """paramètres de la fissure pour méthode construitFissureGenerale + lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage) rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne pointIn_x : optionnel coordonnée x d'un point dans le solide sain (pour orienter la face) """ - logging.info("setParamShapeFissure %s", self.nomCas) + texte = "setParamShapeFissure pour '{}'".format(self.nomCas) + logging.info(texte) self.shapeFissureParams = dict(lgInfluence = 0.6, rayonPipe = 0.1) # --------------------------------------------------------------------------- - def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams): - logging.info("genereShapeFissure %s", self.nomCas) + def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \ + mailleur="MeshGems"): + """Importe la géométrie de la fissure et crée le groupe du fond de la fissure""" + texte = "genereShapeFissure pour '{}'".format(self.nomCas) + logging.info(texte) lgInfluence = shapeFissureParams['lgInfluence'] - shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP") + shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "visFiss.brep")) fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"]) - geompy.UnionIDs(fondFiss, [4, 7, 9]) - geompy.addToStudy( shellFiss, 'shellFiss' ) - geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' ) - + geompy.UnionIDs(fondFiss, [6, 8]) + geomPublish(initLog.always, shellFiss, "shellFiss", self.numeroCas) + geomPublishInFather(initLog.always, shellFiss, fondFiss, "fondFiss", self.numeroCas) - coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.1 ,0.2) + mailleur = self.mailleur2d3d() + coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 0.1 ,0.2, mailleur, self.numeroCas) centre = None + return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss] # --------------------------------------------------------------------------- def setParamMaillageFissure(self): - self.maillageFissureParams = dict(nomRep = '.', + texte = "setParamMaillageFissure pour '{}'".format(self.nomCas) + logging.info(texte) + self.maillageFissureParams = dict(nomRep = os.curdir, nomFicSain = self.nomCas, - nomFicFissure = 'fissure_' + self.nomCas, + nomFicFissure = self.nomCas + "_fissure", nbsegRad = 5, nbsegCercle = 32, areteFaceFissure = 0.1) # --------------------------------------------------------------------------- def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams): - elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams) + elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams, \ + self.numeroCas) return elementsDefaut # --------------------------------------------------------------------------- - def genereMaillageFissure(self, geometriesSaines, maillagesSains, - shapesFissure, shapeFissureParams, - maillageFissureParams, elementsDefaut, step): - maillageFissure = construitFissureGenerale(maillagesSains, - shapesFissure, shapeFissureParams, - maillageFissureParams, elementsDefaut, step) + def genereMaillageFissure(self, geometriesSaines, maillagesSains, \ + shapesFissure, shapeFissureParams, \ + maillageFissureParams, elementsDefaut, step, \ + mailleur="MeshGems"): + + texte = "genereMaillageFissure pour '{}'".format(self.nomCas) + logging.info(texte) + + mailleur = self.mailleur2d3d() + maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ + maillageFissureParams, elementsDefaut, \ + mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- def setReferencesMaillageFissure(self): - self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 1284, - Entity_Quad_Triangle = 2336, - Entity_Quad_Edge = 758, - Entity_Quad_Penta = 984, - Entity_Quad_Hexa = 6416, - Entity_Node = 85673, - Entity_Quad_Tetra = 35990, - Entity_Quad_Quadrangle = 4285) - + self.referencesMaillageFissure = dict( \ + Entity_Quad_Quadrangle = 11596, \ + Entity_Quad_Hexa = 37008, \ + Entity_Node = 250929, \ + Entity_Quad_Edge = 30356, \ + Entity_Quad_Triangle = 8088, \ + Entity_Quad_Tetra = 49055, \ + Entity_Quad_Pyramid = 3026, \ + Entity_Quad_Penta = 4392 \ + )