ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 1029
Committed: Fri Jul 12 19:34:50 2019 UTC (5 years, 10 months ago) by couturad
File size: 116718 byte(s)
Log Message:
Parralelisation des calculs des microstructures a particules

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 1029 #include "mstruct_analyse_energie_hill.h"
22 couturad 919 #include "mg_cg_modele.h"
23     #include "mg_cg_assemblage.h"
24     #include "mg_sous_geometrie.h"
25     #include "mg_cg_forme_multi_volume.h"
26 couturad 937 #include "mg_cg_info.h"
27 couturad 919 #include "mg_file.h"
28     #include "fct_taille_fem_solution_generateur_microstructure.h"
29 couturad 951 #include "mailleur3d_couche.h"
30 couturad 919 #include "mailleur0d.h"
31     #include "mailleur1d.h"
32     #include "mailleur2d.h"
33     #include "mailleur3d.h"
34     #include "mailleur_fem.h"
35 couturad 1029 #include "mailleur3d_structure.h"
36 couturad 919 #include "mailleur_analyse.h"
37     #include <fstream>
38     #include "mgaster.h"
39     #include "ot_cpu.h"
40     #include "mstruct_outils.h"
41 couturad 926 #include "mg_cg_groupe_forme.h"
42     #include "mstruct_ves_file.h"
43 couturad 1029 #include "fem_triangle3.h"
44     #include "fem_triangle6.h"
45 couturad 933 #include "fem_tetra4.h"
46     #include "fem_tetra10.h"
47     #include "fem_penta6.h"
48     #include "fem_penta15.h"
49 couturad 1029 #include "mg_hexa.h"
50     #include "tpl_grille.h"
51 couturad 951 #include "parse.h"
52     #include "pars_argument.h"
53 couturad 1029 #include "ot_geometrie.h"
54 couturad 926 MSTRUCT_VES::MSTRUCT_VES(void)
55 couturad 919 {
56     m_mg_gestionnaire=new MG_GESTIONNAIRE;
57     m_mg_geometrie=NULL;
58     m_mgcg_modele=NULL;
59 couturad 926 m_mgcg_assemblage=NULL;
60 couturad 919 m_mg_maillage=NULL;
61     m_fem_maillage=NULL;
62 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
63     change_boite_3D_ves(BOITE_3D(0.0,0.0,0.0,1.0,1.0,1.0));
64     change_precision(1.0e-06);
65     change_temps_geometrie(0.0);
66     change_temps_carte(0.0);
67     change_temps_maillage(0.0);
68     change_temps_fem_maillage(0.0);
69     change_temps_etude(0.0);
70     change_temps_calcul(0.0);
71     change_temps_analyse(0.0);
72 couturad 919 }
73    
74 couturad 926 MSTRUCT_VES::MSTRUCT_VES(char* fichier_ves)
75 couturad 919 {
76 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
77     m_ves_file->ouvrir(fichier_ves);
78     m_mg_gestionnaire = new MG_FILE(m_ves_file->get_nom_fichier_magic());
79     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());
80     else m_mgcg_modele=NULL;
81     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());
82     else m_mgcg_assemblage=NULL;
83     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());
84     else m_mg_geometrie = NULL;
85     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());
86     else m_mg_maillage = NULL;
87     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());
88     else m_fem_maillage = NULL;
89 couturad 919 }
90    
91 couturad 926 MSTRUCT_VES::~MSTRUCT_VES(void)
92 couturad 919 {
93     delete m_mg_gestionnaire;
94 couturad 926 delete m_ves_file;
95 couturad 919 }
96    
97 couturad 926 MG_GESTIONNAIRE* MSTRUCT_VES::get_mg_gestionnaire(void)
98 couturad 919 {
99     return m_mg_gestionnaire;
100     }
101    
102 couturad 926 void MSTRUCT_VES::change_mg_gestionnaire(MG_GESTIONNAIRE* gest)
103 couturad 919 {
104 couturad 926 m_mg_gestionnaire=gest;
105     }
106    
107     void MSTRUCT_VES::change_mg_geometrie(MG_GEOMETRIE* mg_geometrie)
108     {
109 couturad 919 m_mg_geometrie=mg_geometrie;
110 couturad 926 m_ves_file->change_id_mg_geometrie(m_mg_geometrie->get_id());
111 couturad 919 }
112    
113 couturad 926 MG_GEOMETRIE* MSTRUCT_VES::get_mg_geometrie(void)
114 couturad 919 {
115     return m_mg_geometrie;
116     }
117    
118 couturad 926 void MSTRUCT_VES::change_mgcg_assemblage(MG_CG_ASSEMBLAGE* mgcg_assemblage)
119 couturad 919 {
120     m_mgcg_assemblage=mgcg_assemblage;
121 couturad 926 m_ves_file->change_id_mgcg_assemblage(m_mgcg_assemblage->get_id());
122 couturad 919 }
123    
124 couturad 926 MG_CG_ASSEMBLAGE* MSTRUCT_VES::get_mgcg_assemblage(void)
125 couturad 919 {
126     return m_mgcg_assemblage;
127     }
128    
129 couturad 926 void MSTRUCT_VES::change_mgcg_modele(MG_CG_MODELE* mgcg_modele)
130 couturad 919 {
131     m_mgcg_modele=mgcg_modele;
132 couturad 926 m_ves_file->change_id_mgcg_modele(m_mgcg_modele->get_id());
133 couturad 919 }
134    
135 couturad 926 MG_CG_MODELE* MSTRUCT_VES::get_mgcg_modele(void)
136 couturad 919 {
137     return m_mgcg_modele;
138     }
139    
140 couturad 926 MG_MAILLAGE* MSTRUCT_VES::get_mg_maillage(void)
141 couturad 919 {
142     return m_mg_maillage;
143     }
144    
145 couturad 926 void MSTRUCT_VES::change_mg_maillage(MG_MAILLAGE* mg_maillage)
146 couturad 919 {
147     m_mg_maillage=mg_maillage;
148 couturad 926 m_ves_file->change_id_mg_maillage(m_mg_maillage->get_id());
149 couturad 919 }
150    
151 couturad 926 FEM_MAILLAGE* MSTRUCT_VES::get_fem_maillage(void)
152 couturad 919 {
153     return m_fem_maillage;
154     }
155    
156 couturad 926 void MSTRUCT_VES::change_fem_maillage(FEM_MAILLAGE* fem_maillage)
157 couturad 919 {
158     m_fem_maillage=fem_maillage;
159 couturad 926 m_ves_file->change_id_fem_maillage(m_fem_maillage->get_id());
160 couturad 919 }
161    
162 couturad 926 BOITE_3D MSTRUCT_VES::get_boite3d_ves(void)
163 couturad 919 {
164 couturad 926 return m_ves_file->get_boite_3D_ves();
165 couturad 919 }
166    
167 couturad 926 void MSTRUCT_VES::change_boite_3D_ves(BOITE_3D boite3D)
168 couturad 919 {
169 couturad 926 m_ves_file->change_boite_3D_ves(boite3D);
170 couturad 919 }
171    
172 couturad 926 double MSTRUCT_VES::get_precision(void)
173 couturad 919 {
174 couturad 926 return m_ves_file->get_precision();
175 couturad 919 }
176    
177 couturad 926 void MSTRUCT_VES::change_precision(double precision)
178 couturad 919 {
179 couturad 926 m_ves_file->change_precision(precision);
180 couturad 919 }
181    
182 couturad 926 double MSTRUCT_VES::get_temps_geometrie(void)
183 couturad 919 {
184 couturad 926 return m_ves_file->get_temps_geometrie();
185 couturad 919 }
186    
187 couturad 926 void MSTRUCT_VES::change_temps_geometrie(double temps)
188 couturad 919 {
189 couturad 926 m_ves_file->change_temps_geometrie(temps);
190 couturad 919 }
191    
192 couturad 926 double MSTRUCT_VES::get_temps_materiau(void)
193     {
194     return m_ves_file->get_temps_materiau();
195     }
196 couturad 919
197 couturad 926 void MSTRUCT_VES::change_temps_materiau(double temps)
198 couturad 919 {
199 couturad 926 m_ves_file->change_temps_materiau(temps);
200     }
201    
202     double MSTRUCT_VES::get_temps_carte(void)
203     {
204     return m_ves_file->get_temps_carte();
205     }
206    
207     void MSTRUCT_VES::change_temps_carte(double temps)
208     {
209     m_ves_file->change_temps_carte(temps);
210     }
211    
212     double MSTRUCT_VES::get_temps_maillage(void)
213     {
214     return m_ves_file->get_temps_maillage();
215     }
216    
217     void MSTRUCT_VES::change_temps_maillage(double temps)
218     {
219     m_ves_file->change_temps_maillage(temps);
220     }
221    
222     double MSTRUCT_VES::get_temps_fem_maillage(void)
223     {
224     return m_ves_file->get_temps_fem_maillage();
225     }
226    
227     void MSTRUCT_VES::change_temps_fem_maillage(double temps)
228     {
229     m_ves_file->change_temps_fem_maillage(temps);
230     }
231    
232     double MSTRUCT_VES::get_temps_etude(void)
233     {
234     return m_ves_file->get_temps_etude();
235     }
236    
237     void MSTRUCT_VES::change_temps_etude(double temps)
238     {
239     m_ves_file->change_temps_etude(temps);
240     }
241    
242     double MSTRUCT_VES::get_temps_calcul(void)
243     {
244     return m_ves_file->get_temps_calcul();
245     }
246    
247     void MSTRUCT_VES::change_temps_calcul(double temps)
248     {
249     m_ves_file->change_temps_calcul(temps);
250     }
251    
252     double MSTRUCT_VES::get_temps_analyse(void)
253     {
254     return m_ves_file->get_temps_analyse();
255     }
256    
257     void MSTRUCT_VES::change_temps_analyse(double temps)
258     {
259     m_ves_file->change_temps_analyse(temps);
260     }
261    
262     long int MSTRUCT_VES::get_nb_analyse(void)
263     {
264     return m_ves_file->get_nb_analyse();
265     }
266    
267     int MSTRUCT_VES::ajouter_analyse(MSTRUCT_ANALYSE* analyse_ves)
268     {
269     return m_ves_file->ajouter_analyse(analyse_ves);
270     }
271    
272     MSTRUCT_ANALYSE* MSTRUCT_VES::get_premiere_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
273     {
274     return m_ves_file->get_premiere_analyse(it);
275     }
276    
277     MSTRUCT_ANALYSE* MSTRUCT_VES::get_suivante_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
278     {
279     return m_ves_file->get_suivante_analyse(it);
280     }
281    
282 couturad 951 MSTRUCT_ANALYSE* MSTRUCT_VES::get_analyse(std::string identifiant)
283 couturad 926 {
284     return m_ves_file->get_analyse(identifiant);
285     }
286    
287 couturad 951 int MSTRUCT_VES::supprimer_analyse(std::string identifiant)
288 couturad 926 {
289     return m_ves_file->supprimer_analyse(identifiant);
290     }
291    
292     int MSTRUCT_VES::supprimer_tout_analyse(void)
293     {
294     return m_ves_file->supprimer_tout_analyse();
295     }
296    
297     int MSTRUCT_VES::generer_geometrie(std::vector< OT_PARAMETRES* >& vector_params_geometrie)
298     {
299 couturad 919 OT_CPU ot_cpu;
300     ot_cpu.initialise();
301 couturad 951 MSTRUCT_GENERATEUR* generateur=NULL;
302 couturad 919 std::vector<OT_PARAMETRES*>::iterator it;
303     for(it=vector_params_geometrie.begin();it!=vector_params_geometrie.end();it++)
304     {
305     OT_PARAMETRES* param = *it;
306 couturad 968 if(((int)param->get_valeur((char*)"Type_generateur"))==MSTRUCT::TYPE_GENERATEUR::RSA)
307 couturad 919 {
308     std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
309 couturad 951 MSTRUCT_GENERATEUR_RSA *RSA;
310     if(generateur==NULL)
311     {
312     RSA = new MSTRUCT_GENERATEUR_RSA(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
313     generateur=RSA;
314     RSA->active_affichage(fonc_affiche);
315     }
316    
317 couturad 919 double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
318     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
319     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
320     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
321     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
322     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
323     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
324     Boite3D_distribution_Ymin,
325     Boite3D_distribution_Zmin,
326     Boite3D_distribution_Xmax,
327     Boite3D_distribution_Ymax,
328     Boite3D_distribution_Zmax);
329 couturad 951 RSA->change_boite3d_distribution(Boite3D_distribution);
330 couturad 919 double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
331     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
332 couturad 951 double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
333     RSA->change_nb_pas_grille(Nb_pas_X);
334     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
335     RSA->change_distance_inter_volume_min(Distance_min_inter_volume);
336 couturad 919 double Volume_min = param->get_valeur((char*)"Volume_min");
337 couturad 951 RSA->change_volume_min(Volume_min);
338 couturad 919 double Aire_min = param->get_valeur((char*)"Aire_min");
339 couturad 951 RSA->change_aire_min(Aire_min);
340 couturad 919 double Longueur_min = param->get_valeur((char*)"Longueur_min");
341 couturad 951 RSA->change_longueur_min(Longueur_min);
342 couturad 919 double Angle_min = param->get_valeur((char*)"Angle_min");
343 couturad 951 RSA->change_angle_min(Angle_min);
344 couturad 919 double Nb_iteration_max = param->get_valeur((char*)"Nb_iteration_max");
345 couturad 951 RSA->change_nb_iteration_max(Nb_iteration_max);
346     bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
347     RSA->change_intersection_bords_ves(Avec_intersections);
348     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
349 couturad 971 char message[1000];
350     sprintf(message,"Generateur RSA : %s",Nom_groupe_inclusion.c_str());
351     affiche(message);
352 couturad 951 int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
353 couturad 919 double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
354 couturad 951 double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
355     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
356     std::string multicouche = param->get_nom((char*)"Multicouche");
357     PARS_ARGUMENT parse_param[100];
358     PARSE parse;
359     parse.decode(multicouche.c_str(),"@,(&)",parse_param);
360     std::vector<double> *vector_epaisseur=NULL;
361     int nb_couche = atoi(parse_param[0].argument[0].c_str());
362     if(nb_couche>0)
363 couturad 919 {
364 couturad 951 vector_epaisseur=new std::vector<double>;
365     for(int i=0;i<nb_couche;i++)
366     {
367     double epaisseur=atof(parse_param[1].argument[i].c_str());
368     vector_epaisseur->push_back(epaisseur);
369     }
370     }
371 couturad 968 if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::SPHERE)
372 couturad 951 {
373 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
374     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
375     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
376     double fraction_volumique_actuelle=0.0;
377     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);
378 couturad 919 }
379 couturad 968 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::CYLINDRE)
380 couturad 919 {
381 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
382     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
383     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
384     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
385     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
386     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
387     double Mu_theta = param->get_valeur((char*)"Mu_theta");
388     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
389     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
390     double Mu_phi = param->get_valeur((char*)"Mu_phi");
391     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
392     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
393     double fraction_volumique_actuelle=0.0;
394     RSA->tirrage_aleatoire_cylindre(Nom_groupe_inclusion,
395     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
396     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
397     Mu_theta,Sigma_theta,Type_distribution_theta,
398     Mu_phi,Sigma_phi,Type_distribution_phi,
399     Fraction_volumique_cible,Eps_fraction_volumique,fraction_volumique_actuelle,
400     vector_epaisseur,
401     Porosite);
402 couturad 919 }
403 couturad 993 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::ELLIPSOIDE)
404     {
405     double Mu_rayon_majeur = param->get_valeur((char*)"Mu_rayon_majeur");
406     double Sigma_rayon_majeur = param->get_valeur((char*)"Sigma_rayon_majeur");
407     double Type_distribution_rayon_majeur = param->get_valeur((char*)"Type_distribution_rayon_majeur");
408     double Mu_rayon_mineur = param->get_valeur((char*)"Mu_rayon_mineur");
409     double Sigma_rayon_mineur = param->get_valeur((char*)"Sigma_rayon_mineur");
410     double Type_distribution_rayon_mineur = param->get_valeur((char*)"Type_distribution_rayon_mineur");
411     double Mu_theta = param->get_valeur((char*)"Mu_theta");
412     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
413     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
414     double Mu_phi = param->get_valeur((char*)"Mu_phi");
415     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
416     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
417     double fraction_volumique_actuelle=0.0;
418     RSA->tirrage_aleatoire_ellipsoide(Nom_groupe_inclusion,
419     Mu_rayon_majeur,Sigma_rayon_majeur,Type_distribution_rayon_majeur,
420     Mu_rayon_mineur,Sigma_rayon_mineur,Type_distribution_rayon_mineur,
421     Mu_theta,Sigma_theta,Type_distribution_theta,
422     Mu_phi,Sigma_phi,Type_distribution_phi,
423     Fraction_volumique_cible,Eps_fraction_volumique,fraction_volumique_actuelle,
424     vector_epaisseur,
425     Porosite);
426     }
427 couturad 951 if(vector_epaisseur!=NULL) delete vector_epaisseur;
428     }
429 couturad 968 else if(((int)param->get_valeur((char*)"Type_generateur"))==MSTRUCT::TYPE_GENERATEUR::DCR)
430 couturad 951 {
431 couturad 952 #ifdef PROJECT_CHRONO
432 couturad 951 std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
433     MSTRUCT_GENERATEUR_DCR *DCR;
434     if(generateur==NULL)
435     {
436     DCR = new MSTRUCT_GENERATEUR_DCR(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
437     generateur=DCR;
438     DCR->active_affichage(fonc_affiche);
439     }
440     double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
441     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
442     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
443     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
444     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
445     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
446     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
447     Boite3D_distribution_Ymin,
448     Boite3D_distribution_Zmin,
449     Boite3D_distribution_Xmax,
450     Boite3D_distribution_Ymax,
451     Boite3D_distribution_Zmax);
452     DCR->change_boite3d_distribution(Boite3D_distribution);
453     double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
454     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
455     double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
456     DCR->change_nb_pas_grille(Nb_pas_X);
457     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
458     DCR->change_distance_inter_volume_min(Distance_min_inter_volume);
459     double Volume_min = param->get_valeur((char*)"Volume_min");
460     DCR->change_volume_min(Volume_min);
461     double Aire_min = param->get_valeur((char*)"Aire_min");
462     DCR->change_aire_min(Aire_min);
463     double Longueur_min = param->get_valeur((char*)"Longueur_min");
464     DCR->change_longueur_min(Longueur_min);
465     double Angle_min = param->get_valeur((char*)"Angle_min");
466     DCR->change_angle_min(Angle_min);
467 couturad 966 long Nb_iteration_max = (long)param->get_valeur((char*)"Nb_iteration_max");
468 couturad 951 bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
469     DCR->change_intersection_bords_ves(Avec_intersections);
470     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
471 couturad 971 char message[1000];
472     sprintf(message,"Generateur DCR : %s",Nom_groupe_inclusion.c_str());
473     affiche(message);
474 couturad 951 int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
475     double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
476     double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
477     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
478     std::string multicouche = param->get_nom((char*)"Multicouche");
479 couturad 919
480 couturad 960 bool Avec_interface_graphique = (bool)param->get_valeur((char*)"Avec_interface_graphique");
481     double Facteur_reduction_vitesse = param->get_valeur((char*)"Facteur_reduction_vitesse");
482     double Friction = param->get_valeur((char*)"Friction");
483     double Pas_temps_sim = param->get_valeur((char*)"Pas_temps_sim");
484     double Temps_max_sim = param->get_valeur((char*)"Temps_max_sim");
485     double Eps_vitesse = param->get_valeur((char*)"Eps_vitesse");
486     DCR->active_interface_graphique(Avec_interface_graphique);
487     DCR->change_facteur_reduction_vitesse(Facteur_reduction_vitesse);
488     DCR->change_eps_vitesse(Eps_vitesse);
489     DCR->change_friction(Friction);
490     DCR->change_pas_temps(Pas_temps_sim);
491     DCR->change_temps_max_sim(Temps_max_sim);
492 couturad 971
493 couturad 968 if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::SPHERE)
494 couturad 951 {
495 couturad 966 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 couturad 971 DCR->ajouter_spheres(Nom_groupe_inclusion,Mu_rayon,Sigma_rayon,Type_distribution_rayon,Fraction_volumique_cible,Eps_fraction_volumique,Porosite);
499 couturad 966 }
500 couturad 968 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::CYLINDRE)
501 couturad 966 {
502     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
503     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
504     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
505     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
506     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
507     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
508     double Mu_theta = param->get_valeur((char*)"Mu_theta");
509     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
510     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
511     double Mu_phi = param->get_valeur((char*)"Mu_phi");
512     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
513     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
514     DCR->ajouter_cylindres(Nom_groupe_inclusion,
515     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
516     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
517     Mu_theta,Sigma_theta,Type_distribution_theta,
518     Mu_phi,Sigma_phi,Type_distribution_phi,
519 couturad 971 Fraction_volumique_cible,Eps_fraction_volumique,
520     Porosite);
521 couturad 966 }
522 couturad 971 #else
523     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
524     #endif
525     }
526     }
527     if(generateur->get_type()==MSTRUCT::TYPE_GENERATEUR::DCR)
528     {
529     #ifdef PROJECT_CHRONO
530     MSTRUCT_GENERATEUR_DCR *DCR= (MSTRUCT_GENERATEUR_DCR*)generateur;
531     if(DCR->lancer_simulation()==FAIL)
532 couturad 966 {
533     delete generateur;
534 couturad 971 return FAIL;
535 couturad 966 }
536 couturad 971 DCR->generer_geometrie();
537 couturad 952 #else
538     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
539 couturad 971 #endif
540 couturad 919 }
541     ot_cpu.ajouter_etape((char*)"generation_geometrie");
542 couturad 926 double temps_generation_geometrie;
543     ot_cpu.get_etape((char*)"generation_geometrie",temps_generation_geometrie);
544     change_temps_geometrie(get_temps_geometrie()+temps_generation_geometrie);
545 couturad 919 generateur->construire(this);
546     delete generateur;
547     return OK;
548     }
549    
550 couturad 926 int MSTRUCT_VES::generer_materiau(std::vector< OT_PARAMETRES* >& vector_params_materiau)
551 couturad 919 {
552     OT_CPU ot_cpu;
553     ot_cpu.initialise();
554     std::vector<OT_PARAMETRES*>::iterator it;
555     for(it=vector_params_materiau.begin();it!=vector_params_materiau.end();it++)
556     {
557     OT_PARAMETRES* param = *it;
558     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
559 couturad 971 bool Etude_mecanique = (bool)param->get_valeur((char*)"Etude_mecanique");
560     if(Etude_mecanique)
561 couturad 919 {
562 couturad 971 double Mu_E = param->get_valeur((char*)"Mu_E");
563     double Sigma_E = param->get_valeur((char*)"Sigma_E");
564     int Type_distribution_E = (int)param->get_valeur((char*)"Type_distribution_E");
565     double Mu_nu = param->get_valeur((char*)"Mu_nu");
566     double Sigma_nu = param->get_valeur((char*)"Sigma_nu");
567     int Type_distribution_nu = (int)param->get_valeur((char*)"Type_distribution_nu");
568     std::random_device seed;
569     std::mt19937_64 generateur(seed());
570     std::uniform_real_distribution<double> uniform_distribution_E(Mu_E-Sigma_E,Mu_E+Sigma_E);
571     std::normal_distribution<double> normal_distribution_E(Mu_E,Sigma_E);
572     std::uniform_real_distribution<double> uniform_distribution_nu(Mu_nu-Sigma_nu,Mu_nu+Sigma_nu);
573     std::normal_distribution<double> normal_distribution_nu(Mu_nu,Sigma_nu);
574     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
575     std::map<long,MG_CG_FORME*>::iterator it_forme;
576     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))
577 couturad 919 {
578 couturad 971 double E;
579     if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::FIXE) E=Mu_E;
580     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) E=uniform_distribution_E(generateur);
581     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) E=normal_distribution_E(generateur);
582     double nu;
583     if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::FIXE) nu=Mu_nu;
584     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) nu=uniform_distribution_nu(generateur);
585     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) nu=normal_distribution_nu(generateur);
586     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
587     {
588     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
589     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",E);
590     forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",nu);
591     }
592     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
593     {
594     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
595     std::map<long,MG_VOLUME*>::iterator it_volume;
596     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))
597     {
598     volume->ajouter_ccf((char*)"Em",E);
599     volume->ajouter_ccf((char*)"nu",nu);
600     }
601     }
602 couturad 919 }
603 couturad 971 }
604     bool Etude_thermique = (bool)param->get_valeur((char*)"Etude_thermique");
605     if(Etude_thermique)
606     {
607     double Mu_Lambda = param->get_valeur((char*)"Mu_Lambda");
608     double Sigma_Lambda = param->get_valeur((char*)"Sigma_Lambda");
609     int Type_distribution_Lambda = (int)param->get_valeur((char*)"Type_distribution_Lambda");
610     double Mu_Ro = param->get_valeur((char*)"Mu_Ro");
611     double Sigma_Ro = param->get_valeur((char*)"Sigma_Ro");
612     int Type_distribution_Ro = (int)param->get_valeur((char*)"Type_distribution_Ro");
613     double Mu_Cp = param->get_valeur((char*)"Mu_Cp");
614     double Sigma_Cp = param->get_valeur((char*)"Sigma_Cp");
615     int Type_distribution_Cp = (int)param->get_valeur((char*)"Type_distribution_Cp");
616     std::random_device seed;
617     std::mt19937_64 generateur(seed());
618     std::uniform_real_distribution<double> uniform_distribution_Lambda(Mu_Lambda-Sigma_Lambda,Mu_Lambda+Sigma_Lambda);
619     std::normal_distribution<double> normal_distribution_Lambda(Mu_Lambda,Sigma_Lambda);
620     std::uniform_real_distribution<double> uniform_distribution_Ro(Mu_Ro-Sigma_Ro,Mu_Ro+Sigma_Ro);
621     std::normal_distribution<double> normal_distribution_Ro(Mu_Ro,Sigma_Ro);
622     std::uniform_real_distribution<double> uniform_distribution_Cp(Mu_Cp-Sigma_Cp,Mu_Cp+Sigma_Cp);
623     std::normal_distribution<double> normal_distribution_Cp(Mu_Cp,Sigma_Cp);
624     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
625     std::map<long,MG_CG_FORME*>::iterator it_forme;
626     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))
627 couturad 919 {
628 couturad 971 double Lambda;
629     if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Lambda=Mu_Lambda;
630     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Lambda=uniform_distribution_Lambda(generateur);
631     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Lambda=normal_distribution_Lambda(generateur);
632     double Ro;
633     if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Ro=Mu_Ro;
634     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Ro=uniform_distribution_Ro(generateur);
635     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Ro=normal_distribution_Ro(generateur);
636     double Cp;
637     if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Cp=Mu_Cp;
638     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Cp=uniform_distribution_Cp(generateur);
639     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Cp=normal_distribution_Cp(generateur);
640     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
641     {
642     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
643     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Kx",Lambda);
644     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Ro",Ro);
645     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Cp",Cp);
646     }
647     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
648     {
649     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
650     std::map<long,MG_VOLUME*>::iterator it_volume;
651     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))
652     {
653     volume->ajouter_ccf((char*)"Kx",Lambda);
654     volume->ajouter_ccf((char*)"Ro",Ro);
655     volume->ajouter_ccf((char*)"Cp",Cp);
656     }
657     }
658 couturad 919 }
659     }
660 couturad 971 }
661 couturad 919 ot_cpu.ajouter_etape((char*)"generation_materiau");
662 couturad 926 double temps_generation_materiau;
663     ot_cpu.get_etape((char*)"generation_materiau",temps_generation_materiau);
664     change_temps_materiau(get_temps_materiau()+temps_generation_materiau);
665 couturad 919 return OK;
666     }
667    
668 couturad 926 int MSTRUCT_VES::generer_carte(OT_PARAMETRES *param)
669 couturad 919 {
670     double Ecart_nodal = param->get_valeur((char*)"Ecart_nodal");
671 couturad 937 double Ecart_nodal_face_particule = param->get_valeur((char*)"Ecart_nodal_face_particule");
672 couturad 919 double Fechantillonnage = param->get_valeur((char*)"Fechantillonnage");
673     double Nb_cellule_direction = param->get_valeur((char*)"Nb_cellule_direction");
674     std::string Nom_fem_solution = param->get_nom((char*)"Nom_fem_solution");
675     std::string Nom_mg_gestionnaire_carte = param->get_nom((char*)"Nom_mg_gestionnaire_carte");
676     std::string Nom_carte = param->get_nom((char*)"Nom_carte");
677     double Nb_couche_min = param->get_valeur((char*)"Nb_couche_min");
678     double Nb_pas = param->get_valeur((char*)"Nb_pas");
679     double Facteur_augmentation = param->get_valeur((char*)"Facteur_augmentation");
680     MG_GESTIONNAIRE *mggest_carte = new MG_GESTIONNAIRE;
681 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_matrice = m_mgcg_modele->get_mgcg_groupe_forme((char*)"Matrice");
682     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume_matrice = mgcg_groupe_matrice->get_tpl_map_volume();
683 couturad 919 OT_CPU ot_cpu;
684     ot_cpu.initialise();
685     FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE *carte = new FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE(mggest_carte,
686     m_mg_geometrie,
687     Ecart_nodal,
688 couturad 937 Ecart_nodal_face_particule,
689 couturad 919 Fechantillonnage,
690     Nb_cellule_direction,
691     (char*)Nom_fem_solution.c_str(),
692     tpl_map_volume_matrice,
693     Nb_couche_min,
694     Nb_pas,
695     Facteur_augmentation);
696 couturad 926
697    
698 couturad 933 carte->active_affichage(fonc_affiche);
699 couturad 926 carte->construit();
700 couturad 919 ot_cpu.ajouter_etape((char*)"generation_carte");
701 couturad 926 double temps_generation_carte;
702     ot_cpu.get_etape((char*)"generation_carte",temps_generation_carte);
703     change_temps_carte(get_temps_carte()+temps_generation_carte);
704     mggest_carte->enregistrer(Nom_mg_gestionnaire_carte.c_str());
705 couturad 919 carte->enregistrer((char*)Nom_carte.c_str());
706 couturad 964 char message[1000];
707     std::sprintf(message,"Fichier CARTE de sortie : %s",Nom_carte.c_str());
708     affiche(message);
709 couturad 926 m_ves_file->change_nom_fichier_carte((char*)Nom_carte.c_str());
710 couturad 919 return OK;
711     }
712    
713 couturad 926 int MSTRUCT_VES::generer_maillage(OT_PARAMETRES *param,FCT_TAILLE_FEM_SOLUTION* carte)
714 couturad 919 {
715     OT_CPU ot_cpu;
716     ot_cpu.initialise();
717     int Niveau = (int)param->get_valeur((char*)"Niveau");
718     int Niveau_opt_2d = (int)param->get_valeur((char*)"Niveau_opt_2d");
719     int Niveau_opt_3d = (int)param->get_valeur((char*)"Niveau_opt_3d");
720     double Priorite_metrique = param->get_valeur((char*)"Priorite_metrique");
721 couturad 1029 int Analyse = (int)param->get_valeur((char*)"Analyse");
722     int Grille_reguliere = (int)param->get_valeur((char*)"Grille_reguliere");
723     int Gr_nx = param->get_valeur((char*)"Gr_nx");
724     int Gr_ny = param->get_valeur((char*)"Gr_ny");
725     int Gr_nz = param->get_valeur((char*)"Gr_nz");
726     affiche((char*)"Maillage du VER :");
727     if(!Grille_reguliere)
728 couturad 919 {
729 couturad 1029 m_mg_maillage = new MG_MAILLAGE(m_mg_geometrie);
730     m_mg_gestionnaire->ajouter_mg_maillage(m_mg_maillage);
731     change_mg_maillage(m_mg_maillage);
732     affiche((char*)"Maillage 3D_couche :");
733     MAILLEUR3D_COUCHE m3d_couche(m_mg_maillage,m_mg_geometrie,carte);
734     m3d_couche.active_affichage(fonc_affiche);
735     LISTE_MG_VOLUME::iterator it_volume;
736     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
737 couturad 951 {
738 couturad 1029 if(volume->est_mince())
739     {
740     char message[1000];
741     sprintf(message,"-> Maillage du volume id %li",volume->get_id());
742     affiche(message);
743     if(m3d_couche.maille(volume)==FAIL) return FAIL;
744     }
745 couturad 951 }
746 couturad 1029 if(Niveau>=0)
747 couturad 951 {
748 couturad 1029 long i=1;
749     long nb=m_mg_geometrie->get_nb_mg_sommet();
750     MAILLEUR0D m0d(m_mg_maillage,m_mg_geometrie);
751     affiche((char*)"Maillage 0D :");
752     LISTE_MG_SOMMET::iterator it_sommet;
753     for(MG_SOMMET* sommet=m_mg_geometrie->get_premier_sommet(it_sommet);sommet!=NULL;sommet=m_mg_geometrie->get_suivant_sommet(it_sommet))
754     {
755     if(sommet->get_lien_maillage()->get_nb()>0) continue;
756     char message[1000];
757     sprintf(message,"[%4li/%li] Maillage du sommet id %li",i,nb,sommet->get_id());
758     affiche(message);
759     if(m0d.maille(sommet)==FAIL) return FAIL;
760     i++;
761     }
762 couturad 951 }
763 couturad 1029 if(Niveau>=1)
764 couturad 951 {
765 couturad 1029 long i=1;
766     long nb=m_mg_geometrie->get_nb_mg_arete();
767     MAILLEUR1D m1d(m_mg_maillage,m_mg_geometrie,carte);
768     affiche((char*)"Maillage 1D :");
769     m1d.active_affichage(fonc_affiche);
770     LISTE_MG_ARETE::iterator it_arete;
771     for(MG_ARETE* arete=m_mg_geometrie->get_premier_arete(it_arete);arete!=NULL;arete=m_mg_geometrie->get_suivant_arete(it_arete))
772     {
773     if(arete->get_lien_maillage()->get_nb()>0) continue;
774     char message[1000];
775     sprintf(message,"[%4li/%li] Maillage de l'arete id %li",i,nb,arete->get_id());
776     affiche(message);
777     if(m1d.maille(arete)==FAIL) return FAIL;
778     i++;
779     }
780 couturad 951 }
781 couturad 1029 if(Niveau>=2)
782 couturad 951 {
783 couturad 1029 long i=1;
784     long nb=m_mg_geometrie->get_nb_mg_face();
785     MAILLEUR2D m2d(m_mg_maillage,m_mg_geometrie,carte);
786     m2d.change_niveau_optimisation(Niveau_opt_2d);
787     m2d.change_priorite_metrique(Priorite_metrique);
788     affiche((char*)"Maillage 2D :");
789     m2d.active_affichage(fonc_affiche);
790     LISTE_MG_FACE::iterator it_face;
791     for(MG_FACE* face=m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
792     {
793     if(face->get_lien_maillage()->get_nb()>0) continue;
794     char message[1000];
795     sprintf(message,"[%4li/%li] Maillage de la face id %li",i,nb,face->get_id());
796     affiche(message);
797     if(m2d.maille(face)==FAIL) return FAIL;
798     i++;
799     }
800 couturad 951 }
801 couturad 1029 if(Niveau>=3)
802 couturad 951 {
803 couturad 1029 long i=1;
804     long nb=m_mg_geometrie->get_nb_mg_volume();
805     MAILLEUR3D m3d(m_mg_maillage,m_mg_geometrie,carte,false);
806     m3d.change_niveau_optimisation(Niveau_opt_3d);
807     m3d.change_priorite_metrique(Priorite_metrique);
808     affiche((char*)"Maillage 3D :");
809     m3d.active_affichage(fonc_affiche);
810     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
811     {
812     if(volume->get_lien_maillage()->get_nb()>0) continue;
813     if(volume->est_mince()) continue;
814     char message[1000];
815     sprintf(message,"[%4li/%li] Maillage du volume id %li",i,nb,volume->get_id());
816     affiche(message);
817     if(m3d.maille(volume)==FAIL) return FAIL;
818     i++;
819     }
820 couturad 951 }
821     }
822 couturad 1029 else
823     {
824     maill_struct(0.0,1.0,0.0,1.0,0.0,1.0,Gr_nx,Gr_ny,Gr_nz);
825     m_mg_maillage=m_mg_gestionnaire->get_mg_maillage(m_mg_gestionnaire->get_nb_mg_maillage()-1);
826     change_mg_maillage(m_mg_maillage);
827     LISTE_MG_HEXA::iterator it_hexa;
828     // TPL_MAP_ENTITE<MG_HEXA*> tpl_map_hexa;
829     TPL_GRILLE<MG_HEXA*> tpl_grille_hexa;
830     tpl_grille_hexa.initialiser(-0.1,-0.1,-0.1,1.1,1.1,1.1,20,20,20);
831     for(MG_HEXA* hexa=m_mg_maillage->get_premier_hexa(it_hexa);hexa!=NULL;hexa=m_mg_maillage->get_suivant_hexa(it_hexa))
832     {
833     // tpl_map_hexa.ajouter(hexa);
834     tpl_grille_hexa.inserer(hexa);
835     hexa->change_nouveau_numero(-1);
836     }
837     long i_volume=0;
838     long nb_volume=m_mg_geometrie->get_nb_mg_volume();
839     LISTE_MG_VOLUME::iterator it_volume;
840     for(MG_VOLUME*vol=m_mg_geometrie->get_premier_volume(it_volume);vol!=NULL;vol=m_mg_geometrie->get_suivant_volume(it_volume))
841     {
842     TPL_MAP_ENTITE<MG_HEXA*> hexa_trouve;
843     tpl_grille_hexa.rechercher(vol->get_boite_3D(),hexa_trouve);
844     for(MG_HEXA* hexa=hexa_trouve.get_premier(it_hexa);hexa!=NULL;hexa=hexa_trouve.get_suivant(it_hexa))
845     {
846     if(hexa->get_nouveau_numero()<0)
847     {
848     BOITE_3D boite3d=hexa->get_boite_3D();
849     double xyz[3];
850     boite3d.get_centre(xyz);
851     if(OT_GEOMETRIE::est_dans_mg_volume(xyz,vol)==1)
852     {
853     hexa->change_lien_topologie2(vol);
854     vol->get_lien_maillage()->ajouter(hexa);
855     hexa->change_nouveau_numero(vol->get_id());
856     }
857     }
858     }
859     i_volume++;
860     std::cout << i_volume << "/" << nb_volume << std::endl;
861     }
862    
863    
864     // maill_struct(0.0,1.0,0.0,1.0,0.0,1.0,Gr_nx,Gr_ny,Gr_nz);
865     // m_mg_maillage=m_mg_gestionnaire->get_mg_maillage(m_mg_gestionnaire->get_nb_mg_maillage()-1);
866     // change_mg_maillage(m_mg_maillage);
867     // LISTE_MG_HEXA::iterator it_hexa;
868     // long nb_hexa=m_mg_maillage->get_nb_mg_hexa();
869     // long i_hexa=0;
870     // for(MG_HEXA* hexa=m_mg_maillage->get_premier_hexa(it_hexa);hexa!=NULL;hexa=m_mg_maillage->get_suivant_hexa(it_hexa))
871     // {
872     // BOITE_3D boite3d=hexa->get_boite_3D();
873     // double xyz[3];
874     // boite3d.get_centre(xyz);
875     // LISTE_MG_VOLUME::iterator it_volume;
876     // for(MG_VOLUME*vol=m_mg_geometrie->get_premier_volume(it_volume);vol!=NULL;vol=m_mg_geometrie->get_suivant_volume(it_volume))
877     // {
878     // // if(vol->get_boite_3D().contient(xyz[0],xyz[1],xyz[2]))
879     // if(OT_GEOMETRIE::est_dans_mg_volume(xyz,vol)==1)
880     // {
881     // // hexa->change_lien_topologie(vol);
882     // hexa->change_lien_topologie2(vol);
883     // vol->get_lien_maillage()->ajouter(hexa);
884     // break;
885     // }
886     //
887     // }
888     // i_hexa++;
889     // std::cout << i_hexa << "/" << nb_hexa << std::endl;
890     // }
891    
892    
893    
894    
895    
896     // TPL_GRILLE<MG_VOLUME*> tpl_grille_volume;
897     // tpl_grille_volume.initialiser(0.0,0.0,0.0,1.0,1.0,1.0,20,20,20);
898     // LISTE_MG_VOLUME::iterator it_volume;
899     // for(MG_VOLUME*vol=m_mg_geometrie->get_premier_volume(it_volume);vol!=NULL;vol=m_mg_geometrie->get_suivant_volume(it_volume))
900     // {
901     // tpl_grille_volume.inserer(vol);
902     // }
903     // // MAILLEUR3D_STRUCTURE m3d_struc(0.0,0.0,0.0,1.0,1.0,1.0,Gr_nx,Gr_ny,Gr_nz,m_mg_gestionnaire);
904     // // m3d_struc.maille(NULL);
905     // maill_struct(0.0,1.0,0.0,1.0,0.0,1.0,Gr_nx,Gr_ny,Gr_nz);
906     // m_mg_maillage=m_mg_gestionnaire->get_mg_maillage(m_mg_gestionnaire->get_nb_mg_maillage()-1);
907     // change_mg_maillage(m_mg_maillage);
908     // LISTE_MG_HEXA::iterator it_hexa;
909     // long nb_hexa=m_mg_maillage->get_nb_mg_hexa();
910     // long i_hexa=0;
911     // for(MG_HEXA* hexa=m_mg_maillage->get_premier_hexa(it_hexa);hexa!=NULL;hexa=m_mg_maillage->get_suivant_hexa(it_hexa))
912     // {
913     // BOITE_3D boite3d=hexa->get_boite_3D();
914     // double xyz[3];
915     // boite3d.get_centre(xyz);
916     // TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_vol_trouve;
917     // tpl_grille_volume.rechercher(boite3d,tpl_map_vol_trouve);
918     // TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_trouve;
919     // std::cout << tpl_map_vol_trouve.get_nb() << std::endl;
920     // if(tpl_map_vol_trouve.get_nb()==1)
921     // {
922     // hexa->change_lien_topologie(tpl_map_vol_trouve.get_premier(it_trouve));
923     // }
924     // else
925     // {
926     //
927     // for(MG_VOLUME* ele_top_trouve=tpl_map_vol_trouve.get_premier(it_trouve);ele_top_trouve!=NULL;ele_top_trouve=tpl_map_vol_trouve.get_suivant(it_trouve))
928     // {
929     // if(OT_GEOMETRIE::est_dans_mg_volume(xyz,ele_top_trouve)==1)
930     // {
931     // hexa->change_lien_topologie(ele_top_trouve);
932     // break;
933     // }
934     // }
935     // }
936     // i_hexa++;
937     // std::cout << i_hexa << "/" << nb_hexa << std::endl;
938     //
939     // }
940     }
941 couturad 919 ot_cpu.ajouter_etape((char*)"generation_maillage");
942 couturad 926 double temps_generation_maillage;
943     ot_cpu.get_etape((char*)"generation_maillage",temps_generation_maillage);
944     change_temps_maillage(get_temps_maillage()+temps_generation_maillage);
945 couturad 919 return OK;
946     }
947    
948 couturad 1029 int MSTRUCT_VES::maill_struct(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int n, int m, int k)
949     {
950    
951     affiche((char*)"Création d'un maillage MG structuré");
952     double intx, inty, intz;
953     std::vector<double> tabx,taby,tabz;
954    
955     intx=fabs(xmax-xmin)/n;
956     inty=fabs(ymax-ymin)/m;
957     intz=fabs(zmax-zmin)/k;
958    
959    
960    
961     MG_GEOMETRIE* geo= m_mg_geometrie;
962    
963     MG_MAILLAGE* mai=new MG_MAILLAGE(geo);
964     m_mg_gestionnaire->ajouter_mg_maillage(mai);
965     std::vector<MG_NOEUD*> vecnod;
966     for (int l=0; l<=k ;l++)
967     {
968     for (int j=0; j<=m;j++)
969     {
970     for (int i=0; i<=n;i++)
971     {
972     MG_ELEMENT_TOPOLOGIQUE *topo=NULL;
973    
974     double x,y,z;
975    
976     z=zmin+(l*intz);
977     y=ymin+(j*inty);
978     x=xmin+(i*intx);
979    
980    
981     MG_NOEUD* nou=mai->ajouter_mg_noeud(topo,x,y,z,MAGIC::ORIGINE::MAILLEUR_AUTO);
982     vecnod.push_back(nou);
983     }
984     }
985     }
986     for(int l=0; l<k;l++)
987     {
988     for(int j=0; j<m;j++)
989     {
990     for(int i=0; i<n;i++)
991     {
992     MG_NOEUD* nod1=vecnod[i+((n+1)*j)+(l*(m+1)*(n+1))];
993     MG_NOEUD* nod2=vecnod[(i+1)+((n+1)*j)+(l*(m+1)*(n+1))];
994     MG_NOEUD* nod3=vecnod[(i+1)+(n+1)*(j+1)+(l*(m+1)*(n+1))];
995     MG_NOEUD* nod4=vecnod[i+(n+1)*(j+1)+(l*(m+1)*(n+1))];
996     MG_NOEUD* nod5=vecnod[i+((n+1)*j)+((l+1)*(m+1)*(n+1))];
997     MG_NOEUD* nod6=vecnod[(i+1)+((n+1)*j)+((l+1)*(m+1)*(n+1))];
998     MG_NOEUD* nod7=vecnod[(i+1)+(n+1)*(j+1)+((l+1)*(m+1)*(n+1))];
999     MG_NOEUD* nod8=vecnod[i+(n+1)*(j+1)+((l+1)*(m+1)*(n+1))];
1000     MG_HEXA *hexa=mai->ajouter_mg_hexa(NULL,nod1,nod2,nod3,nod4,nod5,nod6,nod7,nod8,MAGIC::ORIGINE::MAILLEUR_AUTO);
1001     }
1002     }
1003     }
1004     // BOITE_3D b(xmin,ymin,zmin,xmax,ymax,zmax);
1005     // mai->change_param_structure(b,n,m,k);
1006     /*affiche((char*)"Création d'un maillage FEM structuré");
1007     FEM_MAILLAGE* fem = new FEM_MAILLAGE(geo, mai,1);
1008     gest->ajouter_fem_maillage(fem);
1009     fem->construire();*/
1010     return OK;
1011     }
1012    
1013    
1014 couturad 926 int MSTRUCT_VES::generer_fem_maillage(OT_PARAMETRES *param)
1015 couturad 919 {
1016     OT_CPU ot_cpu;
1017     ot_cpu.initialise();
1018     int Degre = (int)param->get_valeur((char*)"Degre");
1019     int Analyse = (int)param->get_valeur((char*)"Analyse");
1020     int Optimisation_num_noeud = (int)param->get_valeur((char*)"Optimisation_num_noeud");
1021     MAILLEUR_FEM mailleurfem;
1022     mailleurfem.active_affichage(fonc_affiche);
1023 couturad 926 m_fem_maillage = new FEM_MAILLAGE(m_mg_maillage->get_mg_geometrie(),m_mg_maillage,Degre);
1024 couturad 919 m_mg_gestionnaire->ajouter_fem_maillage(m_fem_maillage);
1025 couturad 926 change_fem_maillage(m_fem_maillage);
1026 couturad 966 if(Optimisation_num_noeud) {if(mailleurfem.maille(m_fem_maillage,1)==FAIL) return FAIL;}
1027     else {if(mailleurfem.maille(m_fem_maillage,0)==FAIL) return FAIL;};
1028 couturad 919 if(Analyse)
1029     {
1030     MAILLEUR_ANALYSE m3d(m_fem_maillage);
1031     m3d.active_affichage(fonc_affiche);
1032     // m3d.analyse();
1033     }
1034     ot_cpu.ajouter_etape((char*)"generation_fem_maillage");
1035 couturad 926 double temps_generation_fem_maillage;
1036     ot_cpu.get_etape((char*)"generation_fem_maillage",temps_generation_fem_maillage);
1037     change_temps_fem_maillage(get_temps_fem_maillage()+temps_generation_fem_maillage);
1038 couturad 919 return OK;
1039     }
1040    
1041 couturad 926 int MSTRUCT_VES::generer_etude(OT_PARAMETRES *param)
1042 couturad 919 {
1043     OT_CPU ot_cpu;
1044     ot_cpu.initialise();
1045 couturad 926 BOITE_3D boite3D_ves = get_boite3d_ves();
1046     double eps = get_precision();
1047 couturad 982 int Type_etude = (int)param->get_valeur((char*)"Type_etude");
1048     int Type_Chargement = (int)param->get_valeur((char*)"Type_Chargement");
1049     int Type_CL = (int)param->get_valeur((char*)"Type_CL");
1050     double Valeur_CL = param->get_valeur((char*)"Valeur_CL");
1051     int Direction = (int)param->get_valeur((char*)"Direction");
1052     MSTRUCT_OUTILS::appliquer_conditions_limites(m_mg_geometrie,boite3D_ves,Type_etude,Type_CL,Type_Chargement,Valeur_CL,Direction,eps);
1053 couturad 919 ot_cpu.ajouter_etape((char*)"generation_etude");
1054 couturad 926 double temps_generation_etude;
1055     ot_cpu.get_etape((char*)"generation_etude",temps_generation_etude);
1056     change_temps_etude(get_temps_etude()+temps_generation_etude);
1057 couturad 919 return OK;
1058     }
1059    
1060 couturad 968 int MSTRUCT_VES::generer_calcul(OT_PARAMETRES *param,char* param_aster,std::string nom_etude)
1061 couturad 919 {
1062     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
1063 couturad 971 int Type_calcul;
1064     if(Type_etude==MSTRUCT::TYPE_ETUDE::MECANIQUE) Type_calcul=MAGIC::CALCUL_ASTER::ELASTIQUE;
1065     else if(Type_etude==MSTRUCT::TYPE_ETUDE::THERMIQUE) Type_calcul=MAGIC::CALCUL_ASTER::THERMIQUE;
1066 couturad 919 std::string Code_resu = param->get_nom((char*)"Code_resu");
1067     MGASTER mgaster;
1068     mgaster.active_affichage(fonc_affiche);
1069     OT_CPU ot_cpu;
1070     ot_cpu.initialise();
1071 couturad 968 mgaster.calcule(param_aster,m_fem_maillage,(char*)nom_etude.c_str(),Type_calcul,(char*)Code_resu.c_str());
1072 couturad 919 ot_cpu.ajouter_etape((char*)"calcul");
1073 couturad 926 double temps_calcul;
1074     ot_cpu.get_etape((char*)"calcul",temps_calcul);
1075     change_temps_calcul(get_temps_calcul()+temps_calcul);
1076 couturad 919 }
1077    
1078 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement)
1079 couturad 919 {
1080 couturad 926 OT_CPU ot_cpu;
1081     ot_cpu.initialise();
1082     std::vector<OT_PARAMETRES*>::iterator it;
1083 couturad 968 char ligne[1000];
1084     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1085 couturad 919 {
1086 couturad 926 OT_PARAMETRES* param = *it;
1087 couturad 968 int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1088 couturad 926 std::string Identifiant = param->get_nom((char*)"Identifiant");
1089     if(get_analyse(Identifiant)!=NULL)
1090     {
1091     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1092     continue;
1093     }
1094     sprintf(ligne,"-> %s",Identifiant.c_str());
1095     affiche(ligne);
1096 couturad 968 if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP)
1097 couturad 926 {
1098     long Num_solution = (long)param->get_valeur((char*)"Num_solution");
1099 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1100     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1101     BOITE_3D *boite_3d_analyse=NULL;
1102     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1103     if(Boite_analyse)
1104     {
1105     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1106     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1107     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1108     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1109     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1110     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1111     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1112     }
1113     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1114 couturad 926 FEM_SOLUTION* sol = m_mg_gestionnaire->get_fem_solution(Num_solution);
1115     int nb_champ = sol->get_nb_champ();
1116 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);
1117     if(Analyse_erosion)
1118 couturad 930 {
1119 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1120     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1121     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_champ,Nb_couche,Epaisseur_couche);
1122     analyse_erosion->executer();
1123     ajouter_analyse(analyse_erosion);
1124 couturad 930 }
1125     else
1126     {
1127 couturad 968 analyse_champ->executer();
1128     ajouter_analyse(analyse_champ);
1129 couturad 930 }
1130 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1131     }
1132     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION)
1133 couturad 926 {
1134 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1135     int Avec_fem_maillage = (int)param->get_valeur((char*)"Avec_fem_maillage");
1136     BOITE_3D *boite_3d_analyse=NULL;
1137     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1138     if(Boite_analyse)
1139 couturad 930 {
1140 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1141     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1142     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1143     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1144     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1145     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1146     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1147 couturad 930 }
1148 couturad 968 MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION(this,Identifiant,Nom_groupe_forme,boite_3d_analyse,Avec_fem_maillage);
1149     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1150     if(Analyse_erosion)
1151 couturad 930 {
1152 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1153     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1154     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
1155     analyse_erosion->executer();
1156     ajouter_analyse(analyse_erosion);
1157 couturad 930 }
1158 couturad 938 else
1159     {
1160 couturad 968 analyse_orientation->executer();
1161     ajouter_analyse(analyse_orientation);
1162 couturad 938 }
1163 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1164 couturad 938 }
1165 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CAO)
1166 couturad 926 {
1167 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1168 couturad 926 double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
1169 couturad 968 MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(this,Identifiant,Largeur_colonne_distribution_volume_forme,Nom_groupe_forme);
1170     analyse_cao->executer();
1171     ajouter_analyse(analyse_cao);
1172 couturad 926 }
1173 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_PROPRIETE_MASSIQUE)
1174     {
1175     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1176     MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE* analyse_prop_mass = new MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE(this,Identifiant,Nom_groupe_forme);
1177     analyse_prop_mass->executer();
1178     ajouter_analyse(analyse_prop_mass);
1179     }
1180 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_MG)
1181 couturad 926 {
1182 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1183 couturad 926 double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
1184     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
1185     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
1186     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
1187 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1188     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1189     if(Boite_analyse)
1190 couturad 930 {
1191 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1192     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1193     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1194     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1195     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1196     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1197     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1198 couturad 930 }
1199 couturad 968 MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(this,
1200     Identifiant,
1201     m_mg_maillage->get_id(),
1202     Largeur_colonne_distribution_qualite_2D,
1203     Largeur_colonne_distribution_taille_2D,
1204     Largeur_colonne_distribution_qualite_3D,
1205     Largeur_colonne_distribution_taille_3D,
1206     Nom_groupe_forme,boite_3d_analyse);
1207     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1208     if(Analyse_erosion)
1209     {
1210     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1211     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1212     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
1213     analyse_erosion->executer();
1214     ajouter_analyse(analyse_erosion);
1215     }
1216 couturad 930 else
1217     {
1218 couturad 968 analyse_mg_maillage->executer();
1219     ajouter_analyse(analyse_mg_maillage);
1220 couturad 930 }
1221 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1222 couturad 926 }
1223 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_FEM)
1224 couturad 926 {
1225 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1226 couturad 926 double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
1227     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
1228     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
1229     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
1230     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
1231     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
1232 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1233     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1234     if(Boite_analyse)
1235     {
1236     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1237     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1238     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1239     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1240     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1241     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1242     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1243     }
1244     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(this,
1245     Identifiant,
1246 couturad 926 m_fem_maillage->get_id(),
1247     Largeur_colonne_distribution_jacobien_2D_min,
1248     Largeur_colonne_distribution_jacobien_2D_max,
1249     Largeur_colonne_distribution_jacobien_3D_min,
1250     Largeur_colonne_distribution_jacobien_3D_max,
1251     Largeur_colonne_distribution_distortion_2D,
1252     Largeur_colonne_distribution_distortion_3D,
1253     Nom_groupe_forme,
1254     boite_3d_analyse);
1255 couturad 968 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1256     if(Analyse_erosion)
1257 couturad 930 {
1258 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1259     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1260     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
1261     analyse_erosion->executer();
1262     ajouter_analyse(analyse_erosion);
1263 couturad 930 }
1264     else
1265     {
1266 couturad 968 analyse_maillage_fem->executer();
1267     ajouter_analyse(analyse_maillage_fem);
1268 couturad 930 }
1269 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1270 couturad 926 }
1271 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_NORMALISE)
1272     {
1273     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1274 couturad 982 std::string Identifiant_champ_reference = param->get_nom((char*)"Identifiant_champ_reference");
1275 couturad 968 double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1276     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1277     {
1278     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1279 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ_reference);
1280     double valeur_ref=0.0;
1281     int nb_champ=analyse_champ_reference->get_nb_champ();
1282 couturad 997 for(int i=0;i<nb_champ;i++)
1283     {
1284     valeur_ref+=analyse_champ_reference->get_moyenne()[i]*analyse_champ_reference->get_moyenne()[i];
1285     }
1286     valeur_ref=sqrt(valeur_ref);
1287     // 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]);
1288 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1289 couturad 968 ajouter_analyse(analyse_normalise);
1290     }
1291     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1292     {
1293     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1294     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1295     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1296     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1297     MSTRUCT_ANALYSE_EROSION* analyse_erosion_normalise = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1298     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1299 couturad 982 int k=0;
1300     double valeur_ref=0.0;
1301 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))
1302     {
1303 couturad 982 if(k==0)
1304     {
1305     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion_reference;
1306     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ_reference = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ_reference);
1307     MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_champ_reference->get_premiere_analyse(it_analyse_erosion_reference);
1308     int nb_champ=analyse_champ_reference->get_nb_champ();
1309 couturad 1000 for(int i=0;i<nb_champ;i++)
1310     {
1311     valeur_ref+=analyse_champ_reference->get_moyenne()[i]*analyse_champ_reference->get_moyenne()[i];
1312     }
1313     valeur_ref=sqrt(valeur_ref);
1314 couturad 982 }
1315 couturad 968 MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1316 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1317 couturad 968 analyse_erosion_normalise->ajouter_analyse(analyse_normalise);
1318 couturad 982 k++;
1319 couturad 968 }
1320     ajouter_analyse(analyse_erosion_normalise);
1321     }
1322     }
1323     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART)
1324     {
1325     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1326     if(get_analyse(Identifiant_champ)==NULL)
1327     {
1328     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1329     return FAIL;
1330     }
1331     std::string Identifiant_champ_compare = param->get_nom((char*)"Identifiant_champ_compare");
1332     if(get_analyse(Identifiant_champ_compare)==NULL)
1333     {
1334     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1335     return FAIL;
1336     }
1337     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1338     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1339     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1340     {
1341     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1342     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1343     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1344     {
1345     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1346     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1347     ajouter_analyse(analyse_ecart);
1348     }
1349     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1350     {
1351     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1352     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1353     if(Num_couche>=0)
1354     {
1355     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1356     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1357     ajouter_analyse(analyse_ecart);
1358     }
1359     else
1360     {
1361     double epaisseur_couche = analyse_erosion_compare->get_epaisseur_couche();
1362     std::string Nom_groupe_forme = analyse_erosion_compare->get_nom_groupe_forme();
1363     BOITE_3D *boite_3d_analyse=analyse_erosion_compare->get_boite_analyse();
1364     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1365     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1366     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))
1367     {
1368     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,(MSTRUCT_ANALYSE_CHAMP*)analyse_champ_compare,Type_ecart);
1369     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1370     }
1371     ajouter_analyse(analyse_erosion_ecart);
1372     }
1373    
1374     }
1375     }
1376     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1377     {
1378     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1379     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1380     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1381     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1382     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1383     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1384     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))
1385     {
1386     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1387     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1388     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1389     {
1390     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1391     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1392     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1393     }
1394     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1395     {
1396     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1397     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1398     if(Num_couche>=0)
1399     {
1400     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1401     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1402     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1403     }
1404     else
1405     {
1406    
1407     }
1408    
1409     }
1410     }
1411     ajouter_analyse(analyse_erosion_ecart);
1412     }
1413     }
1414     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART_CHARGEMENT)
1415     {
1416     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1417     if(get_analyse(Identifiant_champ)==NULL)
1418     {
1419     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1420     return FAIL;
1421     }
1422     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1423     int Type_chargement = (int)param->get_valeur((char*)"Type_chargement");
1424     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1425     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1426     {
1427     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1428     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1429     ajouter_analyse(analyse_ecart);
1430     }
1431     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1432     {
1433     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1434     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1435     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1436     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1437     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1438     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1439     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))
1440     {
1441     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1442     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1443     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1444     }
1445     ajouter_analyse(analyse_erosion_ecart);
1446     }
1447     }
1448     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION_ECART)
1449     {
1450     std::string Identifiant_orientation = param->get_nom((char*)"Identifiant_orientation");
1451     if(get_analyse(Identifiant_orientation)==NULL)
1452     {
1453     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1454     return FAIL;
1455     }
1456     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1457     double tenseur_compare[6];
1458     tenseur_compare[0] = (double)param->get_valeur((char*)"a_11");
1459     tenseur_compare[1] = (double)param->get_valeur((char*)"a_22");
1460     tenseur_compare[2] = (double)param->get_valeur((char*)"a_33");
1461     tenseur_compare[3] = (double)param->get_valeur((char*)"a_12");
1462     tenseur_compare[4] = (double)param->get_valeur((char*)"a_23");
1463     tenseur_compare[5] = (double)param->get_valeur((char*)"a_13");
1464     if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::ORIENTATION)
1465     {
1466     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)get_analyse(Identifiant_orientation);
1467     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1468     ajouter_analyse(analyse_compare);
1469     }
1470     else if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1471     {
1472     MSTRUCT_ANALYSE_EROSION* analyse_erosion_orientation = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_orientation);
1473     double epaisseur_couche = analyse_erosion_orientation->get_epaisseur_couche();
1474     std::string Nom_groupe_forme = analyse_erosion_orientation->get_nom_groupe_forme();
1475     BOITE_3D *boite_3d_analyse=analyse_erosion_orientation->get_boite_analyse();
1476     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1477     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1478     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))
1479     {
1480     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)analyse;
1481     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1482     analyse_erosion_ecart->ajouter_analyse(analyse_compare);
1483     }
1484     ajouter_analyse(analyse_erosion_ecart);
1485     }
1486     }
1487 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1488     {
1489 couturad 982 long Num_solution_temp=(long)param->get_valeur((char*)"Num_solution_temp");
1490     long Num_solution_flux=(long)param->get_valeur((char*)"Num_solution_flux");
1491     int Direction=(int)param->get_valeur((char*)"Direction");
1492     BOITE_3D *boite_3d_analyse=NULL;
1493     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1494     if(Boite_analyse)
1495 couturad 971 {
1496 couturad 982 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1497     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1498     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1499     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1500     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1501     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1502     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1503 couturad 971 }
1504 couturad 982 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1505     FEM_SOLUTION * fem_sol_temp=get_mg_gestionnaire()->get_fem_solution(Num_solution_temp);
1506     FEM_SOLUTION * fem_sol_flux=get_mg_gestionnaire()->get_fem_solution(Num_solution_flux);
1507     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);
1508     if(Analyse_erosion)
1509 couturad 971 {
1510 couturad 982 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1511     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1512     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cond_ther,Nb_couche,Epaisseur_couche);
1513     analyse_erosion->executer();
1514     ajouter_analyse(analyse_erosion);
1515 couturad 971 }
1516     else
1517     {
1518 couturad 982 analyse_cond_ther->executer();
1519     ajouter_analyse(analyse_cond_ther);
1520 couturad 971 }
1521 couturad 982 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1522 couturad 971 }
1523 couturad 1029 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ENERGIE_HILL)
1524     {
1525     long Num_solution_temp=(long)param->get_valeur((char*)"Num_solution_epsilon");
1526     long Num_solution_flux=(long)param->get_valeur((char*)"Num_solution_sigma");
1527     BOITE_3D *boite_3d_analyse=NULL;
1528     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1529     if(Boite_analyse)
1530     {
1531     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1532     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1533     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1534     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1535     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1536     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1537     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1538     }
1539     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1540     FEM_SOLUTION * fem_sol_temp=get_mg_gestionnaire()->get_fem_solution(Num_solution_temp);
1541     FEM_SOLUTION * fem_sol_flux=get_mg_gestionnaire()->get_fem_solution(Num_solution_flux);
1542     MSTRUCT_ANALYSE_ENERGIE_HILL* analyse_cond_ther = new MSTRUCT_ANALYSE_ENERGIE_HILL(this,Identifiant,fem_sol_temp->get_id(),fem_sol_flux->get_id(),boite_3d_analyse);
1543     if(Analyse_erosion)
1544     {
1545     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1546     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1547     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cond_ther,Nb_couche,Epaisseur_couche);
1548     analyse_erosion->executer();
1549     ajouter_analyse(analyse_erosion);
1550     }
1551     else
1552     {
1553     analyse_cond_ther->executer();
1554     ajouter_analyse(analyse_cond_ther);
1555     }
1556     if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1557     }
1558 couturad 993 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_TEMPS)
1559     {
1560    
1561     }
1562 couturad 968 else
1563     {
1564     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1565     affiche(ligne);
1566     }
1567 couturad 919 }
1568 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
1569     double temps_analyse;
1570     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1571     change_temps_analyse(get_temps_analyse()+temps_analyse);
1572 couturad 919 }
1573    
1574 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1575     MSTRUCT_VES_FILE* ves_sph,
1576     MSTRUCT_VES_FILE* ves_dev)
1577 couturad 933 {
1578 couturad 968 OT_CPU ot_cpu;
1579     ot_cpu.initialise();
1580     std::vector<OT_PARAMETRES*>::iterator it;
1581     char ligne[1000];
1582     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1583     {
1584     OT_PARAMETRES* param = *it;
1585     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1586     std::string Identifiant = param->get_nom((char*)"Identifiant");
1587     if(get_analyse(Identifiant)!=NULL)
1588     {
1589     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1590     return FAIL;
1591     }
1592     sprintf(ligne,"-> %s",Identifiant.c_str());
1593     affiche(ligne);
1594     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MODULES_ELASTICITE)
1595     {
1596     std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
1597     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
1598     if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1599     {
1600     MSTRUCT_ANALYSE_CHAMP* epsilon_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_epsilon);
1601     MSTRUCT_ANALYSE_CHAMP* sigma_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_sigma);
1602     MSTRUCT_ANALYSE_CHAMP* epsilon_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_epsilon);
1603     MSTRUCT_ANALYSE_CHAMP* sigma_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_sigma);
1604     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,epsilon_sph,sigma_sph,epsilon_dev,sigma_dev);
1605     analyse_modules_elasticite->executer();
1606     ajouter_analyse(analyse_modules_elasticite);
1607     }
1608     else if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1609     {
1610     MSTRUCT_ANALYSE_EROSION* epsilon_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_epsilon);
1611     MSTRUCT_ANALYSE_EROSION* sigma_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_sigma);
1612     MSTRUCT_ANALYSE_EROSION* epsilon_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_epsilon);
1613     MSTRUCT_ANALYSE_EROSION* sigma_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_sigma);
1614     long Nb_couche = epsilon_sph_erosion->get_nb_analyse();
1615     double Epaisseur_couche = epsilon_sph_erosion->get_epaisseur_couche();
1616     std::string Nom_groupe_forme = epsilon_sph_erosion->get_nom_groupe_forme();
1617     BOITE_3D *boite_3d_analyse=epsilon_sph_erosion->get_boite_analyse();
1618     MSTRUCT_ANALYSE_EROSION* analyse_modules_elasticite_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,Epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1619     for(int i=0;i<Nb_couche;i++)
1620     {
1621     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,
1622     (MSTRUCT_ANALYSE_CHAMP*)epsilon_sph_erosion->get_analyse(i),
1623     (MSTRUCT_ANALYSE_CHAMP*)sigma_sph_erosion->get_analyse(i),
1624     (MSTRUCT_ANALYSE_CHAMP*)epsilon_dev_erosion->get_analyse(i),
1625     (MSTRUCT_ANALYSE_CHAMP*)sigma_dev_erosion->get_analyse(i));
1626     analyse_modules_elasticite->executer();
1627     analyse_modules_elasticite_erosion->ajouter_analyse(analyse_modules_elasticite);
1628     }
1629     ajouter_analyse(analyse_modules_elasticite_erosion);
1630     }
1631     }
1632     else
1633     {
1634     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1635     affiche(ligne);
1636     }
1637     }
1638     ot_cpu.ajouter_etape((char*)"analyse");
1639     double temps_analyse;
1640     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1641     change_temps_analyse(get_temps_analyse()+temps_analyse);
1642     }
1643    
1644 couturad 971 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1645     MSTRUCT_VES_FILE* ves_lambda_x,
1646     MSTRUCT_VES_FILE* ves_lambda_y,
1647     MSTRUCT_VES_FILE* ves_lambda_z)
1648     {
1649     OT_CPU ot_cpu;
1650     ot_cpu.initialise();
1651     std::vector<OT_PARAMETRES*>::iterator it;
1652     char ligne[1000];
1653     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1654     {
1655     OT_PARAMETRES* param = *it;
1656     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1657     std::string Identifiant = param->get_nom((char*)"Identifiant");
1658     if(get_analyse(Identifiant)!=NULL)
1659     {
1660     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1661     return FAIL;
1662     }
1663     sprintf(ligne,"-> %s",Identifiant.c_str());
1664     affiche(ligne);
1665     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1666     {
1667     std::string Identifiant = param->get_nom((char*)"Identifiant");
1668     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1669     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1670     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1671     {
1672     MSTRUCT_ANALYSE_EROSION* erosion_lambda_x = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_x->get_analyse(Identifiant);
1673     MSTRUCT_ANALYSE_EROSION* erosion_lambda_y = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_y->get_analyse(Identifiant);
1674     MSTRUCT_ANALYSE_EROSION* erosion_lambda_z = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_z->get_analyse(Identifiant);
1675     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_x;
1676     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_y;
1677     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_z;
1678     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_premiere_analyse(it_analyse_x);
1679     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_premiere_analyse(it_analyse_y);
1680     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_premiere_analyse(it_analyse_z);
1681     MSTRUCT_ANALYSE_EROSION* erosion_lambda_app = new MSTRUCT_ANALYSE_EROSION(Identifiant,
1682     erosion_lambda_x->get_epaisseur_couche(),
1683     erosion_lambda_x->get_nom_groupe_forme(),
1684     erosion_lambda_x->get_boite_analyse());
1685     while(analyse_lambda_x!=NULL && analyse_lambda_y!=NULL && analyse_lambda_z!=NULL)
1686     {
1687     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1688     analyse_lambda_app->executer();
1689     erosion_lambda_app->ajouter_analyse(analyse_lambda_app);
1690     analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_suivante_analyse(it_analyse_x);
1691     analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_suivante_analyse(it_analyse_y);
1692     analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_suivante_analyse(it_analyse_z);
1693     }
1694     ajouter_analyse(erosion_lambda_app);
1695     }
1696     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1697     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1698     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE)
1699     {
1700     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_x->get_analyse(Identifiant);
1701     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_y->get_analyse(Identifiant);
1702     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_z->get_analyse(Identifiant);
1703     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1704     analyse_lambda_app->executer();
1705     ajouter_analyse(analyse_lambda_app);
1706     }
1707     }
1708     else
1709     {
1710     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1711     affiche(ligne);
1712     }
1713     }
1714     ot_cpu.ajouter_etape((char*)"analyse");
1715     double temps_analyse;
1716     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1717     change_temps_analyse(get_temps_analyse()+temps_analyse);
1718     }
1719 couturad 968
1720    
1721 couturad 971
1722    
1723 couturad 968 int MSTRUCT_VES::exporter_maillage_abaqus(char* dossier)
1724     {
1725 couturad 933 std::ofstream f;
1726 couturad 968 char file[1000];
1727     sprintf(file,"%s/noeuds",dossier);
1728     f.open(file,std::ios::out);
1729 couturad 933 f.precision(16);
1730     f.setf(std::ios::showpoint);
1731     f << "*NODE"<< std::endl;
1732     LISTE_FEM_NOEUD::iterator it;
1733     long index=1;
1734     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
1735     {
1736     noeud->change_numero(index);
1737     double *coord=noeud->get_coord();
1738     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
1739     index++;
1740     }
1741     f.close();
1742 couturad 968 sprintf(file,"%s/elements",dossier);
1743     f.open(file,std::ios::out);
1744 couturad 933 f.precision(16);
1745     f.setf(std::ios::showpoint);
1746     index=1;
1747     LISTE_FEM_ELEMENT3::iterator ittele3;
1748     bool tetralin=false;
1749     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1750     {
1751     if(ele3->get_type_entite()==IDFEM_TETRA4)
1752     {
1753     if(tetralin==false)
1754     {
1755     tetralin=true;
1756     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
1757     }
1758     f << index << ", "
1759     << ele3->get_fem_noeud(0)->get_numero() << ", "
1760     << ele3->get_fem_noeud(1)->get_numero() << ", "
1761     << ele3->get_fem_noeud(2)->get_numero() << ", "
1762     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
1763     ele3->change_numero(index);
1764     index++;
1765     }
1766     }
1767     bool pentalin=false;
1768     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1769     {
1770     if(ele3->get_type_entite()==IDFEM_PENTA6)
1771     {
1772     if(pentalin==false)
1773     {
1774     pentalin=true;
1775     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1776     }
1777     f << index << ", "
1778     << ele3->get_fem_noeud(0)->get_numero() << ", "
1779     << ele3->get_fem_noeud(1)->get_numero() << ", "
1780     << ele3->get_fem_noeud(2)->get_numero() << ", "
1781     << ele3->get_fem_noeud(3)->get_numero() << ", "
1782     << ele3->get_fem_noeud(4)->get_numero() << ", "
1783     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1784     ele3->change_numero(index);
1785     index++;
1786     }
1787     }
1788     bool tetraquad=false;
1789     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1790     {
1791     if(ele3->get_type_entite()==IDFEM_TETRA10)
1792     {
1793     if(tetraquad==false)
1794     {
1795     tetraquad=true;
1796     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1797     }
1798     f << index << ", "
1799     << ele3->get_fem_noeud(0)->get_numero() << ", "
1800     << ele3->get_fem_noeud(2)->get_numero() << ", "
1801     << ele3->get_fem_noeud(4)->get_numero() << ", "
1802     << ele3->get_fem_noeud(9)->get_numero() << ", "
1803     << ele3->get_fem_noeud(1)->get_numero() << ", "
1804     << ele3->get_fem_noeud(3)->get_numero() << ", "
1805     << ele3->get_fem_noeud(5)->get_numero() << ", "
1806     << ele3->get_fem_noeud(6)->get_numero() << ", "
1807     << ele3->get_fem_noeud(7)->get_numero() << ", "
1808     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1809     ele3->change_numero(index);
1810     index++;
1811     }
1812     }
1813     bool pentaquad=false;
1814     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1815     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1816     {
1817     if(ele3->get_type_entite()==IDFEM_PENTA15)
1818     {
1819     if(pentaquad==false)
1820     {
1821     pentaquad=true;
1822     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1823     }
1824     f << index << ", "
1825     << ele3->get_fem_noeud(0)->get_numero() << ", "
1826     << ele3->get_fem_noeud(2)->get_numero() << ", "
1827     << ele3->get_fem_noeud(4)->get_numero() << ", "
1828     << ele3->get_fem_noeud(9)->get_numero() << ", "
1829     << ele3->get_fem_noeud(11)->get_numero() << ", "
1830     << ele3->get_fem_noeud(13)->get_numero() << ", "
1831     << ele3->get_fem_noeud(1)->get_numero() << ", "
1832     << ele3->get_fem_noeud(3)->get_numero() << ", "
1833     << ele3->get_fem_noeud(5)->get_numero() << ", "
1834     << ele3->get_fem_noeud(10)->get_numero() << ", "
1835     << ele3->get_fem_noeud(12)->get_numero() << ", "
1836     << ele3->get_fem_noeud(14)->get_numero() << ", "
1837     << ele3->get_fem_noeud(6)->get_numero() << ", "
1838     << ele3->get_fem_noeud(7)->get_numero() << ", "
1839     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1840     ele3->change_numero(index);
1841     index++;
1842     }
1843     }
1844     f.close();
1845 couturad 968 sprintf(file,"%s/BC_nsets",dossier);
1846     f.open(file,std::ios::out);
1847 couturad 933 f.precision(16);
1848     f.setf(std::ios::showpoint);
1849     BOITE_3D boite3D_ves = get_boite3d_ves();
1850     double eps = get_precision();
1851     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1852     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1853     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1854     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1855     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1856     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1857     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1858     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1859     {
1860     double xyzmin[3];
1861     double xyzmax[3];
1862     face->get_xyz_min_max(xyzmin,xyzmax,16);
1863    
1864     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1865     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);
1866     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);
1867     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);
1868     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);
1869     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);
1870     }
1871     MG_SOMMET* sommet_x0y0z0=NULL;
1872     MG_SOMMET* sommet_x1y0z0=NULL;
1873     MG_SOMMET* sommet_x0y1z0=NULL;
1874     MG_SOMMET* sommet_x1y1z0=NULL;
1875     MG_SOMMET* sommet_x0y0z1=NULL;
1876     MG_SOMMET* sommet_x1y0z1=NULL;
1877     MG_SOMMET* sommet_x0y1z1=NULL;
1878     MG_SOMMET* sommet_x1y1z1=NULL;
1879     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1880     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1881     {
1882     double xyz[3];
1883     som->get_point()->evaluer(xyz);
1884     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;
1885     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;
1886     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;
1887     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;
1888     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;
1889     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;
1890     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;
1891     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;
1892     }
1893     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1894     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1895     f << coin_x0y0z0->get_numero() << std::endl;
1896     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1897     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1898     f << coin_x1y0z0->get_numero() << std::endl;
1899     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1900     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1901     f << coin_x0y1z0->get_numero() << std::endl;
1902     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1903     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1904     f << coin_x1y1z0->get_numero() << std::endl;
1905     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1906     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1907     f << coin_x0y0z1->get_numero() << std::endl;
1908     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1909     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1910     f << coin_x1y0z1->get_numero() << std::endl;
1911     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1912     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1913     f << coin_x0y1z1->get_numero() << std::endl;
1914     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1915     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1916     f << coin_x1y1z1->get_numero() << std::endl;
1917     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1918     f << "*NSET,NSET=xEQ0" << std::endl;
1919     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1920     {
1921     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1922     long nb_ele=lst_ele->get_nb();
1923     for(long i=0;i<nb_ele;i++)
1924     {
1925     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1926     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1927     {
1928     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1929     }
1930     }
1931     }
1932     f << "*NSET,NSET=xEQ1" << std::endl;
1933     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1934     {
1935     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1936     long nb_ele=lst_ele->get_nb();
1937     for(long i=0;i<nb_ele;i++)
1938     {
1939     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1940     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1941     {
1942     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1943     }
1944     }
1945     }
1946     f << "*NSET,NSET=yEQ0" << std::endl;
1947     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1948     {
1949     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1950     long nb_ele=lst_ele->get_nb();
1951     for(long i=0;i<nb_ele;i++)
1952     {
1953     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1954     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1955     {
1956     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1957     }
1958     }
1959     }
1960     f << "*NSET,NSET=yEQ1" << std::endl;
1961     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1962     {
1963     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1964     long nb_ele=lst_ele->get_nb();
1965     for(long i=0;i<nb_ele;i++)
1966     {
1967     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1968     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1969     {
1970     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1971     }
1972     }
1973     }
1974     f << "*NSET,NSET=zEQ0" << std::endl;
1975     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1976     {
1977     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1978     long nb_ele=lst_ele->get_nb();
1979     for(long i=0;i<nb_ele;i++)
1980     {
1981     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1982     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1983     {
1984     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1985     }
1986     }
1987     }
1988     f << "*NSET,NSET=zEQ1" << std::endl;
1989     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1990     {
1991     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1992     long nb_ele=lst_ele->get_nb();
1993     for(long i=0;i<nb_ele;i++)
1994     {
1995     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1996     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1997     {
1998     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1999     }
2000     }
2001     }
2002     f.close();
2003 couturad 1029
2004    
2005     sprintf(file,"%s/groupes_surfaces",dossier);
2006     f.open(file,std::ios::out);
2007     f.precision(16);
2008     f.setf(std::ios::showpoint);
2009     std::map<MG_ELEMENT_MAILLAGE*,FEM_ELEMENT_MAILLAGE*> map_correspondance_mg_fem;
2010     for(FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
2011     {
2012     MG_ELEMENT_MAILLAGE* mg_ele = ele3->get_mg_element_maillage();
2013     map_correspondance_mg_fem.insert(std::pair<MG_ELEMENT_MAILLAGE*,FEM_ELEMENT_MAILLAGE*>(mg_ele,ele3));
2014     }
2015     f << "*SURFACE,NAME=surf_xEQ0, TYPE=ELEMENT" << std::endl;
2016     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
2017     {
2018     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2019     long nb_ele=lst_ele->get_nb();
2020     for(long i=0;i<nb_ele;i++)
2021     {
2022     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2023     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2024     {
2025     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2026     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2027     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2028     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2029     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2030     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2031     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2032     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2033     }
2034     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2035     {
2036     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2037     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2038     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2039     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2040     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2041     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2042     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2043     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2044     }
2045     }
2046     }
2047     f << "*SURFACE,NAME=surf_xEQ1, TYPE=ELEMENT" << std::endl;
2048     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
2049     {
2050     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2051     long nb_ele=lst_ele->get_nb();
2052     for(long i=0;i<nb_ele;i++)
2053     {
2054     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2055     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2056     {
2057     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2058     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2059     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2060     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2061     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2062     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2063     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2064     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2065     }
2066     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2067     {
2068     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2069     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2070     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2071     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2072     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2073     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2074     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2075     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2076     }
2077     }
2078     }
2079     f << "*SURFACE,NAME=surf_yEQ0, TYPE=ELEMENT" << std::endl;
2080     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
2081     {
2082     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2083     long nb_ele=lst_ele->get_nb();
2084     for(long i=0;i<nb_ele;i++)
2085     {
2086     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2087     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2088     {
2089     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2090     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2091     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2092     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2093     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2094     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2095     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2096     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2097     }
2098     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2099     {
2100     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2101     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2102     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2103     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2104     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2105     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2106     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2107     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2108     }
2109     }
2110     }
2111     f << "*SURFACE,NAME=surf_yEQ1, TYPE=ELEMENT" << std::endl;
2112     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
2113     {
2114     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2115     long nb_ele=lst_ele->get_nb();
2116     for(long i=0;i<nb_ele;i++)
2117     {
2118     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2119     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2120     {
2121     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2122     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2123     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2124     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2125     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2126     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2127     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2128     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2129     }
2130     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2131     {
2132     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2133     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2134     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2135     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2136     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2137     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2138     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2139     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2140     }
2141     }
2142     }
2143     f << "*SURFACE,NAME=surf_zEQ0, TYPE=ELEMENT" << std::endl;
2144     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
2145     {
2146     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2147     long nb_ele=lst_ele->get_nb();
2148     for(long i=0;i<nb_ele;i++)
2149     {
2150     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2151     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2152     {
2153     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2154     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2155     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2156     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2157     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2158     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2159     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2160     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2161     }
2162     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2163     {
2164     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2165     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2166     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2167     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2168     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2169     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2170     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2171     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2172     }
2173     }
2174     }
2175     f << "*SURFACE,NAME=surf_zEQ1, TYPE=ELEMENT" << std::endl;
2176     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
2177     {
2178     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2179     long nb_ele=lst_ele->get_nb();
2180     for(long i=0;i<nb_ele;i++)
2181     {
2182     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2183     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2184     {
2185     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2186     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2187     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2188     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2189     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2190     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2191     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2192     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2193     }
2194     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2195     {
2196     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2197     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2198     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2199     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2200     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2201     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2202     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2203     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2204     }
2205     }
2206     }
2207     f.close();
2208 couturad 968 sprintf(file,"%s/groupes_elements",dossier);
2209     f.open(file,std::ios::out);
2210 couturad 933 f.precision(16);
2211     f.setf(std::ios::showpoint);
2212     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
2213     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))
2214     {
2215     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
2216     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
2217     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
2218     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
2219     {
2220     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2221     long nb_ele=lst_ele->get_nb();
2222     for(long i=0;i<nb_ele;i++)
2223     {
2224     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2225     f << ele3->get_numero() << std::endl;
2226     }
2227     }
2228     }
2229 couturad 937
2230 couturad 1029
2231    
2232    
2233 couturad 968 MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Particule");
2234 couturad 937 if(groupe_forme_particule!=NULL)
2235     {
2236 couturad 1029
2237 couturad 968 sprintf(file,"%s/particules",dossier);
2238     f.open(file,std::ios::out);
2239 couturad 937 f.precision(16);
2240     f.setf(std::ios::showpoint);
2241     std::ofstream f2;
2242 couturad 1029 char file2[1000];
2243     sprintf(file2,"%s/infos_particules",dossier);
2244     f2.open(file2,std::ios::out);
2245 couturad 937 f2.precision(16);
2246     f2.setf(std::ios::showpoint);
2247 couturad 1029 std::map<long,MG_CG_FORME*>::iterator it_forme;
2248     if(groupe_forme_particule->get_premiere_mgcg_forme(it_forme)->get_mgcg_info((char*)"CENTRE")!=NULL)
2249     {
2250     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
2251     }
2252     else if(groupe_forme_particule->get_premiere_mgcg_forme(it_forme)->get_mgcg_info((char*)"EXTREMITE")!=NULL)
2253     {
2254     f2 << "# extremite_x extremite_y extremite_z rayon longueur axe_x axe_y axe_z position_relative" << std::endl;
2255     }
2256 couturad 937 std::ofstream f_bord;
2257 couturad 1029 char file3[1000];
2258     sprintf(file3,"%s/particules_bord",dossier);
2259     f_bord.open(file3,std::ios::out);
2260 couturad 937 f_bord.precision(16);
2261     f_bord.setf(std::ios::showpoint);
2262     std::ofstream f_interieur;
2263 couturad 1029 char file4[1000];
2264     sprintf(file4,"%s/particules_interieur",dossier);
2265     f_interieur.open(file4,std::ios::out);
2266 couturad 937 f_interieur.precision(16);
2267     f_interieur.setf(std::ios::showpoint);
2268 couturad 1029 std::ofstream f_liste;
2269     char file5[1000];
2270     sprintf(file5,"%s/groupes_elements_particules",dossier);
2271     f_liste.open(file5,std::ios::out);
2272     f_liste.precision(16);
2273     f_liste.setf(std::ios::showpoint);
2274 couturad 937 long p=1;
2275     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))
2276     {
2277     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
2278     {
2279     f << "*ELSET,ELSET=P_" << p << std::endl;
2280 couturad 1029 if(forme->get_mgcg_info((char*)"CENTRE")!=NULL)
2281 couturad 937 {
2282 couturad 1029 MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
2283     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
2284     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
2285     std::vector<double> vct_centre = centre->get_vct_valeur();
2286     f2 << p << " "
2287     << vct_centre.at(0) << " "
2288     << vct_centre.at(1) << " "
2289     << vct_centre.at(2) << " "
2290     << rayon->get_valeur() << " "
2291     << pos_rel->get_valeur() << std::endl;
2292     bool au_bord;
2293     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
2294     else au_bord=false;
2295     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
2296     MG_VOLUME* volume = forme_volume->get_mg_volume();
2297     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2298     long nb_ele=lst_ele->get_nb();
2299     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
2300     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
2301     f_liste << "*ELSET,ELSET=P_" << p << std::endl;
2302     for(long i=0;i<nb_ele;i++)
2303     {
2304     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2305     f << ele3->get_numero() << std::endl;
2306     if(au_bord)f_bord << ele3->get_numero() << std::endl;
2307     else f_interieur << ele3->get_numero() << std::endl;
2308     f_liste << ele3->get_numero() << std::endl;
2309     }
2310     p++;
2311 couturad 937 }
2312 couturad 1029 else if(forme->get_mgcg_info((char*)"EXTREMITE")!=NULL)
2313     {
2314     MG_CG_INFO_VCT_DOUBLE* extremite = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"EXTREMITE");
2315     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
2316     MG_CG_INFO_DOUBLE* longueur = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"LONGUEUR");
2317     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
2318     std::vector<double> vct_extremite = extremite->get_vct_valeur();
2319     MG_CG_INFO_VCT_DOUBLE* axe = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"AXE");
2320     std::vector<double> vct_axe = axe->get_vct_valeur();
2321     f2 << p << " "
2322     << vct_extremite.at(0) << " "
2323     << vct_extremite.at(1) << " "
2324     << vct_extremite.at(2) << " "
2325     << rayon->get_valeur() << " "
2326     << longueur->get_valeur() << " "
2327     << vct_axe.at(0) << " "
2328     << vct_axe.at(1) << " "
2329     << vct_axe.at(2) << " "
2330     << pos_rel->get_valeur() << std::endl;
2331     bool au_bord;
2332     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
2333     else au_bord=false;
2334     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
2335     MG_VOLUME* volume = forme_volume->get_mg_volume();
2336     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2337     long nb_ele=lst_ele->get_nb();
2338     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
2339     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
2340     f_liste << "*ELSET,ELSET=P_" << p << std::endl;
2341     for(long i=0;i<nb_ele;i++)
2342     {
2343     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2344     f << ele3->get_numero() << std::endl;
2345     if(au_bord)f_bord << ele3->get_numero() << std::endl;
2346     else f_interieur << ele3->get_numero() << std::endl;
2347     f_liste << ele3->get_numero() << std::endl;
2348     }
2349     p++;
2350     }
2351 couturad 937 }
2352     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
2353     {
2354     f << "*ELSET,ELSET=P_" << p << std::endl;
2355     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
2356     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
2357     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
2358     std::vector<double> vct_centre = centre->get_vct_valeur();
2359     f2 << p << " "
2360     << vct_centre.at(0) << " "
2361     << vct_centre.at(1) << " "
2362     << vct_centre.at(2) << " "
2363     << rayon->get_valeur() << " "
2364     << pos_rel->get_valeur() << std::endl;
2365     bool au_bord;
2366     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
2367     else au_bord=false;
2368     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
2369     std::map<long,MG_VOLUME*>::iterator it_volume;
2370     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))
2371     {
2372     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2373     long nb_ele=lst_ele->get_nb();
2374     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
2375     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
2376     for(long i=0;i<nb_ele;i++)
2377     {
2378     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2379     f << ele3->get_numero() << std::endl;
2380     if(au_bord)f_bord << ele3->get_numero() << std::endl;
2381     else f_interieur << ele3->get_numero() << std::endl;
2382     }
2383     }
2384     p++;
2385     }
2386     }
2387     f_bord.close();
2388     f_interieur.close();
2389 couturad 1029 f_liste.close();
2390 couturad 937 f2.close();
2391     f.close();
2392     }
2393 couturad 933 }
2394 couturad 926
2395 couturad 933
2396 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
2397 couturad 919 {
2398 couturad 926 m_ves_file->enregistrer(fichier_ves);
2399 couturad 919 }
2400    
2401 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
2402 couturad 919 {
2403 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
2404     m_ves_file->enregistrer(fichier_ves);
2405     m_mg_gestionnaire->enregistrer(fichier_magic);
2406 couturad 919 }
2407    
2408 couturad 951 void MSTRUCT_VES::active_affichage(fonction_affiche* fonc)
2409 couturad 919 {
2410     fonc_affiche = fonc;
2411     affichageactif = 1;
2412     }
2413    
2414 couturad 926 void MSTRUCT_VES::affiche(char* message)
2415 couturad 919 {
2416     if(affichageactif==1) fonc_affiche(message);
2417     }
2418    
2419    
2420    
2421    
2422