ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 951
Committed: Fri Aug 10 15:17:17 2018 UTC (6 years, 9 months ago) by couturad
File size: 66568 byte(s)
Log Message:
-> Ajout de Project Chrono (voir CMakeLists.txt).
-> Ajout d'un générateur de microstructure basé sur la dynamique des corps rigides (MSTRUCT_GENERATEUR_DCR).
-> Ajout d'un opérateur de décallage de la topologie (MG_CG_OP_TRANSF_DECALLAGE).
-> Retrait de «using namespace std»  (conflit avec namespace chrono) et modification des fichiers affectés.
-> Modification de mailleur2d.cpp afin d'enregistrer un fichier MAGiC (void.magic) lorsque le nombre d'itération dépasse la valeur maximale.

File Contents

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