ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 997
Committed: Tue Dec 18 15:59:49 2018 UTC (6 years, 4 months ago) by couturad
File size: 93031 byte(s)
Log Message:
MICROSTRUCTURE: ajout d'un outil pour reduire le nombre de colonnes d'un histogramme 

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 919 #include "mg_cg_modele.h"
22     #include "mg_cg_assemblage.h"
23     #include "mg_sous_geometrie.h"
24     #include "mg_cg_forme_multi_volume.h"
25 couturad 937 #include "mg_cg_info.h"
26 couturad 919 #include "mg_file.h"
27     #include "fct_taille_fem_solution_generateur_microstructure.h"
28 couturad 951 #include "mailleur3d_couche.h"
29 couturad 919 #include "mailleur0d.h"
30     #include "mailleur1d.h"
31     #include "mailleur2d.h"
32     #include "mailleur3d.h"
33     #include "mailleur_fem.h"
34     #include "mailleur_analyse.h"
35     #include <fstream>
36     #include "mgaster.h"
37     #include "ot_cpu.h"
38     #include "mstruct_outils.h"
39 couturad 926 #include "mg_cg_groupe_forme.h"
40     #include "mstruct_ves_file.h"
41 couturad 933 #include "fem_tetra4.h"
42     #include "fem_tetra10.h"
43     #include "fem_penta6.h"
44     #include "fem_penta15.h"
45 couturad 951 #include "parse.h"
46     #include "pars_argument.h"
47 couturad 926 MSTRUCT_VES::MSTRUCT_VES(void)
48 couturad 919 {
49     m_mg_gestionnaire=new MG_GESTIONNAIRE;
50     m_mg_geometrie=NULL;
51     m_mgcg_modele=NULL;
52 couturad 926 m_mgcg_assemblage=NULL;
53 couturad 919 m_mg_maillage=NULL;
54     m_fem_maillage=NULL;
55 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
56     change_boite_3D_ves(BOITE_3D(0.0,0.0,0.0,1.0,1.0,1.0));
57     change_precision(1.0e-06);
58     change_temps_geometrie(0.0);
59     change_temps_carte(0.0);
60     change_temps_maillage(0.0);
61     change_temps_fem_maillage(0.0);
62     change_temps_etude(0.0);
63     change_temps_calcul(0.0);
64     change_temps_analyse(0.0);
65 couturad 919 }
66    
67 couturad 926 MSTRUCT_VES::MSTRUCT_VES(char* fichier_ves)
68 couturad 919 {
69 couturad 926 m_ves_file=new MSTRUCT_VES_FILE;
70     m_ves_file->ouvrir(fichier_ves);
71     m_mg_gestionnaire = new MG_FILE(m_ves_file->get_nom_fichier_magic());
72     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());
73     else m_mgcg_modele=NULL;
74     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());
75     else m_mgcg_assemblage=NULL;
76     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());
77     else m_mg_geometrie = NULL;
78     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());
79     else m_mg_maillage = NULL;
80     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());
81     else m_fem_maillage = NULL;
82 couturad 919 }
83    
84 couturad 926 MSTRUCT_VES::~MSTRUCT_VES(void)
85 couturad 919 {
86     delete m_mg_gestionnaire;
87 couturad 926 delete m_ves_file;
88 couturad 919 }
89    
90 couturad 926 MG_GESTIONNAIRE* MSTRUCT_VES::get_mg_gestionnaire(void)
91 couturad 919 {
92     return m_mg_gestionnaire;
93     }
94    
95 couturad 926 void MSTRUCT_VES::change_mg_gestionnaire(MG_GESTIONNAIRE* gest)
96 couturad 919 {
97 couturad 926 m_mg_gestionnaire=gest;
98     }
99    
100     void MSTRUCT_VES::change_mg_geometrie(MG_GEOMETRIE* mg_geometrie)
101     {
102 couturad 919 m_mg_geometrie=mg_geometrie;
103 couturad 926 m_ves_file->change_id_mg_geometrie(m_mg_geometrie->get_id());
104 couturad 919 }
105    
106 couturad 926 MG_GEOMETRIE* MSTRUCT_VES::get_mg_geometrie(void)
107 couturad 919 {
108     return m_mg_geometrie;
109     }
110    
111 couturad 926 void MSTRUCT_VES::change_mgcg_assemblage(MG_CG_ASSEMBLAGE* mgcg_assemblage)
112 couturad 919 {
113     m_mgcg_assemblage=mgcg_assemblage;
114 couturad 926 m_ves_file->change_id_mgcg_assemblage(m_mgcg_assemblage->get_id());
115 couturad 919 }
116    
117 couturad 926 MG_CG_ASSEMBLAGE* MSTRUCT_VES::get_mgcg_assemblage(void)
118 couturad 919 {
119     return m_mgcg_assemblage;
120     }
121    
122 couturad 926 void MSTRUCT_VES::change_mgcg_modele(MG_CG_MODELE* mgcg_modele)
123 couturad 919 {
124     m_mgcg_modele=mgcg_modele;
125 couturad 926 m_ves_file->change_id_mgcg_modele(m_mgcg_modele->get_id());
126 couturad 919 }
127    
128 couturad 926 MG_CG_MODELE* MSTRUCT_VES::get_mgcg_modele(void)
129 couturad 919 {
130     return m_mgcg_modele;
131     }
132    
133 couturad 926 MG_MAILLAGE* MSTRUCT_VES::get_mg_maillage(void)
134 couturad 919 {
135     return m_mg_maillage;
136     }
137    
138 couturad 926 void MSTRUCT_VES::change_mg_maillage(MG_MAILLAGE* mg_maillage)
139 couturad 919 {
140     m_mg_maillage=mg_maillage;
141 couturad 926 m_ves_file->change_id_mg_maillage(m_mg_maillage->get_id());
142 couturad 919 }
143    
144 couturad 926 FEM_MAILLAGE* MSTRUCT_VES::get_fem_maillage(void)
145 couturad 919 {
146     return m_fem_maillage;
147     }
148    
149 couturad 926 void MSTRUCT_VES::change_fem_maillage(FEM_MAILLAGE* fem_maillage)
150 couturad 919 {
151     m_fem_maillage=fem_maillage;
152 couturad 926 m_ves_file->change_id_fem_maillage(m_fem_maillage->get_id());
153 couturad 919 }
154    
155 couturad 926 BOITE_3D MSTRUCT_VES::get_boite3d_ves(void)
156 couturad 919 {
157 couturad 926 return m_ves_file->get_boite_3D_ves();
158 couturad 919 }
159    
160 couturad 926 void MSTRUCT_VES::change_boite_3D_ves(BOITE_3D boite3D)
161 couturad 919 {
162 couturad 926 m_ves_file->change_boite_3D_ves(boite3D);
163 couturad 919 }
164    
165 couturad 926 double MSTRUCT_VES::get_precision(void)
166 couturad 919 {
167 couturad 926 return m_ves_file->get_precision();
168 couturad 919 }
169    
170 couturad 926 void MSTRUCT_VES::change_precision(double precision)
171 couturad 919 {
172 couturad 926 m_ves_file->change_precision(precision);
173 couturad 919 }
174    
175 couturad 926 double MSTRUCT_VES::get_temps_geometrie(void)
176 couturad 919 {
177 couturad 926 return m_ves_file->get_temps_geometrie();
178 couturad 919 }
179    
180 couturad 926 void MSTRUCT_VES::change_temps_geometrie(double temps)
181 couturad 919 {
182 couturad 926 m_ves_file->change_temps_geometrie(temps);
183 couturad 919 }
184    
185 couturad 926 double MSTRUCT_VES::get_temps_materiau(void)
186     {
187     return m_ves_file->get_temps_materiau();
188     }
189 couturad 919
190 couturad 926 void MSTRUCT_VES::change_temps_materiau(double temps)
191 couturad 919 {
192 couturad 926 m_ves_file->change_temps_materiau(temps);
193     }
194    
195     double MSTRUCT_VES::get_temps_carte(void)
196     {
197     return m_ves_file->get_temps_carte();
198     }
199    
200     void MSTRUCT_VES::change_temps_carte(double temps)
201     {
202     m_ves_file->change_temps_carte(temps);
203     }
204    
205     double MSTRUCT_VES::get_temps_maillage(void)
206     {
207     return m_ves_file->get_temps_maillage();
208     }
209    
210     void MSTRUCT_VES::change_temps_maillage(double temps)
211     {
212     m_ves_file->change_temps_maillage(temps);
213     }
214    
215     double MSTRUCT_VES::get_temps_fem_maillage(void)
216     {
217     return m_ves_file->get_temps_fem_maillage();
218     }
219    
220     void MSTRUCT_VES::change_temps_fem_maillage(double temps)
221     {
222     m_ves_file->change_temps_fem_maillage(temps);
223     }
224    
225     double MSTRUCT_VES::get_temps_etude(void)
226     {
227     return m_ves_file->get_temps_etude();
228     }
229    
230     void MSTRUCT_VES::change_temps_etude(double temps)
231     {
232     m_ves_file->change_temps_etude(temps);
233     }
234    
235     double MSTRUCT_VES::get_temps_calcul(void)
236     {
237     return m_ves_file->get_temps_calcul();
238     }
239    
240     void MSTRUCT_VES::change_temps_calcul(double temps)
241     {
242     m_ves_file->change_temps_calcul(temps);
243     }
244    
245     double MSTRUCT_VES::get_temps_analyse(void)
246     {
247     return m_ves_file->get_temps_analyse();
248     }
249    
250     void MSTRUCT_VES::change_temps_analyse(double temps)
251     {
252     m_ves_file->change_temps_analyse(temps);
253     }
254    
255     long int MSTRUCT_VES::get_nb_analyse(void)
256     {
257     return m_ves_file->get_nb_analyse();
258     }
259    
260     int MSTRUCT_VES::ajouter_analyse(MSTRUCT_ANALYSE* analyse_ves)
261     {
262     return m_ves_file->ajouter_analyse(analyse_ves);
263     }
264    
265     MSTRUCT_ANALYSE* MSTRUCT_VES::get_premiere_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
266     {
267     return m_ves_file->get_premiere_analyse(it);
268     }
269    
270     MSTRUCT_ANALYSE* MSTRUCT_VES::get_suivante_analyse(std::map< std::string, MSTRUCT_ANALYSE* >::iterator& it)
271     {
272     return m_ves_file->get_suivante_analyse(it);
273     }
274    
275 couturad 951 MSTRUCT_ANALYSE* MSTRUCT_VES::get_analyse(std::string identifiant)
276 couturad 926 {
277     return m_ves_file->get_analyse(identifiant);
278     }
279    
280 couturad 951 int MSTRUCT_VES::supprimer_analyse(std::string identifiant)
281 couturad 926 {
282     return m_ves_file->supprimer_analyse(identifiant);
283     }
284    
285     int MSTRUCT_VES::supprimer_tout_analyse(void)
286     {
287     return m_ves_file->supprimer_tout_analyse();
288     }
289    
290     int MSTRUCT_VES::generer_geometrie(std::vector< OT_PARAMETRES* >& vector_params_geometrie)
291     {
292 couturad 919 OT_CPU ot_cpu;
293     ot_cpu.initialise();
294 couturad 951 MSTRUCT_GENERATEUR* generateur=NULL;
295 couturad 919 std::vector<OT_PARAMETRES*>::iterator it;
296     for(it=vector_params_geometrie.begin();it!=vector_params_geometrie.end();it++)
297     {
298     OT_PARAMETRES* param = *it;
299 couturad 968 if(((int)param->get_valeur((char*)"Type_generateur"))==MSTRUCT::TYPE_GENERATEUR::RSA)
300 couturad 919 {
301     std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
302 couturad 951 MSTRUCT_GENERATEUR_RSA *RSA;
303     if(generateur==NULL)
304     {
305     RSA = new MSTRUCT_GENERATEUR_RSA(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
306     generateur=RSA;
307     RSA->active_affichage(fonc_affiche);
308     }
309    
310 couturad 919 double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
311     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
312     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
313     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
314     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
315     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
316     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
317     Boite3D_distribution_Ymin,
318     Boite3D_distribution_Zmin,
319     Boite3D_distribution_Xmax,
320     Boite3D_distribution_Ymax,
321     Boite3D_distribution_Zmax);
322 couturad 951 RSA->change_boite3d_distribution(Boite3D_distribution);
323 couturad 919 double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
324     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
325 couturad 951 double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
326     RSA->change_nb_pas_grille(Nb_pas_X);
327     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
328     RSA->change_distance_inter_volume_min(Distance_min_inter_volume);
329 couturad 919 double Volume_min = param->get_valeur((char*)"Volume_min");
330 couturad 951 RSA->change_volume_min(Volume_min);
331 couturad 919 double Aire_min = param->get_valeur((char*)"Aire_min");
332 couturad 951 RSA->change_aire_min(Aire_min);
333 couturad 919 double Longueur_min = param->get_valeur((char*)"Longueur_min");
334 couturad 951 RSA->change_longueur_min(Longueur_min);
335 couturad 919 double Angle_min = param->get_valeur((char*)"Angle_min");
336 couturad 951 RSA->change_angle_min(Angle_min);
337 couturad 919 double Nb_iteration_max = param->get_valeur((char*)"Nb_iteration_max");
338 couturad 951 RSA->change_nb_iteration_max(Nb_iteration_max);
339     bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
340     RSA->change_intersection_bords_ves(Avec_intersections);
341     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
342 couturad 971 char message[1000];
343     sprintf(message,"Generateur RSA : %s",Nom_groupe_inclusion.c_str());
344     affiche(message);
345 couturad 951 int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
346 couturad 919 double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
347 couturad 951 double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
348     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
349     std::string multicouche = param->get_nom((char*)"Multicouche");
350     PARS_ARGUMENT parse_param[100];
351     PARSE parse;
352     parse.decode(multicouche.c_str(),"@,(&)",parse_param);
353     std::vector<double> *vector_epaisseur=NULL;
354     int nb_couche = atoi(parse_param[0].argument[0].c_str());
355     if(nb_couche>0)
356 couturad 919 {
357 couturad 951 vector_epaisseur=new std::vector<double>;
358     for(int i=0;i<nb_couche;i++)
359     {
360     double epaisseur=atof(parse_param[1].argument[i].c_str());
361     vector_epaisseur->push_back(epaisseur);
362     }
363     }
364 couturad 968 if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::SPHERE)
365 couturad 951 {
366 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
367     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
368     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
369     double fraction_volumique_actuelle=0.0;
370     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);
371 couturad 919 }
372 couturad 968 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::CYLINDRE)
373 couturad 919 {
374 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
375     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
376     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
377     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
378     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
379     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
380     double Mu_theta = param->get_valeur((char*)"Mu_theta");
381     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
382     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
383     double Mu_phi = param->get_valeur((char*)"Mu_phi");
384     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
385     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
386     double fraction_volumique_actuelle=0.0;
387     RSA->tirrage_aleatoire_cylindre(Nom_groupe_inclusion,
388     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
389     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
390     Mu_theta,Sigma_theta,Type_distribution_theta,
391     Mu_phi,Sigma_phi,Type_distribution_phi,
392     Fraction_volumique_cible,Eps_fraction_volumique,fraction_volumique_actuelle,
393     vector_epaisseur,
394     Porosite);
395 couturad 919 }
396 couturad 993 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::ELLIPSOIDE)
397     {
398     double Mu_rayon_majeur = param->get_valeur((char*)"Mu_rayon_majeur");
399     double Sigma_rayon_majeur = param->get_valeur((char*)"Sigma_rayon_majeur");
400     double Type_distribution_rayon_majeur = param->get_valeur((char*)"Type_distribution_rayon_majeur");
401     double Mu_rayon_mineur = param->get_valeur((char*)"Mu_rayon_mineur");
402     double Sigma_rayon_mineur = param->get_valeur((char*)"Sigma_rayon_mineur");
403     double Type_distribution_rayon_mineur = param->get_valeur((char*)"Type_distribution_rayon_mineur");
404     double Mu_theta = param->get_valeur((char*)"Mu_theta");
405     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
406     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
407     double Mu_phi = param->get_valeur((char*)"Mu_phi");
408     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
409     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
410     double fraction_volumique_actuelle=0.0;
411     RSA->tirrage_aleatoire_ellipsoide(Nom_groupe_inclusion,
412     Mu_rayon_majeur,Sigma_rayon_majeur,Type_distribution_rayon_majeur,
413     Mu_rayon_mineur,Sigma_rayon_mineur,Type_distribution_rayon_mineur,
414     Mu_theta,Sigma_theta,Type_distribution_theta,
415     Mu_phi,Sigma_phi,Type_distribution_phi,
416     Fraction_volumique_cible,Eps_fraction_volumique,fraction_volumique_actuelle,
417     vector_epaisseur,
418     Porosite);
419     }
420 couturad 951 if(vector_epaisseur!=NULL) delete vector_epaisseur;
421     }
422 couturad 968 else if(((int)param->get_valeur((char*)"Type_generateur"))==MSTRUCT::TYPE_GENERATEUR::DCR)
423 couturad 951 {
424 couturad 952 #ifdef PROJECT_CHRONO
425 couturad 951 std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
426     MSTRUCT_GENERATEUR_DCR *DCR;
427     if(generateur==NULL)
428     {
429     DCR = new MSTRUCT_GENERATEUR_DCR(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
430     generateur=DCR;
431     DCR->active_affichage(fonc_affiche);
432     }
433     double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
434     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
435     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
436     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
437     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
438     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
439     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
440     Boite3D_distribution_Ymin,
441     Boite3D_distribution_Zmin,
442     Boite3D_distribution_Xmax,
443     Boite3D_distribution_Ymax,
444     Boite3D_distribution_Zmax);
445     DCR->change_boite3d_distribution(Boite3D_distribution);
446     double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
447     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
448     double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
449     DCR->change_nb_pas_grille(Nb_pas_X);
450     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
451     DCR->change_distance_inter_volume_min(Distance_min_inter_volume);
452     double Volume_min = param->get_valeur((char*)"Volume_min");
453     DCR->change_volume_min(Volume_min);
454     double Aire_min = param->get_valeur((char*)"Aire_min");
455     DCR->change_aire_min(Aire_min);
456     double Longueur_min = param->get_valeur((char*)"Longueur_min");
457     DCR->change_longueur_min(Longueur_min);
458     double Angle_min = param->get_valeur((char*)"Angle_min");
459     DCR->change_angle_min(Angle_min);
460 couturad 966 long Nb_iteration_max = (long)param->get_valeur((char*)"Nb_iteration_max");
461 couturad 951 bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
462     DCR->change_intersection_bords_ves(Avec_intersections);
463     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
464 couturad 971 char message[1000];
465     sprintf(message,"Generateur DCR : %s",Nom_groupe_inclusion.c_str());
466     affiche(message);
467 couturad 951 int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
468     double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
469     double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
470     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
471     std::string multicouche = param->get_nom((char*)"Multicouche");
472 couturad 919
473 couturad 960 bool Avec_interface_graphique = (bool)param->get_valeur((char*)"Avec_interface_graphique");
474     double Facteur_reduction_vitesse = param->get_valeur((char*)"Facteur_reduction_vitesse");
475     double Friction = param->get_valeur((char*)"Friction");
476     double Pas_temps_sim = param->get_valeur((char*)"Pas_temps_sim");
477     double Temps_max_sim = param->get_valeur((char*)"Temps_max_sim");
478     double Eps_vitesse = param->get_valeur((char*)"Eps_vitesse");
479     DCR->active_interface_graphique(Avec_interface_graphique);
480     DCR->change_facteur_reduction_vitesse(Facteur_reduction_vitesse);
481     DCR->change_eps_vitesse(Eps_vitesse);
482     DCR->change_friction(Friction);
483     DCR->change_pas_temps(Pas_temps_sim);
484     DCR->change_temps_max_sim(Temps_max_sim);
485 couturad 971
486 couturad 968 if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::SPHERE)
487 couturad 951 {
488 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
489     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
490     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
491 couturad 971 DCR->ajouter_spheres(Nom_groupe_inclusion,Mu_rayon,Sigma_rayon,Type_distribution_rayon,Fraction_volumique_cible,Eps_fraction_volumique,Porosite);
492 couturad 966 }
493 couturad 968 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::CYLINDRE)
494 couturad 966 {
495     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
496     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
497     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
498     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
499     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
500     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
501     double Mu_theta = param->get_valeur((char*)"Mu_theta");
502     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
503     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
504     double Mu_phi = param->get_valeur((char*)"Mu_phi");
505     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
506     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
507     DCR->ajouter_cylindres(Nom_groupe_inclusion,
508     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
509     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
510     Mu_theta,Sigma_theta,Type_distribution_theta,
511     Mu_phi,Sigma_phi,Type_distribution_phi,
512 couturad 971 Fraction_volumique_cible,Eps_fraction_volumique,
513     Porosite);
514 couturad 966 }
515 couturad 971 #else
516     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
517     #endif
518     }
519     }
520     if(generateur->get_type()==MSTRUCT::TYPE_GENERATEUR::DCR)
521     {
522     #ifdef PROJECT_CHRONO
523     MSTRUCT_GENERATEUR_DCR *DCR= (MSTRUCT_GENERATEUR_DCR*)generateur;
524     if(DCR->lancer_simulation()==FAIL)
525 couturad 966 {
526     delete generateur;
527 couturad 971 return FAIL;
528 couturad 966 }
529 couturad 971 DCR->generer_geometrie();
530 couturad 952 #else
531     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
532 couturad 971 #endif
533 couturad 919 }
534     ot_cpu.ajouter_etape((char*)"generation_geometrie");
535 couturad 926 double temps_generation_geometrie;
536     ot_cpu.get_etape((char*)"generation_geometrie",temps_generation_geometrie);
537     change_temps_geometrie(get_temps_geometrie()+temps_generation_geometrie);
538 couturad 919 generateur->construire(this);
539     delete generateur;
540     return OK;
541     }
542    
543 couturad 926 int MSTRUCT_VES::generer_materiau(std::vector< OT_PARAMETRES* >& vector_params_materiau)
544 couturad 919 {
545     OT_CPU ot_cpu;
546     ot_cpu.initialise();
547     std::vector<OT_PARAMETRES*>::iterator it;
548     for(it=vector_params_materiau.begin();it!=vector_params_materiau.end();it++)
549     {
550     OT_PARAMETRES* param = *it;
551     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
552 couturad 971 bool Etude_mecanique = (bool)param->get_valeur((char*)"Etude_mecanique");
553     if(Etude_mecanique)
554 couturad 919 {
555 couturad 971 double Mu_E = param->get_valeur((char*)"Mu_E");
556     double Sigma_E = param->get_valeur((char*)"Sigma_E");
557     int Type_distribution_E = (int)param->get_valeur((char*)"Type_distribution_E");
558     double Mu_nu = param->get_valeur((char*)"Mu_nu");
559     double Sigma_nu = param->get_valeur((char*)"Sigma_nu");
560     int Type_distribution_nu = (int)param->get_valeur((char*)"Type_distribution_nu");
561     std::random_device seed;
562     std::mt19937_64 generateur(seed());
563     std::uniform_real_distribution<double> uniform_distribution_E(Mu_E-Sigma_E,Mu_E+Sigma_E);
564     std::normal_distribution<double> normal_distribution_E(Mu_E,Sigma_E);
565     std::uniform_real_distribution<double> uniform_distribution_nu(Mu_nu-Sigma_nu,Mu_nu+Sigma_nu);
566     std::normal_distribution<double> normal_distribution_nu(Mu_nu,Sigma_nu);
567     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
568     std::map<long,MG_CG_FORME*>::iterator it_forme;
569     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))
570 couturad 919 {
571 couturad 971 double E;
572     if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::FIXE) E=Mu_E;
573     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) E=uniform_distribution_E(generateur);
574     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) E=normal_distribution_E(generateur);
575     double nu;
576     if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::FIXE) nu=Mu_nu;
577     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) nu=uniform_distribution_nu(generateur);
578     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) nu=normal_distribution_nu(generateur);
579     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
580     {
581     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
582     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",E);
583     forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",nu);
584     }
585     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
586     {
587     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
588     std::map<long,MG_VOLUME*>::iterator it_volume;
589     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))
590     {
591     volume->ajouter_ccf((char*)"Em",E);
592     volume->ajouter_ccf((char*)"nu",nu);
593     }
594     }
595 couturad 919 }
596 couturad 971 }
597     bool Etude_thermique = (bool)param->get_valeur((char*)"Etude_thermique");
598     if(Etude_thermique)
599     {
600     double Mu_Lambda = param->get_valeur((char*)"Mu_Lambda");
601     double Sigma_Lambda = param->get_valeur((char*)"Sigma_Lambda");
602     int Type_distribution_Lambda = (int)param->get_valeur((char*)"Type_distribution_Lambda");
603     double Mu_Ro = param->get_valeur((char*)"Mu_Ro");
604     double Sigma_Ro = param->get_valeur((char*)"Sigma_Ro");
605     int Type_distribution_Ro = (int)param->get_valeur((char*)"Type_distribution_Ro");
606     double Mu_Cp = param->get_valeur((char*)"Mu_Cp");
607     double Sigma_Cp = param->get_valeur((char*)"Sigma_Cp");
608     int Type_distribution_Cp = (int)param->get_valeur((char*)"Type_distribution_Cp");
609     std::random_device seed;
610     std::mt19937_64 generateur(seed());
611     std::uniform_real_distribution<double> uniform_distribution_Lambda(Mu_Lambda-Sigma_Lambda,Mu_Lambda+Sigma_Lambda);
612     std::normal_distribution<double> normal_distribution_Lambda(Mu_Lambda,Sigma_Lambda);
613     std::uniform_real_distribution<double> uniform_distribution_Ro(Mu_Ro-Sigma_Ro,Mu_Ro+Sigma_Ro);
614     std::normal_distribution<double> normal_distribution_Ro(Mu_Ro,Sigma_Ro);
615     std::uniform_real_distribution<double> uniform_distribution_Cp(Mu_Cp-Sigma_Cp,Mu_Cp+Sigma_Cp);
616     std::normal_distribution<double> normal_distribution_Cp(Mu_Cp,Sigma_Cp);
617     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
618     std::map<long,MG_CG_FORME*>::iterator it_forme;
619     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))
620 couturad 919 {
621 couturad 971 double Lambda;
622     if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Lambda=Mu_Lambda;
623     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Lambda=uniform_distribution_Lambda(generateur);
624     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Lambda=normal_distribution_Lambda(generateur);
625     double Ro;
626     if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Ro=Mu_Ro;
627     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Ro=uniform_distribution_Ro(generateur);
628     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Ro=normal_distribution_Ro(generateur);
629     double Cp;
630     if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Cp=Mu_Cp;
631     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Cp=uniform_distribution_Cp(generateur);
632     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Cp=normal_distribution_Cp(generateur);
633     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
634     {
635     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
636     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Kx",Lambda);
637     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Ro",Ro);
638     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Cp",Cp);
639     }
640     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
641     {
642     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
643     std::map<long,MG_VOLUME*>::iterator it_volume;
644     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))
645     {
646     volume->ajouter_ccf((char*)"Kx",Lambda);
647     volume->ajouter_ccf((char*)"Ro",Ro);
648     volume->ajouter_ccf((char*)"Cp",Cp);
649     }
650     }
651 couturad 919 }
652     }
653 couturad 971 }
654 couturad 919 ot_cpu.ajouter_etape((char*)"generation_materiau");
655 couturad 926 double temps_generation_materiau;
656     ot_cpu.get_etape((char*)"generation_materiau",temps_generation_materiau);
657     change_temps_materiau(get_temps_materiau()+temps_generation_materiau);
658 couturad 919 return OK;
659     }
660    
661 couturad 926 int MSTRUCT_VES::generer_carte(OT_PARAMETRES *param)
662 couturad 919 {
663     double Ecart_nodal = param->get_valeur((char*)"Ecart_nodal");
664 couturad 937 double Ecart_nodal_face_particule = param->get_valeur((char*)"Ecart_nodal_face_particule");
665 couturad 919 double Fechantillonnage = param->get_valeur((char*)"Fechantillonnage");
666     double Nb_cellule_direction = param->get_valeur((char*)"Nb_cellule_direction");
667     std::string Nom_fem_solution = param->get_nom((char*)"Nom_fem_solution");
668     std::string Nom_mg_gestionnaire_carte = param->get_nom((char*)"Nom_mg_gestionnaire_carte");
669     std::string Nom_carte = param->get_nom((char*)"Nom_carte");
670     double Nb_couche_min = param->get_valeur((char*)"Nb_couche_min");
671     double Nb_pas = param->get_valeur((char*)"Nb_pas");
672     double Facteur_augmentation = param->get_valeur((char*)"Facteur_augmentation");
673     MG_GESTIONNAIRE *mggest_carte = new MG_GESTIONNAIRE;
674 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_matrice = m_mgcg_modele->get_mgcg_groupe_forme((char*)"Matrice");
675     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume_matrice = mgcg_groupe_matrice->get_tpl_map_volume();
676 couturad 919 OT_CPU ot_cpu;
677     ot_cpu.initialise();
678     FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE *carte = new FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE(mggest_carte,
679     m_mg_geometrie,
680     Ecart_nodal,
681 couturad 937 Ecart_nodal_face_particule,
682 couturad 919 Fechantillonnage,
683     Nb_cellule_direction,
684     (char*)Nom_fem_solution.c_str(),
685     tpl_map_volume_matrice,
686     Nb_couche_min,
687     Nb_pas,
688     Facteur_augmentation);
689 couturad 926
690    
691 couturad 933 carte->active_affichage(fonc_affiche);
692 couturad 926 carte->construit();
693 couturad 919 ot_cpu.ajouter_etape((char*)"generation_carte");
694 couturad 926 double temps_generation_carte;
695     ot_cpu.get_etape((char*)"generation_carte",temps_generation_carte);
696     change_temps_carte(get_temps_carte()+temps_generation_carte);
697     mggest_carte->enregistrer(Nom_mg_gestionnaire_carte.c_str());
698 couturad 919 carte->enregistrer((char*)Nom_carte.c_str());
699 couturad 964 char message[1000];
700     std::sprintf(message,"Fichier CARTE de sortie : %s",Nom_carte.c_str());
701     affiche(message);
702 couturad 926 m_ves_file->change_nom_fichier_carte((char*)Nom_carte.c_str());
703 couturad 919 return OK;
704     }
705    
706 couturad 926 int MSTRUCT_VES::generer_maillage(OT_PARAMETRES *param,FCT_TAILLE_FEM_SOLUTION* carte)
707 couturad 919 {
708     OT_CPU ot_cpu;
709     ot_cpu.initialise();
710     int Niveau = (int)param->get_valeur((char*)"Niveau");
711     int Niveau_opt_2d = (int)param->get_valeur((char*)"Niveau_opt_2d");
712     int Niveau_opt_3d = (int)param->get_valeur((char*)"Niveau_opt_3d");
713     double Priorite_metrique = param->get_valeur((char*)"Priorite_metrique");
714     int Analyse = (int)param->get_valeur((char*)"Analyse");
715     affiche((char*)"Maillage du VER :");
716     m_mg_maillage = new MG_MAILLAGE(m_mg_geometrie);
717     m_mg_gestionnaire->ajouter_mg_maillage(m_mg_maillage);
718 couturad 951 change_mg_maillage(m_mg_maillage);
719 couturad 993 affiche((char*)"Maillage 3D_couche :");
720 couturad 951 MAILLEUR3D_COUCHE m3d_couche(m_mg_maillage,m_mg_geometrie,carte);
721 couturad 993 m3d_couche.active_affichage(fonc_affiche);
722 couturad 951 LISTE_MG_VOLUME::iterator it_volume;
723     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
724 couturad 919 {
725 couturad 951 if(volume->est_mince())
726     {
727     char message[1000];
728 couturad 993 sprintf(message,"-> Maillage du volume id %li",volume->get_id());
729 couturad 951 affiche(message);
730 couturad 966 if(m3d_couche.maille(volume)==FAIL) return FAIL;
731 couturad 951 }
732 couturad 919 }
733 couturad 951 if(Niveau>=0)
734 couturad 919 {
735 couturad 993 long i=1;
736     long nb=m_mg_geometrie->get_nb_mg_sommet();
737 couturad 951 MAILLEUR0D m0d(m_mg_maillage,m_mg_geometrie);
738 couturad 993 affiche((char*)"Maillage 0D :");
739 couturad 951 LISTE_MG_SOMMET::iterator it_sommet;
740     for(MG_SOMMET* sommet=m_mg_geometrie->get_premier_sommet(it_sommet);sommet!=NULL;sommet=m_mg_geometrie->get_suivant_sommet(it_sommet))
741     {
742     if(sommet->get_lien_maillage()->get_nb()>0) continue;
743     char message[1000];
744 couturad 993 sprintf(message,"[%4li/%li] Maillage du sommet id %li",i,nb,sommet->get_id());
745 couturad 951 affiche(message);
746 couturad 966 if(m0d.maille(sommet)==FAIL) return FAIL;
747 couturad 993 i++;
748 couturad 951 }
749 couturad 919 }
750 couturad 951 if(Niveau>=1)
751 couturad 919 {
752 couturad 993 long i=1;
753     long nb=m_mg_geometrie->get_nb_mg_arete();
754 couturad 951 MAILLEUR1D m1d(m_mg_maillage,m_mg_geometrie,carte);
755 couturad 993 affiche((char*)"Maillage 1D :");
756 couturad 951 m1d.active_affichage(fonc_affiche);
757     LISTE_MG_ARETE::iterator it_arete;
758     for(MG_ARETE* arete=m_mg_geometrie->get_premier_arete(it_arete);arete!=NULL;arete=m_mg_geometrie->get_suivant_arete(it_arete))
759     {
760     if(arete->get_lien_maillage()->get_nb()>0) continue;
761     char message[1000];
762 couturad 993 sprintf(message,"[%4li/%li] Maillage de l'arete id %li",i,nb,arete->get_id());
763 couturad 951 affiche(message);
764 couturad 966 if(m1d.maille(arete)==FAIL) return FAIL;
765 couturad 993 i++;
766 couturad 951 }
767 couturad 919 }
768 couturad 951 if(Niveau>=2)
769 couturad 919 {
770 couturad 993 long i=1;
771     long nb=m_mg_geometrie->get_nb_mg_face();
772 couturad 951 MAILLEUR2D m2d(m_mg_maillage,m_mg_geometrie,carte);
773     m2d.change_niveau_optimisation(Niveau_opt_2d);
774     m2d.change_priorite_metrique(Priorite_metrique);
775 couturad 993 affiche((char*)"Maillage 2D :");
776 couturad 951 m2d.active_affichage(fonc_affiche);
777     LISTE_MG_FACE::iterator it_face;
778     for(MG_FACE* face=m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
779     {
780     if(face->get_lien_maillage()->get_nb()>0) continue;
781     char message[1000];
782 couturad 993 sprintf(message,"[%4li/%li] Maillage de la face id %li",i,nb,face->get_id());
783 couturad 951 affiche(message);
784 couturad 966 if(m2d.maille(face)==FAIL) return FAIL;
785 couturad 993 i++;
786 couturad 951 }
787 couturad 919 }
788 couturad 951 if(Niveau>=3)
789     {
790 couturad 993 long i=1;
791     long nb=m_mg_geometrie->get_nb_mg_volume();
792 couturad 951 MAILLEUR3D m3d(m_mg_maillage,m_mg_geometrie,carte,false);
793     m3d.change_niveau_optimisation(Niveau_opt_3d);
794     m3d.change_priorite_metrique(Priorite_metrique);
795 couturad 993 affiche((char*)"Maillage 3D :");
796 couturad 951 m3d.active_affichage(fonc_affiche);
797     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
798     {
799     if(volume->get_lien_maillage()->get_nb()>0) continue;
800     if(volume->est_mince()) continue;
801     char message[1000];
802 couturad 993 sprintf(message,"[%4li/%li] Maillage du volume id %li",i,nb,volume->get_id());
803 couturad 951 affiche(message);
804 couturad 966 if(m3d.maille(volume)==FAIL) return FAIL;
805 couturad 993 i++;
806 couturad 951 }
807     }
808 couturad 919 ot_cpu.ajouter_etape((char*)"generation_maillage");
809 couturad 926 double temps_generation_maillage;
810     ot_cpu.get_etape((char*)"generation_maillage",temps_generation_maillage);
811     change_temps_maillage(get_temps_maillage()+temps_generation_maillage);
812 couturad 919 return OK;
813     }
814    
815 couturad 926 int MSTRUCT_VES::generer_fem_maillage(OT_PARAMETRES *param)
816 couturad 919 {
817     OT_CPU ot_cpu;
818     ot_cpu.initialise();
819     int Degre = (int)param->get_valeur((char*)"Degre");
820     int Analyse = (int)param->get_valeur((char*)"Analyse");
821     int Optimisation_num_noeud = (int)param->get_valeur((char*)"Optimisation_num_noeud");
822     MAILLEUR_FEM mailleurfem;
823     mailleurfem.active_affichage(fonc_affiche);
824 couturad 926 m_fem_maillage = new FEM_MAILLAGE(m_mg_maillage->get_mg_geometrie(),m_mg_maillage,Degre);
825 couturad 919 m_mg_gestionnaire->ajouter_fem_maillage(m_fem_maillage);
826 couturad 926 change_fem_maillage(m_fem_maillage);
827 couturad 966 if(Optimisation_num_noeud) {if(mailleurfem.maille(m_fem_maillage,1)==FAIL) return FAIL;}
828     else {if(mailleurfem.maille(m_fem_maillage,0)==FAIL) return FAIL;};
829 couturad 919 if(Analyse)
830     {
831     MAILLEUR_ANALYSE m3d(m_fem_maillage);
832     m3d.active_affichage(fonc_affiche);
833     // m3d.analyse();
834     }
835     ot_cpu.ajouter_etape((char*)"generation_fem_maillage");
836 couturad 926 double temps_generation_fem_maillage;
837     ot_cpu.get_etape((char*)"generation_fem_maillage",temps_generation_fem_maillage);
838     change_temps_fem_maillage(get_temps_fem_maillage()+temps_generation_fem_maillage);
839 couturad 919 return OK;
840     }
841    
842 couturad 926 int MSTRUCT_VES::generer_etude(OT_PARAMETRES *param)
843 couturad 919 {
844     OT_CPU ot_cpu;
845     ot_cpu.initialise();
846 couturad 926 BOITE_3D boite3D_ves = get_boite3d_ves();
847     double eps = get_precision();
848 couturad 982 int Type_etude = (int)param->get_valeur((char*)"Type_etude");
849     int Type_Chargement = (int)param->get_valeur((char*)"Type_Chargement");
850     int Type_CL = (int)param->get_valeur((char*)"Type_CL");
851     double Valeur_CL = param->get_valeur((char*)"Valeur_CL");
852     int Direction = (int)param->get_valeur((char*)"Direction");
853     MSTRUCT_OUTILS::appliquer_conditions_limites(m_mg_geometrie,boite3D_ves,Type_etude,Type_CL,Type_Chargement,Valeur_CL,Direction,eps);
854 couturad 919 ot_cpu.ajouter_etape((char*)"generation_etude");
855 couturad 926 double temps_generation_etude;
856     ot_cpu.get_etape((char*)"generation_etude",temps_generation_etude);
857     change_temps_etude(get_temps_etude()+temps_generation_etude);
858 couturad 919 return OK;
859     }
860    
861 couturad 968 int MSTRUCT_VES::generer_calcul(OT_PARAMETRES *param,char* param_aster,std::string nom_etude)
862 couturad 919 {
863     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
864 couturad 971 int Type_calcul;
865     if(Type_etude==MSTRUCT::TYPE_ETUDE::MECANIQUE) Type_calcul=MAGIC::CALCUL_ASTER::ELASTIQUE;
866     else if(Type_etude==MSTRUCT::TYPE_ETUDE::THERMIQUE) Type_calcul=MAGIC::CALCUL_ASTER::THERMIQUE;
867 couturad 919 std::string Code_resu = param->get_nom((char*)"Code_resu");
868     MGASTER mgaster;
869     mgaster.active_affichage(fonc_affiche);
870     OT_CPU ot_cpu;
871     ot_cpu.initialise();
872 couturad 968 mgaster.calcule(param_aster,m_fem_maillage,(char*)nom_etude.c_str(),Type_calcul,(char*)Code_resu.c_str());
873 couturad 919 ot_cpu.ajouter_etape((char*)"calcul");
874 couturad 926 double temps_calcul;
875     ot_cpu.get_etape((char*)"calcul",temps_calcul);
876     change_temps_calcul(get_temps_calcul()+temps_calcul);
877 couturad 919 }
878    
879 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement)
880 couturad 919 {
881 couturad 926 OT_CPU ot_cpu;
882     ot_cpu.initialise();
883     std::vector<OT_PARAMETRES*>::iterator it;
884 couturad 968 char ligne[1000];
885     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
886 couturad 919 {
887 couturad 926 OT_PARAMETRES* param = *it;
888 couturad 968 int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
889 couturad 926 std::string Identifiant = param->get_nom((char*)"Identifiant");
890     if(get_analyse(Identifiant)!=NULL)
891     {
892     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
893     continue;
894     }
895     sprintf(ligne,"-> %s",Identifiant.c_str());
896     affiche(ligne);
897 couturad 968 if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP)
898 couturad 926 {
899     long Num_solution = (long)param->get_valeur((char*)"Num_solution");
900 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
901     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
902     BOITE_3D *boite_3d_analyse=NULL;
903     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
904     if(Boite_analyse)
905     {
906     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
907     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
908     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
909     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
910     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
911     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
912     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
913     }
914     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
915 couturad 926 FEM_SOLUTION* sol = m_mg_gestionnaire->get_fem_solution(Num_solution);
916     int nb_champ = sol->get_nb_champ();
917 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);
918     if(Analyse_erosion)
919 couturad 930 {
920 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
921     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
922     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_champ,Nb_couche,Epaisseur_couche);
923     analyse_erosion->executer();
924     ajouter_analyse(analyse_erosion);
925 couturad 930 }
926     else
927     {
928 couturad 968 analyse_champ->executer();
929     ajouter_analyse(analyse_champ);
930 couturad 930 }
931 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
932     }
933     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION)
934 couturad 926 {
935 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
936     int Avec_fem_maillage = (int)param->get_valeur((char*)"Avec_fem_maillage");
937     BOITE_3D *boite_3d_analyse=NULL;
938     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
939     if(Boite_analyse)
940 couturad 930 {
941 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
942     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
943     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
944     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
945     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
946     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
947     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
948 couturad 930 }
949 couturad 968 MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION(this,Identifiant,Nom_groupe_forme,boite_3d_analyse,Avec_fem_maillage);
950     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
951     if(Analyse_erosion)
952 couturad 930 {
953 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
954     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
955     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
956     analyse_erosion->executer();
957     ajouter_analyse(analyse_erosion);
958 couturad 930 }
959 couturad 938 else
960     {
961 couturad 968 analyse_orientation->executer();
962     ajouter_analyse(analyse_orientation);
963 couturad 938 }
964 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
965 couturad 938 }
966 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CAO)
967 couturad 926 {
968 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
969 couturad 926 double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
970 couturad 968 MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(this,Identifiant,Largeur_colonne_distribution_volume_forme,Nom_groupe_forme);
971     analyse_cao->executer();
972     ajouter_analyse(analyse_cao);
973 couturad 926 }
974 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_PROPRIETE_MASSIQUE)
975     {
976     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
977     MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE* analyse_prop_mass = new MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE(this,Identifiant,Nom_groupe_forme);
978     analyse_prop_mass->executer();
979     ajouter_analyse(analyse_prop_mass);
980     }
981 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_MG)
982 couturad 926 {
983 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
984 couturad 926 double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
985     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
986     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
987     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
988 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
989     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
990     if(Boite_analyse)
991 couturad 930 {
992 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
993     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
994     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
995     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
996     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
997     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
998     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
999 couturad 930 }
1000 couturad 968 MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(this,
1001     Identifiant,
1002     m_mg_maillage->get_id(),
1003     Largeur_colonne_distribution_qualite_2D,
1004     Largeur_colonne_distribution_taille_2D,
1005     Largeur_colonne_distribution_qualite_3D,
1006     Largeur_colonne_distribution_taille_3D,
1007     Nom_groupe_forme,boite_3d_analyse);
1008     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1009     if(Analyse_erosion)
1010     {
1011     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1012     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1013     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
1014     analyse_erosion->executer();
1015     ajouter_analyse(analyse_erosion);
1016     }
1017 couturad 930 else
1018     {
1019 couturad 968 analyse_mg_maillage->executer();
1020     ajouter_analyse(analyse_mg_maillage);
1021 couturad 930 }
1022 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1023 couturad 926 }
1024 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_FEM)
1025 couturad 926 {
1026 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1027 couturad 926 double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
1028     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
1029     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
1030     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
1031     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
1032     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
1033 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1034     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1035     if(Boite_analyse)
1036     {
1037     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1038     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1039     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1040     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1041     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1042     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1043     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1044     }
1045     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(this,
1046     Identifiant,
1047 couturad 926 m_fem_maillage->get_id(),
1048     Largeur_colonne_distribution_jacobien_2D_min,
1049     Largeur_colonne_distribution_jacobien_2D_max,
1050     Largeur_colonne_distribution_jacobien_3D_min,
1051     Largeur_colonne_distribution_jacobien_3D_max,
1052     Largeur_colonne_distribution_distortion_2D,
1053     Largeur_colonne_distribution_distortion_3D,
1054     Nom_groupe_forme,
1055     boite_3d_analyse);
1056 couturad 968 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1057     if(Analyse_erosion)
1058 couturad 930 {
1059 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1060     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1061     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
1062     analyse_erosion->executer();
1063     ajouter_analyse(analyse_erosion);
1064 couturad 930 }
1065     else
1066     {
1067 couturad 968 analyse_maillage_fem->executer();
1068     ajouter_analyse(analyse_maillage_fem);
1069 couturad 930 }
1070 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1071 couturad 926 }
1072 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_NORMALISE)
1073     {
1074     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1075 couturad 982 std::string Identifiant_champ_reference = param->get_nom((char*)"Identifiant_champ_reference");
1076 couturad 968 double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1077     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1078     {
1079     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1080 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ_reference);
1081     double valeur_ref=0.0;
1082     int nb_champ=analyse_champ_reference->get_nb_champ();
1083 couturad 997 for(int i=0;i<nb_champ;i++)
1084     {
1085     valeur_ref+=analyse_champ_reference->get_moyenne()[i]*analyse_champ_reference->get_moyenne()[i];
1086     }
1087     valeur_ref=sqrt(valeur_ref);
1088     // 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]);
1089 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1090 couturad 968 ajouter_analyse(analyse_normalise);
1091     }
1092     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1093     {
1094     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1095     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1096     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1097     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1098     MSTRUCT_ANALYSE_EROSION* analyse_erosion_normalise = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1099     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1100 couturad 982 int k=0;
1101     double valeur_ref=0.0;
1102 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))
1103     {
1104 couturad 982 if(k==0)
1105     {
1106     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion_reference;
1107     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ_reference = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ_reference);
1108     MSTRUCT_ANALYSE_CHAMP* analyse_champ_reference = (MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_champ_reference->get_premiere_analyse(it_analyse_erosion_reference);
1109     int nb_champ=analyse_champ_reference->get_nb_champ();
1110     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]);
1111     }
1112 couturad 968 MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1113 couturad 982 MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,valeur_ref,Largeur_colonne_distribution);
1114 couturad 968 analyse_erosion_normalise->ajouter_analyse(analyse_normalise);
1115 couturad 982 k++;
1116 couturad 968 }
1117     ajouter_analyse(analyse_erosion_normalise);
1118     }
1119     }
1120     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART)
1121     {
1122     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1123     if(get_analyse(Identifiant_champ)==NULL)
1124     {
1125     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1126     return FAIL;
1127     }
1128     std::string Identifiant_champ_compare = param->get_nom((char*)"Identifiant_champ_compare");
1129     if(get_analyse(Identifiant_champ_compare)==NULL)
1130     {
1131     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1132     return FAIL;
1133     }
1134     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1135     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1136     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1137     {
1138     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1139     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1140     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1141     {
1142     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1143     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1144     ajouter_analyse(analyse_ecart);
1145     }
1146     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1147     {
1148     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1149     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1150     if(Num_couche>=0)
1151     {
1152     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1153     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1154     ajouter_analyse(analyse_ecart);
1155     }
1156     else
1157     {
1158     double epaisseur_couche = analyse_erosion_compare->get_epaisseur_couche();
1159     std::string Nom_groupe_forme = analyse_erosion_compare->get_nom_groupe_forme();
1160     BOITE_3D *boite_3d_analyse=analyse_erosion_compare->get_boite_analyse();
1161     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1162     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1163     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))
1164     {
1165     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,(MSTRUCT_ANALYSE_CHAMP*)analyse_champ_compare,Type_ecart);
1166     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1167     }
1168     ajouter_analyse(analyse_erosion_ecart);
1169     }
1170    
1171     }
1172     }
1173     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1174     {
1175     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1176     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1177     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1178     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1179     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1180     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1181     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))
1182     {
1183     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1184     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1185     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1186     {
1187     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1188     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1189     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1190     }
1191     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1192     {
1193     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1194     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1195     if(Num_couche>=0)
1196     {
1197     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1198     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1199     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1200     }
1201     else
1202     {
1203    
1204     }
1205    
1206     }
1207     }
1208     ajouter_analyse(analyse_erosion_ecart);
1209     }
1210     }
1211     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART_CHARGEMENT)
1212     {
1213     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1214     if(get_analyse(Identifiant_champ)==NULL)
1215     {
1216     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1217     return FAIL;
1218     }
1219     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1220     int Type_chargement = (int)param->get_valeur((char*)"Type_chargement");
1221     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1222     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1223     {
1224     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1225     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1226     ajouter_analyse(analyse_ecart);
1227     }
1228     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1229     {
1230     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1231     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1232     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1233     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1234     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1235     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1236     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))
1237     {
1238     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1239     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1240     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1241     }
1242     ajouter_analyse(analyse_erosion_ecart);
1243     }
1244     }
1245     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION_ECART)
1246     {
1247     std::string Identifiant_orientation = param->get_nom((char*)"Identifiant_orientation");
1248     if(get_analyse(Identifiant_orientation)==NULL)
1249     {
1250     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1251     return FAIL;
1252     }
1253     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1254     double tenseur_compare[6];
1255     tenseur_compare[0] = (double)param->get_valeur((char*)"a_11");
1256     tenseur_compare[1] = (double)param->get_valeur((char*)"a_22");
1257     tenseur_compare[2] = (double)param->get_valeur((char*)"a_33");
1258     tenseur_compare[3] = (double)param->get_valeur((char*)"a_12");
1259     tenseur_compare[4] = (double)param->get_valeur((char*)"a_23");
1260     tenseur_compare[5] = (double)param->get_valeur((char*)"a_13");
1261     if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::ORIENTATION)
1262     {
1263     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)get_analyse(Identifiant_orientation);
1264     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1265     ajouter_analyse(analyse_compare);
1266     }
1267     else if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1268     {
1269     MSTRUCT_ANALYSE_EROSION* analyse_erosion_orientation = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_orientation);
1270     double epaisseur_couche = analyse_erosion_orientation->get_epaisseur_couche();
1271     std::string Nom_groupe_forme = analyse_erosion_orientation->get_nom_groupe_forme();
1272     BOITE_3D *boite_3d_analyse=analyse_erosion_orientation->get_boite_analyse();
1273     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1274     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1275     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))
1276     {
1277     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)analyse;
1278     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1279     analyse_erosion_ecart->ajouter_analyse(analyse_compare);
1280     }
1281     ajouter_analyse(analyse_erosion_ecart);
1282     }
1283     }
1284 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1285     {
1286 couturad 982 long Num_solution_temp=(long)param->get_valeur((char*)"Num_solution_temp");
1287     long Num_solution_flux=(long)param->get_valeur((char*)"Num_solution_flux");
1288     int Direction=(int)param->get_valeur((char*)"Direction");
1289     BOITE_3D *boite_3d_analyse=NULL;
1290     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1291     if(Boite_analyse)
1292 couturad 971 {
1293 couturad 982 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1294     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1295     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1296     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1297     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1298     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1299     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1300 couturad 971 }
1301 couturad 982 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1302     FEM_SOLUTION * fem_sol_temp=get_mg_gestionnaire()->get_fem_solution(Num_solution_temp);
1303     FEM_SOLUTION * fem_sol_flux=get_mg_gestionnaire()->get_fem_solution(Num_solution_flux);
1304     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);
1305     if(Analyse_erosion)
1306 couturad 971 {
1307 couturad 982 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1308     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1309     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_cond_ther,Nb_couche,Epaisseur_couche);
1310     analyse_erosion->executer();
1311     ajouter_analyse(analyse_erosion);
1312 couturad 971 }
1313     else
1314     {
1315 couturad 982 analyse_cond_ther->executer();
1316     ajouter_analyse(analyse_cond_ther);
1317 couturad 971 }
1318 couturad 982 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1319 couturad 971 }
1320 couturad 993 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_TEMPS)
1321     {
1322    
1323     }
1324 couturad 968 else
1325     {
1326     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1327     affiche(ligne);
1328     }
1329 couturad 919 }
1330 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
1331     double temps_analyse;
1332     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1333     change_temps_analyse(get_temps_analyse()+temps_analyse);
1334 couturad 919 }
1335    
1336 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1337     MSTRUCT_VES_FILE* ves_sph,
1338     MSTRUCT_VES_FILE* ves_dev)
1339 couturad 933 {
1340 couturad 968 OT_CPU ot_cpu;
1341     ot_cpu.initialise();
1342     std::vector<OT_PARAMETRES*>::iterator it;
1343     char ligne[1000];
1344     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1345     {
1346     OT_PARAMETRES* param = *it;
1347     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1348     std::string Identifiant = param->get_nom((char*)"Identifiant");
1349     if(get_analyse(Identifiant)!=NULL)
1350     {
1351     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1352     return FAIL;
1353     }
1354     sprintf(ligne,"-> %s",Identifiant.c_str());
1355     affiche(ligne);
1356     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MODULES_ELASTICITE)
1357     {
1358     std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
1359     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
1360     if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1361     {
1362     MSTRUCT_ANALYSE_CHAMP* epsilon_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_epsilon);
1363     MSTRUCT_ANALYSE_CHAMP* sigma_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_sigma);
1364     MSTRUCT_ANALYSE_CHAMP* epsilon_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_epsilon);
1365     MSTRUCT_ANALYSE_CHAMP* sigma_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_sigma);
1366     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,epsilon_sph,sigma_sph,epsilon_dev,sigma_dev);
1367     analyse_modules_elasticite->executer();
1368     ajouter_analyse(analyse_modules_elasticite);
1369     }
1370     else if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1371     {
1372     MSTRUCT_ANALYSE_EROSION* epsilon_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_epsilon);
1373     MSTRUCT_ANALYSE_EROSION* sigma_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_sigma);
1374     MSTRUCT_ANALYSE_EROSION* epsilon_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_epsilon);
1375     MSTRUCT_ANALYSE_EROSION* sigma_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_sigma);
1376     long Nb_couche = epsilon_sph_erosion->get_nb_analyse();
1377     double Epaisseur_couche = epsilon_sph_erosion->get_epaisseur_couche();
1378     std::string Nom_groupe_forme = epsilon_sph_erosion->get_nom_groupe_forme();
1379     BOITE_3D *boite_3d_analyse=epsilon_sph_erosion->get_boite_analyse();
1380     MSTRUCT_ANALYSE_EROSION* analyse_modules_elasticite_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,Epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1381     for(int i=0;i<Nb_couche;i++)
1382     {
1383     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,
1384     (MSTRUCT_ANALYSE_CHAMP*)epsilon_sph_erosion->get_analyse(i),
1385     (MSTRUCT_ANALYSE_CHAMP*)sigma_sph_erosion->get_analyse(i),
1386     (MSTRUCT_ANALYSE_CHAMP*)epsilon_dev_erosion->get_analyse(i),
1387     (MSTRUCT_ANALYSE_CHAMP*)sigma_dev_erosion->get_analyse(i));
1388     analyse_modules_elasticite->executer();
1389     analyse_modules_elasticite_erosion->ajouter_analyse(analyse_modules_elasticite);
1390     }
1391     ajouter_analyse(analyse_modules_elasticite_erosion);
1392     }
1393     }
1394     else
1395     {
1396     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1397     affiche(ligne);
1398     }
1399     }
1400     ot_cpu.ajouter_etape((char*)"analyse");
1401     double temps_analyse;
1402     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1403     change_temps_analyse(get_temps_analyse()+temps_analyse);
1404     }
1405    
1406 couturad 971 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1407     MSTRUCT_VES_FILE* ves_lambda_x,
1408     MSTRUCT_VES_FILE* ves_lambda_y,
1409     MSTRUCT_VES_FILE* ves_lambda_z)
1410     {
1411     OT_CPU ot_cpu;
1412     ot_cpu.initialise();
1413     std::vector<OT_PARAMETRES*>::iterator it;
1414     char ligne[1000];
1415     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1416     {
1417     OT_PARAMETRES* param = *it;
1418     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1419     std::string Identifiant = param->get_nom((char*)"Identifiant");
1420     if(get_analyse(Identifiant)!=NULL)
1421     {
1422     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1423     return FAIL;
1424     }
1425     sprintf(ligne,"-> %s",Identifiant.c_str());
1426     affiche(ligne);
1427     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1428     {
1429     std::string Identifiant = param->get_nom((char*)"Identifiant");
1430     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1431     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1432     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1433     {
1434     MSTRUCT_ANALYSE_EROSION* erosion_lambda_x = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_x->get_analyse(Identifiant);
1435     MSTRUCT_ANALYSE_EROSION* erosion_lambda_y = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_y->get_analyse(Identifiant);
1436     MSTRUCT_ANALYSE_EROSION* erosion_lambda_z = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_z->get_analyse(Identifiant);
1437     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_x;
1438     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_y;
1439     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_z;
1440     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_premiere_analyse(it_analyse_x);
1441     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_premiere_analyse(it_analyse_y);
1442     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_premiere_analyse(it_analyse_z);
1443     MSTRUCT_ANALYSE_EROSION* erosion_lambda_app = new MSTRUCT_ANALYSE_EROSION(Identifiant,
1444     erosion_lambda_x->get_epaisseur_couche(),
1445     erosion_lambda_x->get_nom_groupe_forme(),
1446     erosion_lambda_x->get_boite_analyse());
1447     while(analyse_lambda_x!=NULL && analyse_lambda_y!=NULL && analyse_lambda_z!=NULL)
1448     {
1449     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1450     analyse_lambda_app->executer();
1451     erosion_lambda_app->ajouter_analyse(analyse_lambda_app);
1452     analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_suivante_analyse(it_analyse_x);
1453     analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_suivante_analyse(it_analyse_y);
1454     analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_suivante_analyse(it_analyse_z);
1455     }
1456     ajouter_analyse(erosion_lambda_app);
1457     }
1458     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1459     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1460     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE)
1461     {
1462     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_x->get_analyse(Identifiant);
1463     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_y->get_analyse(Identifiant);
1464     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_z->get_analyse(Identifiant);
1465     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1466     analyse_lambda_app->executer();
1467     ajouter_analyse(analyse_lambda_app);
1468     }
1469     }
1470     else
1471     {
1472     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1473     affiche(ligne);
1474     }
1475     }
1476     ot_cpu.ajouter_etape((char*)"analyse");
1477     double temps_analyse;
1478     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1479     change_temps_analyse(get_temps_analyse()+temps_analyse);
1480     }
1481 couturad 968
1482    
1483 couturad 971
1484    
1485 couturad 968 int MSTRUCT_VES::exporter_maillage_abaqus(char* dossier)
1486     {
1487 couturad 933 std::ofstream f;
1488 couturad 968 char file[1000];
1489     sprintf(file,"%s/noeuds",dossier);
1490     f.open(file,std::ios::out);
1491 couturad 933 f.precision(16);
1492     f.setf(std::ios::showpoint);
1493     f << "*NODE"<< std::endl;
1494     LISTE_FEM_NOEUD::iterator it;
1495     long index=1;
1496     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
1497     {
1498     noeud->change_numero(index);
1499     double *coord=noeud->get_coord();
1500     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
1501     index++;
1502     }
1503     f.close();
1504 couturad 968 sprintf(file,"%s/elements",dossier);
1505     f.open(file,std::ios::out);
1506 couturad 933 f.precision(16);
1507     f.setf(std::ios::showpoint);
1508     index=1;
1509     LISTE_FEM_ELEMENT3::iterator ittele3;
1510     bool tetralin=false;
1511     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1512     {
1513     if(ele3->get_type_entite()==IDFEM_TETRA4)
1514     {
1515     if(tetralin==false)
1516     {
1517     tetralin=true;
1518     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
1519     }
1520     f << index << ", "
1521     << ele3->get_fem_noeud(0)->get_numero() << ", "
1522     << ele3->get_fem_noeud(1)->get_numero() << ", "
1523     << ele3->get_fem_noeud(2)->get_numero() << ", "
1524     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
1525     ele3->change_numero(index);
1526     index++;
1527     }
1528     }
1529     bool pentalin=false;
1530     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1531     {
1532     if(ele3->get_type_entite()==IDFEM_PENTA6)
1533     {
1534     if(pentalin==false)
1535     {
1536     pentalin=true;
1537     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1538     }
1539     f << index << ", "
1540     << ele3->get_fem_noeud(0)->get_numero() << ", "
1541     << ele3->get_fem_noeud(1)->get_numero() << ", "
1542     << ele3->get_fem_noeud(2)->get_numero() << ", "
1543     << ele3->get_fem_noeud(3)->get_numero() << ", "
1544     << ele3->get_fem_noeud(4)->get_numero() << ", "
1545     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1546     ele3->change_numero(index);
1547     index++;
1548     }
1549     }
1550     bool tetraquad=false;
1551     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1552     {
1553     if(ele3->get_type_entite()==IDFEM_TETRA10)
1554     {
1555     if(tetraquad==false)
1556     {
1557     tetraquad=true;
1558     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1559     }
1560     f << index << ", "
1561     << ele3->get_fem_noeud(0)->get_numero() << ", "
1562     << ele3->get_fem_noeud(2)->get_numero() << ", "
1563     << ele3->get_fem_noeud(4)->get_numero() << ", "
1564     << ele3->get_fem_noeud(9)->get_numero() << ", "
1565     << ele3->get_fem_noeud(1)->get_numero() << ", "
1566     << ele3->get_fem_noeud(3)->get_numero() << ", "
1567     << ele3->get_fem_noeud(5)->get_numero() << ", "
1568     << ele3->get_fem_noeud(6)->get_numero() << ", "
1569     << ele3->get_fem_noeud(7)->get_numero() << ", "
1570     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1571     ele3->change_numero(index);
1572     index++;
1573     }
1574     }
1575     bool pentaquad=false;
1576     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1577     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1578     {
1579     if(ele3->get_type_entite()==IDFEM_PENTA15)
1580     {
1581     if(pentaquad==false)
1582     {
1583     pentaquad=true;
1584     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1585     }
1586     f << index << ", "
1587     << ele3->get_fem_noeud(0)->get_numero() << ", "
1588     << ele3->get_fem_noeud(2)->get_numero() << ", "
1589     << ele3->get_fem_noeud(4)->get_numero() << ", "
1590     << ele3->get_fem_noeud(9)->get_numero() << ", "
1591     << ele3->get_fem_noeud(11)->get_numero() << ", "
1592     << ele3->get_fem_noeud(13)->get_numero() << ", "
1593     << ele3->get_fem_noeud(1)->get_numero() << ", "
1594     << ele3->get_fem_noeud(3)->get_numero() << ", "
1595     << ele3->get_fem_noeud(5)->get_numero() << ", "
1596     << ele3->get_fem_noeud(10)->get_numero() << ", "
1597     << ele3->get_fem_noeud(12)->get_numero() << ", "
1598     << ele3->get_fem_noeud(14)->get_numero() << ", "
1599     << ele3->get_fem_noeud(6)->get_numero() << ", "
1600     << ele3->get_fem_noeud(7)->get_numero() << ", "
1601     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1602     ele3->change_numero(index);
1603     index++;
1604     }
1605     }
1606     f.close();
1607 couturad 968 sprintf(file,"%s/BC_nsets",dossier);
1608     f.open(file,std::ios::out);
1609 couturad 933 f.precision(16);
1610     f.setf(std::ios::showpoint);
1611     BOITE_3D boite3D_ves = get_boite3d_ves();
1612     double eps = get_precision();
1613     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1614     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1615     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1616     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1617     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1618     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1619     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1620     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1621     {
1622     double xyzmin[3];
1623     double xyzmax[3];
1624     face->get_xyz_min_max(xyzmin,xyzmax,16);
1625    
1626     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1627     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);
1628     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);
1629     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);
1630     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);
1631     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);
1632     }
1633     MG_SOMMET* sommet_x0y0z0=NULL;
1634     MG_SOMMET* sommet_x1y0z0=NULL;
1635     MG_SOMMET* sommet_x0y1z0=NULL;
1636     MG_SOMMET* sommet_x1y1z0=NULL;
1637     MG_SOMMET* sommet_x0y0z1=NULL;
1638     MG_SOMMET* sommet_x1y0z1=NULL;
1639     MG_SOMMET* sommet_x0y1z1=NULL;
1640     MG_SOMMET* sommet_x1y1z1=NULL;
1641     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1642     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1643     {
1644     double xyz[3];
1645     som->get_point()->evaluer(xyz);
1646     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;
1647     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;
1648     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;
1649     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;
1650     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;
1651     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;
1652     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;
1653     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;
1654     }
1655     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1656     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1657     f << coin_x0y0z0->get_numero() << std::endl;
1658     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1659     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1660     f << coin_x1y0z0->get_numero() << std::endl;
1661     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1662     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1663     f << coin_x0y1z0->get_numero() << std::endl;
1664     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1665     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1666     f << coin_x1y1z0->get_numero() << std::endl;
1667     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1668     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1669     f << coin_x0y0z1->get_numero() << std::endl;
1670     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1671     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1672     f << coin_x1y0z1->get_numero() << std::endl;
1673     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1674     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1675     f << coin_x0y1z1->get_numero() << std::endl;
1676     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1677     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1678     f << coin_x1y1z1->get_numero() << std::endl;
1679     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1680     f << "*NSET,NSET=xEQ0" << std::endl;
1681     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1682     {
1683     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1684     long nb_ele=lst_ele->get_nb();
1685     for(long i=0;i<nb_ele;i++)
1686     {
1687     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1688     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1689     {
1690     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1691     }
1692     }
1693     }
1694     f << "*NSET,NSET=xEQ1" << std::endl;
1695     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1696     {
1697     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1698     long nb_ele=lst_ele->get_nb();
1699     for(long i=0;i<nb_ele;i++)
1700     {
1701     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1702     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1703     {
1704     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1705     }
1706     }
1707     }
1708     f << "*NSET,NSET=yEQ0" << std::endl;
1709     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1710     {
1711     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1712     long nb_ele=lst_ele->get_nb();
1713     for(long i=0;i<nb_ele;i++)
1714     {
1715     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1716     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1717     {
1718     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1719     }
1720     }
1721     }
1722     f << "*NSET,NSET=yEQ1" << std::endl;
1723     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1724     {
1725     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1726     long nb_ele=lst_ele->get_nb();
1727     for(long i=0;i<nb_ele;i++)
1728     {
1729     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1730     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1731     {
1732     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1733     }
1734     }
1735     }
1736     f << "*NSET,NSET=zEQ0" << std::endl;
1737     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1738     {
1739     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1740     long nb_ele=lst_ele->get_nb();
1741     for(long i=0;i<nb_ele;i++)
1742     {
1743     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1744     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1745     {
1746     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1747     }
1748     }
1749     }
1750     f << "*NSET,NSET=zEQ1" << std::endl;
1751     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1752     {
1753     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1754     long nb_ele=lst_ele->get_nb();
1755     for(long i=0;i<nb_ele;i++)
1756     {
1757     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1758     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1759     {
1760     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1761     }
1762     }
1763     }
1764     f.close();
1765 couturad 968 sprintf(file,"%s/groupes_elements",dossier);
1766     f.open(file,std::ios::out);
1767 couturad 933 f.precision(16);
1768     f.setf(std::ios::showpoint);
1769     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
1770     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))
1771     {
1772     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
1773     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
1774     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
1775     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
1776     {
1777     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1778     long nb_ele=lst_ele->get_nb();
1779     for(long i=0;i<nb_ele;i++)
1780     {
1781     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1782     f << ele3->get_numero() << std::endl;
1783     }
1784     }
1785     }
1786 couturad 937
1787 couturad 968 MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Particule");
1788 couturad 937 if(groupe_forme_particule!=NULL)
1789     {
1790 couturad 968 sprintf(file,"%s/particules",dossier);
1791     f.open(file,std::ios::out);
1792 couturad 937 f.precision(16);
1793     f.setf(std::ios::showpoint);
1794     std::ofstream f2;
1795     f2.open((char*)"infos_particules");
1796     f2.precision(16);
1797     f2.setf(std::ios::showpoint);
1798     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
1799     std::ofstream f_bord;
1800     f_bord.open((char*)"particules_bord");
1801     f_bord.precision(16);
1802     f_bord.setf(std::ios::showpoint);
1803     std::ofstream f_interieur;
1804     f_interieur.open((char*)"particules_interieur");
1805     f_interieur.precision(16);
1806     f_interieur.setf(std::ios::showpoint);
1807     long p=1;
1808     std::map<long,MG_CG_FORME*>::iterator it_forme;
1809     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))
1810     {
1811     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
1812     {
1813     f << "*ELSET,ELSET=P_" << p << std::endl;
1814     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1815     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1816     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1817     std::vector<double> vct_centre = centre->get_vct_valeur();
1818     f2 << p << " "
1819     << vct_centre.at(0) << " "
1820     << vct_centre.at(1) << " "
1821     << vct_centre.at(2) << " "
1822     << rayon->get_valeur() << " "
1823     << pos_rel->get_valeur() << std::endl;
1824     bool au_bord;
1825     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1826     else au_bord=false;
1827     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
1828     MG_VOLUME* volume = forme_volume->get_mg_volume();
1829     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1830     long nb_ele=lst_ele->get_nb();
1831     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1832     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1833     for(long i=0;i<nb_ele;i++)
1834     {
1835     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1836     f << ele3->get_numero() << std::endl;
1837     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1838     else f_interieur << ele3->get_numero() << std::endl;
1839     }
1840     p++;
1841     }
1842     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
1843     {
1844     f << "*ELSET,ELSET=P_" << p << std::endl;
1845     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1846     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1847     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1848     std::vector<double> vct_centre = centre->get_vct_valeur();
1849     f2 << p << " "
1850     << vct_centre.at(0) << " "
1851     << vct_centre.at(1) << " "
1852     << vct_centre.at(2) << " "
1853     << rayon->get_valeur() << " "
1854     << pos_rel->get_valeur() << std::endl;
1855     bool au_bord;
1856     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1857     else au_bord=false;
1858     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
1859     std::map<long,MG_VOLUME*>::iterator it_volume;
1860     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))
1861     {
1862     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1863     long nb_ele=lst_ele->get_nb();
1864     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1865     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1866     for(long i=0;i<nb_ele;i++)
1867     {
1868     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1869     f << ele3->get_numero() << std::endl;
1870     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1871     else f_interieur << ele3->get_numero() << std::endl;
1872     }
1873     }
1874     p++;
1875     }
1876     }
1877     f_bord.close();
1878     f_interieur.close();
1879     f2.close();
1880     f.close();
1881     }
1882 couturad 933 }
1883 couturad 926
1884 couturad 933
1885 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
1886 couturad 919 {
1887 couturad 926 m_ves_file->enregistrer(fichier_ves);
1888 couturad 919 }
1889    
1890 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
1891 couturad 919 {
1892 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
1893     m_ves_file->enregistrer(fichier_ves);
1894     m_mg_gestionnaire->enregistrer(fichier_magic);
1895 couturad 919 }
1896    
1897 couturad 951 void MSTRUCT_VES::active_affichage(fonction_affiche* fonc)
1898 couturad 919 {
1899     fonc_affiche = fonc;
1900     affichageactif = 1;
1901     }
1902    
1903 couturad 926 void MSTRUCT_VES::affiche(char* message)
1904 couturad 919 {
1905     if(affichageactif==1) fonc_affiche(message);
1906     }
1907    
1908    
1909    
1910    
1911