1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 # -----------------------------------------------------------------------------
25 # --- statistiques maillage
27 def getStatsMaillageFissure(maillage, referencesMaillageFissure, maillageFissureParams):
31 logging.debug('start')
34 if 'nomRep' in maillageFissureParams:
35 nomRep = maillageFissureParams['nomRep']
37 nomFicFissure = maillageFissureParams['nomFicFissure']
38 fichierStatMaillageFissure = nomRep + '/' + nomFicFissure + '.res'
39 fichierNewRef = nomRep + '/' + nomFicFissure + '.new'
40 logging.debug("fichierStatMaillageFissure=%s", fichierStatMaillageFissure)
43 if maillage is not None:
44 mesures = maillage.GetMeshInfo()
46 for key, value in mesures.items():
47 logging.debug( "key: %s value: %s", key, value)
49 logging.debug("dico mesures %s", d)
51 f = open(fichierStatMaillageFissure, 'w')
52 f2 = open(fichierNewRef, 'w')
54 for key in ('Entity_Quad_Pyramid', 'Entity_Quad_Hexa', 'Entity_Quad_Quadrangle'):
55 if d[key] != referencesMaillageFissure[key]:
56 logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
57 f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
60 logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
61 f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
62 f2.write(key + " = " + str(d[key]) + ",\n")
64 for key in ('Entity_Quad_Penta', 'Entity_Quad_Tetra', 'Entity_Quad_Triangle', 'Entity_Quad_Edge', 'Entity_Node'):
65 if (d[key] < (1.0 - tolerance)*referencesMaillageFissure[key]) \
66 or (d[key] > (1.0 + tolerance)*referencesMaillageFissure[key]):
67 logging.info("Ecart: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
68 f.write("Ecart: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
71 logging.info("Valeur_OK: %s reference: %s calcul: %s", key, referencesMaillageFissure[key], d[key])
72 f.write("Valeur_OK: " + key + " reference: " + str(referencesMaillageFissure[key]) + " calcul: " + str(d[key]) + '\n')
73 f2.write(key + " = " + str(d[key]) + ",\n")