ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_ves.cpp
Revision: 1158
Committed: Thu Jun 13 22:18:49 2024 UTC (11 months, 1 week ago) by francois
File size: 119616 byte(s)
Log Message:
compatibilité Ubuntu 22.04
Suppression des refeences à Windows
Ajout d'une banière

File Contents

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