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