ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 1092
Committed: Mon Feb 7 21:46:53 2022 UTC (3 years, 3 months ago) by ghazal
File size: 120639 byte(s)
Log Message:
Ajout du tore dans la génération RSA des microstrucutures

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