ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 960
Committed: Wed Aug 15 19:35:25 2018 UTC (6 years, 8 months ago) by couturad
File size: 67319 byte(s)
Log Message:
Ajout de parametres pour le generateur dcr

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 couturad 952 #ifdef PROJECT_CHRONO
386 couturad 951 std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
387     MSTRUCT_GENERATEUR_DCR *DCR;
388     if(generateur==NULL)
389     {
390     DCR = new MSTRUCT_GENERATEUR_DCR(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
391     generateur=DCR;
392     DCR->active_affichage(fonc_affiche);
393     }
394     double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
395     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
396     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
397     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
398     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
399     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
400     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
401     Boite3D_distribution_Ymin,
402     Boite3D_distribution_Zmin,
403     Boite3D_distribution_Xmax,
404     Boite3D_distribution_Ymax,
405     Boite3D_distribution_Zmax);
406     DCR->change_boite3d_distribution(Boite3D_distribution);
407     double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
408     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
409     double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
410     DCR->change_nb_pas_grille(Nb_pas_X);
411     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
412     DCR->change_distance_inter_volume_min(Distance_min_inter_volume);
413     double Volume_min = param->get_valeur((char*)"Volume_min");
414     DCR->change_volume_min(Volume_min);
415     double Aire_min = param->get_valeur((char*)"Aire_min");
416     DCR->change_aire_min(Aire_min);
417     double Longueur_min = param->get_valeur((char*)"Longueur_min");
418     DCR->change_longueur_min(Longueur_min);
419     double Angle_min = param->get_valeur((char*)"Angle_min");
420     DCR->change_angle_min(Angle_min);
421     double Nb_iteration_max = param->get_valeur((char*)"Nb_iteration_max");
422     bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
423     DCR->change_intersection_bords_ves(Avec_intersections);
424     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
425     int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
426     double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
427     double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
428     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
429     std::string multicouche = param->get_nom((char*)"Multicouche");
430 couturad 919
431 couturad 960 bool Avec_interface_graphique = (bool)param->get_valeur((char*)"Avec_interface_graphique");
432     double Facteur_reduction_vitesse = param->get_valeur((char*)"Facteur_reduction_vitesse");
433     double Friction = param->get_valeur((char*)"Friction");
434     double Pas_temps_sim = param->get_valeur((char*)"Pas_temps_sim");
435     double Temps_max_sim = param->get_valeur((char*)"Temps_max_sim");
436     double Eps_vitesse = param->get_valeur((char*)"Eps_vitesse");
437     DCR->active_interface_graphique(Avec_interface_graphique);
438     DCR->change_facteur_reduction_vitesse(Facteur_reduction_vitesse);
439     DCR->change_eps_vitesse(Eps_vitesse);
440     DCR->change_friction(Friction);
441     DCR->change_pas_temps(Pas_temps_sim);
442     DCR->change_temps_max_sim(Temps_max_sim);
443 couturad 951
444    
445     PARS_ARGUMENT parse_param[100];
446     PARSE parse;
447     parse.decode(multicouche.c_str(),"@,(&)",parse_param);
448     std::vector<double> *vector_epaisseur=NULL;
449     int nb_couche = atoi(parse_param[0].argument[0].c_str());
450     if(nb_couche>0)
451     {
452     vector_epaisseur=new std::vector<double>;
453     for(int i=0;i<nb_couche;i++)
454     {
455     double epaisseur=atof(parse_param[1].argument[i].c_str());
456     vector_epaisseur->push_back(epaisseur);
457     }
458     }
459     if(Type_inclusion==MSTRUCT_GENERATEUR_RSA::TYPE_INCLUSION::SPHERE)
460     {
461     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
462     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
463     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
464     DCR->ajouter_spheres(Nom_groupe_inclusion,Mu_rayon,Sigma_rayon,Type_distribution_rayon,Fraction_volumique_cible,Eps_fraction_volumique);
465     DCR->lancer_simulation();
466    
467     }
468     else if(Type_inclusion==MSTRUCT_GENERATEUR_RSA::TYPE_INCLUSION::CYLINDRE)
469     {
470     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
471     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
472     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
473     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
474     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
475     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
476     double Mu_theta = param->get_valeur((char*)"Mu_theta");
477     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
478     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
479     double Mu_phi = param->get_valeur((char*)"Mu_phi");
480     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
481     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
482     DCR->ajouter_cylindres(Nom_groupe_inclusion,
483     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
484     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
485     Mu_theta,Sigma_theta,Type_distribution_theta,
486     Mu_phi,Sigma_phi,Type_distribution_phi,
487     Fraction_volumique_cible,Eps_fraction_volumique);
488     DCR->lancer_simulation();
489 couturad 953 }
490     if(vector_epaisseur!=NULL) delete vector_epaisseur;
491 couturad 952 #else
492     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
493 couturad 953 #endif
494 couturad 919 }
495     }
496     ot_cpu.ajouter_etape((char*)"generation_geometrie");
497 couturad 926 double temps_generation_geometrie;
498     ot_cpu.get_etape((char*)"generation_geometrie",temps_generation_geometrie);
499     change_temps_geometrie(get_temps_geometrie()+temps_generation_geometrie);
500 couturad 919 generateur->construire(this);
501     delete generateur;
502     return OK;
503     }
504    
505 couturad 926 int MSTRUCT_VES::generer_materiau(std::vector< OT_PARAMETRES* >& vector_params_materiau)
506 couturad 919 {
507     OT_CPU ot_cpu;
508     ot_cpu.initialise();
509     std::vector<OT_PARAMETRES*>::iterator it;
510     for(it=vector_params_materiau.begin();it!=vector_params_materiau.end();it++)
511     {
512     OT_PARAMETRES* param = *it;
513     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
514     double Mu_E = param->get_valeur((char*)"Mu_E");
515     double Sigma_E = param->get_valeur((char*)"Sigma_E");
516     double Mu_nu = param->get_valeur((char*)"Mu_nu");
517     double Sigma_nu = param->get_valeur((char*)"Sigma_nu");
518 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
519     std::map<long,MG_CG_FORME*>::iterator it_forme;
520     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))
521 couturad 919 {
522     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
523     {
524     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
525     if(Sigma_E==0.0) forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",Mu_E);
526     else
527     {
528     std::random_device seed;
529     std::mt19937_64 generateur(seed());
530     std::normal_distribution<double> distribution(Mu_E,Sigma_E);
531     double Em = distribution(generateur);
532     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",Em);
533     }
534     if(Sigma_nu==0.0) forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",Mu_nu);
535     else
536     {
537     std::random_device seed;
538     std::mt19937_64 generateur(seed());
539     std::normal_distribution<double> distribution(Mu_nu,Sigma_nu);
540     double nu = distribution(generateur);
541     forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",nu);
542     }
543     }
544     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
545     {
546     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
547     std::map<long,MG_VOLUME*>::iterator it_volume;
548     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))
549     {
550     if(Sigma_E==0.0) volume->ajouter_ccf((char*)"Em",Mu_E);
551     else
552     {
553     std::random_device seed;
554     std::mt19937_64 generateur(seed());
555     std::normal_distribution<double> distribution(Mu_E,Sigma_E);
556     double Em = distribution(generateur);
557     volume->ajouter_ccf((char*)"Em",Em);
558     }
559     if(Sigma_nu==0.0) volume->ajouter_ccf((char*)"nu",Mu_nu);
560     else
561     {
562     std::random_device seed;
563     std::mt19937_64 generateur(seed());
564     std::normal_distribution<double> distribution(Mu_nu,Sigma_nu);
565     double nu = distribution(generateur);
566     volume->ajouter_ccf((char*)"nu",nu);
567     }
568     }
569     }
570     }
571     }
572     ot_cpu.ajouter_etape((char*)"generation_materiau");
573 couturad 926 double temps_generation_materiau;
574     ot_cpu.get_etape((char*)"generation_materiau",temps_generation_materiau);
575     change_temps_materiau(get_temps_materiau()+temps_generation_materiau);
576 couturad 919 return OK;
577     }
578    
579 couturad 926 int MSTRUCT_VES::generer_carte(OT_PARAMETRES *param)
580 couturad 919 {
581     double Ecart_nodal = param->get_valeur((char*)"Ecart_nodal");
582 couturad 937 double Ecart_nodal_face_particule = param->get_valeur((char*)"Ecart_nodal_face_particule");
583 couturad 919 double Fechantillonnage = param->get_valeur((char*)"Fechantillonnage");
584     double Nb_cellule_direction = param->get_valeur((char*)"Nb_cellule_direction");
585     std::string Nom_fem_solution = param->get_nom((char*)"Nom_fem_solution");
586     std::string Nom_mg_gestionnaire_carte = param->get_nom((char*)"Nom_mg_gestionnaire_carte");
587     std::string Nom_carte = param->get_nom((char*)"Nom_carte");
588     double Nb_couche_min = param->get_valeur((char*)"Nb_couche_min");
589     double Nb_pas = param->get_valeur((char*)"Nb_pas");
590     double Facteur_augmentation = param->get_valeur((char*)"Facteur_augmentation");
591     MG_GESTIONNAIRE *mggest_carte = new MG_GESTIONNAIRE;
592 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_matrice = m_mgcg_modele->get_mgcg_groupe_forme((char*)"Matrice");
593     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume_matrice = mgcg_groupe_matrice->get_tpl_map_volume();
594 couturad 919 OT_CPU ot_cpu;
595     ot_cpu.initialise();
596     FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE *carte = new FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE(mggest_carte,
597     m_mg_geometrie,
598     Ecart_nodal,
599 couturad 937 Ecart_nodal_face_particule,
600 couturad 919 Fechantillonnage,
601     Nb_cellule_direction,
602     (char*)Nom_fem_solution.c_str(),
603     tpl_map_volume_matrice,
604     Nb_couche_min,
605     Nb_pas,
606     Facteur_augmentation);
607 couturad 926
608    
609 couturad 933 carte->active_affichage(fonc_affiche);
610 couturad 926 carte->construit();
611 couturad 919 ot_cpu.ajouter_etape((char*)"generation_carte");
612 couturad 926 double temps_generation_carte;
613     ot_cpu.get_etape((char*)"generation_carte",temps_generation_carte);
614     change_temps_carte(get_temps_carte()+temps_generation_carte);
615     mggest_carte->enregistrer(Nom_mg_gestionnaire_carte.c_str());
616 couturad 919 carte->enregistrer((char*)Nom_carte.c_str());
617 couturad 926 m_ves_file->change_nom_fichier_carte((char*)Nom_carte.c_str());
618 couturad 919 return OK;
619     }
620    
621 couturad 926 int MSTRUCT_VES::generer_maillage(OT_PARAMETRES *param,FCT_TAILLE_FEM_SOLUTION* carte)
622 couturad 919 {
623     OT_CPU ot_cpu;
624     ot_cpu.initialise();
625     int Niveau = (int)param->get_valeur((char*)"Niveau");
626     int Niveau_opt_2d = (int)param->get_valeur((char*)"Niveau_opt_2d");
627     int Niveau_opt_3d = (int)param->get_valeur((char*)"Niveau_opt_3d");
628     double Priorite_metrique = param->get_valeur((char*)"Priorite_metrique");
629     int Analyse = (int)param->get_valeur((char*)"Analyse");
630     affiche((char*)"Maillage du VER :");
631     m_mg_maillage = new MG_MAILLAGE(m_mg_geometrie);
632     m_mg_gestionnaire->ajouter_mg_maillage(m_mg_maillage);
633 couturad 951 change_mg_maillage(m_mg_maillage);
634     affiche((char*)" Maillage 3D_couche :");
635     MAILLEUR3D_COUCHE m3d_couche(m_mg_maillage,m_mg_geometrie,carte);
636     m3d_couche.active_affichage(fonc_affiche);
637     LISTE_MG_VOLUME::iterator it_volume;
638     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
639 couturad 919 {
640 couturad 951 if(volume->est_mince())
641     {
642     char message[1000];
643     sprintf(message," -> Maillage du volume id %li",volume->get_id());
644     affiche(message);
645     m3d_couche.maille(volume);
646     }
647 couturad 919 }
648 couturad 951 if(Niveau>=0)
649 couturad 919 {
650 couturad 951 MAILLEUR0D m0d(m_mg_maillage,m_mg_geometrie);
651     affiche((char*)" Maillage 0D :");
652     LISTE_MG_SOMMET::iterator it_sommet;
653     for(MG_SOMMET* sommet=m_mg_geometrie->get_premier_sommet(it_sommet);sommet!=NULL;sommet=m_mg_geometrie->get_suivant_sommet(it_sommet))
654     {
655     if(sommet->get_lien_maillage()->get_nb()>0) continue;
656     char message[1000];
657     sprintf(message," -> Maillage du sommet id %li",sommet->get_id());
658     affiche(message);
659     m0d.maille(sommet);
660     }
661 couturad 919 }
662 couturad 951 if(Niveau>=1)
663 couturad 919 {
664 couturad 951 MAILLEUR1D m1d(m_mg_maillage,m_mg_geometrie,carte);
665     affiche((char*)" Maillage 1D :");
666     m1d.active_affichage(fonc_affiche);
667     LISTE_MG_ARETE::iterator it_arete;
668     for(MG_ARETE* arete=m_mg_geometrie->get_premier_arete(it_arete);arete!=NULL;arete=m_mg_geometrie->get_suivant_arete(it_arete))
669     {
670     if(arete->get_lien_maillage()->get_nb()>0) continue;
671     char message[1000];
672     sprintf(message," -> Maillage de l'arete id %li",arete->get_id());
673     affiche(message);
674     m1d.maille(arete);
675     }
676 couturad 919 }
677 couturad 951 if(Niveau>=2)
678 couturad 919 {
679 couturad 951 MAILLEUR2D m2d(m_mg_maillage,m_mg_geometrie,carte);
680     m2d.change_niveau_optimisation(Niveau_opt_2d);
681     m2d.change_priorite_metrique(Priorite_metrique);
682     affiche((char*)" Maillage 2D :");
683     m2d.active_affichage(fonc_affiche);
684     LISTE_MG_FACE::iterator it_face;
685     for(MG_FACE* face=m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
686     {
687     if(face->get_lien_maillage()->get_nb()>0) continue;
688     char message[1000];
689     sprintf(message," -> Maillage de la face id %li",face->get_id());
690     affiche(message);
691     m2d.maille(face);
692     }
693 couturad 919 }
694 couturad 951 if(Niveau>=3)
695     {
696     MAILLEUR3D m3d(m_mg_maillage,m_mg_geometrie,carte,false);
697     m3d.change_niveau_optimisation(Niveau_opt_3d);
698     m3d.change_priorite_metrique(Priorite_metrique);
699     affiche((char*)" Maillage 3D :");
700     m3d.active_affichage(fonc_affiche);
701     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
702     {
703     if(volume->get_lien_maillage()->get_nb()>0) continue;
704     if(volume->est_mince()) continue;
705     char message[1000];
706     sprintf(message," -> Maillage du volume id %li",volume->get_id());
707     affiche(message);
708     m3d.maille(volume);
709     }
710     }
711 couturad 919 ot_cpu.ajouter_etape((char*)"generation_maillage");
712 couturad 926 double temps_generation_maillage;
713     ot_cpu.get_etape((char*)"generation_maillage",temps_generation_maillage);
714     change_temps_maillage(get_temps_maillage()+temps_generation_maillage);
715 couturad 919 return OK;
716     }
717    
718 couturad 926 int MSTRUCT_VES::generer_fem_maillage(OT_PARAMETRES *param)
719 couturad 919 {
720     OT_CPU ot_cpu;
721     ot_cpu.initialise();
722     int Degre = (int)param->get_valeur((char*)"Degre");
723     int Analyse = (int)param->get_valeur((char*)"Analyse");
724     int Optimisation_num_noeud = (int)param->get_valeur((char*)"Optimisation_num_noeud");
725     MAILLEUR_FEM mailleurfem;
726     mailleurfem.active_affichage(fonc_affiche);
727 couturad 926 m_fem_maillage = new FEM_MAILLAGE(m_mg_maillage->get_mg_geometrie(),m_mg_maillage,Degre);
728 couturad 919 m_mg_gestionnaire->ajouter_fem_maillage(m_fem_maillage);
729 couturad 926 change_fem_maillage(m_fem_maillage);
730 couturad 919 if(Optimisation_num_noeud) mailleurfem.maille(m_fem_maillage,1);
731     else mailleurfem.maille(m_fem_maillage,0);
732     if(Analyse)
733     {
734     MAILLEUR_ANALYSE m3d(m_fem_maillage);
735     m3d.active_affichage(fonc_affiche);
736     // m3d.analyse();
737     }
738     ot_cpu.ajouter_etape((char*)"generation_fem_maillage");
739 couturad 926 double temps_generation_fem_maillage;
740     ot_cpu.get_etape((char*)"generation_fem_maillage",temps_generation_fem_maillage);
741     change_temps_fem_maillage(get_temps_fem_maillage()+temps_generation_fem_maillage);
742 couturad 919 return OK;
743     }
744    
745 couturad 926 int MSTRUCT_VES::generer_etude(OT_PARAMETRES *param)
746 couturad 919 {
747     OT_CPU ot_cpu;
748     ot_cpu.initialise();
749 couturad 926 BOITE_3D boite3D_ves = get_boite3d_ves();
750     double eps = get_precision();
751 couturad 919 TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
752     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
753     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
754     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
755     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
756     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
757     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
758     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
759     {
760     double xyzmin[3];
761     double xyzmax[3];
762     face->get_xyz_min_max(xyzmin,xyzmax,16);
763    
764 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);
765     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);
766     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);
767     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);
768     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);
769     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);
770 couturad 919 }
771     MG_SOMMET* sommet_origine;
772     MG_SOMMET* sommet_x1y0z0;
773     MG_SOMMET* sommet_x0y1z0;
774     MG_SOMMET* sommet_x0y0z1;
775     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
776     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
777     {
778     double xyz[3];
779     som->get_point()->evaluer(xyz);
780 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;
781     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;
782     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;
783     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;
784 couturad 919 }
785     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
786     int Type_Chargement = (int)param->get_valeur((char*)"Type_Chargement");
787     int Type_CL = (int)param->get_valeur((char*)"Type_CL");
788     double Valeur_CL = param->get_valeur((char*)"Valeur_CL");
789     if(Type_etude==TYPE_ETUDE::MECANIQUE)
790     {
791     if(Type_Chargement==TYPE_CHARGEMENT::SPHERIQUE)
792     {
793     if(Type_CL==TYPE_CONDITIONS_LIMITES::DEFORMATION_HOMOGENE)
794     {
795     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true);
796     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",Valeur_CL,true);
797     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true);
798     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",Valeur_CL,true);
799     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true);
800     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",Valeur_CL,true);
801     }
802     else if(Type_CL==TYPE_CONDITIONS_LIMITES::CONTRAINTE_HOMOGENE)
803     {
804     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true);
805     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Pz",Valeur_CL,false);
806     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true);
807     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Px",Valeur_CL,false);
808     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true);
809     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Py",Valeur_CL,false);
810     }
811     }
812     else if(Type_Chargement==TYPE_CHARGEMENT::DEVIATORIQUE)
813     {
814     if(Type_CL==TYPE_CONDITIONS_LIMITES::DEFORMATION_HOMOGENE)
815     {
816     char chr_valeur_cl[1000];
817     sprintf(chr_valeur_cl,"%lf",Valeur_CL);
818     std::string str_valeur_cl = chr_valeur_cl;
819     std::string formule_Dx = str_valeur_cl+ "*Y";
820     std::string formule_Dy = str_valeur_cl+ "*Z";
821     std::string formule_Dz = str_valeur_cl+ "*X";
822     std::vector<std::string> liste_variable_formule_Dx;
823     std::vector<std::string> liste_variable_formule_Dy;
824     std::vector<std::string> liste_variable_formule_Dz;
825     liste_variable_formule_Dx.push_back((std::string)"Y");
826     liste_variable_formule_Dy.push_back((std::string)"Z");
827     liste_variable_formule_Dz.push_back((std::string)"X");
828     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
829     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
830     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
831     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
832     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
833     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
834     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
835     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
836     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
837     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
838     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
839     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
840     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
841     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
842     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
843     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
844     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
845     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
846     }
847     else if(Type_CL==TYPE_CONDITIONS_LIMITES::CONTRAINTE_HOMOGENE)
848     {
849     sommet_origine->ajouter_ccf((char*)"Dt",0.0);
850     sommet_x1y0z0->ajouter_ccf((char*)"Dy",0.0);
851     sommet_x1y0z0->ajouter_ccf((char*)"Dz",0.0);
852     sommet_x0y1z0->ajouter_ccf((char*)"Dz",0.0);
853     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Px",-Valeur_CL,true);
854     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Py",-Valeur_CL,true);
855     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Px",Valeur_CL,true);
856     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Py",Valeur_CL,true);
857     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Px",-Valeur_CL,true);
858     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Pz",-Valeur_CL,true);
859     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Px",Valeur_CL,true);
860     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Pz",Valeur_CL,true);
861     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Py",-Valeur_CL,true);
862     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Pz",-Valeur_CL,true);
863     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Py",Valeur_CL,true);
864     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Pz",Valeur_CL,true);
865     }
866     }
867     }
868     ot_cpu.ajouter_etape((char*)"generation_etude");
869 couturad 926 double temps_generation_etude;
870     ot_cpu.get_etape((char*)"generation_etude",temps_generation_etude);
871     change_temps_etude(get_temps_etude()+temps_generation_etude);
872 couturad 919 return OK;
873     }
874    
875 couturad 926 int MSTRUCT_VES::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, double valeur,bool topo_sous_jacente)
876 couturad 919 {
877     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
878     for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan))
879     {
880     face->ajouter_ccf(condition,valeur);
881     if(topo_sous_jacente==true)
882     {
883     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo;
884     face->get_topologie_sousjacente(&map_topo);
885     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo;
886     for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo))
887     {
888     topo->ajouter_ccf(condition,valeur);
889     }
890     }
891     }
892     }
893    
894 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)
895 couturad 919 {
896     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
897     for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan))
898     {
899     face->ajouter_ccf(condition,formule,listvariable);
900     if(topo_sous_jacente==true)
901     {
902     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo;
903     face->get_topologie_sousjacente(&map_topo);
904     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo;
905     for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo))
906     {
907     topo->ajouter_ccf(condition,formule,listvariable);
908     }
909     }
910     }
911     }
912    
913 couturad 926 int MSTRUCT_VES::generer_calcul(OT_PARAMETRES *param,char* param_aster)
914 couturad 919 {
915     std::string Nom_etude = param->get_nom((char*)"Nom_etude");
916     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
917     int Type_calcul = (int)param->get_valeur((char*)"Type_calcul");
918     std::string Code_resu = param->get_nom((char*)"Code_resu");
919     MGASTER mgaster;
920     mgaster.active_affichage(fonc_affiche);
921     OT_CPU ot_cpu;
922     ot_cpu.initialise();
923     mgaster.calcule(param_aster,m_fem_maillage,(char*)Nom_etude.c_str(),Type_calcul,(char*)Code_resu.c_str());
924     ot_cpu.ajouter_etape((char*)"calcul");
925 couturad 926 double temps_calcul;
926     ot_cpu.get_etape((char*)"calcul",temps_calcul);
927     change_temps_calcul(get_temps_calcul()+temps_calcul);
928 couturad 919 }
929    
930 couturad 926 int MSTRUCT_VES::generer_analyse(std::vector< OT_PARAMETRES* >& vector_params_analyse)
931 couturad 919 {
932 couturad 926 OT_CPU ot_cpu;
933     ot_cpu.initialise();
934     std::vector<OT_PARAMETRES*>::iterator it;
935     for(it=vector_params_analyse.begin();it!=vector_params_analyse.end();it++)
936 couturad 919 {
937 couturad 926 OT_PARAMETRES* param = *it;
938     std::string Identifiant = param->get_nom((char*)"Identifiant");
939     if(get_analyse(Identifiant)!=NULL)
940     {
941     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
942     continue;
943     }
944     char ligne[1000];
945     sprintf(ligne,"-> %s",Identifiant.c_str());
946     affiche(ligne);
947     int Type_analyse = (int)param->get_valeur((char*)"Type_analyse");
948     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
949 couturad 930 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
950     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
951     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
952 couturad 926 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
953     BOITE_3D *boite_3d_analyse=NULL;
954     if(Boite_analyse)
955     {
956     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
957     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
958     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
959     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
960     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
961     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
962     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
963     }
964     if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CHAMP)
965     {
966     long Num_solution = (long)param->get_valeur((char*)"Num_solution");
967     FEM_SOLUTION* sol = m_mg_gestionnaire->get_fem_solution(Num_solution);
968     int nb_champ = sol->get_nb_champ();
969     double Largeur_colonne = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
970     MSTRUCT_ANALYSE_CHAMP* analyse_champ = new MSTRUCT_ANALYSE_CHAMP(Identifiant,sol->get_id(),nb_champ,Largeur_colonne,Nom_groupe_forme,boite_3d_analyse);
971 couturad 930 if(!Analyse_erosion)
972     {
973     analyse_champ->executer(this);
974     ajouter_analyse(analyse_champ);
975     }
976     else
977     {
978     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_champ,Nb_couche,Epaisseur_couche);
979     analyse_erosion->executer(this);
980     ajouter_analyse(analyse_erosion);
981     }
982 couturad 926 }
983     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION)
984     {
985     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION(Identifiant,Nom_groupe_forme,boite_3d_analyse);
986 couturad 930 if(!Analyse_erosion)
987     {
988     analyse_orientation->executer(this);
989     ajouter_analyse(analyse_orientation);
990     }
991     else
992     {
993     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
994     analyse_erosion->executer(this);
995     ajouter_analyse(analyse_erosion);
996     }
997 couturad 926 }
998 couturad 938 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::ORIENTATION_PONDEREE)
999     {
1000     MSTRUCT_ANALYSE_ORIENTATION_PONDEREE* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION_PONDEREE(Identifiant,Nom_groupe_forme,boite_3d_analyse);
1001     if(!Analyse_erosion)
1002     {
1003     analyse_orientation->executer(this);
1004     ajouter_analyse(analyse_orientation);
1005     }
1006     else
1007     {
1008     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
1009     analyse_erosion->executer(this);
1010     ajouter_analyse(analyse_erosion);
1011     }
1012     }
1013 couturad 926 else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::CAO)
1014     {
1015     double Largeur_colonne_distribution_nb_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_volume");
1016     double Largeur_colonne_distribution_nb_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_forme");
1017     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
1018     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
1019     double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
1020     MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(Identifiant,
1021     Largeur_colonne_distribution_nb_volume,
1022     Largeur_colonne_distribution_nb_forme,
1023     Largeur_colonne_distribution_volume,
1024     Largeur_colonne_distribution_fraction_volumique,
1025     Largeur_colonne_distribution_volume_forme,
1026     Nom_groupe_forme);
1027 couturad 930 if(!Analyse_erosion)
1028     {
1029     analyse_cao->executer(this);
1030     ajouter_analyse(analyse_cao);
1031     }
1032     else
1033     {
1034     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cao,Nb_couche,Epaisseur_couche);
1035     analyse_erosion->executer(this);
1036     ajouter_analyse(analyse_erosion);
1037     }
1038 couturad 926 }
1039     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_MG)
1040     {
1041     double Largeur_colonne_distribution_nb_element_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_2D");
1042     double Largeur_colonne_distribution_nb_element_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_3D");
1043     double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
1044     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
1045     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
1046     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
1047     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
1048     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
1049    
1050     MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(Identifiant,
1051     m_mg_maillage->get_id(),
1052     Largeur_colonne_distribution_qualite_2D,
1053     Largeur_colonne_distribution_nb_element_2D,
1054     Largeur_colonne_distribution_nb_element_3D,
1055     Largeur_colonne_distribution_taille_2D,
1056     Largeur_colonne_distribution_qualite_3D,
1057     Largeur_colonne_distribution_taille_3D,
1058     Largeur_colonne_distribution_volume,
1059     Largeur_colonne_distribution_fraction_volumique,
1060     Nom_groupe_forme);
1061 couturad 930 if(!Analyse_erosion)
1062     {
1063     analyse_mg_maillage->executer(this);
1064     ajouter_analyse(analyse_mg_maillage);
1065     }
1066     else
1067     {
1068     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
1069     analyse_erosion->executer(this);
1070     ajouter_analyse(analyse_erosion);
1071     }
1072 couturad 926 }
1073     else if(Type_analyse==MSTRUCT_ANALYSE::TYPE_ANALYSE::MAILLAGE_FEM)
1074     {
1075     double Largeur_colonne_distribution_nb_element_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_2D");
1076     double Largeur_colonne_distribution_nb_element_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_nb_element_3D");
1077     double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
1078     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
1079     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
1080     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
1081     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
1082     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
1083     double Largeur_colonne_distribution_volume = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume");
1084     double Largeur_colonne_distribution_fraction_volumique = (double)param->get_valeur((char*)"Largeur_colonne_distribution_fraction_volumique");
1085     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(Identifiant,
1086     m_fem_maillage->get_id(),
1087     Largeur_colonne_distribution_nb_element_2D,
1088     Largeur_colonne_distribution_nb_element_3D,
1089     Largeur_colonne_distribution_jacobien_2D_min,
1090     Largeur_colonne_distribution_jacobien_2D_max,
1091     Largeur_colonne_distribution_jacobien_3D_min,
1092     Largeur_colonne_distribution_jacobien_3D_max,
1093     Largeur_colonne_distribution_distortion_2D,
1094     Largeur_colonne_distribution_distortion_3D,
1095     Largeur_colonne_distribution_volume,
1096     Largeur_colonne_distribution_fraction_volumique,
1097     Nom_groupe_forme,
1098     boite_3d_analyse);
1099 couturad 930 if(!Analyse_erosion)
1100     {
1101     analyse_maillage_fem->executer(this);
1102     ajouter_analyse(analyse_maillage_fem);
1103     }
1104     else
1105     {
1106     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
1107     analyse_erosion->executer(this);
1108     ajouter_analyse(analyse_erosion);
1109     }
1110 couturad 926 }
1111     if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1112 couturad 919 }
1113 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
1114     double temps_analyse;
1115     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1116     change_temps_analyse(get_temps_analyse()+temps_analyse);
1117 couturad 919 }
1118    
1119 couturad 933 int MSTRUCT_VES::exporter_maillage_abaqus(void)
1120     {
1121     std::ofstream f;
1122     std::string file="noeuds";
1123 couturad 959 f.open(file.c_str(),std::ios::out);
1124 couturad 933 f.precision(16);
1125     f.setf(std::ios::showpoint);
1126     f << "*NODE"<< std::endl;
1127     LISTE_FEM_NOEUD::iterator it;
1128     long index=1;
1129     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
1130     {
1131     noeud->change_numero(index);
1132     double *coord=noeud->get_coord();
1133     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
1134     index++;
1135     }
1136     f.close();
1137     file="elements";
1138 couturad 959 f.open(file.c_str(),std::ios::out);
1139 couturad 933 f.precision(16);
1140     f.setf(std::ios::showpoint);
1141     index=1;
1142     LISTE_FEM_ELEMENT3::iterator ittele3;
1143     bool tetralin=false;
1144     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1145     {
1146     if(ele3->get_type_entite()==IDFEM_TETRA4)
1147     {
1148     if(tetralin==false)
1149     {
1150     tetralin=true;
1151     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
1152     }
1153     f << index << ", "
1154     << ele3->get_fem_noeud(0)->get_numero() << ", "
1155     << ele3->get_fem_noeud(1)->get_numero() << ", "
1156     << ele3->get_fem_noeud(2)->get_numero() << ", "
1157     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
1158     ele3->change_numero(index);
1159     index++;
1160     }
1161     }
1162     bool pentalin=false;
1163     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1164     {
1165     if(ele3->get_type_entite()==IDFEM_PENTA6)
1166     {
1167     if(pentalin==false)
1168     {
1169     pentalin=true;
1170     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1171     }
1172     f << index << ", "
1173     << ele3->get_fem_noeud(0)->get_numero() << ", "
1174     << ele3->get_fem_noeud(1)->get_numero() << ", "
1175     << ele3->get_fem_noeud(2)->get_numero() << ", "
1176     << ele3->get_fem_noeud(3)->get_numero() << ", "
1177     << ele3->get_fem_noeud(4)->get_numero() << ", "
1178     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1179     ele3->change_numero(index);
1180     index++;
1181     }
1182     }
1183     bool tetraquad=false;
1184     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1185     {
1186     if(ele3->get_type_entite()==IDFEM_TETRA10)
1187     {
1188     if(tetraquad==false)
1189     {
1190     tetraquad=true;
1191     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1192     }
1193     f << index << ", "
1194     << ele3->get_fem_noeud(0)->get_numero() << ", "
1195     << ele3->get_fem_noeud(2)->get_numero() << ", "
1196     << ele3->get_fem_noeud(4)->get_numero() << ", "
1197     << ele3->get_fem_noeud(9)->get_numero() << ", "
1198     << ele3->get_fem_noeud(1)->get_numero() << ", "
1199     << ele3->get_fem_noeud(3)->get_numero() << ", "
1200     << ele3->get_fem_noeud(5)->get_numero() << ", "
1201     << ele3->get_fem_noeud(6)->get_numero() << ", "
1202     << ele3->get_fem_noeud(7)->get_numero() << ", "
1203     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1204     ele3->change_numero(index);
1205     index++;
1206     }
1207     }
1208     bool pentaquad=false;
1209     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1210     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1211     {
1212     if(ele3->get_type_entite()==IDFEM_PENTA15)
1213     {
1214     if(pentaquad==false)
1215     {
1216     pentaquad=true;
1217     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1218     }
1219     f << index << ", "
1220     << ele3->get_fem_noeud(0)->get_numero() << ", "
1221     << ele3->get_fem_noeud(2)->get_numero() << ", "
1222     << ele3->get_fem_noeud(4)->get_numero() << ", "
1223     << ele3->get_fem_noeud(9)->get_numero() << ", "
1224     << ele3->get_fem_noeud(11)->get_numero() << ", "
1225     << ele3->get_fem_noeud(13)->get_numero() << ", "
1226     << ele3->get_fem_noeud(1)->get_numero() << ", "
1227     << ele3->get_fem_noeud(3)->get_numero() << ", "
1228     << ele3->get_fem_noeud(5)->get_numero() << ", "
1229     << ele3->get_fem_noeud(10)->get_numero() << ", "
1230     << ele3->get_fem_noeud(12)->get_numero() << ", "
1231     << ele3->get_fem_noeud(14)->get_numero() << ", "
1232     << ele3->get_fem_noeud(6)->get_numero() << ", "
1233     << ele3->get_fem_noeud(7)->get_numero() << ", "
1234     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1235     ele3->change_numero(index);
1236     index++;
1237     }
1238     }
1239     f.close();
1240     file="BC_nsets";
1241 couturad 959 f.open(file.c_str(),std::ios::out);
1242 couturad 933 f.precision(16);
1243     f.setf(std::ios::showpoint);
1244     BOITE_3D boite3D_ves = get_boite3d_ves();
1245     double eps = get_precision();
1246     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1247     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1248     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1249     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1250     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1251     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1252     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1253     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1254     {
1255     double xyzmin[3];
1256     double xyzmax[3];
1257     face->get_xyz_min_max(xyzmin,xyzmax,16);
1258    
1259     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1260     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);
1261     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);
1262     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);
1263     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);
1264     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);
1265     }
1266     MG_SOMMET* sommet_x0y0z0=NULL;
1267     MG_SOMMET* sommet_x1y0z0=NULL;
1268     MG_SOMMET* sommet_x0y1z0=NULL;
1269     MG_SOMMET* sommet_x1y1z0=NULL;
1270     MG_SOMMET* sommet_x0y0z1=NULL;
1271     MG_SOMMET* sommet_x1y0z1=NULL;
1272     MG_SOMMET* sommet_x0y1z1=NULL;
1273     MG_SOMMET* sommet_x1y1z1=NULL;
1274     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1275     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1276     {
1277     double xyz[3];
1278     som->get_point()->evaluer(xyz);
1279     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;
1280     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;
1281     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;
1282     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;
1283     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;
1284     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;
1285     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;
1286     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;
1287     }
1288     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1289     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1290     f << coin_x0y0z0->get_numero() << std::endl;
1291     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1292     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1293     f << coin_x1y0z0->get_numero() << std::endl;
1294     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1295     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1296     f << coin_x0y1z0->get_numero() << std::endl;
1297     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1298     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1299     f << coin_x1y1z0->get_numero() << std::endl;
1300     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1301     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1302     f << coin_x0y0z1->get_numero() << std::endl;
1303     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1304     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1305     f << coin_x1y0z1->get_numero() << std::endl;
1306     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1307     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1308     f << coin_x0y1z1->get_numero() << std::endl;
1309     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1310     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1311     f << coin_x1y1z1->get_numero() << std::endl;
1312     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1313     f << "*NSET,NSET=xEQ0" << std::endl;
1314     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1315     {
1316     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1317     long nb_ele=lst_ele->get_nb();
1318     for(long i=0;i<nb_ele;i++)
1319     {
1320     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1321     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1322     {
1323     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1324     }
1325     }
1326     }
1327     f << "*NSET,NSET=xEQ1" << std::endl;
1328     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1329     {
1330     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1331     long nb_ele=lst_ele->get_nb();
1332     for(long i=0;i<nb_ele;i++)
1333     {
1334     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1335     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1336     {
1337     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1338     }
1339     }
1340     }
1341     f << "*NSET,NSET=yEQ0" << std::endl;
1342     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1343     {
1344     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1345     long nb_ele=lst_ele->get_nb();
1346     for(long i=0;i<nb_ele;i++)
1347     {
1348     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1349     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1350     {
1351     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1352     }
1353     }
1354     }
1355     f << "*NSET,NSET=yEQ1" << std::endl;
1356     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1357     {
1358     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1359     long nb_ele=lst_ele->get_nb();
1360     for(long i=0;i<nb_ele;i++)
1361     {
1362     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1363     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1364     {
1365     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1366     }
1367     }
1368     }
1369     f << "*NSET,NSET=zEQ0" << std::endl;
1370     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1371     {
1372     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1373     long nb_ele=lst_ele->get_nb();
1374     for(long i=0;i<nb_ele;i++)
1375     {
1376     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1377     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1378     {
1379     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1380     }
1381     }
1382     }
1383     f << "*NSET,NSET=zEQ1" << std::endl;
1384     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1385     {
1386     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1387     long nb_ele=lst_ele->get_nb();
1388     for(long i=0;i<nb_ele;i++)
1389     {
1390     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1391     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1392     {
1393     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1394     }
1395     }
1396     }
1397     f.close();
1398     file="groupes_elements";
1399 couturad 959 f.open(file.c_str(),std::ios::out);
1400 couturad 933 f.precision(16);
1401     f.setf(std::ios::showpoint);
1402     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
1403     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))
1404     {
1405     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
1406     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
1407     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
1408     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
1409     {
1410     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1411     long nb_ele=lst_ele->get_nb();
1412     for(long i=0;i<nb_ele;i++)
1413     {
1414     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1415     f << ele3->get_numero() << std::endl;
1416     }
1417     }
1418     }
1419 couturad 937
1420     MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Sphere");
1421     if(groupe_forme_particule!=NULL)
1422     {
1423     file="particules";
1424 couturad 959 f.open(file.c_str(),std::ios::out);
1425 couturad 937 f.precision(16);
1426     f.setf(std::ios::showpoint);
1427     std::ofstream f2;
1428     f2.open((char*)"infos_particules");
1429     f2.precision(16);
1430     f2.setf(std::ios::showpoint);
1431     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
1432     std::ofstream f_bord;
1433     f_bord.open((char*)"particules_bord");
1434     f_bord.precision(16);
1435     f_bord.setf(std::ios::showpoint);
1436     std::ofstream f_interieur;
1437     f_interieur.open((char*)"particules_interieur");
1438     f_interieur.precision(16);
1439     f_interieur.setf(std::ios::showpoint);
1440     long p=1;
1441     std::map<long,MG_CG_FORME*>::iterator it_forme;
1442     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))
1443     {
1444     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
1445     {
1446     f << "*ELSET,ELSET=P_" << p << std::endl;
1447     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1448     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1449     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1450     std::vector<double> vct_centre = centre->get_vct_valeur();
1451     f2 << p << " "
1452     << vct_centre.at(0) << " "
1453     << vct_centre.at(1) << " "
1454     << vct_centre.at(2) << " "
1455     << rayon->get_valeur() << " "
1456     << pos_rel->get_valeur() << std::endl;
1457     bool au_bord;
1458     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1459     else au_bord=false;
1460     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
1461     MG_VOLUME* volume = forme_volume->get_mg_volume();
1462     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1463     long nb_ele=lst_ele->get_nb();
1464     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1465     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1466     for(long i=0;i<nb_ele;i++)
1467     {
1468     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1469     f << ele3->get_numero() << std::endl;
1470     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1471     else f_interieur << ele3->get_numero() << std::endl;
1472     }
1473     p++;
1474     }
1475     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
1476     {
1477     f << "*ELSET,ELSET=P_" << p << std::endl;
1478     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1479     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1480     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1481     std::vector<double> vct_centre = centre->get_vct_valeur();
1482     f2 << p << " "
1483     << vct_centre.at(0) << " "
1484     << vct_centre.at(1) << " "
1485     << vct_centre.at(2) << " "
1486     << rayon->get_valeur() << " "
1487     << pos_rel->get_valeur() << std::endl;
1488     bool au_bord;
1489     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1490     else au_bord=false;
1491     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
1492     std::map<long,MG_VOLUME*>::iterator it_volume;
1493     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))
1494     {
1495     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1496     long nb_ele=lst_ele->get_nb();
1497     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1498     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1499     for(long i=0;i<nb_ele;i++)
1500     {
1501     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1502     f << ele3->get_numero() << std::endl;
1503     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1504     else f_interieur << ele3->get_numero() << std::endl;
1505     }
1506     }
1507     p++;
1508     }
1509     }
1510     f_bord.close();
1511     f_interieur.close();
1512     f2.close();
1513     f.close();
1514     }
1515 couturad 933 }
1516 couturad 926
1517 couturad 933
1518 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
1519 couturad 919 {
1520 couturad 926 m_ves_file->enregistrer(fichier_ves);
1521 couturad 919 }
1522    
1523 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
1524 couturad 919 {
1525 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
1526     m_ves_file->enregistrer(fichier_ves);
1527     m_mg_gestionnaire->enregistrer(fichier_magic);
1528 couturad 919 }
1529    
1530 couturad 951 void MSTRUCT_VES::active_affichage(fonction_affiche* fonc)
1531 couturad 919 {
1532     fonc_affiche = fonc;
1533     affichageactif = 1;
1534     }
1535    
1536 couturad 926 void MSTRUCT_VES::affiche(char* message)
1537 couturad 919 {
1538     if(affichageactif==1) fonc_affiche(message);
1539     }
1540    
1541    
1542    
1543    
1544