ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ver.cpp
Revision: 938
Committed: Wed Jun 6 13:04:19 2018 UTC (6 years, 11 months ago) by couturad
File size: 22915 byte(s)
Log Message:
MICROSTRUCTURE : Ajout du tenseur d'orientation pondere par le volume des particules

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 couturad 931 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
125     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
126 couturad 926 char nom_fichier_resultat[500];
127     sprintf(nom_fichier_resultat,"%s%s.txt",dossier_resultat,Identifiant.c_str());
128     ofstream ofstrm(nom_fichier_resultat,ios::out);
129     ofstrm.precision(16);
130     if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CHAMP)
131 couturad 919 {
132 couturad 931 if(!Analyse_erosion)
133 couturad 926 {
134 couturad 931 std::vector<MSTRUCT_ANALYSE_CHAMP*> vector_analyse;
135     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
136     i=1;
137     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
138 couturad 926 {
139 couturad 931 MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
140     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
141     if(analyse==NULL)
142     {
143     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
144     return FAIL;
145     }
146     vector_analyse.push_back((MSTRUCT_ANALYSE_CHAMP*)analyse);
147     if(resultats_incrementaux)
148     {
149     MSTRUCT_ANALYSE_CHAMP analyse_champ(vector_analyse);
150     analyse_champ.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
151     }
152     i++;
153 couturad 926 }
154 couturad 931 if(!resultats_incrementaux)
155 couturad 926 {
156     MSTRUCT_ANALYSE_CHAMP analyse_champ(vector_analyse);
157 couturad 931 analyse_champ.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
158     }
159     }
160     else
161     {
162     for(i=0;i<Nb_couche;i++)
163     {
164     std::vector<MSTRUCT_ANALYSE_CHAMP*> vector_analyse;
165     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
166     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
167     {
168     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
169     MSTRUCT_ANALYSE_EROSION *analyse_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_file->get_analyse(Identifiant);
170     vector_analyse.push_back((MSTRUCT_ANALYSE_CHAMP*)analyse_erosion->get_analyse(i));
171     }
172     MSTRUCT_ANALYSE_CHAMP analyse_champ(vector_analyse);
173     analyse_champ.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat);
174 couturad 926 }
175     }
176 couturad 919 }
177 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION)
178 couturad 919 {
179 couturad 931 if(!Analyse_erosion)
180 couturad 926 {
181 couturad 931 std::vector<MSTRUCT_ANALYSE_ORIENTATION*> vector_analyse;
182     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
183     i=1;
184     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
185 couturad 926 {
186 couturad 931 MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
187     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
188     if(analyse==NULL)
189     {
190     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
191     return FAIL;
192     }
193     vector_analyse.push_back((MSTRUCT_ANALYSE_ORIENTATION*)analyse);
194     if(resultats_incrementaux)
195     {
196     MSTRUCT_ANALYSE_ORIENTATION analyse_orientation(vector_analyse);
197     analyse_orientation.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
198     }
199     i++;
200 couturad 926 }
201 couturad 931 if(!resultats_incrementaux)
202 couturad 926 {
203     MSTRUCT_ANALYSE_ORIENTATION analyse_orientation(vector_analyse);
204 couturad 931 analyse_orientation.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
205 couturad 926 }
206     }
207 couturad 931 else
208 couturad 926 {
209 couturad 931 for(i=0;i<Nb_couche;i++)
210     {
211     std::vector<MSTRUCT_ANALYSE_ORIENTATION*> vector_analyse;
212     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
213     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
214     {
215     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
216     MSTRUCT_ANALYSE_EROSION *analyse_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_file->get_analyse(Identifiant);
217     vector_analyse.push_back((MSTRUCT_ANALYSE_ORIENTATION*)analyse_erosion->get_analyse(i));
218     }
219     MSTRUCT_ANALYSE_ORIENTATION analyse_orientation(vector_analyse);
220     analyse_orientation.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat);
221     }
222 couturad 926 }
223 couturad 919 }
224 couturad 938 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION_PONDEREE)
225     {
226     if(!Analyse_erosion)
227     {
228     std::vector<MSTRUCT_ANALYSE_ORIENTATION*> vector_analyse;
229     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
230     i=1;
231     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
232     {
233     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
234     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
235     if(analyse==NULL)
236     {
237     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
238     return FAIL;
239     }
240     vector_analyse.push_back((MSTRUCT_ANALYSE_ORIENTATION_PONDEREE*)analyse);
241     if(resultats_incrementaux)
242     {
243     MSTRUCT_ANALYSE_ORIENTATION_PONDEREE analyse_orientation(vector_analyse);
244     analyse_orientation.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
245     }
246     i++;
247     }
248     if(!resultats_incrementaux)
249     {
250     MSTRUCT_ANALYSE_ORIENTATION_PONDEREE analyse_orientation(vector_analyse);
251     analyse_orientation.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
252     }
253     }
254     else
255     {
256     for(i=0;i<Nb_couche;i++)
257     {
258     std::vector<MSTRUCT_ANALYSE_ORIENTATION*> vector_analyse;
259     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
260     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
261     {
262     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
263     MSTRUCT_ANALYSE_EROSION *analyse_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_file->get_analyse(Identifiant);
264     vector_analyse.push_back((MSTRUCT_ANALYSE_ORIENTATION_PONDEREE*)analyse_erosion->get_analyse(i));
265     }
266     MSTRUCT_ANALYSE_ORIENTATION_PONDEREE analyse_orientation(vector_analyse);
267     analyse_orientation.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat);
268     }
269     }
270     }
271 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CAO)
272 couturad 919 {
273 couturad 931 if(!Analyse_erosion)
274 couturad 926 {
275 couturad 931 std::vector<MSTRUCT_ANALYSE_CAO*> vector_analyse;
276     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
277     i=1;
278     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
279 couturad 926 {
280 couturad 931 MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
281     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
282     if(analyse==NULL)
283     {
284     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
285     return FAIL;
286     }
287     vector_analyse.push_back((MSTRUCT_ANALYSE_CAO*)analyse);
288     if(resultats_incrementaux)
289     {
290     MSTRUCT_ANALYSE_CAO analyse_cao(vector_analyse);
291     analyse_cao.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
292     }
293     i++;
294 couturad 926 }
295 couturad 931 if(!resultats_incrementaux)
296 couturad 926 {
297 couturad 931 MSTRUCT_ANALYSE_CAO analyse_orientation(vector_analyse);
298     analyse_orientation.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
299 couturad 926 }
300     }
301 couturad 931 else
302 couturad 926 {
303 couturad 931 for(i=0;i<Nb_couche;i++)
304     {
305     std::vector<MSTRUCT_ANALYSE_CAO*> vector_analyse;
306     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
307     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
308     {
309     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
310     MSTRUCT_ANALYSE_EROSION *analyse_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_file->get_analyse(Identifiant);
311     vector_analyse.push_back((MSTRUCT_ANALYSE_CAO*)analyse_erosion->get_analyse(i));
312     }
313     MSTRUCT_ANALYSE_CAO analyse_cao(vector_analyse);
314     analyse_cao.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat);
315     }
316 couturad 926 }
317 couturad 919 }
318 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_MG)
319 couturad 919 {
320 couturad 931 if(!Analyse_erosion)
321 couturad 926 {
322 couturad 931 std::vector<MSTRUCT_ANALYSE_MG_MAILLAGE*> vector_analyse;
323     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
324     i=1;
325     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
326 couturad 926 {
327 couturad 931 MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
328     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
329     if(analyse==NULL)
330     {
331     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
332     return FAIL;
333     }
334     vector_analyse.push_back((MSTRUCT_ANALYSE_MG_MAILLAGE*)analyse);
335     if(resultats_incrementaux)
336     {
337     MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse);
338     analyse_mg_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
339     }
340     i++;
341 couturad 926 }
342 couturad 931 if(!resultats_incrementaux)
343 couturad 926 {
344     MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse);
345 couturad 931 analyse_mg_maillage.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
346 couturad 926 }
347     }
348 couturad 931 else
349 couturad 926 {
350 couturad 931 for(i=0;i<Nb_couche;i++)
351     {
352     std::vector<MSTRUCT_ANALYSE_MG_MAILLAGE*> vector_analyse;
353     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
354     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
355     {
356     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
357     MSTRUCT_ANALYSE_EROSION *analyse_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_file->get_analyse(Identifiant);
358     vector_analyse.push_back((MSTRUCT_ANALYSE_MG_MAILLAGE*)analyse_erosion->get_analyse(i));
359     }
360     MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maill(vector_analyse);
361     analyse_mg_maill.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat);
362     }
363 couturad 926 }
364 couturad 919 }
365 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_FEM)
366 couturad 919 {
367 couturad 931 if(!Analyse_erosion)
368 couturad 926 {
369 couturad 931 std::vector<MSTRUCT_ANALYSE_FEM_MAILLAGE*> vector_analyse;
370     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
371     i=1;
372     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
373 couturad 926 {
374 couturad 931 MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
375     MSTRUCT_ANALYSE* analyse = ves_file->get_analyse(Identifiant);
376     if(analyse==NULL)
377     {
378     std::cerr << "*** MSTRUCT_VER::cumuler_analyse : Erreur ***" << std::endl;
379     return FAIL;
380     }
381     vector_analyse.push_back((MSTRUCT_ANALYSE_FEM_MAILLAGE*)analyse);
382     if(resultats_incrementaux)
383     {
384     MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maillage(vector_analyse);
385     analyse_fem_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
386     }
387     i++;
388 couturad 926 }
389 couturad 931 if(!resultats_incrementaux)
390 couturad 926 {
391     MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maillage(vector_analyse);
392 couturad 931 analyse_fem_maillage.exporter(ofstrm,1,avec_histogramme,dossier_resultat);
393 couturad 926 }
394     }
395 couturad 931 else
396 couturad 926 {
397 couturad 931 for(i=0;i<Nb_couche;i++)
398     {
399     std::vector<MSTRUCT_ANALYSE_FEM_MAILLAGE*> vector_analyse;
400     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
401     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
402     {
403     MSTRUCT_VES_FILE *ves_file=it_ves_file->second;
404     MSTRUCT_ANALYSE_EROSION *analyse_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_file->get_analyse(Identifiant);
405     vector_analyse.push_back((MSTRUCT_ANALYSE_FEM_MAILLAGE*)analyse_erosion->get_analyse(i));
406     }
407     MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maill(vector_analyse);
408     analyse_fem_maill.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat);
409     }
410 couturad 926 }
411 couturad 919 }
412     }
413 couturad 926 std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file;
414     for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++)
415 couturad 919 {
416 couturad 926 delete it_ves_file->second;
417 couturad 919 }
418     return OK;
419     }
420    
421 couturad 926 int MSTRUCT_VER::calculer_modules_mecaniques(char* fichier_liste_ves_spherique,
422     char* fichier_liste_ves_deviatorique,
423 couturad 930 std::vector< OT_PARAMETRES* >& vector_params_ver,
424 couturad 926 char* dossier_resultat,
425 couturad 927 bool cumuler,
426 couturad 926 bool resultats_incrementaux,
427     bool avec_histogramme)
428 couturad 919 {
429 couturad 926 char message[5000];
430     std::map<long,MSTRUCT_VES_FILE*> map_ves_file_spherique;
431     std::ifstream f;
432     f.open(fichier_liste_ves_spherique,ios::in);
433     char ligne[1000];
434     f.getline(ligne,1000);
435     long i=0;
436     while(!f.eof())
437 couturad 919 {
438 couturad 926 char fichier_ves[1000];
439     sscanf(ligne,"%s",fichier_ves);
440     if(strlen(fichier_ves)==0) continue;
441     std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
442     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
443     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
444     map_ves_file_spherique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
445     i++;
446     f.getline(ligne,1000);
447 couturad 919 }
448 couturad 926 f.close();
449     std::map<long,MSTRUCT_VES_FILE*> map_ves_file_deviatorique;
450     f.open(fichier_liste_ves_deviatorique,ios::in);
451     f.getline(ligne,1000);
452     i=0;
453     while(!f.eof())
454 couturad 919 {
455 couturad 926 char fichier_ves[1000];
456     sscanf(ligne,"%s",fichier_ves);
457     if(strlen(fichier_ves)==0) continue;
458     std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>;
459     MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE;
460     if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL;
461     map_ves_file_deviatorique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file));
462     i++;
463     f.getline(ligne,1000);
464 couturad 919 }
465 couturad 926 f.close();
466     if(map_ves_file_spherique.size()!=map_ves_file_deviatorique.size())
467 couturad 919 {
468 couturad 926 std::cerr << "*** MSTRUCT_VER::calculer_module_young : Liste non identique ***" << std::endl;
469 couturad 919 return FAIL;
470     }
471 couturad 926 long nb_ves = map_ves_file_spherique.size();
472     sprintf(message,"NB_VES : %li",nb_ves); affiche(message);
473     std::vector<OT_PARAMETRES*>::iterator it;
474     for(it=vector_params_ver.begin();it!=vector_params_ver.end();it++)
475 couturad 919 {
476 couturad 930 OT_PARAMETRES *param = *it;
477 couturad 926 std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
478     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
479 couturad 931 char ligne[1000];
480     sprintf(ligne,"-> %s_%s",Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
481     affiche(ligne);
482 couturad 927 double Largeur_colonne_distribution_module_Kapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Kapp");
483     double Largeur_colonne_distribution_module_Gapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Gapp");
484     double Largeur_colonne_distribution_module_Eapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Eapp");
485     double Largeur_colonne_distribution_module_Nuapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Nuapp");
486 couturad 930 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
487 couturad 926 char nom_fichier_resultat[500];
488 couturad 927 sprintf(nom_fichier_resultat,"%sModules_meca_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str());
489 couturad 926 ofstream ofstrm(nom_fichier_resultat,ios::out);
490 couturad 930 ofstrm.precision(16);
491     if(Analyse_erosion)
492 couturad 919 {
493 couturad 930 cumuler=true;
494     resultats_incrementaux=false;
495     avec_histogramme=false;
496     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_sph=map_ves_file_spherique.begin();
497     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_dev=map_ves_file_deviatorique.begin();
498     MSTRUCT_VES_FILE* file_sph=it_ves_sph->second;
499     MSTRUCT_VES_FILE* file_dev=it_ves_sph->second;
500     MSTRUCT_ANALYSE_EROSION* analyse_erosion_epsilon_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_epsilon);
501     MSTRUCT_ANALYSE_EROSION* analyse_erosion_sigma_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_sigma);
502     MSTRUCT_ANALYSE_EROSION* analyse_erosion_epsilon_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_epsilon);
503     MSTRUCT_ANALYSE_EROSION* analyse_erosion_sigma_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_sigma);
504     long nb_couche=analyse_erosion_epsilon_sph->get_nb_couche();
505     double epaisseur_couche = analyse_erosion_epsilon_sph->get_epaisseur_couche();
506     for(long j=0;j<nb_couche;j++)
507 couturad 926 {
508 couturad 933 sprintf(ligne,"\033[1A\033[K-> Couche #%li",j);
509     affiche(ligne);
510 couturad 930 it_ves_sph=map_ves_file_spherique.begin();
511     it_ves_dev=map_ves_file_deviatorique.begin();
512     std::vector<MSTRUCT_ANALYSE_MODULES_MECA*> vector_module_meca;
513     for(;it_ves_sph!=map_ves_file_spherique.end();it_ves_sph++,it_ves_dev++)
514 couturad 926 {
515 couturad 930 file_sph=it_ves_sph->second;
516     file_dev=it_ves_dev->second;
517     analyse_erosion_epsilon_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_epsilon);
518     analyse_erosion_sigma_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_sigma);
519     analyse_erosion_epsilon_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_epsilon);
520     analyse_erosion_sigma_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_sigma);
521     MSTRUCT_ANALYSE_CHAMP* epsilon_sph=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_epsilon_sph->get_analyse(j);
522     MSTRUCT_ANALYSE_CHAMP* sigma_sph=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_sigma_sph->get_analyse(j);
523     MSTRUCT_ANALYSE_CHAMP* epsilon_dev=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_epsilon_dev->get_analyse(j);
524     MSTRUCT_ANALYSE_CHAMP* sigma_dev=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_sigma_dev->get_analyse(j);
525     MSTRUCT_ANALYSE_MODULES_MECA* analyse_meca = new MSTRUCT_ANALYSE_MODULES_MECA(epsilon_sph,
526     sigma_sph,
527     epsilon_dev,
528     sigma_dev,
529     Largeur_colonne_distribution_module_Kapp,
530     Largeur_colonne_distribution_module_Gapp,
531     Largeur_colonne_distribution_module_Eapp,
532     Largeur_colonne_distribution_module_Nuapp);
533     vector_module_meca.push_back(analyse_meca);
534 couturad 926 }
535 couturad 930 MSTRUCT_ANALYSE_MODULES_MECA analyse_meca_glob(vector_module_meca);
536 couturad 931 analyse_meca_glob.exporter(ofstrm,j+1,false);
537 couturad 930 std::vector<MSTRUCT_ANALYSE_MODULES_MECA*>::iterator it_vector_meca;
538     for(it_vector_meca=vector_module_meca.begin();it_vector_meca!=vector_module_meca.end();it_vector_meca++) delete *it_vector_meca;
539 couturad 933 }
540     sprintf(ligne,"\033[1A\033[K");
541     affiche(ligne);
542     // ofstrm.close();
543 couturad 919 }
544 couturad 930 else
545 couturad 926 {
546 couturad 930 std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_sph=map_ves_file_spherique.begin();
547     std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_dev=map_ves_file_deviatorique.begin();
548     MSTRUCT_VES_FILE* file_sph;
549     MSTRUCT_VES_FILE* file_dev;
550     std::vector<MSTRUCT_ANALYSE_MODULES_MECA*> vector_module_meca;
551 couturad 933 i=1;
552 couturad 930 for(;it_ves_sph!=map_ves_file_spherique.end();it_ves_sph++,it_ves_dev++)
553     {
554     file_sph=it_ves_sph->second;
555     file_dev=it_ves_dev->second;
556     MSTRUCT_ANALYSE_CHAMP* epsilon_sph=(MSTRUCT_ANALYSE_CHAMP*)file_sph->get_analyse(Identifiant_epsilon);
557     MSTRUCT_ANALYSE_CHAMP* sigma_sph=(MSTRUCT_ANALYSE_CHAMP*)file_sph->get_analyse(Identifiant_sigma);
558     MSTRUCT_ANALYSE_CHAMP* epsilon_dev=(MSTRUCT_ANALYSE_CHAMP*)file_dev->get_analyse(Identifiant_epsilon);
559     MSTRUCT_ANALYSE_CHAMP* sigma_dev=(MSTRUCT_ANALYSE_CHAMP*)file_dev->get_analyse(Identifiant_sigma);
560     MSTRUCT_ANALYSE_MODULES_MECA* analyse_meca = new MSTRUCT_ANALYSE_MODULES_MECA(epsilon_sph,
561     sigma_sph,
562     epsilon_dev,
563     sigma_dev,
564     Largeur_colonne_distribution_module_Kapp,
565     Largeur_colonne_distribution_module_Gapp,
566     Largeur_colonne_distribution_module_Eapp,
567     Largeur_colonne_distribution_module_Nuapp);
568    
569     if(!cumuler)
570 couturad 926 {
571 couturad 930 analyse_meca->exporter(ofstrm,i,false);
572     delete analyse_meca;
573 couturad 926 }
574 couturad 930 else
575 couturad 926 {
576 couturad 930 vector_module_meca.push_back(analyse_meca);
577     if(resultats_incrementaux)
578     {
579     MSTRUCT_ANALYSE_MODULES_MECA analyse_meca_glob(vector_module_meca);
580     analyse_meca_glob.exporter(ofstrm,i,false);
581     }
582 couturad 926 }
583 couturad 931 i++;
584 couturad 930 }
585     if(cumuler)
586     {
587     MSTRUCT_ANALYSE_MODULES_MECA analyse_meca_glob(vector_module_meca);
588     analyse_meca_glob.exporter(ofstrm,i,avec_histogramme,dossier_resultat);
589     std::vector<MSTRUCT_ANALYSE_MODULES_MECA*>::iterator it_vector_meca;
590     for(it_vector_meca=vector_module_meca.begin();it_vector_meca!=vector_module_meca.end();it_vector_meca++) delete *it_vector_meca;
591     }
592 couturad 933 }
593     ofstrm.close();
594 couturad 930 }
595 couturad 919 }
596    
597    
598    
599    
600    
601 couturad 926
602    
603    
604    
605    
606    
607    
608    
609    
610    
611    
612    
613    
614