ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 1095
Committed: Mon Jul 25 19:04:45 2022 UTC (2 years, 9 months ago) by francois
File size: 120741 byte(s)
Log Message:
Correction des tores dans l'homogeinisation. Problème de la boite englobante dans le parametrique.

File Contents

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