ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 1075
Committed: Tue Aug 10 17:02:54 2021 UTC (3 years, 9 months ago) by francois
File size: 116817 byte(s)
Log Message:
suppression de warning avec le dernier compilateur

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 francois 1075 return 0;
1077    
1078 couturad 919 }
1079    
1080 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement)
1081 couturad 919 {
1082 couturad 926 OT_CPU ot_cpu;
1083     ot_cpu.initialise();
1084     std::vector<OT_PARAMETRES*>::iterator it;
1085 couturad 968 char ligne[1000];
1086     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1087 couturad 919 {
1088 couturad 926 OT_PARAMETRES* param = *it;
1089 couturad 968 int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1090 couturad 926 std::string Identifiant = param->get_nom((char*)"Identifiant");
1091     if(get_analyse(Identifiant)!=NULL)
1092     {
1093     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1094     continue;
1095     }
1096     sprintf(ligne,"-> %s",Identifiant.c_str());
1097     affiche(ligne);
1098 couturad 968 if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP)
1099 couturad 926 {
1100     long Num_solution = (long)param->get_valeur((char*)"Num_solution");
1101 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1102     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1103     BOITE_3D *boite_3d_analyse=NULL;
1104     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1105     if(Boite_analyse)
1106     {
1107     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1108     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1109     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1110     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1111     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1112     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1113     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1114     }
1115     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1116 couturad 926 FEM_SOLUTION* sol = m_mg_gestionnaire->get_fem_solution(Num_solution);
1117     int nb_champ = sol->get_nb_champ();
1118 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);
1119     if(Analyse_erosion)
1120 couturad 930 {
1121 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1122     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1123     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_champ,Nb_couche,Epaisseur_couche);
1124     analyse_erosion->executer();
1125     ajouter_analyse(analyse_erosion);
1126 couturad 930 }
1127     else
1128     {
1129 couturad 968 analyse_champ->executer();
1130     ajouter_analyse(analyse_champ);
1131 couturad 930 }
1132 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1133     }
1134     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION)
1135 couturad 926 {
1136 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1137     int Avec_fem_maillage = (int)param->get_valeur((char*)"Avec_fem_maillage");
1138     BOITE_3D *boite_3d_analyse=NULL;
1139     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1140     if(Boite_analyse)
1141 couturad 930 {
1142 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1143     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1144     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1145     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1146     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1147     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1148     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1149 couturad 930 }
1150 couturad 968 MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION(this,Identifiant,Nom_groupe_forme,boite_3d_analyse,Avec_fem_maillage);
1151     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1152     if(Analyse_erosion)
1153 couturad 930 {
1154 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1155     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1156     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
1157     analyse_erosion->executer();
1158     ajouter_analyse(analyse_erosion);
1159 couturad 930 }
1160 couturad 938 else
1161     {
1162 couturad 968 analyse_orientation->executer();
1163     ajouter_analyse(analyse_orientation);
1164 couturad 938 }
1165 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1166 couturad 938 }
1167 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CAO)
1168 couturad 926 {
1169 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1170 couturad 926 double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
1171 couturad 968 MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(this,Identifiant,Largeur_colonne_distribution_volume_forme,Nom_groupe_forme);
1172     analyse_cao->executer();
1173     ajouter_analyse(analyse_cao);
1174 couturad 926 }
1175 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_PROPRIETE_MASSIQUE)
1176     {
1177     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1178     MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE* analyse_prop_mass = new MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE(this,Identifiant,Nom_groupe_forme);
1179     analyse_prop_mass->executer();
1180     ajouter_analyse(analyse_prop_mass);
1181     }
1182 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_MG)
1183 couturad 926 {
1184 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1185 couturad 926 double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
1186     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
1187     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
1188     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
1189 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1190     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1191     if(Boite_analyse)
1192 couturad 930 {
1193 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1194     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1195     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1196     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1197     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1198     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1199     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1200 couturad 930 }
1201 couturad 968 MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(this,
1202     Identifiant,
1203     m_mg_maillage->get_id(),
1204     Largeur_colonne_distribution_qualite_2D,
1205     Largeur_colonne_distribution_taille_2D,
1206     Largeur_colonne_distribution_qualite_3D,
1207     Largeur_colonne_distribution_taille_3D,
1208     Nom_groupe_forme,boite_3d_analyse);
1209     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1210     if(Analyse_erosion)
1211     {
1212     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1213     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1214     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
1215     analyse_erosion->executer();
1216     ajouter_analyse(analyse_erosion);
1217     }
1218 couturad 930 else
1219     {
1220 couturad 968 analyse_mg_maillage->executer();
1221     ajouter_analyse(analyse_mg_maillage);
1222 couturad 930 }
1223 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1224 couturad 926 }
1225 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_FEM)
1226 couturad 926 {
1227 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1228 couturad 926 double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
1229     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
1230     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
1231     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
1232     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
1233     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
1234 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1235     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1236     if(Boite_analyse)
1237     {
1238     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1239     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1240     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1241     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1242     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1243     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1244     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1245     }
1246     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(this,
1247     Identifiant,
1248 couturad 926 m_fem_maillage->get_id(),
1249     Largeur_colonne_distribution_jacobien_2D_min,
1250     Largeur_colonne_distribution_jacobien_2D_max,
1251     Largeur_colonne_distribution_jacobien_3D_min,
1252     Largeur_colonne_distribution_jacobien_3D_max,
1253     Largeur_colonne_distribution_distortion_2D,
1254     Largeur_colonne_distribution_distortion_3D,
1255     Nom_groupe_forme,
1256     boite_3d_analyse);
1257 couturad 968 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1258     if(Analyse_erosion)
1259 couturad 930 {
1260 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1261     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1262     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
1263     analyse_erosion->executer();
1264     ajouter_analyse(analyse_erosion);
1265 couturad 930 }
1266     else
1267     {
1268 couturad 968 analyse_maillage_fem->executer();
1269     ajouter_analyse(analyse_maillage_fem);
1270 couturad 930 }
1271 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1272 couturad 926 }
1273 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_NORMALISE)
1274     {
1275     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1276 couturad 982 std::string Identifiant_champ_reference = param->get_nom((char*)"Identifiant_champ_reference");
1277 couturad 968 double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1278     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1279     {
1280     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1281 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ_reference);
1282     double valeur_ref=0.0;
1283     int nb_champ=analyse_champ_reference->get_nb_champ();
1284 couturad 997 for(int i=0;i<nb_champ;i++)
1285     {
1286     valeur_ref+=analyse_champ_reference->get_moyenne()[i]*analyse_champ_reference->get_moyenne()[i];
1287     }
1288     valeur_ref=sqrt(valeur_ref);
1289     // 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]);
1290 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1291 couturad 968 ajouter_analyse(analyse_normalise);
1292     }
1293     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1294     {
1295     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1296     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1297     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1298     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1299     MSTRUCT_ANALYSE_EROSION* analyse_erosion_normalise = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1300     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1301 couturad 982 int k=0;
1302     double valeur_ref=0.0;
1303 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))
1304     {
1305 couturad 982 if(k==0)
1306     {
1307     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion_reference;
1308     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ_reference = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ_reference);
1309     MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_champ_reference->get_premiere_analyse(it_analyse_erosion_reference);
1310     int nb_champ=analyse_champ_reference->get_nb_champ();
1311 couturad 1000 for(int i=0;i<nb_champ;i++)
1312     {
1313     valeur_ref+=analyse_champ_reference->get_moyenne()[i]*analyse_champ_reference->get_moyenne()[i];
1314     }
1315     valeur_ref=sqrt(valeur_ref);
1316 couturad 982 }
1317 couturad 968 MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1318 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1319 couturad 968 analyse_erosion_normalise->ajouter_analyse(analyse_normalise);
1320 couturad 982 k++;
1321 couturad 968 }
1322     ajouter_analyse(analyse_erosion_normalise);
1323     }
1324     }
1325     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART)
1326     {
1327     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1328     if(get_analyse(Identifiant_champ)==NULL)
1329     {
1330     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1331     return FAIL;
1332     }
1333     std::string Identifiant_champ_compare = param->get_nom((char*)"Identifiant_champ_compare");
1334     if(get_analyse(Identifiant_champ_compare)==NULL)
1335     {
1336     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1337     return FAIL;
1338     }
1339     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1340     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1341     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1342     {
1343     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1344     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1345     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1346     {
1347     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1348     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1349     ajouter_analyse(analyse_ecart);
1350     }
1351     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1352     {
1353     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1354     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1355     if(Num_couche>=0)
1356     {
1357     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1358     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1359     ajouter_analyse(analyse_ecart);
1360     }
1361     else
1362     {
1363     double epaisseur_couche = analyse_erosion_compare->get_epaisseur_couche();
1364     std::string Nom_groupe_forme = analyse_erosion_compare->get_nom_groupe_forme();
1365     BOITE_3D *boite_3d_analyse=analyse_erosion_compare->get_boite_analyse();
1366     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1367     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1368     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))
1369     {
1370     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,(MSTRUCT_ANALYSE_CHAMP*)analyse_champ_compare,Type_ecart);
1371     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1372     }
1373     ajouter_analyse(analyse_erosion_ecart);
1374     }
1375    
1376     }
1377     }
1378     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1379     {
1380     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1381     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1382     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1383     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1384     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1385     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1386     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))
1387     {
1388     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1389     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1390     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1391     {
1392     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1393     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1394     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1395     }
1396     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1397     {
1398     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1399     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1400     if(Num_couche>=0)
1401     {
1402     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1403     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1404     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1405     }
1406     else
1407     {
1408    
1409     }
1410    
1411     }
1412     }
1413     ajouter_analyse(analyse_erosion_ecart);
1414     }
1415     }
1416     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART_CHARGEMENT)
1417     {
1418     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1419     if(get_analyse(Identifiant_champ)==NULL)
1420     {
1421     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1422     return FAIL;
1423     }
1424     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1425     int Type_chargement = (int)param->get_valeur((char*)"Type_chargement");
1426     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1427     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1428     {
1429     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1430     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1431     ajouter_analyse(analyse_ecart);
1432     }
1433     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1434     {
1435     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1436     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1437     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1438     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1439     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1440     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1441     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))
1442     {
1443     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1444     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1445     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1446     }
1447     ajouter_analyse(analyse_erosion_ecart);
1448     }
1449     }
1450     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION_ECART)
1451     {
1452     std::string Identifiant_orientation = param->get_nom((char*)"Identifiant_orientation");
1453     if(get_analyse(Identifiant_orientation)==NULL)
1454     {
1455     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1456     return FAIL;
1457     }
1458     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1459     double tenseur_compare[6];
1460     tenseur_compare[0] = (double)param->get_valeur((char*)"a_11");
1461     tenseur_compare[1] = (double)param->get_valeur((char*)"a_22");
1462     tenseur_compare[2] = (double)param->get_valeur((char*)"a_33");
1463     tenseur_compare[3] = (double)param->get_valeur((char*)"a_12");
1464     tenseur_compare[4] = (double)param->get_valeur((char*)"a_23");
1465     tenseur_compare[5] = (double)param->get_valeur((char*)"a_13");
1466     if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::ORIENTATION)
1467     {
1468     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)get_analyse(Identifiant_orientation);
1469     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1470     ajouter_analyse(analyse_compare);
1471     }
1472     else if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1473     {
1474     MSTRUCT_ANALYSE_EROSION* analyse_erosion_orientation = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_orientation);
1475     double epaisseur_couche = analyse_erosion_orientation->get_epaisseur_couche();
1476     std::string Nom_groupe_forme = analyse_erosion_orientation->get_nom_groupe_forme();
1477     BOITE_3D *boite_3d_analyse=analyse_erosion_orientation->get_boite_analyse();
1478     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1479     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1480     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))
1481     {
1482     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)analyse;
1483     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1484     analyse_erosion_ecart->ajouter_analyse(analyse_compare);
1485     }
1486     ajouter_analyse(analyse_erosion_ecart);
1487     }
1488     }
1489 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1490     {
1491 couturad 982 long Num_solution_temp=(long)param->get_valeur((char*)"Num_solution_temp");
1492     long Num_solution_flux=(long)param->get_valeur((char*)"Num_solution_flux");
1493     int Direction=(int)param->get_valeur((char*)"Direction");
1494     BOITE_3D *boite_3d_analyse=NULL;
1495     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1496     if(Boite_analyse)
1497 couturad 971 {
1498 couturad 982 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1499     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1500     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1501     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1502     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1503     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1504     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1505 couturad 971 }
1506 couturad 982 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1507     FEM_SOLUTION * fem_sol_temp=get_mg_gestionnaire()->get_fem_solution(Num_solution_temp);
1508     FEM_SOLUTION * fem_sol_flux=get_mg_gestionnaire()->get_fem_solution(Num_solution_flux);
1509     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);
1510     if(Analyse_erosion)
1511 couturad 971 {
1512 couturad 982 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1513     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1514     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cond_ther,Nb_couche,Epaisseur_couche);
1515     analyse_erosion->executer();
1516     ajouter_analyse(analyse_erosion);
1517 couturad 971 }
1518     else
1519     {
1520 couturad 982 analyse_cond_ther->executer();
1521     ajouter_analyse(analyse_cond_ther);
1522 couturad 971 }
1523 couturad 982 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1524 couturad 971 }
1525 couturad 1029 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ENERGIE_HILL)
1526     {
1527     long Num_solution_temp=(long)param->get_valeur((char*)"Num_solution_epsilon");
1528     long Num_solution_flux=(long)param->get_valeur((char*)"Num_solution_sigma");
1529     BOITE_3D *boite_3d_analyse=NULL;
1530     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1531     if(Boite_analyse)
1532     {
1533     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1534     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1535     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1536     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1537     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1538     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1539     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1540     }
1541     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1542     FEM_SOLUTION * fem_sol_temp=get_mg_gestionnaire()->get_fem_solution(Num_solution_temp);
1543     FEM_SOLUTION * fem_sol_flux=get_mg_gestionnaire()->get_fem_solution(Num_solution_flux);
1544     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);
1545     if(Analyse_erosion)
1546     {
1547     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1548     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1549     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cond_ther,Nb_couche,Epaisseur_couche);
1550     analyse_erosion->executer();
1551     ajouter_analyse(analyse_erosion);
1552     }
1553     else
1554     {
1555     analyse_cond_ther->executer();
1556     ajouter_analyse(analyse_cond_ther);
1557     }
1558     if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1559     }
1560 couturad 993 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_TEMPS)
1561     {
1562    
1563     }
1564 couturad 968 else
1565     {
1566     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1567     affiche(ligne);
1568     }
1569 couturad 919 }
1570 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
1571     double temps_analyse;
1572     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1573     change_temps_analyse(get_temps_analyse()+temps_analyse);
1574 francois 1075 return 0;
1575 couturad 919 }
1576    
1577 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1578     MSTRUCT_VES_FILE* ves_sph,
1579     MSTRUCT_VES_FILE* ves_dev)
1580 couturad 933 {
1581 couturad 968 OT_CPU ot_cpu;
1582     ot_cpu.initialise();
1583     std::vector<OT_PARAMETRES*>::iterator it;
1584     char ligne[1000];
1585     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1586     {
1587     OT_PARAMETRES* param = *it;
1588     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1589     std::string Identifiant = param->get_nom((char*)"Identifiant");
1590     if(get_analyse(Identifiant)!=NULL)
1591     {
1592     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1593     return FAIL;
1594     }
1595     sprintf(ligne,"-> %s",Identifiant.c_str());
1596     affiche(ligne);
1597     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MODULES_ELASTICITE)
1598     {
1599     std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
1600     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
1601     if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1602     {
1603     MSTRUCT_ANALYSE_CHAMP* epsilon_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_epsilon);
1604     MSTRUCT_ANALYSE_CHAMP* sigma_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_sigma);
1605     MSTRUCT_ANALYSE_CHAMP* epsilon_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_epsilon);
1606     MSTRUCT_ANALYSE_CHAMP* sigma_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_sigma);
1607     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,epsilon_sph,sigma_sph,epsilon_dev,sigma_dev);
1608     analyse_modules_elasticite->executer();
1609     ajouter_analyse(analyse_modules_elasticite);
1610     }
1611     else if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1612     {
1613     MSTRUCT_ANALYSE_EROSION* epsilon_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_epsilon);
1614     MSTRUCT_ANALYSE_EROSION* sigma_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_sigma);
1615     MSTRUCT_ANALYSE_EROSION* epsilon_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_epsilon);
1616     MSTRUCT_ANALYSE_EROSION* sigma_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_sigma);
1617     long Nb_couche = epsilon_sph_erosion->get_nb_analyse();
1618     double Epaisseur_couche = epsilon_sph_erosion->get_epaisseur_couche();
1619     std::string Nom_groupe_forme = epsilon_sph_erosion->get_nom_groupe_forme();
1620     BOITE_3D *boite_3d_analyse=epsilon_sph_erosion->get_boite_analyse();
1621     MSTRUCT_ANALYSE_EROSION* analyse_modules_elasticite_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,Epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1622     for(int i=0;i<Nb_couche;i++)
1623     {
1624     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,
1625     (MSTRUCT_ANALYSE_CHAMP*)epsilon_sph_erosion->get_analyse(i),
1626     (MSTRUCT_ANALYSE_CHAMP*)sigma_sph_erosion->get_analyse(i),
1627     (MSTRUCT_ANALYSE_CHAMP*)epsilon_dev_erosion->get_analyse(i),
1628     (MSTRUCT_ANALYSE_CHAMP*)sigma_dev_erosion->get_analyse(i));
1629     analyse_modules_elasticite->executer();
1630     analyse_modules_elasticite_erosion->ajouter_analyse(analyse_modules_elasticite);
1631     }
1632     ajouter_analyse(analyse_modules_elasticite_erosion);
1633     }
1634     }
1635     else
1636     {
1637     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1638     affiche(ligne);
1639     }
1640     }
1641     ot_cpu.ajouter_etape((char*)"analyse");
1642     double temps_analyse;
1643     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1644     change_temps_analyse(get_temps_analyse()+temps_analyse);
1645 francois 1075 return 0;
1646    
1647 couturad 968 }
1648    
1649 couturad 971 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1650     MSTRUCT_VES_FILE* ves_lambda_x,
1651     MSTRUCT_VES_FILE* ves_lambda_y,
1652     MSTRUCT_VES_FILE* ves_lambda_z)
1653     {
1654     OT_CPU ot_cpu;
1655     ot_cpu.initialise();
1656     std::vector<OT_PARAMETRES*>::iterator it;
1657     char ligne[1000];
1658     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1659     {
1660     OT_PARAMETRES* param = *it;
1661     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1662     std::string Identifiant = param->get_nom((char*)"Identifiant");
1663     if(get_analyse(Identifiant)!=NULL)
1664     {
1665     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1666     return FAIL;
1667     }
1668     sprintf(ligne,"-> %s",Identifiant.c_str());
1669     affiche(ligne);
1670     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1671     {
1672     std::string Identifiant = param->get_nom((char*)"Identifiant");
1673     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1674     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1675     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1676     {
1677     MSTRUCT_ANALYSE_EROSION* erosion_lambda_x = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_x->get_analyse(Identifiant);
1678     MSTRUCT_ANALYSE_EROSION* erosion_lambda_y = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_y->get_analyse(Identifiant);
1679     MSTRUCT_ANALYSE_EROSION* erosion_lambda_z = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_z->get_analyse(Identifiant);
1680     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_x;
1681     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_y;
1682     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_z;
1683     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_premiere_analyse(it_analyse_x);
1684     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_premiere_analyse(it_analyse_y);
1685     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_premiere_analyse(it_analyse_z);
1686     MSTRUCT_ANALYSE_EROSION* erosion_lambda_app = new MSTRUCT_ANALYSE_EROSION(Identifiant,
1687     erosion_lambda_x->get_epaisseur_couche(),
1688     erosion_lambda_x->get_nom_groupe_forme(),
1689     erosion_lambda_x->get_boite_analyse());
1690     while(analyse_lambda_x!=NULL && analyse_lambda_y!=NULL && analyse_lambda_z!=NULL)
1691     {
1692     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1693     analyse_lambda_app->executer();
1694     erosion_lambda_app->ajouter_analyse(analyse_lambda_app);
1695     analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_suivante_analyse(it_analyse_x);
1696     analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_suivante_analyse(it_analyse_y);
1697     analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_suivante_analyse(it_analyse_z);
1698     }
1699     ajouter_analyse(erosion_lambda_app);
1700     }
1701     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1702     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1703     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE)
1704     {
1705     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_x->get_analyse(Identifiant);
1706     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_y->get_analyse(Identifiant);
1707     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_z->get_analyse(Identifiant);
1708     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1709     analyse_lambda_app->executer();
1710     ajouter_analyse(analyse_lambda_app);
1711     }
1712     }
1713     else
1714     {
1715     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1716     affiche(ligne);
1717     }
1718     }
1719     ot_cpu.ajouter_etape((char*)"analyse");
1720     double temps_analyse;
1721     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1722     change_temps_analyse(get_temps_analyse()+temps_analyse);
1723 francois 1075 return 0;
1724    
1725 couturad 971 }
1726 couturad 968
1727    
1728 couturad 971
1729    
1730 couturad 968 int MSTRUCT_VES::exporter_maillage_abaqus(char* dossier)
1731     {
1732 couturad 933 std::ofstream f;
1733 couturad 968 char file[1000];
1734     sprintf(file,"%s/noeuds",dossier);
1735     f.open(file,std::ios::out);
1736 couturad 933 f.precision(16);
1737     f.setf(std::ios::showpoint);
1738     f << "*NODE"<< std::endl;
1739     LISTE_FEM_NOEUD::iterator it;
1740     long index=1;
1741     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
1742     {
1743     noeud->change_numero(index);
1744     double *coord=noeud->get_coord();
1745     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
1746     index++;
1747     }
1748     f.close();
1749 couturad 968 sprintf(file,"%s/elements",dossier);
1750     f.open(file,std::ios::out);
1751 couturad 933 f.precision(16);
1752     f.setf(std::ios::showpoint);
1753     index=1;
1754     LISTE_FEM_ELEMENT3::iterator ittele3;
1755     bool tetralin=false;
1756     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1757     {
1758     if(ele3->get_type_entite()==IDFEM_TETRA4)
1759     {
1760     if(tetralin==false)
1761     {
1762     tetralin=true;
1763     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
1764     }
1765     f << index << ", "
1766     << ele3->get_fem_noeud(0)->get_numero() << ", "
1767     << ele3->get_fem_noeud(1)->get_numero() << ", "
1768     << ele3->get_fem_noeud(2)->get_numero() << ", "
1769     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
1770     ele3->change_numero(index);
1771     index++;
1772     }
1773     }
1774     bool pentalin=false;
1775     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1776     {
1777     if(ele3->get_type_entite()==IDFEM_PENTA6)
1778     {
1779     if(pentalin==false)
1780     {
1781     pentalin=true;
1782     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1783     }
1784     f << index << ", "
1785     << ele3->get_fem_noeud(0)->get_numero() << ", "
1786     << ele3->get_fem_noeud(1)->get_numero() << ", "
1787     << ele3->get_fem_noeud(2)->get_numero() << ", "
1788     << ele3->get_fem_noeud(3)->get_numero() << ", "
1789     << ele3->get_fem_noeud(4)->get_numero() << ", "
1790     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1791     ele3->change_numero(index);
1792     index++;
1793     }
1794     }
1795     bool tetraquad=false;
1796     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1797     {
1798     if(ele3->get_type_entite()==IDFEM_TETRA10)
1799     {
1800     if(tetraquad==false)
1801     {
1802     tetraquad=true;
1803     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1804     }
1805     f << index << ", "
1806     << ele3->get_fem_noeud(0)->get_numero() << ", "
1807     << ele3->get_fem_noeud(2)->get_numero() << ", "
1808     << ele3->get_fem_noeud(4)->get_numero() << ", "
1809     << ele3->get_fem_noeud(9)->get_numero() << ", "
1810     << ele3->get_fem_noeud(1)->get_numero() << ", "
1811     << ele3->get_fem_noeud(3)->get_numero() << ", "
1812     << ele3->get_fem_noeud(5)->get_numero() << ", "
1813     << ele3->get_fem_noeud(6)->get_numero() << ", "
1814     << ele3->get_fem_noeud(7)->get_numero() << ", "
1815     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1816     ele3->change_numero(index);
1817     index++;
1818     }
1819     }
1820     bool pentaquad=false;
1821     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1822     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1823     {
1824     if(ele3->get_type_entite()==IDFEM_PENTA15)
1825     {
1826     if(pentaquad==false)
1827     {
1828     pentaquad=true;
1829     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1830     }
1831     f << index << ", "
1832     << ele3->get_fem_noeud(0)->get_numero() << ", "
1833     << ele3->get_fem_noeud(2)->get_numero() << ", "
1834     << ele3->get_fem_noeud(4)->get_numero() << ", "
1835     << ele3->get_fem_noeud(9)->get_numero() << ", "
1836     << ele3->get_fem_noeud(11)->get_numero() << ", "
1837     << ele3->get_fem_noeud(13)->get_numero() << ", "
1838     << ele3->get_fem_noeud(1)->get_numero() << ", "
1839     << ele3->get_fem_noeud(3)->get_numero() << ", "
1840     << ele3->get_fem_noeud(5)->get_numero() << ", "
1841     << ele3->get_fem_noeud(10)->get_numero() << ", "
1842     << ele3->get_fem_noeud(12)->get_numero() << ", "
1843     << ele3->get_fem_noeud(14)->get_numero() << ", "
1844     << ele3->get_fem_noeud(6)->get_numero() << ", "
1845     << ele3->get_fem_noeud(7)->get_numero() << ", "
1846     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1847     ele3->change_numero(index);
1848     index++;
1849     }
1850     }
1851     f.close();
1852 couturad 968 sprintf(file,"%s/BC_nsets",dossier);
1853     f.open(file,std::ios::out);
1854 couturad 933 f.precision(16);
1855     f.setf(std::ios::showpoint);
1856     BOITE_3D boite3D_ves = get_boite3d_ves();
1857     double eps = get_precision();
1858     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1859     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1860     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1861     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1862     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1863     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1864     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1865     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1866     {
1867     double xyzmin[3];
1868     double xyzmax[3];
1869     face->get_xyz_min_max(xyzmin,xyzmax,16);
1870    
1871     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1872     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);
1873     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);
1874     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);
1875     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);
1876     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);
1877     }
1878     MG_SOMMET* sommet_x0y0z0=NULL;
1879     MG_SOMMET* sommet_x1y0z0=NULL;
1880     MG_SOMMET* sommet_x0y1z0=NULL;
1881     MG_SOMMET* sommet_x1y1z0=NULL;
1882     MG_SOMMET* sommet_x0y0z1=NULL;
1883     MG_SOMMET* sommet_x1y0z1=NULL;
1884     MG_SOMMET* sommet_x0y1z1=NULL;
1885     MG_SOMMET* sommet_x1y1z1=NULL;
1886     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1887     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1888     {
1889     double xyz[3];
1890     som->get_point()->evaluer(xyz);
1891     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;
1892     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;
1893     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;
1894     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;
1895     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;
1896     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;
1897     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;
1898     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;
1899     }
1900     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1901     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1902     f << coin_x0y0z0->get_numero() << std::endl;
1903     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1904     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1905     f << coin_x1y0z0->get_numero() << std::endl;
1906     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1907     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1908     f << coin_x0y1z0->get_numero() << std::endl;
1909     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1910     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1911     f << coin_x1y1z0->get_numero() << std::endl;
1912     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1913     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1914     f << coin_x0y0z1->get_numero() << std::endl;
1915     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1916     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1917     f << coin_x1y0z1->get_numero() << std::endl;
1918     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1919     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1920     f << coin_x0y1z1->get_numero() << std::endl;
1921     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1922     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1923     f << coin_x1y1z1->get_numero() << std::endl;
1924     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1925     f << "*NSET,NSET=xEQ0" << std::endl;
1926     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1927     {
1928     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1929     long nb_ele=lst_ele->get_nb();
1930     for(long i=0;i<nb_ele;i++)
1931     {
1932     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1933     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1934     {
1935     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1936     }
1937     }
1938     }
1939     f << "*NSET,NSET=xEQ1" << std::endl;
1940     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1941     {
1942     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1943     long nb_ele=lst_ele->get_nb();
1944     for(long i=0;i<nb_ele;i++)
1945     {
1946     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1947     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1948     {
1949     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1950     }
1951     }
1952     }
1953     f << "*NSET,NSET=yEQ0" << std::endl;
1954     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1955     {
1956     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1957     long nb_ele=lst_ele->get_nb();
1958     for(long i=0;i<nb_ele;i++)
1959     {
1960     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1961     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1962     {
1963     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1964     }
1965     }
1966     }
1967     f << "*NSET,NSET=yEQ1" << std::endl;
1968     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1969     {
1970     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1971     long nb_ele=lst_ele->get_nb();
1972     for(long i=0;i<nb_ele;i++)
1973     {
1974     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1975     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1976     {
1977     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1978     }
1979     }
1980     }
1981     f << "*NSET,NSET=zEQ0" << std::endl;
1982     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1983     {
1984     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1985     long nb_ele=lst_ele->get_nb();
1986     for(long i=0;i<nb_ele;i++)
1987     {
1988     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1989     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1990     {
1991     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1992     }
1993     }
1994     }
1995     f << "*NSET,NSET=zEQ1" << std::endl;
1996     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1997     {
1998     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1999     long nb_ele=lst_ele->get_nb();
2000     for(long i=0;i<nb_ele;i++)
2001     {
2002     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2003     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
2004     {
2005     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
2006     }
2007     }
2008     }
2009     f.close();
2010 couturad 1029
2011    
2012     sprintf(file,"%s/groupes_surfaces",dossier);
2013     f.open(file,std::ios::out);
2014     f.precision(16);
2015     f.setf(std::ios::showpoint);
2016     std::map<MG_ELEMENT_MAILLAGE*,FEM_ELEMENT_MAILLAGE*> map_correspondance_mg_fem;
2017     for(FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
2018     {
2019     MG_ELEMENT_MAILLAGE* mg_ele = ele3->get_mg_element_maillage();
2020     map_correspondance_mg_fem.insert(std::pair<MG_ELEMENT_MAILLAGE*,FEM_ELEMENT_MAILLAGE*>(mg_ele,ele3));
2021     }
2022     f << "*SURFACE,NAME=surf_xEQ0, TYPE=ELEMENT" << std::endl;
2023     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
2024     {
2025     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2026     long nb_ele=lst_ele->get_nb();
2027     for(long i=0;i<nb_ele;i++)
2028     {
2029     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2030     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2031     {
2032     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2033     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2034     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2035     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2036     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2037     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2038     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2039     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2040     }
2041     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2042     {
2043     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2044     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2045     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2046     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2047     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2048     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2049     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2050     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2051     }
2052     }
2053     }
2054     f << "*SURFACE,NAME=surf_xEQ1, TYPE=ELEMENT" << std::endl;
2055     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
2056     {
2057     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2058     long nb_ele=lst_ele->get_nb();
2059     for(long i=0;i<nb_ele;i++)
2060     {
2061     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2062     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2063     {
2064     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2065     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2066     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2067     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2068     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2069     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2070     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2071     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2072     }
2073     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2074     {
2075     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2076     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2077     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2078     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2079     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2080     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2081     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2082     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2083     }
2084     }
2085     }
2086     f << "*SURFACE,NAME=surf_yEQ0, TYPE=ELEMENT" << std::endl;
2087     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
2088     {
2089     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2090     long nb_ele=lst_ele->get_nb();
2091     for(long i=0;i<nb_ele;i++)
2092     {
2093     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2094     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2095     {
2096     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2097     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2098     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2099     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2100     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2101     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2102     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2103     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2104     }
2105     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2106     {
2107     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2108     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2109     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2110     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2111     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2112     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2113     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2114     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2115     }
2116     }
2117     }
2118     f << "*SURFACE,NAME=surf_yEQ1, TYPE=ELEMENT" << std::endl;
2119     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
2120     {
2121     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2122     long nb_ele=lst_ele->get_nb();
2123     for(long i=0;i<nb_ele;i++)
2124     {
2125     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2126     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2127     {
2128     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2129     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2130     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2131     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2132     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2133     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2134     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2135     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2136     }
2137     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2138     {
2139     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2140     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2141     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2142     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2143     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2144     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2145     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2146     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2147     }
2148     }
2149     }
2150     f << "*SURFACE,NAME=surf_zEQ0, TYPE=ELEMENT" << std::endl;
2151     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
2152     {
2153     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2154     long nb_ele=lst_ele->get_nb();
2155     for(long i=0;i<nb_ele;i++)
2156     {
2157     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2158     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2159     {
2160     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2161     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2162     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2163     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2164     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2165     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2166     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2167     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2168     }
2169     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2170     {
2171     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2172     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2173     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2174     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2175     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2176     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2177     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2178     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2179     }
2180     }
2181     }
2182     f << "*SURFACE,NAME=surf_zEQ1, TYPE=ELEMENT" << std::endl;
2183     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
2184     {
2185     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
2186     long nb_ele=lst_ele->get_nb();
2187     for(long i=0;i<nb_ele;i++)
2188     {
2189     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
2190     if(ele2->get_type_entite()==IDFEM_TRIANGLE3)
2191     {
2192     FEM_TRIANGLE3* tri3= (FEM_TRIANGLE3*)ele2;
2193     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri3->get_mg_element_maillage();
2194     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2195     FEM_TETRA4* tet4 = (FEM_TETRA4*)map_correspondance_mg_fem.find(mgtetra)->second;
2196     if(mgtri==mgtetra->get_triangle1()) f << tet4->get_numero() << ", S1" << std::endl;
2197     else if(mgtri==mgtetra->get_triangle2()) f << tet4->get_numero() << ", S2" << std::endl;
2198     else if(mgtri==mgtetra->get_triangle3()) f << tet4->get_numero() << ", S3" << std::endl;
2199     else if(mgtri==mgtetra->get_triangle4()) f << tet4->get_numero() << ", S4" << std::endl;
2200     }
2201     if(ele2->get_type_entite()==IDFEM_TRIANGLE6)
2202     {
2203     FEM_TRIANGLE6* tri6= (FEM_TRIANGLE6*)ele2;
2204     MG_TRIANGLE* mgtri= (MG_TRIANGLE*)tri6->get_mg_element_maillage();
2205     MG_TETRA* mgtetra = mgtri->get_lien_tetra()->get(0);
2206     FEM_TETRA10* tet10 = (FEM_TETRA10*)map_correspondance_mg_fem.find(mgtetra)->second;
2207     if(mgtri==mgtetra->get_triangle1()) f << tet10->get_numero() << ", S1" << std::endl;
2208     else if(mgtri==mgtetra->get_triangle2()) f << tet10->get_numero() << ", S2" << std::endl;
2209     else if(mgtri==mgtetra->get_triangle3()) f << tet10->get_numero() << ", S3" << std::endl;
2210     else if(mgtri==mgtetra->get_triangle4()) f << tet10->get_numero() << ", S4" << std::endl;
2211     }
2212     }
2213     }
2214     f.close();
2215 couturad 968 sprintf(file,"%s/groupes_elements",dossier);
2216     f.open(file,std::ios::out);
2217 couturad 933 f.precision(16);
2218     f.setf(std::ios::showpoint);
2219     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
2220     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))
2221     {
2222     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
2223     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
2224     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
2225     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
2226     {
2227     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2228     long nb_ele=lst_ele->get_nb();
2229     for(long i=0;i<nb_ele;i++)
2230     {
2231     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2232     f << ele3->get_numero() << std::endl;
2233     }
2234     }
2235     }
2236 couturad 937
2237 couturad 1029
2238    
2239    
2240 couturad 968 MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Particule");
2241 couturad 937 if(groupe_forme_particule!=NULL)
2242     {
2243 couturad 1029
2244 couturad 968 sprintf(file,"%s/particules",dossier);
2245     f.open(file,std::ios::out);
2246 couturad 937 f.precision(16);
2247     f.setf(std::ios::showpoint);
2248     std::ofstream f2;
2249 couturad 1029 char file2[1000];
2250     sprintf(file2,"%s/infos_particules",dossier);
2251     f2.open(file2,std::ios::out);
2252 couturad 937 f2.precision(16);
2253     f2.setf(std::ios::showpoint);
2254 couturad 1029 std::map<long,MG_CG_FORME*>::iterator it_forme;
2255     if(groupe_forme_particule->get_premiere_mgcg_forme(it_forme)->get_mgcg_info((char*)"CENTRE")!=NULL)
2256     {
2257     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
2258     }
2259     else if(groupe_forme_particule->get_premiere_mgcg_forme(it_forme)->get_mgcg_info((char*)"EXTREMITE")!=NULL)
2260     {
2261     f2 << "# extremite_x extremite_y extremite_z rayon longueur axe_x axe_y axe_z position_relative" << std::endl;
2262     }
2263 couturad 937 std::ofstream f_bord;
2264 couturad 1029 char file3[1000];
2265     sprintf(file3,"%s/particules_bord",dossier);
2266     f_bord.open(file3,std::ios::out);
2267 couturad 937 f_bord.precision(16);
2268     f_bord.setf(std::ios::showpoint);
2269     std::ofstream f_interieur;
2270 couturad 1029 char file4[1000];
2271     sprintf(file4,"%s/particules_interieur",dossier);
2272     f_interieur.open(file4,std::ios::out);
2273 couturad 937 f_interieur.precision(16);
2274     f_interieur.setf(std::ios::showpoint);
2275 couturad 1029 std::ofstream f_liste;
2276     char file5[1000];
2277     sprintf(file5,"%s/groupes_elements_particules",dossier);
2278     f_liste.open(file5,std::ios::out);
2279     f_liste.precision(16);
2280     f_liste.setf(std::ios::showpoint);
2281 couturad 937 long p=1;
2282     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))
2283     {
2284     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
2285     {
2286     f << "*ELSET,ELSET=P_" << p << std::endl;
2287 couturad 1029 if(forme->get_mgcg_info((char*)"CENTRE")!=NULL)
2288 couturad 937 {
2289 couturad 1029 MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
2290     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
2291     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
2292     std::vector<double> vct_centre = centre->get_vct_valeur();
2293     f2 << p << " "
2294     << vct_centre.at(0) << " "
2295     << vct_centre.at(1) << " "
2296     << vct_centre.at(2) << " "
2297     << rayon->get_valeur() << " "
2298     << pos_rel->get_valeur() << std::endl;
2299     bool au_bord;
2300     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
2301     else au_bord=false;
2302     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
2303     MG_VOLUME* volume = forme_volume->get_mg_volume();
2304     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2305     long nb_ele=lst_ele->get_nb();
2306     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
2307     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
2308     f_liste << "*ELSET,ELSET=P_" << p << std::endl;
2309     for(long i=0;i<nb_ele;i++)
2310     {
2311     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2312     f << ele3->get_numero() << std::endl;
2313     if(au_bord)f_bord << ele3->get_numero() << std::endl;
2314     else f_interieur << ele3->get_numero() << std::endl;
2315     f_liste << ele3->get_numero() << std::endl;
2316     }
2317     p++;
2318 couturad 937 }
2319 couturad 1029 else if(forme->get_mgcg_info((char*)"EXTREMITE")!=NULL)
2320     {
2321     MG_CG_INFO_VCT_DOUBLE* extremite = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"EXTREMITE");
2322     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
2323     MG_CG_INFO_DOUBLE* longueur = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"LONGUEUR");
2324     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
2325     std::vector<double> vct_extremite = extremite->get_vct_valeur();
2326     MG_CG_INFO_VCT_DOUBLE* axe = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"AXE");
2327     std::vector<double> vct_axe = axe->get_vct_valeur();
2328     f2 << p << " "
2329     << vct_extremite.at(0) << " "
2330     << vct_extremite.at(1) << " "
2331     << vct_extremite.at(2) << " "
2332     << rayon->get_valeur() << " "
2333     << longueur->get_valeur() << " "
2334     << vct_axe.at(0) << " "
2335     << vct_axe.at(1) << " "
2336     << vct_axe.at(2) << " "
2337     << pos_rel->get_valeur() << std::endl;
2338     bool au_bord;
2339     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
2340     else au_bord=false;
2341     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
2342     MG_VOLUME* volume = forme_volume->get_mg_volume();
2343     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2344     long nb_ele=lst_ele->get_nb();
2345     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
2346     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
2347     f_liste << "*ELSET,ELSET=P_" << p << std::endl;
2348     for(long i=0;i<nb_ele;i++)
2349     {
2350     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2351     f << ele3->get_numero() << std::endl;
2352     if(au_bord)f_bord << ele3->get_numero() << std::endl;
2353     else f_interieur << ele3->get_numero() << std::endl;
2354     f_liste << ele3->get_numero() << std::endl;
2355     }
2356     p++;
2357     }
2358 couturad 937 }
2359     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
2360     {
2361     f << "*ELSET,ELSET=P_" << p << std::endl;
2362     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
2363     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
2364     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
2365     std::vector<double> vct_centre = centre->get_vct_valeur();
2366     f2 << p << " "
2367     << vct_centre.at(0) << " "
2368     << vct_centre.at(1) << " "
2369     << vct_centre.at(2) << " "
2370     << rayon->get_valeur() << " "
2371     << pos_rel->get_valeur() << std::endl;
2372     bool au_bord;
2373     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
2374     else au_bord=false;
2375     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
2376     std::map<long,MG_VOLUME*>::iterator it_volume;
2377     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))
2378     {
2379     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2380     long nb_ele=lst_ele->get_nb();
2381     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
2382     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
2383     for(long i=0;i<nb_ele;i++)
2384     {
2385     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2386     f << ele3->get_numero() << std::endl;
2387     if(au_bord)f_bord << ele3->get_numero() << std::endl;
2388     else f_interieur << ele3->get_numero() << std::endl;
2389     }
2390     }
2391     p++;
2392     }
2393     }
2394     f_bord.close();
2395     f_interieur.close();
2396 couturad 1029 f_liste.close();
2397 couturad 937 f2.close();
2398     f.close();
2399     }
2400 francois 1075 return 0;
2401    
2402 couturad 933 }
2403 couturad 926
2404 couturad 933
2405 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
2406 couturad 919 {
2407 couturad 926 m_ves_file->enregistrer(fichier_ves);
2408 francois 1075 return 0;
2409    
2410 couturad 919 }
2411    
2412 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
2413 couturad 919 {
2414 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
2415     m_ves_file->enregistrer(fichier_ves);
2416     m_mg_gestionnaire->enregistrer(fichier_magic);
2417 francois 1075 return 0;
2418 couturad 919 }
2419    
2420 couturad 951 void MSTRUCT_VES::active_affichage(fonction_affiche* fonc)
2421 couturad 919 {
2422     fonc_affiche = fonc;
2423     affichageactif = 1;
2424     }
2425    
2426 couturad 926 void MSTRUCT_VES::affiche(char* message)
2427 couturad 919 {
2428     if(affichageactif==1) fonc_affiche(message);
2429     }
2430    
2431    
2432    
2433    
2434