ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 938
Committed: Wed Jun 6 13:04:19 2018 UTC (6 years, 11 months ago) by couturad
File size: 59028 byte(s)
Log Message:
MICROSTRUCTURE : Ajout du tenseur d'orientation pondere par le volume des particules

File Contents

# User Rev Content
1 couturad 919 #include "mstruct_ves.h"
2     #include "mg_volume.h"
3     #include "mg_geometrie.h"
4     #include "mg_maillage.h"
5     #include "fem_maillage.h"
6     #include "mg_gestionnaire.h"
7     #include "mstruct_groupe_volume.h"
8     #include "mstruct_parametres.h"
9     #include "mstruct_generateur_rsa.h"
10     #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 couturad 938 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION_PONDEREE)
845     {
846     MSTRUCT_ANALYSE_ORIENTATION_PONDEREE* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION_PONDEREE(Identifiant,Nom_groupe_forme,boite_3d_analyse);
847     if(!Analyse_erosion)
848     {
849     analyse_orientation->executer(this);
850     ajouter_analyse(analyse_orientation);
851     }
852     else
853     {
854     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
855     analyse_erosion->executer(this);
856     ajouter_analyse(analyse_erosion);
857     }
858     }
859 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CAO)
860     {
861     double Largeur_colonne_distribution_nb_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_volume");
862     double Largeur_colonne_distribution_nb_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_forme");
863     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
864     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
865     double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
866     MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(Identifiant,
867     Largeur_colonne_distribution_nb_volume,
868     Largeur_colonne_distribution_nb_forme,
869     Largeur_colonne_distribution_volume,
870     Largeur_colonne_distribution_fraction_volumique,
871     Largeur_colonne_distribution_volume_forme,
872     Nom_groupe_forme);
873 couturad 930 if(!Analyse_erosion)
874     {
875     analyse_cao->executer(this);
876     ajouter_analyse(analyse_cao);
877     }
878     else
879     {
880     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cao,Nb_couche,Epaisseur_couche);
881     analyse_erosion->executer(this);
882     ajouter_analyse(analyse_erosion);
883     }
884 couturad 926 }
885     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_MG)
886     {
887     double Largeur_colonne_distribution_nb_element_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_2D");
888     double Largeur_colonne_distribution_nb_element_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_3D");
889     double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
890     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
891     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
892     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
893     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
894     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
895    
896     MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(Identifiant,
897     m_mg_maillage->get_id(),
898     Largeur_colonne_distribution_qualite_2D,
899     Largeur_colonne_distribution_nb_element_2D,
900     Largeur_colonne_distribution_nb_element_3D,
901     Largeur_colonne_distribution_taille_2D,
902     Largeur_colonne_distribution_qualite_3D,
903     Largeur_colonne_distribution_taille_3D,
904     Largeur_colonne_distribution_volume,
905     Largeur_colonne_distribution_fraction_volumique,
906     Nom_groupe_forme);
907 couturad 930 if(!Analyse_erosion)
908     {
909     analyse_mg_maillage->executer(this);
910     ajouter_analyse(analyse_mg_maillage);
911     }
912     else
913     {
914     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
915     analyse_erosion->executer(this);
916     ajouter_analyse(analyse_erosion);
917     }
918 couturad 926 }
919     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_FEM)
920     {
921     double Largeur_colonne_distribution_nb_element_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_2D");
922     double Largeur_colonne_distribution_nb_element_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_3D");
923     double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
924     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
925     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
926     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
927     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
928     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
929     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
930     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
931     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(Identifiant,
932     m_fem_maillage->get_id(),
933     Largeur_colonne_distribution_nb_element_2D,
934     Largeur_colonne_distribution_nb_element_3D,
935     Largeur_colonne_distribution_jacobien_2D_min,
936     Largeur_colonne_distribution_jacobien_2D_max,
937     Largeur_colonne_distribution_jacobien_3D_min,
938     Largeur_colonne_distribution_jacobien_3D_max,
939     Largeur_colonne_distribution_distortion_2D,
940     Largeur_colonne_distribution_distortion_3D,
941     Largeur_colonne_distribution_volume,
942     Largeur_colonne_distribution_fraction_volumique,
943     Nom_groupe_forme,
944     boite_3d_analyse);
945 couturad 930 if(!Analyse_erosion)
946     {
947     analyse_maillage_fem->executer(this);
948     ajouter_analyse(analyse_maillage_fem);
949     }
950     else
951     {
952     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
953     analyse_erosion->executer(this);
954     ajouter_analyse(analyse_erosion);
955     }
956 couturad 926 }
957     if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
958 couturad 919 }
959 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
960     double temps_analyse;
961     ot_cpu.get_etape((char*)"analyse",temps_analyse);
962     change_temps_analyse(get_temps_analyse()+temps_analyse);
963 couturad 919 }
964    
965 couturad 933 int MSTRUCT_VES::exporter_maillage_abaqus(void)
966     {
967     std::ofstream f;
968     std::string file="noeuds";
969     f.open(file.c_str(),ios::out);
970     f.precision(16);
971     f.setf(std::ios::showpoint);
972     f << "*NODE"<< std::endl;
973     LISTE_FEM_NOEUD::iterator it;
974     long index=1;
975     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
976     {
977     noeud->change_numero(index);
978     double *coord=noeud->get_coord();
979     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
980     index++;
981     }
982     f.close();
983     file="elements";
984     f.open(file.c_str(),ios::out);
985     f.precision(16);
986     f.setf(std::ios::showpoint);
987     index=1;
988     LISTE_FEM_ELEMENT3::iterator ittele3;
989     bool tetralin=false;
990     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
991     {
992     if(ele3->get_type_entite()==IDFEM_TETRA4)
993     {
994     if(tetralin==false)
995     {
996     tetralin=true;
997     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
998     }
999     f << index << ", "
1000     << ele3->get_fem_noeud(0)->get_numero() << ", "
1001     << ele3->get_fem_noeud(1)->get_numero() << ", "
1002     << ele3->get_fem_noeud(2)->get_numero() << ", "
1003     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
1004     ele3->change_numero(index);
1005     index++;
1006     }
1007     }
1008     bool pentalin=false;
1009     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1010     {
1011     if(ele3->get_type_entite()==IDFEM_PENTA6)
1012     {
1013     if(pentalin==false)
1014     {
1015     pentalin=true;
1016     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1017     }
1018     f << index << ", "
1019     << ele3->get_fem_noeud(0)->get_numero() << ", "
1020     << ele3->get_fem_noeud(1)->get_numero() << ", "
1021     << ele3->get_fem_noeud(2)->get_numero() << ", "
1022     << ele3->get_fem_noeud(3)->get_numero() << ", "
1023     << ele3->get_fem_noeud(4)->get_numero() << ", "
1024     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1025     ele3->change_numero(index);
1026     index++;
1027     }
1028     }
1029     bool tetraquad=false;
1030     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1031     {
1032     if(ele3->get_type_entite()==IDFEM_TETRA10)
1033     {
1034     if(tetraquad==false)
1035     {
1036     tetraquad=true;
1037     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1038     }
1039     f << index << ", "
1040     << ele3->get_fem_noeud(0)->get_numero() << ", "
1041     << ele3->get_fem_noeud(2)->get_numero() << ", "
1042     << ele3->get_fem_noeud(4)->get_numero() << ", "
1043     << ele3->get_fem_noeud(9)->get_numero() << ", "
1044     << ele3->get_fem_noeud(1)->get_numero() << ", "
1045     << ele3->get_fem_noeud(3)->get_numero() << ", "
1046     << ele3->get_fem_noeud(5)->get_numero() << ", "
1047     << ele3->get_fem_noeud(6)->get_numero() << ", "
1048     << ele3->get_fem_noeud(7)->get_numero() << ", "
1049     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1050     ele3->change_numero(index);
1051     index++;
1052     }
1053     }
1054     bool pentaquad=false;
1055     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1056     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1057     {
1058     if(ele3->get_type_entite()==IDFEM_PENTA15)
1059     {
1060     if(pentaquad==false)
1061     {
1062     pentaquad=true;
1063     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1064     }
1065     f << index << ", "
1066     << ele3->get_fem_noeud(0)->get_numero() << ", "
1067     << ele3->get_fem_noeud(2)->get_numero() << ", "
1068     << ele3->get_fem_noeud(4)->get_numero() << ", "
1069     << ele3->get_fem_noeud(9)->get_numero() << ", "
1070     << ele3->get_fem_noeud(11)->get_numero() << ", "
1071     << ele3->get_fem_noeud(13)->get_numero() << ", "
1072     << ele3->get_fem_noeud(1)->get_numero() << ", "
1073     << ele3->get_fem_noeud(3)->get_numero() << ", "
1074     << ele3->get_fem_noeud(5)->get_numero() << ", "
1075     << ele3->get_fem_noeud(10)->get_numero() << ", "
1076     << ele3->get_fem_noeud(12)->get_numero() << ", "
1077     << ele3->get_fem_noeud(14)->get_numero() << ", "
1078     << ele3->get_fem_noeud(6)->get_numero() << ", "
1079     << ele3->get_fem_noeud(7)->get_numero() << ", "
1080     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1081     ele3->change_numero(index);
1082     index++;
1083     }
1084     }
1085     f.close();
1086     file="BC_nsets";
1087     f.open(file.c_str(),ios::out);
1088     f.precision(16);
1089     f.setf(std::ios::showpoint);
1090     BOITE_3D boite3D_ves = get_boite3d_ves();
1091     double eps = get_precision();
1092     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1093     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1094     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1095     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1096     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1097     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1098     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1099     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1100     {
1101     double xyzmin[3];
1102     double xyzmax[3];
1103     face->get_xyz_min_max(xyzmin,xyzmax,16);
1104    
1105     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1106     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);
1107     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);
1108     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);
1109     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);
1110     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);
1111     }
1112     MG_SOMMET* sommet_x0y0z0=NULL;
1113     MG_SOMMET* sommet_x1y0z0=NULL;
1114     MG_SOMMET* sommet_x0y1z0=NULL;
1115     MG_SOMMET* sommet_x1y1z0=NULL;
1116     MG_SOMMET* sommet_x0y0z1=NULL;
1117     MG_SOMMET* sommet_x1y0z1=NULL;
1118     MG_SOMMET* sommet_x0y1z1=NULL;
1119     MG_SOMMET* sommet_x1y1z1=NULL;
1120     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1121     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1122     {
1123     double xyz[3];
1124     som->get_point()->evaluer(xyz);
1125     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;
1126     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;
1127     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;
1128     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;
1129     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;
1130     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;
1131     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;
1132     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;
1133     }
1134     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1135     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1136     f << coin_x0y0z0->get_numero() << std::endl;
1137     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1138     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1139     f << coin_x1y0z0->get_numero() << std::endl;
1140     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1141     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1142     f << coin_x0y1z0->get_numero() << std::endl;
1143     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1144     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1145     f << coin_x1y1z0->get_numero() << std::endl;
1146     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1147     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1148     f << coin_x0y0z1->get_numero() << std::endl;
1149     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1150     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1151     f << coin_x1y0z1->get_numero() << std::endl;
1152     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1153     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1154     f << coin_x0y1z1->get_numero() << std::endl;
1155     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1156     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1157     f << coin_x1y1z1->get_numero() << std::endl;
1158     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1159     f << "*NSET,NSET=xEQ0" << std::endl;
1160     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1161     {
1162     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1163     long nb_ele=lst_ele->get_nb();
1164     for(long i=0;i<nb_ele;i++)
1165     {
1166     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1167     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1168     {
1169     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1170     }
1171     }
1172     }
1173     f << "*NSET,NSET=xEQ1" << std::endl;
1174     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1175     {
1176     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1177     long nb_ele=lst_ele->get_nb();
1178     for(long i=0;i<nb_ele;i++)
1179     {
1180     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1181     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1182     {
1183     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1184     }
1185     }
1186     }
1187     f << "*NSET,NSET=yEQ0" << std::endl;
1188     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1189     {
1190     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1191     long nb_ele=lst_ele->get_nb();
1192     for(long i=0;i<nb_ele;i++)
1193     {
1194     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1195     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1196     {
1197     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1198     }
1199     }
1200     }
1201     f << "*NSET,NSET=yEQ1" << std::endl;
1202     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1203     {
1204     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1205     long nb_ele=lst_ele->get_nb();
1206     for(long i=0;i<nb_ele;i++)
1207     {
1208     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1209     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1210     {
1211     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1212     }
1213     }
1214     }
1215     f << "*NSET,NSET=zEQ0" << std::endl;
1216     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1217     {
1218     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1219     long nb_ele=lst_ele->get_nb();
1220     for(long i=0;i<nb_ele;i++)
1221     {
1222     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1223     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1224     {
1225     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1226     }
1227     }
1228     }
1229     f << "*NSET,NSET=zEQ1" << std::endl;
1230     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1231     {
1232     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1233     long nb_ele=lst_ele->get_nb();
1234     for(long i=0;i<nb_ele;i++)
1235     {
1236     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1237     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1238     {
1239     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1240     }
1241     }
1242     }
1243     f.close();
1244     file="groupes_elements";
1245     f.open(file.c_str(),ios::out);
1246     f.precision(16);
1247     f.setf(std::ios::showpoint);
1248     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
1249     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))
1250     {
1251     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
1252     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
1253     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
1254     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
1255     {
1256     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1257     long nb_ele=lst_ele->get_nb();
1258     for(long i=0;i<nb_ele;i++)
1259     {
1260     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1261     f << ele3->get_numero() << std::endl;
1262     }
1263     }
1264     }
1265 couturad 937
1266     MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Sphere");
1267     if(groupe_forme_particule!=NULL)
1268     {
1269     file="particules";
1270     f.open(file.c_str(),ios::out);
1271     f.precision(16);
1272     f.setf(std::ios::showpoint);
1273     std::ofstream f2;
1274     f2.open((char*)"infos_particules");
1275     f2.precision(16);
1276     f2.setf(std::ios::showpoint);
1277     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
1278     std::ofstream f_bord;
1279     f_bord.open((char*)"particules_bord");
1280     f_bord.precision(16);
1281     f_bord.setf(std::ios::showpoint);
1282     std::ofstream f_interieur;
1283     f_interieur.open((char*)"particules_interieur");
1284     f_interieur.precision(16);
1285     f_interieur.setf(std::ios::showpoint);
1286     long p=1;
1287     std::map<long,MG_CG_FORME*>::iterator it_forme;
1288     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))
1289     {
1290     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
1291     {
1292     f << "*ELSET,ELSET=P_" << p << std::endl;
1293     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1294     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1295     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1296     std::vector<double> vct_centre = centre->get_vct_valeur();
1297     f2 << p << " "
1298     << vct_centre.at(0) << " "
1299     << vct_centre.at(1) << " "
1300     << vct_centre.at(2) << " "
1301     << rayon->get_valeur() << " "
1302     << pos_rel->get_valeur() << std::endl;
1303     bool au_bord;
1304     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1305     else au_bord=false;
1306     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
1307     MG_VOLUME* volume = forme_volume->get_mg_volume();
1308     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1309     long nb_ele=lst_ele->get_nb();
1310     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1311     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1312     for(long i=0;i<nb_ele;i++)
1313     {
1314     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1315     f << ele3->get_numero() << std::endl;
1316     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1317     else f_interieur << ele3->get_numero() << std::endl;
1318     }
1319     p++;
1320     }
1321     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
1322     {
1323     f << "*ELSET,ELSET=P_" << p << std::endl;
1324     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1325     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1326     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1327     std::vector<double> vct_centre = centre->get_vct_valeur();
1328     f2 << p << " "
1329     << vct_centre.at(0) << " "
1330     << vct_centre.at(1) << " "
1331     << vct_centre.at(2) << " "
1332     << rayon->get_valeur() << " "
1333     << pos_rel->get_valeur() << std::endl;
1334     bool au_bord;
1335     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1336     else au_bord=false;
1337     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
1338     std::map<long,MG_VOLUME*>::iterator it_volume;
1339     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))
1340     {
1341     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1342     long nb_ele=lst_ele->get_nb();
1343     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1344     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1345     for(long i=0;i<nb_ele;i++)
1346     {
1347     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1348     f << ele3->get_numero() << std::endl;
1349     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1350     else f_interieur << ele3->get_numero() << std::endl;
1351     }
1352     }
1353     p++;
1354     }
1355     }
1356     f_bord.close();
1357     f_interieur.close();
1358     f2.close();
1359     f.close();
1360     }
1361 couturad 933 }
1362 couturad 926
1363 couturad 933
1364 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
1365 couturad 919 {
1366 couturad 926 m_ves_file->enregistrer(fichier_ves);
1367 couturad 919 }
1368    
1369 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
1370 couturad 919 {
1371 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
1372     m_ves_file->enregistrer(fichier_ves);
1373     m_mg_gestionnaire->enregistrer(fichier_magic);
1374 couturad 919 }
1375    
1376 couturad 926 void MSTRUCT_VES::active_affichage(MICROSTRUCTURE::fonction_affiche* fonc)
1377 couturad 919 {
1378     fonc_affiche = fonc;
1379     affichageactif = 1;
1380     }
1381    
1382 couturad 926 void MSTRUCT_VES::affiche(char* message)
1383 couturad 919 {
1384     if(affichageactif==1) fonc_affiche(message);
1385     }
1386    
1387    
1388    
1389    
1390