ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 993
Committed: Sun Nov 11 17:17:59 2018 UTC (6 years, 6 months ago) by couturad
File size: 92863 byte(s)
Log Message:
MICROSTRUCTURE : 
-> Ajout d'une procedure de suivit des erreurs
-> Mise a jour des CLs
-> (Polycristaux) Correction d'un bug du calcul du tenseur d'orientation

File Contents

# User Rev Content
1 couturad 919 #include "mstruct_ves.h"
2     #include "mg_volume.h"
3     #include "mg_geometrie.h"
4     #include "mg_maillage.h"
5     #include "fem_maillage.h"
6     #include "mg_gestionnaire.h"
7     #include "mstruct_groupe_volume.h"
8     #include "mstruct_parametres.h"
9     #include "mstruct_generateur_rsa.h"
10 couturad 951 #include "mstruct_generateur_dcr.h"
11 couturad 968 #include "mstruct_definition.h"
12     #include "mstruct_analyse_champ.h"
13     #include "mstruct_analyse_orientation.h"
14     #include "mstruct_analyse_cao.h"
15 couturad 971 #include "mstruct_analyse_propriete_massique.h"
16 couturad 968 #include "mstruct_analyse_mg_maillage.h"
17     #include "mstruct_analyse_fem_maillage.h"
18     #include "mstruct_analyse_erosion.h"
19     #include "mstruct_analyse_modules_elasticite.h"
20 couturad 971 #include "mstruct_analyse_conductivite_thermique.h"
21 couturad 919 #include "mg_cg_modele.h"
22     #include "mg_cg_assemblage.h"
23     #include "mg_sous_geometrie.h"
24     #include "mg_cg_forme_multi_volume.h"
25 couturad 937 #include "mg_cg_info.h"
26 couturad 919 #include "mg_file.h"
27     #include "fct_taille_fem_solution_generateur_microstructure.h"
28 couturad 951 #include "mailleur3d_couche.h"
29 couturad 919 #include "mailleur0d.h"
30     #include "mailleur1d.h"
31     #include "mailleur2d.h"
32     #include "mailleur3d.h"
33     #include "mailleur_fem.h"
34     #include "mailleur_analyse.h"
35     #include <fstream>
36     #include "mgaster.h"
37     #include "ot_cpu.h"
38     #include "mstruct_outils.h"
39 couturad 926 #include "mg_cg_groupe_forme.h"
40     #include "mstruct_ves_file.h"
41 couturad 933 #include "fem_tetra4.h"
42     #include "fem_tetra10.h"
43     #include "fem_penta6.h"
44     #include "fem_penta15.h"
45 couturad 951 #include "parse.h"
46     #include "pars_argument.h"
47 couturad 926 MSTRUCT_VES::MSTRUCT_VES(void)
48 couturad 919 {
49     m_mg_gestionnaire=new MG_GESTIONNAIRE;
50     m_mg_geometrie=NULL;
51     m_mgcg_modele=NULL;
52 couturad 926 m_mgcg_assemblage=NULL;
53 couturad 919 m_mg_maillage=NULL;
54     m_fem_maillage=NULL;
55 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
56     change_boite_3D_ves(BOITE_3D(0.0,0.0,0.0,1.0,1.0,1.0));
57     change_precision(1.0e-06);
58     change_temps_geometrie(0.0);
59     change_temps_carte(0.0);
60     change_temps_maillage(0.0);
61     change_temps_fem_maillage(0.0);
62     change_temps_etude(0.0);
63     change_temps_calcul(0.0);
64     change_temps_analyse(0.0);
65 couturad 919 }
66    
67 couturad 926 MSTRUCT_VES::MSTRUCT_VES(char* fichier_ves)
68 couturad 919 {
69 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
70     m_ves_file->ouvrir(fichier_ves);
71     m_mg_gestionnaire = new MG_FILE(m_ves_file->get_nom_fichier_magic());
72     if(m_ves_file->get_id_mgcg_modele()>0) m_mgcg_modele = m_mg_gestionnaire->get_mgcg_modeleid(m_ves_file->get_id_mgcg_modele());
73     else m_mgcg_modele=NULL;
74     if(m_ves_file->get_id_mgcg_assemblage()>0) m_mgcg_assemblage = m_mgcg_modele->get_mgcg_assemblageid(m_ves_file->get_id_mgcg_assemblage());
75     else m_mgcg_assemblage=NULL;
76     if(m_ves_file->get_id_mg_geometrie()>0) m_mg_geometrie = m_mg_gestionnaire->get_mg_geometrieid(m_ves_file->get_id_mg_geometrie());
77     else m_mg_geometrie = NULL;
78     if(m_ves_file->get_id_mg_maillage()>0) m_mg_maillage = m_mg_gestionnaire->get_mg_maillageid(m_ves_file->get_id_mg_maillage());
79     else m_mg_maillage = NULL;
80     if(m_ves_file->get_id_fem_maillage()>0) m_fem_maillage = m_mg_gestionnaire->get_fem_maillageid(m_ves_file->get_id_fem_maillage());
81     else m_fem_maillage = NULL;
82 couturad 919 }
83    
84 couturad 926 MSTRUCT_VES::~MSTRUCT_VES(void)
85 couturad 919 {
86     delete m_mg_gestionnaire;
87 couturad 926 delete m_ves_file;
88 couturad 919 }
89    
90 couturad 926 MG_GESTIONNAIRE* MSTRUCT_VES::get_mg_gestionnaire(void)
91 couturad 919 {
92     return m_mg_gestionnaire;
93     }
94    
95 couturad 926 void MSTRUCT_VES::change_mg_gestionnaire(MG_GESTIONNAIRE* gest)
96 couturad 919 {
97 couturad 926 m_mg_gestionnaire=gest;
98     }
99    
100     void MSTRUCT_VES::change_mg_geometrie(MG_GEOMETRIE* mg_geometrie)
101     {
102 couturad 919 m_mg_geometrie=mg_geometrie;
103 couturad 926 m_ves_file->change_id_mg_geometrie(m_mg_geometrie->get_id());
104 couturad 919 }
105    
106 couturad 926 MG_GEOMETRIE* MSTRUCT_VES::get_mg_geometrie(void)
107 couturad 919 {
108     return m_mg_geometrie;
109     }
110    
111 couturad 926 void MSTRUCT_VES::change_mgcg_assemblage(MG_CG_ASSEMBLAGE* mgcg_assemblage)
112 couturad 919 {
113     m_mgcg_assemblage=mgcg_assemblage;
114 couturad 926 m_ves_file->change_id_mgcg_assemblage(m_mgcg_assemblage->get_id());
115 couturad 919 }
116    
117 couturad 926 MG_CG_ASSEMBLAGE* MSTRUCT_VES::get_mgcg_assemblage(void)
118 couturad 919 {
119     return m_mgcg_assemblage;
120     }
121    
122 couturad 926 void MSTRUCT_VES::change_mgcg_modele(MG_CG_MODELE* mgcg_modele)
123 couturad 919 {
124     m_mgcg_modele=mgcg_modele;
125 couturad 926 m_ves_file->change_id_mgcg_modele(m_mgcg_modele->get_id());
126 couturad 919 }
127    
128 couturad 926 MG_CG_MODELE* MSTRUCT_VES::get_mgcg_modele(void)
129 couturad 919 {
130     return m_mgcg_modele;
131     }
132    
133 couturad 926 MG_MAILLAGE* MSTRUCT_VES::get_mg_maillage(void)
134 couturad 919 {
135     return m_mg_maillage;
136     }
137    
138 couturad 926 void MSTRUCT_VES::change_mg_maillage(MG_MAILLAGE* mg_maillage)
139 couturad 919 {
140     m_mg_maillage=mg_maillage;
141 couturad 926 m_ves_file->change_id_mg_maillage(m_mg_maillage->get_id());
142 couturad 919 }
143    
144 couturad 926 FEM_MAILLAGE* MSTRUCT_VES::get_fem_maillage(void)
145 couturad 919 {
146     return m_fem_maillage;
147     }
148    
149 couturad 926 void MSTRUCT_VES::change_fem_maillage(FEM_MAILLAGE* fem_maillage)
150 couturad 919 {
151     m_fem_maillage=fem_maillage;
152 couturad 926 m_ves_file->change_id_fem_maillage(m_fem_maillage->get_id());
153 couturad 919 }
154    
155 couturad 926 BOITE_3D MSTRUCT_VES::get_boite3d_ves(void)
156 couturad 919 {
157 couturad 926 return m_ves_file->get_boite_3D_ves();
158 couturad 919 }
159    
160 couturad 926 void MSTRUCT_VES::change_boite_3D_ves(BOITE_3D boite3D)
161 couturad 919 {
162 couturad 926 m_ves_file->change_boite_3D_ves(boite3D);
163 couturad 919 }
164    
165 couturad 926 double MSTRUCT_VES::get_precision(void)
166 couturad 919 {
167 couturad 926 return m_ves_file->get_precision();
168 couturad 919 }
169    
170 couturad 926 void MSTRUCT_VES::change_precision(double precision)
171 couturad 919 {
172 couturad 926 m_ves_file->change_precision(precision);
173 couturad 919 }
174    
175 couturad 926 double MSTRUCT_VES::get_temps_geometrie(void)
176 couturad 919 {
177 couturad 926 return m_ves_file->get_temps_geometrie();
178 couturad 919 }
179    
180 couturad 926 void MSTRUCT_VES::change_temps_geometrie(double temps)
181 couturad 919 {
182 couturad 926 m_ves_file->change_temps_geometrie(temps);
183 couturad 919 }
184    
185 couturad 926 double MSTRUCT_VES::get_temps_materiau(void)
186     {
187     return m_ves_file->get_temps_materiau();
188     }
189 couturad 919
190 couturad 926 void MSTRUCT_VES::change_temps_materiau(double temps)
191 couturad 919 {
192 couturad 926 m_ves_file->change_temps_materiau(temps);
193     }
194    
195     double MSTRUCT_VES::get_temps_carte(void)
196     {
197     return m_ves_file->get_temps_carte();
198     }
199    
200     void MSTRUCT_VES::change_temps_carte(double temps)
201     {
202     m_ves_file->change_temps_carte(temps);
203     }
204    
205     double MSTRUCT_VES::get_temps_maillage(void)
206     {
207     return m_ves_file->get_temps_maillage();
208     }
209    
210     void MSTRUCT_VES::change_temps_maillage(double temps)
211     {
212     m_ves_file->change_temps_maillage(temps);
213     }
214    
215     double MSTRUCT_VES::get_temps_fem_maillage(void)
216     {
217     return m_ves_file->get_temps_fem_maillage();
218     }
219    
220     void MSTRUCT_VES::change_temps_fem_maillage(double temps)
221     {
222     m_ves_file->change_temps_fem_maillage(temps);
223     }
224    
225     double MSTRUCT_VES::get_temps_etude(void)
226     {
227     return m_ves_file->get_temps_etude();
228     }
229    
230     void MSTRUCT_VES::change_temps_etude(double temps)
231     {
232     m_ves_file->change_temps_etude(temps);
233     }
234    
235     double MSTRUCT_VES::get_temps_calcul(void)
236     {
237     return m_ves_file->get_temps_calcul();
238     }
239    
240     void MSTRUCT_VES::change_temps_calcul(double temps)
241     {
242     m_ves_file->change_temps_calcul(temps);
243     }
244    
245     double MSTRUCT_VES::get_temps_analyse(void)
246     {
247     return m_ves_file->get_temps_analyse();
248     }
249    
250     void MSTRUCT_VES::change_temps_analyse(double temps)
251     {
252     m_ves_file->change_temps_analyse(temps);
253     }
254    
255     long int MSTRUCT_VES::get_nb_analyse(void)
256     {
257     return m_ves_file->get_nb_analyse();
258     }
259    
260     int MSTRUCT_VES::ajouter_analyse(MSTRUCT_ANALYSE* analyse_ves)
261     {
262     return m_ves_file->ajouter_analyse(analyse_ves);
263     }
264    
265     MSTRUCT_ANALYSE* MSTRUCT_VES::get_premiere_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
266     {
267     return m_ves_file->get_premiere_analyse(it);
268     }
269    
270     MSTRUCT_ANALYSE* MSTRUCT_VES::get_suivante_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
271     {
272     return m_ves_file->get_suivante_analyse(it);
273     }
274    
275 couturad 951 MSTRUCT_ANALYSE* MSTRUCT_VES::get_analyse(std::string identifiant)
276 couturad 926 {
277     return m_ves_file->get_analyse(identifiant);
278     }
279    
280 couturad 951 int MSTRUCT_VES::supprimer_analyse(std::string identifiant)
281 couturad 926 {
282     return m_ves_file->supprimer_analyse(identifiant);
283     }
284    
285     int MSTRUCT_VES::supprimer_tout_analyse(void)
286     {
287     return m_ves_file->supprimer_tout_analyse();
288     }
289    
290     int MSTRUCT_VES::generer_geometrie(std::vector< OT_PARAMETRES* >& vector_params_geometrie)
291     {
292 couturad 919 OT_CPU ot_cpu;
293     ot_cpu.initialise();
294 couturad 951 MSTRUCT_GENERATEUR* generateur=NULL;
295 couturad 919 std::vector<OT_PARAMETRES*>::iterator it;
296     for(it=vector_params_geometrie.begin();it!=vector_params_geometrie.end();it++)
297     {
298     OT_PARAMETRES* param = *it;
299 couturad 968 if(((int)param->get_valeur((char*)"Type_generateur"))==MSTRUCT::TYPE_GENERATEUR::RSA)
300 couturad 919 {
301     std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
302 couturad 951 MSTRUCT_GENERATEUR_RSA *RSA;
303     if(generateur==NULL)
304     {
305     RSA = new MSTRUCT_GENERATEUR_RSA(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
306     generateur=RSA;
307     RSA->active_affichage(fonc_affiche);
308     }
309    
310 couturad 919 double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
311     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
312     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
313     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
314     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
315     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
316     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
317     Boite3D_distribution_Ymin,
318     Boite3D_distribution_Zmin,
319     Boite3D_distribution_Xmax,
320     Boite3D_distribution_Ymax,
321     Boite3D_distribution_Zmax);
322 couturad 951 RSA->change_boite3d_distribution(Boite3D_distribution);
323 couturad 919 double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
324     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
325 couturad 951 double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
326     RSA->change_nb_pas_grille(Nb_pas_X);
327     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
328     RSA->change_distance_inter_volume_min(Distance_min_inter_volume);
329 couturad 919 double Volume_min = param->get_valeur((char*)"Volume_min");
330 couturad 951 RSA->change_volume_min(Volume_min);
331 couturad 919 double Aire_min = param->get_valeur((char*)"Aire_min");
332 couturad 951 RSA->change_aire_min(Aire_min);
333 couturad 919 double Longueur_min = param->get_valeur((char*)"Longueur_min");
334 couturad 951 RSA->change_longueur_min(Longueur_min);
335 couturad 919 double Angle_min = param->get_valeur((char*)"Angle_min");
336 couturad 951 RSA->change_angle_min(Angle_min);
337 couturad 919 double Nb_iteration_max = param->get_valeur((char*)"Nb_iteration_max");
338 couturad 951 RSA->change_nb_iteration_max(Nb_iteration_max);
339     bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
340     RSA->change_intersection_bords_ves(Avec_intersections);
341     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
342 couturad 971 char message[1000];
343     sprintf(message,"Generateur RSA : %s",Nom_groupe_inclusion.c_str());
344     affiche(message);
345 couturad 951 int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
346 couturad 919 double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
347 couturad 951 double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
348     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
349     std::string multicouche = param->get_nom((char*)"Multicouche");
350     PARS_ARGUMENT parse_param[100];
351     PARSE parse;
352     parse.decode(multicouche.c_str(),"@,(&)",parse_param);
353     std::vector<double> *vector_epaisseur=NULL;
354     int nb_couche = atoi(parse_param[0].argument[0].c_str());
355     if(nb_couche>0)
356 couturad 919 {
357 couturad 951 vector_epaisseur=new std::vector<double>;
358     for(int i=0;i<nb_couche;i++)
359     {
360     double epaisseur=atof(parse_param[1].argument[i].c_str());
361     vector_epaisseur->push_back(epaisseur);
362     }
363     }
364 couturad 968 if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::SPHERE)
365 couturad 951 {
366 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
367     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
368     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
369     double fraction_volumique_actuelle=0.0;
370     RSA->tirrage_aleatoire_sphere(Nom_groupe_inclusion,Mu_rayon,Sigma_rayon,Type_distribution_rayon,Fraction_volumique_cible,Eps_fraction_volumique,fraction_volumique_actuelle,vector_epaisseur,Porosite);
371 couturad 919 }
372 couturad 968 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::CYLINDRE)
373 couturad 919 {
374 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
375     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
376     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
377     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
378     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
379     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
380     double Mu_theta = param->get_valeur((char*)"Mu_theta");
381     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
382     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
383     double Mu_phi = param->get_valeur((char*)"Mu_phi");
384     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
385     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
386     double fraction_volumique_actuelle=0.0;
387     RSA->tirrage_aleatoire_cylindre(Nom_groupe_inclusion,
388     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
389     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
390     Mu_theta,Sigma_theta,Type_distribution_theta,
391     Mu_phi,Sigma_phi,Type_distribution_phi,
392     Fraction_volumique_cible,Eps_fraction_volumique,fraction_volumique_actuelle,
393     vector_epaisseur,
394     Porosite);
395 couturad 919 }
396 couturad 993 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::ELLIPSOIDE)
397     {
398     double Mu_rayon_majeur = param->get_valeur((char*)"Mu_rayon_majeur");
399     double Sigma_rayon_majeur = param->get_valeur((char*)"Sigma_rayon_majeur");
400     double Type_distribution_rayon_majeur = param->get_valeur((char*)"Type_distribution_rayon_majeur");
401     double Mu_rayon_mineur = param->get_valeur((char*)"Mu_rayon_mineur");
402     double Sigma_rayon_mineur = param->get_valeur((char*)"Sigma_rayon_mineur");
403     double Type_distribution_rayon_mineur = param->get_valeur((char*)"Type_distribution_rayon_mineur");
404     double Mu_theta = param->get_valeur((char*)"Mu_theta");
405     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
406     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
407     double Mu_phi = param->get_valeur((char*)"Mu_phi");
408     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
409     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
410     double fraction_volumique_actuelle=0.0;
411     RSA->tirrage_aleatoire_ellipsoide(Nom_groupe_inclusion,
412     Mu_rayon_majeur,Sigma_rayon_majeur,Type_distribution_rayon_majeur,
413     Mu_rayon_mineur,Sigma_rayon_mineur,Type_distribution_rayon_mineur,
414     Mu_theta,Sigma_theta,Type_distribution_theta,
415     Mu_phi,Sigma_phi,Type_distribution_phi,
416     Fraction_volumique_cible,Eps_fraction_volumique,fraction_volumique_actuelle,
417     vector_epaisseur,
418     Porosite);
419     }
420 couturad 951 if(vector_epaisseur!=NULL) delete vector_epaisseur;
421     }
422 couturad 968 else if(((int)param->get_valeur((char*)"Type_generateur"))==MSTRUCT::TYPE_GENERATEUR::DCR)
423 couturad 951 {
424 couturad 952 #ifdef PROJECT_CHRONO
425 couturad 951 std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
426     MSTRUCT_GENERATEUR_DCR *DCR;
427     if(generateur==NULL)
428     {
429     DCR = new MSTRUCT_GENERATEUR_DCR(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
430     generateur=DCR;
431     DCR->active_affichage(fonc_affiche);
432     }
433     double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
434     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
435     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
436     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
437     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
438     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
439     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
440     Boite3D_distribution_Ymin,
441     Boite3D_distribution_Zmin,
442     Boite3D_distribution_Xmax,
443     Boite3D_distribution_Ymax,
444     Boite3D_distribution_Zmax);
445     DCR->change_boite3d_distribution(Boite3D_distribution);
446     double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
447     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
448     double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
449     DCR->change_nb_pas_grille(Nb_pas_X);
450     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
451     DCR->change_distance_inter_volume_min(Distance_min_inter_volume);
452     double Volume_min = param->get_valeur((char*)"Volume_min");
453     DCR->change_volume_min(Volume_min);
454     double Aire_min = param->get_valeur((char*)"Aire_min");
455     DCR->change_aire_min(Aire_min);
456     double Longueur_min = param->get_valeur((char*)"Longueur_min");
457     DCR->change_longueur_min(Longueur_min);
458     double Angle_min = param->get_valeur((char*)"Angle_min");
459     DCR->change_angle_min(Angle_min);
460 couturad 966 long Nb_iteration_max = (long)param->get_valeur((char*)"Nb_iteration_max");
461 couturad 951 bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
462     DCR->change_intersection_bords_ves(Avec_intersections);
463     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
464 couturad 971 char message[1000];
465     sprintf(message,"Generateur DCR : %s",Nom_groupe_inclusion.c_str());
466     affiche(message);
467 couturad 951 int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
468     double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
469     double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
470     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
471     std::string multicouche = param->get_nom((char*)"Multicouche");
472 couturad 919
473 couturad 960 bool Avec_interface_graphique = (bool)param->get_valeur((char*)"Avec_interface_graphique");
474     double Facteur_reduction_vitesse = param->get_valeur((char*)"Facteur_reduction_vitesse");
475     double Friction = param->get_valeur((char*)"Friction");
476     double Pas_temps_sim = param->get_valeur((char*)"Pas_temps_sim");
477     double Temps_max_sim = param->get_valeur((char*)"Temps_max_sim");
478     double Eps_vitesse = param->get_valeur((char*)"Eps_vitesse");
479     DCR->active_interface_graphique(Avec_interface_graphique);
480     DCR->change_facteur_reduction_vitesse(Facteur_reduction_vitesse);
481     DCR->change_eps_vitesse(Eps_vitesse);
482     DCR->change_friction(Friction);
483     DCR->change_pas_temps(Pas_temps_sim);
484     DCR->change_temps_max_sim(Temps_max_sim);
485 couturad 971
486 couturad 968 if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::SPHERE)
487 couturad 951 {
488 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
489     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
490     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
491 couturad 971 DCR->ajouter_spheres(Nom_groupe_inclusion,Mu_rayon,Sigma_rayon,Type_distribution_rayon,Fraction_volumique_cible,Eps_fraction_volumique,Porosite);
492 couturad 966 }
493 couturad 968 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::CYLINDRE)
494 couturad 966 {
495     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
496     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
497     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
498     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
499     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
500     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
501     double Mu_theta = param->get_valeur((char*)"Mu_theta");
502     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
503     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
504     double Mu_phi = param->get_valeur((char*)"Mu_phi");
505     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
506     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
507     DCR->ajouter_cylindres(Nom_groupe_inclusion,
508     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
509     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
510     Mu_theta,Sigma_theta,Type_distribution_theta,
511     Mu_phi,Sigma_phi,Type_distribution_phi,
512 couturad 971 Fraction_volumique_cible,Eps_fraction_volumique,
513     Porosite);
514 couturad 966 }
515 couturad 971 #else
516     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
517     #endif
518     }
519     }
520     if(generateur->get_type()==MSTRUCT::TYPE_GENERATEUR::DCR)
521     {
522     #ifdef PROJECT_CHRONO
523     MSTRUCT_GENERATEUR_DCR *DCR= (MSTRUCT_GENERATEUR_DCR*)generateur;
524     if(DCR->lancer_simulation()==FAIL)
525 couturad 966 {
526     delete generateur;
527 couturad 971 return FAIL;
528 couturad 966 }
529 couturad 971 DCR->generer_geometrie();
530 couturad 952 #else
531     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
532 couturad 971 #endif
533 couturad 919 }
534     ot_cpu.ajouter_etape((char*)"generation_geometrie");
535 couturad 926 double temps_generation_geometrie;
536     ot_cpu.get_etape((char*)"generation_geometrie",temps_generation_geometrie);
537     change_temps_geometrie(get_temps_geometrie()+temps_generation_geometrie);
538 couturad 919 generateur->construire(this);
539     delete generateur;
540     return OK;
541     }
542    
543 couturad 926 int MSTRUCT_VES::generer_materiau(std::vector< OT_PARAMETRES* >& vector_params_materiau)
544 couturad 919 {
545     OT_CPU ot_cpu;
546     ot_cpu.initialise();
547     std::vector<OT_PARAMETRES*>::iterator it;
548     for(it=vector_params_materiau.begin();it!=vector_params_materiau.end();it++)
549     {
550     OT_PARAMETRES* param = *it;
551     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
552 couturad 971 bool Etude_mecanique = (bool)param->get_valeur((char*)"Etude_mecanique");
553     if(Etude_mecanique)
554 couturad 919 {
555 couturad 971 double Mu_E = param->get_valeur((char*)"Mu_E");
556     double Sigma_E = param->get_valeur((char*)"Sigma_E");
557     int Type_distribution_E = (int)param->get_valeur((char*)"Type_distribution_E");
558     double Mu_nu = param->get_valeur((char*)"Mu_nu");
559     double Sigma_nu = param->get_valeur((char*)"Sigma_nu");
560     int Type_distribution_nu = (int)param->get_valeur((char*)"Type_distribution_nu");
561     std::random_device seed;
562     std::mt19937_64 generateur(seed());
563     std::uniform_real_distribution<double> uniform_distribution_E(Mu_E-Sigma_E,Mu_E+Sigma_E);
564     std::normal_distribution<double> normal_distribution_E(Mu_E,Sigma_E);
565     std::uniform_real_distribution<double> uniform_distribution_nu(Mu_nu-Sigma_nu,Mu_nu+Sigma_nu);
566     std::normal_distribution<double> normal_distribution_nu(Mu_nu,Sigma_nu);
567     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
568     std::map<long,MG_CG_FORME*>::iterator it_forme;
569     for(MG_CG_FORME* forme = mgcg_groupe_forme->get_premiere_mgcg_forme(it_forme);forme!=NULL;forme=mgcg_groupe_forme->get_suivante_mgcg_forme(it_forme))
570 couturad 919 {
571 couturad 971 double E;
572     if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::FIXE) E=Mu_E;
573     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) E=uniform_distribution_E(generateur);
574     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) E=normal_distribution_E(generateur);
575     double nu;
576     if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::FIXE) nu=Mu_nu;
577     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) nu=uniform_distribution_nu(generateur);
578     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) nu=normal_distribution_nu(generateur);
579     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
580     {
581     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
582     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",E);
583     forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",nu);
584     }
585     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
586     {
587     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
588     std::map<long,MG_VOLUME*>::iterator it_volume;
589     for(MG_VOLUME* volume = forme_multi_volume->get_premier_mg_volume(it_volume);volume!=NULL;volume=forme_multi_volume->get_suivant_mg_volume(it_volume))
590     {
591     volume->ajouter_ccf((char*)"Em",E);
592     volume->ajouter_ccf((char*)"nu",nu);
593     }
594     }
595 couturad 919 }
596 couturad 971 }
597     bool Etude_thermique = (bool)param->get_valeur((char*)"Etude_thermique");
598     if(Etude_thermique)
599     {
600     double Mu_Lambda = param->get_valeur((char*)"Mu_Lambda");
601     double Sigma_Lambda = param->get_valeur((char*)"Sigma_Lambda");
602     int Type_distribution_Lambda = (int)param->get_valeur((char*)"Type_distribution_Lambda");
603     double Mu_Ro = param->get_valeur((char*)"Mu_Ro");
604     double Sigma_Ro = param->get_valeur((char*)"Sigma_Ro");
605     int Type_distribution_Ro = (int)param->get_valeur((char*)"Type_distribution_Ro");
606     double Mu_Cp = param->get_valeur((char*)"Mu_Cp");
607     double Sigma_Cp = param->get_valeur((char*)"Sigma_Cp");
608     int Type_distribution_Cp = (int)param->get_valeur((char*)"Type_distribution_Cp");
609     std::random_device seed;
610     std::mt19937_64 generateur(seed());
611     std::uniform_real_distribution<double> uniform_distribution_Lambda(Mu_Lambda-Sigma_Lambda,Mu_Lambda+Sigma_Lambda);
612     std::normal_distribution<double> normal_distribution_Lambda(Mu_Lambda,Sigma_Lambda);
613     std::uniform_real_distribution<double> uniform_distribution_Ro(Mu_Ro-Sigma_Ro,Mu_Ro+Sigma_Ro);
614     std::normal_distribution<double> normal_distribution_Ro(Mu_Ro,Sigma_Ro);
615     std::uniform_real_distribution<double> uniform_distribution_Cp(Mu_Cp-Sigma_Cp,Mu_Cp+Sigma_Cp);
616     std::normal_distribution<double> normal_distribution_Cp(Mu_Cp,Sigma_Cp);
617     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
618     std::map<long,MG_CG_FORME*>::iterator it_forme;
619     for(MG_CG_FORME* forme = mgcg_groupe_forme->get_premiere_mgcg_forme(it_forme);forme!=NULL;forme=mgcg_groupe_forme->get_suivante_mgcg_forme(it_forme))
620 couturad 919 {
621 couturad 971 double Lambda;
622     if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Lambda=Mu_Lambda;
623     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Lambda=uniform_distribution_Lambda(generateur);
624     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Lambda=normal_distribution_Lambda(generateur);
625     double Ro;
626     if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Ro=Mu_Ro;
627     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Ro=uniform_distribution_Ro(generateur);
628     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Ro=normal_distribution_Ro(generateur);
629     double Cp;
630     if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Cp=Mu_Cp;
631     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Cp=uniform_distribution_Cp(generateur);
632     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Cp=normal_distribution_Cp(generateur);
633     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
634     {
635     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
636     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Kx",Lambda);
637     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Ro",Ro);
638     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Cp",Cp);
639     }
640     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
641     {
642     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
643     std::map<long,MG_VOLUME*>::iterator it_volume;
644     for(MG_VOLUME* volume = forme_multi_volume->get_premier_mg_volume(it_volume);volume!=NULL;volume=forme_multi_volume->get_suivant_mg_volume(it_volume))
645     {
646     volume->ajouter_ccf((char*)"Kx",Lambda);
647     volume->ajouter_ccf((char*)"Ro",Ro);
648     volume->ajouter_ccf((char*)"Cp",Cp);
649     }
650     }
651 couturad 919 }
652     }
653 couturad 971 }
654 couturad 919 ot_cpu.ajouter_etape((char*)"generation_materiau");
655 couturad 926 double temps_generation_materiau;
656     ot_cpu.get_etape((char*)"generation_materiau",temps_generation_materiau);
657     change_temps_materiau(get_temps_materiau()+temps_generation_materiau);
658 couturad 919 return OK;
659     }
660    
661 couturad 926 int MSTRUCT_VES::generer_carte(OT_PARAMETRES *param)
662 couturad 919 {
663     double Ecart_nodal = param->get_valeur((char*)"Ecart_nodal");
664 couturad 937 double Ecart_nodal_face_particule = param->get_valeur((char*)"Ecart_nodal_face_particule");
665 couturad 919 double Fechantillonnage = param->get_valeur((char*)"Fechantillonnage");
666     double Nb_cellule_direction = param->get_valeur((char*)"Nb_cellule_direction");
667     std::string Nom_fem_solution = param->get_nom((char*)"Nom_fem_solution");
668     std::string Nom_mg_gestionnaire_carte = param->get_nom((char*)"Nom_mg_gestionnaire_carte");
669     std::string Nom_carte = param->get_nom((char*)"Nom_carte");
670     double Nb_couche_min = param->get_valeur((char*)"Nb_couche_min");
671     double Nb_pas = param->get_valeur((char*)"Nb_pas");
672     double Facteur_augmentation = param->get_valeur((char*)"Facteur_augmentation");
673     MG_GESTIONNAIRE *mggest_carte = new MG_GESTIONNAIRE;
674 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_matrice = m_mgcg_modele->get_mgcg_groupe_forme((char*)"Matrice");
675     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume_matrice = mgcg_groupe_matrice->get_tpl_map_volume();
676 couturad 919 OT_CPU ot_cpu;
677     ot_cpu.initialise();
678     FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE *carte = new FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE(mggest_carte,
679     m_mg_geometrie,
680     Ecart_nodal,
681 couturad 937 Ecart_nodal_face_particule,
682 couturad 919 Fechantillonnage,
683     Nb_cellule_direction,
684     (char*)Nom_fem_solution.c_str(),
685     tpl_map_volume_matrice,
686     Nb_couche_min,
687     Nb_pas,
688     Facteur_augmentation);
689 couturad 926
690    
691 couturad 933 carte->active_affichage(fonc_affiche);
692 couturad 926 carte->construit();
693 couturad 919 ot_cpu.ajouter_etape((char*)"generation_carte");
694 couturad 926 double temps_generation_carte;
695     ot_cpu.get_etape((char*)"generation_carte",temps_generation_carte);
696     change_temps_carte(get_temps_carte()+temps_generation_carte);
697     mggest_carte->enregistrer(Nom_mg_gestionnaire_carte.c_str());
698 couturad 919 carte->enregistrer((char*)Nom_carte.c_str());
699 couturad 964 char message[1000];
700     std::sprintf(message,"Fichier CARTE de sortie : %s",Nom_carte.c_str());
701     affiche(message);
702 couturad 926 m_ves_file->change_nom_fichier_carte((char*)Nom_carte.c_str());
703 couturad 919 return OK;
704     }
705    
706 couturad 926 int MSTRUCT_VES::generer_maillage(OT_PARAMETRES *param,FCT_TAILLE_FEM_SOLUTION* carte)
707 couturad 919 {
708     OT_CPU ot_cpu;
709     ot_cpu.initialise();
710     int Niveau = (int)param->get_valeur((char*)"Niveau");
711     int Niveau_opt_2d = (int)param->get_valeur((char*)"Niveau_opt_2d");
712     int Niveau_opt_3d = (int)param->get_valeur((char*)"Niveau_opt_3d");
713     double Priorite_metrique = param->get_valeur((char*)"Priorite_metrique");
714     int Analyse = (int)param->get_valeur((char*)"Analyse");
715     affiche((char*)"Maillage du VER :");
716     m_mg_maillage = new MG_MAILLAGE(m_mg_geometrie);
717     m_mg_gestionnaire->ajouter_mg_maillage(m_mg_maillage);
718 couturad 951 change_mg_maillage(m_mg_maillage);
719 couturad 993 affiche((char*)"Maillage 3D_couche :");
720 couturad 951 MAILLEUR3D_COUCHE m3d_couche(m_mg_maillage,m_mg_geometrie,carte);
721 couturad 993 m3d_couche.active_affichage(fonc_affiche);
722 couturad 951 LISTE_MG_VOLUME::iterator it_volume;
723     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
724 couturad 919 {
725 couturad 951 if(volume->est_mince())
726     {
727     char message[1000];
728 couturad 993 sprintf(message,"-> Maillage du volume id %li",volume->get_id());
729 couturad 951 affiche(message);
730 couturad 966 if(m3d_couche.maille(volume)==FAIL) return FAIL;
731 couturad 951 }
732 couturad 919 }
733 couturad 951 if(Niveau>=0)
734 couturad 919 {
735 couturad 993 long i=1;
736     long nb=m_mg_geometrie->get_nb_mg_sommet();
737 couturad 951 MAILLEUR0D m0d(m_mg_maillage,m_mg_geometrie);
738 couturad 993 affiche((char*)"Maillage 0D :");
739 couturad 951 LISTE_MG_SOMMET::iterator it_sommet;
740     for(MG_SOMMET* sommet=m_mg_geometrie->get_premier_sommet(it_sommet);sommet!=NULL;sommet=m_mg_geometrie->get_suivant_sommet(it_sommet))
741     {
742     if(sommet->get_lien_maillage()->get_nb()>0) continue;
743     char message[1000];
744 couturad 993 sprintf(message,"[%4li/%li] Maillage du sommet id %li",i,nb,sommet->get_id());
745 couturad 951 affiche(message);
746 couturad 966 if(m0d.maille(sommet)==FAIL) return FAIL;
747 couturad 993 i++;
748 couturad 951 }
749 couturad 919 }
750 couturad 951 if(Niveau>=1)
751 couturad 919 {
752 couturad 993 long i=1;
753     long nb=m_mg_geometrie->get_nb_mg_arete();
754 couturad 951 MAILLEUR1D m1d(m_mg_maillage,m_mg_geometrie,carte);
755 couturad 993 affiche((char*)"Maillage 1D :");
756 couturad 951 m1d.active_affichage(fonc_affiche);
757     LISTE_MG_ARETE::iterator it_arete;
758     for(MG_ARETE* arete=m_mg_geometrie->get_premier_arete(it_arete);arete!=NULL;arete=m_mg_geometrie->get_suivant_arete(it_arete))
759     {
760     if(arete->get_lien_maillage()->get_nb()>0) continue;
761     char message[1000];
762 couturad 993 sprintf(message,"[%4li/%li] Maillage de l'arete id %li",i,nb,arete->get_id());
763 couturad 951 affiche(message);
764 couturad 966 if(m1d.maille(arete)==FAIL) return FAIL;
765 couturad 993 i++;
766 couturad 951 }
767 couturad 919 }
768 couturad 951 if(Niveau>=2)
769 couturad 919 {
770 couturad 993 long i=1;
771     long nb=m_mg_geometrie->get_nb_mg_face();
772 couturad 951 MAILLEUR2D m2d(m_mg_maillage,m_mg_geometrie,carte);
773     m2d.change_niveau_optimisation(Niveau_opt_2d);
774     m2d.change_priorite_metrique(Priorite_metrique);
775 couturad 993 affiche((char*)"Maillage 2D :");
776 couturad 951 m2d.active_affichage(fonc_affiche);
777     LISTE_MG_FACE::iterator it_face;
778     for(MG_FACE* face=m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
779     {
780     if(face->get_lien_maillage()->get_nb()>0) continue;
781     char message[1000];
782 couturad 993 sprintf(message,"[%4li/%li] Maillage de la face id %li",i,nb,face->get_id());
783 couturad 951 affiche(message);
784 couturad 966 if(m2d.maille(face)==FAIL) return FAIL;
785 couturad 993 i++;
786 couturad 951 }
787 couturad 919 }
788 couturad 951 if(Niveau>=3)
789     {
790 couturad 993 long i=1;
791     long nb=m_mg_geometrie->get_nb_mg_volume();
792 couturad 951 MAILLEUR3D m3d(m_mg_maillage,m_mg_geometrie,carte,false);
793     m3d.change_niveau_optimisation(Niveau_opt_3d);
794     m3d.change_priorite_metrique(Priorite_metrique);
795 couturad 993 affiche((char*)"Maillage 3D :");
796 couturad 951 m3d.active_affichage(fonc_affiche);
797     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
798     {
799     if(volume->get_lien_maillage()->get_nb()>0) continue;
800     if(volume->est_mince()) continue;
801     char message[1000];
802 couturad 993 sprintf(message,"[%4li/%li] Maillage du volume id %li",i,nb,volume->get_id());
803 couturad 951 affiche(message);
804 couturad 966 if(m3d.maille(volume)==FAIL) return FAIL;
805 couturad 993 i++;
806 couturad 951 }
807     }
808 couturad 919 ot_cpu.ajouter_etape((char*)"generation_maillage");
809 couturad 926 double temps_generation_maillage;
810     ot_cpu.get_etape((char*)"generation_maillage",temps_generation_maillage);
811     change_temps_maillage(get_temps_maillage()+temps_generation_maillage);
812 couturad 919 return OK;
813     }
814    
815 couturad 926 int MSTRUCT_VES::generer_fem_maillage(OT_PARAMETRES *param)
816 couturad 919 {
817     OT_CPU ot_cpu;
818     ot_cpu.initialise();
819     int Degre = (int)param->get_valeur((char*)"Degre");
820     int Analyse = (int)param->get_valeur((char*)"Analyse");
821     int Optimisation_num_noeud = (int)param->get_valeur((char*)"Optimisation_num_noeud");
822     MAILLEUR_FEM mailleurfem;
823     mailleurfem.active_affichage(fonc_affiche);
824 couturad 926 m_fem_maillage = new FEM_MAILLAGE(m_mg_maillage->get_mg_geometrie(),m_mg_maillage,Degre);
825 couturad 919 m_mg_gestionnaire->ajouter_fem_maillage(m_fem_maillage);
826 couturad 926 change_fem_maillage(m_fem_maillage);
827 couturad 966 if(Optimisation_num_noeud) {if(mailleurfem.maille(m_fem_maillage,1)==FAIL) return FAIL;}
828     else {if(mailleurfem.maille(m_fem_maillage,0)==FAIL) return FAIL;};
829 couturad 919 if(Analyse)
830     {
831     MAILLEUR_ANALYSE m3d(m_fem_maillage);
832     m3d.active_affichage(fonc_affiche);
833     // m3d.analyse();
834     }
835     ot_cpu.ajouter_etape((char*)"generation_fem_maillage");
836 couturad 926 double temps_generation_fem_maillage;
837     ot_cpu.get_etape((char*)"generation_fem_maillage",temps_generation_fem_maillage);
838     change_temps_fem_maillage(get_temps_fem_maillage()+temps_generation_fem_maillage);
839 couturad 919 return OK;
840     }
841    
842 couturad 926 int MSTRUCT_VES::generer_etude(OT_PARAMETRES *param)
843 couturad 919 {
844     OT_CPU ot_cpu;
845     ot_cpu.initialise();
846 couturad 926 BOITE_3D boite3D_ves = get_boite3d_ves();
847     double eps = get_precision();
848 couturad 982 int Type_etude = (int)param->get_valeur((char*)"Type_etude");
849     int Type_Chargement = (int)param->get_valeur((char*)"Type_Chargement");
850     int Type_CL = (int)param->get_valeur((char*)"Type_CL");
851     double Valeur_CL = param->get_valeur((char*)"Valeur_CL");
852     int Direction = (int)param->get_valeur((char*)"Direction");
853     MSTRUCT_OUTILS::appliquer_conditions_limites(m_mg_geometrie,boite3D_ves,Type_etude,Type_CL,Type_Chargement,Valeur_CL,Direction,eps);
854 couturad 919 ot_cpu.ajouter_etape((char*)"generation_etude");
855 couturad 926 double temps_generation_etude;
856     ot_cpu.get_etape((char*)"generation_etude",temps_generation_etude);
857     change_temps_etude(get_temps_etude()+temps_generation_etude);
858 couturad 919 return OK;
859     }
860    
861 couturad 968 int MSTRUCT_VES::generer_calcul(OT_PARAMETRES *param,char* param_aster,std::string nom_etude)
862 couturad 919 {
863     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
864 couturad 971 int Type_calcul;
865     if(Type_etude==MSTRUCT::TYPE_ETUDE::MECANIQUE) Type_calcul=MAGIC::CALCUL_ASTER::ELASTIQUE;
866     else if(Type_etude==MSTRUCT::TYPE_ETUDE::THERMIQUE) Type_calcul=MAGIC::CALCUL_ASTER::THERMIQUE;
867 couturad 919 std::string Code_resu = param->get_nom((char*)"Code_resu");
868     MGASTER mgaster;
869     mgaster.active_affichage(fonc_affiche);
870     OT_CPU ot_cpu;
871     ot_cpu.initialise();
872 couturad 968 mgaster.calcule(param_aster,m_fem_maillage,(char*)nom_etude.c_str(),Type_calcul,(char*)Code_resu.c_str());
873 couturad 919 ot_cpu.ajouter_etape((char*)"calcul");
874 couturad 926 double temps_calcul;
875     ot_cpu.get_etape((char*)"calcul",temps_calcul);
876     change_temps_calcul(get_temps_calcul()+temps_calcul);
877 couturad 919 }
878    
879 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement)
880 couturad 919 {
881 couturad 926 OT_CPU ot_cpu;
882     ot_cpu.initialise();
883     std::vector<OT_PARAMETRES*>::iterator it;
884 couturad 968 char ligne[1000];
885     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
886 couturad 919 {
887 couturad 926 OT_PARAMETRES* param = *it;
888 couturad 968 int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
889 couturad 926 std::string Identifiant = param->get_nom((char*)"Identifiant");
890     if(get_analyse(Identifiant)!=NULL)
891     {
892     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
893     continue;
894     }
895     sprintf(ligne,"-> %s",Identifiant.c_str());
896     affiche(ligne);
897 couturad 968 if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP)
898 couturad 926 {
899     long Num_solution = (long)param->get_valeur((char*)"Num_solution");
900 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
901     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
902     BOITE_3D *boite_3d_analyse=NULL;
903     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
904     if(Boite_analyse)
905     {
906     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
907     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
908     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
909     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
910     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
911     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
912     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
913     }
914     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
915 couturad 926 FEM_SOLUTION* sol = m_mg_gestionnaire->get_fem_solution(Num_solution);
916     int nb_champ = sol->get_nb_champ();
917 couturad 968 MSTRUCT_ANALYSE_CHAMP* analyse_champ = new MSTRUCT_ANALYSE_CHAMP(this,Identifiant,sol->get_id(),nb_champ,Largeur_colonne_distribution,Nom_groupe_forme,boite_3d_analyse);
918     if(Analyse_erosion)
919 couturad 930 {
920 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
921     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
922     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_champ,Nb_couche,Epaisseur_couche);
923     analyse_erosion->executer();
924     ajouter_analyse(analyse_erosion);
925 couturad 930 }
926     else
927     {
928 couturad 968 analyse_champ->executer();
929     ajouter_analyse(analyse_champ);
930 couturad 930 }
931 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
932     }
933     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION)
934 couturad 926 {
935 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
936     int Avec_fem_maillage = (int)param->get_valeur((char*)"Avec_fem_maillage");
937     BOITE_3D *boite_3d_analyse=NULL;
938     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
939     if(Boite_analyse)
940 couturad 930 {
941 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
942     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
943     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
944     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
945     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
946     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
947     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
948 couturad 930 }
949 couturad 968 MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION(this,Identifiant,Nom_groupe_forme,boite_3d_analyse,Avec_fem_maillage);
950     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
951     if(Analyse_erosion)
952 couturad 930 {
953 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
954     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
955     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
956     analyse_erosion->executer();
957     ajouter_analyse(analyse_erosion);
958 couturad 930 }
959 couturad 938 else
960     {
961 couturad 968 analyse_orientation->executer();
962     ajouter_analyse(analyse_orientation);
963 couturad 938 }
964 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
965 couturad 938 }
966 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CAO)
967 couturad 926 {
968 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
969 couturad 926 double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
970 couturad 968 MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(this,Identifiant,Largeur_colonne_distribution_volume_forme,Nom_groupe_forme);
971     analyse_cao->executer();
972     ajouter_analyse(analyse_cao);
973 couturad 926 }
974 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_PROPRIETE_MASSIQUE)
975     {
976     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
977     MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE* analyse_prop_mass = new MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE(this,Identifiant,Nom_groupe_forme);
978     analyse_prop_mass->executer();
979     ajouter_analyse(analyse_prop_mass);
980     }
981 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_MG)
982 couturad 926 {
983 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
984 couturad 926 double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
985     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
986     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
987     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
988 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
989     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
990     if(Boite_analyse)
991 couturad 930 {
992 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
993     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
994     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
995     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
996     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
997     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
998     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
999 couturad 930 }
1000 couturad 968 MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(this,
1001     Identifiant,
1002     m_mg_maillage->get_id(),
1003     Largeur_colonne_distribution_qualite_2D,
1004     Largeur_colonne_distribution_taille_2D,
1005     Largeur_colonne_distribution_qualite_3D,
1006     Largeur_colonne_distribution_taille_3D,
1007     Nom_groupe_forme,boite_3d_analyse);
1008     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1009     if(Analyse_erosion)
1010     {
1011     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1012     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1013     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
1014     analyse_erosion->executer();
1015     ajouter_analyse(analyse_erosion);
1016     }
1017 couturad 930 else
1018     {
1019 couturad 968 analyse_mg_maillage->executer();
1020     ajouter_analyse(analyse_mg_maillage);
1021 couturad 930 }
1022 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1023 couturad 926 }
1024 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_FEM)
1025 couturad 926 {
1026 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1027 couturad 926 double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
1028     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
1029     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
1030     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
1031     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
1032     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
1033 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1034     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1035     if(Boite_analyse)
1036     {
1037     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1038     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1039     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1040     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1041     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1042     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1043     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1044     }
1045     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(this,
1046     Identifiant,
1047 couturad 926 m_fem_maillage->get_id(),
1048     Largeur_colonne_distribution_jacobien_2D_min,
1049     Largeur_colonne_distribution_jacobien_2D_max,
1050     Largeur_colonne_distribution_jacobien_3D_min,
1051     Largeur_colonne_distribution_jacobien_3D_max,
1052     Largeur_colonne_distribution_distortion_2D,
1053     Largeur_colonne_distribution_distortion_3D,
1054     Nom_groupe_forme,
1055     boite_3d_analyse);
1056 couturad 968 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1057     if(Analyse_erosion)
1058 couturad 930 {
1059 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1060     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1061     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
1062     analyse_erosion->executer();
1063     ajouter_analyse(analyse_erosion);
1064 couturad 930 }
1065     else
1066     {
1067 couturad 968 analyse_maillage_fem->executer();
1068     ajouter_analyse(analyse_maillage_fem);
1069 couturad 930 }
1070 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1071 couturad 926 }
1072 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_NORMALISE)
1073     {
1074     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1075 couturad 982 std::string Identifiant_champ_reference = param->get_nom((char*)"Identifiant_champ_reference");
1076 couturad 968 double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1077     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1078     {
1079     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1080 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ_reference);
1081     double valeur_ref=0.0;
1082     int nb_champ=analyse_champ_reference->get_nb_champ();
1083     for(int i=0;i<nb_champ;i++) if(abs(analyse_champ_reference->get_moyenne()[i])>valeur_ref) valeur_ref=abs(analyse_champ_reference->get_moyenne()[i]);
1084     MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1085 couturad 968 ajouter_analyse(analyse_normalise);
1086     }
1087     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1088     {
1089     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1090     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1091     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1092     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1093     MSTRUCT_ANALYSE_EROSION* analyse_erosion_normalise = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1094     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1095 couturad 982 int k=0;
1096     double valeur_ref=0.0;
1097 couturad 968 for(MSTRUCT_ANALYSE* analyse=analyse_erosion_champ->get_premiere_analyse(it_analyse_erosion);analyse!=NULL;analyse=analyse_erosion_champ->get_suivante_analyse(it_analyse_erosion))
1098     {
1099 couturad 982 if(k==0)
1100     {
1101     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion_reference;
1102     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ_reference = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ_reference);
1103     MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_champ_reference->get_premiere_analyse(it_analyse_erosion_reference);
1104     int nb_champ=analyse_champ_reference->get_nb_champ();
1105     for(int i=0;i<nb_champ;i++) if(abs(analyse_champ_reference->get_moyenne()[i])>valeur_ref) valeur_ref=abs(analyse_champ_reference->get_moyenne()[i]);
1106     }
1107 couturad 968 MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1108 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1109 couturad 968 analyse_erosion_normalise->ajouter_analyse(analyse_normalise);
1110 couturad 982 k++;
1111 couturad 968 }
1112     ajouter_analyse(analyse_erosion_normalise);
1113     }
1114     }
1115     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART)
1116     {
1117     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1118     if(get_analyse(Identifiant_champ)==NULL)
1119     {
1120     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1121     return FAIL;
1122     }
1123     std::string Identifiant_champ_compare = param->get_nom((char*)"Identifiant_champ_compare");
1124     if(get_analyse(Identifiant_champ_compare)==NULL)
1125     {
1126     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1127     return FAIL;
1128     }
1129     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1130     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1131     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1132     {
1133     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1134     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1135     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1136     {
1137     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1138     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1139     ajouter_analyse(analyse_ecart);
1140     }
1141     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1142     {
1143     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1144     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1145     if(Num_couche>=0)
1146     {
1147     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1148     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1149     ajouter_analyse(analyse_ecart);
1150     }
1151     else
1152     {
1153     double epaisseur_couche = analyse_erosion_compare->get_epaisseur_couche();
1154     std::string Nom_groupe_forme = analyse_erosion_compare->get_nom_groupe_forme();
1155     BOITE_3D *boite_3d_analyse=analyse_erosion_compare->get_boite_analyse();
1156     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1157     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1158     for(MSTRUCT_ANALYSE* analyse_champ_compare=analyse_erosion_compare->get_premiere_analyse(it_analyse_erosion);analyse_champ_compare!=NULL;analyse_champ_compare=analyse_erosion_compare->get_suivante_analyse(it_analyse_erosion))
1159     {
1160     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,(MSTRUCT_ANALYSE_CHAMP*)analyse_champ_compare,Type_ecart);
1161     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1162     }
1163     ajouter_analyse(analyse_erosion_ecart);
1164     }
1165    
1166     }
1167     }
1168     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1169     {
1170     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1171     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1172     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1173     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1174     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1175     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1176     for(MSTRUCT_ANALYSE* analyse=analyse_erosion_champ->get_premiere_analyse(it_analyse_erosion);analyse!=NULL;analyse=analyse_erosion_champ->get_suivante_analyse(it_analyse_erosion))
1177     {
1178     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1179     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1180     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1181     {
1182     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1183     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1184     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1185     }
1186     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1187     {
1188     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1189     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1190     if(Num_couche>=0)
1191     {
1192     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1193     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1194     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1195     }
1196     else
1197     {
1198    
1199     }
1200    
1201     }
1202     }
1203     ajouter_analyse(analyse_erosion_ecart);
1204     }
1205     }
1206     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART_CHARGEMENT)
1207     {
1208     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1209     if(get_analyse(Identifiant_champ)==NULL)
1210     {
1211     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1212     return FAIL;
1213     }
1214     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1215     int Type_chargement = (int)param->get_valeur((char*)"Type_chargement");
1216     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1217     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1218     {
1219     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1220     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1221     ajouter_analyse(analyse_ecart);
1222     }
1223     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1224     {
1225     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1226     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1227     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1228     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1229     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1230     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1231     for(MSTRUCT_ANALYSE* analyse=analyse_erosion_champ->get_premiere_analyse(it_analyse_erosion);analyse!=NULL;analyse=analyse_erosion_champ->get_suivante_analyse(it_analyse_erosion))
1232     {
1233     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1234     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1235     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1236     }
1237     ajouter_analyse(analyse_erosion_ecart);
1238     }
1239     }
1240     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION_ECART)
1241     {
1242     std::string Identifiant_orientation = param->get_nom((char*)"Identifiant_orientation");
1243     if(get_analyse(Identifiant_orientation)==NULL)
1244     {
1245     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1246     return FAIL;
1247     }
1248     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1249     double tenseur_compare[6];
1250     tenseur_compare[0] = (double)param->get_valeur((char*)"a_11");
1251     tenseur_compare[1] = (double)param->get_valeur((char*)"a_22");
1252     tenseur_compare[2] = (double)param->get_valeur((char*)"a_33");
1253     tenseur_compare[3] = (double)param->get_valeur((char*)"a_12");
1254     tenseur_compare[4] = (double)param->get_valeur((char*)"a_23");
1255     tenseur_compare[5] = (double)param->get_valeur((char*)"a_13");
1256     if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::ORIENTATION)
1257     {
1258     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)get_analyse(Identifiant_orientation);
1259     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1260     ajouter_analyse(analyse_compare);
1261     }
1262     else if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1263     {
1264     MSTRUCT_ANALYSE_EROSION* analyse_erosion_orientation = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_orientation);
1265     double epaisseur_couche = analyse_erosion_orientation->get_epaisseur_couche();
1266     std::string Nom_groupe_forme = analyse_erosion_orientation->get_nom_groupe_forme();
1267     BOITE_3D *boite_3d_analyse=analyse_erosion_orientation->get_boite_analyse();
1268     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1269     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1270     for(MSTRUCT_ANALYSE* analyse=analyse_erosion_orientation->get_premiere_analyse(it_analyse_erosion);analyse!=NULL;analyse=analyse_erosion_orientation->get_suivante_analyse(it_analyse_erosion))
1271     {
1272     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)analyse;
1273     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1274     analyse_erosion_ecart->ajouter_analyse(analyse_compare);
1275     }
1276     ajouter_analyse(analyse_erosion_ecart);
1277     }
1278     }
1279 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1280     {
1281 couturad 982 long Num_solution_temp=(long)param->get_valeur((char*)"Num_solution_temp");
1282     long Num_solution_flux=(long)param->get_valeur((char*)"Num_solution_flux");
1283     int Direction=(int)param->get_valeur((char*)"Direction");
1284     BOITE_3D *boite_3d_analyse=NULL;
1285     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1286     if(Boite_analyse)
1287 couturad 971 {
1288 couturad 982 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1289     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1290     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1291     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1292     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1293     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1294     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1295 couturad 971 }
1296 couturad 982 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1297     FEM_SOLUTION * fem_sol_temp=get_mg_gestionnaire()->get_fem_solution(Num_solution_temp);
1298     FEM_SOLUTION * fem_sol_flux=get_mg_gestionnaire()->get_fem_solution(Num_solution_flux);
1299     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_cond_ther = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(this,Identifiant,fem_sol_temp->get_id(),fem_sol_flux->get_id(),Direction,boite_3d_analyse);
1300     if(Analyse_erosion)
1301 couturad 971 {
1302 couturad 982 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1303     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1304     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cond_ther,Nb_couche,Epaisseur_couche);
1305     analyse_erosion->executer();
1306     ajouter_analyse(analyse_erosion);
1307 couturad 971 }
1308     else
1309     {
1310 couturad 982 analyse_cond_ther->executer();
1311     ajouter_analyse(analyse_cond_ther);
1312 couturad 971 }
1313 couturad 982 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1314 couturad 971 }
1315 couturad 993 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_TEMPS)
1316     {
1317    
1318     }
1319 couturad 968 else
1320     {
1321     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1322     affiche(ligne);
1323     }
1324 couturad 919 }
1325 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
1326     double temps_analyse;
1327     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1328     change_temps_analyse(get_temps_analyse()+temps_analyse);
1329 couturad 919 }
1330    
1331 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1332     MSTRUCT_VES_FILE* ves_sph,
1333     MSTRUCT_VES_FILE* ves_dev)
1334 couturad 933 {
1335 couturad 968 OT_CPU ot_cpu;
1336     ot_cpu.initialise();
1337     std::vector<OT_PARAMETRES*>::iterator it;
1338     char ligne[1000];
1339     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1340     {
1341     OT_PARAMETRES* param = *it;
1342     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1343     std::string Identifiant = param->get_nom((char*)"Identifiant");
1344     if(get_analyse(Identifiant)!=NULL)
1345     {
1346     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1347     return FAIL;
1348     }
1349     sprintf(ligne,"-> %s",Identifiant.c_str());
1350     affiche(ligne);
1351     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MODULES_ELASTICITE)
1352     {
1353     std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
1354     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
1355     if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1356     {
1357     MSTRUCT_ANALYSE_CHAMP* epsilon_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_epsilon);
1358     MSTRUCT_ANALYSE_CHAMP* sigma_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_sigma);
1359     MSTRUCT_ANALYSE_CHAMP* epsilon_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_epsilon);
1360     MSTRUCT_ANALYSE_CHAMP* sigma_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_sigma);
1361     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,epsilon_sph,sigma_sph,epsilon_dev,sigma_dev);
1362     analyse_modules_elasticite->executer();
1363     ajouter_analyse(analyse_modules_elasticite);
1364     }
1365     else if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1366     {
1367     MSTRUCT_ANALYSE_EROSION* epsilon_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_epsilon);
1368     MSTRUCT_ANALYSE_EROSION* sigma_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_sigma);
1369     MSTRUCT_ANALYSE_EROSION* epsilon_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_epsilon);
1370     MSTRUCT_ANALYSE_EROSION* sigma_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_sigma);
1371     long Nb_couche = epsilon_sph_erosion->get_nb_analyse();
1372     double Epaisseur_couche = epsilon_sph_erosion->get_epaisseur_couche();
1373     std::string Nom_groupe_forme = epsilon_sph_erosion->get_nom_groupe_forme();
1374     BOITE_3D *boite_3d_analyse=epsilon_sph_erosion->get_boite_analyse();
1375     MSTRUCT_ANALYSE_EROSION* analyse_modules_elasticite_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,Epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1376     for(int i=0;i<Nb_couche;i++)
1377     {
1378     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,
1379     (MSTRUCT_ANALYSE_CHAMP*)epsilon_sph_erosion->get_analyse(i),
1380     (MSTRUCT_ANALYSE_CHAMP*)sigma_sph_erosion->get_analyse(i),
1381     (MSTRUCT_ANALYSE_CHAMP*)epsilon_dev_erosion->get_analyse(i),
1382     (MSTRUCT_ANALYSE_CHAMP*)sigma_dev_erosion->get_analyse(i));
1383     analyse_modules_elasticite->executer();
1384     analyse_modules_elasticite_erosion->ajouter_analyse(analyse_modules_elasticite);
1385     }
1386     ajouter_analyse(analyse_modules_elasticite_erosion);
1387     }
1388     }
1389     else
1390     {
1391     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1392     affiche(ligne);
1393     }
1394     }
1395     ot_cpu.ajouter_etape((char*)"analyse");
1396     double temps_analyse;
1397     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1398     change_temps_analyse(get_temps_analyse()+temps_analyse);
1399     }
1400    
1401 couturad 971 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1402     MSTRUCT_VES_FILE* ves_lambda_x,
1403     MSTRUCT_VES_FILE* ves_lambda_y,
1404     MSTRUCT_VES_FILE* ves_lambda_z)
1405     {
1406     OT_CPU ot_cpu;
1407     ot_cpu.initialise();
1408     std::vector<OT_PARAMETRES*>::iterator it;
1409     char ligne[1000];
1410     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1411     {
1412     OT_PARAMETRES* param = *it;
1413     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1414     std::string Identifiant = param->get_nom((char*)"Identifiant");
1415     if(get_analyse(Identifiant)!=NULL)
1416     {
1417     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1418     return FAIL;
1419     }
1420     sprintf(ligne,"-> %s",Identifiant.c_str());
1421     affiche(ligne);
1422     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1423     {
1424     std::string Identifiant = param->get_nom((char*)"Identifiant");
1425     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1426     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1427     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1428     {
1429     MSTRUCT_ANALYSE_EROSION* erosion_lambda_x = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_x->get_analyse(Identifiant);
1430     MSTRUCT_ANALYSE_EROSION* erosion_lambda_y = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_y->get_analyse(Identifiant);
1431     MSTRUCT_ANALYSE_EROSION* erosion_lambda_z = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_z->get_analyse(Identifiant);
1432     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_x;
1433     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_y;
1434     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_z;
1435     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_premiere_analyse(it_analyse_x);
1436     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_premiere_analyse(it_analyse_y);
1437     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_premiere_analyse(it_analyse_z);
1438     MSTRUCT_ANALYSE_EROSION* erosion_lambda_app = new MSTRUCT_ANALYSE_EROSION(Identifiant,
1439     erosion_lambda_x->get_epaisseur_couche(),
1440     erosion_lambda_x->get_nom_groupe_forme(),
1441     erosion_lambda_x->get_boite_analyse());
1442     while(analyse_lambda_x!=NULL && analyse_lambda_y!=NULL && analyse_lambda_z!=NULL)
1443     {
1444     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1445     analyse_lambda_app->executer();
1446     erosion_lambda_app->ajouter_analyse(analyse_lambda_app);
1447     analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_suivante_analyse(it_analyse_x);
1448     analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_suivante_analyse(it_analyse_y);
1449     analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_suivante_analyse(it_analyse_z);
1450     }
1451     ajouter_analyse(erosion_lambda_app);
1452     }
1453     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1454     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1455     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE)
1456     {
1457     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_x->get_analyse(Identifiant);
1458     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_y->get_analyse(Identifiant);
1459     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_z->get_analyse(Identifiant);
1460     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1461     analyse_lambda_app->executer();
1462     ajouter_analyse(analyse_lambda_app);
1463     }
1464     }
1465     else
1466     {
1467     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1468     affiche(ligne);
1469     }
1470     }
1471     ot_cpu.ajouter_etape((char*)"analyse");
1472     double temps_analyse;
1473     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1474     change_temps_analyse(get_temps_analyse()+temps_analyse);
1475     }
1476 couturad 968
1477    
1478 couturad 971
1479    
1480 couturad 968 int MSTRUCT_VES::exporter_maillage_abaqus(char* dossier)
1481     {
1482 couturad 933 std::ofstream f;
1483 couturad 968 char file[1000];
1484     sprintf(file,"%s/noeuds",dossier);
1485     f.open(file,std::ios::out);
1486 couturad 933 f.precision(16);
1487     f.setf(std::ios::showpoint);
1488     f << "*NODE"<< std::endl;
1489     LISTE_FEM_NOEUD::iterator it;
1490     long index=1;
1491     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
1492     {
1493     noeud->change_numero(index);
1494     double *coord=noeud->get_coord();
1495     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
1496     index++;
1497     }
1498     f.close();
1499 couturad 968 sprintf(file,"%s/elements",dossier);
1500     f.open(file,std::ios::out);
1501 couturad 933 f.precision(16);
1502     f.setf(std::ios::showpoint);
1503     index=1;
1504     LISTE_FEM_ELEMENT3::iterator ittele3;
1505     bool tetralin=false;
1506     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1507     {
1508     if(ele3->get_type_entite()==IDFEM_TETRA4)
1509     {
1510     if(tetralin==false)
1511     {
1512     tetralin=true;
1513     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
1514     }
1515     f << index << ", "
1516     << ele3->get_fem_noeud(0)->get_numero() << ", "
1517     << ele3->get_fem_noeud(1)->get_numero() << ", "
1518     << ele3->get_fem_noeud(2)->get_numero() << ", "
1519     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
1520     ele3->change_numero(index);
1521     index++;
1522     }
1523     }
1524     bool pentalin=false;
1525     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1526     {
1527     if(ele3->get_type_entite()==IDFEM_PENTA6)
1528     {
1529     if(pentalin==false)
1530     {
1531     pentalin=true;
1532     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1533     }
1534     f << index << ", "
1535     << ele3->get_fem_noeud(0)->get_numero() << ", "
1536     << ele3->get_fem_noeud(1)->get_numero() << ", "
1537     << ele3->get_fem_noeud(2)->get_numero() << ", "
1538     << ele3->get_fem_noeud(3)->get_numero() << ", "
1539     << ele3->get_fem_noeud(4)->get_numero() << ", "
1540     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1541     ele3->change_numero(index);
1542     index++;
1543     }
1544     }
1545     bool tetraquad=false;
1546     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1547     {
1548     if(ele3->get_type_entite()==IDFEM_TETRA10)
1549     {
1550     if(tetraquad==false)
1551     {
1552     tetraquad=true;
1553     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1554     }
1555     f << index << ", "
1556     << ele3->get_fem_noeud(0)->get_numero() << ", "
1557     << ele3->get_fem_noeud(2)->get_numero() << ", "
1558     << ele3->get_fem_noeud(4)->get_numero() << ", "
1559     << ele3->get_fem_noeud(9)->get_numero() << ", "
1560     << ele3->get_fem_noeud(1)->get_numero() << ", "
1561     << ele3->get_fem_noeud(3)->get_numero() << ", "
1562     << ele3->get_fem_noeud(5)->get_numero() << ", "
1563     << ele3->get_fem_noeud(6)->get_numero() << ", "
1564     << ele3->get_fem_noeud(7)->get_numero() << ", "
1565     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1566     ele3->change_numero(index);
1567     index++;
1568     }
1569     }
1570     bool pentaquad=false;
1571     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1572     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1573     {
1574     if(ele3->get_type_entite()==IDFEM_PENTA15)
1575     {
1576     if(pentaquad==false)
1577     {
1578     pentaquad=true;
1579     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1580     }
1581     f << index << ", "
1582     << ele3->get_fem_noeud(0)->get_numero() << ", "
1583     << ele3->get_fem_noeud(2)->get_numero() << ", "
1584     << ele3->get_fem_noeud(4)->get_numero() << ", "
1585     << ele3->get_fem_noeud(9)->get_numero() << ", "
1586     << ele3->get_fem_noeud(11)->get_numero() << ", "
1587     << ele3->get_fem_noeud(13)->get_numero() << ", "
1588     << ele3->get_fem_noeud(1)->get_numero() << ", "
1589     << ele3->get_fem_noeud(3)->get_numero() << ", "
1590     << ele3->get_fem_noeud(5)->get_numero() << ", "
1591     << ele3->get_fem_noeud(10)->get_numero() << ", "
1592     << ele3->get_fem_noeud(12)->get_numero() << ", "
1593     << ele3->get_fem_noeud(14)->get_numero() << ", "
1594     << ele3->get_fem_noeud(6)->get_numero() << ", "
1595     << ele3->get_fem_noeud(7)->get_numero() << ", "
1596     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1597     ele3->change_numero(index);
1598     index++;
1599     }
1600     }
1601     f.close();
1602 couturad 968 sprintf(file,"%s/BC_nsets",dossier);
1603     f.open(file,std::ios::out);
1604 couturad 933 f.precision(16);
1605     f.setf(std::ios::showpoint);
1606     BOITE_3D boite3D_ves = get_boite3d_ves();
1607     double eps = get_precision();
1608     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1609     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1610     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1611     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1612     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1613     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1614     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1615     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1616     {
1617     double xyzmin[3];
1618     double xyzmax[3];
1619     face->get_xyz_min_max(xyzmin,xyzmax,16);
1620    
1621     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1622     else if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmax(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmax(),eps)) plan_yz_x1.ajouter(face);
1623     else if(OPERATEUR::egal(xyzmin[1],boite3D_ves.get_ymin(),eps) && OPERATEUR::egal(xyzmax[1],boite3D_ves.get_ymin(),eps)) plan_xz_y0.ajouter(face);
1624     else if(OPERATEUR::egal(xyzmin[1],boite3D_ves.get_ymax(),eps) && OPERATEUR::egal(xyzmax[1],boite3D_ves.get_ymax(),eps)) plan_xz_y1.ajouter(face);
1625     else if(OPERATEUR::egal(xyzmin[2],boite3D_ves.get_zmin(),eps) && OPERATEUR::egal(xyzmax[2],boite3D_ves.get_zmin(),eps)) plan_xy_z0.ajouter(face);
1626     else if(OPERATEUR::egal(xyzmin[2],boite3D_ves.get_zmax(),eps) && OPERATEUR::egal(xyzmax[2],boite3D_ves.get_zmax(),eps)) plan_xy_z1.ajouter(face);
1627     }
1628     MG_SOMMET* sommet_x0y0z0=NULL;
1629     MG_SOMMET* sommet_x1y0z0=NULL;
1630     MG_SOMMET* sommet_x0y1z0=NULL;
1631     MG_SOMMET* sommet_x1y1z0=NULL;
1632     MG_SOMMET* sommet_x0y0z1=NULL;
1633     MG_SOMMET* sommet_x1y0z1=NULL;
1634     MG_SOMMET* sommet_x0y1z1=NULL;
1635     MG_SOMMET* sommet_x1y1z1=NULL;
1636     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1637     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1638     {
1639     double xyz[3];
1640     som->get_point()->evaluer(xyz);
1641     if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymin(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmin(),eps)) sommet_x0y0z0=som;
1642     else if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmax(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymin(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmin(),eps)) sommet_x1y0z0=som;
1643     else if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymax(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmin(),eps)) sommet_x0y1z0=som;
1644     else if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmax(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymax(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmin(),eps)) sommet_x1y1z0=som;
1645     else if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymin(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmax(),eps)) sommet_x0y0z1=som;
1646     else if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmax(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymin(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmax(),eps)) sommet_x1y0z1=som;
1647     else if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymax(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmax(),eps)) sommet_x0y1z1=som;
1648     else if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmax(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymax(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmax(),eps)) sommet_x1y1z1=som;
1649     }
1650     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1651     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1652     f << coin_x0y0z0->get_numero() << std::endl;
1653     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1654     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1655     f << coin_x1y0z0->get_numero() << std::endl;
1656     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1657     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1658     f << coin_x0y1z0->get_numero() << std::endl;
1659     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1660     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1661     f << coin_x1y1z0->get_numero() << std::endl;
1662     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1663     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1664     f << coin_x0y0z1->get_numero() << std::endl;
1665     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1666     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1667     f << coin_x1y0z1->get_numero() << std::endl;
1668     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1669     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1670     f << coin_x0y1z1->get_numero() << std::endl;
1671     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1672     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1673     f << coin_x1y1z1->get_numero() << std::endl;
1674     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1675     f << "*NSET,NSET=xEQ0" << std::endl;
1676     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1677     {
1678     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1679     long nb_ele=lst_ele->get_nb();
1680     for(long i=0;i<nb_ele;i++)
1681     {
1682     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1683     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1684     {
1685     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1686     }
1687     }
1688     }
1689     f << "*NSET,NSET=xEQ1" << std::endl;
1690     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1691     {
1692     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1693     long nb_ele=lst_ele->get_nb();
1694     for(long i=0;i<nb_ele;i++)
1695     {
1696     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1697     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1698     {
1699     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1700     }
1701     }
1702     }
1703     f << "*NSET,NSET=yEQ0" << std::endl;
1704     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1705     {
1706     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1707     long nb_ele=lst_ele->get_nb();
1708     for(long i=0;i<nb_ele;i++)
1709     {
1710     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1711     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1712     {
1713     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1714     }
1715     }
1716     }
1717     f << "*NSET,NSET=yEQ1" << std::endl;
1718     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1719     {
1720     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1721     long nb_ele=lst_ele->get_nb();
1722     for(long i=0;i<nb_ele;i++)
1723     {
1724     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1725     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1726     {
1727     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1728     }
1729     }
1730     }
1731     f << "*NSET,NSET=zEQ0" << std::endl;
1732     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1733     {
1734     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1735     long nb_ele=lst_ele->get_nb();
1736     for(long i=0;i<nb_ele;i++)
1737     {
1738     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1739     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1740     {
1741     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1742     }
1743     }
1744     }
1745     f << "*NSET,NSET=zEQ1" << std::endl;
1746     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1747     {
1748     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1749     long nb_ele=lst_ele->get_nb();
1750     for(long i=0;i<nb_ele;i++)
1751     {
1752     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1753     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1754     {
1755     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1756     }
1757     }
1758     }
1759     f.close();
1760 couturad 968 sprintf(file,"%s/groupes_elements",dossier);
1761     f.open(file,std::ios::out);
1762 couturad 933 f.precision(16);
1763     f.setf(std::ios::showpoint);
1764     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
1765     for(MG_CG_GROUPE_FORME* groupe_forme=m_mgcg_modele->get_premier_mgcg_groupe_forme(it_groupe_forme);groupe_forme!=NULL;groupe_forme=m_mgcg_modele->get_suivant_mgcg_groupe_forme(it_groupe_forme))
1766     {
1767     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
1768     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
1769     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
1770     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
1771     {
1772     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1773     long nb_ele=lst_ele->get_nb();
1774     for(long i=0;i<nb_ele;i++)
1775     {
1776     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1777     f << ele3->get_numero() << std::endl;
1778     }
1779     }
1780     }
1781 couturad 937
1782 couturad 968 MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Particule");
1783 couturad 937 if(groupe_forme_particule!=NULL)
1784     {
1785 couturad 968 sprintf(file,"%s/particules",dossier);
1786     f.open(file,std::ios::out);
1787 couturad 937 f.precision(16);
1788     f.setf(std::ios::showpoint);
1789     std::ofstream f2;
1790     f2.open((char*)"infos_particules");
1791     f2.precision(16);
1792     f2.setf(std::ios::showpoint);
1793     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
1794     std::ofstream f_bord;
1795     f_bord.open((char*)"particules_bord");
1796     f_bord.precision(16);
1797     f_bord.setf(std::ios::showpoint);
1798     std::ofstream f_interieur;
1799     f_interieur.open((char*)"particules_interieur");
1800     f_interieur.precision(16);
1801     f_interieur.setf(std::ios::showpoint);
1802     long p=1;
1803     std::map<long,MG_CG_FORME*>::iterator it_forme;
1804     for(MG_CG_FORME* forme=groupe_forme_particule->get_premiere_mgcg_forme(it_forme);forme!=NULL;forme=groupe_forme_particule->get_suivante_mgcg_forme(it_forme))
1805     {
1806     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
1807     {
1808     f << "*ELSET,ELSET=P_" << p << std::endl;
1809     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1810     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1811     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1812     std::vector<double> vct_centre = centre->get_vct_valeur();
1813     f2 << p << " "
1814     << vct_centre.at(0) << " "
1815     << vct_centre.at(1) << " "
1816     << vct_centre.at(2) << " "
1817     << rayon->get_valeur() << " "
1818     << pos_rel->get_valeur() << std::endl;
1819     bool au_bord;
1820     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1821     else au_bord=false;
1822     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
1823     MG_VOLUME* volume = forme_volume->get_mg_volume();
1824     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1825     long nb_ele=lst_ele->get_nb();
1826     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1827     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1828     for(long i=0;i<nb_ele;i++)
1829     {
1830     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1831     f << ele3->get_numero() << std::endl;
1832     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1833     else f_interieur << ele3->get_numero() << std::endl;
1834     }
1835     p++;
1836     }
1837     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
1838     {
1839     f << "*ELSET,ELSET=P_" << p << std::endl;
1840     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1841     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1842     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1843     std::vector<double> vct_centre = centre->get_vct_valeur();
1844     f2 << p << " "
1845     << vct_centre.at(0) << " "
1846     << vct_centre.at(1) << " "
1847     << vct_centre.at(2) << " "
1848     << rayon->get_valeur() << " "
1849     << pos_rel->get_valeur() << std::endl;
1850     bool au_bord;
1851     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1852     else au_bord=false;
1853     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
1854     std::map<long,MG_VOLUME*>::iterator it_volume;
1855     for(MG_VOLUME* volume=forme_multi_volume->get_premier_mg_volume(it_volume);volume!=NULL;volume=forme_multi_volume->get_suivant_mg_volume(it_volume))
1856     {
1857     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1858     long nb_ele=lst_ele->get_nb();
1859     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1860     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1861     for(long i=0;i<nb_ele;i++)
1862     {
1863     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1864     f << ele3->get_numero() << std::endl;
1865     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1866     else f_interieur << ele3->get_numero() << std::endl;
1867     }
1868     }
1869     p++;
1870     }
1871     }
1872     f_bord.close();
1873     f_interieur.close();
1874     f2.close();
1875     f.close();
1876     }
1877 couturad 933 }
1878 couturad 926
1879 couturad 933
1880 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
1881 couturad 919 {
1882 couturad 926 m_ves_file->enregistrer(fichier_ves);
1883 couturad 919 }
1884    
1885 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
1886 couturad 919 {
1887 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
1888     m_ves_file->enregistrer(fichier_ves);
1889     m_mg_gestionnaire->enregistrer(fichier_magic);
1890 couturad 919 }
1891    
1892 couturad 951 void MSTRUCT_VES::active_affichage(fonction_affiche* fonc)
1893 couturad 919 {
1894     fonc_affiche = fonc;
1895     affichageactif = 1;
1896     }
1897    
1898 couturad 926 void MSTRUCT_VES::affiche(char* message)
1899 couturad 919 {
1900     if(affichageactif==1) fonc_affiche(message);
1901     }
1902    
1903    
1904    
1905    
1906