1 # -*- coding: utf-8 -*-
8 # -----------------------------------------------------------------------------
9 # --- satistiques maillage
11 def getGroupesRef(fichierMed):
12 fichier=fichierMed.replace('.med','_groupesRef.res')
14 text=open(fichier).read()
21 def getStatsMaillage(maillage,fichierStatMaillage):
27 if maillage is not None:
28 mesures = maillage.GetMeshInfo()
31 for i in range(len(mesures)):
32 txt += str(SMESH.EntityType._item(i))+ " " +str(mesures[SMESH.EntityType._item(i)]) + "\n"
34 from utiles import writeFile
35 writeFile(fichierStatMaillage,txt)
39 def getStatsGroupes(maillage,fichierMedResult):
43 fichierGroupe=fichierMedResult.replace('.med','_groupesRef.res')
44 lGroups=getGroupesRef(fichierGroupe)
46 print "pas de Groupe de Reference "
48 os.remove(fichierGroupe)
52 lGroupsSMESH=maillage.GetGroups()
53 for groupe in lGroupsSMESH :
54 groupeName= groupe.GetName()
55 if groupeName not in lGroups : continue
56 extension='_'+groupeName+'.res'
57 fichierStatGroupe=fichierGroupe.replace('_groupesRef.res',extension)
58 getStatsStatSurGroupes(maillage,groupe,fichierStatGroupe)
61 def getStatsStatSurGroupes(maillage,groupe,fichierStatGroupe):
62 mesures = maillage.GetMeshInfo(groupe)
65 for i in range(len(mesures)):
66 txt += str(SMESH.EntityType._item(i))+ " " +str(mesures[SMESH.EntityType._item(i)]) + "\n"
67 from utiles import writeFile
68 writeFile(fichierStatGroupe,txt)
70 def genHistogram(aMesh, aCriterion, nbIntervals, isLog, aFile,theStudy):
72 from salome.smesh import smeshBuilder
73 smesh = smeshBuilder.New(theStudy)
74 aFunctor = smesh.GetFunctor(aCriterion)
75 aFunctor.SetMesh(aMesh.GetMesh())
76 histogram = aFunctor.GetHistogram(nbIntervals,isLog)
78 for tranche in histogram:
79 f.write(str(tranche.min) + " " + str(tranche.max) + " " + str(tranche.nbEvents) + "\n")