MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
mstruct_generateur_rsa.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_rsa.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:56 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #include "mstruct_generateur_rsa.h"
23 #include "mstruct_definition.h"
24 #include "mg_gestionnaire.h"
25 #include "mg_cg.h"
26 #include "mg_cg_modele.h"
27 #include "mg_cg_assemblage.h"
28 #include "mg_cg_info.h"
29 #include "mg_cg_groupe_forme.h"
30 #include "mg_cg_forme_volume.h"
41 #include "mg_sous_geometrie.h"
42 #include "mstruct_ves.h"
43 #include "tpl_grille.h"
44 #include "ot_geometrie.h"
45 #include "mg_point.h"
46 #include <random>
47 #include <vector>
48 #include <stack>
49 
50 
51 
52 MSTRUCT_GENERATEUR_RSA::MSTRUCT_GENERATEUR_RSA(MG_GESTIONNAIRE* mg_gestionnaire, char* nom_mgcg_modele): MSTRUCT_GENERATEUR(mg_gestionnaire, nom_mgcg_modele)
53 {
54  m_boite3d_ves=BOITE_3D(0.0,0.0,0.0,1.0,1.0,1.0);
57  m_angle_min=0.0;
58  m_longueur_min=0.0;
59  m_aire_min=0.0;
60  m_volume_min=0.0;
61  m_distance_min=0.0;
62  m_nb_iteration_max=std::numeric_limits<long>::max();
63  m_nb_pas_grille=20;
65  m_precision=1.e-06;
66  m_grille_init=false;
67  m_matrice=NULL;
68 }
69 
70 
72  char* nom_mgcg_modele,
73  BOITE_3D boite3d_ves, BOITE_3D boite3d_distribution,
74  int nb_pas_x, int nb_pas_y, int nb_pas_z): MSTRUCT_GENERATEUR(mg_gestionnaire,nom_mgcg_modele)
75 {
76  m_boite3d_ves=boite3d_ves;
77  m_boite3d_distribution=boite3d_distribution;
78  m_nb_pas_x=nb_pas_x;
79  m_nb_pas_y=nb_pas_y;
80  m_nb_pas_z=nb_pas_z;
83  nb_pas_x,nb_pas_y,nb_pas_z);
84  m_matrice=NULL;
85 }
86 
88 {
89  m_nb_iteration_max=std::numeric_limits<long>::max();
90 }
91 
92 
94 {
95 }
96 
98 {
100 }
101 
102 
103 
104 void MSTRUCT_GENERATEUR_RSA::change_nb_iteration_max(long int nb_iteration_max)
105 {
106  m_nb_iteration_max=nb_iteration_max;
107 }
108 
109 
110 
111 
113  double mu_rayon, double sigma_rayon,int type_distribution_rayon,
114  double fraction_volumique_cible, double eps_frac_vol,
115  double &fraction_volumique_actuelle,
116  std::vector< double >* vector_epaisseur_couches,
117  bool porosite)
118 {
119  char message[1000];
121  std::vector<MG_CG_GROUPE_FORME*> vct_groupe_forme;
122  cree_vector_groupe_forme(nom,vct_groupe_forme,vector_epaisseur_couches);
123  std::random_device seed;
124  std::mt19937_64 generateur(seed());
125 
126 
127  std::uniform_real_distribution<double> uniform_distribution_position_x(m_boite3d_distribution.get_xmin(),m_boite3d_distribution.get_xmax());
128  std::uniform_real_distribution<double> uniform_distribution_position_y(m_boite3d_distribution.get_ymin(),m_boite3d_distribution.get_ymax());
129  std::uniform_real_distribution<double> uniform_distribution_position_z(m_boite3d_distribution.get_zmin(),m_boite3d_distribution.get_zmax());
130 
131 
132  std::normal_distribution<double> normal_distribution_rayon(mu_rayon,sigma_rayon);
133  std::uniform_real_distribution<double> uniform_distribution_rayon(mu_rayon-sigma_rayon,mu_rayon+sigma_rayon);
134  if(m_matrice==NULL)
135  {
141  }
143  {
144  fraction_volumique_cible=fraction_volumique_cible*m_boite3d_distribution.get_volume()/m_boite3d_ves.get_volume();
145  }
146 
147 
148  //-------------------------------------------------------------------
149  double fraction_volumique=fraction_volumique_actuelle;
150  long iteration=0;
151  long nb_inclusion=0;
152  while(fraction_volumique<fraction_volumique_cible-eps_frac_vol && iteration<m_nb_iteration_max)
153  {
154  double centre[3];
155  centre[0]=uniform_distribution_position_x(generateur);
156  centre[1]=uniform_distribution_position_y(generateur);
157  centre[2]=uniform_distribution_position_z(generateur);
158  double rayon=-1;
159 
160  if(type_distribution_rayon==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon<0.0) rayon=mu_rayon;
161 
162  else if(type_distribution_rayon==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon<0.0) rayon=uniform_distribution_rayon(generateur);
163 
164  else if(type_distribution_rayon==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon<0.0) rayon=normal_distribution_rayon(generateur);
165 
166  MG_CG_FORME_VOLUME_SPHERE* sphere_test = MG_CG::creer_MG_CG_FORME_VOLUME_SPHERE(m_mgcg_modele,centre[0],centre[1],centre[2],rayon);
167  sphere_test->construire();
168  std::vector<MG_CG_FORME*> vector_forme;
169  int position_relative;
170  if(insertion_inclusion(sphere_test,fraction_volumique_cible,eps_frac_vol,fraction_volumique,vector_forme,position_relative,vector_epaisseur_couches,porosite)==OK)
171  {
172  nb_inclusion++;
173  std::vector<MG_CG_FORME*>::iterator it_forme;
174  std::vector<MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
175  it_groupe_forme=vct_groupe_forme.begin();
176  for(it_forme=vector_forme.begin();it_forme!=vector_forme.end();it_forme++,it_groupe_forme++)
177  {
178  MG_CG_FORME* forme=*it_forme;
179  MG_CG_GROUPE_FORME* groupe_forme=*it_groupe_forme;
180  groupe_forme->ajouter_mgcg_forme(forme);
181  if(it_forme==vector_forme.begin())
182  {
183  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"CENTRE",3,centre);
184  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON",rayon);
185  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ID_FORME_INI",sphere_test->get_id());
186  }
187  if(porosite)
188  {
189  MG_CG::creer_MG_CG_INFO_STRING(forme,(char*)"POROSITE",(char*)"1");
190  }
191  }
192  char position[100];
193  if(position_relative==MSTRUCT::POSITION_RELATIVE::INTERIEUR) sprintf(position,"Interieur");
194  else if(position_relative==MSTRUCT::POSITION_RELATIVE::AU_BORD) sprintf(position,"Au_bord");
195  sprintf(message,"IT [%6li/%6li max] : Sphere # [%4li] : Fraction volumique [%.6lf / %.6lf] : Position %s",
196  iteration,m_nb_iteration_max,nb_inclusion,fraction_volumique,fraction_volumique_cible,position);
197  affiche(message);
198  }
199  iteration++;
200  }
201  fraction_volumique_actuelle=fraction_volumique;
202  return fraction_volumique;
203 }
204 
205 
207  double mu_rayon, double sigma_rayon, int type_distribution_rayon,
208  double mu_longueur, double sigma_longueur, int type_distribution_longueur,
209  double mu_theta, double sigma_theta, int type_distribution_theta,
210  double mu_phi, double sigma_phi, int type_distribution_phi,
211  double fraction_volumique_cible, double eps_frac_vol,
212  double &fraction_volumique_actuelle,
213  std::vector< double >* vector_epaisseur_couches,
214  bool porosite)
215 {
216  char message[1000];
218  std::vector<MG_CG_GROUPE_FORME*> vct_groupe_forme;
219  cree_vector_groupe_forme(nom,vct_groupe_forme,vector_epaisseur_couches);
220  std::random_device seed;
221  std::mt19937_64 generateur(seed());
222  std::uniform_real_distribution<double> uniform_distribution_position_x(m_boite3d_distribution.get_xmin(),m_boite3d_distribution.get_xmax());
223  std::uniform_real_distribution<double> uniform_distribution_position_y(m_boite3d_distribution.get_ymin(),m_boite3d_distribution.get_ymax());
224  std::uniform_real_distribution<double> uniform_distribution_position_z(m_boite3d_distribution.get_zmin(),m_boite3d_distribution.get_zmax());
225 
226 
227  std::normal_distribution<double> normal_distribution_rayon(mu_rayon,sigma_rayon);
228  std::uniform_real_distribution<double> uniform_distribution_rayon(mu_rayon-sigma_rayon,mu_rayon+sigma_rayon);
229  std::normal_distribution<double> normal_distribution_longueur(mu_longueur,sigma_longueur);
230  std::uniform_real_distribution<double> uniform_distribution_longueur(mu_longueur-sigma_longueur,mu_longueur+sigma_longueur);
231  std::normal_distribution<double> normal_distribution_theta(mu_theta,sigma_theta);
232  std::uniform_real_distribution<double> uniform_distribution_theta(0,sigma_theta);
233  std::normal_distribution<double> normal_distribution_phi(mu_phi,sigma_phi);
234  std::uniform_real_distribution<double> uniform_distribution_phi(0,sigma_phi);
235  if(m_matrice==NULL)
236  {
242  }
244  {
245  fraction_volumique_cible=fraction_volumique_cible*m_boite3d_distribution.get_volume()/m_boite3d_ves.get_volume();
246  }
247  double fraction_volumique=fraction_volumique_actuelle;
248  long iteration=0;
249  long nb_inclusion=0;
250  while(fraction_volumique<fraction_volumique_cible-eps_frac_vol && iteration<m_nb_iteration_max)
251  {
252  double extremite[3];
253  extremite[0]=uniform_distribution_position_x(generateur);
254  extremite[1]=uniform_distribution_position_y(generateur);
255  extremite[2]=uniform_distribution_position_z(generateur);
256  double rayon=-1;
257  if(type_distribution_rayon==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon<0.0) rayon=mu_rayon;
258  else if(type_distribution_rayon==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon<0.0) rayon=uniform_distribution_rayon(generateur);
259  else if(type_distribution_rayon==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon<0.0) rayon=normal_distribution_rayon(generateur);
260  double longueur=-1;
261  if(type_distribution_longueur==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(longueur<0.0) longueur=mu_longueur;
262  else if(type_distribution_longueur==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(longueur<0.0) longueur=uniform_distribution_longueur(generateur);
263  else if(type_distribution_longueur==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(longueur<0.0) longueur=normal_distribution_longueur(generateur);
264  double theta=-1;
265  if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(theta<0.0) theta=mu_theta;
266  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(theta<0.0) theta=uniform_distribution_theta(generateur);
267  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(theta<0.0) theta=normal_distribution_theta(generateur);
268  double phi=-1;
269  if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(phi<0.0) phi=mu_phi;
270  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(phi<0.0) phi=uniform_distribution_phi(generateur);
271  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(phi<0.0) phi=normal_distribution_phi(generateur);
272 
273 
274 
275 
276  double axe[3];
277  theta = 2.0*M_PI*theta;
278  phi=acos(2.0*phi-1.0);
279  axe[0]=sin(phi)*cos(theta);
280  axe[1]=sin(phi)*sin(theta);
281  axe[2]=cos(phi);
282  OT_VECTEUR_3D vct_axe(axe);
283  vct_axe.norme();
284  axe[0]=vct_axe.get_x();
285  axe[1]=vct_axe.get_y();
286  axe[2]=vct_axe.get_z();
287  MG_CG_FORME_VOLUME_CYLINDRE* cylindre_test = MG_CG::creer_MG_CG_FORME_VOLUME_CYLINDRE(m_mgcg_modele,extremite[0],extremite[1],extremite[2],axe[0],axe[1],axe[2],rayon,longueur);
288  cylindre_test->construire();
289  std::vector<MG_CG_FORME*> vector_forme;
290  int position_relative;
291  if(insertion_inclusion(cylindre_test,fraction_volumique_cible,eps_frac_vol,fraction_volumique,vector_forme,position_relative,vector_epaisseur_couches,porosite)==OK)
292  {
293  nb_inclusion++;
294  std::vector<MG_CG_FORME*>::iterator it_forme;
295  std::vector<MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
296  it_groupe_forme=vct_groupe_forme.begin();
297  for(it_forme=vector_forme.begin();it_forme!=vector_forme.end();it_forme++,it_groupe_forme++)
298  {
299  MG_CG_FORME* forme=*it_forme;
300  MG_CG_GROUPE_FORME* groupe_forme=*it_groupe_forme;
301  groupe_forme->ajouter_mgcg_forme(forme);
302  if(it_forme==vector_forme.begin())
303  {
304  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"EXTREMITE",3,extremite);
305  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"AXE",3,axe);
306  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON",rayon);
307  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"LONGUEUR",longueur);
308  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ID_FORME_INI",cylindre_test->get_id());
309  }
310  if(porosite)
311  {
312  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"POROSITE",1);
313  }
314  }
315  char position[100];
316  if(position_relative==MSTRUCT::POSITION_RELATIVE::INTERIEUR) sprintf(position,"Interieur");
317  else if(position_relative==MSTRUCT::POSITION_RELATIVE::AU_BORD) sprintf(position,"Au_bord");
318  sprintf(message,"IT [%6li/%6li max] : Cylindre # [%4li] : Fraction volumique [%.6lf / %.6lf] : Position %s",
319  iteration,m_nb_iteration_max,nb_inclusion,fraction_volumique,fraction_volumique_cible,position);
320  affiche(message);
321  }
322  iteration++;
323  }
324  fraction_volumique_actuelle=fraction_volumique;
325  return fraction_volumique;
326 }
327 
328 
329  //--------------with 1 angle-------------------------------
330  //==================================================================
331 
333  double mu_rayon_cercle, double sigma_rayon_cercle, int type_distribution_rayon_cercle,
334  double mu_rayon_tore, double sigma_rayon_tore, int type_distribution_rayon_tore,
335  double mu_theta, double sigma_theta, int type_distribution_theta,
336  double mu_phi, double sigma_phi, int type_distribution_phi,
337  double mu_angle_seg, double sigma_angle_seg, int type_distribution_angle_seg,
338  double fraction_volumique_cible, double eps_frac_vol,
339  double &fraction_volumique_actuelle,
340  std::vector< double >* vector_epaisseur_couches,
341  bool porosite)
342 {
343  char message[1000];
345  std::vector<MG_CG_GROUPE_FORME*> vct_groupe_forme;
346  cree_vector_groupe_forme(nom,vct_groupe_forme,vector_epaisseur_couches);
347  std::random_device seed;
348  std::mt19937_64 generateur(seed());
349 
350 
351 
352  std::uniform_real_distribution<double> uniform_distribution_position_x(m_boite3d_distribution.get_xmin(),m_boite3d_distribution.get_xmax());
353  std::uniform_real_distribution<double> uniform_distribution_position_y(m_boite3d_distribution.get_ymin(),m_boite3d_distribution.get_ymax());
354  std::uniform_real_distribution<double> uniform_distribution_position_z(m_boite3d_distribution.get_zmin(),m_boite3d_distribution.get_zmax());
355 
356 
357 
358  std::normal_distribution<double> normal_distribution_rayon_cercle(mu_rayon_cercle,sigma_rayon_cercle);
359  std::uniform_real_distribution<double> uniform_distribution_rayon_cercle(mu_rayon_cercle-sigma_rayon_cercle,mu_rayon_cercle+sigma_rayon_cercle);
360  std::normal_distribution<double> normal_distribution_rayon_tore(mu_rayon_tore,sigma_rayon_tore);
361  std::uniform_real_distribution<double> uniform_distribution_rayon_tore(mu_rayon_tore-sigma_rayon_tore,mu_rayon_tore+sigma_rayon_tore);
362 
363 
364  std::normal_distribution<double> normal_distribution_theta(mu_theta,sigma_theta);
365  std::uniform_real_distribution<double> uniform_distribution_theta(0,sigma_theta);
366  std::normal_distribution<double> normal_distribution_phi(mu_phi,sigma_phi);
367  std::uniform_real_distribution<double> uniform_distribution_phi(0,sigma_phi);
368  //==============================
369 
370  std::normal_distribution<double> normal_distribution_angle_seg(mu_angle_seg,sigma_angle_seg);
371  std::uniform_real_distribution<double> uniform_distribution_angle_seg(0,sigma_angle_seg);
372 
373 
374  if(m_matrice==NULL)
375  {
381  }
383  {
384  fraction_volumique_cible=fraction_volumique_cible*m_boite3d_distribution.get_volume()/m_boite3d_ves.get_volume();
385  }
386  double fraction_volumique=fraction_volumique_actuelle;
387  long iteration=0;
388  long nb_inclusion=0;
389  while(fraction_volumique<fraction_volumique_cible-eps_frac_vol && iteration<m_nb_iteration_max)
390  {
391  //---------------------------------------------------------------
392 
393  // double centre[3];
394  //centre[0]=uniform_distribution_position_x(generateur);
395  //centre[1]=uniform_distribution_position_y(generateur);
396  //centre[2]=uniform_distribution_position_z(generateur);
397 
398 
399  //======================changed==========================
400 
401  double centre_prim[3];
402  centre_prim[0]=uniform_distribution_position_x(generateur);
403  centre_prim[1]=uniform_distribution_position_y(generateur);
404  centre_prim[2]=uniform_distribution_position_z(generateur);
405 
406 
407 
408  double rayon_cercle=-1;
409  if(type_distribution_rayon_cercle==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon_cercle<0.0) rayon_cercle=mu_rayon_cercle;
410  else if(type_distribution_rayon_cercle==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon_cercle<0.0) rayon_cercle=uniform_distribution_rayon_cercle(generateur);
411  else if(type_distribution_rayon_cercle==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon_cercle<0.0) rayon_cercle=normal_distribution_rayon_cercle(generateur);
412 
413  double rayon_tore=-1;
414  if(type_distribution_rayon_tore==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon_tore<0.0) rayon_tore=mu_rayon_tore;
415  else if(type_distribution_rayon_tore==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon_tore<0.0) rayon_tore=uniform_distribution_rayon_tore(generateur);
416  else if(type_distribution_rayon_tore==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon_tore<0.0) rayon_tore=normal_distribution_rayon_tore(generateur);
417 
418 
419 
420  double theta=-1;
421  if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(theta<0.0) theta=mu_theta;
422  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(theta<0.0) theta=uniform_distribution_theta(generateur);
423  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(theta<0.0) theta=normal_distribution_theta(generateur);
424 
425 
426  double phi=-1;
427  if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(phi<0.0) phi=mu_phi;
428  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(phi<0.0) phi=uniform_distribution_phi(generateur);
429  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(phi<0.0) phi=normal_distribution_phi(generateur);
430  //===========================================================================================
431  //===========================================================================================
432  double angle_seg=-1;
433  if(type_distribution_angle_seg==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(angle_seg<0.0) angle_seg=mu_angle_seg;
434  else if(type_distribution_angle_seg==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(angle_seg<0.0) angle_seg=uniform_distribution_angle_seg(generateur);
435  else if(type_distribution_angle_seg==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(angle_seg<0.0) angle_seg=normal_distribution_angle_seg(generateur);
436 
437  double angle_rotation=0.0;
438  angle_rotation=-angle_seg/2.;
439 
440 
441  double axe[3];
442  theta = 2.0*M_PI*theta;
443  phi=acos(2.0*phi-1.0);
444  axe[0]=sin(phi)*cos(theta);
445  axe[1]=sin(phi)*sin(theta);
446  axe[2]=cos(phi);
447  OT_VECTEUR_3D vct_axe(axe);
448  vct_axe.norme();
449  axe[0]=vct_axe.get_x();
450  axe[1]=vct_axe.get_y();
451  axe[2]=vct_axe.get_z();
452 
453 
454  // double centre_loc_prim[3];
455  // centre_loc_prim[0]=((cos(phi)*cos(theta)*centre_prim[0])+(sin(theta)*cos(phi)*centre_prim[1])-(sin(phi)*centre_prim[2]));
456  // centre_loc_prim[1]=((cos(theta)*centre_prim[1])-(sin(theta)*centre_prim[0]));
457  // centre_loc_prim[2]=((sin(phi)*cos(theta)*centre_prim[0])+(sin(phi)*sin(theta)*centre_prim[1])+(cos(phi)*centre_prim[2]));
458 
459 
460  double centre_loc[3];
461  centre_loc[0]=((cos(phi)*cos(theta)*centre_prim[0])+(sin(theta)*cos(phi)*centre_prim[1])-(sin(phi)*centre_prim[2]))-rayon_cercle;
462  centre_loc[1]=((cos(theta)*centre_prim[1])-(sin(theta)*centre_prim[0]));
463  centre_loc[2]=((sin(phi)*cos(theta)*centre_prim[0])+(sin(phi)*sin(theta)*centre_prim[1])+(cos(phi)*centre_prim[2]));
464 
465  double centre[3];
466  centre[0]=(sin(phi)*cos(theta)*centre_loc[2])+(cos(phi)*cos(theta)*centre_loc[0])-(sin(theta)*centre_loc[1]);
467  centre[1]=(sin(phi)*sin(theta)*centre_loc[2])+(sin(theta)*cos(phi)*centre_loc[0])+(cos(theta)*centre_loc[1]);
468  centre[2]=(cos(phi)*centre_loc[2])-(sin(phi)*centre_loc[0]);
469 
470 
471  MG_CG_FORME_VOLUME_TORE* tore_test = MG_CG::creer_MG_CG_FORME_VOLUME_TORE(m_mgcg_modele,centre[0],centre[1],centre[2],axe[0],axe[1],axe[2],rayon_cercle,rayon_tore,angle_seg,angle_rotation);
472  //-------------------------------------
473 
474  //-----------------------------------------------------------------
475  tore_test->construire();
476  std::vector<MG_CG_FORME*> vector_forme;
477  int position_relative;
478 
479  if(insertion_inclusion(tore_test,fraction_volumique_cible,eps_frac_vol,fraction_volumique,vector_forme,position_relative,vector_epaisseur_couches,porosite)==OK)
480  {
481  nb_inclusion++;
482  std::vector<MG_CG_FORME*>::iterator it_forme;
483  std::vector<MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
484  it_groupe_forme=vct_groupe_forme.begin();
485  for(it_forme=vector_forme.begin();it_forme!=vector_forme.end();it_forme++,it_groupe_forme++)
486  {
487  MG_CG_FORME* forme=*it_forme;
488  MG_CG_GROUPE_FORME* groupe_forme=*it_groupe_forme;
489  groupe_forme->ajouter_mgcg_forme(forme);
490  //-----------------------------------------------------------------------
491  if(it_forme==vector_forme.begin())
492  {
493  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"CENTRE",3,centre);
494  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"AXE",3,axe);
495  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON_CERCLE",rayon_cercle);
496  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON_TORE",rayon_tore);
497  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ANGLE_SEG",angle_seg);
498  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ID_FORME_INI",tore_test->get_id());
499  }
500  if(porosite)
501  {
502  //---------DOUBLE OR STRING?????????????________________________________________
503  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"POROSITE",1);
504  }
505  }
506  char position[100];
507  if(position_relative==MSTRUCT::POSITION_RELATIVE::INTERIEUR) sprintf(position,"Interieur");
508  else if(position_relative==MSTRUCT::POSITION_RELATIVE::AU_BORD) sprintf(position,"Au_bord");
509  sprintf(message,"IT [%6li/%6li max] : Torus # [%4li] : Fraction volumique [%.6lf / %.6lf] : Position %s",
510  iteration,m_nb_iteration_max,nb_inclusion,fraction_volumique,fraction_volumique_cible,position);
511  affiche(message);
512  }
513 
514  iteration++;
515  }
516 
517  fraction_volumique_actuelle=fraction_volumique;
518  return fraction_volumique;
519 }
520 
521  //--------------with 2 angle-------------------------------
522  //==================================================================
523 /*
524 
525  double MSTRUCT_GENERATEUR_RSA::tirrage_aleatoire_torus(std::string nom,
526  double mu_rayon_cercle, double sigma_rayon_cercle, int type_distribution_rayon_cercle,
527  double mu_rayon_tore, double sigma_rayon_tore, int type_distribution_rayon_tore,
528  double mu_theta, double sigma_theta, int type_distribution_theta,
529  double mu_phi, double sigma_phi, int type_distribution_phi,
530  double mu_angle_begin, double sigma_angle_begin, int type_distribution_angle_begin,
531  double mu_angle_end, double sigma_angle_end, int type_distribution_angle_end,
532  double fraction_volumique_cible, double eps_frac_vol,
533  double &fraction_volumique_actuelle,
534  std::vector< double >* vector_epaisseur_couches,
535  bool porosite)
536 {
537  char message[1000];
538  initialiser_grille();
539  std::vector<MG_CG_GROUPE_FORME*> vct_groupe_forme;
540  cree_vector_groupe_forme(nom,vct_groupe_forme,vector_epaisseur_couches);
541  std::random_device seed;
542  std::mt19937_64 generateur(seed());
543 
544 
545 
546  std::uniform_real_distribution<double> uniform_distribution_position_x(m_boite3d_distribution.get_xmin(),m_boite3d_distribution.get_xmax());
547  std::uniform_real_distribution<double> uniform_distribution_position_y(m_boite3d_distribution.get_ymin(),m_boite3d_distribution.get_ymax());
548  std::uniform_real_distribution<double> uniform_distribution_position_z(m_boite3d_distribution.get_zmin(),m_boite3d_distribution.get_zmax());
549 
550  std::normal_distribution<double> normal_distribution_rayon_cercle(mu_rayon_cercle,sigma_rayon_cercle);
551  std::uniform_real_distribution<double> uniform_distribution_rayon_cercle(mu_rayon_cercle-sigma_rayon_cercle,mu_rayon_cercle+sigma_rayon_cercle);
552  std::normal_distribution<double> normal_distribution_rayon_tore(mu_rayon_tore,sigma_rayon_tore);
553  std::uniform_real_distribution<double> uniform_distribution_rayon_tore(mu_rayon_tore-sigma_rayon_tore,mu_rayon_tore+sigma_rayon_tore);
554 
555 
556  std::normal_distribution<double> normal_distribution_theta(mu_theta,sigma_theta);
557  std::uniform_real_distribution<double> uniform_distribution_theta(0,sigma_theta);
558  std::normal_distribution<double> normal_distribution_phi(mu_phi,sigma_phi);
559  std::uniform_real_distribution<double> uniform_distribution_phi(0,sigma_phi);
560  //==============================
561 
562  std::normal_distribution<double> normal_distribution_angle_begin(mu_angle_begin,sigma_angle_begin);
563  std::uniform_real_distribution<double> uniform_distribution_angle_begin(0,sigma_angle_begin);
564 
565  std::normal_distribution<double> normal_distribution_angle_end(mu_angle_end,sigma_angle_end);
566  std::uniform_real_distribution<double> uniform_distribution_angle_end(0,sigma_angle_end);
567 
568 
569 
570  if(m_matrice==NULL)
571  {
572  m_matrice=MG_CG::creer_MG_CG_FORME_VOLUME_BOITE(m_mgcg_modele,
573  m_boite3d_ves.get_xmin(),m_boite3d_ves.get_ymin(),m_boite3d_ves.get_zmin(),
574  m_boite3d_ves.get_xmax(),m_boite3d_ves.get_ymax(),m_boite3d_ves.get_zmax());
575  m_matrice->construire();
576  m_cube_initial=(MG_CG_FORME_VOLUME*)m_matrice;
577  }
578  if(m_boite3d_distribution.get_volume()<m_boite3d_ves.get_volume())
579  {
580  fraction_volumique_cible=fraction_volumique_cible*m_boite3d_distribution.get_volume()/m_boite3d_ves.get_volume();
581  }
582  double fraction_volumique=fraction_volumique_actuelle;
583  long iteration=0;
584  long nb_inclusion=0;
585  while(fraction_volumique<fraction_volumique_cible-eps_frac_vol && iteration<m_nb_iteration_max)
586  {
587  //---------------------------------------------------------------
588 
589  double centre[3];
590  centre[0]=uniform_distribution_position_x(generateur);
591  centre[1]=uniform_distribution_position_y(generateur);
592  centre[2]=uniform_distribution_position_z(generateur);
593 
594  double rayon_cercle=-1;
595  if(type_distribution_rayon_cercle==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon_cercle<0.0) rayon_cercle=mu_rayon_cercle;
596  else if(type_distribution_rayon_cercle==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon_cercle<0.0) rayon_cercle=uniform_distribution_rayon_cercle(generateur);
597  else if(type_distribution_rayon_cercle==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon_cercle<0.0) rayon_cercle=normal_distribution_rayon_cercle(generateur);
598 
599  double rayon_tore=-1;
600  if(type_distribution_rayon_tore==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon_tore<0.0) rayon_tore=mu_rayon_tore;
601  else if(type_distribution_rayon_tore==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon_tore<0.0) rayon_tore=uniform_distribution_rayon_tore(generateur);
602  else if(type_distribution_rayon_tore==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon_tore<0.0) rayon_tore=normal_distribution_rayon_tore(generateur);
603 
604 
605  double theta=-1;
606  if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(theta<0.0) theta=mu_theta;
607  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(theta<0.0) theta=uniform_distribution_theta(generateur);
608  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(theta<0.0) theta=normal_distribution_theta(generateur);
609 
610 
611  double phi=-1;
612  if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(phi<0.0) phi=mu_phi;
613  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(phi<0.0) phi=uniform_distribution_phi(generateur);
614  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(phi<0.0) phi=normal_distribution_phi(generateur);
615  //===========================================================================================
616  //===========================================================================================
617  double angle_begin=-1;
618  if(type_distribution_angle_begin==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(angle_begin<0.0) angle_begin=mu_angle_begin;
619  else if(type_distribution_angle_begin==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(angle_begin<0.0) angle_begin=uniform_distribution_angle_begin(generateur);
620  else if(type_distribution_angle_begin==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(angle_begin<0.0) angle_begin=normal_distribution_angle_begin(generateur);
621 
622 
623  double angle_end=-1;
624  if(type_distribution_angle_end==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(angle_end<0.0) angle_end=mu_angle_end;
625  else if(type_distribution_angle_end==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(angle_end<0.0) angle_end=uniform_distribution_angle_end(generateur);
626  else if(type_distribution_angle_end==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(angle_end<0.0) angle_end=normal_distribution_angle_end(generateur);
627 
628 
629 
630  double axe[3];
631  theta = 2.0*M_PI*theta;
632  phi=acos(2.0*phi-1.0);
633  axe[0]=sin(phi)*cos(theta);
634  axe[1]=sin(phi)*sin(theta);
635  axe[2]=cos(phi);
636  OT_VECTEUR_3D vct_axe(axe);
637  vct_axe.norme();
638  axe[0]=vct_axe.get_x();
639  axe[1]=vct_axe.get_y();
640  axe[2]=vct_axe.get_z();
641  //--------------------------------------------------------------------
642 
643  MG_CG_FORME_VOLUME_TORE* tore_test = MG_CG::creer_MG_CG_FORME_VOLUME_TORE(m_mgcg_modele,centre[0],centre[1],centre[2],axe[0],axe[1],axe[2],rayon_cercle,rayon_tore,angle_begin,angle_end);
644 
645  //-----------------------------------------------------------------
646  tore_test->construire();
647  std::vector<MG_CG_FORME*> vector_forme;
648  int position_relative;
649  if(insertion_inclusion(tore_test,fraction_volumique_cible,eps_frac_vol,fraction_volumique,vector_forme,position_relative,vector_epaisseur_couches,porosite)==OK)
650  {
651  nb_inclusion++;
652  std::vector<MG_CG_FORME*>::iterator it_forme;
653  std::vector<MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
654  it_groupe_forme=vct_groupe_forme.begin();
655  for(it_forme=vector_forme.begin();it_forme!=vector_forme.end();it_forme++,it_groupe_forme++)
656  {
657  MG_CG_FORME* forme=*it_forme;
658  MG_CG_GROUPE_FORME* groupe_forme=*it_groupe_forme;
659  groupe_forme->ajouter_mgcg_forme(forme);
660  //-----------------------------------------------------------------------
661  if(it_forme==vector_forme.begin())
662  {
663  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"CENTRE",3,centre);
664  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"AXE",3,axe);
665  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON_CERCLE",rayon_cercle);
666  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON_TORE",rayon_tore);
667  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ANGLEG",angle_begin);
668  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ANGLE2",angle_end);
669  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ID_FORME_INI",tore_test->get_id());
670  }
671  if(porosite)
672  {
673  //---------DOUBLE OR STRING?????????????________________________________________
674  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"POROSITE",1);
675  }
676  }
677  char position[100];
678  if(position_relative==MSTRUCT::POSITION_RELATIVE::INTERIEUR) sprintf(position,"Interieur");
679  else if(position_relative==MSTRUCT::POSITION_RELATIVE::AU_BORD) sprintf(position,"Au_bord");
680  sprintf(message,"IT [%6li/%6li max] : Torus # [%4li] : Fraction volumique [%.6lf / %.6lf] : Position %s",
681  iteration,m_nb_iteration_max,nb_inclusion,fraction_volumique,fraction_volumique_cible,position);
682  affiche(message);
683  }
684  iteration++;
685  }
686  fraction_volumique_actuelle=fraction_volumique;
687  return fraction_volumique;
688 }
689 
690  */
692  double mu_rayon_majeur, double sigma_rayon_majeur, int type_distribution_rayon_majeur,
693  double mu_rayon_mineur, double sigma_rayon_mineur, int type_distribution_rayon_mineur,
694  double mu_theta, double sigma_theta, int type_distribution_theta,
695  double mu_phi, double sigma_phi, int type_distribution_phi,
696  double fraction_volumique_cible , double eps_frac_vol,
697  double& fraction_volumique_actuelle,
698  std::vector<double>* vector_epaisseur_couches,
699  bool porosite)
700 {
701  char message[1000];
703  std::vector<MG_CG_GROUPE_FORME*> vct_groupe_forme;
704  cree_vector_groupe_forme(nom,vct_groupe_forme,vector_epaisseur_couches);
705  std::random_device seed;
706  std::mt19937_64 generateur(seed());
707  std::uniform_real_distribution<double> uniform_distribution_position_x(m_boite3d_distribution.get_xmin(),m_boite3d_distribution.get_xmax());
708  std::uniform_real_distribution<double> uniform_distribution_position_y(m_boite3d_distribution.get_ymin(),m_boite3d_distribution.get_ymax());
709  std::uniform_real_distribution<double> uniform_distribution_position_z(m_boite3d_distribution.get_zmin(),m_boite3d_distribution.get_zmax());
710  std::normal_distribution<double> normal_distribution_rayon_majeur(mu_rayon_majeur,sigma_rayon_majeur);
711  std::uniform_real_distribution<double> uniform_distribution_rayon_majeur(mu_rayon_majeur-sigma_rayon_majeur,mu_rayon_majeur+sigma_rayon_majeur);
712  std::normal_distribution<double> normal_distribution_rayon_mineur(mu_rayon_mineur,sigma_rayon_mineur);
713  std::uniform_real_distribution<double> uniform_distribution_rayon_mineur(mu_rayon_mineur-sigma_rayon_mineur,mu_rayon_mineur+sigma_rayon_mineur);
714  std::normal_distribution<double> normal_distribution_theta(mu_theta,sigma_theta);
715  std::uniform_real_distribution<double> uniform_distribution_theta(0,sigma_theta);
716  std::normal_distribution<double> normal_distribution_phi(mu_phi,sigma_phi);
717  std::uniform_real_distribution<double> uniform_distribution_phi(0,sigma_phi);
718  if(m_matrice==NULL)
719  {
725  }
727  {
728  fraction_volumique_cible=fraction_volumique_cible*m_boite3d_distribution.get_volume()/m_boite3d_ves.get_volume();
729  }
730  double fraction_volumique=fraction_volumique_actuelle;
731  long iteration=0;
732  long nb_inclusion=0;
733  while(fraction_volumique<fraction_volumique_cible-eps_frac_vol && iteration<m_nb_iteration_max)
734  {
735  double extremite[3];
736  extremite[0]=uniform_distribution_position_x(generateur);
737  extremite[1]=uniform_distribution_position_y(generateur);
738  extremite[2]=uniform_distribution_position_z(generateur);
739  double rayon_majeur=-1;
740  if(type_distribution_rayon_majeur==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon_majeur<0.0) rayon_majeur=mu_rayon_majeur;
741  else if(type_distribution_rayon_majeur==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon_majeur<0.0) rayon_majeur=uniform_distribution_rayon_majeur(generateur);
742  else if(type_distribution_rayon_majeur==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon_majeur<0.0) rayon_majeur=normal_distribution_rayon_majeur(generateur);
743  double rayon_mineur=-1;
744  if(type_distribution_rayon_mineur==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(rayon_mineur<0.0) rayon_mineur=mu_rayon_mineur;
745  else if(type_distribution_rayon_mineur==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(rayon_mineur<0.0) rayon_mineur=uniform_distribution_rayon_mineur(generateur);
746  else if(type_distribution_rayon_mineur==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(rayon_mineur<0.0) rayon_mineur=normal_distribution_rayon_mineur(generateur);
747  double theta=-1;
748  if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(theta<0.0) theta=mu_theta;
749  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(theta<0.0) theta=uniform_distribution_theta(generateur);
750  else if(type_distribution_theta==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(theta<0.0) theta=normal_distribution_theta(generateur);
751  double phi=-1;
752  if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::FIXE) while(phi<0.0) phi=mu_phi;
753  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::UNIFORME) while(phi<0.0) phi=uniform_distribution_phi(generateur);
754  else if(type_distribution_phi==MSTRUCT::TYPE_DISTRIBUTION::NORMALE) while(phi<0.0) phi=normal_distribution_phi(generateur);
755  double axe[3];
756  theta = 2.0*M_PI*theta;
757  phi=acos(2.0*phi-1.0);
758  axe[0]=sin(phi)*cos(theta);
759  axe[1]=sin(phi)*sin(theta);
760  axe[2]=cos(phi);
761  OT_VECTEUR_3D vct_axe(axe);
762  vct_axe.norme();
763  axe[0]=vct_axe.get_x();
764  axe[1]=vct_axe.get_y();
765  axe[2]=vct_axe.get_z();
766  MG_CG_FORME_VOLUME_ELLIPSOIDE *ellipsoide_test = MG_CG::creer_MG_CG_FORME_VOLUME_ELLIPSOIDE(m_mgcg_modele,extremite[0],extremite[1],extremite[2],axe[0],axe[1],axe[2],rayon_majeur,rayon_mineur);
767  ellipsoide_test->construire();
768  std::vector<MG_CG_FORME*> vector_forme;
769  int position_relative;
770  if(insertion_inclusion(ellipsoide_test,fraction_volumique_cible,eps_frac_vol,fraction_volumique,vector_forme,position_relative,vector_epaisseur_couches,porosite)==OK)
771  {
772  nb_inclusion++;
773  std::vector<MG_CG_FORME*>::iterator it_forme;
774  std::vector<MG_CG_GROUPE_FORME*>::iterator it_groupe_forme;
775  it_groupe_forme=vct_groupe_forme.begin();
776  for(it_forme=vector_forme.begin();it_forme!=vector_forme.end();it_forme++,it_groupe_forme++)
777  {
778  MG_CG_FORME* forme=*it_forme;
779  MG_CG_GROUPE_FORME* groupe_forme=*it_groupe_forme;
780  groupe_forme->ajouter_mgcg_forme(forme);
781  if(it_forme==vector_forme.begin())
782  {
783  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"EXTREMITE",3,extremite);
784  MG_CG::creer_MG_CG_INFO_VCT_DOUBLE(forme,(char*)"AXE",3,axe);
785  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON_MAJEUR",rayon_majeur);
786  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"RAYON_MINEUR",rayon_mineur);
787  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"ID_FORME_INI",ellipsoide_test->get_id());
788  }
789  if(porosite)
790  {
791  MG_CG::creer_MG_CG_INFO_DOUBLE(forme,(char*)"POROSITE",1);
792  }
793  }
794  char position[100];
795  if(position_relative==MSTRUCT::POSITION_RELATIVE::INTERIEUR) sprintf(position,"Interieur");
796  else if(position_relative==MSTRUCT::POSITION_RELATIVE::AU_BORD) sprintf(position,"Au_bord");
797  sprintf(message,"IT [%6li/%6li max] : Ellipsoide # [%4li] : Fraction volumique [%.6lf / %.6lf] : Position %s",
798  iteration,m_nb_iteration_max,nb_inclusion,fraction_volumique,fraction_volumique_cible,position);
799  affiche(message);
800  }
801  iteration++;
802  }
803  fraction_volumique_actuelle=fraction_volumique;
804  return fraction_volumique;
805 }
806 
807 
808 
810 {
813  ves->change_mgcg_assemblage(assemblage);
814  ves->change_mg_geometrie(assemblage->get_mg_sous_geometrie());
815  std::vector<MG_CG_GROUPE_FORME*>::iterator it_gr_forme;
816  for(it_gr_forme=m_vector_mgcg_groupe_forme_inclusion.begin();it_gr_forme!=m_vector_mgcg_groupe_forme_inclusion.end();it_gr_forme++)
817  {
818  MG_CG_GROUPE_FORME* groupe_forme = *it_gr_forme;
819  std::map<long,MG_CG_FORME*>::iterator it_forme;
820  for(MG_CG_FORME* forme=groupe_forme->get_premiere_mgcg_forme(it_forme);forme!=NULL;forme=groupe_forme->get_suivante_mgcg_forme(it_forme))
821  {
822  MG_CG_INFO* info_porosite = forme->get_mgcg_info((char*)"POROSITE");
823  if(info_porosite!=NULL) continue;
824  assemblage->ajouter_mgcg_forme(forme);
825  }
826  }
827  assemblage->ajouter_mgcg_forme(m_matrice);
828  MG_CG_GROUPE_FORME* groupe_forme_matrice=MG_CG::creer_MG_CG_GROUPE_FORME(m_mgcg_modele,(char*)"Matrice");
829  groupe_forme_matrice->ajouter_mgcg_forme(m_matrice);
830  return OK;
831 }
832 
833 
834 
835 
836 
837 
838 
839 
840 
841 
842 
843 
844 
845 
846 
MSTRUCT_GENERATEUR_RSA::~MSTRUCT_GENERATEUR_RSA
~MSTRUCT_GENERATEUR_RSA(void)
Definition: mstruct_generateur_rsa.cpp:93
MSTRUCT::RSA
@ RSA
Definition: mstruct_definition.h:39
MSTRUCT_GENERATEUR::cree_vector_groupe_forme
void cree_vector_groupe_forme(std::string nom, std::vector< MG_CG_GROUPE_FORME * > &vector_groupe_forme, std::vector< double > *vector_epaisseur_couches=NULL)
Definition: mstruct_generateur.cpp:1000
mg_cg_forme_volume_boite.h
mg_cg_forme_multi_volume.h
mg_cg_op_bool_intersection.h
ot_geometrie.h
MSTRUCT_GENERATEUR::insertion_inclusion
bool insertion_inclusion(MG_CG_FORME *forme_inclusion, double fraction_volumique_cible, double eps_fra_vol, double &fraction_volumique_actuelle, std::vector< MG_CG_FORME * > &vector_inclusion_genere, int &position_relative, std::vector< double > *vector_epaisseur_couche=NULL, bool porosite=false)
Definition: mstruct_generateur.cpp:484
MSTRUCT_GENERATEUR::m_grille_init
bool m_grille_init
Definition: mstruct_generateur.h:107
MG_CG_GROUPE_FORME::get_premiere_mgcg_forme
MG_CG_FORME * get_premiere_mgcg_forme(std::map< long, MG_CG_FORME * >::iterator &it)
Definition: mg_cg_groupe_forme.cpp:68
MSTRUCT_GENERATEUR::m_nb_pas_z
double m_nb_pas_z
Definition: mstruct_generateur.h:115
mstruct_generateur_rsa.h
MSTRUCT_GENERATEUR::m_cube_initial
MG_CG_FORME * m_cube_initial
Definition: mstruct_generateur.h:112
MSTRUCT_GENERATEUR::m_boite3d_ves
BOITE_3D m_boite3d_ves
Definition: mstruct_generateur.h:96
MSTRUCT::NORMALE
@ NORMALE
Definition: mstruct_definition.h:44
mg_cg.h
mg_cg_forme_volume.h
BOITE_3D::get_xmin
double get_xmin(void)
Definition: ot_boite_3d.cpp:104
mstruct_ves.h
mg_gestionnaire.h
MSTRUCT_GENERATEUR::m_distance_min
double m_distance_min
Definition: mstruct_generateur.h:103
mg_cg_forme_volume_sphere.h
MSTRUCT_GENERATEUR::m_longueur_min
double m_longueur_min
Definition: mstruct_generateur.h:100
mg_cg_groupe_forme.h
MSTRUCT_GENERATEUR_RSA::tirrage_aleatoire_ellipsoide
double tirrage_aleatoire_ellipsoide(std::string nom, double mu_rayon_majeur, double sigma_rayon_majeur, int type_distribution_rayon_majeur, double mu_rayon_mineur, double sigma_rayon_mineur, int type_distribution_rayon_mineur, double mu_theta, double sigma_theta, int type_distribution_theta, double mu_phi, double sigma_phi, int type_distribution_phi, double fraction_volumique_cible, double eps_frac_vol, double &fraction_volumique_actuelle, std::vector< double > *vector_epaisseur_couches=NULL, bool porosite=false)
Definition: mstruct_generateur_rsa.cpp:691
MSTRUCT_GENERATEUR
Definition: mstruct_generateur.h:34
MG_CG::creer_MG_CG_INFO_VCT_DOUBLE
static MG_CG_INFO_VCT_DOUBLE * creer_MG_CG_INFO_VCT_DOUBLE(MG_CONSTRUCTION_GEOMETRIQUE *mg_construction_geometrique, std::string identifiant, std::vector< double > &valeur)
Definition: mg_cg.cpp:137
mg_cg_op_inclusion_matrice.h
MSTRUCT_GENERATEUR_RSA::tirrage_aleatoire_torus
double tirrage_aleatoire_torus(std::string nom, double mu_rayon_cercle, double sigma_rayon_cercle, int type_distribution_rayon_cercle, double mu_rayon_tore, double sigma_rayon_tore, int type_distribution_rayon_tore, double mu_theta, double sigma_theta, int type_distribution_theta, double mu_phi, double sigma_phi, int type_distribution_phi, double mu_angle_seg, double sigma_angle_seg, int type_distribution_angle_seg, double fraction_volumique_cible, double eps_frac_vol, double &fraction_volumique_actuelle, std::vector< double > *vector_epaisseur_couches, bool porosite=false)
Definition: mstruct_generateur_rsa.cpp:332
mg_cg_forme_volume_ellipsoide.h
mg_cg_forme_volume_tore.h
MSTRUCT_GENERATEUR::m_nb_pas_grille
int m_nb_pas_grille
Definition: mstruct_generateur.h:104
MG_CG::creer_MG_CG_FORME_VOLUME_CYLINDRE
static MG_CG_FORME_VOLUME_CYLINDRE * creer_MG_CG_FORME_VOLUME_CYLINDRE(MG_CG_MODELE *mgcg_modele, double extremite_x, double extremite_y, double extremite_z, double direction_x, double direction_y, double direction_z, double rayon, double longueur)
Definition: mg_cg.cpp:243
MG_CG_ASSEMBLAGE::get_mg_sous_geometrie
virtual MG_SOUS_GEOMETRIE * get_mg_sous_geometrie(void)
Definition: mg_cg_assemblage.cpp:77
OK
const int OK
Definition: mg_definition.h:38
MSTRUCT_GENERATEUR::m_vector_mgcg_groupe_forme_inclusion
std::vector< MG_CG_GROUPE_FORME * > m_vector_mgcg_groupe_forme_inclusion
Definition: mstruct_generateur.h:110
MSTRUCT_GENERATEUR::affiche
void affiche(char *message)
Definition: mstruct_generateur.cpp:1113
MG_CG_FORME_VOLUME_ELLIPSOIDE::construire
virtual int construire(void)=0
MG_GESTIONNAIRE
Definition: mg_gestionnaire.h:57
OT_VECTEUR_3D::get_x
virtual double get_x(void) const
Definition: ot_mathematique.cpp:417
MSTRUCT_GENERATEUR::m_intersection_bords_ves
bool m_intersection_bords_ves
Definition: mstruct_generateur.h:98
MG_CG::creer_MG_CG_INFO_STRING
static MG_CG_INFO_STRING * creer_MG_CG_INFO_STRING(MG_CONSTRUCTION_GEOMETRIQUE *mg_construction_geometrique, std::string identifiant, std::string valeur)
Definition: mg_cg.cpp:117
MSTRUCT_GENERATEUR::m_grille_volume_inclusion
TPL_GRILLE< MG_VOLUME * > m_grille_volume_inclusion
Definition: mstruct_generateur.h:109
MSTRUCT_GENERATEUR::initialiser_grille
void initialiser_grille(void)
Definition: mstruct_generateur.cpp:185
MSTRUCT_GENERATEUR::m_nb_pas_echantillonnage
int m_nb_pas_echantillonnage
Definition: mstruct_generateur.h:105
MSTRUCT_GENERATEUR::m_angle_min
double m_angle_min
Definition: mstruct_generateur.h:99
MSTRUCT_GENERATEUR_RSA::m_nb_iteration_max
long m_nb_iteration_max
Definition: mstruct_generateur_rsa.h:95
BOITE_3D::get_zmax
double get_zmax(void)
Definition: ot_boite_3d.cpp:129
BOITE_3D::get_ymin
double get_ymin(void)
Definition: ot_boite_3d.cpp:114
MG_CG_GROUPE_FORME::ajouter_mgcg_forme
int ajouter_mgcg_forme(MG_CG_FORME *mgcg_forme)
Definition: mg_cg_groupe_forme.cpp:60
MG_CG_FORME_VOLUME_CYLINDRE::construire
virtual int construire(void)=0
MSTRUCT::UNIFORME
@ UNIFORME
Definition: mstruct_definition.h:43
MSTRUCT_GENERATEUR::m_boite3d_distribution
BOITE_3D m_boite3d_distribution
Definition: mstruct_generateur.h:97
MG_CG_FORME
Definition: mg_cg_forme.h:41
MSTRUCT_GENERATEUR::m_nb_pas_y
double m_nb_pas_y
Definition: mstruct_generateur.h:114
MSTRUCT_VES::change_mg_geometrie
virtual void change_mg_geometrie(MG_GEOMETRIE *mg_geometrie)
Definition: mstruct_ves.cpp:140
mg_point.h
BOITE_3D::get_xmax
double get_xmax(void)
Definition: ot_boite_3d.cpp:109
MG_CG_FORME_VOLUME_SPHERE::construire
virtual int construire(void)=0
MG_CG::creer_MG_CG_FORME_VOLUME_SPHERE
static MG_CG_FORME_VOLUME_SPHERE * creer_MG_CG_FORME_VOLUME_SPHERE(MG_CG_MODELE *mgcg_modele, double centre_x, double centre_y, double centre_z, double rayon)
Definition: mg_cg.cpp:215
MG_CG::creer_MG_CG_FORME_VOLUME_TORE
static MG_CG_FORME_VOLUME_TORE * creer_MG_CG_FORME_VOLUME_TORE(MG_CG_MODELE *mgcg_modele, double centre_x, double centre_y, double centre_z, double direction_x, double direction_y, double direction_z, double rayon_cercle, double rayon_tore, double angle_seg=2 *M_PI, double angle_rotation=0.0)
Definition: mg_cg.cpp:271
MSTRUCT_GENERATEUR::m_precision
double m_precision
Definition: mstruct_generateur.h:106
MG_CG_FORME_VOLUME_SPHERE
Definition: mg_cg_forme_volume_sphere.h:36
MG_CG_FORME_VOLUME_CYLINDRE
Definition: mg_cg_forme_volume_cylindre.h:36
MSTRUCT_GENERATEUR_RSA::construire
virtual int construire(MSTRUCT_VES *ves)
Definition: mstruct_generateur_rsa.cpp:809
tpl_grille.h
MSTRUCT::INTERIEUR
@ INTERIEUR
Definition: mstruct_definition.h:46
BOITE_3D::get_volume
double get_volume(void)
Definition: ot_boite_3d.cpp:171
MSTRUCT_GENERATEUR::m_mgcg_modele
MG_CG_MODELE * m_mgcg_modele
Definition: mstruct_generateur.h:95
MG_CG_ASSEMBLAGE
Definition: mg_cg_assemblage.h:37
MG_CG_GROUPE_FORME::get_suivante_mgcg_forme
MG_CG_FORME * get_suivante_mgcg_forme(std::map< long, MG_CG_FORME * >::iterator &it)
Definition: mg_cg_groupe_forme.cpp:76
MSTRUCT_GENERATEUR_RSA::tirrage_aleatoire_cylindre
double tirrage_aleatoire_cylindre(std::string nom, double mu_rayon, double sigma_rayon, int type_distribution_rayon, double mu_longueur, double sigma_longueur, int type_distribution_longueur, double mu_theta, double sigma_theta, int type_distribution_theta, double mu_phi, double sigma_phi, int type_distribution_phi, double fraction_volumique_cible, double eps_frac_vol, double &fraction_volumique_actuelle, std::vector< double > *vector_epaisseur_couches=NULL, bool porosite=false)
Definition: mstruct_generateur_rsa.cpp:206
OT_VECTEUR_3D::norme
virtual void norme(void)
Definition: ot_mathematique.cpp:494
mg_sous_geometrie.h
MSTRUCT_GENERATEUR::m_matrice
MG_CG_FORME * m_matrice
Definition: mstruct_generateur.h:111
MG_CG::creer_MG_CG_FORME_VOLUME_ELLIPSOIDE
static MG_CG_FORME_VOLUME_ELLIPSOIDE * creer_MG_CG_FORME_VOLUME_ELLIPSOIDE(MG_CG_MODELE *mgcg_modele, double centre_x, double centre_y, double centre_z, double direction_x, double direction_y, double direction_z, double rayon_majeur, double rayon_mineur)
Definition: mg_cg.cpp:229
MSTRUCT_GENERATEUR_RSA::change_nb_iteration_max
void change_nb_iteration_max(long nb_iteration_max)
Definition: mstruct_generateur_rsa.cpp:104
mstruct_definition.h
MSTRUCT_VES
Definition: mstruct_ves.h:45
MG_CG_GROUPE_FORME
Definition: mg_cg_groupe_forme.h:30
BOITE_3D::get_ymax
double get_ymax(void)
Definition: ot_boite_3d.cpp:119
mg_cg_forme_volume_cylindre.h
MSTRUCT_GENERATEUR::m_nb_pas_x
double m_nb_pas_x
Definition: mstruct_generateur.h:113
mg_cg_modele.h
OT_VECTEUR_3D::get_y
virtual double get_y(void) const
Definition: ot_mathematique.cpp:423
MG_CG_FORME_VOLUME_TORE
Definition: mg_cg_forme_volume_tore.h:36
MSTRUCT_GENERATEUR::m_aire_min
double m_aire_min
Definition: mstruct_generateur.h:101
acos
double2 acos(double2 &val)
Definition: ot_doubleprecision.cpp:224
MG_CG_FORME::construire
virtual int construire(void)=0
MG_CG_FORME_VOLUME_ELLIPSOIDE
Definition: mg_cg_forme_volume_ellipsoide.h:36
OT_VECTEUR_3D
Definition: ot_mathematique.h:94
mg_cg_assemblage.h
MG_CG::creer_MG_CG_FORME_VOLUME_BOITE
static MG_CG_FORME_VOLUME_BOITE * creer_MG_CG_FORME_VOLUME_BOITE(MG_CG_MODELE *mgcg_modele, double x1, double y1, double z1, double x2, double y2, double z2)
Definition: mg_cg.cpp:201
MG_CG::creer_MG_CG_ASSEMBLAGE
static MG_CG_ASSEMBLAGE * creer_MG_CG_ASSEMBLAGE(MG_CG_MODELE *mgcg_modele, std::string nom_mgcg_assemblage)
Definition: mg_cg.cpp:97
BOITE_3D
Definition: ot_boite_3d.h:27
mg_cg_info.h
MSTRUCT_GENERATEUR::m_volume_min
double m_volume_min
Definition: mstruct_generateur.h:102
MSTRUCT_GENERATEUR_RSA::tirrage_aleatoire_sphere
double tirrage_aleatoire_sphere(std::string nom, double mu_rayon, double sigma_rayon, int type_distribution_rayon, double fraction_volumique_cible, double eps_frac_vol, double &fraction_volumique_actuelle, std::vector< double > *vector_epaisseur_couches=NULL, bool porosite=false)
Definition: mstruct_generateur_rsa.cpp:112
MSTRUCT::AU_BORD
@ AU_BORD
Definition: mstruct_definition.h:48
MSTRUCT_GENERATEUR_RSA::get_type
virtual int get_type(void)
Definition: mstruct_generateur_rsa.cpp:97
BOITE_3D::get_zmin
double get_zmin(void)
Definition: ot_boite_3d.cpp:124
OT_VECTEUR_3D::get_z
virtual double get_z(void) const
Definition: ot_mathematique.cpp:429
MSTRUCT::FIXE
@ FIXE
Definition: mstruct_definition.h:42
MG_CG::creer_MG_CG_GROUPE_FORME
static MG_CG_GROUPE_FORME * creer_MG_CG_GROUPE_FORME(MG_CG_MODELE *mgcg_modele, std::string nom)
Definition: mg_cg.cpp:107
MSTRUCT_GENERATEUR_RSA::MSTRUCT_GENERATEUR_RSA
MSTRUCT_GENERATEUR_RSA(MG_GESTIONNAIRE *mg_gestionnaire, char *nom_mgcg_modele)
Definition: mstruct_generateur_rsa.cpp:52
MG_CG_FORME_VOLUME_TORE::construire
virtual int construire(void)=0
MSTRUCT_VES::change_mgcg_assemblage
virtual void change_mgcg_assemblage(MG_CG_ASSEMBLAGE *mgcg_assemblage)
Definition: mstruct_ves.cpp:151
mg_cg_op_bool_difference.h
MG_CG_ASSEMBLAGE::ajouter_mgcg_forme
virtual int ajouter_mgcg_forme(MG_CG_FORME *mgcg_forme, bool avec_mg_element=true)
Definition: mg_cg_assemblage.cpp:87
cos
double2 cos(double2 &val)
Definition: ot_doubleprecision.cpp:206
MSTRUCT_VES::change_mgcg_modele
virtual void change_mgcg_modele(MG_CG_MODELE *mgcg_modele)
Definition: mstruct_ves.cpp:163
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_CG::creer_MG_CG_INFO_DOUBLE
static MG_CG_INFO_DOUBLE * creer_MG_CG_INFO_DOUBLE(MG_CONSTRUCTION_GEOMETRIQUE *mg_construction_geometrique, std::string identifiant, double valeur)
Definition: mg_cg.cpp:127
MG_CG_FORME_VOLUME
Definition: mg_cg_forme_volume.h:36
MG_CG_INFO
Definition: mg_cg_info.h:28
mg_cg_op_transf_decallage.h
sin
double2 sin(double2 &val)
Definition: ot_doubleprecision.cpp:250