MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
mstruct_generateur_polycristaux.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
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_generateur_polycristaux.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2025
19 //####// Derniere modification par francois
20 //####// mer 14 mai 2025 17:54:57 EDT
21 //####//------------------------------------------------------------
22 //####//------------------------------------------------------------
23  #include "gestionversion.h"
24  #include "mg_file.h"
26  #include "tpl_grille.h"
27  #ifdef PROJECT_POLYCRISTAUX
28  #include "polycristal.h"
29  #endif
30  #include "occ_import.h"
32  #include "mailleur0d.h"
33  #include "mailleur1d.h"
34  #include "mailleur2d.h"
35  #include "mailleur3d.h"
36  #include "mailleur_fem.h"
37  #include "mailleur_analyse.h"
38  #include "mg_export.h"
39  #include "mstruct_outils.h"
40  #include "mstruct_definition.h"
41  #include "mgaster.h"
42  #include "lc_point.h"
43  #include "mailleur_analyse.h"
44  #include <fstream>
45  #include <math.h>
46  #include <random>
47  #include "mstruct_borne.h"
48 #include <sys/stat.h>
49 #include <mutex>
50 
51 
53 {
54 nbcristaux=-1;
55 degre=-1;
56 dg=-1;
57 KDH=-1.;
58 GDH=-1.;
59 EDH=-1.;
60 KCH=-1.;
61 GCH=-1.;
62 ECH=-1.;
63 nbphase=0;
64 }
65 
66 MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT(MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT& mdd):nbcristaux(mdd.nbcristaux),degre(mdd.degre),dg(mdd.dg),KDH(mdd.KDH),GDH(mdd.GDH),EDH(mdd.EDH),KCH(mdd.KCH),GCH(mdd.GCH),ECH(mdd.ECH),nbphase(mdd.nbphase),nbcristauxphase(mdd.nbcristauxphase),masse(mdd.masse),volume(mdd.volume),cdm(mdd.cdm)
67 {
68 memcpy(tens1,mdd.tens1,sizeof(double)*9);
69 memcpy(tens2,mdd.tens2,sizeof(double)*9);
70 memcpy(tens3,mdd.tens3,sizeof(double)*9);
71 
72 }
73 
75 {
76 }
77 
78 
80 {
81 Evoigt=-1;
82 Ereuss=-1;
83 Kvoigt=-1;
84 Kreuss=-1;
85 Gvoigt=-1;
86 Greuss=-1;
87 nuvoigt=-1;
88 nureuss=-1;
89 }
90 
91 MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE(MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE& mdd):Evoigt(mdd.Evoigt),Ereuss(mdd.Ereuss),Kvoigt(mdd.Kvoigt),Kreuss(mdd.Kreuss),Gvoigt(mdd.Gvoigt),Greuss(mdd.Greuss),nuvoigt(mdd.nuvoigt),nureuss(mdd.nureuss)
92 {
93 }
94 
96 {
97 }
98 
99 
100 
102  {
103  ini_param(NULL);
104  }
105 
106 
108  {
109  ini_param(nomparam);
110  }
111 
113  {
114  MG_FILE gest(fichierin);
115  MG_GEOMETRIE *mggeo=gest.get_mg_geometrie(0);
116  FILE *out=fopen(fichierout,"wt");
117  LISTE_MG_POINT::iterator it;
118  for (MG_POINT* pt=mggeo->get_premier_point(it);pt!=NULL;pt=mggeo->get_suivant_point(it))
119  if (pt->get_type()==MG_ELEMENT_GEOMETRIQUE::TYPE_ELEMENT_GEOMETRIQUE::LC_POINT)
120  {
121  double xyz[3];
122  pt->evaluer(xyz);
123  fprintf(out,"%e %e %e\n",xyz[0],xyz[1],xyz[2]);
124  }
125  fclose(out);
126  }
127 
128 
130  {
131 
132  }
133 
135  {
136 
137  }
138 
140  {
141  affiche2=fonc;
142  affichageactif=1;
143  }
144 
146  {
147  if (affichageactif==1) affiche2(mess);
148  }
149 
151  {
152  param.ajouter("nommateriau","Cuivre",OT_PARAMETRES::STRING,"nom du matériaux");
153  //param.ajouter("bornereuss",109e9,OT_PARAMETRES::DOUBLE,"Valeur de la borne de Reuss en Pa");
154  //param.ajouter("bornevoigt",143e9,OT_PARAMETRES::DOUBLE,"Valeur de la borne de Voigt en Pa");
155  param.ajouter("boitexmin",0,OT_PARAMETRES::DOUBLE,"valeur x min de l'échantillon");
156  param.ajouter("boiteymin",0,OT_PARAMETRES::DOUBLE,"valeur y min de l'échantillon");
157  param.ajouter("boitezmin",0,OT_PARAMETRES::DOUBLE,"valeur z min de l'échantillon");
158  param.ajouter("boitexmax",1,OT_PARAMETRES::DOUBLE,"valeur x max de l'échantillon");
159  param.ajouter("boiteymax",1,OT_PARAMETRES::DOUBLE,"valeur y max de l'échantillon");
160  param.ajouter("boitezmax",1,OT_PARAMETRES::DOUBLE,"valeur z max de l'échantillon");
161  param.ajouter("nb_cristaux",100,OT_PARAMETRES::DOUBLE,"Nombre de cristaux à tirer aléatoirement");
162  param.ajouter("rayon",0.05,OT_PARAMETRES::DOUBLE,"Distance séparant deux points tirés aléatoirement en % de la longueur totale");
163  param.ajouter("nomfichier","nomcao",OT_PARAMETRES::STRING,"Nom du fichier de l'étude sans extension");
164  param.ajouter("enregistrementstep",0.,OT_PARAMETRES::DOUBLE,"0. pas de fichier step 1. avec fichier step");
165  param.ajouter("epsfusion",1e-6,OT_PARAMETRES::DOUBLE,"epsilon de la fusion des noeuds des Voronoi");
166  param.ajouter("dg",0.1,OT_PARAMETRES::DOUBLE,"ecart nodale pour la carte de taille");
167  param.ajouter("gradient",0.25,OT_PARAMETRES::DOUBLE,"gradient max visé pour la carte de taille");
168  param.ajouter("bornemin_carte",0.1,OT_PARAMETRES::DOUBLE,"Borne minimal de l'écart nodal");
169  param.ajouter("type_bornemin",1,OT_PARAMETRES::DOUBLE,"0. borne min absolue 1. borne min relative");
170  param.ajouter("Nbphase",2.0,OT_PARAMETRES::DOUBLE,"Nombre de phase du polycristal");
171  std::vector<double> lstphase;
172  lstphase.push_back(0.68);
173  lstphase.push_back(0.32);
174  param.ajouter("Proportionphase",lstphase,OT_PARAMETRES::DOUBLE,"Proportion de chacune des phases en masse");
175  std::vector<double> lstdens;
176  lstdens.push_back(5.);
177  lstdens.push_back(12.);
178  param.ajouter("Densite",lstdens,OT_PARAMETRES::DOUBLE,"Densité de chacune des phases");
179  std::vector<double> lst1,lst2,lst3;
180  lst1.push_back(66.69e9);
181  lst1.push_back(120.1e9);
182  lst2.push_back(0.4189);
183  lst2.push_back(0.3);
184  lst3.push_back(75.4e9);
185  lst3.push_back(85.2e9);
186 
187  param.ajouter("E1",lst1,OT_PARAMETRES::DOUBLE,"Module d'Young dans la direction 1 du polycristal");
188  param.ajouter("E2",lst1,OT_PARAMETRES::DOUBLE,"Module d'Young dans la direction 2 du polycristal");
189  param.ajouter("E3",lst1,OT_PARAMETRES::DOUBLE,"Module d'Young dans la direction 3 du polycristal");
190  param.ajouter("n1",lst2,OT_PARAMETRES::DOUBLE,"Coefficent de Poisson dans le plan 12 du polycristal");
191  param.ajouter("n2",lst2,OT_PARAMETRES::DOUBLE,"Coefficent de Poisson dans le plan 23 du polycristal");
192  param.ajouter("n3",lst2,OT_PARAMETRES::DOUBLE,"Coefficent de Poisson dans le plan 13 du polycristal");
193  param.ajouter("G1",lst3,OT_PARAMETRES::DOUBLE,"Module de Cisaillement dans le plan 12 du polycristal");
194  param.ajouter("G2",lst3,OT_PARAMETRES::DOUBLE,"Module de Cisaillement dans le plan 23 du polycristal");
195  param.ajouter("G3",lst3,OT_PARAMETRES::DOUBLE,"Module de Cisaillement dans le plan 13 du polycristal");
196  param.ajouter("Degre",1,OT_PARAMETRES::DOUBLE,"1 maillage lineaire 2 maillage quadratique");
197  param.ajouter("fichiercumul","cumul",OT_PARAMETRES::STRING,"Nom du fichier sans extension du cumul des resultats");
198  param.ajouter("enregistrerres","1.0",OT_PARAMETRES::DOUBLE,"0. pas d'enregistrement des résultats et statistiques 1. enregistrement");
199  param.ajouter("paramaster","param_aster.txt",OT_PARAMETRES::STRING,"Nom du fichier des parametres aster");
200  param.ajouter("reprise_geo",0.,OT_PARAMETRES::DOUBLE,"0. nouvelle géométrie 1. reprise de la dernière géométrie");
201  param.ajouter("reprise_ori",0.,OT_PARAMETRES::DOUBLE,"0. nouvelle orientation 1. reprise des dernières orientations");
202  param.ajouter("reprise_mai",0.,OT_PARAMETRES::DOUBLE,"0. nouveau maillage 1. reprise du dernier maillage");
203  param.ajouter("operationaeffectuer",3.,OT_PARAMETRES::DOUBLE,"0. rien 1. generation 2. maillage 3. calcul");
204  if (nom!=NULL) param.lire(nom);
205  }
206 
207 
208  void MSTRUCT_GENERATEUR_POLYCRISTAUX::cree_param(char* nom,char *nomexe)
209  {
210  affiche((char*)"\nCreation du fichier de parametre");
211  param.change_valeur("operationaeffectuer", 2.);
212  param.change_valeur("enregistrerres", 0.);
213  param.enregistrer(nom);
214 
215  char nom2[500];
216  strcpy(nom2, nom);
217  strcat(nom2, "2");
218  FILE *paraout2=fopen(nom2,"wt");
219  fprintf(paraout2,"-> %s\n",nom);
220  fprintf(paraout2,"operationaeffectuer = 3.000000\n");
221  fprintf(paraout2,"reprise_geo = 1.000000\n");
222  fprintf(paraout2,"reprise_ori = 1.000000\n");
223  fprintf(paraout2,"reprise_mai = 1.000000\n");
224  fprintf(paraout2,"enregistrerres = 1.000000\n");
225 
226 
227  fclose(paraout2);
228 
229 
230 
231 
232  FILE *out = fopen("vasy", "wt");
233  fprintf(out, "#!/bin/bash\n");
234 fprintf(out, "for ((c=1;c<=$1;c++))\n");
235 fprintf(out, "do\n");
236 fprintf(out, "timeout 900s %s -polycristaux -out cristal.magic -param %s\n", nomexe,nom);
237 fprintf(out, "VAR=$?\n");
238 fprintf(out, "if (( $VAR )) ; then\n");
239 fprintf(out, " echo \"Timeout\"\n");
240 fprintf(out, "else\n");
241 fprintf(out, " %s -polycristaux -out cristal.magic -param %s\n", nomexe,nom2);
242 fprintf(out, "fi\n");
243 fprintf(out, "done\n");
244 
245 
246  fclose(out);
247  out = fopen("vasy_par", "wt");
248  fprintf(out, "#!/bin/bash\n");
249 fprintf(out, "VAR=1\n");
250 fprintf(out, "while (($VAR))\n");
251 fprintf(out, "do\n");
252 bool chemindanspath=false;
253 if ((nomexe[0]>='a') && (nomexe[0]<='z')) chemindanspath=true;
254 if ((nomexe[0]>='A') && (nomexe[0]<='Z')) chemindanspath=true;
255 if (chemindanspath)
256  fprintf(out, "timeout 1800s %s -polycristaux -out cristal.magic -param %s\n", nomexe,nom);
257 else
258  fprintf(out, "timeout 1800s ../%s -polycristaux -out cristal.magic -param %s\n", nomexe,nom);
259 fprintf(out, "VAR=$?\n");
260 fprintf(out, "if (( $VAR )) ; then\n");
261 fprintf(out, " echo \"Timeout\"\n");
262 fprintf(out, "else\n");
263 if (chemindanspath)
264  fprintf(out, " %s -polycristaux -out cristal.magic -param %s\n", nomexe,nom2);
265 else
266  fprintf(out, " ../%s -polycristaux -out cristal.magic -param %s\n", nomexe,nom2);
267 fprintf(out, "fi\n");
268 fprintf(out, "done\n");
269 
270 
271  fclose(out);
272  chmod ("vasy",strtol("0777", NULL,8));
273  chmod ("vasy_par",strtol("0777", NULL,8));
274  MG_EXPORT exp;
275  exp.change_param_aster((char*)"Noeud_ele",2.);
276  exp.ecrire_params_aster((char*)"param_aster.txt");
277 
278  }
279 
280 
282  {
283  int reprendgeo=(int)param.get_valeur("reprise_geo");
284  int reprendmai=(int)param.get_valeur("reprise_mai");
285  int reprendori=(int)param.get_valeur("reprise_ori");
286 
287 
288 
289 
290  #ifdef PROJECT_POLYCRISTAUX
293  MG_GESTIONNAIRE *gest;
294  int afaire=(int)param.get_valeur("operationaeffectuer");
295  MG_GEOMETRIE* mggeo;
296  double dg=param.get_valeur("dg");
297  statres.dg=dg;
298  double epsfusion=param.get_valeur("epsfusion");
299  std::string nomfichier=param.get_nom("nomfichier");
300  std::string nomfichierbrep=nomfichier+".brep";
301  std::string nomfichierocaf=nomfichier+".ocaf";
302  std::string nomfichiercarte=nomfichier+".sol";
303  std::string nomfichierborne=nomfichier+".borne";
304  double xmin=param.get_valeur("boitexmin");
305  double ymin=param.get_valeur("boiteymin");
306  double zmin=param.get_valeur("boitezmin");
307  double xmax=param.get_valeur("boitexmax");
308  double ymax=param.get_valeur("boiteymax");
309  double zmax=param.get_valeur("boitezmax");
310  BOITE_3D boite(xmin,ymin,zmin,xmax,ymax,zmax);
311  BOITE_3D boite2=boite;
312  boite2.change_grosseur(1.01);
313  if (afaire>0)
314  {
315  std::random_device seed;
316  std::mt19937_64 generateur(seed());
317  affiche((char*)"\nInitialisation");
318 
319  if (reprendgeo==0)
320  {
321  gest=new MG_GESTIONNAIRE;
323  grille.initialiser(boite2.get_xmin(),boite2.get_ymin(),boite2.get_zmin(),boite2.get_xmax(),boite2.get_ymax(),boite2.get_zmax(),100,100,100);
324  /*POLYCRISTAUX::POINT_TIRE p1(0,0,0,0);grille.inserer(&p1);
325  POLYCRISTAUX::POINT_TIRE p2(1,1000,0,0);grille.inserer(&p2);
326  POLYCRISTAUX::POINT_TIRE p3(2,1000,1000,0);grille.inserer(&p3);
327  POLYCRISTAUX::POINT_TIRE p4(3,0,1000,0);grille.inserer(&p4);
328  POLYCRISTAUX::POINT_TIRE p5(4,0,0,0);grille.inserer(&p5);
329  POLYCRISTAUX::POINT_TIRE p6(5,1000,0,0);grille.inserer(&p6);
330  POLYCRISTAUX::POINT_TIRE p7(6,1000,1000,0);grille.inserer(&p7);
331  POLYCRISTAUX::POINT_TIRE p8(7,0,1000,0);grille.inserer(&p8);*/
332  double dx=boite.get_xmax()-boite.get_xmin();
333  double dy=boite.get_ymax()-boite.get_ymin();
334  double dz=boite.get_zmax()-boite.get_zmin();
335  affiche((char*)"Generation de cristaux aléatoires");
336  double rayon=param.get_valeur("rayon")*0.3333333333333333333*(dx+dy+dz);
337  std::uniform_real_distribution<double> distribution_position_x(boite.get_xmin(),boite.get_xmax());
338  std::uniform_real_distribution<double> distribution_position_y(boite.get_ymin(),boite.get_ymax());
339  std::uniform_real_distribution<double> distribution_position_z(boite.get_zmin(),boite.get_zmax());
340  int nbinsere=0;
341  int nbainsere=param.get_valeur("nb_cristaux");
342  std::vector<POLYCRISTAUX::POINT_TIRE*> listepointainserer;
343  std::vector<double> listedepointvoro;
344  listedepointvoro.push_back(boite.get_xmin());listedepointvoro.push_back(boite.get_ymin());listedepointvoro.push_back(boite.get_zmin());
345  listedepointvoro.push_back(boite.get_xmin());listedepointvoro.push_back(boite.get_ymax());listedepointvoro.push_back(boite.get_zmin());
346  listedepointvoro.push_back(boite.get_xmax());listedepointvoro.push_back(boite.get_ymax());listedepointvoro.push_back(boite.get_zmin());
347  listedepointvoro.push_back(boite.get_xmax());listedepointvoro.push_back(boite.get_ymin());listedepointvoro.push_back(boite.get_zmin());
348  listedepointvoro.push_back(boite.get_xmin());listedepointvoro.push_back(boite.get_ymin());listedepointvoro.push_back(boite.get_zmax());
349  listedepointvoro.push_back(boite.get_xmin());listedepointvoro.push_back(boite.get_ymax());listedepointvoro.push_back(boite.get_zmax());
350  listedepointvoro.push_back(boite.get_xmax());listedepointvoro.push_back(boite.get_ymax());listedepointvoro.push_back(boite.get_zmax());
351  listedepointvoro.push_back(boite.get_xmax());listedepointvoro.push_back(boite.get_ymin());listedepointvoro.push_back(boite.get_zmax());
352 
353  while (nbinsere<nbainsere)
354  {
355  double x=distribution_position_x(generateur);
356  double y=distribution_position_y(generateur);
357  double z=distribution_position_z(generateur);
359  grille.rechercher(x,y,z,rayon,lsttrouve);
361  bool bonpoint=true;
362  for (POLYCRISTAUX::POINT_TIRE* pt=lsttrouve.get_premier(it);pt!=NULL;pt=lsttrouve.get_suivant(it))
363  {
364  OT_VECTEUR_3D vec(x-pt->x,y-pt->y,z-pt->z);
365  if (vec.get_longueur()<rayon) bonpoint=false;
366  }
367  if (bonpoint)
368  {
369  listedepointvoro.push_back(x);
370  listedepointvoro.push_back(y);
371  listedepointvoro.push_back(z);
372  POLYCRISTAUX::POINT_TIRE *pt=new POLYCRISTAUX::POINT_TIRE(nbinsere+8,x,y,z);
373  grille.inserer(pt);
374  listepointainserer.push_back(pt);
375  nbinsere++;
376  }
377  }
378 
379  for (int i=0;i<listepointainserer.size();i++)
380  delete listepointainserer[i];
381 
382  char message[1000];
383  sprintf(message," Construction des Voronoi avec borne de fusion de %lf",epsfusion);
384  affiche(message);
385  Polycristal poly(listedepointvoro,(char*)nomfichierbrep.c_str(),epsfusion);
387  bool avecstep=false;
388  int valeur=(int)param.get_valeur("enregistrementstep");
389  if (valeur==0) avecstep=false;
390  if (valeur==1) avecstep=true;
391  poly.construit(avecstep);
392  OCC_IMPORT occ_import;
393  mggeo = occ_import.importer_fichier_brep_V2017(*gest,(char*)nomfichierbrep.c_str(),(char*)nomfichierocaf.c_str(),FICHIEROCC,1e-6,false);
394  occ_import.importer_triangulation_V2017(*gest,mggeo,0.1,1);
395  mggeo->change_valeur_unite(1.);
396  int nb=listedepointvoro.size()/3;
397  for (int i=8;i<nb;i++)
398  {
399  double x=listedepointvoro[3*i];
400  double y=listedepointvoro[3*i+1];
401  double z=listedepointvoro[3*i+2];
402  LC_POINT* pt=new LC_POINT(x,y,z);
403  mggeo->ajouter_mg_point(pt);
404  }
405 
406  }
407  else
408  {
409  affiche((char*)"Reprise de calcul d'un ancien polycristal");
410  gest=new MG_FILE(nommagic);
411  mggeo=gest->get_mg_geometrie(0);
412 
413  }
414  statres.nbcristaux=mggeo->get_nb_mg_volume();
415 
416  char mess[500];
417  sprintf(mess," Nombre de cristaux MAGiC assemblés = %d ", mggeo->get_nb_mg_volume());;
418  affiche(mess);
419  double tens1[9],tens2[9],tens3[9];
420  for (int i=0;i<9;i++)
421  {
422  tens1[i]=0.;
423  tens2[i]=0.;
424  tens3[i]=0.;
425  }
426  if (reprendori==0)
427  {
428  std::uniform_real_distribution<double> distribution_angle1(0.,360.);
429  std::uniform_real_distribution<double> distribution_angle2(-1.,1.);
430  std::uniform_real_distribution<double> distribution_angle3(0.,360.);
431  affiche((char*)"Conditions aux limites");
432  LISTE_MG_VOLUME::iterator it;
433  int nbphase=(int)param.get_valeur("Nbphase");
434  statres.nbphase=nbphase;
435  statres.volume.resize(statres.nbphase+1);
436  statres.masse.resize(statres.nbphase+1);
437  statres.nbcristauxphase.resize(statres.nbphase+1);
438  statres.cdm.resize(statres.nbphase+1);
439  //std::discrete_distribution<int> d({20, 80});
440  //std::map<int, int> m;
441  std::vector<double> volume(nbphase);
442  std::vector<double> tirage(nbphase);
443  std::vector<OT_VECTEUR_3D> cdm(nbphase);
444  std::vector<double> cible(nbphase);
445  std::vector<int> ordrecible(nbphase);
446  std::vector<double> densite(nbphase);
447  std::vector<int> nbcristaux(nbphase);
448  //OT_TENSEUR rigtot(6,6),soutot(6,6);
449  //MSTRUCT_BORNE borne;
450  for (int i=0;i<nbphase;i++)
451  {
452  volume[i]=0.;
453  tirage[i]=0.;
454  cdm[i].change_x(0.);
455  cdm[i].change_y(0.);
456  cdm[i].change_z(0.);
457  cible[i]=param.get_valeur("Proportionphase",i);
458  ordrecible[i]=i;
459  densite[i]=param.get_valeur("Densite",i);
460  nbcristaux[i]=0;
461  /*double E1=param.get_valeur("E1",i);
462  double E2=param.get_valeur("E2",i);
463  double E3=param.get_valeur("E3",i);
464  double n1=param.get_valeur("n1",i);
465  double n2=param.get_valeur("n2",i);
466  double n3=param.get_valeur("n3",i);
467  double G1=param.get_valeur("G1",i);
468  double G2=param.get_valeur("G2",i);
469  double G3=param.get_valeur("G3",i);
470  OT_TENSEUR rig(6,6),rigphase(6,6),souphase(6,6);
471  borne.get_tenseur_rigidite(E1/1e9,E2/1e9,E3/1e9,2.*G1/1e9,2.*G2/1e9,2.*G3/1e9,n1,n2,n3,rig);
472  borne.get_VoigtReuss_poly(rig,rigphase,souphase);
473  rigphase=cible[i]*rigphase;
474  souphase=cible[i]*souphase;
475  rigtot=rigtot+rigphase;
476  soutot=soutot+souphase;*/
477  }
478  /*double Ev,Gv,Kv,nuv;
479  double Er,Gr,Kr,nur;
480  borne.get_VoigtReuss_poly(rigtot,soutot,Kv,Gv,Ev,nuv,Kr,Gr,Er,nur);
481  statborne.Evoigt=Ev*1e9;
482  statborne.Kvoigt=Kv/3.*1e9;
483  statborne.Gvoigt=Gv/2.*1e9;
484  statborne.nuvoigt=nuv;
485  statborne.Ereuss=Er*1e9;
486  statborne.Kreuss=Kr/3.*1e9;
487  statborne.Greuss=Gr/2.*1e9;
488  statborne.nureuss=nur;
489 
490  FILE *inborne=fopen(nomfichierborne.c_str(),"wb");
491  fwrite(&statborne,sizeof(statborne),1,inborne);
492  fclose(inborne);*/
493 
494  std::shuffle(ordrecible.begin(),ordrecible.end(),generateur);
495  std::vector<MG_VOLUME*> listevolume;
496  for (MG_VOLUME* vol=mggeo->get_premier_volume(it);vol!=NULL;vol=mggeo->get_suivant_volume(it))
497  listevolume.push_back(vol);
498  std::shuffle(listevolume.begin(),listevolume.end(),generateur);
499  double voltot=(boite.get_xmax()-boite.get_xmin())*(boite.get_ymax()-boite.get_ymin())*(boite.get_zmax()-boite.get_zmin());
500  double nume=voltot;
501  std::vector<double> deno(nbphase);
502  for (int i=0;i<nbphase;i++)
503  deno[i]=1.;
504  for (int i=0;i<nbphase;i++)
505  {
506  nume=nume*densite[i];
507  for (int j=0;j<nbphase;j++)
508  if (i!=j) deno[j]=deno[j]*densite[i];
509  else deno[j]=deno[j]*cible[i];
510  }
511  double massetot=0.;
512  for (int i=0;i<nbphase;i++)
513  massetot=massetot+deno[i];
514  massetot=nume/massetot;
515 
516 
517  for (int i=0;i<listevolume.size();i++)
518  {
519  MG_VOLUME *vol=listevolume[i];
520  int tir=-1,j=0;
521  while (tir==-1)
522  {
523  if (tirage[ordrecible[j]]/massetot<cible[ordrecible[j]]) tir=ordrecible[j];
524  j++;
525  //if (j>=nbphase) tir=j-1;
526  }
527  double volu,masse;
528  OT_VECTEUR_3D cdm2;
529  OT_MATRICE_3D m1,m2;
530  double dens=densite[tir];
531  vol->get_propriete_massique(gest->get_mg_maillage(0),volu,masse,cdm2,m1,m2,dens,-1);
532  volume[tir]=volume[tir]+volu;
533  tirage[tir]=tirage[tir]+masse;
534  cdm[tir]=cdm[tir]+masse*cdm2;
535  nbcristaux[tir]=nbcristaux[tir]+1;
536 
537 
538  for (int i=0;i<vol->get_nb_ccf();i++)
539  vol->supprimer_ccf(0);
540  double E1=param.get_valeur("E1",tir);
541  double E2=param.get_valeur("E2",tir);
542  double E3=param.get_valeur("E3",tir);
543  double n1=param.get_valeur("n1",tir);
544  double n2=param.get_valeur("n2",tir);
545  double n3=param.get_valeur("n3",tir);
546  double G1=param.get_valeur("G1",tir);
547  double G2=param.get_valeur("G2",tir);
548  double G3=param.get_valeur("G3",tir);
549  vol->ajouter_ccf((char*)"Ph",(double)tir);
550  vol->ajouter_ccf((char*)"E1",E1);
551  vol->ajouter_ccf((char*)"E2",E2);
552  vol->ajouter_ccf((char*)"E3",E3);
553  vol->ajouter_ccf((char*)"n1",n1);
554  vol->ajouter_ccf((char*)"n2",n2);
555  vol->ajouter_ccf((char*)"n3",n3);
556  vol->ajouter_ccf((char*)"G1",G1);
557  vol->ajouter_ccf((char*)"G2",G2);
558  vol->ajouter_ccf((char*)"G3",G3);
559  vol->ajouter_ccf((char*)"Ro",dens);
560  double a1=distribution_angle1(generateur);
561  double a3=distribution_angle3(generateur);
562  double a2=distribution_angle2(generateur);
563  a2=acos(a2)/M_PI*180.;
564  vol->ajouter_ccf((char*)"a1",a1);
565  vol->ajouter_ccf((char*)"a2",a2);
566  vol->ajouter_ccf((char*)"a3",a3);
567  double x1[3],x2[3],x3[3];
568  double psi=a1/180.*M_PI;
569  double teta=a2/180.*M_PI;
570  double phi=a3/180.*M_PI;
571  x1[0]=cos(phi)*cos(psi)-sin(phi)*cos(teta)*sin(psi);
572  x1[1]=cos(phi)*sin(psi)+sin(phi)*cos(teta)*cos(psi);
573  x1[2]=sin(phi)*sin(teta);
574  x2[0]=-sin(phi)*cos(psi)-cos(phi)*cos(teta)*sin(psi);
575  x2[1]=-sin(phi)*sin(psi)+cos(phi)*cos(teta)*cos(psi);
576  x2[2]=cos(phi)*sin(teta);
577  x3[0]=sin(teta)*sin(psi);
578  x3[1]=-sin(teta)*cos(psi);
579  x3[2]=cos(teta);
580  for (int i=0;i<3;i++)
581  for (int j=0;j<3;j++)
582  {
583  tens1[i*3+j]+=x1[i]*x1[j];
584  tens2[i*3+j]+=x2[i]*x2[j];
585  tens3[i*3+j]+=x3[i]*x3[j];
586  }
587 
588  }
589  double massetotale=0.;
590  double volumetotal=0.;
591  for (int i=0;i<nbphase;i++)
592  {
593  volumetotal=volumetotal+volume[i];
594  massetotale=massetotale+tirage[i];
595  }
596  char mess[500];
597  sprintf(mess," Masse estimée %lf calculée %lf",massetot,massetotale);
598  affiche(mess);
599  statres.masse[nbphase]=massetotale;
600  statres.volume[nbphase]=volumetotal;
601  for (int i=0;i<nbphase;i++)
602  {
603  char mess[500];
604  sprintf(mess," Phase %d (%d cristaux) = tirage %d \n masse %lf ou %lf%% \n volume %lf ou %lf%%", i+1,nbcristaux[i],ordrecible[i]+1,tirage[i],tirage[i]/massetotale*100.,volume[i],volume[i]/volumetotal*100.);
605  affiche(mess);
606  sprintf(mess," Centre de masse x = %lf ",cdm[i].get_x()/tirage[i]);
607  affiche(mess);
608  sprintf(mess," y = %lf ",cdm[i].get_y()/tirage[i]);
609  affiche(mess);
610  sprintf(mess," z = %lf ",cdm[i].get_z()/tirage[i]);
611  affiche(mess);
612  statres.masse[i]=tirage[i];
613  statres.volume[i]=volume[i];
614  statres.cdm[i]=cdm[i]/tirage[i];
615  statres.cdm[nbphase]=statres.cdm[nbphase]+cdm[i];
616  statres.nbcristauxphase[i]=nbcristaux[i];
617  }
618  statres.cdm[statres.nbphase]=(1./statres.masse[statres.nbphase])*statres.cdm[statres.nbphase];
619  sprintf(mess," Centre de masse global x = %lf ",statres.cdm[statres.nbphase].get_x());
620  affiche(mess);
621  sprintf(mess," y = %lf ",statres.cdm[statres.nbphase].get_y());
622  affiche(mess);
623  sprintf(mess," z = %lf ",statres.cdm[statres.nbphase].get_z());
624  affiche(mess);
625  }
626  else
627  {
628  affiche((char*)"Reprise conditions aux limites");
629  LISTE_MG_VOLUME::iterator it;
630  statres.nbphase=(int)param.get_valeur("Nbphase");
631  statres.volume.resize(statres.nbphase+1);
632  statres.masse.resize(statres.nbphase+1);
633  statres.nbcristauxphase.resize(statres.nbphase+1);
634  statres.cdm.resize(statres.nbphase+1);
635  for (int i=0;i<statres.nbphase;i++)
636  {
637  statres.volume[i]=0.;
638  statres.masse[i]=0.;
639  statres.nbcristauxphase[i]=0;
640  statres.cdm[i].change_x(0.);
641  statres.cdm[i].change_y(0.);
642  statres.cdm[i].change_z(0.);
643  }
644  for (MG_VOLUME* vol=mggeo->get_premier_volume(it);vol!=NULL;vol=mggeo->get_suivant_volume(it))
645  {
646  double a1,a2,a3;
647  vol->get_valeur_ccf((char*)"a1",a1);
648  vol->get_valeur_ccf((char*)"a2",a2);
649  vol->get_valeur_ccf((char*)"a3",a3);
650  double x1[3],x2[3],x3[3];
651  double psi=a1/180.*M_PI;
652  double teta=a2/180.*M_PI;
653  double phi=a3/180.*M_PI;
654  x1[0]=cos(phi)*cos(psi)-sin(phi)*cos(teta)*sin(psi);
655  x1[1]=cos(phi)*sin(psi)+sin(phi)*cos(teta)*cos(psi);
656  x1[2]=sin(phi)*sin(teta);
657  x2[0]=-sin(phi)*cos(psi)-cos(phi)*cos(teta)*sin(psi);
658  x2[1]=-sin(phi)*sin(psi)+cos(phi)*cos(teta)*cos(psi);
659  x2[2]=cos(phi)*sin(teta);
660  x3[0]=sin(teta)*sin(psi);
661  x3[1]=-sin(teta)*cos(psi);
662  x3[2]=cos(teta);
663  for (int i=0;i<3;i++)
664  for (int j=0;j<3;j++)
665  {
666  tens1[i*3+j]+=x1[i]*x1[j];
667  tens2[i*3+j]+=x2[i]*x2[j];
668  tens3[i*3+j]+=x3[i]*x3[j];
669  }
670  double val;
671  vol->get_valeur_ccf((char*)"Ph",val);
672  int numphase=(int)val;
673  vol->get_valeur_ccf((char*)"Ro",val);
674  double dens=val;
675  double volu,mass;
676  OT_VECTEUR_3D cdm2;
677  OT_MATRICE_3D m1,m2;
678  vol->get_propriete_massique(gest->get_mg_maillage(0),volu,mass,cdm2,m1,m2,dens,-1);
679  statres.volume[numphase]=statres.volume[numphase]+volu;
680  statres.masse[numphase]=statres.masse[numphase]+mass;
681  statres.nbcristauxphase[numphase]++;
682  statres.cdm[numphase]=statres.cdm[numphase]+mass*cdm2;
683  }
684  statres.masse[statres.nbphase]=0.;
685  statres.volume[statres.nbphase]=0.;
686  statres.cdm[statres.nbphase].change_x(0.);
687  statres.cdm[statres.nbphase].change_y(0.);
688  statres.cdm[statres.nbphase].change_z(0.);
689  for (int i=0;i<statres.nbphase;i++)
690  {
691  statres.volume[statres.nbphase]=statres.volume[statres.nbphase]+statres.volume[i];
692  statres.masse[statres.nbphase]=statres.masse[statres.nbphase]+statres.masse[i];
693  statres.cdm[i]=(1./statres.masse[i])*statres.cdm[i];
694  statres.cdm[statres.nbphase]=statres.cdm[statres.nbphase]+statres.masse[i]*statres.cdm[i];
695  }
696  statres.cdm[statres.nbphase]=(1./statres.masse[statres.nbphase])*statres.cdm[statres.nbphase];
697  for (int i=0;i<statres.nbphase;i++)
698  {
699  char mess[500];
700  sprintf(mess," Phase %d (%d cristaux) : masse %lf ou %lf%% \n volume %lf ou %lf%%", i+1,statres.nbcristauxphase[i],statres.masse[i],statres.masse[i]/statres.masse[statres.nbphase]*100.,statres.volume[i],statres.volume[i]/statres.volume[statres.nbphase]*100.);
701 
702  affiche(mess);
703 
704  sprintf(mess," Centre de masse x = %lf ",statres.cdm[i].get_x());
705  affiche(mess);
706  sprintf(mess," y = %lf ",statres.cdm[i].get_y());
707  affiche(mess);
708  sprintf(mess," z = %lf ",statres.cdm[i].get_z());
709  affiche(mess);
710 
711  }
712  sprintf(mess," Centre de masse global x = %lf ",statres.cdm[statres.nbphase].get_x());
713  affiche(mess);
714  sprintf(mess," y = %lf ",statres.cdm[statres.nbphase].get_y());
715  affiche(mess);
716  sprintf(mess," z = %lf ",statres.cdm[statres.nbphase].get_z());
717  affiche(mess);
718 
719  }
720 
721  for (int i=0;i<9;i++)
722  {
723  statres.tens1[i]=tens1[i]/mggeo->get_nb_mg_volume();
724  statres.tens2[i]=tens2[i]/mggeo->get_nb_mg_volume();
725  statres.tens3[i]=tens3[i]/mggeo->get_nb_mg_volume();
726  }
727  }
728  int degre=(int)param.get_valeur("Degre");
729  statres.degre=degre;
730  FEM_MAILLAGE* fem;
731  if (afaire>1)
732  {
733 
734  if (reprendmai==0)
735  {
738  for (int i=gest->get_nb_mg_maillage()-1;i>0;i--)
739  gest->supprimer_mg_maillage(i);
740  //FCT_TAILLE_FEM_SOLUTION_GENERATEUR_CONSTANT carte(gest,mggeo,dg,1,1,1,1,(char*)nomfichiercarte.c_str());
741  affiche((char*)"Carte de taille");
742 
743  std::vector<double> lstpoint;
744  int nbarete=mggeo->get_nb_mg_arete();
745  double bornerafmin=param.get_valeur("bornemin_carte");
746  int typeborne=(int)param.get_valeur("type_bornemin");
747  if (typeborne==1) bornerafmin=bornerafmin*dg;
748  for (int i=0;i<nbarete;i++)
749  {
750  MG_ARETE* are=mggeo->get_mg_arete(i);
751  double val=are->get_longueur(are->get_tmin(),are->get_tmax());
752  if (val<epsfusion) std::cout<< " pb" << std::endl;
753  if (val<dg)
754  {
755  double xyz[3];
756  are->get_cosommet1()->get_sommet()->get_point()->evaluer(xyz);
757  lstpoint.push_back(xyz[0]);
758  lstpoint.push_back(xyz[1]);
759  lstpoint.push_back(xyz[2]);
760  lstpoint.push_back(std::max(val,bornerafmin));
761  }
762 
763  }
764  char message[500];
765  sprintf(message," Écart nodal demande : %lf Écart nodal minimal : %lf",dg,bornerafmin);
766  affiche(message);
767  sprintf(message," %d points de raffinement",(int)(lstpoint.size())/4);
768  affiche(message);
769  //affiche((char*)"Enregistrement");
770  //gest->enregistrer(nommagic);
771  double gradient=param.get_valeur("gradient");
772  FCT_TAILLE_FEM_SOLUTION_GENERATEUR_GRADIENT carte(gest,mggeo,dg,2,50,50,50,(char*)nomfichiercarte.c_str(),lstpoint,gradient);
773  //carte.active_affichage(affiche2);
774  carte.construit();
775  carte.enregistrer(nommagic);
776 
777  MG_MAILLAGE *mai=new MG_MAILLAGE(mggeo);
778  gest->ajouter_mg_maillage(mai);
779  affiche((char*)"Maillage 0D");
780  MAILLEUR0D m0d(mai,mggeo);
782  m0d.maille();
783  affiche((char*)"Maillage 1D");
784  MAILLEUR1D m1d(mai,mggeo,&carte);
785  //m1d.active_affichage(affiche2);
786  m1d.maille();
787  affiche((char*)"Maillage 2D");
788  MAILLEUR2D m2d(mai,mggeo,&carte);
789  //m2d.active_affichage(affiche2);
790  m2d.maille();
791  affiche((char*)"Maillage 3D");
792  MAILLEUR3D m3d(mai,mggeo,&carte,false);
793  //m3d.active_affichage(affiche2);
794  LISTE_MG_VOLUME::iterator it;int ii=0;
795  for (MG_VOLUME* vol=mggeo->get_premier_volume(it);vol!=NULL;vol=mggeo->get_suivant_volume(it))
796  {
797  ii++;
798  char mess[5000];
799  if (ii!=1) sprintf(mess,"\033[A\033[K Polycristal %d / %d soit %.2lf%%",ii,mggeo->get_nb_mg_volume(),ii*100.0/mggeo->get_nb_mg_volume());
800  else sprintf(mess," Polycristal %d / %d soit %.2lf%%",ii,mggeo->get_nb_mg_volume(),ii*100.0/mggeo->get_nb_mg_volume());
801  affiche(mess);
802  m3d.maille(vol);
803  }
804  //MAILLEUR_ANALYSE mana(mai);
805  //mana.active_affichage(affiche2);
806  //mana.analyse();
807  //optimise_maillage(mai);
808  //mana.analyse();
809  fem=new FEM_MAILLAGE(mggeo,mai,degre);
810  gest->ajouter_fem_maillage(fem);
811  char mess[400];
812  sprintf(mess,"Maillage FEM degre %d",degre);
813  affiche(mess);
814  MAILLEUR_FEM mfem;
815  mfem.maille(fem,0);
816  }
817  else
818  {
819  affiche((char*)"Reprise de calcul d'un ancien maillage");
820  fem=gest->get_fem_maillage(1);
821  }
822 
823  //verification volume
824  double volume=0.;
825  LISTE_FEM_ELEMENT3::iterator it;
826  for (FEM_ELEMENT3* ele=fem->get_premier_element3(it);ele!=NULL;ele=fem->get_suivant_element3(it))
827  {
828  MG_TETRA* tet=(MG_TETRA*)ele->get_mg_element_maillage();
829  MG_NOEUD* n1=tet->get_noeud1();
830  MG_NOEUD* n2=tet->get_noeud2();
831  MG_NOEUD* n3=tet->get_noeud3();
832  MG_NOEUD* n4=tet->get_noeud4();
833  OT_VECTEUR_3D vec1(n1->get_coord(),n2->get_coord());
834  OT_VECTEUR_3D vec2(n1->get_coord(),n3->get_coord());
835  OT_VECTEUR_3D vec3(n1->get_coord(),n4->get_coord());
836  OT_VECTEUR_3D pvec=vec1&vec2;
837  double vol=fabs(pvec*vec3);
838  volume=volume+vol;
839  }
840  volume=volume/6.;
841  char message[500];
842  sprintf(message," Volume des mailles = %lf",volume);
843  affiche(message);
844 
845  /*
846  MAILLEUR_ANALYSE mana(fem);
847  mana.active_affichage(affiche2);
848  mana.analyse(NULL);
849  */}
850  if (afaire>2)
851  {
852  double epsx,epsy,epsz,epsxy,epsxz,epsyz;
853  double sigx,sigy,sigz,sigxy,sigxz,sigyz;
854  affiche((char*)"\n---> 1. CLDHS\n");
856  int erreur=calcule_cacteristique_mecanique(gest,fem,epsx,epsy,epsz,epsxy,epsxz,epsyz,sigx,sigy,sigz,sigxy,sigxz,sigyz);
857  if (erreur==0)
858  {
859  statres.KDH=1./3.*(sigx+sigy+sigz)/(epsx+epsy+epsz);
860  mggeo->efface_ccf(false,true,true,true);
861  char message[500];
862  sprintf(message," KDH=%lf",statres.KDH);
863  affiche(message);
864  }
865  else exit(EXIT_FAILURE);
866 
867  if (erreur==0)
868  {
869 
870  affiche((char*)"\n---> 2. CLDHD\n");
872  erreur=calcule_cacteristique_mecanique(gest,fem,epsx,epsy,epsz,epsxy,epsxz,epsyz,sigx,sigy,sigz,sigxy,sigxz,sigyz);
873  if (erreur==0)
874  {
875  statres.GDH=1./6.*(sigxy/epsxy+sigyz/epsyz+sigxz/epsxz);
876  statres.EDH=9*statres.KDH*statres.GDH/(3*statres.KDH+statres.GDH);
877  mggeo->efface_ccf(false,true,true,true);
878  char message[500];
879  sprintf(message," GDH=%lf\n EDH=%lf\n",statres.GDH,statres.EDH);
880  affiche(message);
881  }
882  else exit(EXIT_FAILURE);
883  }
884 
885  if (erreur==0)
886  {
887  affiche((char*)"\n---> 3. CLCHS\n");
889  erreur=calcule_cacteristique_mecanique(gest,fem,epsx,epsy,epsz,epsxy,epsxz,epsyz,sigx,sigy,sigz,sigxy,sigxz,sigyz);
890  if (erreur==0)
891  {
892  statres.KCH=1./3.*(sigx+sigy+sigz)/(epsx+epsy+epsz);
893  mggeo->efface_ccf(false,true,true,true);
894  char message[500];
895  sprintf(message," KCH=%lf\n\n",statres.KCH);
896  affiche(message);
897  }
898  else exit(EXIT_FAILURE);
899 
900  }
901 
902  if (erreur==0)
903  {
904  affiche((char*)"\n---> 4. CLCHD\n");
906  calcule_cacteristique_mecanique(gest,fem,epsx,epsy,epsz,epsxy,epsxz,epsyz,sigx,sigy,sigz,sigxy,sigxz,sigyz);
907  if (erreur==0)
908  {
909  statres.GCH=1./6.*(sigxy/epsxy+sigyz/epsyz+sigxz/epsxz);
910  statres.ECH=9*statres.KCH*statres.GCH/(3*statres.KCH+statres.GCH);
911  mggeo->efface_ccf(false,true,true,true);
912  char message[500];
913  sprintf(message," GCH=%lf\n ECH=%lf\n",statres.GCH,statres.ECH);
914  affiche(message);
915  }
916  else exit(EXIT_FAILURE);
917 
918  //double GDH,EDH,KCH,GCH,ECH;
919  affiche((char*)"\n\n Résultats \n\n");
920  char message[500];
921  sprintf(message," KDH=%lf;GDH=%lf;EDH=%lf;",statres.KDH,statres.GDH,statres.EDH);
922  affiche(message);
923  sprintf(message," KCH=%lf;GCH=%lf;ECH=%lf;\n",statres.KCH,statres.GCH,statres.ECH);
924  affiche(message);
925  gest->enregistrer(nommagic);
926 
927 
928 
929  }
930 
931  }
932  int enregistreresultat=(int)param.get_valeur("enregistrerres");
933  if (enregistreresultat==1)
934  {
935  /*FILE *outborne=fopen(nomfichierborne.c_str(),"rb");
936  fread(&statborne,sizeof(statborne),1,outborne);
937  fclose(outborne);*/
938  calcule_borne(statborne,statres);
939  std::mutex mtx;
940  std::string nomcumul=param.get_nom("fichiercumul");
941  std::string nomcumul1 = nomcumul+".txt";
942  std::string nomcumul2 = nomcumul+".gnu";
943  std::string nomcumul3 = nomcumul+".svg";
944  FILE *outtest=fopen((char*)nomcumul1.c_str(),"rt");
945  bool existe =false;
946  if (outtest!=NULL) {existe=true;fclose(outtest);}
947  mtx.lock();
948  FILE *out=fopen((char*)nomcumul1.c_str(),"at");
949  if (!existe)
950  { fprintf(out,"Nbcristaux;degre;dg;KDH;GDH;EDH;KCH;GCH;ECH;ori1_11;ori1_12;ori1_13;ori1_21;ori1_22;ori1_23;ori1_31;ori1_32;ori1_33;ori2_11;ori2_12;ori2_13;ori2_21;ori2_22;ori2_23;ori2_31;ori2_32;ori2_33;ori3_11;ori3_12;ori3_13;ori3_21;ori3_22;ori3_23;ori3_31;ori3_32;ori3_33;Nbphase;");
951  for (int i=0;i<statres.nbphase;i++)
952  fprintf(out,"N%d;VPh%d;MPh%d;CDMx%d;CDMy%d;CDMz%d;",i+1,i+1,i+1,i+1,i+1,i+1);
953  fprintf(out,"VPhtot;MPhtot;CDMxtot;CDMytot;CDMztot,Kv,Gv,Ev,nuv,Kr,Gr,Er,nur\n");
954  }
955  fprintf(out,"%d;%d;%lf;",statres.nbcristaux,statres.degre,statres.dg);
956  fprintf(out,"%lf;%lf;%lf;",statres.KDH,statres.GDH,statres.EDH);
957  fprintf(out,"%lf;%lf;%lf;",statres.KCH,statres.GCH,statres.ECH);
958  for (int i=0;i<9;i++)
959  fprintf(out,"%lf;",statres.tens1[i]);
960  for (int i=0;i<9;i++)
961  fprintf(out,"%lf;",statres.tens2[i]);
962  for (int i=0;i<9;i++)
963  fprintf(out,"%lf;",statres.tens3[i]);
964  fprintf(out,"%d;",statres.nbphase);
965  for (int i=0;i<statres.nbphase;i++)
966  fprintf(out,"%d;%lf;%lf;%lf;%lf;%lf;",statres.nbcristauxphase[i],statres.volume[i],statres.masse[i],statres.cdm[i].get_x(),statres.cdm[i].get_y(),statres.cdm[i].get_z());
967  fprintf(out,"%lf;%lf;%lf;%lf;%lf;",statres.volume[statres.nbphase],statres.masse[statres.nbphase],statres.cdm[statres.nbphase].get_x(),statres.cdm[statres.nbphase].get_y(),statres.cdm[statres.nbphase].get_z());
968  fprintf(out,"%lf;%lf;%lf;%lf;%lf;%lf;%lf;%lf;",statborne.Kvoigt,statborne.Gvoigt,statborne.Evoigt,statborne.nuvoigt,statborne.Kreuss,statborne.Greuss,statborne.Ereuss,statborne.nureuss);
969  fprintf(out,"\n");
970 
971  fclose(out);
972  mtx.unlock();
973  /*outtest=fopen((char*)nomcumul2.c_str(),"rt");
974  existe =false;
975  if (outtest!=NULL) {existe=true;fclose(outtest);}
976  if (!existe)
977  {
978  mtx.lock();
979  FILE *out=fopen((char*)nomcumul2.c_str(),"wt");
980  fprintf(out, "set terminal svg\n");
981  fprintf(out, "set output \"%s\"\n", nomcumul3.c_str());
982  fprintf(out, "set datafile separator \";\"\n");
983  fprintf(out, "set key on bmargin horizontal\n");
984  fprintf(out, "set xlabel 'Numéro d''essai'\n");
985  fprintf(out, "set ylabel 'Module d''Young (GPa)'\n");
986  fprintf(out, "set y2label 'Écart à l''isotropie'\n");
987  fprintf(out, "set pointsize 1\n");
988  fprintf(out, "set autoscale x\n");
989  fprintf(out, "set autoscale y\n");
990  fprintf(out, "set y2tics 0.5,0.1,1\n");
991  fprintf(out, "set y2r [0.5:1]\n");
992  fprintf(out, "set ytics nomirror\n");
993  fprintf(out, "set xtics nomirror\n");
994  double facteur = (param.get_valeur("bornevoigt")-param.get_valeur("bornereuss"))/3./1e9;
995  fprintf(out, "set offsets graph 0, 0, %lf,0\n", facteur);
996  fprintf(out, "#\n");
997  fprintf(out, "d(x)=dd\n");
998  fprintf(out, "fit d(x) '%s' u :($6/1e9) via dd\n",nomcumul1.c_str());
999  fprintf(out, "c(x)=cc\n");
1000  fprintf(out, "fit c(x) '%s' u :($9/1e9) via cc\n",nomcumul1.c_str());
1001  fprintf(out, "#\n");
1002  fprintf(out, "set title \"%s\\n %d cristaux\"\n",param.get_nom("nommateriau").c_str(), (int)param.get_valeur("nb_cristaux"));
1003  fprintf(out, "plot '%s' u :($6/1e9) title 'EDH' pointtype 5 lc rgb \"blue\", '%s' u :($9/1e9) title 'ECH' pointtype 5 lc rgb \"red\",(%lf/1e9) title 'Borne Voigt' w l lc rgb \"violet\" lw 3,(%lf/1e9) title 'Borne Reuss' w l lc rgb \"dark-orange\" lw 3, '%s' u :(1.-sqrt(1./9.*(($10-1./3)*($10-1./3)+($14-1./3.)*($14-1./3)+($18-1./3.)*($18-1./3.)+($19-1./3)*($19-1./3)+($23-1./3.)*($23-1./3)+($27-1./3.)*($27-1./3.)+($28-1./3)*($28-1./3)+($32-1./3.)*($32-1./3)+($36-1./3.)*($36-1./3.)))) axis x1y2 title 'Isotropie' lc rgb \"green\" pointtype 1,c(x) title sprintf(\"moyenne %%.1f\",cc) lc rgb \"red\" dt 2 ,d(x) title sprintf(\"moyenne %%.1f\",dd) lc rgb \"blue\" dt 2", nomcumul1.c_str(),nomcumul1.c_str(),statres.Evoigt,statres.Ereuss,nomcumul1.c_str() );
1004 
1005 
1006  fclose(out);
1007  mtx.unlock();
1008  }*/
1009  }
1010 
1011 
1012 
1013  affiche((char*)"Enregistrement");
1014  gest->enregistrer(nommagic);
1015  delete gest;
1016 
1017  #endif
1018  }
1019 
1020 
1021 
1022  int MSTRUCT_GENERATEUR_POLYCRISTAUX::calcule_cacteristique_mecanique(MG_GESTIONNAIRE *gest,FEM_MAILLAGE* fem, double& epsx, double& epsy, double& epsz, double& epsxy, double& epsxz, double& epsyz, double& sigx, double& sigy, double& sigz, double& sigxy, double& sigxz, double& sigyz)
1023  {
1024 
1025  //affiche((char*)"Calcul aster");
1026  MGASTER ef;
1028  std::string nomparamaster=param.get_nom("paramaster");
1029  std::string nomfichier=param.get_nom("nomfichier");
1030  int erreur=ef.calcule((char*)nomparamaster.c_str(),fem,(char*)nomfichier.c_str(),MAGIC::CALCUL_ASTER::ELASTIQUE,(char*)"00011111",false);
1031  if (erreur!=0) return erreur;
1032  int nb=gest->get_nb_fem_solution();
1033  for (int i=0;i<nb;i++)
1034  {
1035 
1036  FEM_SOLUTION* sol=gest->get_fem_solution(i);
1037  std::string nom=sol->get_nom();
1038  nom.erase(2,1000);
1039  if (nom=="GE")
1040  {
1041  epsx=sol->get_moyenne_volumique_champs(NULL,0);
1042  epsy=sol->get_moyenne_volumique_champs(NULL,1);
1043  epsz=sol->get_moyenne_volumique_champs(NULL,2);
1044  epsxy=sol->get_moyenne_volumique_champs(NULL,3);
1045  epsxz=sol->get_moyenne_volumique_champs(NULL,4);
1046  epsyz=sol->get_moyenne_volumique_champs(NULL,5);
1047  }
1048  if ((nom=="GS") && (sol->get_nb_champ()==6))
1049  {
1050  sigx=sol->get_moyenne_volumique_champs(NULL,0);
1051  sigy=sol->get_moyenne_volumique_champs(NULL,1);
1052  sigz=sol->get_moyenne_volumique_champs(NULL,2);
1053  sigxy=sol->get_moyenne_volumique_champs(NULL,3);
1054  sigxz=sol->get_moyenne_volumique_champs(NULL,4);
1055  sigyz=sol->get_moyenne_volumique_champs(NULL,5);
1056  }
1057  }
1058  return erreur;
1059  }
1060 
1061 
1062 
1063 
1064 
1065 
1067 {
1068 double bornerafmin=param.get_valeur("bornemin_carte");
1069 int typeborne=(int)param.get_valeur("type_bornemin");
1070 double dg=param.get_valeur("dg");
1071 if (typeborne==1) bornerafmin=bornerafmin*dg;
1073 std::multimap<MG_NOEUD*,MG_NOEUD*> lst1;
1074 std::map<MG_NOEUD*,MG_NOEUD*> lst2;
1075 LISTE_MG_SEGMENT::iterator it;
1076 for (MG_SEGMENT* seg=mai->get_premier_segment(it);seg!=NULL;seg=mai->get_suivant_segment(it))
1077  {
1078  if (seg->get_longueur()<bornerafmin)
1079  {
1080  int nb1=seg->get_noeud1()->get_lien_tetra()->get_nb();
1081  int nb2=seg->get_noeud2()->get_lien_tetra()->get_nb();
1082  MG_NOEUD* no1=seg->get_noeud1();
1083  MG_NOEUD* no2=seg->get_noeud2();
1084  if (no1>no2)
1085  {
1086  MG_NOEUD* tmp=no1;
1087  no1=no2;
1088  no2=tmp;
1089  }
1090  std::map<MG_NOEUD*,MG_NOEUD*>::iterator itn=lst2.find(no1);
1091  if (itn!=lst2.end())
1092  no1=itn->second;
1093  std::pair<MG_NOEUD*,MG_NOEUD*> tmp1(no1,no2);
1094  std::pair<MG_NOEUD*,MG_NOEUD*> tmp2(no2,no1);
1095  std::pair<std::map<MG_NOEUD*,MG_NOEUD*>::iterator,bool> ret=lst2.insert(tmp2);
1096  if (ret.second==false) continue;
1097  lst1.insert(tmp1);
1098  for (int i=0;i<nb1;i++)
1099  for (int j=0;j<nb2;j++)
1100  if (seg->get_noeud1()->get_lien_tetra()->get(i)==seg->get_noeud2()->get_lien_tetra()->get(j))
1101  {
1102  MG_TETRA* tet=seg->get_noeud1()->get_lien_tetra()->get(i);
1103  coq.ajouter(tet);
1104  }
1105  }
1106  }
1108 for (MG_TETRA* tet=coq.get_premier(it2);tet!=NULL;tet=coq.get_suivant(it2))
1109  mai->supprimer_mg_tetraid(tet->get_id());
1110 for (std::multimap<MG_NOEUD*,MG_NOEUD*>::iterator itn=lst1.begin();itn!=lst1.end();itn++)
1111  {
1112  TPL_LISTE_ENTITE<MG_NOEUD*> lsttetaconstruire;
1113  TPL_LISTE_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> lsttetaconstruire2;
1114  coq.vide();
1115  MG_NOEUD* no1=itn->first;
1116  MG_NOEUD* no2=itn->second;
1117  int nb=no2->get_lien_tetra()->get_nb();
1118  for (int i=0;i<nb;i++)
1119  {
1120  MG_TETRA* tet=no2->get_lien_tetra()->get(i);
1121  if (tet->get_noeud1()==no2) lsttetaconstruire.ajouter(no1); else lsttetaconstruire.ajouter(tet->get_noeud1());
1122  if (tet->get_noeud2()==no2) lsttetaconstruire.ajouter(no1); else lsttetaconstruire.ajouter(tet->get_noeud2());
1123  if (tet->get_noeud3()==no2) lsttetaconstruire.ajouter(no1); else lsttetaconstruire.ajouter(tet->get_noeud3());
1124  if (tet->get_noeud4()==no2) lsttetaconstruire.ajouter(no1); else lsttetaconstruire.ajouter(tet->get_noeud4());
1125  lsttetaconstruire2.ajouter(tet->get_lien_topologie());
1126  coq.ajouter(tet);
1127  }
1128 
1129 for (int i=0;i<lsttetaconstruire.get_nb()/4;i++)
1130  {
1131  double qual=OPERATEUR::qualite_tetra(lsttetaconstruire.get(4*i)->get_coord(),lsttetaconstruire.get(4*i+1)->get_coord(),lsttetaconstruire.get(4*i+2)->get_coord(),lsttetaconstruire.get(4*i+3)->get_coord());
1132  if (qual<1e-14) std::cout << qual << std::endl;
1133  mai->ajouter_mg_tetra(lsttetaconstruire2.get(i),lsttetaconstruire.get(4*i),lsttetaconstruire.get(4*i+1),lsttetaconstruire.get(4*i+2),lsttetaconstruire.get(4*i+3),MAGIC::ORIGINE::MAILLEUR_AUTO);
1134  }
1135 
1136  }
1137 for (MG_TETRA* tet=coq.get_premier(it2);tet!=NULL;tet=coq.get_suivant(it2))
1138  mai->supprimer_mg_tetraid(tet->get_id());
1139 
1140 
1141 
1142 
1143 
1144 }
1145 
1147 {
1148  OT_TENSEUR rigtot(6,6),soutot(6,6);
1149  MSTRUCT_BORNE borne;
1150  for (int i=0;i<echantillon.nbphase;i++)
1151  {
1152  double E1=param.get_valeur("E1",i);
1153  double E2=param.get_valeur("E2",i);
1154  double E3=param.get_valeur("E3",i);
1155  double n1=param.get_valeur("n1",i);
1156  double n2=param.get_valeur("n2",i);
1157  double n3=param.get_valeur("n3",i);
1158  double G1=param.get_valeur("G1",i);
1159  double G2=param.get_valeur("G2",i);
1160  double G3=param.get_valeur("G3",i);
1161  OT_TENSEUR rig(6,6),rigphase(6,6),souphase(6,6);
1162  borne.get_tenseur_rigidite(E1/1e9,E2/1e9,E3/1e9,2.*G1/1e9,2.*G2/1e9,2.*G3/1e9,n1,n2,n3,rig);
1163  borne.get_VoigtReuss_poly(rig,rigphase,souphase);
1164  double proportion=echantillon.masse[i]/echantillon.masse[echantillon.nbphase];
1165  rigphase=proportion*rigphase;
1166  souphase=proportion*souphase;
1167  rigtot=rigtot+rigphase;
1168  soutot=soutot+souphase;
1169  }
1170  double Ev,Gv,Kv,nuv;
1171  double Er,Gr,Kr,nur;
1172  borne.get_VoigtReuss_poly(rigtot,soutot,Kv,Gv,Ev,nuv,Kr,Gr,Er,nur);
1173  statborne.Evoigt=Ev*1e9;
1174  statborne.Kvoigt=Kv/3.*1e9;
1175  statborne.Gvoigt=Gv/2.*1e9;
1176  statborne.nuvoigt=nuv;
1177  statborne.Ereuss=Er*1e9;
1178  statborne.Kreuss=Kr/3.*1e9;
1179  statborne.Greuss=Gr/2.*1e9;
1180  statborne.nureuss=nur;
1181 
1182 }
1183 
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::degre
int degre
Definition: mstruct_generateur_polycristaux.h:38
MG_ELEMENT_TOPOLOGIQUE::supprimer_ccf
virtual void supprimer_ccf(int num)
Definition: mg_element_topologique.cpp:241
MG_EXPORT
Definition: mg_export.h:33
MG_GESTIONNAIRE::enregistrer
virtual void enregistrer(std::ostream &o, double version=MAGIC_VERSION_FICHIER_DOUBLE)
Definition: mg_gestionnaire.cpp:1070
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE
Definition: mstruct_generateur_polycristaux.h:56
FEM_SOLUTION::get_nb_champ
int get_nb_champ(void)
Definition: fem_solution.cpp:467
MG_MAILLAGE::ajouter_mg_tetra
MG_TETRA * ajouter_mg_tetra(MG_ELEMENT_TOPOLOGIQUE *topo, class MG_NOEUD *mgnoeud1, class MG_NOEUD *mgnoeud2, class MG_NOEUD *mgnoeud3, class MG_NOEUD *mgnoeud4, int origine, unsigned long num=0)
Definition: mg_maillage.cpp:1158
TPL_MAP_ENTITE::get_premier
virtual X get_premier(ITERATEUR &it)
Definition: tpl_map_entite.h:112
MGASTER::calcule
virtual int calcule(char *nomfichierparam, class FEM_MAILLAGE *fem, char *nometude, int typeetude, char *code=NULL, bool avecenreg=true)
Definition: mgaster.cpp:62
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT()
Definition: mstruct_generateur_polycristaux.cpp:52
FEM_SOLUTION
Definition: fem_solution.h:40
MG_SEGMENT
Definition: mg_segment.h:38
FEM_MAILLAGE::get_suivant_element3
FEM_ELEMENT3 * get_suivant_element3(LISTE_FEM_ELEMENT3::iterator &it)
Definition: fem_maillage.cpp:680
MG_ELEMENT_TOPOLOGIQUE::ajouter_ccf
virtual void ajouter_ccf(char *nom, double val, std::string suiv="NS")
Definition: mg_element_topologique.cpp:159
MG_VOLUME::get_propriete_massique
virtual void get_propriete_massique(class MG_MAILLAGE *mai, double &masse, double &volume, class OT_VECTEUR_3D &cdm, class OT_MATRICE_3D &inertieglobale, class OT_MATRICE_3D &inertiecdm, double dens=1., int sens=1)
Definition: mg_volume.cpp:220
MG_TETRA::get_noeud2
virtual MG_NOEUD * get_noeud2(void)
Definition: mg_tetra.cpp:148
gestionversion.h
MG_GESTIONNAIRE::ajouter_fem_maillage
int ajouter_fem_maillage(FEM_MAILLAGE *femmai)
Definition: mg_gestionnaire.cpp:641
mstruct_outils.h
MSTRUCT::MECANIQUE
@ MECANIQUE
Definition: mstruct_definition.h:28
MAGIC_AFFICHE::active_affichage
virtual void active_affichage(fonction_affiche *fonc)
Definition: magic_affiche.cpp:49
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::tens2
double tens2[9]
Definition: mstruct_generateur_polycristaux.h:42
MG_GEOMETRIE::change_valeur_unite
void change_valeur_unite(double val)
Definition: mg_geometrie.cpp:2657
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::dg
double dg
Definition: mstruct_generateur_polycristaux.h:39
TPL_MAP_ENTITE
Definition: tpl_map_entite.h:35
MG_GESTIONNAIRE::supprimer_tout_fem_solution
void supprimer_tout_fem_solution(void)
Definition: mg_gestionnaire.cpp:1017
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::Greuss
double Greuss
Definition: mstruct_generateur_polycristaux.h:62
MSTRUCT_BORNE
Definition: mstruct_borne.h:10
OT_PARAMETRES::get_valeur
double get_valeur(std::string chaine, int num=0)
Definition: ot_parametres.cpp:191
BOITE_3D::get_xmin
double get_xmin(void)
Definition: ot_boite_3d.cpp:104
MG_GEOMETRIE::get_suivant_volume
MG_VOLUME * get_suivant_volume(LISTE_MG_VOLUME::iterator &it)
Definition: mg_geometrie.cpp:1702
FCT_TAILLE_FEM_SOLUTION_GENERATEUR_ISOTROPE::construit
virtual void construit(void)
Definition: fct_taille_fem_solution_generateur_isotrope.cpp:66
mailleur2d.h
MG_EXPORT::ecrire_params_aster
void ecrire_params_aster(char *fichier)
Definition: mg_export.cpp:115
OCC_IMPORT::importer_fichier_brep_V2017
class MG_GEOMETRIE * importer_fichier_brep_V2017(class MG_GESTIONNAIRE &gest, char *path_brep, char *nom_caf, int typefichier, double precision=1e-6, bool fusionner_entite_similaire=false)
Definition: occ_import.cpp:92
mstruct_borne.h
MG_TETRA::get_noeud1
virtual MG_NOEUD * get_noeud1(void)
Definition: mg_tetra.cpp:143
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::nuvoigt
double nuvoigt
Definition: mstruct_generateur_polycristaux.h:62
TPL_GRILLE::inserer
virtual void inserer(A a)
Definition: tpl_grille.h:274
MG_GEOMETRIE::get_nb_mg_arete
unsigned int get_nb_mg_arete(void)
Definition: mg_geometrie.cpp:813
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::Kvoigt
double Kvoigt
Definition: mstruct_generateur_polycristaux.h:62
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::KDH
double KDH
Definition: mstruct_generateur_polycristaux.h:40
OT_PARAMETRES::STRING
@ STRING
Definition: ot_parametres.h:38
OT_PARAMETRES::ajouter
void ajouter(std::string chaine, double valeur, int typep, std::string aide="")
Definition: ot_parametres.cpp:61
MAILLEUR3D::maille
virtual int maille(MG_GROUPE_TOPOLOGIQUE *mggt=NULL)
Definition: mailleur3d.cpp:55
mg_file.h
TPL_GRILLE
Definition: tpl_grille.h:121
FEM_ELEMENT3
Definition: fem_element3.h:34
MSTRUCT_GENERATEUR_POLYCRISTAUX::MSTRUCT_GENERATEUR_POLYCRISTAUX
MSTRUCT_GENERATEUR_POLYCRISTAUX()
Definition: mstruct_generateur_polycristaux.cpp:101
MSTRUCT_GENERATEUR_POLYCRISTAUX::affiche
virtual void affiche(char *mess)
Definition: mstruct_generateur_polycristaux.cpp:145
mailleur_analyse.h
MG_GEOMETRIE::get_premier_point
MG_POINT * get_premier_point(LISTE_MG_POINT::iterator &it)
Definition: mg_geometrie.cpp:233
MG_VOLUME
Definition: mg_volume.h:33
MG_GESTIONNAIRE
Definition: mg_gestionnaire.h:57
MG_MAILLAGE::get_premier_segment
MG_SEGMENT * get_premier_segment(LISTE_MG_SEGMENT::iterator &)
Definition: mg_maillage.cpp:630
MAILLEUR3D
Definition: mailleur3d.h:51
MSTRUCT_GENERATEUR_POLYCRISTAUX::ini_param
virtual void ini_param(char *nom)
Definition: mstruct_generateur_polycristaux.cpp:150
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::EDH
double EDH
Definition: mstruct_generateur_polycristaux.h:40
MSTRUCT_GENERATEUR_POLYCRISTAUX::~MSTRUCT_GENERATEUR_POLYCRISTAUX
~MSTRUCT_GENERATEUR_POLYCRISTAUX()
Definition: mstruct_generateur_polycristaux.cpp:134
MG_TETRA
Definition: mg_tetra.h:37
MSTRUCT_GENERATEUR_POLYCRISTAUX::cree_param
virtual void cree_param(char *nom, char *nomexe)
Definition: mstruct_generateur_polycristaux.cpp:208
FICHIEROCC
#define FICHIEROCC
Definition: occ_import.h:58
MAILLEUR2D
Definition: mailleur2d.h:49
MAILLEUR1D
Definition: mailleur1d.h:36
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::tens1
double tens1[9]
Definition: mstruct_generateur_polycristaux.h:42
MAILLEUR0D
Definition: mailleur0d.h:34
occ_import.h
MG_ARETE::get_tmin
virtual double get_tmin(void)
Definition: mg_arete.cpp:179
MG_GESTIONNAIRE::get_fem_solution
FEM_SOLUTION * get_fem_solution(unsigned int num)
Definition: mg_gestionnaire.cpp:930
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::volume
std::vector< double > volume
Definition: mstruct_generateur_polycristaux.h:46
BOITE_3D::get_zmax
double get_zmax(void)
Definition: ot_boite_3d.cpp:129
MGASTER
Definition: mgaster.h:29
BOITE_3D::get_ymin
double get_ymin(void)
Definition: ot_boite_3d.cpp:114
MG_GESTIONNAIRE::ajouter_mg_maillage
int ajouter_mg_maillage(MG_MAILLAGE *mgmai)
Definition: mg_gestionnaire.cpp:521
MG_GESTIONNAIRE::supprimer_mg_maillage
int supprimer_mg_maillage(unsigned int num)
Definition: mg_gestionnaire.cpp:602
MSTRUCT_GENERATEUR_POLYCRISTAUX::active_affichage
virtual void active_affichage(fonction_affiche *fonc)
Definition: mstruct_generateur_polycristaux.cpp:139
MSTRUCT_GENERATEUR_POLYCRISTAUX::optimise_maillage
void optimise_maillage(MG_MAILLAGE *mai)
Definition: mstruct_generateur_polycristaux.cpp:1066
fct_taille_fem_solution_generateur_gradient.h
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::masse
std::vector< double > masse
Definition: mstruct_generateur_polycristaux.h:45
mgaster.h
OCC_IMPORT::importer_triangulation_V2017
class MG_MAILLAGE * importer_triangulation_V2017(class MG_GESTIONNAIRE &gest, MG_GEOMETRIE *mggeo, double epsilon=1., int mode=1)
Definition: occ_import.cpp:1122
MSTRUCT_GENERATEUR_POLYCRISTAUX::calcule_borne
virtual void calcule_borne(MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE &statborne, MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT &echantillon)
Definition: mstruct_generateur_polycristaux.cpp:1146
DEVIATORIQUE
@ DEVIATORIQUE
Definition: ve_definition.h:47
OT_TENSEUR
Definition: ot_tenseur.h:41
MG_EXPORT::change_param_aster
void change_param_aster(char *nomparam, double val)
Definition: mg_export.cpp:105
CONTRAINTE_HOMOGENE
@ CONTRAINTE_HOMOGENE
Definition: ve_definition.h:42
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::Kreuss
double Kreuss
Definition: mstruct_generateur_polycristaux.h:62
mg_export.h
MG_MAILLAGE::supprimer_mg_tetraid
int supprimer_mg_tetraid(unsigned long num)
Definition: mg_maillage.cpp:1268
lc_point.h
MSTRUCT_GENERATEUR_POLYCRISTAUX
Definition: mstruct_generateur_polycristaux.h:68
BOITE_3D::get_xmax
double get_xmax(void)
Definition: ot_boite_3d.cpp:109
OT_PARAMETRES::get_nom
std::string get_nom(std::string chaine)
Definition: ot_parametres.cpp:266
FEM_MAILLAGE
Definition: fem_maillage.h:66
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::Gvoigt
double Gvoigt
Definition: mstruct_generateur_polycristaux.h:62
OT_PARAMETRES::DOUBLE
@ DOUBLE
Definition: ot_parametres.h:38
TPL_MAP_ENTITE::get_nb
virtual int get_nb(void)
Definition: tpl_map_entite.h:83
MG_ELEMENT_TOPOLOGIQUE::get_nb_ccf
virtual int get_nb_ccf(void)
Definition: mg_element_topologique.cpp:154
MG_NOEUD
Definition: mg_noeud.h:41
OT_MATRICE_3D
Definition: ot_mathematique.h:160
TPL_GRILLE::rechercher
virtual void rechercher(BOITE_3D bt, TPL_MAP_ENTITE< A > &liste_entite_trouve)
Definition: tpl_grille.h:202
MG_GEOMETRIE::get_mg_arete
MG_ARETE * get_mg_arete(unsigned int num)
Definition: mg_geometrie.cpp:800
MG_MAILLAGE::get_suivant_segment
MG_SEGMENT * get_suivant_segment(LISTE_MG_SEGMENT::iterator &)
Definition: mg_maillage.cpp:638
tpl_grille.h
MG_GESTIONNAIRE::get_fem_maillage
FEM_MAILLAGE * get_fem_maillage(unsigned int num)
Definition: mg_gestionnaire.cpp:670
mailleur1d.h
TPL_LISTE_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_liste_entite.h:38
MG_NOEUD::get_coord
virtual double * get_coord(void)
Definition: mg_noeud.cpp:92
TPL_MAP_ENTITE::ITERATEUR
std::map< unsigned long, X, std::less< unsigned long > >::iterator ITERATEUR
Definition: tpl_map_entite.h:38
MSTRUCT_GENERATEUR_POLYCRISTAUX::calcule_cacteristique_mecanique
int calcule_cacteristique_mecanique(MG_GESTIONNAIRE *gest, FEM_MAILLAGE *fem, double &epsx, double &epsy, double &epsz, double &epsxy, double &epsxz, double &epsyz, double &sigx, double &sigy, double &sigz, double &sigxy, double &sigxz, double &sigyz)
Definition: mstruct_generateur_polycristaux.cpp:1022
MG_GESTIONNAIRE::get_mg_maillage
MG_MAILLAGE * get_mg_maillage(unsigned int num)
Definition: mg_gestionnaire.cpp:550
MAILLEUR_FEM::maille
virtual int maille(class FEM_MAILLAGE *fem, bool courbure_discrete=false, int num=0)
Definition: mailleur_fem.cpp:66
TPL_LISTE_ENTITE::get_nb
virtual int get_nb(void)
Definition: tpl_liste_entite.h:67
MG_SOMMET::get_point
virtual MG_POINT * get_point(void)
Definition: mg_sommet.cpp:52
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::Evoigt
double Evoigt
Definition: mstruct_generateur_polycristaux.h:62
MG_POINT
Definition: mg_point.h:33
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT
Definition: mstruct_generateur_polycristaux.h:31
MG_FILE
Definition: mg_file.h:31
MG_NOEUD::get_lien_tetra
TPL_LISTE_ENTITE< class MG_TETRA * > * get_lien_tetra(void)
Definition: mg_noeud.cpp:175
FEM_SOLUTION::get_nom
std::string get_nom(void)
Definition: fem_solution.cpp:834
MSTRUCT_GENERATEUR_POLYCRISTAUX::affiche2
fonction_affiche * affiche2
Definition: mstruct_generateur_polycristaux.h:86
mstruct_definition.h
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::~MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE
virtual ~MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE()
Definition: mstruct_generateur_polycristaux.cpp:95
MG_COSOMMET::get_sommet
virtual MG_SOMMET * get_sommet(void)
Definition: mg_cosommet.cpp:83
TPL_LISTE_ENTITE::get
virtual X get(int num)
Definition: tpl_liste_entite.h:72
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::cdm
std::vector< OT_VECTEUR_3D > cdm
Definition: mstruct_generateur_polycristaux.h:47
POLY_AFFICHE::active_affichage
virtual void active_affichage(fonction_affiche *fonc)
Definition: poly_affiche.cpp:36
BOITE_3D::get_ymax
double get_ymax(void)
Definition: ot_boite_3d.cpp:119
OPERATEUR::qualite_tetra
static double qualite_tetra(double *noeud1, double *noeud2, double *noeud3, double *noeud4)
Definition: ot_mathematique.cpp:1673
MSTRUCT_BORNE::get_tenseur_rigidite
void get_tenseur_rigidite(double E1, double E2, double E3, double G1, double G2, double G3, double nu1, double nu2, double nu3, OT_TENSEUR &rigE)
Definition: mstruct_borne.cpp:80
MAILLEUR_FEM
Definition: mailleur_fem.h:31
MSTRUCT_GENERATEUR_POLYCRISTAUX::param
OT_PARAMETRES param
Definition: mstruct_generateur_polycristaux.h:90
FCT_TAILLE_FEM_SOLUTION::enregistrer
virtual void enregistrer(char *nom)
Definition: fct_taille_fem_solution.cpp:337
polycristal.h
OT_PARAMETRES::enregistrer
void enregistrer(char *nom)
Definition: ot_parametres.cpp:132
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::nbphase
int nbphase
Definition: mstruct_generateur_polycristaux.h:43
acos
double2 acos(double2 &val)
Definition: ot_doubleprecision.cpp:224
OT_VECTEUR_3D
Definition: ot_mathematique.h:94
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::KCH
double KCH
Definition: mstruct_generateur_polycristaux.h:41
TPL_MAP_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_map_entite.h:55
MG_GEOMETRIE::get_nb_mg_volume
unsigned int get_nb_mg_volume(void)
Definition: mg_geometrie.cpp:1712
Polycristal::construit
virtual void construit(bool avecstep=false)
Definition: polycristal.cpp:75
BOITE_3D
Definition: ot_boite_3d.h:27
MAGIC::CALCUL_ASTER::ELASTIQUE
@ ELASTIQUE
Definition: mg_definition.h:134
MG_TETRA::get_noeud4
virtual MG_NOEUD * get_noeud4(void)
Definition: mg_tetra.cpp:158
POLYCRISTAUX::POINT_TIRE
Definition: mstruct_generateur_polycristaux.h:96
MSTRUCT_BORNE::get_VoigtReuss_poly
void get_VoigtReuss_poly(double c11, double c12, double c13, double c23, double c22, double c33, double c44, double c55, double c66, double &troisKvoigt, double &deuxGvoigt, double &Evoigt, double &nuvoigt, double &troisKreuss, double &deuxGreuss, double &Ereuss, double &nureuss)
Definition: mstruct_borne.cpp:22
MG_GEOMETRIE::efface_ccf
void efface_ccf(bool volume, bool face, bool arete, bool sommet)
Definition: mg_geometrie.cpp:2717
mstruct_generateur_polycristaux.h
FEM_SOLUTION::get_moyenne_volumique_champs
double get_moyenne_volumique_champs(class MG_VOLUME *vol, int numchamps, int coord=0)
Definition: fem_solution.cpp:564
mailleur3d.h
MAILLEUR1D::maille
int maille(MG_GROUPE_TOPOLOGIQUE *mggt=NULL)
Definition: mailleur1d.cpp:50
MG_GEOMETRIE::ajouter_mg_point
virtual int ajouter_mg_point(MG_POINT *mgpt)
Definition: mg_geometrie.cpp:137
LC_POINT
Definition: lc_point.h:30
MG_GESTIONNAIRE::supprimer_tout_fem_maillage
void supprimer_tout_fem_maillage(void)
Definition: mg_gestionnaire.cpp:723
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::tens3
double tens3[9]
Definition: mstruct_generateur_polycristaux.h:42
SPHERIQUE
@ SPHERIQUE
Definition: ve_definition.h:46
MAILLEUR2D::maille
int maille(MG_GROUPE_TOPOLOGIQUE *mggt=NULL)
Definition: mailleur2d.cpp:49
FCT_TAILLE_FEM_SOLUTION_GENERATEUR_GRADIENT
Definition: fct_taille_fem_solution_generateur_gradient.h:28
MG_ELEMENT_MAILLAGE::get_lien_topologie
MG_ELEMENT_TOPOLOGIQUE * get_lien_topologie(void)
Definition: mg_element_maillage.cpp:51
MSTRUCT_GENERATEUR_POLYCRISTAUX::affichageactif
int affichageactif
Definition: mstruct_generateur_polycristaux.h:87
MG_GESTIONNAIRE::get_nb_mg_maillage
unsigned int get_nb_mg_maillage(void)
Definition: mg_gestionnaire.cpp:579
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::nbcristauxphase
std::vector< int > nbcristauxphase
Definition: mstruct_generateur_polycristaux.h:44
MG_TETRA::get_noeud3
virtual MG_NOEUD * get_noeud3(void)
Definition: mg_tetra.cpp:153
MG_GEOMETRIE::get_premier_volume
MG_VOLUME * get_premier_volume(LISTE_MG_VOLUME::iterator &it)
Definition: mg_geometrie.cpp:1694
BOITE_3D::get_zmin
double get_zmin(void)
Definition: ot_boite_3d.cpp:124
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::nureuss
double nureuss
Definition: mstruct_generateur_polycristaux.h:62
MGASTER::active_affichage
virtual void active_affichage(void(*fonc)(char *))
Definition: mgaster.cpp:56
MG_GEOMETRIE
Definition: mg_geometrie.h:84
OT_PARAMETRES::lire
int lire(char *nom)
Definition: ot_parametres.cpp:144
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::nbcristaux
int nbcristaux
Definition: mstruct_generateur_polycristaux.h:37
OT_VECTEUR_3D::get_longueur
virtual double get_longueur(void) const
Definition: ot_mathematique.cpp:483
MG_MAILLAGE
Definition: mg_maillage.h:62
TPL_LISTE_ENTITE< MG_NOEUD * >
mailleur_fem.h
fonction_affiche
void fonction_affiche(char *)
Definition: fct_taille.h:28
Polycristal
Definition: polycristal.h:31
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE()
Definition: mstruct_generateur_polycristaux.cpp:79
MSTRUCT_GENERATEUR_POLYCRISTAUX_BORNE::Ereuss
double Ereuss
Definition: mstruct_generateur_polycristaux.h:62
MSTRUCT_OUTILS::appliquer_conditions_limites
static int appliquer_conditions_limites(MG_GEOMETRIE *m_mg_geometrie, BOITE_3D boite3D_ves, int Type_etude, int Type_CL, int Type_Chargement, double Valeur_CL, int Direction=0, double eps=1.0e-06)
Definition: mstruct_outils.cpp:885
MG_ARETE
Definition: mg_arete.h:36
existe
int existe(const std::vector< T > &vct, double val, int &idx)
MG_GESTIONNAIRE::get_nb_fem_solution
unsigned int get_nb_fem_solution(void)
Definition: mg_gestionnaire.cpp:960
BOITE_3D::change_grosseur
void change_grosseur(double f)
Definition: ot_boite_3d.cpp:176
MG_ARETE::get_cosommet1
virtual class MG_COSOMMET * get_cosommet1(void)
Definition: mg_arete.cpp:81
TPL_MAP_ENTITE::get_suivant
virtual X get_suivant(ITERATEUR &it)
Definition: tpl_map_entite.h:120
MG_ARETE::get_longueur
virtual double get_longueur(double t1, double t2, double precis=1e-6)
Definition: mg_arete.cpp:193
cos
double2 cos(double2 &val)
Definition: ot_doubleprecision.cpp:206
MAGIC::ORIGINE::MAILLEUR_AUTO
@ MAILLEUR_AUTO
Definition: mg_definition.h:79
TPL_GRILLE::initialiser
virtual void initialiser(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, int nb_pasx, int nb_pasy, int nb_pasz)
Definition: tpl_grille.h:142
MG_GESTIONNAIRE::get_mg_geometrie
MG_GEOMETRIE * get_mg_geometrie(unsigned int num)
Definition: mg_gestionnaire.cpp:331
MSTRUCT_GENERATEUR_POLYCRISTAUX::genere
virtual void genere(char *nommagic)
Definition: mstruct_generateur_polycristaux.cpp:281
TPL_MAP_ENTITE::vide
virtual void vide(void)
Definition: tpl_map_entite.h:106
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::GCH
double GCH
Definition: mstruct_generateur_polycristaux.h:41
OCC_IMPORT
Definition: occ_import.h:60
DEFORMATION_HOMOGENE
@ DEFORMATION_HOMOGENE
Definition: ve_definition.h:41
MG_ARETE::get_tmax
virtual double get_tmax(void)
Definition: mg_arete.cpp:184
MG_GEOMETRIE::get_suivant_point
MG_POINT * get_suivant_point(LISTE_MG_POINT::iterator &it)
Definition: mg_geometrie.cpp:241
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::ECH
double ECH
Definition: mstruct_generateur_polycristaux.h:41
MAILLEUR0D::maille
int maille(MG_GROUPE_TOPOLOGIQUE *mggt=NULL)
Definition: mailleur0d.cpp:43
MG_POINT::evaluer
virtual void evaluer(double *xyz)=0
mailleur0d.h
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::GDH
double GDH
Definition: mstruct_generateur_polycristaux.h:40
FEM_MAILLAGE::get_premier_element3
FEM_ELEMENT3 * get_premier_element3(LISTE_FEM_ELEMENT3::iterator &it)
Definition: fem_maillage.cpp:672
MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT::~MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT
virtual ~MSTRUCT_GENERATEUR_POLYCRISTAUX_RESULTAT()
Definition: mstruct_generateur_polycristaux.cpp:74
sin
double2 sin(double2 &val)
Definition: ot_doubleprecision.cpp:250
OT_PARAMETRES::change_valeur
void change_valeur(std::string chaine, double val, int num=0)
Definition: ot_parametres.cpp:210