ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 1130
Committed: Fri Feb 2 16:59:34 2024 UTC (15 months, 2 weeks ago) by ghazal
File size: 120885 byte(s)
Log Message:
Microstructure par decoupage disponible

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