ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ver.cpp
Revision: 926
Committed: Tue May 1 20:38:42 2018 UTC (7 years ago) by couturad
File size: 17609 byte(s)
Log Message:
Ajout de nouvelles fonctionnalités de representation et d'analyse des VES
*Modification du CMakeLists.txt de microstructure

File Contents

# User Rev Content
1 couturad 919 #include "mstruct_ver.h"
2 couturad 926 #include "mstruct_ves_file.h"
3 couturad 919 using namespace MICROSTRUCTURE;
4    
5 couturad 926 MSTRUCT_VER::MSTRUCT_VER(void)
6 couturad 919 {
7    
8     }
9    
10 couturad 926 MSTRUCT_VER::~MSTRUCT_VER(void)
11 couturad 919 {
12    
13     }
14    
15 couturad 926 void MSTRUCT_VER::active_affichage(MICROSTRUCTURE::fonction_affiche* fonc)
16 couturad 919 {
17     fonc_affiche = fonc;
18     affichageactif = 1;
19     }
20    
21 couturad 926 void MSTRUCT_VER::affiche(char* message)
22 couturad 919 {
23     if(affichageactif==1) fonc_affiche(message);
24     }
25    
26 couturad 926 int MSTRUCT_VER::cumuler_analyse(char* fichier_liste_ves,
27     std::vector< OT_PARAMETRES* >& vector_params_analyse,
28     char* dossier_resultat,
29     bool resultats_incrementaux,
30     bool avec_histogramme)
31 couturad 919 {
32 couturad 926 char message[5000];
33     std::map<long,MSTRUCT_VES_FILE*> map_ves_file;
34 couturad 919 std::ifstream f;
35     f.open(fichier_liste_ves,ios::in);
36     char ligne[1000];
37     f.getline(ligne,1000);
38 couturad 926 long i=0;
39 couturad 919 while(!f.eof())
40     {
41     char fichier_ves[1000];
42     sscanf(ligne,"%s",fichier_ves);
43     if(strlen(fichier_ves)==0) continue;
44 couturad 926 std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
45     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
46     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
47     map_ves_file.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
48     i++;
49 couturad 919 f.getline(ligne,1000);
50     }
51     f.close();
52 couturad 926 long nb_ves = map_ves_file.size();
53     sprintf(message,"NB_VES : %li",nb_ves); affiche(message);
54     std::vector<OT_PARAMETRES*>::iterator it;
55     for(it=vector_params_analyse.begin();it!=vector_params_analyse.end();it++)
56 couturad 919 {
57 couturad 926
58     OT_PARAMETRES* param = *it;
59     int Type_analyse = (int)param->get_valeur((char*)"Type_analyse");
60     std::string Identifiant = param->get_nom((char*)"Identifiant");
61     sprintf(message,"-> %s",Identifiant.c_str()); affiche(message);
62     char nom_fichier_resultat[500];
63     sprintf(nom_fichier_resultat,"%s%s.txt",dossier_resultat,Identifiant.c_str());
64     ofstream ofstrm(nom_fichier_resultat,ios::out);
65     ofstrm.precision(16);
66     if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CHAMP)
67 couturad 919 {
68 couturad 926 std::vector<MSTRUCT_ANALYSE_CHAMP*> vector_analyse;
69     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
70     i=1;
71     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
72     {
73     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
74     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
75     if(analyse==NULL)
76     {
77     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
78     return FAIL;
79     }
80     vector_analyse.push_back((MSTRUCT_ANALYSE_CHAMP*)analyse);
81     if(resultats_incrementaux)
82     {
83     MSTRUCT_ANALYSE_CHAMP analyse_champ(vector_analyse);
84     analyse_champ.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
85     }
86     i++;
87     }
88     if(!resultats_incrementaux)
89     {
90     MSTRUCT_ANALYSE_CHAMP analyse_champ(vector_analyse);
91     analyse_champ.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
92     }
93 couturad 919 }
94 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION)
95 couturad 919 {
96 couturad 926 std::vector<MSTRUCT_ANALYSE_ORIENTATION*> vector_analyse;
97     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
98     i=1;
99     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
100     {
101     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
102     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
103     if(analyse==NULL)
104     {
105     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
106     return FAIL;
107     }
108     vector_analyse.push_back((MSTRUCT_ANALYSE_ORIENTATION*)analyse);
109     if(resultats_incrementaux)
110     {
111     MSTRUCT_ANALYSE_ORIENTATION analyse_orientation(vector_analyse);
112     analyse_orientation.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
113     }
114     i++;
115     }
116     if(!resultats_incrementaux)
117     {
118     MSTRUCT_ANALYSE_ORIENTATION analyse_orientation(vector_analyse);
119     analyse_orientation.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
120     }
121 couturad 919 }
122 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CAO)
123 couturad 919 {
124 couturad 926 std::vector<MSTRUCT_ANALYSE_CAO*> vector_analyse;
125     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
126     i=1;
127     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
128     {
129     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
130     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
131     if(analyse==NULL)
132     {
133     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
134     return FAIL;
135     }
136     vector_analyse.push_back((MSTRUCT_ANALYSE_CAO*)analyse);
137     if(resultats_incrementaux)
138     {
139     MSTRUCT_ANALYSE_CAO analyse_cao(vector_analyse);
140     analyse_cao.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
141     }
142     i++;
143     }
144     if(!resultats_incrementaux)
145     {
146     MSTRUCT_ANALYSE_CAO analyse_orientation(vector_analyse);
147     analyse_orientation.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
148     }
149 couturad 919 }
150 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_MG)
151 couturad 919 {
152 couturad 926 std::vector<MSTRUCT_ANALYSE_MG_MAILLAGE*> vector_analyse;
153     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
154     i=1;
155     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
156     {
157     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
158     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
159     if(analyse==NULL)
160     {
161     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
162     return FAIL;
163     }
164     vector_analyse.push_back((MSTRUCT_ANALYSE_MG_MAILLAGE*)analyse);
165     if(resultats_incrementaux)
166     {
167     MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse);
168     analyse_mg_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
169     }
170     i++;
171     }
172     if(!resultats_incrementaux)
173     {
174     MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse);
175     analyse_mg_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
176     }
177 couturad 919 }
178 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_FEM)
179 couturad 919 {
180 couturad 926 std::vector<MSTRUCT_ANALYSE_FEM_MAILLAGE*> vector_analyse;
181     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
182     i=1;
183     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
184     {
185     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
186     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
187     if(analyse==NULL)
188     {
189     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
190     return FAIL;
191     }
192     vector_analyse.push_back((MSTRUCT_ANALYSE_FEM_MAILLAGE*)analyse);
193     if(resultats_incrementaux)
194     {
195     MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maillage(vector_analyse);
196     analyse_fem_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
197     }
198     i++;
199     }
200     if(!resultats_incrementaux)
201     {
202     MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maillage(vector_analyse);
203     analyse_fem_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
204     }
205 couturad 919 }
206     }
207 couturad 926 std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
208     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
209 couturad 919 {
210 couturad 926 delete it_ves_file->second;
211 couturad 919 }
212     return OK;
213     }
214    
215 couturad 926 int MSTRUCT_VER::calculer_modules_mecaniques(char* fichier_liste_ves_spherique,
216     char* fichier_liste_ves_deviatorique,
217     std::vector<OT_PARAMETRES*> &vector_params_ver,
218     char* dossier_resultat,
219     bool resultats_incrementaux,
220     bool avec_histogramme)
221 couturad 919 {
222 couturad 926 char message[5000];
223     std::map<long,MSTRUCT_VES_FILE*> map_ves_file_spherique;
224     std::ifstream f;
225     f.open(fichier_liste_ves_spherique,ios::in);
226     char ligne[1000];
227     f.getline(ligne,1000);
228     long i=0;
229     while(!f.eof())
230 couturad 919 {
231 couturad 926 char fichier_ves[1000];
232     sscanf(ligne,"%s",fichier_ves);
233     if(strlen(fichier_ves)==0) continue;
234     std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
235     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
236     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
237     map_ves_file_spherique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
238     i++;
239     f.getline(ligne,1000);
240 couturad 919 }
241 couturad 926 f.close();
242     std::map<long,MSTRUCT_VES_FILE*> map_ves_file_deviatorique;
243     f.open(fichier_liste_ves_deviatorique,ios::in);
244     f.getline(ligne,1000);
245     i=0;
246     while(!f.eof())
247 couturad 919 {
248 couturad 926 char fichier_ves[1000];
249     sscanf(ligne,"%s",fichier_ves);
250     if(strlen(fichier_ves)==0) continue;
251     std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
252     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
253     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
254     map_ves_file_deviatorique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
255     i++;
256     f.getline(ligne,1000);
257 couturad 919 }
258 couturad 926 f.close();
259     if(map_ves_file_spherique.size()!=map_ves_file_deviatorique.size())
260 couturad 919 {
261 couturad 926 std::cerr << "*** MSTRUCT_VER::calculer_module_young : Liste non identique ***" << std::endl;
262 couturad 919 return FAIL;
263     }
264 couturad 926 long nb_ves = map_ves_file_spherique.size();
265     sprintf(message,"NB_VES : %li",nb_ves); affiche(message);
266     std::vector<OT_PARAMETRES*>::iterator it;
267     for(it=vector_params_ver.begin();it!=vector_params_ver.end();it++)
268 couturad 919 {
269 couturad 926 OT_PARAMETRES *param = *it;
270    
271     std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
272     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
273     char nom_fichier_resultat[500];
274     sprintf(nom_fichier_resultat,"%sEapp_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
275     ofstream ofstrm(nom_fichier_resultat,ios::out);
276     ofstrm.precision(16);
277     double Largeur_colonne_distribution_module_Young = param->get_valeur((char*)"Largeur_colonne_distribution_module_Young");
278     std::vector<double> vector_Kapp;
279     std::vector<double> vector_Gapp;
280     std::vector<double> vector_Eapp;
281     std::vector<double> vector_Nuapp;
282     double Kapp_moyenne=0;
283     double Kapp_ecart_type=0;
284     double Kapp_min=numeric_limits<double>::max();
285     double Kapp_max=numeric_limits<double>::min();
286     double Gapp_moyenne=0;
287     double Gapp_ecart_type=0;
288     double Gapp_min=numeric_limits<double>::max();
289     double Gapp_max=numeric_limits<double>::min();
290     double Eapp_moyenne=0;
291     double Eapp_ecart_type=0;
292     double Eapp_min=numeric_limits<double>::max();
293     double Eapp_max=numeric_limits<double>::min();
294     double Nuapp_moyenne=0;
295     double Nuapp_ecart_type=0;
296     double Nuapp_min=numeric_limits<double>::max();
297     double Nuapp_max=numeric_limits<double>::min();
298     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_sph=map_ves_file_spherique.begin();
299     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_dev=map_ves_file_deviatorique.begin();
300     long i=1;
301     for(;it_ves_sph!=map_ves_file_spherique.end();it_ves_sph++,it_ves_dev++)
302 couturad 919 {
303 couturad 926 MSTRUCT_VES_FILE *ves_sph=it_ves_sph->second;
304     MSTRUCT_VES_FILE *ves_dev=it_ves_dev->second;
305    
306     MSTRUCT_ANALYSE_CHAMP* epsilon_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_epsilon);
307     MSTRUCT_ANALYSE_CHAMP* sigma_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_sigma);
308     MSTRUCT_ANALYSE_CHAMP* epsilon_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_epsilon);
309     MSTRUCT_ANALYSE_CHAMP* sigma_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_sigma);
310    
311     double Kapp = (sigma_sph->get_moyenne()[0]+sigma_sph->get_moyenne()[1]+sigma_sph->get_moyenne()[2])/(3.0*(epsilon_sph->get_moyenne()[0]+epsilon_sph->get_moyenne()[1]+epsilon_sph->get_moyenne()[2]));
312     double Gapp = (1./3.)*((sigma_dev->get_moyenne()[3]/(2*epsilon_dev->get_moyenne()[3]))+
313     (sigma_dev->get_moyenne()[4]/(2*epsilon_dev->get_moyenne()[4]))+
314     (sigma_dev->get_moyenne()[5]/(2*epsilon_dev->get_moyenne()[5])));
315     double Eapp = (9.0*Kapp*Gapp)/(3.0*Kapp+Gapp);
316     double Nuapp = (3.0*Kapp-2.0*Gapp)/(2.0*(3.0*Kapp+Gapp));
317     vector_Kapp.push_back(Kapp);
318     vector_Gapp.push_back(Gapp);
319     vector_Eapp.push_back(Eapp);
320     vector_Nuapp.push_back(Nuapp);
321     if(resultats_incrementaux)
322     {
323     Kapp_moyenne=0;
324     Kapp_ecart_type=0;
325     Kapp_min=numeric_limits<double>::max();
326     Kapp_max=numeric_limits<double>::min();
327     Gapp_moyenne=0;
328     Gapp_ecart_type=0;
329     Gapp_min=numeric_limits<double>::max();
330     Gapp_max=numeric_limits<double>::min();
331     Eapp_moyenne=0;
332     Eapp_ecart_type=0;
333     Eapp_min=numeric_limits<double>::max();
334     Eapp_max=numeric_limits<double>::min();
335     Nuapp_moyenne=0;
336     Nuapp_ecart_type=0;
337     Nuapp_min=numeric_limits<double>::max();
338     Nuapp_max=numeric_limits<double>::min();
339     std::vector<double>::iterator it_Kapp=vector_Kapp.begin();
340     std::vector<double>::iterator it_Gapp=vector_Gapp.begin();
341     std::vector<double>::iterator it_Eapp=vector_Eapp.begin();
342     std::vector<double>::iterator it_Nuapp=vector_Nuapp.begin();
343     for(long j=0;j<i;j++)
344     {
345     Kapp_moyenne+=*it_Kapp;
346     if(*it_Kapp<Kapp_min) Kapp_min=*it_Kapp;
347     if(*it_Kapp>Kapp_max) Kapp_max=*it_Kapp;
348     Gapp_moyenne+=*it_Gapp;
349     if(*it_Gapp<Gapp_min) Gapp_min=*it_Gapp;
350     if(*it_Gapp>Gapp_max) Gapp_max=*it_Gapp;
351     Eapp_moyenne+=*it_Eapp;
352     if(*it_Eapp<Eapp_min) Eapp_min=*it_Eapp;
353     if(*it_Eapp>Eapp_max) Eapp_max=*it_Eapp;
354     Nuapp_moyenne+=*it_Nuapp;
355     if(*it_Nuapp<Nuapp_min) Nuapp_min=*it_Nuapp;
356     if(*it_Nuapp>Nuapp_max) Nuapp_max=*it_Nuapp;
357     it_Kapp++;
358     it_Gapp++;
359     it_Eapp++;
360     it_Nuapp++;
361     }
362     Kapp_moyenne=Kapp_moyenne/i;
363     Gapp_moyenne=Gapp_moyenne/i;
364     Eapp_moyenne=Eapp_moyenne/i;
365     Nuapp_moyenne=Nuapp_moyenne/i;
366     it_Kapp=vector_Kapp.begin();
367     it_Gapp=vector_Gapp.begin();
368     it_Eapp=vector_Eapp.begin();
369     it_Nuapp=vector_Nuapp.begin();
370     for(long j=0;j<i;j++)
371     {
372     Kapp_ecart_type+=(*it_Kapp-Kapp_moyenne)*(*it_Kapp-Kapp_moyenne);
373     Gapp_ecart_type+=(*it_Gapp-Gapp_moyenne)*(*it_Gapp-Gapp_moyenne);
374     Eapp_ecart_type+=(*it_Eapp-Eapp_moyenne)*(*it_Eapp-Eapp_moyenne);
375     Nuapp_ecart_type+=(*it_Nuapp-Nuapp_moyenne)*(*it_Nuapp-Nuapp_moyenne);
376     }
377     Kapp_ecart_type=sqrt(Kapp_ecart_type*(1.0/(i-1.0)));
378     Gapp_ecart_type=sqrt(Gapp_ecart_type*(1.0/(i-1.0)));
379     Eapp_ecart_type=sqrt(Eapp_ecart_type*(1.0/(i-1.0)));
380     Nuapp_ecart_type=sqrt(Nuapp_ecart_type*(1.0/(i-1.0)));
381    
382     if(i==1) ofstrm << "# Eapp[Moy ± min max] Nuapp[Moy ± min max] Kapp[Moy ± min max] Gapp[Moy ± min max]" << std::endl;
383     ofstrm << i << " "
384     << Eapp_moyenne << " "
385     << Eapp_ecart_type << " "
386     << Eapp_min << " "
387     << Eapp_max << " "
388     << Nuapp_moyenne << " "
389     << Nuapp_ecart_type << " "
390     << Nuapp_min << " "
391     << Nuapp_max << " "
392     << Kapp_moyenne << " "
393     << Kapp_ecart_type << " "
394     << Kapp_min << " "
395     << Kapp_max << " "
396     << Gapp_moyenne << " "
397     << Gapp_ecart_type << " "
398     << Gapp_min << " "
399     << Gapp_max << std::endl;
400     }
401     i++;
402 couturad 919 }
403 couturad 926 if(!resultats_incrementaux)
404     {
405     Kapp_moyenne=0;
406     Kapp_ecart_type=0;
407     Kapp_min=numeric_limits<double>::max();
408     Kapp_max=numeric_limits<double>::min();
409     Gapp_moyenne=0;
410     Gapp_ecart_type=0;
411     Gapp_min=numeric_limits<double>::max();
412     Gapp_max=numeric_limits<double>::min();
413     Eapp_moyenne=0;
414     Eapp_ecart_type=0;
415     Eapp_min=numeric_limits<double>::max();
416     Eapp_max=numeric_limits<double>::min();
417     Nuapp_moyenne=0;
418     Nuapp_ecart_type=0;
419     Nuapp_min=numeric_limits<double>::max();
420     Nuapp_max=numeric_limits<double>::min();
421     std::vector<double>::iterator it_Kapp=vector_Kapp.begin();
422     std::vector<double>::iterator it_Gapp=vector_Gapp.begin();
423     std::vector<double>::iterator it_Eapp=vector_Eapp.begin();
424     std::vector<double>::iterator it_Nuapp=vector_Nuapp.begin();
425     for(long j=0;j<i;j++)
426     {
427     Kapp_moyenne+=*it_Kapp;
428     if(*it_Kapp<Kapp_min) Kapp_min=*it_Kapp;
429     if(*it_Kapp>Kapp_max) Kapp_max=*it_Kapp;
430     Gapp_moyenne+=*it_Gapp;
431     if(*it_Gapp<Gapp_min) Gapp_min=*it_Gapp;
432     if(*it_Gapp>Gapp_max) Gapp_max=*it_Gapp;
433     Eapp_moyenne+=*it_Eapp;
434     if(*it_Eapp<Eapp_min) Eapp_min=*it_Eapp;
435     if(*it_Eapp>Eapp_max) Eapp_max=*it_Eapp;
436     Nuapp_moyenne+=*it_Nuapp;
437     if(*it_Nuapp<Nuapp_min) Nuapp_min=*it_Nuapp;
438     if(*it_Nuapp>Nuapp_max) Nuapp_max=*it_Nuapp;
439     it_Kapp++;
440     it_Gapp++;
441     it_Eapp++;
442     it_Nuapp++;
443     }
444     Kapp_moyenne=Kapp_moyenne/i;
445     Gapp_moyenne=Gapp_moyenne/i;
446     Eapp_moyenne=Eapp_moyenne/i;
447     Nuapp_moyenne=Nuapp_moyenne/i;
448     it_Kapp=vector_Kapp.begin();
449     it_Gapp=vector_Gapp.begin();
450     it_Eapp=vector_Eapp.begin();
451     it_Nuapp=vector_Nuapp.begin();
452     for(long j=0;j<i;j++)
453     {
454     Kapp_ecart_type+=(*it_Kapp-Kapp_moyenne)*(*it_Kapp-Kapp_moyenne);
455     Gapp_ecart_type+=(*it_Gapp-Gapp_moyenne)*(*it_Gapp-Gapp_moyenne);
456     Eapp_ecart_type+=(*it_Eapp-Eapp_moyenne)*(*it_Eapp-Eapp_moyenne);
457     Nuapp_ecart_type+=(*it_Nuapp-Nuapp_moyenne)*(*it_Nuapp-Nuapp_moyenne);
458     }
459     Kapp_ecart_type=sqrt(Kapp_ecart_type*(1.0/(i-1.0)));
460     Gapp_ecart_type=sqrt(Gapp_ecart_type*(1.0/(i-1.0)));
461     Eapp_ecart_type=sqrt(Eapp_ecart_type*(1.0/(i-1.0)));
462     Nuapp_ecart_type=sqrt(Nuapp_ecart_type*(1.0/(i-1.0)));
463     ofstrm << "# Eapp[Moy ± min max] Nuapp[Moy ± min max] Kapp[Moy ± min max] Gapp[Moy ± min max]" << std::endl;
464     ofstrm << i << " "
465     << Eapp_moyenne << " "
466     << Eapp_ecart_type << " "
467     << Eapp_min << " "
468     << Eapp_max << " "
469     << Nuapp_moyenne << " "
470     << Nuapp_ecart_type << " "
471     << Nuapp_min << " "
472     << Nuapp_max << " "
473     << Kapp_moyenne << " "
474     << Kapp_ecart_type << " "
475     << Kapp_min << " "
476     << Kapp_max << " "
477     << Gapp_moyenne << " "
478     << Gapp_ecart_type << " "
479     << Gapp_min << " "
480     << Gapp_max << std::endl;
481     }
482 couturad 919 }
483     }
484    
485    
486    
487    
488    
489 couturad 926
490    
491    
492    
493    
494    
495    
496    
497    
498    
499    
500    
501    
502    
503    
504    
505    
506    
507    
508    
509    
510    
511    
512