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 |
926 |
else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CAO) |
225 |
couturad |
919 |
{ |
226 |
couturad |
931 |
if(!Analyse_erosion) |
227 |
couturad |
926 |
{ |
228 |
couturad |
931 |
std::vector<MSTRUCT_ANALYSE_CAO*> 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 |
couturad |
926 |
{ |
233 |
couturad |
931 |
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_CAO*)analyse); |
241 |
|
|
if(resultats_incrementaux) |
242 |
|
|
{ |
243 |
|
|
MSTRUCT_ANALYSE_CAO analyse_cao(vector_analyse); |
244 |
|
|
analyse_cao.exporter(ofstrm,i,avec_histogramme,dossier_resultat); |
245 |
|
|
} |
246 |
|
|
i++; |
247 |
couturad |
926 |
} |
248 |
couturad |
931 |
if(!resultats_incrementaux) |
249 |
couturad |
926 |
{ |
250 |
couturad |
931 |
MSTRUCT_ANALYSE_CAO analyse_orientation(vector_analyse); |
251 |
|
|
analyse_orientation.exporter(ofstrm,1,avec_histogramme,dossier_resultat); |
252 |
couturad |
926 |
} |
253 |
|
|
} |
254 |
couturad |
931 |
else |
255 |
couturad |
926 |
{ |
256 |
couturad |
931 |
for(i=0;i<Nb_couche;i++) |
257 |
|
|
{ |
258 |
|
|
std::vector<MSTRUCT_ANALYSE_CAO*> 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_CAO*)analyse_erosion->get_analyse(i)); |
265 |
|
|
} |
266 |
|
|
MSTRUCT_ANALYSE_CAO analyse_cao(vector_analyse); |
267 |
|
|
analyse_cao.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat); |
268 |
|
|
} |
269 |
couturad |
926 |
} |
270 |
couturad |
919 |
} |
271 |
couturad |
926 |
else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_MG) |
272 |
couturad |
919 |
{ |
273 |
couturad |
931 |
if(!Analyse_erosion) |
274 |
couturad |
926 |
{ |
275 |
couturad |
931 |
std::vector<MSTRUCT_ANALYSE_MG_MAILLAGE*> 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_MG_MAILLAGE*)analyse); |
288 |
|
|
if(resultats_incrementaux) |
289 |
|
|
{ |
290 |
|
|
MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse); |
291 |
|
|
analyse_mg_maillage.exporter(ofstrm,i,avec_histogramme,dossier_resultat); |
292 |
|
|
} |
293 |
|
|
i++; |
294 |
couturad |
926 |
} |
295 |
couturad |
931 |
if(!resultats_incrementaux) |
296 |
couturad |
926 |
{ |
297 |
|
|
MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maillage(vector_analyse); |
298 |
couturad |
931 |
analyse_mg_maillage.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_MG_MAILLAGE*> 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_MG_MAILLAGE*)analyse_erosion->get_analyse(i)); |
312 |
|
|
} |
313 |
|
|
MSTRUCT_ANALYSE_MG_MAILLAGE analyse_mg_maill(vector_analyse); |
314 |
|
|
analyse_mg_maill.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_FEM) |
319 |
couturad |
919 |
{ |
320 |
couturad |
931 |
if(!Analyse_erosion) |
321 |
couturad |
926 |
{ |
322 |
couturad |
931 |
std::vector<MSTRUCT_ANALYSE_FEM_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_FEM_MAILLAGE*)analyse); |
335 |
|
|
if(resultats_incrementaux) |
336 |
|
|
{ |
337 |
|
|
MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maillage(vector_analyse); |
338 |
|
|
analyse_fem_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_FEM_MAILLAGE analyse_fem_maillage(vector_analyse); |
345 |
couturad |
931 |
analyse_fem_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_FEM_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_FEM_MAILLAGE*)analyse_erosion->get_analyse(i)); |
359 |
|
|
} |
360 |
|
|
MSTRUCT_ANALYSE_FEM_MAILLAGE analyse_fem_maill(vector_analyse); |
361 |
|
|
analyse_fem_maill.exporter(ofstrm,i+1,avec_histogramme,dossier_resultat); |
362 |
|
|
} |
363 |
couturad |
926 |
} |
364 |
couturad |
919 |
} |
365 |
|
|
} |
366 |
couturad |
926 |
std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_file; |
367 |
|
|
for(it_ves_file=map_ves_file.begin();it_ves_file!=map_ves_file.end();it_ves_file++) |
368 |
couturad |
919 |
{ |
369 |
couturad |
926 |
delete it_ves_file->second; |
370 |
couturad |
919 |
} |
371 |
|
|
return OK; |
372 |
|
|
} |
373 |
|
|
|
374 |
couturad |
926 |
int MSTRUCT_VER::calculer_modules_mecaniques(char* fichier_liste_ves_spherique, |
375 |
|
|
char* fichier_liste_ves_deviatorique, |
376 |
couturad |
930 |
std::vector< OT_PARAMETRES* >& vector_params_ver, |
377 |
couturad |
926 |
char* dossier_resultat, |
378 |
couturad |
927 |
bool cumuler, |
379 |
couturad |
926 |
bool resultats_incrementaux, |
380 |
|
|
bool avec_histogramme) |
381 |
couturad |
919 |
{ |
382 |
couturad |
926 |
char message[5000]; |
383 |
|
|
std::map<long,MSTRUCT_VES_FILE*> map_ves_file_spherique; |
384 |
|
|
std::ifstream f; |
385 |
|
|
f.open(fichier_liste_ves_spherique,ios::in); |
386 |
|
|
char ligne[1000]; |
387 |
|
|
f.getline(ligne,1000); |
388 |
|
|
long i=0; |
389 |
|
|
while(!f.eof()) |
390 |
couturad |
919 |
{ |
391 |
couturad |
926 |
char fichier_ves[1000]; |
392 |
|
|
sscanf(ligne,"%s",fichier_ves); |
393 |
|
|
if(strlen(fichier_ves)==0) continue; |
394 |
|
|
std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>; |
395 |
|
|
MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE; |
396 |
|
|
if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL; |
397 |
|
|
map_ves_file_spherique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file)); |
398 |
|
|
i++; |
399 |
|
|
f.getline(ligne,1000); |
400 |
couturad |
919 |
} |
401 |
couturad |
926 |
f.close(); |
402 |
|
|
std::map<long,MSTRUCT_VES_FILE*> map_ves_file_deviatorique; |
403 |
|
|
f.open(fichier_liste_ves_deviatorique,ios::in); |
404 |
|
|
f.getline(ligne,1000); |
405 |
|
|
i=0; |
406 |
|
|
while(!f.eof()) |
407 |
couturad |
919 |
{ |
408 |
couturad |
926 |
char fichier_ves[1000]; |
409 |
|
|
sscanf(ligne,"%s",fichier_ves); |
410 |
|
|
if(strlen(fichier_ves)==0) continue; |
411 |
|
|
std::map<std::string,MSTRUCT_ANALYSE*>* map_analyse = new std::map<std::string,MSTRUCT_ANALYSE*>; |
412 |
|
|
MSTRUCT_VES_FILE *ves_file=new MSTRUCT_VES_FILE; |
413 |
|
|
if(ves_file->ouvrir(fichier_ves)==FAIL) return FAIL; |
414 |
|
|
map_ves_file_deviatorique.insert(std::pair<long,MSTRUCT_VES_FILE*>(i,ves_file)); |
415 |
|
|
i++; |
416 |
|
|
f.getline(ligne,1000); |
417 |
couturad |
919 |
} |
418 |
couturad |
926 |
f.close(); |
419 |
|
|
if(map_ves_file_spherique.size()!=map_ves_file_deviatorique.size()) |
420 |
couturad |
919 |
{ |
421 |
couturad |
926 |
std::cerr << "*** MSTRUCT_VER::calculer_module_young : Liste non identique ***" << std::endl; |
422 |
couturad |
919 |
return FAIL; |
423 |
|
|
} |
424 |
couturad |
926 |
long nb_ves = map_ves_file_spherique.size(); |
425 |
|
|
sprintf(message,"NB_VES : %li",nb_ves); affiche(message); |
426 |
|
|
std::vector<OT_PARAMETRES*>::iterator it; |
427 |
|
|
for(it=vector_params_ver.begin();it!=vector_params_ver.end();it++) |
428 |
couturad |
919 |
{ |
429 |
couturad |
930 |
OT_PARAMETRES *param = *it; |
430 |
couturad |
926 |
std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon"); |
431 |
|
|
std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma"); |
432 |
couturad |
931 |
char ligne[1000]; |
433 |
|
|
sprintf(ligne,"-> %s_%s",Identifiant_epsilon.c_str(),Identifiant_sigma.c_str()); |
434 |
|
|
affiche(ligne); |
435 |
couturad |
927 |
double Largeur_colonne_distribution_module_Kapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Kapp"); |
436 |
|
|
double Largeur_colonne_distribution_module_Gapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Gapp"); |
437 |
|
|
double Largeur_colonne_distribution_module_Eapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Eapp"); |
438 |
|
|
double Largeur_colonne_distribution_module_Nuapp = param->get_valeur((char*)"Largeur_colonne_distribution_module_Nuapp"); |
439 |
couturad |
930 |
int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion"); |
440 |
couturad |
926 |
char nom_fichier_resultat[500]; |
441 |
couturad |
927 |
sprintf(nom_fichier_resultat,"%sModules_meca_%s_%s.txt",dossier_resultat,Identifiant_epsilon.c_str(),Identifiant_sigma.c_str()); |
442 |
couturad |
926 |
ofstream ofstrm(nom_fichier_resultat,ios::out); |
443 |
couturad |
930 |
ofstrm.precision(16); |
444 |
|
|
if(Analyse_erosion) |
445 |
couturad |
919 |
{ |
446 |
couturad |
930 |
cumuler=true; |
447 |
|
|
resultats_incrementaux=false; |
448 |
|
|
avec_histogramme=false; |
449 |
|
|
std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_sph=map_ves_file_spherique.begin(); |
450 |
|
|
std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_dev=map_ves_file_deviatorique.begin(); |
451 |
|
|
MSTRUCT_VES_FILE* file_sph=it_ves_sph->second; |
452 |
|
|
MSTRUCT_VES_FILE* file_dev=it_ves_sph->second; |
453 |
|
|
MSTRUCT_ANALYSE_EROSION* analyse_erosion_epsilon_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_epsilon); |
454 |
|
|
MSTRUCT_ANALYSE_EROSION* analyse_erosion_sigma_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_sigma); |
455 |
|
|
MSTRUCT_ANALYSE_EROSION* analyse_erosion_epsilon_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_epsilon); |
456 |
|
|
MSTRUCT_ANALYSE_EROSION* analyse_erosion_sigma_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_sigma); |
457 |
|
|
long nb_couche=analyse_erosion_epsilon_sph->get_nb_couche(); |
458 |
|
|
double epaisseur_couche = analyse_erosion_epsilon_sph->get_epaisseur_couche(); |
459 |
|
|
for(long j=0;j<nb_couche;j++) |
460 |
couturad |
926 |
{ |
461 |
couturad |
933 |
sprintf(ligne,"\033[1A\033[K-> Couche #%li",j); |
462 |
|
|
affiche(ligne); |
463 |
couturad |
930 |
it_ves_sph=map_ves_file_spherique.begin(); |
464 |
|
|
it_ves_dev=map_ves_file_deviatorique.begin(); |
465 |
|
|
std::vector<MSTRUCT_ANALYSE_MODULES_MECA*> vector_module_meca; |
466 |
|
|
for(;it_ves_sph!=map_ves_file_spherique.end();it_ves_sph++,it_ves_dev++) |
467 |
couturad |
926 |
{ |
468 |
couturad |
930 |
file_sph=it_ves_sph->second; |
469 |
|
|
file_dev=it_ves_dev->second; |
470 |
|
|
analyse_erosion_epsilon_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_epsilon); |
471 |
|
|
analyse_erosion_sigma_sph = (MSTRUCT_ANALYSE_EROSION*)file_sph->get_analyse(Identifiant_sigma); |
472 |
|
|
analyse_erosion_epsilon_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_epsilon); |
473 |
|
|
analyse_erosion_sigma_dev = (MSTRUCT_ANALYSE_EROSION*)file_dev->get_analyse(Identifiant_sigma); |
474 |
|
|
MSTRUCT_ANALYSE_CHAMP* epsilon_sph=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_epsilon_sph->get_analyse(j); |
475 |
|
|
MSTRUCT_ANALYSE_CHAMP* sigma_sph=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_sigma_sph->get_analyse(j); |
476 |
|
|
MSTRUCT_ANALYSE_CHAMP* epsilon_dev=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_epsilon_dev->get_analyse(j); |
477 |
|
|
MSTRUCT_ANALYSE_CHAMP* sigma_dev=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_sigma_dev->get_analyse(j); |
478 |
|
|
MSTRUCT_ANALYSE_MODULES_MECA* analyse_meca = new MSTRUCT_ANALYSE_MODULES_MECA(epsilon_sph, |
479 |
|
|
sigma_sph, |
480 |
|
|
epsilon_dev, |
481 |
|
|
sigma_dev, |
482 |
|
|
Largeur_colonne_distribution_module_Kapp, |
483 |
|
|
Largeur_colonne_distribution_module_Gapp, |
484 |
|
|
Largeur_colonne_distribution_module_Eapp, |
485 |
|
|
Largeur_colonne_distribution_module_Nuapp); |
486 |
|
|
vector_module_meca.push_back(analyse_meca); |
487 |
couturad |
926 |
} |
488 |
couturad |
930 |
MSTRUCT_ANALYSE_MODULES_MECA analyse_meca_glob(vector_module_meca); |
489 |
couturad |
931 |
analyse_meca_glob.exporter(ofstrm,j+1,false); |
490 |
couturad |
930 |
std::vector<MSTRUCT_ANALYSE_MODULES_MECA*>::iterator it_vector_meca; |
491 |
|
|
for(it_vector_meca=vector_module_meca.begin();it_vector_meca!=vector_module_meca.end();it_vector_meca++) delete *it_vector_meca; |
492 |
couturad |
933 |
} |
493 |
|
|
sprintf(ligne,"\033[1A\033[K"); |
494 |
|
|
affiche(ligne); |
495 |
|
|
// ofstrm.close(); |
496 |
couturad |
919 |
} |
497 |
couturad |
930 |
else |
498 |
couturad |
926 |
{ |
499 |
couturad |
930 |
std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_sph=map_ves_file_spherique.begin(); |
500 |
|
|
std::map<long,MSTRUCT_VES_FILE*>::iterator it_ves_dev=map_ves_file_deviatorique.begin(); |
501 |
|
|
MSTRUCT_VES_FILE* file_sph; |
502 |
|
|
MSTRUCT_VES_FILE* file_dev; |
503 |
|
|
std::vector<MSTRUCT_ANALYSE_MODULES_MECA*> vector_module_meca; |
504 |
couturad |
933 |
i=1; |
505 |
couturad |
930 |
for(;it_ves_sph!=map_ves_file_spherique.end();it_ves_sph++,it_ves_dev++) |
506 |
|
|
{ |
507 |
|
|
file_sph=it_ves_sph->second; |
508 |
|
|
file_dev=it_ves_dev->second; |
509 |
|
|
MSTRUCT_ANALYSE_CHAMP* epsilon_sph=(MSTRUCT_ANALYSE_CHAMP*)file_sph->get_analyse(Identifiant_epsilon); |
510 |
|
|
MSTRUCT_ANALYSE_CHAMP* sigma_sph=(MSTRUCT_ANALYSE_CHAMP*)file_sph->get_analyse(Identifiant_sigma); |
511 |
|
|
MSTRUCT_ANALYSE_CHAMP* epsilon_dev=(MSTRUCT_ANALYSE_CHAMP*)file_dev->get_analyse(Identifiant_epsilon); |
512 |
|
|
MSTRUCT_ANALYSE_CHAMP* sigma_dev=(MSTRUCT_ANALYSE_CHAMP*)file_dev->get_analyse(Identifiant_sigma); |
513 |
|
|
MSTRUCT_ANALYSE_MODULES_MECA* analyse_meca = new MSTRUCT_ANALYSE_MODULES_MECA(epsilon_sph, |
514 |
|
|
sigma_sph, |
515 |
|
|
epsilon_dev, |
516 |
|
|
sigma_dev, |
517 |
|
|
Largeur_colonne_distribution_module_Kapp, |
518 |
|
|
Largeur_colonne_distribution_module_Gapp, |
519 |
|
|
Largeur_colonne_distribution_module_Eapp, |
520 |
|
|
Largeur_colonne_distribution_module_Nuapp); |
521 |
|
|
|
522 |
|
|
if(!cumuler) |
523 |
couturad |
926 |
{ |
524 |
couturad |
930 |
analyse_meca->exporter(ofstrm,i,false); |
525 |
|
|
delete analyse_meca; |
526 |
couturad |
926 |
} |
527 |
couturad |
930 |
else |
528 |
couturad |
926 |
{ |
529 |
couturad |
930 |
vector_module_meca.push_back(analyse_meca); |
530 |
|
|
if(resultats_incrementaux) |
531 |
|
|
{ |
532 |
|
|
MSTRUCT_ANALYSE_MODULES_MECA analyse_meca_glob(vector_module_meca); |
533 |
|
|
analyse_meca_glob.exporter(ofstrm,i,false); |
534 |
|
|
} |
535 |
couturad |
926 |
} |
536 |
couturad |
931 |
i++; |
537 |
couturad |
930 |
} |
538 |
|
|
if(cumuler) |
539 |
|
|
{ |
540 |
|
|
MSTRUCT_ANALYSE_MODULES_MECA analyse_meca_glob(vector_module_meca); |
541 |
|
|
analyse_meca_glob.exporter(ofstrm,i,avec_histogramme,dossier_resultat); |
542 |
|
|
std::vector<MSTRUCT_ANALYSE_MODULES_MECA*>::iterator it_vector_meca; |
543 |
|
|
for(it_vector_meca=vector_module_meca.begin();it_vector_meca!=vector_module_meca.end();it_vector_meca++) delete *it_vector_meca; |
544 |
|
|
} |
545 |
couturad |
933 |
} |
546 |
|
|
ofstrm.close(); |
547 |
couturad |
930 |
} |
548 |
couturad |
919 |
} |
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
|
|
|
553 |
|
|
|
554 |
couturad |
926 |
|
555 |
|
|
|
556 |
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
|
|
|
560 |
|
|
|
561 |
|
|
|
562 |
|
|
|
563 |
|
|
|
564 |
|
|
|
565 |
|
|
|
566 |
|
|
|
567 |
|
|
|