smesh/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py

81 lines
3.1 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2021-03-23 17:44:27 +03:00
# Copyright (C) 2014-2021 EDF R&D
2019-02-14 14:55:47 +03:00
#
# 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
#
2021-04-01 16:19:17 +02:00
"""edges de bord, faces défaut à respecter"""
import logging
2021-04-01 16:19:17 +02:00
import SMESH
2017-03-20 13:27:30 +01:00
from .geomsmesh import geompy
from .geomsmesh import smesh
2021-04-06 17:50:03 +02:00
from .geomsmesh import geomPublish
2021-04-06 17:50:03 +02:00
from . import initLog
2017-03-20 13:27:30 +01:00
from .putName import putName
2021-01-26 18:34:02 +01:00
2021-04-02 17:05:20 +02:00
def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives, \
2021-04-06 17:43:34 +02:00
nro_cas=None):
2021-04-01 16:19:17 +02:00
"""edges de bord, faces défaut à respecter"""
logging.info('start')
2021-04-02 17:59:18 +02:00
logging.info("Pour le cas n°%d", nro_cas)
2021-04-01 16:19:17 +02:00
_ = smesh.CreateFilterManager()
_, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
criteres = list()
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres)
bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
2021-04-02 17:05:20 +02:00
putName(bordsLibres, 'bordsLibres', i_pref=nro_cas)
2021-04-06 17:50:03 +02:00
# --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'extérieur des volumes repliés sur eux-mêmes
# on désigne les faces de peau en quadrangles par le groupe "skinFaces"
skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
2021-04-01 16:19:17 +02:00
_ = skinFaces.AddFrom( internalBoundary.GetMesh() )
# --- maillage des éventuelles arêtes vives entre faces reconstruites
2021-01-26 18:34:02 +01:00
2014-09-21 21:49:53 +02:00
grpAretesVives = None
2021-01-27 11:51:06 +01:00
if aretesVivesCoupees:
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
2021-04-06 17:50:03 +02:00
geomPublish(initLog.always, aretesVivesC, "aretesVives", nro_cas)
meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment()
hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07)
2021-04-02 17:05:20 +02:00
putName(algo1d.GetSubMesh(), "aretesVives", i_pref=nro_cas)
putName(algo1d, "algo1d_aretesVives", i_pref=nro_cas)
putName(hypo1d, "hypo1d_aretesVives", i_pref=nro_cas)
2021-01-27 11:51:06 +01:00
2021-01-26 18:34:02 +01:00
is_done = meshAretesVives.Compute()
text = "meshAretesVives.Compute"
if is_done:
logging.info(text+" OK")
else:
text = "Erreur au calcul du maillage.\n" + text
logging.info(text)
raise Exception(text)
2021-01-27 11:51:06 +01:00
grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
2021-04-01 16:19:17 +02:00
_ = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
2021-01-26 18:34:02 +01:00
return (internalBoundary, bordsLibres, grpAretesVives)