X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FconstruitMaillagePipe.py;h=17b570594f6e898309df20f4b0213097e3ea2e22;hp=84be0203d9902b7053de6197bfca172baf1bbd06;hb=19f671efb91ebb9fa8f4c1beb053d4dc059196fa;hpb=e8173b4ff130ddb26d165c92403ef847fdfb8be2 diff --git a/src/Tools/blocFissure/gmu/construitMaillagePipe.py b/src/Tools/blocFissure/gmu/construitMaillagePipe.py index 84be0203d..17b570594 100644 --- a/src/Tools/blocFissure/gmu/construitMaillagePipe.py +++ b/src/Tools/blocFissure/gmu/construitMaillagePipe.py @@ -1,17 +1,46 @@ # -*- 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 +# +"""Maillage du pipe""" import logging -from .geomsmesh import geompy -from .geomsmesh import smesh import SMESH -def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad): - """ - maillage effectif du pipe - """ +from .geomsmesh import smesh +from .putName import putName + +from .construitMaillagePipe_a import construitMaillagePipe_a +from .construitMaillagePipe_b import construitMaillagePipe_b +from .construitMaillagePipe_c import construitMaillagePipe_c +from .construitMaillagePipe_d import construitMaillagePipe_d + +def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad, \ + nro_cas=None): + """maillage effectif du pipe""" logging.info('start') + logging.info("nbsegCercle = %d, nbsegRad = %d", nbsegCercle, nbsegRad) + logging.info("idisklim[0] = %d, idisklim[1] = %d", idisklim[0], idisklim[1]) + meshPipe = smesh.Mesh(None, "meshPipe") + putName(meshPipe, "meshPipe", i_pref=nro_cas) + fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS") nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis") faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi") @@ -20,150 +49,74 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad): edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1") faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0") faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1") - - mptsdisks = [] # vertices maillage de tous les disques - mEdges = [] # identifiants edges maillage fond de fissure - mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe - mFaces = [] # identifiants faces maillage fissure - mVols = [] # identifiants volumes maillage pipe - - mptdsk = None + + mptdsk = list() # vertices de chaque disque au fur et à mesure + mptsdisks = list() # vertices maillage de tous les disques + mEdges = list() # identifiants edges maillage fond de fissure + mEdgeFaces = list() # identifiants edges maillage edge face de fissure externe + mFaces = list() # identifiants faces maillage fissure + mVols = list() # identifiants volumes maillage pipe + for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes - + #logging.info(". Prise en compte du disque n°%d", idisk) + # ----------------------------------------------------------------------- - # --- points - - gptdsk = gptsdisks[idisk] - if idisk > idisklim[0]: - oldmpts = mptdsk - mptdsk = [] # vertices maillage d'un disque - for k in range(nbsegCercle): - points = gptdsk[k] - mptids = [] - for j, pt in enumerate(points): - if j == 0 and k > 0: - id = mptdsk[0][0] - else: - coords = geompy.PointCoordinates(pt) - id = meshPipe.AddNode(coords[0], coords[1], coords[2]) - mptids.append(id) - mptdsk.append(mptids) - mptsdisks.append(mptdsk) - + # --- Les points + + oldmpts = mptdsk + mptdsk = construitMaillagePipe_a(idisk, \ + gptsdisks, nbsegCercle, \ + meshPipe, mptsdisks) + # ----------------------------------------------------------------------- - # --- groupes edges cercles debouchants - - if idisk == idisklim[0]: - pts = [] - for k in range(nbsegCercle): - pts.append(mptdsk[k][-1]) - edges = [] - for k in range(len(pts)): - k1 = (k+1)%len(pts) - idEdge = meshPipe.AddEdge([pts[k], pts[k1]]) - edges.append(idEdge) - edgeCircPipe0Group.Add(edges) - - if idisk == idisklim[1]: - pts = [] - for k in range(nbsegCercle): - pts.append(mptdsk[k][-1]) - edges = [] - for k in range(len(pts)): - k1 = (k+1)%len(pts) - idEdge = meshPipe.AddEdge([pts[k], pts[k1]]) - edges.append(idEdge) - edgeCircPipe1Group.Add(edges) - + # --- Les groupes des edges des cercles débouchants + + if idisk in (idisklim[0],idisklim[1]): + construitMaillagePipe_b(idisk, \ + idisklim, nbsegCercle, \ + meshPipe, mptdsk, \ + edgeCircPipe0Group, edgeCircPipe1Group) + # ----------------------------------------------------------------------- - # --- groupes faces debouchantes - - if idisk == idisklim[0]: - faces = [] - for j in range(nbsegRad): - for k in range(nbsegCercle): - k1 = k+1 - if k == nbsegCercle-1: - k1 = 0 - if j == 0: - idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle - else: - idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle - faces.append(idf) - faceCircPipe0Group.Add(faces) - - if idisk == idisklim[1]: - faces = [] - for j in range(nbsegRad): - for k in range(nbsegCercle): - k1 = k+1 - if k == nbsegCercle-1: - k1 = 0 - if j == 0: - idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle - else: - idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle - faces.append(idf) - faceCircPipe1Group.Add(faces) - + # --- Les groupes des faces débouchantes + + if idisk in (idisklim[0],idisklim[1]): + construitMaillagePipe_c(idisk, \ + idisklim, nbsegCercle, \ + meshPipe, mptdsk, nbsegRad, \ + faceCircPipe0Group, faceCircPipe1Group) + # ----------------------------------------------------------------------- # --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure - - if idisk == idisklim[0]: - mEdges.append(0) - mEdgeFaces.append(0) - mFaces.append([0]) - mVols.append([[0]]) - nodesFondFissGroup.Add([mptdsk[0][0]]) - else: - ide = meshPipe.AddEdge([oldmpts[0][0], mptdsk[0][0]]) - mEdges.append(ide) - fondFissGroup.Add([ide]) - nodesFondFissGroup.Add([mptdsk[0][0]]) - ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]]) - mEdgeFaces.append(ide2) - edgeFaceFissGroup.Add([ide2]) - idFaces = [] - idVols = [] - - for j in range(nbsegRad): - idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]]) - faceFissGroup.Add([idf]) - idFaces.append(idf) - - idVolCercle = [] - for k in range(nbsegCercle): - k1 = k+1 - if k == nbsegCercle-1: - k1 = 0 - if j == 0: - idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], - oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1]]) - else: - idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j], - oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]]) - idVolCercle.append(idv) - idVols.append(idVolCercle) - - mFaces.append(idFaces) - mVols.append(idVols) + + construitMaillagePipe_d(idisk, \ + idisklim, nbsegCercle, nbsegRad, \ + meshPipe, mptdsk, oldmpts, \ + fondFissGroup, edgeFaceFissGroup, faceFissGroup, \ + mEdges, mEdgeFaces, mFaces, mVols, nodesFondFissGroup) + # Bilan pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' ) - nbAdd = pipeFissGroup.AddFrom( meshPipe.GetMesh() ) + _ = pipeFissGroup.AddFrom( meshPipe.GetMesh() ) - nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries") + _, _, _ = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries") edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group] - meshPipeGroups = dict(fondFissGroup = fondFissGroup, - nodesFondFissGroup = nodesFondFissGroup, - faceFissGroup = faceFissGroup, - edgeFaceFissGroup = edgeFaceFissGroup, - edgeCircPipe0Group = edgeCircPipe0Group, - edgeCircPipe1Group = edgeCircPipe1Group, - faceCircPipe0Group = faceCircPipe0Group, - faceCircPipe1Group = faceCircPipe1Group, - pipeFissGroup = pipeFissGroup, - edgesCircPipeGroup = edgesCircPipeGroup + meshPipeGroups = dict(fondFissGroup = fondFissGroup, \ + nodesFondFissGroup = nodesFondFissGroup, \ + faceFissGroup = faceFissGroup, \ + edgeFaceFissGroup = edgeFaceFissGroup, \ + edgeCircPipe0Group = edgeCircPipe0Group, \ + edgeCircPipe1Group = edgeCircPipe1Group, \ + faceCircPipe0Group = faceCircPipe0Group, \ + faceCircPipe1Group = faceCircPipe1Group, \ + pipeFissGroup = pipeFissGroup, \ + edgesCircPipeGroup = edgesCircPipeGroup \ ) - - return (meshPipe, meshPipeGroups, edgesCircPipeGroup) \ No newline at end of file + + #if meshPipe: + #text = "Arrêt rapide.\n" + #logging.info(text) + #raise Exception(text) + + return (meshPipe, meshPipeGroups, edgesCircPipeGroup)