ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 971
Committed: Thu Sep 20 19:04:41 2018 UTC (6 years, 7 months ago) by couturad
File size: 103010 byte(s)
Log Message:
MG_EXPORT: Changement du facteur de correction dans l'application de la conductivite thermique (corr=1)
MICROSTRUCTURE: 
-> Ajout de l'etude thermique (Calcul de la conductivite thermique apparente)
-> Ajout d'une analyse des proprietes massiques (Centre de masse, moment d'inertie)

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 951 if(vector_epaisseur!=NULL) delete vector_epaisseur;
397     }
398 couturad 968 else if(((int)param->get_valeur((char*)"Type_generateur"))==MSTRUCT::TYPE_GENERATEUR::DCR)
399 couturad 951 {
400 couturad 952 #ifdef PROJECT_CHRONO
401 couturad 951 std::string Nom_mgcg_modele = param->get_nom((char*)"Nom_mgcg_modele");
402     MSTRUCT_GENERATEUR_DCR *DCR;
403     if(generateur==NULL)
404     {
405     DCR = new MSTRUCT_GENERATEUR_DCR(m_mg_gestionnaire,(char*)Nom_mgcg_modele.c_str());
406     generateur=DCR;
407     DCR->active_affichage(fonc_affiche);
408     }
409     double Boite3D_distribution_Xmin = param->get_valeur((char*)"Boite3D_distribution_Xmin");
410     double Boite3D_distribution_Ymin = param->get_valeur((char*)"Boite3D_distribution_Ymin");
411     double Boite3D_distribution_Zmin = param->get_valeur((char*)"Boite3D_distribution_Zmin");
412     double Boite3D_distribution_Xmax = param->get_valeur((char*)"Boite3D_distribution_Xmax");
413     double Boite3D_distribution_Ymax = param->get_valeur((char*)"Boite3D_distribution_Ymax");
414     double Boite3D_distribution_Zmax = param->get_valeur((char*)"Boite3D_distribution_Zmax");
415     BOITE_3D Boite3D_distribution(Boite3D_distribution_Xmin,
416     Boite3D_distribution_Ymin,
417     Boite3D_distribution_Zmin,
418     Boite3D_distribution_Xmax,
419     Boite3D_distribution_Ymax,
420     Boite3D_distribution_Zmax);
421     DCR->change_boite3d_distribution(Boite3D_distribution);
422     double Nb_pas_X = param->get_valeur((char*)"Nb_pas_X");
423     double Nb_pas_Y = param->get_valeur((char*)"Nb_pas_Y");
424     double Nb_pas_Z = param->get_valeur((char*)"Nb_pas_Z");
425     DCR->change_nb_pas_grille(Nb_pas_X);
426     double Distance_min_inter_volume = param->get_valeur((char*)"Distance_min_inter_volume");
427     DCR->change_distance_inter_volume_min(Distance_min_inter_volume);
428     double Volume_min = param->get_valeur((char*)"Volume_min");
429     DCR->change_volume_min(Volume_min);
430     double Aire_min = param->get_valeur((char*)"Aire_min");
431     DCR->change_aire_min(Aire_min);
432     double Longueur_min = param->get_valeur((char*)"Longueur_min");
433     DCR->change_longueur_min(Longueur_min);
434     double Angle_min = param->get_valeur((char*)"Angle_min");
435     DCR->change_angle_min(Angle_min);
436 couturad 966 long Nb_iteration_max = (long)param->get_valeur((char*)"Nb_iteration_max");
437 couturad 951 bool Avec_intersections = (bool)param->get_valeur((char*)"Avec_intersections");
438     DCR->change_intersection_bords_ves(Avec_intersections);
439     std::string Nom_groupe_inclusion = param->get_nom((char*)"Nom_groupe_inclusion");
440 couturad 971 char message[1000];
441     sprintf(message,"Generateur DCR : %s",Nom_groupe_inclusion.c_str());
442     affiche(message);
443 couturad 951 int Type_inclusion = param->get_valeur((char*)"Type_inclusion");
444     double Fraction_volumique_cible = param->get_valeur((char*)"Fraction_volumique_cible");
445     double Eps_fraction_volumique = param->get_valeur((char*)"Eps_fraction_volumique");
446     bool Porosite = (bool)param->get_valeur((char*)"Porosite");
447     std::string multicouche = param->get_nom((char*)"Multicouche");
448 couturad 919
449 couturad 960 bool Avec_interface_graphique = (bool)param->get_valeur((char*)"Avec_interface_graphique");
450     double Facteur_reduction_vitesse = param->get_valeur((char*)"Facteur_reduction_vitesse");
451     double Friction = param->get_valeur((char*)"Friction");
452     double Pas_temps_sim = param->get_valeur((char*)"Pas_temps_sim");
453     double Temps_max_sim = param->get_valeur((char*)"Temps_max_sim");
454     double Eps_vitesse = param->get_valeur((char*)"Eps_vitesse");
455     DCR->active_interface_graphique(Avec_interface_graphique);
456     DCR->change_facteur_reduction_vitesse(Facteur_reduction_vitesse);
457     DCR->change_eps_vitesse(Eps_vitesse);
458     DCR->change_friction(Friction);
459     DCR->change_pas_temps(Pas_temps_sim);
460     DCR->change_temps_max_sim(Temps_max_sim);
461 couturad 971
462 couturad 968 if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::SPHERE)
463 couturad 951 {
464 couturad 966 double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
465     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
466     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
467 couturad 971 DCR->ajouter_spheres(Nom_groupe_inclusion,Mu_rayon,Sigma_rayon,Type_distribution_rayon,Fraction_volumique_cible,Eps_fraction_volumique,Porosite);
468 couturad 966 }
469 couturad 968 else if(Type_inclusion==MSTRUCT::TYPE_INCLUSION::CYLINDRE)
470 couturad 966 {
471     double Mu_rayon = param->get_valeur((char*)"Mu_rayon");
472     double Sigma_rayon = param->get_valeur((char*)"Sigma_rayon");
473     double Type_distribution_rayon = param->get_valeur((char*)"Type_distribution_rayon");
474     double Mu_longueur = param->get_valeur((char*)"Mu_longueur");
475     double Sigma_longueur = param->get_valeur((char*)"Sigma_longueur");
476     double Type_distribution_longueur = param->get_valeur((char*)"Type_distribution_longueur");
477     double Mu_theta = param->get_valeur((char*)"Mu_theta");
478     double Sigma_theta = param->get_valeur((char*)"Sigma_theta");
479     double Type_distribution_theta = param->get_valeur((char*)"Type_distribution_theta");
480     double Mu_phi = param->get_valeur((char*)"Mu_phi");
481     double Sigma_phi = param->get_valeur((char*)"Sigma_phi");
482     double Type_distribution_phi = param->get_valeur((char*)"Type_distribution_phi");
483     DCR->ajouter_cylindres(Nom_groupe_inclusion,
484     Mu_rayon,Sigma_rayon,Type_distribution_rayon,
485     Mu_longueur,Sigma_longueur,Type_distribution_longueur,
486     Mu_theta,Sigma_theta,Type_distribution_theta,
487     Mu_phi,Sigma_phi,Type_distribution_phi,
488 couturad 971 Fraction_volumique_cible,Eps_fraction_volumique,
489     Porosite);
490 couturad 966 }
491 couturad 971 #else
492     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
493     #endif
494     }
495     }
496     if(generateur->get_type()==MSTRUCT::TYPE_GENERATEUR::DCR)
497     {
498     #ifdef PROJECT_CHRONO
499     MSTRUCT_GENERATEUR_DCR *DCR= (MSTRUCT_GENERATEUR_DCR*)generateur;
500     if(DCR->lancer_simulation()==FAIL)
501 couturad 966 {
502     delete generateur;
503 couturad 971 return FAIL;
504 couturad 966 }
505 couturad 971 DCR->generer_geometrie();
506 couturad 952 #else
507     std::cerr << "*** ERREUR : MSTRUCT_VES::generer_geometrie : PROJECT_CHRONO absent ***" << std::endl;
508 couturad 971 #endif
509 couturad 919 }
510     ot_cpu.ajouter_etape((char*)"generation_geometrie");
511 couturad 926 double temps_generation_geometrie;
512     ot_cpu.get_etape((char*)"generation_geometrie",temps_generation_geometrie);
513     change_temps_geometrie(get_temps_geometrie()+temps_generation_geometrie);
514 couturad 919 generateur->construire(this);
515     delete generateur;
516     return OK;
517     }
518    
519 couturad 926 int MSTRUCT_VES::generer_materiau(std::vector< OT_PARAMETRES* >& vector_params_materiau)
520 couturad 919 {
521     OT_CPU ot_cpu;
522     ot_cpu.initialise();
523     std::vector<OT_PARAMETRES*>::iterator it;
524     for(it=vector_params_materiau.begin();it!=vector_params_materiau.end();it++)
525     {
526     OT_PARAMETRES* param = *it;
527     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
528 couturad 971 bool Etude_mecanique = (bool)param->get_valeur((char*)"Etude_mecanique");
529     if(Etude_mecanique)
530 couturad 919 {
531 couturad 971 double Mu_E = param->get_valeur((char*)"Mu_E");
532     double Sigma_E = param->get_valeur((char*)"Sigma_E");
533     int Type_distribution_E = (int)param->get_valeur((char*)"Type_distribution_E");
534     double Mu_nu = param->get_valeur((char*)"Mu_nu");
535     double Sigma_nu = param->get_valeur((char*)"Sigma_nu");
536     int Type_distribution_nu = (int)param->get_valeur((char*)"Type_distribution_nu");
537     std::random_device seed;
538     std::mt19937_64 generateur(seed());
539     std::uniform_real_distribution<double> uniform_distribution_E(Mu_E-Sigma_E,Mu_E+Sigma_E);
540     std::normal_distribution<double> normal_distribution_E(Mu_E,Sigma_E);
541     std::uniform_real_distribution<double> uniform_distribution_nu(Mu_nu-Sigma_nu,Mu_nu+Sigma_nu);
542     std::normal_distribution<double> normal_distribution_nu(Mu_nu,Sigma_nu);
543     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
544     std::map<long,MG_CG_FORME*>::iterator it_forme;
545     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))
546 couturad 919 {
547 couturad 971 double E;
548     if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::FIXE) E=Mu_E;
549     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) E=uniform_distribution_E(generateur);
550     else if(Type_distribution_E==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) E=normal_distribution_E(generateur);
551     double nu;
552     if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::FIXE) nu=Mu_nu;
553     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) nu=uniform_distribution_nu(generateur);
554     else if(Type_distribution_nu==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) nu=normal_distribution_nu(generateur);
555     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
556     {
557     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
558     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Em",E);
559     forme_volume->get_mg_volume()->ajouter_ccf((char*)"nu",nu);
560     }
561     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
562     {
563     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
564     std::map<long,MG_VOLUME*>::iterator it_volume;
565     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))
566     {
567     volume->ajouter_ccf((char*)"Em",E);
568     volume->ajouter_ccf((char*)"nu",nu);
569     }
570     }
571 couturad 919 }
572 couturad 971 }
573     bool Etude_thermique = (bool)param->get_valeur((char*)"Etude_thermique");
574     if(Etude_thermique)
575     {
576     double Mu_Lambda = param->get_valeur((char*)"Mu_Lambda");
577     double Sigma_Lambda = param->get_valeur((char*)"Sigma_Lambda");
578     int Type_distribution_Lambda = (int)param->get_valeur((char*)"Type_distribution_Lambda");
579     double Mu_Ro = param->get_valeur((char*)"Mu_Ro");
580     double Sigma_Ro = param->get_valeur((char*)"Sigma_Ro");
581     int Type_distribution_Ro = (int)param->get_valeur((char*)"Type_distribution_Ro");
582     double Mu_Cp = param->get_valeur((char*)"Mu_Cp");
583     double Sigma_Cp = param->get_valeur((char*)"Sigma_Cp");
584     int Type_distribution_Cp = (int)param->get_valeur((char*)"Type_distribution_Cp");
585     std::random_device seed;
586     std::mt19937_64 generateur(seed());
587     std::uniform_real_distribution<double> uniform_distribution_Lambda(Mu_Lambda-Sigma_Lambda,Mu_Lambda+Sigma_Lambda);
588     std::normal_distribution<double> normal_distribution_Lambda(Mu_Lambda,Sigma_Lambda);
589     std::uniform_real_distribution<double> uniform_distribution_Ro(Mu_Ro-Sigma_Ro,Mu_Ro+Sigma_Ro);
590     std::normal_distribution<double> normal_distribution_Ro(Mu_Ro,Sigma_Ro);
591     std::uniform_real_distribution<double> uniform_distribution_Cp(Mu_Cp-Sigma_Cp,Mu_Cp+Sigma_Cp);
592     std::normal_distribution<double> normal_distribution_Cp(Mu_Cp,Sigma_Cp);
593     MG_CG_GROUPE_FORME* mgcg_groupe_forme = m_mgcg_modele->get_mgcg_groupe_forme(Nom_groupe_forme);
594     std::map<long,MG_CG_FORME*>::iterator it_forme;
595     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))
596 couturad 919 {
597 couturad 971 double Lambda;
598     if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Lambda=Mu_Lambda;
599     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Lambda=uniform_distribution_Lambda(generateur);
600     else if(Type_distribution_Lambda==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Lambda=normal_distribution_Lambda(generateur);
601     double Ro;
602     if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Ro=Mu_Ro;
603     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Ro=uniform_distribution_Ro(generateur);
604     else if(Type_distribution_Ro==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Ro=normal_distribution_Ro(generateur);
605     double Cp;
606     if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::FIXE) Cp=Mu_Cp;
607     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) Cp=uniform_distribution_Cp(generateur);
608     else if(Type_distribution_Cp==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) Cp=normal_distribution_Cp(generateur);
609     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
610     {
611     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
612     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Kx",Lambda);
613     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Ro",Ro);
614     forme_volume->get_mg_volume()->ajouter_ccf((char*)"Cp",Cp);
615     }
616     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
617     {
618     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
619     std::map<long,MG_VOLUME*>::iterator it_volume;
620     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))
621     {
622     volume->ajouter_ccf((char*)"Kx",Lambda);
623     volume->ajouter_ccf((char*)"Ro",Ro);
624     volume->ajouter_ccf((char*)"Cp",Cp);
625     }
626     }
627 couturad 919 }
628     }
629 couturad 971 }
630 couturad 919 ot_cpu.ajouter_etape((char*)"generation_materiau");
631 couturad 926 double temps_generation_materiau;
632     ot_cpu.get_etape((char*)"generation_materiau",temps_generation_materiau);
633     change_temps_materiau(get_temps_materiau()+temps_generation_materiau);
634 couturad 919 return OK;
635     }
636    
637 couturad 926 int MSTRUCT_VES::generer_carte(OT_PARAMETRES *param)
638 couturad 919 {
639     double Ecart_nodal = param->get_valeur((char*)"Ecart_nodal");
640 couturad 937 double Ecart_nodal_face_particule = param->get_valeur((char*)"Ecart_nodal_face_particule");
641 couturad 919 double Fechantillonnage = param->get_valeur((char*)"Fechantillonnage");
642     double Nb_cellule_direction = param->get_valeur((char*)"Nb_cellule_direction");
643     std::string Nom_fem_solution = param->get_nom((char*)"Nom_fem_solution");
644     std::string Nom_mg_gestionnaire_carte = param->get_nom((char*)"Nom_mg_gestionnaire_carte");
645     std::string Nom_carte = param->get_nom((char*)"Nom_carte");
646     double Nb_couche_min = param->get_valeur((char*)"Nb_couche_min");
647     double Nb_pas = param->get_valeur((char*)"Nb_pas");
648     double Facteur_augmentation = param->get_valeur((char*)"Facteur_augmentation");
649     MG_GESTIONNAIRE *mggest_carte = new MG_GESTIONNAIRE;
650 couturad 926 MG_CG_GROUPE_FORME* mgcg_groupe_matrice = m_mgcg_modele->get_mgcg_groupe_forme((char*)"Matrice");
651     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume_matrice = mgcg_groupe_matrice->get_tpl_map_volume();
652 couturad 919 OT_CPU ot_cpu;
653     ot_cpu.initialise();
654     FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE *carte = new FCT_TAILLE_FEM_SOLUTION_GENERATEUR_MICROSTRUCTURE(mggest_carte,
655     m_mg_geometrie,
656     Ecart_nodal,
657 couturad 937 Ecart_nodal_face_particule,
658 couturad 919 Fechantillonnage,
659     Nb_cellule_direction,
660     (char*)Nom_fem_solution.c_str(),
661     tpl_map_volume_matrice,
662     Nb_couche_min,
663     Nb_pas,
664     Facteur_augmentation);
665 couturad 926
666    
667 couturad 933 carte->active_affichage(fonc_affiche);
668 couturad 926 carte->construit();
669 couturad 919 ot_cpu.ajouter_etape((char*)"generation_carte");
670 couturad 926 double temps_generation_carte;
671     ot_cpu.get_etape((char*)"generation_carte",temps_generation_carte);
672     change_temps_carte(get_temps_carte()+temps_generation_carte);
673     mggest_carte->enregistrer(Nom_mg_gestionnaire_carte.c_str());
674 couturad 919 carte->enregistrer((char*)Nom_carte.c_str());
675 couturad 964 char message[1000];
676     std::sprintf(message,"Fichier CARTE de sortie : %s",Nom_carte.c_str());
677     affiche(message);
678 couturad 926 m_ves_file->change_nom_fichier_carte((char*)Nom_carte.c_str());
679 couturad 919 return OK;
680     }
681    
682 couturad 926 int MSTRUCT_VES::generer_maillage(OT_PARAMETRES *param,FCT_TAILLE_FEM_SOLUTION* carte)
683 couturad 919 {
684     OT_CPU ot_cpu;
685     ot_cpu.initialise();
686     int Niveau = (int)param->get_valeur((char*)"Niveau");
687     int Niveau_opt_2d = (int)param->get_valeur((char*)"Niveau_opt_2d");
688     int Niveau_opt_3d = (int)param->get_valeur((char*)"Niveau_opt_3d");
689     double Priorite_metrique = param->get_valeur((char*)"Priorite_metrique");
690     int Analyse = (int)param->get_valeur((char*)"Analyse");
691     affiche((char*)"Maillage du VER :");
692     m_mg_maillage = new MG_MAILLAGE(m_mg_geometrie);
693     m_mg_gestionnaire->ajouter_mg_maillage(m_mg_maillage);
694 couturad 951 change_mg_maillage(m_mg_maillage);
695     affiche((char*)" Maillage 3D_couche :");
696     MAILLEUR3D_COUCHE m3d_couche(m_mg_maillage,m_mg_geometrie,carte);
697     m3d_couche.active_affichage(fonc_affiche);
698     LISTE_MG_VOLUME::iterator it_volume;
699     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
700 couturad 919 {
701 couturad 951 if(volume->est_mince())
702     {
703     char message[1000];
704     sprintf(message," -> Maillage du volume id %li",volume->get_id());
705     affiche(message);
706 couturad 966 if(m3d_couche.maille(volume)==FAIL) return FAIL;
707 couturad 951 }
708 couturad 919 }
709 couturad 951 if(Niveau>=0)
710 couturad 919 {
711 couturad 951 MAILLEUR0D m0d(m_mg_maillage,m_mg_geometrie);
712     affiche((char*)" Maillage 0D :");
713     LISTE_MG_SOMMET::iterator it_sommet;
714     for(MG_SOMMET* sommet=m_mg_geometrie->get_premier_sommet(it_sommet);sommet!=NULL;sommet=m_mg_geometrie->get_suivant_sommet(it_sommet))
715     {
716     if(sommet->get_lien_maillage()->get_nb()>0) continue;
717     char message[1000];
718     sprintf(message," -> Maillage du sommet id %li",sommet->get_id());
719     affiche(message);
720 couturad 966 if(m0d.maille(sommet)==FAIL) return FAIL;
721 couturad 951 }
722 couturad 919 }
723 couturad 951 if(Niveau>=1)
724 couturad 919 {
725 couturad 951 MAILLEUR1D m1d(m_mg_maillage,m_mg_geometrie,carte);
726     affiche((char*)" Maillage 1D :");
727     m1d.active_affichage(fonc_affiche);
728     LISTE_MG_ARETE::iterator it_arete;
729     for(MG_ARETE* arete=m_mg_geometrie->get_premier_arete(it_arete);arete!=NULL;arete=m_mg_geometrie->get_suivant_arete(it_arete))
730     {
731     if(arete->get_lien_maillage()->get_nb()>0) continue;
732     char message[1000];
733     sprintf(message," -> Maillage de l'arete id %li",arete->get_id());
734     affiche(message);
735 couturad 966 if(m1d.maille(arete)==FAIL) return FAIL;
736 couturad 951 }
737 couturad 919 }
738 couturad 951 if(Niveau>=2)
739 couturad 919 {
740 couturad 951 MAILLEUR2D m2d(m_mg_maillage,m_mg_geometrie,carte);
741     m2d.change_niveau_optimisation(Niveau_opt_2d);
742     m2d.change_priorite_metrique(Priorite_metrique);
743     affiche((char*)" Maillage 2D :");
744     m2d.active_affichage(fonc_affiche);
745     LISTE_MG_FACE::iterator it_face;
746     for(MG_FACE* face=m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
747     {
748     if(face->get_lien_maillage()->get_nb()>0) continue;
749     char message[1000];
750     sprintf(message," -> Maillage de la face id %li",face->get_id());
751     affiche(message);
752 couturad 966 if(m2d.maille(face)==FAIL) return FAIL;
753 couturad 951 }
754 couturad 919 }
755 couturad 951 if(Niveau>=3)
756     {
757     MAILLEUR3D m3d(m_mg_maillage,m_mg_geometrie,carte,false);
758     m3d.change_niveau_optimisation(Niveau_opt_3d);
759     m3d.change_priorite_metrique(Priorite_metrique);
760     affiche((char*)" Maillage 3D :");
761     m3d.active_affichage(fonc_affiche);
762     for(MG_VOLUME* volume=m_mg_geometrie->get_premier_volume(it_volume);volume!=NULL;volume=m_mg_geometrie->get_suivant_volume(it_volume))
763     {
764     if(volume->get_lien_maillage()->get_nb()>0) continue;
765     if(volume->est_mince()) continue;
766     char message[1000];
767     sprintf(message," -> Maillage du volume id %li",volume->get_id());
768     affiche(message);
769 couturad 966 if(m3d.maille(volume)==FAIL) return FAIL;
770 couturad 951 }
771     }
772 couturad 919 ot_cpu.ajouter_etape((char*)"generation_maillage");
773 couturad 926 double temps_generation_maillage;
774     ot_cpu.get_etape((char*)"generation_maillage",temps_generation_maillage);
775     change_temps_maillage(get_temps_maillage()+temps_generation_maillage);
776 couturad 919 return OK;
777     }
778    
779 couturad 926 int MSTRUCT_VES::generer_fem_maillage(OT_PARAMETRES *param)
780 couturad 919 {
781     OT_CPU ot_cpu;
782     ot_cpu.initialise();
783     int Degre = (int)param->get_valeur((char*)"Degre");
784     int Analyse = (int)param->get_valeur((char*)"Analyse");
785     int Optimisation_num_noeud = (int)param->get_valeur((char*)"Optimisation_num_noeud");
786     MAILLEUR_FEM mailleurfem;
787     mailleurfem.active_affichage(fonc_affiche);
788 couturad 926 m_fem_maillage = new FEM_MAILLAGE(m_mg_maillage->get_mg_geometrie(),m_mg_maillage,Degre);
789 couturad 919 m_mg_gestionnaire->ajouter_fem_maillage(m_fem_maillage);
790 couturad 926 change_fem_maillage(m_fem_maillage);
791 couturad 966 if(Optimisation_num_noeud) {if(mailleurfem.maille(m_fem_maillage,1)==FAIL) return FAIL;}
792     else {if(mailleurfem.maille(m_fem_maillage,0)==FAIL) return FAIL;};
793 couturad 919 if(Analyse)
794     {
795     MAILLEUR_ANALYSE m3d(m_fem_maillage);
796     m3d.active_affichage(fonc_affiche);
797     // m3d.analyse();
798     }
799     ot_cpu.ajouter_etape((char*)"generation_fem_maillage");
800 couturad 926 double temps_generation_fem_maillage;
801     ot_cpu.get_etape((char*)"generation_fem_maillage",temps_generation_fem_maillage);
802     change_temps_fem_maillage(get_temps_fem_maillage()+temps_generation_fem_maillage);
803 couturad 919 return OK;
804     }
805    
806 couturad 926 int MSTRUCT_VES::generer_etude(OT_PARAMETRES *param)
807 couturad 919 {
808     OT_CPU ot_cpu;
809     ot_cpu.initialise();
810 couturad 926 BOITE_3D boite3D_ves = get_boite3d_ves();
811     double eps = get_precision();
812 couturad 919 TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
813     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
814     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
815     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
816     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
817     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
818     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
819     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
820     {
821     double xyzmin[3];
822     double xyzmax[3];
823     face->get_xyz_min_max(xyzmin,xyzmax,16);
824    
825 couturad 926 if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
826     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);
827     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);
828     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);
829     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);
830     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);
831 couturad 919 }
832     MG_SOMMET* sommet_origine;
833     MG_SOMMET* sommet_x1y0z0;
834     MG_SOMMET* sommet_x0y1z0;
835     MG_SOMMET* sommet_x0y0z1;
836     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
837     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
838     {
839     double xyz[3];
840     som->get_point()->evaluer(xyz);
841 couturad 926 if(OPERATEUR::egal(xyz[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyz[1],boite3D_ves.get_ymin(),eps) && OPERATEUR::egal(xyz[2],boite3D_ves.get_zmin(),eps)) sommet_origine=som;
842     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;
843     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;
844     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;
845 couturad 919 }
846 couturad 971 int Type_etude = (int)param->get_valeur((char*)"Type_etude");
847 couturad 968 if(Type_etude==MSTRUCT::TYPE_ETUDE::MECANIQUE)
848 couturad 919 {
849 couturad 971 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 couturad 968 if(Type_Chargement==MSTRUCT::TYPE_CHARGEMENT::SPHERIQUE)
853 couturad 919 {
854 couturad 968 if(Type_CL==MSTRUCT::TYPE_CONDITIONS_LIMITES::DEFORMATION_HOMOGENE)
855 couturad 919 {
856     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true);
857     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",Valeur_CL,true);
858     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true);
859     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",Valeur_CL,true);
860     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true);
861     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",Valeur_CL,true);
862     }
863 couturad 968 else if(Type_CL==MSTRUCT::TYPE_CONDITIONS_LIMITES::CONTRAINTE_HOMOGENE)
864 couturad 919 {
865     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true);
866     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Pz",Valeur_CL,false);
867     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true);
868     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Px",Valeur_CL,false);
869     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true);
870     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Py",Valeur_CL,false);
871     }
872     }
873 couturad 968 else if(Type_Chargement==MSTRUCT::TYPE_CHARGEMENT::DEVIATORIQUE)
874 couturad 919 {
875 couturad 968 if(Type_CL==MSTRUCT::TYPE_CONDITIONS_LIMITES::DEFORMATION_HOMOGENE)
876 couturad 919 {
877     char chr_valeur_cl[1000];
878     sprintf(chr_valeur_cl,"%lf",Valeur_CL);
879     std::string str_valeur_cl = chr_valeur_cl;
880     std::string formule_Dx = str_valeur_cl+ "*Y";
881     std::string formule_Dy = str_valeur_cl+ "*Z";
882     std::string formule_Dz = str_valeur_cl+ "*X";
883     std::vector<std::string> liste_variable_formule_Dx;
884     std::vector<std::string> liste_variable_formule_Dy;
885     std::vector<std::string> liste_variable_formule_Dz;
886     liste_variable_formule_Dx.push_back((std::string)"Y");
887     liste_variable_formule_Dy.push_back((std::string)"Z");
888     liste_variable_formule_Dz.push_back((std::string)"X");
889     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
890     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
891     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
892     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
893     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
894     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
895     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
896     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
897     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
898     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
899     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
900     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
901     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
902     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
903     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
904     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true);
905     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true);
906     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true);
907     }
908 couturad 968 else if(Type_CL==MSTRUCT::TYPE_CONDITIONS_LIMITES::CONTRAINTE_HOMOGENE)
909 couturad 919 {
910     sommet_origine->ajouter_ccf((char*)"Dt",0.0);
911     sommet_x1y0z0->ajouter_ccf((char*)"Dy",0.0);
912     sommet_x1y0z0->ajouter_ccf((char*)"Dz",0.0);
913     sommet_x0y1z0->ajouter_ccf((char*)"Dz",0.0);
914 couturad 968 appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Px",-Valeur_CL,false);
915     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Py",-Valeur_CL,false);
916     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Px",Valeur_CL,false);
917     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Py",Valeur_CL,false);
918     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Px",-Valeur_CL,false);
919     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Pz",-Valeur_CL,false);
920     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Px",Valeur_CL,false);
921     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Pz",Valeur_CL,false);
922     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Py",-Valeur_CL,false);
923     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Pz",-Valeur_CL,false);
924     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Py",Valeur_CL,false);
925     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Pz",Valeur_CL,false);
926 couturad 919 }
927     }
928     }
929 couturad 971 else if(Type_etude==MSTRUCT::TYPE_ETUDE::THERMIQUE)
930     {
931     int Type_CL = (int)param->get_valeur((char*)"Type_CL");
932     double Valeur_CL = param->get_valeur((char*)"Valeur_CL");
933     int Direction = (int)param->get_valeur((char*)"Direction");
934     if(Type_CL==MSTRUCT::TYPE_CONDITIONS_LIMITES::GRADIENT_TEMPERATURE)
935     {
936     if(Direction==0)
937     {
938     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Tn",0.0,false);
939     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Tn",Valeur_CL,false);
940     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"fn",0.0,false);
941     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"fn",0.0,false);
942     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"fn",0.0,false);
943     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"fn",0.0,false);
944     }
945     else if(Direction==1)
946     {
947     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"fn",0.0,false);
948     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"fn",0.0,false);
949     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"fn",0.0,false);
950     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"fn",0.0,false);
951     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Tn",0.0,false);
952     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Tn",Valeur_CL,false);
953     }
954     else if(Direction==2)
955     {
956     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"fn",0.0,false);
957     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"fn",0.0,false);
958     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Tn",0.0,false);
959     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Tn",Valeur_CL,false);
960     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"fn",0.0,false);
961     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"fn",0.0,false);
962     }
963     }
964     else if(Type_CL==MSTRUCT::TYPE_CONDITIONS_LIMITES::FLUX_CHALEUR)
965     {
966     if(Direction==0)
967     {
968     sommet_origine->ajouter_ccf((char*)"Tn",0.0);
969     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"fn",Valeur_CL,false);
970     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"fn",-Valeur_CL,false);
971     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"fn",0.0,false);
972     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"fn",0.0,false);
973     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"fn",0.0,false);
974     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"fn",0.0,false);
975     }
976     else if(Direction==1)
977     {
978     sommet_origine->ajouter_ccf((char*)"Tn",0.0);
979     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"fn",0.0,false);
980     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"fn",0.0,false);
981     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"fn",0.0,false);
982     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"fn",0.0,false);
983     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"fn",Valeur_CL,false);
984     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"fn",-Valeur_CL,false);
985     }
986     else if(Direction==2)
987     {
988     sommet_origine->ajouter_ccf((char*)"Tn",0.0);
989     appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"fn",0.0,false);
990     appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"fn",0.0,false);
991     appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"fn",Valeur_CL,false);
992     appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"fn",-Valeur_CL,false);
993     appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"fn",0.0,false);
994     appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"fn",0.0,false);
995     }
996     }
997     }
998 couturad 919 ot_cpu.ajouter_etape((char*)"generation_etude");
999 couturad 926 double temps_generation_etude;
1000     ot_cpu.get_etape((char*)"generation_etude",temps_generation_etude);
1001     change_temps_etude(get_temps_etude()+temps_generation_etude);
1002 couturad 919 return OK;
1003     }
1004    
1005 couturad 926 int MSTRUCT_VES::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, double valeur,bool topo_sous_jacente)
1006 couturad 919 {
1007     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1008     for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan))
1009     {
1010     face->ajouter_ccf(condition,valeur);
1011     if(topo_sous_jacente==true)
1012     {
1013     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo;
1014     face->get_topologie_sousjacente(&map_topo);
1015     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo;
1016     for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo))
1017     {
1018     topo->ajouter_ccf(condition,valeur);
1019     }
1020     }
1021     }
1022     }
1023    
1024 couturad 926 int MSTRUCT_VES::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, std::string formule,std::vector<std::string> &listvariable,bool topo_sous_jacente)
1025 couturad 919 {
1026     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1027     for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan))
1028     {
1029     face->ajouter_ccf(condition,formule,listvariable);
1030     if(topo_sous_jacente==true)
1031     {
1032     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo;
1033     face->get_topologie_sousjacente(&map_topo);
1034     TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo;
1035     for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo))
1036     {
1037     topo->ajouter_ccf(condition,formule,listvariable);
1038     }
1039     }
1040     }
1041     }
1042    
1043 couturad 968 int MSTRUCT_VES::generer_calcul(OT_PARAMETRES *param,char* param_aster,std::string nom_etude)
1044 couturad 919 {
1045     int Type_etude = (int)param->get_valeur((char*)"Type_etude");
1046 couturad 971 int Type_calcul;
1047     if(Type_etude==MSTRUCT::TYPE_ETUDE::MECANIQUE) Type_calcul=MAGIC::CALCUL_ASTER::ELASTIQUE;
1048     else if(Type_etude==MSTRUCT::TYPE_ETUDE::THERMIQUE) Type_calcul=MAGIC::CALCUL_ASTER::THERMIQUE;
1049 couturad 919 std::string Code_resu = param->get_nom((char*)"Code_resu");
1050     MGASTER mgaster;
1051     mgaster.active_affichage(fonc_affiche);
1052     OT_CPU ot_cpu;
1053     ot_cpu.initialise();
1054 couturad 968 mgaster.calcule(param_aster,m_fem_maillage,(char*)nom_etude.c_str(),Type_calcul,(char*)Code_resu.c_str());
1055 couturad 919 ot_cpu.ajouter_etape((char*)"calcul");
1056 couturad 926 double temps_calcul;
1057     ot_cpu.get_etape((char*)"calcul",temps_calcul);
1058     change_temps_calcul(get_temps_calcul()+temps_calcul);
1059 couturad 919 }
1060    
1061 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement)
1062 couturad 919 {
1063 couturad 926 OT_CPU ot_cpu;
1064     ot_cpu.initialise();
1065     std::vector<OT_PARAMETRES*>::iterator it;
1066 couturad 968 char ligne[1000];
1067     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1068 couturad 919 {
1069 couturad 926 OT_PARAMETRES* param = *it;
1070 couturad 968 int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1071 couturad 926 std::string Identifiant = param->get_nom((char*)"Identifiant");
1072     if(get_analyse(Identifiant)!=NULL)
1073     {
1074     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1075     continue;
1076     }
1077     sprintf(ligne,"-> %s",Identifiant.c_str());
1078     affiche(ligne);
1079 couturad 968 if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP)
1080 couturad 926 {
1081     long Num_solution = (long)param->get_valeur((char*)"Num_solution");
1082 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1083     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1084     BOITE_3D *boite_3d_analyse=NULL;
1085     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1086     if(Boite_analyse)
1087     {
1088     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1089     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1090     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1091     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1092     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1093     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1094     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1095     }
1096     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1097 couturad 926 FEM_SOLUTION* sol = m_mg_gestionnaire->get_fem_solution(Num_solution);
1098     int nb_champ = sol->get_nb_champ();
1099 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);
1100     if(Analyse_erosion)
1101 couturad 930 {
1102 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1103     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1104     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_champ,Nb_couche,Epaisseur_couche);
1105     analyse_erosion->executer();
1106     ajouter_analyse(analyse_erosion);
1107 couturad 930 }
1108     else
1109     {
1110 couturad 968 analyse_champ->executer();
1111     ajouter_analyse(analyse_champ);
1112 couturad 930 }
1113 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1114     }
1115     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION)
1116 couturad 926 {
1117 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1118     int Avec_fem_maillage = (int)param->get_valeur((char*)"Avec_fem_maillage");
1119     BOITE_3D *boite_3d_analyse=NULL;
1120     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1121     if(Boite_analyse)
1122 couturad 930 {
1123 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1124     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1125     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1126     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1127     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1128     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1129     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1130 couturad 930 }
1131 couturad 968 MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = new MSTRUCT_ANALYSE_ORIENTATION(this,Identifiant,Nom_groupe_forme,boite_3d_analyse,Avec_fem_maillage);
1132     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1133     if(Analyse_erosion)
1134 couturad 930 {
1135 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1136     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1137     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_orientation,Nb_couche,Epaisseur_couche);
1138     analyse_erosion->executer();
1139     ajouter_analyse(analyse_erosion);
1140 couturad 930 }
1141 couturad 938 else
1142     {
1143 couturad 968 analyse_orientation->executer();
1144     ajouter_analyse(analyse_orientation);
1145 couturad 938 }
1146 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1147 couturad 938 }
1148 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CAO)
1149 couturad 926 {
1150 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1151 couturad 926 double Largeur_colonne_distribution_volume_forme = (double)param->get_valeur((char*)"Largeur_colonne_distribution_volume_forme");
1152 couturad 968 MSTRUCT_ANALYSE_CAO* analyse_cao = new MSTRUCT_ANALYSE_CAO(this,Identifiant,Largeur_colonne_distribution_volume_forme,Nom_groupe_forme);
1153     analyse_cao->executer();
1154     ajouter_analyse(analyse_cao);
1155 couturad 926 }
1156 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_PROPRIETE_MASSIQUE)
1157     {
1158     std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1159     MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE* analyse_prop_mass = new MSTRUCT_ANALYSE_PROPRIETE_MASSIQUE(this,Identifiant,Nom_groupe_forme);
1160     analyse_prop_mass->executer();
1161     ajouter_analyse(analyse_prop_mass);
1162     }
1163 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_MG)
1164 couturad 926 {
1165 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1166 couturad 926 double Largeur_colonne_distribution_qualite_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_2D");
1167     double Largeur_colonne_distribution_qualite_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_qualite_3D");
1168     double Largeur_colonne_distribution_taille_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_2D");
1169     double Largeur_colonne_distribution_taille_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_taille_3D");
1170 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1171     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1172     if(Boite_analyse)
1173 couturad 930 {
1174 couturad 968 double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1175     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1176     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1177     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1178     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1179     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1180     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1181 couturad 930 }
1182 couturad 968 MSTRUCT_ANALYSE_MG_MAILLAGE* analyse_mg_maillage = new MSTRUCT_ANALYSE_MG_MAILLAGE(this,
1183     Identifiant,
1184     m_mg_maillage->get_id(),
1185     Largeur_colonne_distribution_qualite_2D,
1186     Largeur_colonne_distribution_taille_2D,
1187     Largeur_colonne_distribution_qualite_3D,
1188     Largeur_colonne_distribution_taille_3D,
1189     Nom_groupe_forme,boite_3d_analyse);
1190     int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1191     if(Analyse_erosion)
1192     {
1193     long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1194     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1195     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_mg_maillage,Nb_couche,Epaisseur_couche);
1196     analyse_erosion->executer();
1197     ajouter_analyse(analyse_erosion);
1198     }
1199 couturad 930 else
1200     {
1201 couturad 968 analyse_mg_maillage->executer();
1202     ajouter_analyse(analyse_mg_maillage);
1203 couturad 930 }
1204 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1205 couturad 926 }
1206 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MAILLAGE_FEM)
1207 couturad 926 {
1208 couturad 968 std::string Nom_groupe_forme = param->get_nom((char*)"Nom_groupe_forme");
1209 couturad 926 double Largeur_colonne_distribution_jacobien_2D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_min");
1210     double Largeur_colonne_distribution_jacobien_2D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_2D_max");
1211     double Largeur_colonne_distribution_jacobien_3D_min = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_min");
1212     double Largeur_colonne_distribution_jacobien_3D_max = (double)param->get_valeur((char*)"Largeur_colonne_distribution_jacobien_3D_max");
1213     double Largeur_colonne_distribution_distortion_2D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_2D");
1214     double Largeur_colonne_distribution_distortion_3D = (double)param->get_valeur((char*)"Largeur_colonne_distribution_distortion_3D");
1215 couturad 968 BOITE_3D *boite_3d_analyse=NULL;
1216     int Boite_analyse = (int)param->get_valeur((char*)"Boite_analyse");
1217     if(Boite_analyse)
1218     {
1219     double Xmin = (double)param->get_valeur((char*)"Boite3D_analyse_Xmin");
1220     double Ymin = (double)param->get_valeur((char*)"Boite3D_analyse_Ymin");
1221     double Zmin = (double)param->get_valeur((char*)"Boite3D_analyse_Zmin");
1222     double Xmax = (double)param->get_valeur((char*)"Boite3D_analyse_Xmax");
1223     double Ymax = (double)param->get_valeur((char*)"Boite3D_analyse_Ymax");
1224     double Zmax = (double)param->get_valeur((char*)"Boite3D_analyse_Zmax");
1225     boite_3d_analyse = new BOITE_3D(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
1226     }
1227     MSTRUCT_ANALYSE_FEM_MAILLAGE* analyse_maillage_fem = new MSTRUCT_ANALYSE_FEM_MAILLAGE(this,
1228     Identifiant,
1229 couturad 926 m_fem_maillage->get_id(),
1230     Largeur_colonne_distribution_jacobien_2D_min,
1231     Largeur_colonne_distribution_jacobien_2D_max,
1232     Largeur_colonne_distribution_jacobien_3D_min,
1233     Largeur_colonne_distribution_jacobien_3D_max,
1234     Largeur_colonne_distribution_distortion_2D,
1235     Largeur_colonne_distribution_distortion_3D,
1236     Nom_groupe_forme,
1237     boite_3d_analyse);
1238 couturad 968 int Analyse_erosion = (int)param->get_valeur((char*)"Analyse_erosion");
1239     if(Analyse_erosion)
1240 couturad 930 {
1241 couturad 968 long Nb_couche = (long)param->get_valeur((char*)"Nb_couche");
1242     double Epaisseur_couche = (double)param->get_valeur((char*)"Epaisseur_couche");
1243     MSTRUCT_ANALYSE_EROSION* analyse_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,analyse_maillage_fem,Nb_couche,Epaisseur_couche);
1244     analyse_erosion->executer();
1245     ajouter_analyse(analyse_erosion);
1246 couturad 930 }
1247     else
1248     {
1249 couturad 968 analyse_maillage_fem->executer();
1250     ajouter_analyse(analyse_maillage_fem);
1251 couturad 930 }
1252 couturad 968 if(boite_3d_analyse!=NULL) delete boite_3d_analyse;
1253 couturad 926 }
1254 couturad 968 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_NORMALISE)
1255     {
1256     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1257     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1258     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1259     {
1260     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1261     MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,Largeur_colonne_distribution);
1262     ajouter_analyse(analyse_normalise);
1263     }
1264     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1265     {
1266     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1267     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1268     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1269     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1270     MSTRUCT_ANALYSE_EROSION* analyse_erosion_normalise = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1271     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1272     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))
1273     {
1274     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1275     MSTRUCT_ANALYSE_CHAMP* analyse_normalise = analyse_champ->normaliser(Identifiant,Largeur_colonne_distribution);
1276     analyse_erosion_normalise->ajouter_analyse(analyse_normalise);
1277     }
1278     ajouter_analyse(analyse_erosion_normalise);
1279     }
1280     }
1281     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART)
1282     {
1283     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1284     if(get_analyse(Identifiant_champ)==NULL)
1285     {
1286     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1287     return FAIL;
1288     }
1289     std::string Identifiant_champ_compare = param->get_nom((char*)"Identifiant_champ_compare");
1290     if(get_analyse(Identifiant_champ_compare)==NULL)
1291     {
1292     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1293     return FAIL;
1294     }
1295     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1296     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1297     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1298     {
1299     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1300     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1301     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1302     {
1303     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1304     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1305     ajouter_analyse(analyse_ecart);
1306     }
1307     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1308     {
1309     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1310     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1311     if(Num_couche>=0)
1312     {
1313     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1314     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1315     ajouter_analyse(analyse_ecart);
1316     }
1317     else
1318     {
1319     double epaisseur_couche = analyse_erosion_compare->get_epaisseur_couche();
1320     std::string Nom_groupe_forme = analyse_erosion_compare->get_nom_groupe_forme();
1321     BOITE_3D *boite_3d_analyse=analyse_erosion_compare->get_boite_analyse();
1322     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1323     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1324     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))
1325     {
1326     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,(MSTRUCT_ANALYSE_CHAMP*)analyse_champ_compare,Type_ecart);
1327     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1328     }
1329     ajouter_analyse(analyse_erosion_ecart);
1330     }
1331    
1332     }
1333     }
1334     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1335     {
1336     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1337     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1338     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1339     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1340     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1341     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1342     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))
1343     {
1344     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1345     MSTRUCT_ANALYSE* analyse_compare = get_analyse(Identifiant_champ_compare);
1346     if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1347     {
1348     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare = (MSTRUCT_ANALYSE_CHAMP*)analyse_compare;
1349     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1350     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1351     }
1352     else if(analyse_compare->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1353     {
1354     MSTRUCT_ANALYSE_EROSION* analyse_erosion_compare = (MSTRUCT_ANALYSE_EROSION*)analyse_compare;
1355     int Num_couche = (int)param->get_valeur((char*)"Num_couche");
1356     if(Num_couche>=0)
1357     {
1358     MSTRUCT_ANALYSE_CHAMP* analyse_champ_compare=(MSTRUCT_ANALYSE_CHAMP*)analyse_erosion_compare->get_analyse(Num_couche);
1359     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart(Identifiant,Largeur_colonne_distribution,analyse_champ_compare,Type_ecart);
1360     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1361     }
1362     else
1363     {
1364    
1365     }
1366    
1367     }
1368     }
1369     ajouter_analyse(analyse_erosion_ecart);
1370     }
1371     }
1372     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CHAMP_ECART_CHARGEMENT)
1373     {
1374     std::string Identifiant_champ = param->get_nom((char*)"Identifiant_champ");
1375     if(get_analyse(Identifiant_champ)==NULL)
1376     {
1377     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1378     return FAIL;
1379     }
1380     double Largeur_colonne_distribution = (double)param->get_valeur((char*)"Largeur_colonne_distribution");
1381     int Type_chargement = (int)param->get_valeur((char*)"Type_chargement");
1382     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1383     if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1384     {
1385     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ);
1386     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1387     ajouter_analyse(analyse_ecart);
1388     }
1389     else if(get_analyse(Identifiant_champ)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1390     {
1391     MSTRUCT_ANALYSE_EROSION* analyse_erosion_champ = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ);
1392     double epaisseur_couche = analyse_erosion_champ->get_epaisseur_couche();
1393     std::string Nom_groupe_forme = analyse_erosion_champ->get_nom_groupe_forme();
1394     BOITE_3D *boite_3d_analyse=analyse_erosion_champ->get_boite_analyse();
1395     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1396     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1397     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))
1398     {
1399     MSTRUCT_ANALYSE_CHAMP* analyse_champ = (MSTRUCT_ANALYSE_CHAMP*)analyse;
1400     MSTRUCT_ANALYSE_CHAMP* analyse_ecart = analyse_champ->calculer_ecart_chargement(Identifiant,Largeur_colonne_distribution,Type_chargement,Type_ecart);
1401     analyse_erosion_ecart->ajouter_analyse(analyse_ecart);
1402     }
1403     ajouter_analyse(analyse_erosion_ecart);
1404     }
1405     }
1406     else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_ORIENTATION_ECART)
1407     {
1408     std::string Identifiant_orientation = param->get_nom((char*)"Identifiant_orientation");
1409     if(get_analyse(Identifiant_orientation)==NULL)
1410     {
1411     std::cerr << "*** Analyse [" << Identifiant << "] inexistante ***" << std::endl;
1412     return FAIL;
1413     }
1414     int Type_ecart = (int)param->get_valeur((char*)"Type_ecart");
1415     double tenseur_compare[6];
1416     tenseur_compare[0] = (double)param->get_valeur((char*)"a_11");
1417     tenseur_compare[1] = (double)param->get_valeur((char*)"a_22");
1418     tenseur_compare[2] = (double)param->get_valeur((char*)"a_33");
1419     tenseur_compare[3] = (double)param->get_valeur((char*)"a_12");
1420     tenseur_compare[4] = (double)param->get_valeur((char*)"a_23");
1421     tenseur_compare[5] = (double)param->get_valeur((char*)"a_13");
1422     if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::ORIENTATION)
1423     {
1424     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)get_analyse(Identifiant_orientation);
1425     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1426     ajouter_analyse(analyse_compare);
1427     }
1428     else if(get_analyse(Identifiant_orientation)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1429     {
1430     MSTRUCT_ANALYSE_EROSION* analyse_erosion_orientation = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_orientation);
1431     double epaisseur_couche = analyse_erosion_orientation->get_epaisseur_couche();
1432     std::string Nom_groupe_forme = analyse_erosion_orientation->get_nom_groupe_forme();
1433     BOITE_3D *boite_3d_analyse=analyse_erosion_orientation->get_boite_analyse();
1434     MSTRUCT_ANALYSE_EROSION* analyse_erosion_ecart = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1435     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion;
1436     for(MSTRUCT_ANALYSE* analyse=analyse_erosion_orientation->get_premiere_analyse(it_analyse_erosion);analyse!=NULL;analyse=analyse_erosion_orientation->get_suivante_analyse(it_analyse_erosion))
1437     {
1438     MSTRUCT_ANALYSE_ORIENTATION* analyse_orientation = (MSTRUCT_ANALYSE_ORIENTATION*)analyse;
1439     MSTRUCT_ANALYSE_ORIENTATION* analyse_compare = analyse_orientation->calculer_ecart(Identifiant,tenseur_compare,Type_ecart);
1440     analyse_erosion_ecart->ajouter_analyse(analyse_compare);
1441     }
1442     ajouter_analyse(analyse_erosion_ecart);
1443     }
1444     }
1445 couturad 971 else if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1446     {
1447     std::string Identifiant_champ_temp = param->get_nom((char*)"Identifiant_champ_temp");
1448     std::string Identifiant_champ_flux = param->get_nom((char*)"Identifiant_champ_flux");
1449     if(get_analyse(Identifiant_champ_temp)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION && get_analyse(Identifiant_champ_flux)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1450     {
1451     MSTRUCT_ANALYSE_EROSION* erosion_TEMP = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ_temp);
1452     MSTRUCT_ANALYSE_EROSION* erosion_FLUX = (MSTRUCT_ANALYSE_EROSION*)get_analyse(Identifiant_champ_flux);
1453     double epaisseur_couche = erosion_TEMP->get_epaisseur_couche();
1454     std::string Nom_groupe_forme = erosion_TEMP->get_nom_groupe_forme();
1455     BOITE_3D *boite_3d_analyse=erosion_TEMP->get_boite_analyse();
1456     MSTRUCT_ANALYSE_EROSION* analyse_erosion_cond_ther = new MSTRUCT_ANALYSE_EROSION(Identifiant,epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1457     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion_temp;
1458     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_erosion_flux;
1459     MSTRUCT_ANALYSE* analyse_TEMP;
1460     MSTRUCT_ANALYSE* analyse_FLUX;
1461     for(analyse_TEMP=erosion_TEMP->get_premiere_analyse(it_analyse_erosion_temp),analyse_FLUX=erosion_FLUX->get_premiere_analyse(it_analyse_erosion_flux);
1462     analyse_TEMP!=NULL,analyse_FLUX!=NULL;
1463     analyse_TEMP=erosion_TEMP->get_suivante_analyse(it_analyse_erosion_temp),analyse_FLUX=erosion_FLUX->get_suivante_analyse(it_analyse_erosion_flux))
1464     {
1465     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_cond_ther = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,(MSTRUCT_ANALYSE_CHAMP*)analyse_TEMP,(MSTRUCT_ANALYSE_CHAMP*)analyse_FLUX);
1466     analyse_cond_ther->executer();
1467     analyse_erosion_cond_ther->ajouter_analyse(analyse_cond_ther);
1468     }
1469     ajouter_analyse(analyse_erosion_cond_ther);
1470     }
1471     else if(get_analyse(Identifiant_champ_temp)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP && get_analyse(Identifiant_champ_flux)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1472     {
1473     MSTRUCT_ANALYSE_CHAMP* analyse_champ_TEMP = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ_temp);
1474     MSTRUCT_ANALYSE_CHAMP* analyse_champ_FLUX = (MSTRUCT_ANALYSE_CHAMP*)get_analyse(Identifiant_champ_flux);
1475     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_cond_ther = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_champ_TEMP,analyse_champ_FLUX);
1476     analyse_cond_ther->executer();
1477     ajouter_analyse(analyse_cond_ther);
1478     }
1479     else
1480     {
1481     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1482     affiche(ligne);
1483     }
1484     }
1485 couturad 968 else
1486     {
1487     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1488     affiche(ligne);
1489     }
1490 couturad 919 }
1491 couturad 926 ot_cpu.ajouter_etape((char*)"analyse");
1492     double temps_analyse;
1493     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1494     change_temps_analyse(get_temps_analyse()+temps_analyse);
1495 couturad 919 }
1496    
1497 couturad 968 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1498     MSTRUCT_VES_FILE* ves_sph,
1499     MSTRUCT_VES_FILE* ves_dev)
1500 couturad 933 {
1501 couturad 968 OT_CPU ot_cpu;
1502     ot_cpu.initialise();
1503     std::vector<OT_PARAMETRES*>::iterator it;
1504     char ligne[1000];
1505     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1506     {
1507     OT_PARAMETRES* param = *it;
1508     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1509     std::string Identifiant = param->get_nom((char*)"Identifiant");
1510     if(get_analyse(Identifiant)!=NULL)
1511     {
1512     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1513     return FAIL;
1514     }
1515     sprintf(ligne,"-> %s",Identifiant.c_str());
1516     affiche(ligne);
1517     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_MODULES_ELASTICITE)
1518     {
1519     std::string Identifiant_epsilon = param->get_nom((char*)"Identifiant_epsilon");
1520     std::string Identifiant_sigma = param->get_nom((char*)"Identifiant_sigma");
1521     if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::CHAMP)
1522     {
1523     MSTRUCT_ANALYSE_CHAMP* epsilon_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_epsilon);
1524     MSTRUCT_ANALYSE_CHAMP* sigma_sph = (MSTRUCT_ANALYSE_CHAMP*)ves_sph->get_analyse(Identifiant_sigma);
1525     MSTRUCT_ANALYSE_CHAMP* epsilon_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_epsilon);
1526     MSTRUCT_ANALYSE_CHAMP* sigma_dev = (MSTRUCT_ANALYSE_CHAMP*)ves_dev->get_analyse(Identifiant_sigma);
1527     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,epsilon_sph,sigma_sph,epsilon_dev,sigma_dev);
1528     analyse_modules_elasticite->executer();
1529     ajouter_analyse(analyse_modules_elasticite);
1530     }
1531     else if(ves_sph->get_analyse(Identifiant_epsilon)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1532     {
1533     MSTRUCT_ANALYSE_EROSION* epsilon_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_epsilon);
1534     MSTRUCT_ANALYSE_EROSION* sigma_sph_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_sph->get_analyse(Identifiant_sigma);
1535     MSTRUCT_ANALYSE_EROSION* epsilon_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_epsilon);
1536     MSTRUCT_ANALYSE_EROSION* sigma_dev_erosion = (MSTRUCT_ANALYSE_EROSION*)ves_dev->get_analyse(Identifiant_sigma);
1537     long Nb_couche = epsilon_sph_erosion->get_nb_analyse();
1538     double Epaisseur_couche = epsilon_sph_erosion->get_epaisseur_couche();
1539     std::string Nom_groupe_forme = epsilon_sph_erosion->get_nom_groupe_forme();
1540     BOITE_3D *boite_3d_analyse=epsilon_sph_erosion->get_boite_analyse();
1541     MSTRUCT_ANALYSE_EROSION* analyse_modules_elasticite_erosion = new MSTRUCT_ANALYSE_EROSION(Identifiant,Epaisseur_couche,Nom_groupe_forme,boite_3d_analyse);
1542     for(int i=0;i<Nb_couche;i++)
1543     {
1544     MSTRUCT_ANALYSE_MODULES_ELASTICITE* analyse_modules_elasticite = new MSTRUCT_ANALYSE_MODULES_ELASTICITE(Identifiant,
1545     (MSTRUCT_ANALYSE_CHAMP*)epsilon_sph_erosion->get_analyse(i),
1546     (MSTRUCT_ANALYSE_CHAMP*)sigma_sph_erosion->get_analyse(i),
1547     (MSTRUCT_ANALYSE_CHAMP*)epsilon_dev_erosion->get_analyse(i),
1548     (MSTRUCT_ANALYSE_CHAMP*)sigma_dev_erosion->get_analyse(i));
1549     analyse_modules_elasticite->executer();
1550     analyse_modules_elasticite_erosion->ajouter_analyse(analyse_modules_elasticite);
1551     }
1552     ajouter_analyse(analyse_modules_elasticite_erosion);
1553     }
1554     }
1555     else
1556     {
1557     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1558     affiche(ligne);
1559     }
1560     }
1561     ot_cpu.ajouter_etape((char*)"analyse");
1562     double temps_analyse;
1563     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1564     change_temps_analyse(get_temps_analyse()+temps_analyse);
1565     }
1566    
1567 couturad 971 int MSTRUCT_VES::generer_post_traitement(std::vector<OT_PARAMETRES *>& vector_params_post_traitement,
1568     MSTRUCT_VES_FILE* ves_lambda_x,
1569     MSTRUCT_VES_FILE* ves_lambda_y,
1570     MSTRUCT_VES_FILE* ves_lambda_z)
1571     {
1572     OT_CPU ot_cpu;
1573     ot_cpu.initialise();
1574     std::vector<OT_PARAMETRES*>::iterator it;
1575     char ligne[1000];
1576     for(it=vector_params_post_traitement.begin();it!=vector_params_post_traitement.end();it++)
1577     {
1578     OT_PARAMETRES* param = *it;
1579     int Type_post_traitement = (int)param->get_valeur((char*)"Type_post_traitement");
1580     std::string Identifiant = param->get_nom((char*)"Identifiant");
1581     if(get_analyse(Identifiant)!=NULL)
1582     {
1583     std::cerr << "*** Analyse [" << Identifiant << "] existante ***" << std::endl;
1584     return FAIL;
1585     }
1586     sprintf(ligne,"-> %s",Identifiant.c_str());
1587     affiche(ligne);
1588     if(Type_post_traitement==MSTRUCT::TYPE_POST_TRAITEMENT::POST_CONDUCTIVITE_THERMIQUE)
1589     {
1590     std::string Identifiant = param->get_nom((char*)"Identifiant");
1591     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1592     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION &&
1593     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::EROSION)
1594     {
1595     MSTRUCT_ANALYSE_EROSION* erosion_lambda_x = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_x->get_analyse(Identifiant);
1596     MSTRUCT_ANALYSE_EROSION* erosion_lambda_y = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_y->get_analyse(Identifiant);
1597     MSTRUCT_ANALYSE_EROSION* erosion_lambda_z = (MSTRUCT_ANALYSE_EROSION*)ves_lambda_z->get_analyse(Identifiant);
1598     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_x;
1599     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_y;
1600     std::vector<MSTRUCT_ANALYSE*>::iterator it_analyse_z;
1601     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_premiere_analyse(it_analyse_x);
1602     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_premiere_analyse(it_analyse_y);
1603     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_premiere_analyse(it_analyse_z);
1604     MSTRUCT_ANALYSE_EROSION* erosion_lambda_app = new MSTRUCT_ANALYSE_EROSION(Identifiant,
1605     erosion_lambda_x->get_epaisseur_couche(),
1606     erosion_lambda_x->get_nom_groupe_forme(),
1607     erosion_lambda_x->get_boite_analyse());
1608     while(analyse_lambda_x!=NULL && analyse_lambda_y!=NULL && analyse_lambda_z!=NULL)
1609     {
1610     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1611     analyse_lambda_app->executer();
1612     erosion_lambda_app->ajouter_analyse(analyse_lambda_app);
1613     analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_x->get_suivante_analyse(it_analyse_x);
1614     analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_y->get_suivante_analyse(it_analyse_y);
1615     analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)erosion_lambda_z->get_suivante_analyse(it_analyse_z);
1616     }
1617     ajouter_analyse(erosion_lambda_app);
1618     }
1619     if(ves_lambda_x->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1620     ves_lambda_y->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE &&
1621     ves_lambda_z->get_analyse(Identifiant)->get_type()==MSTRUCT::TYPE_ANALYSE::CONDUCTIVITE_THERMIQUE)
1622     {
1623     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_x=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_x->get_analyse(Identifiant);
1624     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_y=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_y->get_analyse(Identifiant);
1625     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_z=(MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE*)ves_lambda_z->get_analyse(Identifiant);
1626     MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE* analyse_lambda_app = new MSTRUCT_ANALYSE_CONDUCTIVITE_THERMIQUE(Identifiant,analyse_lambda_x,analyse_lambda_y,analyse_lambda_z);
1627     analyse_lambda_app->executer();
1628     ajouter_analyse(analyse_lambda_app);
1629     }
1630     }
1631     else
1632     {
1633     sprintf(ligne,"ERREUR -> %s",Identifiant.c_str());
1634     affiche(ligne);
1635     }
1636     }
1637     ot_cpu.ajouter_etape((char*)"analyse");
1638     double temps_analyse;
1639     ot_cpu.get_etape((char*)"analyse",temps_analyse);
1640     change_temps_analyse(get_temps_analyse()+temps_analyse);
1641     }
1642 couturad 968
1643    
1644 couturad 971
1645    
1646 couturad 968 int MSTRUCT_VES::exporter_maillage_abaqus(char* dossier)
1647     {
1648 couturad 933 std::ofstream f;
1649 couturad 968 char file[1000];
1650     sprintf(file,"%s/noeuds",dossier);
1651     f.open(file,std::ios::out);
1652 couturad 933 f.precision(16);
1653     f.setf(std::ios::showpoint);
1654     f << "*NODE"<< std::endl;
1655     LISTE_FEM_NOEUD::iterator it;
1656     long index=1;
1657     for (FEM_NOEUD* noeud=m_fem_maillage->get_premier_noeud(it);noeud;noeud=m_fem_maillage->get_suivant_noeud(it))
1658     {
1659     noeud->change_numero(index);
1660     double *coord=noeud->get_coord();
1661     f << noeud->get_numero() << ", " << coord[0] << ", " << coord[1] << ", " << coord[2] << std::endl;
1662     index++;
1663     }
1664     f.close();
1665 couturad 968 sprintf(file,"%s/elements",dossier);
1666     f.open(file,std::ios::out);
1667 couturad 933 f.precision(16);
1668     f.setf(std::ios::showpoint);
1669     index=1;
1670     LISTE_FEM_ELEMENT3::iterator ittele3;
1671     bool tetralin=false;
1672     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1673     {
1674     if(ele3->get_type_entite()==IDFEM_TETRA4)
1675     {
1676     if(tetralin==false)
1677     {
1678     tetralin=true;
1679     f << "*ELEMENT,TYPE=C3D4,ELSET=tetralin"<< std::endl;
1680     }
1681     f << index << ", "
1682     << ele3->get_fem_noeud(0)->get_numero() << ", "
1683     << ele3->get_fem_noeud(1)->get_numero() << ", "
1684     << ele3->get_fem_noeud(2)->get_numero() << ", "
1685     << ele3->get_fem_noeud(3)->get_numero() << std::endl;
1686     ele3->change_numero(index);
1687     index++;
1688     }
1689     }
1690     bool pentalin=false;
1691     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1692     {
1693     if(ele3->get_type_entite()==IDFEM_PENTA6)
1694     {
1695     if(pentalin==false)
1696     {
1697     pentalin=true;
1698     f << "*ELEMENT,TYPE=C3D6,ELSET=pentalin"<< std::endl;
1699     }
1700     f << index << ", "
1701     << ele3->get_fem_noeud(0)->get_numero() << ", "
1702     << ele3->get_fem_noeud(1)->get_numero() << ", "
1703     << ele3->get_fem_noeud(2)->get_numero() << ", "
1704     << ele3->get_fem_noeud(3)->get_numero() << ", "
1705     << ele3->get_fem_noeud(4)->get_numero() << ", "
1706     << ele3->get_fem_noeud(5)->get_numero() << std::endl;
1707     ele3->change_numero(index);
1708     index++;
1709     }
1710     }
1711     bool tetraquad=false;
1712     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1713     {
1714     if(ele3->get_type_entite()==IDFEM_TETRA10)
1715     {
1716     if(tetraquad==false)
1717     {
1718     tetraquad=true;
1719     f << "*ELEMENT,TYPE=C3D10,ELSET=tetraquad"<< std::endl;
1720     }
1721     f << index << ", "
1722     << ele3->get_fem_noeud(0)->get_numero() << ", "
1723     << ele3->get_fem_noeud(2)->get_numero() << ", "
1724     << ele3->get_fem_noeud(4)->get_numero() << ", "
1725     << ele3->get_fem_noeud(9)->get_numero() << ", "
1726     << ele3->get_fem_noeud(1)->get_numero() << ", "
1727     << ele3->get_fem_noeud(3)->get_numero() << ", "
1728     << ele3->get_fem_noeud(5)->get_numero() << ", "
1729     << ele3->get_fem_noeud(6)->get_numero() << ", "
1730     << ele3->get_fem_noeud(7)->get_numero() << ", "
1731     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1732     ele3->change_numero(index);
1733     index++;
1734     }
1735     }
1736     bool pentaquad=false;
1737     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1738     for (FEM_ELEMENT3* ele3=m_fem_maillage->get_premier_element3(ittele3);ele3;ele3=m_fem_maillage->get_suivant_element3(ittele3))
1739     {
1740     if(ele3->get_type_entite()==IDFEM_PENTA15)
1741     {
1742     if(pentaquad==false)
1743     {
1744     pentaquad=true;
1745     f << "*ELEMENT,TYPE=C3D15,ELSET=pentaquad"<< std::endl;
1746     }
1747     f << index << ", "
1748     << ele3->get_fem_noeud(0)->get_numero() << ", "
1749     << ele3->get_fem_noeud(2)->get_numero() << ", "
1750     << ele3->get_fem_noeud(4)->get_numero() << ", "
1751     << ele3->get_fem_noeud(9)->get_numero() << ", "
1752     << ele3->get_fem_noeud(11)->get_numero() << ", "
1753     << ele3->get_fem_noeud(13)->get_numero() << ", "
1754     << ele3->get_fem_noeud(1)->get_numero() << ", "
1755     << ele3->get_fem_noeud(3)->get_numero() << ", "
1756     << ele3->get_fem_noeud(5)->get_numero() << ", "
1757     << ele3->get_fem_noeud(10)->get_numero() << ", "
1758     << ele3->get_fem_noeud(12)->get_numero() << ", "
1759     << ele3->get_fem_noeud(14)->get_numero() << ", "
1760     << ele3->get_fem_noeud(6)->get_numero() << ", "
1761     << ele3->get_fem_noeud(7)->get_numero() << ", "
1762     << ele3->get_fem_noeud(8)->get_numero() << std::endl;
1763     ele3->change_numero(index);
1764     index++;
1765     }
1766     }
1767     f.close();
1768 couturad 968 sprintf(file,"%s/BC_nsets",dossier);
1769     f.open(file,std::ios::out);
1770 couturad 933 f.precision(16);
1771     f.setf(std::ios::showpoint);
1772     BOITE_3D boite3D_ves = get_boite3d_ves();
1773     double eps = get_precision();
1774     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0;
1775     TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1;
1776     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0;
1777     TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1;
1778     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0;
1779     TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1;
1780     std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face;
1781     for(MG_FACE *face = m_mg_geometrie->get_premier_face(it_face);face!=NULL;face=m_mg_geometrie->get_suivant_face(it_face))
1782     {
1783     double xyzmin[3];
1784     double xyzmax[3];
1785     face->get_xyz_min_max(xyzmin,xyzmax,16);
1786    
1787     if(OPERATEUR::egal(xyzmin[0],boite3D_ves.get_xmin(),eps) && OPERATEUR::egal(xyzmax[0],boite3D_ves.get_xmin(),eps)) plan_yz_x0.ajouter(face);
1788     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);
1789     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);
1790     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);
1791     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);
1792     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);
1793     }
1794     MG_SOMMET* sommet_x0y0z0=NULL;
1795     MG_SOMMET* sommet_x1y0z0=NULL;
1796     MG_SOMMET* sommet_x0y1z0=NULL;
1797     MG_SOMMET* sommet_x1y1z0=NULL;
1798     MG_SOMMET* sommet_x0y0z1=NULL;
1799     MG_SOMMET* sommet_x1y0z1=NULL;
1800     MG_SOMMET* sommet_x0y1z1=NULL;
1801     MG_SOMMET* sommet_x1y1z1=NULL;
1802     std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet;
1803     for(MG_SOMMET* som=m_mg_geometrie->get_premier_sommet(it_sommet);som!=NULL;som=m_mg_geometrie->get_suivant_sommet(it_sommet))
1804     {
1805     double xyz[3];
1806     som->get_point()->evaluer(xyz);
1807     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;
1808     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;
1809     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;
1810     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;
1811     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;
1812     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;
1813     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;
1814     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;
1815     }
1816     f << "*NSET,NSET=coin_x0y0z0" << std::endl;
1817     FEM_NOEUD* coin_x0y0z0 = (FEM_NOEUD*)(sommet_x0y0z0->get_lien_fem_maillage()->get(0));
1818     f << coin_x0y0z0->get_numero() << std::endl;
1819     f << "*NSET,NSET=coin_x1y0z0" << std::endl;
1820     FEM_NOEUD* coin_x1y0z0 = (FEM_NOEUD*)(sommet_x1y0z0->get_lien_fem_maillage()->get(0));
1821     f << coin_x1y0z0->get_numero() << std::endl;
1822     f << "*NSET,NSET=coin_x0y1z0" << std::endl;
1823     FEM_NOEUD* coin_x0y1z0 = (FEM_NOEUD*)(sommet_x0y1z0->get_lien_fem_maillage()->get(0));
1824     f << coin_x0y1z0->get_numero() << std::endl;
1825     f << "*NSET,NSET=coin_x1y1z0" << std::endl;
1826     FEM_NOEUD* coin_x1y1z0 = (FEM_NOEUD*)(sommet_x1y1z0->get_lien_fem_maillage()->get(0));
1827     f << coin_x1y1z0->get_numero() << std::endl;
1828     f << "*NSET,NSET=coin_x0y0z1" << std::endl;
1829     FEM_NOEUD* coin_x0y0z1 = (FEM_NOEUD*)(sommet_x0y0z1->get_lien_fem_maillage()->get(0));
1830     f << coin_x0y0z1->get_numero() << std::endl;
1831     f << "*NSET,NSET=coin_x1y0z1" << std::endl;
1832     FEM_NOEUD* coin_x1y0z1 = (FEM_NOEUD*)(sommet_x1y0z1->get_lien_fem_maillage()->get(0));
1833     f << coin_x1y0z1->get_numero() << std::endl;
1834     f << "*NSET,NSET=coin_x0y1z1" << std::endl;
1835     FEM_NOEUD* coin_x0y1z1 = (FEM_NOEUD*)(sommet_x0y1z1->get_lien_fem_maillage()->get(0));
1836     f << coin_x0y1z1->get_numero() << std::endl;
1837     f << "*NSET,NSET=coin_x1y1z1" << std::endl;
1838     FEM_NOEUD* coin_x1y1z1 = (FEM_NOEUD*)(sommet_x1y1z1->get_lien_fem_maillage()->get(0));
1839     f << coin_x1y1z1->get_numero() << std::endl;
1840     TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan;
1841     f << "*NSET,NSET=xEQ0" << std::endl;
1842     for(MG_FACE* face=plan_yz_x0.get_premier(it_face_plan);face!=NULL;face=plan_yz_x0.get_suivant(it_face_plan))
1843     {
1844     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1845     long nb_ele=lst_ele->get_nb();
1846     for(long i=0;i<nb_ele;i++)
1847     {
1848     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1849     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1850     {
1851     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1852     }
1853     }
1854     }
1855     f << "*NSET,NSET=xEQ1" << std::endl;
1856     for(MG_FACE* face=plan_yz_x1.get_premier(it_face_plan);face!=NULL;face=plan_yz_x1.get_suivant(it_face_plan))
1857     {
1858     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1859     long nb_ele=lst_ele->get_nb();
1860     for(long i=0;i<nb_ele;i++)
1861     {
1862     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1863     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1864     {
1865     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1866     }
1867     }
1868     }
1869     f << "*NSET,NSET=yEQ0" << std::endl;
1870     for(MG_FACE* face=plan_xz_y0.get_premier(it_face_plan);face!=NULL;face=plan_xz_y0.get_suivant(it_face_plan))
1871     {
1872     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1873     long nb_ele=lst_ele->get_nb();
1874     for(long i=0;i<nb_ele;i++)
1875     {
1876     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1877     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1878     {
1879     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1880     }
1881     }
1882     }
1883     f << "*NSET,NSET=yEQ1" << std::endl;
1884     for(MG_FACE* face=plan_xz_y1.get_premier(it_face_plan);face!=NULL;face=plan_xz_y1.get_suivant(it_face_plan))
1885     {
1886     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1887     long nb_ele=lst_ele->get_nb();
1888     for(long i=0;i<nb_ele;i++)
1889     {
1890     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1891     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1892     {
1893     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1894     }
1895     }
1896     }
1897     f << "*NSET,NSET=zEQ0" << std::endl;
1898     for(MG_FACE* face=plan_xy_z0.get_premier(it_face_plan);face!=NULL;face=plan_xy_z0.get_suivant(it_face_plan))
1899     {
1900     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1901     long nb_ele=lst_ele->get_nb();
1902     for(long i=0;i<nb_ele;i++)
1903     {
1904     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1905     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1906     {
1907     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1908     }
1909     }
1910     }
1911     f << "*NSET,NSET=zEQ1" << std::endl;
1912     for(MG_FACE* face=plan_xy_z1.get_premier(it_face_plan);face!=NULL;face=plan_xy_z1.get_suivant(it_face_plan))
1913     {
1914     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=face->get_lien_fem_maillage();
1915     long nb_ele=lst_ele->get_nb();
1916     for(long i=0;i<nb_ele;i++)
1917     {
1918     FEM_ELEMENT2* ele2 = (FEM_ELEMENT2*)lst_ele->get(i);
1919     for(int j=0;j<ele2->get_nb_fem_noeud();j++)
1920     {
1921     f << ele2->get_fem_noeud(j)->get_numero() << std::endl;
1922     }
1923     }
1924     }
1925     f.close();
1926 couturad 968 sprintf(file,"%s/groupes_elements",dossier);
1927     f.open(file,std::ios::out);
1928 couturad 933 f.precision(16);
1929     f.setf(std::ios::showpoint);
1930     std::map<long,MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
1931     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))
1932     {
1933     f << "*ELSET,ELSET=" << groupe_forme->get_nom() << std::endl;
1934     TPL_MAP_ENTITE<MG_VOLUME*> tpl_map_volume = groupe_forme->get_tpl_map_volume();
1935     TPL_MAP_ENTITE<MG_VOLUME*>::ITERATEUR it_volume;
1936     for(MG_VOLUME* volume=tpl_map_volume.get_premier(it_volume);volume!=NULL;volume=tpl_map_volume.get_suivant(it_volume))
1937     {
1938     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1939     long nb_ele=lst_ele->get_nb();
1940     for(long i=0;i<nb_ele;i++)
1941     {
1942     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1943     f << ele3->get_numero() << std::endl;
1944     }
1945     }
1946     }
1947 couturad 937
1948 couturad 968 MG_CG_GROUPE_FORME* groupe_forme_particule=m_mgcg_modele->get_mgcg_groupe_forme((char*)"Particule");
1949 couturad 937 if(groupe_forme_particule!=NULL)
1950     {
1951 couturad 968 sprintf(file,"%s/particules",dossier);
1952     f.open(file,std::ios::out);
1953 couturad 937 f.precision(16);
1954     f.setf(std::ios::showpoint);
1955     std::ofstream f2;
1956     f2.open((char*)"infos_particules");
1957     f2.precision(16);
1958     f2.setf(std::ios::showpoint);
1959     f2 << "# centre_x centre_y centre_z rayon position_relative" << std::endl;
1960     std::ofstream f_bord;
1961     f_bord.open((char*)"particules_bord");
1962     f_bord.precision(16);
1963     f_bord.setf(std::ios::showpoint);
1964     std::ofstream f_interieur;
1965     f_interieur.open((char*)"particules_interieur");
1966     f_interieur.precision(16);
1967     f_interieur.setf(std::ios::showpoint);
1968     long p=1;
1969     std::map<long,MG_CG_FORME*>::iterator it_forme;
1970     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))
1971     {
1972     if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::VOLUME)
1973     {
1974     f << "*ELSET,ELSET=P_" << p << std::endl;
1975     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
1976     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
1977     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
1978     std::vector<double> vct_centre = centre->get_vct_valeur();
1979     f2 << p << " "
1980     << vct_centre.at(0) << " "
1981     << vct_centre.at(1) << " "
1982     << vct_centre.at(2) << " "
1983     << rayon->get_valeur() << " "
1984     << pos_rel->get_valeur() << std::endl;
1985     bool au_bord;
1986     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
1987     else au_bord=false;
1988     MG_CG_FORME_VOLUME* forme_volume = (MG_CG_FORME_VOLUME*)forme;
1989     MG_VOLUME* volume = forme_volume->get_mg_volume();
1990     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
1991     long nb_ele=lst_ele->get_nb();
1992     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
1993     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
1994     for(long i=0;i<nb_ele;i++)
1995     {
1996     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
1997     f << ele3->get_numero() << std::endl;
1998     if(au_bord)f_bord << ele3->get_numero() << std::endl;
1999     else f_interieur << ele3->get_numero() << std::endl;
2000     }
2001     p++;
2002     }
2003     else if(forme->get_type_forme()==MG_CG_FORME::TYPE_FORME::MULTI_VOLUME)
2004     {
2005     f << "*ELSET,ELSET=P_" << p << std::endl;
2006     MG_CG_INFO_VCT_DOUBLE* centre = (MG_CG_INFO_VCT_DOUBLE*)forme->get_mgcg_info((char*)"CENTRE");
2007     MG_CG_INFO_DOUBLE* rayon = (MG_CG_INFO_DOUBLE*)forme->get_mgcg_info((char*)"RAYON");
2008     MG_CG_INFO_STRING* pos_rel = (MG_CG_INFO_STRING*)forme->get_mgcg_info((char*)"POSITION_RELATIVE");
2009     std::vector<double> vct_centre = centre->get_vct_valeur();
2010     f2 << p << " "
2011     << vct_centre.at(0) << " "
2012     << vct_centre.at(1) << " "
2013     << vct_centre.at(2) << " "
2014     << rayon->get_valeur() << " "
2015     << pos_rel->get_valeur() << std::endl;
2016     bool au_bord;
2017     if(pos_rel->get_valeur()=="AU_BORD") au_bord=true;
2018     else au_bord=false;
2019     MG_CG_FORME_MULTI_VOLUME* forme_multi_volume = (MG_CG_FORME_MULTI_VOLUME*)forme;
2020     std::map<long,MG_VOLUME*>::iterator it_volume;
2021     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))
2022     {
2023     TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> *lst_ele=volume->get_lien_fem_maillage();
2024     long nb_ele=lst_ele->get_nb();
2025     if(au_bord) f_bord << "*ELSET,ELSET=P_" << p << std::endl;
2026     else f_interieur << "*ELSET,ELSET=P_" << p << std::endl;
2027     for(long i=0;i<nb_ele;i++)
2028     {
2029     FEM_ELEMENT3* ele3 = (FEM_ELEMENT3*)lst_ele->get(i);
2030     f << ele3->get_numero() << std::endl;
2031     if(au_bord)f_bord << ele3->get_numero() << std::endl;
2032     else f_interieur << ele3->get_numero() << std::endl;
2033     }
2034     }
2035     p++;
2036     }
2037     }
2038     f_bord.close();
2039     f_interieur.close();
2040     f2.close();
2041     f.close();
2042     }
2043 couturad 933 }
2044 couturad 926
2045 couturad 933
2046 couturad 926 int MSTRUCT_VES::enregistrer(char* fichier_ves)
2047 couturad 919 {
2048 couturad 926 m_ves_file->enregistrer(fichier_ves);
2049 couturad 919 }
2050    
2051 couturad 926 int MSTRUCT_VES::enregistrer(char *fichier_ves,char* fichier_magic)
2052 couturad 919 {
2053 couturad 926 m_ves_file->change_nom_fichier_magic(fichier_magic);
2054     m_ves_file->enregistrer(fichier_ves);
2055     m_mg_gestionnaire->enregistrer(fichier_magic);
2056 couturad 919 }
2057    
2058 couturad 951 void MSTRUCT_VES::active_affichage(fonction_affiche* fonc)
2059 couturad 919 {
2060     fonc_affiche = fonc;
2061     affichageactif = 1;
2062     }
2063    
2064 couturad 926 void MSTRUCT_VES::affiche(char* message)
2065 couturad 919 {
2066     if(affichageactif==1) fonc_affiche(message);
2067     }
2068    
2069    
2070    
2071    
2072