ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ver.cpp
Revision: 927
Committed: Mon May 7 17:16:53 2018 UTC (7 years ago) by couturad
File size: 22962 byte(s)
Log Message:
Mise a jour des fonctionnalites 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 927 int MSTRUCT_VER::exporter_analyse(char* fichier_liste_ves,
27     std::vector< OT_PARAMETRES* >& vector_params_analyse,
28     char* dossier_resultat)
29     {
30     char message[5000];
31     std::map<long,MSTRUCT_VES_FILE*> map_ves_file;
32     std::ifstream f;
33     f.open(fichier_liste_ves,ios::in);
34     char ligne[1000];
35     f.getline(ligne,1000);
36     long i=0;
37     while(!f.eof())
38     {
39     char fichier_ves[1000];
40     sscanf(ligne,"%s",fichier_ves);
41     if(strlen(fichier_ves)==0) continue;
42     std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
43     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
44     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
45     map_ves_file.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
46     i++;
47     f.getline(ligne,1000);
48     }
49     f.close();
50     long nb_ves = map_ves_file.size();
51     sprintf(message,"NB_VES : %li",nb_ves); affiche(message);
52     std::vector<OT_PARAMETRES*>::iterator it;
53     for(it=vector_params_analyse.begin();it!=vector_params_analyse.end();it++)
54     {
55    
56     OT_PARAMETRES* param = *it;
57     int Type_analyse = (int)param->get_valeur((char*)"Type_analyse");
58     std::string Identifiant = param->get_nom((char*)"Identifiant");
59     sprintf(message,"-> %s",Identifiant.c_str()); affiche(message);
60     char nom_fichier_resultat[500];
61     sprintf(nom_fichier_resultat,"%s%s.txt",dossier_resultat,Identifiant.c_str());
62     ofstream ofstrm(nom_fichier_resultat,ios::out);
63     ofstrm.precision(16);
64     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
65     i=1;
66     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
67     {
68     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
69     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
70     if(analyse==NULL)
71     {
72     std::cerr << "*** MSTRUCT_VER::exporter_analyse : Erreur ***" << std::endl;
73     return FAIL;
74     }
75     analyse->exporter(ofstrm,i);
76     i++;
77     }
78     }
79     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
80     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
81     {
82     delete it_ves_file->second;
83     }
84     }
85    
86    
87 couturad 926 int MSTRUCT_VER::cumuler_analyse(char* fichier_liste_ves,
88     std::vector< OT_PARAMETRES* >& vector_params_analyse,
89     char* dossier_resultat,
90     bool resultats_incrementaux,
91     bool avec_histogramme)
92 couturad 919 {
93 couturad 927
94 couturad 926 char message[5000];
95     std::map<long,MSTRUCT_VES_FILE*> map_ves_file;
96 couturad 919 std::ifstream f;
97     f.open(fichier_liste_ves,ios::in);
98     char ligne[1000];
99     f.getline(ligne,1000);
100 couturad 926 long i=0;
101 couturad 919 while(!f.eof())
102     {
103     char fichier_ves[1000];
104     sscanf(ligne,"%s",fichier_ves);
105     if(strlen(fichier_ves)==0) continue;
106 couturad 926 std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
107     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
108     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
109     map_ves_file.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
110     i++;
111 couturad 919 f.getline(ligne,1000);
112     }
113     f.close();
114 couturad 926 long nb_ves = map_ves_file.size();
115     sprintf(message,"NB_VES : %li",nb_ves); affiche(message);
116     std::vector<OT_PARAMETRES*>::iterator it;
117     for(it=vector_params_analyse.begin();it!=vector_params_analyse.end();it++)
118 couturad 919 {
119 couturad 926
120     OT_PARAMETRES* param = *it;
121     int Type_analyse = (int)param->get_valeur((char*)"Type_analyse");
122     std::string Identifiant = param->get_nom((char*)"Identifiant");
123     sprintf(message,"-> %s",Identifiant.c_str()); affiche(message);
124     char nom_fichier_resultat[500];
125     sprintf(nom_fichier_resultat,"%s%s.txt",dossier_resultat,Identifiant.c_str());
126     ofstream ofstrm(nom_fichier_resultat,ios::out);
127     ofstrm.precision(16);
128     if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CHAMP)
129 couturad 919 {
130 couturad 926 std::vector<MSTRUCT_ANALYSE_CHAMP*> vector_analyse;
131     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
132     i=1;
133     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
134     {
135     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
136     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
137     if(analyse==NULL)
138     {
139     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
140     return FAIL;
141     }
142     vector_analyse.push_back((MSTRUCT_ANALYSE_CHAMP*)analyse);
143     if(resultats_incrementaux)
144     {
145     MSTRUCT_ANALYSE_CHAMP analyse_champ(vector_analyse);
146     analyse_champ.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
147     }
148     i++;
149     }
150     if(!resultats_incrementaux)
151     {
152     MSTRUCT_ANALYSE_CHAMP analyse_champ(vector_analyse);
153 couturad 927 analyse_champ.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
154 couturad 926 }
155 couturad 919 }
156 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION)
157 couturad 919 {
158 couturad 926 std::vector<MSTRUCT_ANALYSE_ORIENTATION*> vector_analyse;
159     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
160     i=1;
161     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
162     {
163     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
164     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
165     if(analyse==NULL)
166     {
167     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
168     return FAIL;
169     }
170     vector_analyse.push_back((MSTRUCT_ANALYSE_ORIENTATION*)analyse);
171     if(resultats_incrementaux)
172     {
173     MSTRUCT_ANALYSE_ORIENTATION analyse_orientation(vector_analyse);
174     analyse_orientation.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
175     }
176     i++;
177     }
178     if(!resultats_incrementaux)
179     {
180     MSTRUCT_ANALYSE_ORIENTATION analyse_orientation(vector_analyse);
181 couturad 927 analyse_orientation.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
182 couturad 926 }
183 couturad 919 }
184 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CAO)
185 couturad 919 {
186 couturad 926 std::vector<MSTRUCT_ANALYSE_CAO*> vector_analyse;
187     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
188     i=1;
189     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
190     {
191     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
192     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
193     if(analyse==NULL)
194     {
195     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
196     return FAIL;
197     }
198     vector_analyse.push_back((MSTRUCT_ANALYSE_CAO*)analyse);
199     if(resultats_incrementaux)
200     {
201     MSTRUCT_ANALYSE_CAO analyse_cao(vector_analyse);
202     analyse_cao.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
203     }
204     i++;
205     }
206     if(!resultats_incrementaux)
207     {
208     MSTRUCT_ANALYSE_CAO analyse_orientation(vector_analyse);
209 couturad 927 analyse_orientation.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
210 couturad 926 }
211 couturad 919 }
212 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_MG)
213 couturad 919 {
214 couturad 926 std::vector<MSTRUCT_ANALYSE_MG_MAILLAGE*> vector_analyse;
215     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
216     i=1;
217     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
218     {
219     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
220     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
221     if(analyse==NULL)
222     {
223     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
224     return FAIL;
225     }
226     vector_analyse.push_back((MSTRUCT_ANALYSE_MG_MAILLAGE*)analyse);
227     if(resultats_incrementaux)
228     {
229     MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse);
230     analyse_mg_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
231     }
232     i++;
233     }
234     if(!resultats_incrementaux)
235     {
236     MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse);
237 couturad 927 analyse_mg_maillage.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
238 couturad 926 }
239 couturad 919 }
240 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_FEM)
241 couturad 919 {
242 couturad 926 std::vector<MSTRUCT_ANALYSE_FEM_MAILLAGE*> vector_analyse;
243     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
244     i=1;
245     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
246     {
247     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
248     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
249     if(analyse==NULL)
250     {
251     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
252     return FAIL;
253     }
254     vector_analyse.push_back((MSTRUCT_ANALYSE_FEM_MAILLAGE*)analyse);
255     if(resultats_incrementaux)
256     {
257     MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maillage(vector_analyse);
258     analyse_fem_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
259     }
260     i++;
261     }
262     if(!resultats_incrementaux)
263     {
264     MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maillage(vector_analyse);
265 couturad 927 analyse_fem_maillage.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
266 couturad 926 }
267 couturad 919 }
268     }
269 couturad 926 std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
270     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
271 couturad 919 {
272 couturad 926 delete it_ves_file->second;
273 couturad 919 }
274     return OK;
275     }
276    
277 couturad 926 int MSTRUCT_VER::calculer_modules_mecaniques(char* fichier_liste_ves_spherique,
278     char* fichier_liste_ves_deviatorique,
279     std::vector<OT_PARAMETRES*> &vector_params_ver,
280     char* dossier_resultat,
281 couturad 927 bool cumuler,
282 couturad 926 bool resultats_incrementaux,
283     bool avec_histogramme)
284 couturad 919 {
285 couturad 926 char message[5000];
286     std::map<long,MSTRUCT_VES_FILE*> map_ves_file_spherique;
287     std::ifstream f;
288     f.open(fichier_liste_ves_spherique,ios::in);
289     char ligne[1000];
290     f.getline(ligne,1000);
291     long i=0;
292     while(!f.eof())
293 couturad 919 {
294 couturad 926 char fichier_ves[1000];
295     sscanf(ligne,"%s",fichier_ves);
296     if(strlen(fichier_ves)==0) continue;
297     std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
298     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
299     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
300     map_ves_file_spherique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
301     i++;
302     f.getline(ligne,1000);
303 couturad 919 }
304 couturad 926 f.close();
305     std::map<long,MSTRUCT_VES_FILE*> map_ves_file_deviatorique;
306     f.open(fichier_liste_ves_deviatorique,ios::in);
307     f.getline(ligne,1000);
308     i=0;
309     while(!f.eof())
310 couturad 919 {
311 couturad 926 char fichier_ves[1000];
312     sscanf(ligne,"%s",fichier_ves);
313     if(strlen(fichier_ves)==0) continue;
314     std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
315     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
316     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
317     map_ves_file_deviatorique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
318     i++;
319     f.getline(ligne,1000);
320 couturad 919 }
321 couturad 926 f.close();
322     if(map_ves_file_spherique.size()!=map_ves_file_deviatorique.size())
323 couturad 919 {
324 couturad 926 std::cerr << "*** MSTRUCT_VER::calculer_module_young : Liste non identique ***" << std::endl;
325 couturad 919 return FAIL;
326     }
327 couturad 926 long nb_ves = map_ves_file_spherique.size();
328     sprintf(message,"NB_VES : %li",nb_ves); affiche(message);
329     std::vector<OT_PARAMETRES*>::iterator it;
330     for(it=vector_params_ver.begin();it!=vector_params_ver.end();it++)
331 couturad 919 {
332 couturad 926 OT_PARAMETRES *param = *it;
333    
334     std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
335     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
336 couturad 927 double Largeur_colonne_distribution_module_Kapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Kapp");
337     double Largeur_colonne_distribution_module_Gapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Gapp");
338     double Largeur_colonne_distribution_module_Eapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Eapp");
339     std::cout << "Largeur_colonne_distribution_module_Eapp" << Largeur_colonne_distribution_module_Eapp << std::endl;
340     double Largeur_colonne_distribution_module_Nuapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Nuapp");
341 couturad 926 char nom_fichier_resultat[500];
342 couturad 927 sprintf(nom_fichier_resultat,"%sModules_meca_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
343 couturad 926 ofstream ofstrm(nom_fichier_resultat,ios::out);
344     ofstrm.precision(16);
345     double Largeur_colonne_distribution_module_Young = param->get_valeur((char*)"Largeur_colonne_distribution_module_Young");
346     std::vector<double> vector_Kapp;
347     std::vector<double> vector_Gapp;
348     std::vector<double> vector_Eapp;
349     std::vector<double> vector_Nuapp;
350     double Kapp_moyenne=0;
351     double Kapp_ecart_type=0;
352     double Kapp_min=numeric_limits<double>::max();
353     double Kapp_max=numeric_limits<double>::min();
354 couturad 927 OT_HISTOGRAMME Kapp_histogramme;
355     Kapp_histogramme.fixe_largeur_colonne(Largeur_colonne_distribution_module_Kapp);
356 couturad 926 double Gapp_moyenne=0;
357     double Gapp_ecart_type=0;
358     double Gapp_min=numeric_limits<double>::max();
359     double Gapp_max=numeric_limits<double>::min();
360 couturad 927 OT_HISTOGRAMME Gapp_histogramme;
361     Gapp_histogramme.fixe_largeur_colonne(Largeur_colonne_distribution_module_Gapp);
362 couturad 926 double Eapp_moyenne=0;
363     double Eapp_ecart_type=0;
364     double Eapp_min=numeric_limits<double>::max();
365     double Eapp_max=numeric_limits<double>::min();
366 couturad 927 OT_HISTOGRAMME Eapp_histogramme;
367     Eapp_histogramme.fixe_largeur_colonne(Largeur_colonne_distribution_module_Eapp);
368 couturad 926 double Nuapp_moyenne=0;
369     double Nuapp_ecart_type=0;
370     double Nuapp_min=numeric_limits<double>::max();
371     double Nuapp_max=numeric_limits<double>::min();
372 couturad 927 OT_HISTOGRAMME Nuapp_histogramme;
373     Nuapp_histogramme.fixe_largeur_colonne(Largeur_colonne_distribution_module_Nuapp);
374 couturad 926 std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_sph=map_ves_file_spherique.begin();
375     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_dev=map_ves_file_deviatorique.begin();
376     long i=1;
377     for(;it_ves_sph!=map_ves_file_spherique.end();it_ves_sph++,it_ves_dev++)
378 couturad 919 {
379 couturad 926 MSTRUCT_VES_FILE *ves_sph=it_ves_sph->second;
380     MSTRUCT_VES_FILE *ves_dev=it_ves_dev->second;
381    
382     MSTRUCT_ANALYSE_CHAMP* epsilon_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_epsilon);
383     MSTRUCT_ANALYSE_CHAMP* sigma_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_sigma);
384     MSTRUCT_ANALYSE_CHAMP* epsilon_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_epsilon);
385     MSTRUCT_ANALYSE_CHAMP* sigma_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_sigma);
386    
387     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]));
388     double Gapp = (1./3.)*((sigma_dev->get_moyenne()[3]/(2*epsilon_dev->get_moyenne()[3]))+
389     (sigma_dev->get_moyenne()[4]/(2*epsilon_dev->get_moyenne()[4]))+
390     (sigma_dev->get_moyenne()[5]/(2*epsilon_dev->get_moyenne()[5])));
391     double Eapp = (9.0*Kapp*Gapp)/(3.0*Kapp+Gapp);
392     double Nuapp = (3.0*Kapp-2.0*Gapp)/(2.0*(3.0*Kapp+Gapp));
393 couturad 927 if(!cumuler)
394 couturad 926 {
395 couturad 927 if(i==1) ofstrm << "#(1) Eapp(2) Nuapp(3) Kapp(4) Gapp(5)" << std::endl;
396     ofstrm << i << " "
397     << Eapp << " "
398     << Nuapp << " "
399     << Kapp << " "
400     << Gapp << std::endl;
401     }
402     else
403     {
404     vector_Kapp.push_back(Kapp);
405     vector_Gapp.push_back(Gapp);
406     vector_Eapp.push_back(Eapp);
407     vector_Nuapp.push_back(Nuapp);
408     Kapp_histogramme.ajouter_valeur(Kapp,1.0/nb_ves);
409     Gapp_histogramme.ajouter_valeur(Gapp,1.0/nb_ves);
410     Eapp_histogramme.ajouter_valeur(Eapp,1.0/nb_ves);
411     Nuapp_histogramme.ajouter_valeur(Nuapp,1.0/nb_ves);
412     if(resultats_incrementaux)
413 couturad 926 {
414 couturad 927 Kapp_moyenne=0;
415     Kapp_ecart_type=0;
416     Kapp_min=numeric_limits<double>::max();
417     Kapp_max=numeric_limits<double>::min();
418     Gapp_moyenne=0;
419     Gapp_ecart_type=0;
420     Gapp_min=numeric_limits<double>::max();
421     Gapp_max=numeric_limits<double>::min();
422     Eapp_moyenne=0;
423     Eapp_ecart_type=0;
424     Eapp_min=numeric_limits<double>::max();
425     Eapp_max=numeric_limits<double>::min();
426     Nuapp_moyenne=0;
427     Nuapp_ecart_type=0;
428     Nuapp_min=numeric_limits<double>::max();
429     Nuapp_max=numeric_limits<double>::min();
430     std::vector<double>::iterator it_Kapp=vector_Kapp.begin();
431     std::vector<double>::iterator it_Gapp=vector_Gapp.begin();
432     std::vector<double>::iterator it_Eapp=vector_Eapp.begin();
433     std::vector<double>::iterator it_Nuapp=vector_Nuapp.begin();
434     for(long j=0;j<i;j++)
435     {
436     Kapp_moyenne+=*it_Kapp;
437     if(*it_Kapp<Kapp_min) Kapp_min=*it_Kapp;
438     if(*it_Kapp>Kapp_max) Kapp_max=*it_Kapp;
439     Gapp_moyenne+=*it_Gapp;
440     if(*it_Gapp<Gapp_min) Gapp_min=*it_Gapp;
441     if(*it_Gapp>Gapp_max) Gapp_max=*it_Gapp;
442     Eapp_moyenne+=*it_Eapp;
443     if(*it_Eapp<Eapp_min) Eapp_min=*it_Eapp;
444     if(*it_Eapp>Eapp_max) Eapp_max=*it_Eapp;
445     Nuapp_moyenne+=*it_Nuapp;
446     if(*it_Nuapp<Nuapp_min) Nuapp_min=*it_Nuapp;
447     if(*it_Nuapp>Nuapp_max) Nuapp_max=*it_Nuapp;
448     it_Kapp++;
449     it_Gapp++;
450     it_Eapp++;
451     it_Nuapp++;
452     }
453     Kapp_moyenne=Kapp_moyenne/i;
454     Gapp_moyenne=Gapp_moyenne/i;
455     Eapp_moyenne=Eapp_moyenne/i;
456     Nuapp_moyenne=Nuapp_moyenne/i;
457     it_Kapp=vector_Kapp.begin();
458     it_Gapp=vector_Gapp.begin();
459     it_Eapp=vector_Eapp.begin();
460     it_Nuapp=vector_Nuapp.begin();
461     if(i>1)
462     {
463     for(long j=0;j<i;j++)
464     {
465     Kapp_ecart_type+=(*it_Kapp-Kapp_moyenne)*(*it_Kapp-Kapp_moyenne);
466     Gapp_ecart_type+=(*it_Gapp-Gapp_moyenne)*(*it_Gapp-Gapp_moyenne);
467     Eapp_ecart_type+=(*it_Eapp-Eapp_moyenne)*(*it_Eapp-Eapp_moyenne);
468     Nuapp_ecart_type+=(*it_Nuapp-Nuapp_moyenne)*(*it_Nuapp-Nuapp_moyenne);
469     }
470     Kapp_ecart_type=sqrt(Kapp_ecart_type*(1.0/(i-1.0)));
471     Gapp_ecart_type=sqrt(Gapp_ecart_type*(1.0/(i-1.0)));
472     Eapp_ecart_type=sqrt(Eapp_ecart_type*(1.0/(i-1.0)));
473     Nuapp_ecart_type=sqrt(Nuapp_ecart_type*(1.0/(i-1.0)));
474     }
475     if(i==1) ofstrm << "#(1) Eapp[Moy(2) ±(3) min(4) max(5)] Nuapp[Moy(6) ±(7) min(8) max(9)] Kapp[Moy(10) ±(11) min(12) max(13)] Gapp[Moy(14) ±(15) min(16) max(17)]" << std::endl;
476     ofstrm << i << " "
477     << Eapp_moyenne << " "
478     << Eapp_ecart_type << " "
479     << Eapp_min << " "
480     << Eapp_max << " "
481     << Nuapp_moyenne << " "
482     << Nuapp_ecart_type << " "
483     << Nuapp_min << " "
484     << Nuapp_max << " "
485     << Kapp_moyenne << " "
486     << Kapp_ecart_type << " "
487     << Kapp_min << " "
488     << Kapp_max << " "
489     << Gapp_moyenne << " "
490     << Gapp_ecart_type << " "
491     << Gapp_min << " "
492     << Gapp_max << std::endl;
493 couturad 926 }
494     }
495     i++;
496 couturad 919 }
497 couturad 926 if(!resultats_incrementaux)
498     {
499     Kapp_moyenne=0;
500     Kapp_ecart_type=0;
501     Kapp_min=numeric_limits<double>::max();
502     Kapp_max=numeric_limits<double>::min();
503     Gapp_moyenne=0;
504     Gapp_ecart_type=0;
505     Gapp_min=numeric_limits<double>::max();
506     Gapp_max=numeric_limits<double>::min();
507     Eapp_moyenne=0;
508     Eapp_ecart_type=0;
509     Eapp_min=numeric_limits<double>::max();
510     Eapp_max=numeric_limits<double>::min();
511     Nuapp_moyenne=0;
512     Nuapp_ecart_type=0;
513     Nuapp_min=numeric_limits<double>::max();
514     Nuapp_max=numeric_limits<double>::min();
515     std::vector<double>::iterator it_Kapp=vector_Kapp.begin();
516     std::vector<double>::iterator it_Gapp=vector_Gapp.begin();
517     std::vector<double>::iterator it_Eapp=vector_Eapp.begin();
518     std::vector<double>::iterator it_Nuapp=vector_Nuapp.begin();
519     for(long j=0;j<i;j++)
520     {
521     Kapp_moyenne+=*it_Kapp;
522     if(*it_Kapp<Kapp_min) Kapp_min=*it_Kapp;
523     if(*it_Kapp>Kapp_max) Kapp_max=*it_Kapp;
524     Gapp_moyenne+=*it_Gapp;
525     if(*it_Gapp<Gapp_min) Gapp_min=*it_Gapp;
526     if(*it_Gapp>Gapp_max) Gapp_max=*it_Gapp;
527     Eapp_moyenne+=*it_Eapp;
528     if(*it_Eapp<Eapp_min) Eapp_min=*it_Eapp;
529     if(*it_Eapp>Eapp_max) Eapp_max=*it_Eapp;
530     Nuapp_moyenne+=*it_Nuapp;
531     if(*it_Nuapp<Nuapp_min) Nuapp_min=*it_Nuapp;
532     if(*it_Nuapp>Nuapp_max) Nuapp_max=*it_Nuapp;
533     it_Kapp++;
534     it_Gapp++;
535     it_Eapp++;
536     it_Nuapp++;
537     }
538     Kapp_moyenne=Kapp_moyenne/i;
539     Gapp_moyenne=Gapp_moyenne/i;
540     Eapp_moyenne=Eapp_moyenne/i;
541     Nuapp_moyenne=Nuapp_moyenne/i;
542     it_Kapp=vector_Kapp.begin();
543     it_Gapp=vector_Gapp.begin();
544     it_Eapp=vector_Eapp.begin();
545     it_Nuapp=vector_Nuapp.begin();
546     for(long j=0;j<i;j++)
547     {
548     Kapp_ecart_type+=(*it_Kapp-Kapp_moyenne)*(*it_Kapp-Kapp_moyenne);
549     Gapp_ecart_type+=(*it_Gapp-Gapp_moyenne)*(*it_Gapp-Gapp_moyenne);
550     Eapp_ecart_type+=(*it_Eapp-Eapp_moyenne)*(*it_Eapp-Eapp_moyenne);
551     Nuapp_ecart_type+=(*it_Nuapp-Nuapp_moyenne)*(*it_Nuapp-Nuapp_moyenne);
552     }
553     Kapp_ecart_type=sqrt(Kapp_ecart_type*(1.0/(i-1.0)));
554     Gapp_ecart_type=sqrt(Gapp_ecart_type*(1.0/(i-1.0)));
555     Eapp_ecart_type=sqrt(Eapp_ecart_type*(1.0/(i-1.0)));
556     Nuapp_ecart_type=sqrt(Nuapp_ecart_type*(1.0/(i-1.0)));
557 couturad 927 ofstrm << "#(1) Eapp[Moy(2) ±(3) min(4) max(5)] Nuapp[Moy(6) ±(7) min(8) max(9)] Kapp[Moy(10) ±(11) min(12) max(13)] Gapp[Moy(14) ±(15) min(16) max(17)]" << std::endl;
558 couturad 926 ofstrm << i << " "
559     << Eapp_moyenne << " "
560     << Eapp_ecart_type << " "
561     << Eapp_min << " "
562     << Eapp_max << " "
563     << Nuapp_moyenne << " "
564     << Nuapp_ecart_type << " "
565     << Nuapp_min << " "
566     << Nuapp_max << " "
567     << Kapp_moyenne << " "
568     << Kapp_ecart_type << " "
569     << Kapp_min << " "
570     << Kapp_max << " "
571     << Gapp_moyenne << " "
572     << Gapp_ecart_type << " "
573     << Gapp_min << " "
574     << Gapp_max << std::endl;
575 couturad 927 if(avec_histogramme)
576     {
577     char nom_fichier[500];
578     sprintf(nom_fichier,"%shisto_Kapp_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
579     ofstream of_histo_Kapp(nom_fichier,std::ios::out|std::ios::trunc);
580     of_histo_Kapp.precision(16);
581     of_histo_Kapp.setf(std::ios::showpoint);
582     Kapp_histogramme.exporter(of_histo_Kapp);
583     of_histo_Kapp.close();
584    
585     sprintf(nom_fichier,"%shisto_Gapp_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
586     ofstream of_histo_Gapp(nom_fichier,std::ios::out|std::ios::trunc);
587     of_histo_Gapp.precision(16);
588     of_histo_Gapp.setf(std::ios::showpoint);
589     Gapp_histogramme.exporter(of_histo_Gapp);
590     of_histo_Gapp.close();
591    
592     sprintf(nom_fichier,"%shisto_Eapp_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
593     ofstream of_histo_Eapp(nom_fichier,std::ios::out|std::ios::trunc);
594     of_histo_Eapp.precision(16);
595     of_histo_Eapp.setf(std::ios::showpoint);
596     Eapp_histogramme.exporter(of_histo_Eapp);
597     of_histo_Eapp.close();
598    
599     sprintf(nom_fichier,"%shisto_Nuapp_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
600     ofstream of_histo_Nuapp(nom_fichier,std::ios::out|std::ios::trunc);
601     of_histo_Nuapp.precision(16);
602     of_histo_Nuapp.setf(std::ios::showpoint);
603     Nuapp_histogramme.exporter(of_histo_Nuapp);
604     of_histo_Nuapp.close();
605     }
606 couturad 926 }
607 couturad 927 ofstrm.close();
608 couturad 919 }
609 couturad 927
610 couturad 919 }
611    
612    
613    
614    
615    
616 couturad 926
617    
618    
619    
620    
621    
622    
623    
624    
625    
626    
627    
628    
629    
630    
631    
632    
633    
634    
635    
636    
637    
638    
639