ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 937
Committed: Mon Jun 4 18:41:00 2018 UTC (6 years, 11 months ago) by couturad
File size: 58433 byte(s)
Log Message:
MICROSTRUCTURE: Optimisation de la carte de taille

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     #include "mg_cg_modele.h"
11     #include "mg_cg_assemblage.h"
12     #include "mg_sous_geometrie.h"
13     #include "mg_cg_forme_multi_volume.h"
14 couturad 937 #include "mg_cg_info.h"
15 couturad 919 #include "mg_file.h"
16     #include "fct_taille_fem_solution_generateur_microstructure.h"
17     #include "mailleur0d.h"
18     #include "mailleur1d.h"
19     #include "mailleur2d.h"
20     #include "mailleur3d.h"
21     #include "mailleur_fem.h"
22     #include "mailleur_analyse.h"
23     #include <fstream>
24     #include "mgaster.h"
25     #include "ot_cpu.h"
26     #include "mstruct_outils.h"
27 couturad 926 #include "mg_cg_groupe_forme.h"
28     #include "mstruct_ves_file.h"
29 couturad 933 #include "fem_tetra4.h"
30     #include "fem_tetra10.h"
31     #include "fem_penta6.h"
32     #include "fem_penta15.h"
33 couturad 919 using namespace MICROSTRUCTURE;
34 couturad 926 MSTRUCT_VES::MSTRUCT_VES(void)
35 couturad 919 {
36     m_mg_gestionnaire=new MG_GESTIONNAIRE;
37     m_mg_geometrie=NULL;
38     m_mgcg_modele=NULL;
39 couturad 926 m_mgcg_assemblage=NULL;
40 couturad 919 m_mg_maillage=NULL;
41     m_fem_maillage=NULL;
42 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
43     change_boite_3D_ves(BOITE_3D(0.0,0.0,0.0,1.0,1.0,1.0));
44     change_precision(1.0e-06);
45     change_temps_geometrie(0.0);
46     change_temps_carte(0.0);
47     change_temps_maillage(0.0);
48     change_temps_fem_maillage(0.0);
49     change_temps_etude(0.0);
50     change_temps_calcul(0.0);
51     change_temps_analyse(0.0);
52 couturad 919 }
53    
54 couturad 926 MSTRUCT_VES::MSTRUCT_VES(char* fichier_ves)
55 couturad 919 {
56 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
57     m_ves_file->ouvrir(fichier_ves);
58     m_mg_gestionnaire = new MG_FILE(m_ves_file->get_nom_fichier_magic());
59     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());
60     else m_mgcg_modele=NULL;
61     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());
62     else m_mgcg_assemblage=NULL;
63     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());
64     else m_mg_geometrie = NULL;
65     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());
66     else m_mg_maillage = NULL;
67     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());
68     else m_fem_maillage = NULL;
69 couturad 919 }
70    
71 couturad 926 MSTRUCT_VES::~MSTRUCT_VES(void)
72 couturad 919 {
73     delete m_mg_gestionnaire;
74 couturad 926 delete m_ves_file;
75 couturad 919 }
76    
77 couturad 926 MG_GESTIONNAIRE* MSTRUCT_VES::get_mg_gestionnaire(void)
78 couturad 919 {
79     return m_mg_gestionnaire;
80     }
81    
82 couturad 926 void MSTRUCT_VES::change_mg_gestionnaire(MG_GESTIONNAIRE* gest)
83 couturad 919 {
84 couturad 926 m_mg_gestionnaire=gest;
85     }
86    
87     void MSTRUCT_VES::change_mg_geometrie(MG_GEOMETRIE* mg_geometrie)
88     {
89 couturad 919 m_mg_geometrie=mg_geometrie;
90 couturad 926 m_ves_file->change_id_mg_geometrie(m_mg_geometrie->get_id());
91 couturad 919 }
92    
93 couturad 926 MG_GEOMETRIE* MSTRUCT_VES::get_mg_geometrie(void)
94 couturad 919 {
95     return m_mg_geometrie;
96     }
97    
98 couturad 926 void MSTRUCT_VES::change_mgcg_assemblage(MG_CG_ASSEMBLAGE* mgcg_assemblage)
99 couturad 919 {
100     m_mgcg_assemblage=mgcg_assemblage;
101 couturad 926 m_ves_file->change_id_mgcg_assemblage(m_mgcg_assemblage->get_id());
102 couturad 919 }
103    
104 couturad 926 MG_CG_ASSEMBLAGE* MSTRUCT_VES::get_mgcg_assemblage(void)
105 couturad 919 {
106     return m_mgcg_assemblage;
107     }
108    
109 couturad 926 void MSTRUCT_VES::change_mgcg_modele(MG_CG_MODELE* mgcg_modele)
110 couturad 919 {
111     m_mgcg_modele=mgcg_modele;
112 couturad 926 m_ves_file->change_id_mgcg_modele(m_mgcg_modele->get_id());
113 couturad 919 }
114    
115 couturad 926 MG_CG_MODELE* MSTRUCT_VES::get_mgcg_modele(void)
116 couturad 919 {
117     return m_mgcg_modele;
118     }
119    
120 couturad 926 MG_MAILLAGE* MSTRUCT_VES::get_mg_maillage(void)
121 couturad 919 {
122     return m_mg_maillage;
123     }
124    
125 couturad 926 void MSTRUCT_VES::change_mg_maillage(MG_MAILLAGE* mg_maillage)
126 couturad 919 {
127     m_mg_maillage=mg_maillage;
128 couturad 926 m_ves_file->change_id_mg_maillage(m_mg_maillage->get_id());
129 couturad 919 }
130    
131 couturad 926 FEM_MAILLAGE* MSTRUCT_VES::get_fem_maillage(void)
132 couturad 919 {
133     return m_fem_maillage;
134     }
135    
136 couturad 926 void MSTRUCT_VES::change_fem_maillage(FEM_MAILLAGE* fem_maillage)
137 couturad 919 {
138     m_fem_maillage=fem_maillage;
139 couturad 926 m_ves_file->change_id_fem_maillage(m_fem_maillage->get_id());
140 couturad 919 }
141    
142 couturad 926 BOITE_3D MSTRUCT_VES::get_boite3d_ves(void)
143 couturad 919 {
144 couturad 926 return m_ves_file->get_boite_3D_ves();
145 couturad 919 }
146    
147 couturad 926 void MSTRUCT_VES::change_boite_3D_ves(BOITE_3D boite3D)
148 couturad 919 {
149 couturad 926 m_ves_file->change_boite_3D_ves(boite3D);
150 couturad 919 }
151    
152 couturad 926 double MSTRUCT_VES::get_precision(void)
153 couturad 919 {
154 couturad 926 return m_ves_file->get_precision();
155 couturad 919 }
156    
157 couturad 926 void MSTRUCT_VES::change_precision(double precision)
158 couturad 919 {
159 couturad 926 m_ves_file->change_precision(precision);
160 couturad 919 }
161    
162 couturad 926 double MSTRUCT_VES::get_temps_geometrie(void)
163 couturad 919 {
164 couturad 926 return m_ves_file->get_temps_geometrie();
165 couturad 919 }
166    
167 couturad 926 void MSTRUCT_VES::change_temps_geometrie(double temps)
168 couturad 919 {
169 couturad 926 m_ves_file->change_temps_geometrie(temps);
170 couturad 919 }
171    
172 couturad 926 double MSTRUCT_VES::get_temps_materiau(void)
173     {
174     return m_ves_file->get_temps_materiau();
175     }
176 couturad 919
177 couturad 926 void MSTRUCT_VES::change_temps_materiau(double temps)
178 couturad 919 {
179 couturad 926 m_ves_file->change_temps_materiau(temps);
180     }
181    
182     double MSTRUCT_VES::get_temps_carte(void)
183     {
184     return m_ves_file->get_temps_carte();
185     }
186    
187     void MSTRUCT_VES::change_temps_carte(double temps)
188     {
189     m_ves_file->change_temps_carte(temps);
190     }
191    
192     double MSTRUCT_VES::get_temps_maillage(void)
193     {
194     return m_ves_file->get_temps_maillage();
195     }
196    
197     void MSTRUCT_VES::change_temps_maillage(double temps)
198     {
199     m_ves_file->change_temps_maillage(temps);
200     }
201    
202     double MSTRUCT_VES::get_temps_fem_maillage(void)
203     {
204     return m_ves_file->get_temps_fem_maillage();
205     }
206    
207     void MSTRUCT_VES::change_temps_fem_maillage(double temps)
208     {
209     m_ves_file->change_temps_fem_maillage(temps);
210     }
211    
212     double MSTRUCT_VES::get_temps_etude(void)
213     {
214     return m_ves_file->get_temps_etude();
215     }
216    
217     void MSTRUCT_VES::change_temps_etude(double temps)
218     {
219     m_ves_file->change_temps_etude(temps);
220     }
221    
222     double MSTRUCT_VES::get_temps_calcul(void)
223     {
224     return m_ves_file->get_temps_calcul();
225     }
226    
227     void MSTRUCT_VES::change_temps_calcul(double temps)
228     {
229     m_ves_file->change_temps_calcul(temps);
230     }
231    
232     double MSTRUCT_VES::get_temps_analyse(void)
233     {
234     return m_ves_file->get_temps_analyse();
235     }
236    
237     void MSTRUCT_VES::change_temps_analyse(double temps)
238     {
239     m_ves_file->change_temps_analyse(temps);
240     }
241    
242     long int MSTRUCT_VES::get_nb_analyse(void)
243     {
244     return m_ves_file->get_nb_analyse();
245     }
246    
247     int MSTRUCT_VES::ajouter_analyse(MSTRUCT_ANALYSE* analyse_ves)
248     {
249     return m_ves_file->ajouter_analyse(analyse_ves);
250     }
251    
252     MSTRUCT_ANALYSE* MSTRUCT_VES::get_premiere_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
253     {
254     return m_ves_file->get_premiere_analyse(it);
255     }
256    
257     MSTRUCT_ANALYSE* MSTRUCT_VES::get_suivante_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
258     {
259     return m_ves_file->get_suivante_analyse(it);
260     }
261    
262     MSTRUCT_ANALYSE* MSTRUCT_VES::get_analyse(string identifiant)
263     {
264     return m_ves_file->get_analyse(identifiant);
265     }
266    
267     int MSTRUCT_VES::supprimer_analyse(string identifiant)
268     {
269     return m_ves_file->supprimer_analyse(identifiant);
270     }
271    
272     int MSTRUCT_VES::supprimer_tout_analyse(void)
273     {
274     return m_ves_file->supprimer_tout_analyse();
275     }
276    
277     int MSTRUCT_VES::generer_geometrie(std::vector< OT_PARAMETRES* >& vector_params_geometrie)
278     {
279 couturad 919 OT_CPU ot_cpu;
280     ot_cpu.initialise();
281     GENERATEUR* generateur=NULL;
282     std::vector<OT_PARAMETRES*>::iterator it;
283     for(it=vector_params_geometrie.begin();it!=vector_params_geometrie.end();it++)
284     {
285     OT_PARAMETRES* param = *it;
286     if(((int)param->get_valeur((char*)"Type_generateur"))==GENERATEUR::TYPE_GENERATEUR::RSA)
287     {
288     GENERATEUR_RSA *RSA;
289     std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
290     double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
291     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
292     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
293     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
294     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
295     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
296     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
297     Boite3D_distribution_Ymin,
298     Boite3D_distribution_Zmin,
299     Boite3D_distribution_Xmax,
300     Boite3D_distribution_Ymax,
301     Boite3D_distribution_Zmax);
302     double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
303     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
304     double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
305     if(generateur==NULL)
306     {
307 couturad 926 RSA = new GENERATEUR_RSA(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str(),get_boite3d_ves(),Boite3D_distribution,Nb_pas_X,Nb_pas_Y,Nb_pas_Z);
308 couturad 919 generateur=RSA;
309 couturad 929 RSA->active_affichage(fonc_affiche);
310 couturad 919 }
311     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
312     int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
313     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
314     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
315     double Volume_min = param->get_valeur((char*)"Volume_min");
316     double Aire_min = param->get_valeur((char*)"Aire_min");
317     double Longueur_min = param->get_valeur((char*)"Longueur_min");
318     double Angle_min = param->get_valeur((char*)"Angle_min");
319     double Nb_volume_max = param->get_valeur((char*)"Nb_volume_max");
320     double Nb_iteration_max = param->get_valeur((char*)"Nb_iteration_max");
321     double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
322 couturad 929 double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
323 couturad 919 if(Type_inclusion==GENERATEUR_RSA::TYPE_INCLUSION::SPHERE)
324     {
325     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
326     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
327     RSA->tirrage_aleatoire_sphere(Nom_groupe_inclusion,
328     Mu_rayon,Sigma_rayon,
329     Fraction_volumique_cible,
330     Distance_min_inter_volume,
331     Volume_min,
332     Aire_min,
333     Longueur_min,
334     Angle_min,
335     Nb_volume_max,
336     Nb_iteration_max,
337     Porosite);
338     }
339     else if(Type_inclusion==GENERATEUR_RSA::TYPE_INCLUSION::CYLINDRE)
340     {
341     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
342     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
343     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
344     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
345 couturad 929 double Mu_theta = param->get_valeur((char*)"Mu_theta");
346     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
347     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
348     double Mu_phi = param->get_valeur((char*)"Mu_phi");
349     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
350     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
351    
352 couturad 919 RSA->tirrage_aleatoire_cylindre(Nom_groupe_inclusion,
353     Mu_rayon,Sigma_rayon,
354     Mu_longueur,Sigma_longueur,
355 couturad 929 Mu_theta,Sigma_theta,Type_distribution_theta,
356     Mu_phi,Sigma_phi,Type_distribution_phi,
357     Fraction_volumique_cible,
358     Eps_fraction_volumique,
359 couturad 919 Distance_min_inter_volume,
360     Volume_min,
361     Aire_min,
362     Longueur_min,
363     Angle_min,
364     Nb_volume_max,
365     Nb_iteration_max,
366     Porosite);
367     }
368    
369     }
370     }
371     ot_cpu.ajouter_etape((char*)"generation_geometrie");
372 couturad 926 double temps_generation_geometrie;
373     ot_cpu.get_etape((char*)"generation_geometrie",temps_generation_geometrie);
374     change_temps_geometrie(get_temps_geometrie()+temps_generation_geometrie);
375 couturad 919 generateur->construire(this);
376     delete generateur;
377     return OK;
378     }
379    
380 couturad 926 int MSTRUCT_VES::generer_materiau(std::vector< OT_PARAMETRES* >& vector_params_materiau)
381 couturad 919 {
382     OT_CPU ot_cpu;
383     ot_cpu.initialise();
384     std::vector<OT_PARAMETRES*>::iterator it;
385     for(it=vector_params_materiau.begin();it!=vector_params_materiau.end();it++)
386     {
387     OT_PARAMETRES* param = *it;
388     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
389     double Mu_E = param->get_valeur((char*)"Mu_E");
390     double Sigma_E = param->get_valeur((char*)"Sigma_E");
391     double Mu_nu = param->get_valeur((char*)"Mu_nu");
392     double Sigma_nu = param->get_valeur((char*)"Sigma_nu");
393 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
394     std::map<long,MG_CG_FORME*>::iterator it_forme;
395     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))
396 couturad 919 {
397     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
398     {
399     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
400     if(Sigma_E==0.0) forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",Mu_E);
401     else
402     {
403     std::random_device seed;
404     std::mt19937_64 generateur(seed());
405     std::normal_distribution<double> distribution(Mu_E,Sigma_E);
406     double Em = distribution(generateur);
407     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",Em);
408     }
409     if(Sigma_nu==0.0) forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",Mu_nu);
410     else
411     {
412     std::random_device seed;
413     std::mt19937_64 generateur(seed());
414     std::normal_distribution<double> distribution(Mu_nu,Sigma_nu);
415     double nu = distribution(generateur);
416     forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",nu);
417     }
418     }
419     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
420     {
421     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
422     std::map<long,MG_VOLUME*>::iterator it_volume;
423     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))
424     {
425     if(Sigma_E==0.0) volume->ajouter_ccf((char*)"Em",Mu_E);
426     else
427     {
428     std::random_device seed;
429     std::mt19937_64 generateur(seed());
430     std::normal_distribution<double> distribution(Mu_E,Sigma_E);
431     double Em = distribution(generateur);
432     volume->ajouter_ccf((char*)"Em",Em);
433     }
434     if(Sigma_nu==0.0) volume->ajouter_ccf((char*)"nu",Mu_nu);
435     else
436     {
437     std::random_device seed;
438     std::mt19937_64 generateur(seed());
439     std::normal_distribution<double> distribution(Mu_nu,Sigma_nu);
440     double nu = distribution(generateur);
441     volume->ajouter_ccf((char*)"nu",nu);
442     }
443     }
444     }
445     }
446     }
447     ot_cpu.ajouter_etape((char*)"generation_materiau");
448 couturad 926 double temps_generation_materiau;
449     ot_cpu.get_etape((char*)"generation_materiau",temps_generation_materiau);
450     change_temps_materiau(get_temps_materiau()+temps_generation_materiau);
451 couturad 919 return OK;
452     }
453    
454 couturad 926 int MSTRUCT_VES::generer_carte(OT_PARAMETRES *param)
455 couturad 919 {
456     double Ecart_nodal = param->get_valeur((char*)"Ecart_nodal");
457 couturad 937 double Ecart_nodal_face_particule = param->get_valeur((char*)"Ecart_nodal_face_particule");
458 couturad 919 double Fechantillonnage = param->get_valeur((char*)"Fechantillonnage");
459     double Nb_cellule_direction = param->get_valeur((char*)"Nb_cellule_direction");
460     std::string Nom_fem_solution = param->get_nom((char*)"Nom_fem_solution");
461     std::string Nom_mg_gestionnaire_carte = param->get_nom((char*)"Nom_mg_gestionnaire_carte");
462     std::string Nom_carte = param->get_nom((char*)"Nom_carte");
463     double Nb_couche_min = param->get_valeur((char*)"Nb_couche_min");
464     double Nb_pas = param->get_valeur((char*)"Nb_pas");
465     double Facteur_augmentation = param->get_valeur((char*)"Facteur_augmentation");
466     MG_GESTIONNAIRE *mggest_carte = new MG_GESTIONNAIRE;
467 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_matrice = m_mgcg_modele->get_mgcg_groupe_forme((char*)"Matrice");
468     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume_matrice = mgcg_groupe_matrice->get_tpl_map_volume();
469 couturad 919 OT_CPU ot_cpu;
470     ot_cpu.initialise();
471     FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE *carte = new FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE(mggest_carte,
472     m_mg_geometrie,
473     Ecart_nodal,
474 couturad 937 Ecart_nodal_face_particule,
475 couturad 919 Fechantillonnage,
476     Nb_cellule_direction,
477     (char*)Nom_fem_solution.c_str(),
478     tpl_map_volume_matrice,
479     Nb_couche_min,
480     Nb_pas,
481     Facteur_augmentation);
482 couturad 926
483    
484 couturad 933 carte->active_affichage(fonc_affiche);
485 couturad 926 carte->construit();
486 couturad 919 ot_cpu.ajouter_etape((char*)"generation_carte");
487 couturad 926 double temps_generation_carte;
488     ot_cpu.get_etape((char*)"generation_carte",temps_generation_carte);
489     change_temps_carte(get_temps_carte()+temps_generation_carte);
490     mggest_carte->enregistrer(Nom_mg_gestionnaire_carte.c_str());
491 couturad 919 carte->enregistrer((char*)Nom_carte.c_str());
492 couturad 926 m_ves_file->change_nom_fichier_carte((char*)Nom_carte.c_str());
493 couturad 919 return OK;
494     }
495    
496 couturad 926 int MSTRUCT_VES::generer_maillage(OT_PARAMETRES *param,FCT_TAILLE_FEM_SOLUTION* carte)
497 couturad 919 {
498     OT_CPU ot_cpu;
499     ot_cpu.initialise();
500     int Niveau = (int)param->get_valeur((char*)"Niveau");
501     int Niveau_opt_2d = (int)param->get_valeur((char*)"Niveau_opt_2d");
502     int Niveau_opt_3d = (int)param->get_valeur((char*)"Niveau_opt_3d");
503     double Priorite_metrique = param->get_valeur((char*)"Priorite_metrique");
504     int Analyse = (int)param->get_valeur((char*)"Analyse");
505     affiche((char*)"Maillage du VER :");
506     m_mg_maillage = new MG_MAILLAGE(m_mg_geometrie);
507     m_mg_gestionnaire->ajouter_mg_maillage(m_mg_maillage);
508 couturad 926 change_mg_maillage(m_mg_maillage);
509 couturad 919 MAILLEUR0D m0d(m_mg_maillage,m_mg_geometrie);
510     affiche((char*)" Maillage 0D :");
511     LISTE_MG_SOMMET::iterator it_sommet;
512     for(MG_SOMMET* sommet=m_mg_geometrie->get_premier_sommet(it_sommet);sommet!=NULL;sommet=m_mg_geometrie->get_suivant_sommet(it_sommet))
513     {
514     char message[1000];
515     sprintf(message," -> Maillage du sommet id %li",sommet->get_id());
516     affiche(message);
517     m0d.maille(sommet);
518     }
519    
520     MAILLEUR1D m1d(m_mg_maillage,m_mg_geometrie,carte);
521     affiche((char*)" Maillage 1D :");
522     m1d.active_affichage(fonc_affiche);
523     LISTE_MG_ARETE::iterator it_arete;
524     for(MG_ARETE* arete=m_mg_geometrie->get_premier_arete(it_arete);arete!=NULL;arete=m_mg_geometrie->get_suivant_arete(it_arete))
525     {
526     char message[1000];
527     sprintf(message," -> Maillage de l'arete id %li",arete->get_id());
528     affiche(message);
529     m1d.maille(arete);
530     }
531     MAILLEUR2D m2d(m_mg_maillage,m_mg_geometrie,carte);
532     m2d.change_niveau_optimisation(Niveau_opt_2d);
533     m2d.change_priorite_metrique(Priorite_metrique);
534     affiche((char*)" Maillage 2D :");
535     m2d.active_affichage(fonc_affiche);
536     LISTE_MG_FACE::iterator it_face;
537     for(MG_FACE* face=m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
538     {
539     char message[1000];
540     sprintf(message," -> Maillage de la face id %li",face->get_id());
541     affiche(message);
542     m2d.maille(face);
543     }
544     MAILLEUR3D m3d(m_mg_maillage,m_mg_geometrie,carte,false);
545 couturad 937 m3d.change_niveau_optimisation(Niveau_opt_3d);
546 couturad 919 m3d.change_priorite_metrique(Priorite_metrique);
547     affiche((char*)" Maillage 3D :");
548     m3d.active_affichage(fonc_affiche);
549     LISTE_MG_VOLUME::iterator it_volume;
550     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
551     {
552     char message[1000];
553     sprintf(message," -> Maillage du volume id %li",volume->get_id());
554     affiche(message);
555     m3d.maille(volume);
556     }
557     ot_cpu.ajouter_etape((char*)"generation_maillage");
558 couturad 926 double temps_generation_maillage;
559     ot_cpu.get_etape((char*)"generation_maillage",temps_generation_maillage);
560     change_temps_maillage(get_temps_maillage()+temps_generation_maillage);
561 couturad 919 return OK;
562     }
563    
564 couturad 926 int MSTRUCT_VES::generer_fem_maillage(OT_PARAMETRES *param)
565 couturad 919 {
566     OT_CPU ot_cpu;
567     ot_cpu.initialise();
568     int Degre = (int)param->get_valeur((char*)"Degre");
569     int Analyse = (int)param->get_valeur((char*)"Analyse");
570     int Optimisation_num_noeud = (int)param->get_valeur((char*)"Optimisation_num_noeud");
571     MAILLEUR_FEM mailleurfem;
572     mailleurfem.active_affichage(fonc_affiche);
573 couturad 926 m_fem_maillage = new FEM_MAILLAGE(m_mg_maillage->get_mg_geometrie(),m_mg_maillage,Degre);
574 couturad 919 m_mg_gestionnaire->ajouter_fem_maillage(m_fem_maillage);
575 couturad 926 change_fem_maillage(m_fem_maillage);
576 couturad 919 if(Optimisation_num_noeud) mailleurfem.maille(m_fem_maillage,1);
577     else mailleurfem.maille(m_fem_maillage,0);
578     if(Analyse)
579     {
580     MAILLEUR_ANALYSE m3d(m_fem_maillage);
581     m3d.active_affichage(fonc_affiche);
582     // m3d.analyse();
583     }
584     ot_cpu.ajouter_etape((char*)"generation_fem_maillage");
585 couturad 926 double temps_generation_fem_maillage;
586     ot_cpu.get_etape((char*)"generation_fem_maillage",temps_generation_fem_maillage);
587     change_temps_fem_maillage(get_temps_fem_maillage()+temps_generation_fem_maillage);
588 couturad 919 return OK;
589     }
590    
591 couturad 926 int MSTRUCT_VES::generer_etude(OT_PARAMETRES *param)
592 couturad 919 {
593     OT_CPU ot_cpu;
594     ot_cpu.initialise();
595 couturad 926 BOITE_3D boite3D_ves = get_boite3d_ves();
596     double eps = get_precision();
597 couturad 919 TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
598     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
599     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
600     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
601     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
602     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
603     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
604     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
605     {
606     double xyzmin[3];
607     double xyzmax[3];
608     face->get_xyz_min_max(xyzmin,xyzmax,16);
609    
610 couturad 926 if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
611     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);
612     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);
613     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);
614     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);
615     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);
616 couturad 919 }
617     MG_SOMMET* sommet_origine;
618     MG_SOMMET* sommet_x1y0z0;
619     MG_SOMMET* sommet_x0y1z0;
620     MG_SOMMET* sommet_x0y0z1;
621     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
622     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
623     {
624     double xyz[3];
625     som->get_point()->evaluer(xyz);
626 couturad 926 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_origine=som;
627     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;
628     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;
629     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;
630 couturad 919 }
631     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
632     int Type_Chargement = (int)param->get_valeur((char*)"Type_Chargement");
633     int Type_CL = (int)param->get_valeur((char*)"Type_CL");
634     double Valeur_CL = param->get_valeur((char*)"Valeur_CL");
635     if(Type_etude==TYPE_ETUDE::MECANIQUE)
636     {
637     if(Type_Chargement==TYPE_CHARGEMENT::SPHERIQUE)
638     {
639     if(Type_CL==TYPE_CONDITIONS_LIMITES::DEFORMATION_HOMOGENE)
640     {
641     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true);
642     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",Valeur_CL,true);
643     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true);
644     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",Valeur_CL,true);
645     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true);
646     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",Valeur_CL,true);
647     }
648     else if(Type_CL==TYPE_CONDITIONS_LIMITES::CONTRAINTE_HOMOGENE)
649     {
650     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true);
651     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Pz",Valeur_CL,false);
652     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true);
653     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Px",Valeur_CL,false);
654     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true);
655     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Py",Valeur_CL,false);
656     }
657     }
658     else if(Type_Chargement==TYPE_CHARGEMENT::DEVIATORIQUE)
659     {
660     if(Type_CL==TYPE_CONDITIONS_LIMITES::DEFORMATION_HOMOGENE)
661     {
662     char chr_valeur_cl[1000];
663     sprintf(chr_valeur_cl,"%lf",Valeur_CL);
664     std::string str_valeur_cl = chr_valeur_cl;
665     std::string formule_Dx = str_valeur_cl+ "*Y";
666     std::string formule_Dy = str_valeur_cl+ "*Z";
667     std::string formule_Dz = str_valeur_cl+ "*X";
668     std::vector<std::string> liste_variable_formule_Dx;
669     std::vector<std::string> liste_variable_formule_Dy;
670     std::vector<std::string> liste_variable_formule_Dz;
671     liste_variable_formule_Dx.push_back((std::string)"Y");
672     liste_variable_formule_Dy.push_back((std::string)"Z");
673     liste_variable_formule_Dz.push_back((std::string)"X");
674     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
675     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
676     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
677     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
678     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
679     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
680     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
681     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
682     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
683     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
684     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
685     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
686     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
687     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
688     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
689     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
690     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
691     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
692     }
693     else if(Type_CL==TYPE_CONDITIONS_LIMITES::CONTRAINTE_HOMOGENE)
694     {
695     sommet_origine->ajouter_ccf((char*)"Dt",0.0);
696     sommet_x1y0z0->ajouter_ccf((char*)"Dy",0.0);
697     sommet_x1y0z0->ajouter_ccf((char*)"Dz",0.0);
698     sommet_x0y1z0->ajouter_ccf((char*)"Dz",0.0);
699     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Px",-Valeur_CL,true);
700     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Py",-Valeur_CL,true);
701     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Px",Valeur_CL,true);
702     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Py",Valeur_CL,true);
703     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Px",-Valeur_CL,true);
704     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Pz",-Valeur_CL,true);
705     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Px",Valeur_CL,true);
706     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Pz",Valeur_CL,true);
707     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Py",-Valeur_CL,true);
708     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Pz",-Valeur_CL,true);
709     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Py",Valeur_CL,true);
710     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Pz",Valeur_CL,true);
711     }
712     }
713     }
714     ot_cpu.ajouter_etape((char*)"generation_etude");
715 couturad 926 double temps_generation_etude;
716     ot_cpu.get_etape((char*)"generation_etude",temps_generation_etude);
717     change_temps_etude(get_temps_etude()+temps_generation_etude);
718 couturad 919 return OK;
719     }
720    
721 couturad 926 int MSTRUCT_VES::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, double valeur,bool topo_sous_jacente)
722 couturad 919 {
723     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
724     for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan))
725     {
726     face->ajouter_ccf(condition,valeur);
727     if(topo_sous_jacente==true)
728     {
729     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo;
730     face->get_topologie_sousjacente(&map_topo);
731     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo;
732     for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo))
733     {
734     topo->ajouter_ccf(condition,valeur);
735     }
736     }
737     }
738     }
739    
740 couturad 926 int MSTRUCT_VES::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, std::string formule,std::vector<std::string> &listvariable,bool topo_sous_jacente)
741 couturad 919 {
742     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
743     for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan))
744     {
745     face->ajouter_ccf(condition,formule,listvariable);
746     if(topo_sous_jacente==true)
747     {
748     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo;
749     face->get_topologie_sousjacente(&map_topo);
750     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo;
751     for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo))
752     {
753     topo->ajouter_ccf(condition,formule,listvariable);
754     }
755     }
756     }
757     }
758    
759 couturad 926 int MSTRUCT_VES::generer_calcul(OT_PARAMETRES *param,char* param_aster)
760 couturad 919 {
761     std::string Nom_etude = param->get_nom((char*)"Nom_etude");
762     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
763     int Type_calcul = (int)param->get_valeur((char*)"Type_calcul");
764     std::string Code_resu = param->get_nom((char*)"Code_resu");
765     MGASTER mgaster;
766     mgaster.active_affichage(fonc_affiche);
767     OT_CPU ot_cpu;
768     ot_cpu.initialise();
769     mgaster.calcule(param_aster,m_fem_maillage,(char*)Nom_etude.c_str(),Type_calcul,(char*)Code_resu.c_str());
770     ot_cpu.ajouter_etape((char*)"calcul");
771 couturad 926 double temps_calcul;
772     ot_cpu.get_etape((char*)"calcul",temps_calcul);
773     change_temps_calcul(get_temps_calcul()+temps_calcul);
774 couturad 919 }
775    
776 couturad 926 int MSTRUCT_VES::generer_analyse(std::vector< OT_PARAMETRES* >& vector_params_analyse)
777 couturad 919 {
778 couturad 926 OT_CPU ot_cpu;
779     ot_cpu.initialise();
780     std::vector<OT_PARAMETRES*>::iterator it;
781     for(it=vector_params_analyse.begin();it!=vector_params_analyse.end();it++)
782 couturad 919 {
783 couturad 926 OT_PARAMETRES* param = *it;
784     std::string Identifiant = param->get_nom((char*)"Identifiant");
785     if(get_analyse(Identifiant)!=NULL)
786     {
787     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
788     continue;
789     }
790     char ligne[1000];
791     sprintf(ligne,"-> %s",Identifiant.c_str());
792     affiche(ligne);
793     int Type_analyse = (int)param->get_valeur((char*)"Type_analyse");
794     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
795 couturad 930 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
796     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
797     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
798 couturad 926 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
799     BOITE_3D *boite_3d_analyse=NULL;
800     if(Boite_analyse)
801     {
802     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
803     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
804     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
805     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
806     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
807     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
808     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
809     }
810     if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CHAMP)
811     {
812     long Num_solution = (long)param->get_valeur((char*)"Num_solution");
813     FEM_SOLUTION* sol = m_mg_gestionnaire->get_fem_solution(Num_solution);
814     int nb_champ = sol->get_nb_champ();
815     double Largeur_colonne = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
816     MSTRUCT_ANALYSE_CHAMP* analyse_champ = new MSTRUCT_ANALYSE_CHAMP(Identifiant,sol->get_id(),nb_champ,Largeur_colonne,Nom_groupe_forme,boite_3d_analyse);
817 couturad 930 if(!Analyse_erosion)
818     {
819     analyse_champ->executer(this);
820     ajouter_analyse(analyse_champ);
821     }
822     else
823     {
824     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_champ,Nb_couche,Epaisseur_couche);
825     analyse_erosion->executer(this);
826     ajouter_analyse(analyse_erosion);
827     }
828 couturad 926 }
829     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION)
830     {
831     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION(Identifiant,Nom_groupe_forme,boite_3d_analyse);
832 couturad 930 if(!Analyse_erosion)
833     {
834     analyse_orientation->executer(this);
835     ajouter_analyse(analyse_orientation);
836     }
837     else
838     {
839     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
840     analyse_erosion->executer(this);
841     ajouter_analyse(analyse_erosion);
842     }
843 couturad 926 }
844     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CAO)
845     {
846     double Largeur_colonne_distribution_nb_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_volume");
847     double Largeur_colonne_distribution_nb_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_forme");
848     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
849     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
850     double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
851     MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(Identifiant,
852     Largeur_colonne_distribution_nb_volume,
853     Largeur_colonne_distribution_nb_forme,
854     Largeur_colonne_distribution_volume,
855     Largeur_colonne_distribution_fraction_volumique,
856     Largeur_colonne_distribution_volume_forme,
857     Nom_groupe_forme);
858 couturad 930 if(!Analyse_erosion)
859     {
860     analyse_cao->executer(this);
861     ajouter_analyse(analyse_cao);
862     }
863     else
864     {
865     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cao,Nb_couche,Epaisseur_couche);
866     analyse_erosion->executer(this);
867     ajouter_analyse(analyse_erosion);
868     }
869 couturad 926 }
870     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_MG)
871     {
872     double Largeur_colonne_distribution_nb_element_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_2D");
873     double Largeur_colonne_distribution_nb_element_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_3D");
874     double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
875     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
876     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
877     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
878     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
879     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
880    
881     MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(Identifiant,
882     m_mg_maillage->get_id(),
883     Largeur_colonne_distribution_qualite_2D,
884     Largeur_colonne_distribution_nb_element_2D,
885     Largeur_colonne_distribution_nb_element_3D,
886     Largeur_colonne_distribution_taille_2D,
887     Largeur_colonne_distribution_qualite_3D,
888     Largeur_colonne_distribution_taille_3D,
889     Largeur_colonne_distribution_volume,
890     Largeur_colonne_distribution_fraction_volumique,
891     Nom_groupe_forme);
892 couturad 930 if(!Analyse_erosion)
893     {
894     analyse_mg_maillage->executer(this);
895     ajouter_analyse(analyse_mg_maillage);
896     }
897     else
898     {
899     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
900     analyse_erosion->executer(this);
901     ajouter_analyse(analyse_erosion);
902     }
903 couturad 926 }
904     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_FEM)
905     {
906     double Largeur_colonne_distribution_nb_element_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_2D");
907     double Largeur_colonne_distribution_nb_element_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_3D");
908     double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
909     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
910     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
911     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
912     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
913     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
914     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
915     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
916     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(Identifiant,
917     m_fem_maillage->get_id(),
918     Largeur_colonne_distribution_nb_element_2D,
919     Largeur_colonne_distribution_nb_element_3D,
920     Largeur_colonne_distribution_jacobien_2D_min,
921     Largeur_colonne_distribution_jacobien_2D_max,
922     Largeur_colonne_distribution_jacobien_3D_min,
923     Largeur_colonne_distribution_jacobien_3D_max,
924     Largeur_colonne_distribution_distortion_2D,
925     Largeur_colonne_distribution_distortion_3D,
926     Largeur_colonne_distribution_volume,
927     Largeur_colonne_distribution_fraction_volumique,
928     Nom_groupe_forme,
929     boite_3d_analyse);
930 couturad 930 if(!Analyse_erosion)
931     {
932     analyse_maillage_fem->executer(this);
933     ajouter_analyse(analyse_maillage_fem);
934     }
935     else
936     {
937     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
938     analyse_erosion->executer(this);
939     ajouter_analyse(analyse_erosion);
940     }
941 couturad 926 }
942     if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
943 couturad 919 }
944 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
945     double temps_analyse;
946     ot_cpu.get_etape((char*)"analyse",temps_analyse);
947     change_temps_analyse(get_temps_analyse()+temps_analyse);
948 couturad 919 }
949    
950 couturad 933 int MSTRUCT_VES::exporter_maillage_abaqus(void)
951     {
952     std::ofstream f;
953     std::string file="noeuds";
954     f.open(file.c_str(),ios::out);
955     f.precision(16);
956     f.setf(std::ios::showpoint);
957     f << "*NODE"<< std::endl;
958     LISTE_FEM_NOEUD::iterator it;
959     long index=1;
960     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
961     {
962     noeud->change_numero(index);
963     double *coord=noeud->get_coord();
964     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
965     index++;
966     }
967     f.close();
968     file="elements";
969     f.open(file.c_str(),ios::out);
970     f.precision(16);
971     f.setf(std::ios::showpoint);
972     index=1;
973     LISTE_FEM_ELEMENT3::iterator ittele3;
974     bool tetralin=false;
975     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
976     {
977     if(ele3->get_type_entite()==IDFEM_TETRA4)
978     {
979     if(tetralin==false)
980     {
981     tetralin=true;
982     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
983     }
984     f << index << ", "
985     << ele3->get_fem_noeud(0)->get_numero() << ", "
986     << ele3->get_fem_noeud(1)->get_numero() << ", "
987     << ele3->get_fem_noeud(2)->get_numero() << ", "
988     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
989     ele3->change_numero(index);
990     index++;
991     }
992     }
993     bool pentalin=false;
994     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
995     {
996     if(ele3->get_type_entite()==IDFEM_PENTA6)
997     {
998     if(pentalin==false)
999     {
1000     pentalin=true;
1001     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1002     }
1003     f << index << ", "
1004     << ele3->get_fem_noeud(0)->get_numero() << ", "
1005     << ele3->get_fem_noeud(1)->get_numero() << ", "
1006     << ele3->get_fem_noeud(2)->get_numero() << ", "
1007     << ele3->get_fem_noeud(3)->get_numero() << ", "
1008     << ele3->get_fem_noeud(4)->get_numero() << ", "
1009     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1010     ele3->change_numero(index);
1011     index++;
1012     }
1013     }
1014     bool tetraquad=false;
1015     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1016     {
1017     if(ele3->get_type_entite()==IDFEM_TETRA10)
1018     {
1019     if(tetraquad==false)
1020     {
1021     tetraquad=true;
1022     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1023     }
1024     f << index << ", "
1025     << ele3->get_fem_noeud(0)->get_numero() << ", "
1026     << ele3->get_fem_noeud(2)->get_numero() << ", "
1027     << ele3->get_fem_noeud(4)->get_numero() << ", "
1028     << ele3->get_fem_noeud(9)->get_numero() << ", "
1029     << ele3->get_fem_noeud(1)->get_numero() << ", "
1030     << ele3->get_fem_noeud(3)->get_numero() << ", "
1031     << ele3->get_fem_noeud(5)->get_numero() << ", "
1032     << ele3->get_fem_noeud(6)->get_numero() << ", "
1033     << ele3->get_fem_noeud(7)->get_numero() << ", "
1034     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1035     ele3->change_numero(index);
1036     index++;
1037     }
1038     }
1039     bool pentaquad=false;
1040     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1041     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1042     {
1043     if(ele3->get_type_entite()==IDFEM_PENTA15)
1044     {
1045     if(pentaquad==false)
1046     {
1047     pentaquad=true;
1048     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1049     }
1050     f << index << ", "
1051     << ele3->get_fem_noeud(0)->get_numero() << ", "
1052     << ele3->get_fem_noeud(2)->get_numero() << ", "
1053     << ele3->get_fem_noeud(4)->get_numero() << ", "
1054     << ele3->get_fem_noeud(9)->get_numero() << ", "
1055     << ele3->get_fem_noeud(11)->get_numero() << ", "
1056     << ele3->get_fem_noeud(13)->get_numero() << ", "
1057     << ele3->get_fem_noeud(1)->get_numero() << ", "
1058     << ele3->get_fem_noeud(3)->get_numero() << ", "
1059     << ele3->get_fem_noeud(5)->get_numero() << ", "
1060     << ele3->get_fem_noeud(10)->get_numero() << ", "
1061     << ele3->get_fem_noeud(12)->get_numero() << ", "
1062     << ele3->get_fem_noeud(14)->get_numero() << ", "
1063     << ele3->get_fem_noeud(6)->get_numero() << ", "
1064     << ele3->get_fem_noeud(7)->get_numero() << ", "
1065     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1066     ele3->change_numero(index);
1067     index++;
1068     }
1069     }
1070     f.close();
1071     file="BC_nsets";
1072     f.open(file.c_str(),ios::out);
1073     f.precision(16);
1074     f.setf(std::ios::showpoint);
1075     BOITE_3D boite3D_ves = get_boite3d_ves();
1076     double eps = get_precision();
1077     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1078     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1079     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1080     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1081     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1082     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1083     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1084     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1085     {
1086     double xyzmin[3];
1087     double xyzmax[3];
1088     face->get_xyz_min_max(xyzmin,xyzmax,16);
1089    
1090     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1091     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);
1092     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);
1093     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);
1094     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);
1095     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);
1096     }
1097     MG_SOMMET* sommet_x0y0z0=NULL;
1098     MG_SOMMET* sommet_x1y0z0=NULL;
1099     MG_SOMMET* sommet_x0y1z0=NULL;
1100     MG_SOMMET* sommet_x1y1z0=NULL;
1101     MG_SOMMET* sommet_x0y0z1=NULL;
1102     MG_SOMMET* sommet_x1y0z1=NULL;
1103     MG_SOMMET* sommet_x0y1z1=NULL;
1104     MG_SOMMET* sommet_x1y1z1=NULL;
1105     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1106     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1107     {
1108     double xyz[3];
1109     som->get_point()->evaluer(xyz);
1110     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;
1111     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;
1112     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;
1113     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;
1114     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;
1115     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;
1116     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;
1117     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;
1118     }
1119     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1120     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1121     f << coin_x0y0z0->get_numero() << std::endl;
1122     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1123     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1124     f << coin_x1y0z0->get_numero() << std::endl;
1125     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1126     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1127     f << coin_x0y1z0->get_numero() << std::endl;
1128     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1129     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1130     f << coin_x1y1z0->get_numero() << std::endl;
1131     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1132     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1133     f << coin_x0y0z1->get_numero() << std::endl;
1134     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1135     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1136     f << coin_x1y0z1->get_numero() << std::endl;
1137     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1138     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1139     f << coin_x0y1z1->get_numero() << std::endl;
1140     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1141     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1142     f << coin_x1y1z1->get_numero() << std::endl;
1143     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1144     f << "*NSET,NSET=xEQ0" << std::endl;
1145     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1146     {
1147     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1148     long nb_ele=lst_ele->get_nb();
1149     for(long i=0;i<nb_ele;i++)
1150     {
1151     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1152     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1153     {
1154     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1155     }
1156     }
1157     }
1158     f << "*NSET,NSET=xEQ1" << std::endl;
1159     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1160     {
1161     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1162     long nb_ele=lst_ele->get_nb();
1163     for(long i=0;i<nb_ele;i++)
1164     {
1165     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1166     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1167     {
1168     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1169     }
1170     }
1171     }
1172     f << "*NSET,NSET=yEQ0" << std::endl;
1173     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1174     {
1175     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1176     long nb_ele=lst_ele->get_nb();
1177     for(long i=0;i<nb_ele;i++)
1178     {
1179     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1180     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1181     {
1182     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1183     }
1184     }
1185     }
1186     f << "*NSET,NSET=yEQ1" << std::endl;
1187     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1188     {
1189     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1190     long nb_ele=lst_ele->get_nb();
1191     for(long i=0;i<nb_ele;i++)
1192     {
1193     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1194     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1195     {
1196     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1197     }
1198     }
1199     }
1200     f << "*NSET,NSET=zEQ0" << std::endl;
1201     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1202     {
1203     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1204     long nb_ele=lst_ele->get_nb();
1205     for(long i=0;i<nb_ele;i++)
1206     {
1207     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1208     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1209     {
1210     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1211     }
1212     }
1213     }
1214     f << "*NSET,NSET=zEQ1" << std::endl;
1215     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1216     {
1217     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1218     long nb_ele=lst_ele->get_nb();
1219     for(long i=0;i<nb_ele;i++)
1220     {
1221     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1222     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1223     {
1224     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1225     }
1226     }
1227     }
1228     f.close();
1229     file="groupes_elements";
1230     f.open(file.c_str(),ios::out);
1231     f.precision(16);
1232     f.setf(std::ios::showpoint);
1233     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
1234     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))
1235     {
1236     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
1237     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
1238     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
1239     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
1240     {
1241     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1242     long nb_ele=lst_ele->get_nb();
1243     for(long i=0;i<nb_ele;i++)
1244     {
1245     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1246     f << ele3->get_numero() << std::endl;
1247     }
1248     }
1249     }
1250 couturad 937
1251     MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Sphere");
1252     if(groupe_forme_particule!=NULL)
1253     {
1254     file="particules";
1255     f.open(file.c_str(),ios::out);
1256     f.precision(16);
1257     f.setf(std::ios::showpoint);
1258     std::ofstream f2;
1259     f2.open((char*)"infos_particules");
1260     f2.precision(16);
1261     f2.setf(std::ios::showpoint);
1262     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
1263     std::ofstream f_bord;
1264     f_bord.open((char*)"particules_bord");
1265     f_bord.precision(16);
1266     f_bord.setf(std::ios::showpoint);
1267     std::ofstream f_interieur;
1268     f_interieur.open((char*)"particules_interieur");
1269     f_interieur.precision(16);
1270     f_interieur.setf(std::ios::showpoint);
1271     long p=1;
1272     std::map<long,MG_CG_FORME*>::iterator it_forme;
1273     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))
1274     {
1275     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
1276     {
1277     f << "*ELSET,ELSET=P_" << p << std::endl;
1278     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1279     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1280     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1281     std::vector<double> vct_centre = centre->get_vct_valeur();
1282     f2 << p << " "
1283     << vct_centre.at(0) << " "
1284     << vct_centre.at(1) << " "
1285     << vct_centre.at(2) << " "
1286     << rayon->get_valeur() << " "
1287     << pos_rel->get_valeur() << std::endl;
1288     bool au_bord;
1289     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1290     else au_bord=false;
1291     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
1292     MG_VOLUME* volume = forme_volume->get_mg_volume();
1293     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1294     long nb_ele=lst_ele->get_nb();
1295     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1296     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1297     for(long i=0;i<nb_ele;i++)
1298     {
1299     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1300     f << ele3->get_numero() << std::endl;
1301     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1302     else f_interieur << ele3->get_numero() << std::endl;
1303     }
1304     p++;
1305     }
1306     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
1307     {
1308     f << "*ELSET,ELSET=P_" << p << std::endl;
1309     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1310     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1311     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1312     std::vector<double> vct_centre = centre->get_vct_valeur();
1313     f2 << p << " "
1314     << vct_centre.at(0) << " "
1315     << vct_centre.at(1) << " "
1316     << vct_centre.at(2) << " "
1317     << rayon->get_valeur() << " "
1318     << pos_rel->get_valeur() << std::endl;
1319     bool au_bord;
1320     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1321     else au_bord=false;
1322     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
1323     std::map<long,MG_VOLUME*>::iterator it_volume;
1324     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))
1325     {
1326     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1327     long nb_ele=lst_ele->get_nb();
1328     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1329     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1330     for(long i=0;i<nb_ele;i++)
1331     {
1332     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1333     f << ele3->get_numero() << std::endl;
1334     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1335     else f_interieur << ele3->get_numero() << std::endl;
1336     }
1337     }
1338     p++;
1339     }
1340     }
1341     f_bord.close();
1342     f_interieur.close();
1343     f2.close();
1344     f.close();
1345     }
1346 couturad 933 }
1347 couturad 926
1348 couturad 933
1349 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
1350 couturad 919 {
1351 couturad 926 m_ves_file->enregistrer(fichier_ves);
1352 couturad 919 }
1353    
1354 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
1355 couturad 919 {
1356 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
1357     m_ves_file->enregistrer(fichier_ves);
1358     m_mg_gestionnaire->enregistrer(fichier_magic);
1359 couturad 919 }
1360    
1361 couturad 926 void MSTRUCT_VES::active_affichage(MICROSTRUCTURE::fonction_affiche* fonc)
1362 couturad 919 {
1363     fonc_affiche = fonc;
1364     affichageactif = 1;
1365     }
1366    
1367 couturad 926 void MSTRUCT_VES::affiche(char* message)
1368 couturad 919 {
1369     if(affichageactif==1) fonc_affiche(message);
1370     }
1371    
1372    
1373    
1374    
1375