MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
fct_generateur_constante.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 //####// fct_generateur_constante.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:52 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 
23 
24 #include "gestionversion.h"
25 
26 #pragma hdrstop
27 
29 #include "mg_gestionnaire.h"
30 #include "ct_face.h"
31 #include <math.h>
32 
33 FCT_GENERATEUR_CONSTANTE::FCT_GENERATEUR_CONSTANTE(MG_GESTIONNAIRE& mggest,double dn):FCT_GENERATEUR_3D<4>(),gest(mggest),dng(dn),pas_echantillon(20),pas_estimation(20)
34 {
35 }
36 
38 {
39 }
40 
41 
42 
43 
44 void FCT_GENERATEUR_CONSTANTE::construit(int pas_echan,int pas_estim,MG_GROUPE_TOPOLOGIQUE* mggt)
45 {
47  if (mggt!=NULL)
48  {
49  std::map<MG_ELEMENT_TOPOLOGIQUE*,MG_ELEMENT_TOPOLOGIQUE*>::iterator it;
50  for(MG_ELEMENT_TOPOLOGIQUE* ele=mggt->get_premier(it);ele!=NULL;ele=mggt->get_suivant(it))
51  {
52  lst.ajouter(ele);
53  ele->get_topologie_sousjacente(&lst);
54  }
55  }
57  pas_estimation=pas_estim;
58  int nb_geo=gest.get_nb_mg_geometrie();
59  BOITE_3D boite;
60  bool affect=false;
61  for (int i=0;i<nb_geo;i++)
62  {
64  int nbvol=geo->get_nb_mg_volume();
65  for (int j=0;j<nbvol;j++)
66  {
67  MG_VOLUME* vol=geo->get_mg_volume(j);
68  if (mggt!=NULL)
69  if (!mggt->est_dans_laliste(vol)) continue;
70  BOITE_3D tmp=vol->get_boite_3D();
71  if (affect==false) boite=tmp;
72  else boite=boite+tmp;
73  affect=true;
74  }
75  int nbcoque=geo->get_nb_mg_coque();
76  for (int j=0;j<nbcoque;j++)
77  {
78  MG_COQUE* coq=geo->get_mg_coque(j);
79  if (mggt!=NULL)
80  if (!mggt->est_dans_laliste(coq)) continue;
81  BOITE_3D tmp=coq->get_boite_3D();
82  if (affect==false) boite=tmp;
83  else boite=boite+tmp;
84  affect=true;
85  }
86  }
88  boite.change_grosseur(1.25);
89  grille.initialiser(boite.get_xmin(),boite.get_ymin(),boite.get_zmin(),boite.get_xmax(),boite.get_ymax(),boite.get_zmax(),pas_estimation,pas_estimation,pas_estimation);
90  double valmax=-1e308;
91  for (int i=0;i<pas_estimation;i++)
92  for (int j=0;j<pas_estimation;j++)
93  for (int k=0;k<pas_estimation;k++)
94  {
95  TPL_CELLULE_GRILLE_INFO<CT_POINT<1> *,DOUBLEN<4> > *cell=grille.get_cellule(i,j,k);
96  double tab[4];
97  tab[0]=dng;
98  tab[1]=0.;
99  tab[2]=0.;
100  tab[3]=0.;
101  DOUBLEN<4> ecart0(tab);
102  if (tab[0]>valmax)
103  {
104  valeurmax=ecart0;
105  valmax=tab[0];
106  }
107  cell->change_info(0,ecart0);
108  cell->change_info(1,ecart0);
109  cell->change_info(2,ecart0);
110  cell->change_info(3,ecart0);
111  cell->change_info(4,ecart0);
112  cell->change_info(5,ecart0);
113  cell->change_info(6,ecart0);
114  cell->change_info(7,ecart0);
115  }
116  legende[0]="F(x,y,z)";
117  legende[1]="dF/dx";
118  legende[2]="dF/dy";
119  legende[3]="dF/dz";
120 }
121 
122 void FCT_GENERATEUR_CONSTANTE::construit(double xmin,double ymin,double zmin,double xmax,double ymax,double zmax,int pas_echan,int pas_estim)
123 {
124  pas_echantillon=pas_echan;
125  pas_estimation=pas_estim;
126  BOITE_3D boite(xmin,ymin,zmin,xmax,ymax,zmax);
127  double xc=boite.get_xcentre();
128  double yc=boite.get_ycentre();
129  double zc=boite.get_zcentre();
130  double rayonx=1.125*(boite.get_xmax()-xc);
131  double rayony=1.125*(boite.get_ymax()-yc);
132  double rayonz=1.125*(boite.get_zmax()-zc);
133  boite.reinit(xc-rayonx,yc-rayony,zc-rayonz,xc+rayonx,yc+rayony,zc+rayonz);
134  grille.initialiser(boite.get_xmin(),boite.get_ymin(),boite.get_zmin(),boite.get_xmax(),boite.get_ymax(),boite.get_zmax(),pas_estimation,pas_estimation,pas_estimation);
135  for (int i=0;i<pas_estimation;i++)
136  for (int j=0;j<pas_estimation;j++)
137  for (int k=0;k<pas_estimation;k++)
138  {
139  TPL_CELLULE_GRILLE_INFO<CT_POINT<1> *,DOUBLEN<4> > *cell=grille.get_cellule(i,j,k);
140  double tab[4];
141  tab[0]=dng;
142  tab[1]=0.;
143  tab[2]=0.;
144  tab[3]=0.;
145  DOUBLEN<4> ecart0(tab);
146  cell->change_info(0,ecart0);
147  cell->change_info(1,ecart0);
148  cell->change_info(2,ecart0);
149  cell->change_info(3,ecart0);
150  cell->change_info(4,ecart0);
151  cell->change_info(5,ecart0);
152  cell->change_info(6,ecart0);
153  cell->change_info(7,ecart0);
154  }
155  legende[0]="F(x,y,z)";
156  legende[1]="dF/dx";
157  legende[2]="dF/dy";
158  legende[3]="dF/dz";
159 }
160 
161 
double get_xmin(void)
double get_xcentre(void)
double get_zmin(void)
double get_ycentre(void)
double get_zmax(void)
double get_xmax(void)
void change_grosseur(double f)
double get_ymax(void)
void reinit(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Definition: ot_boite_3d.cpp:55
double get_ymin(void)
double get_zcentre(void)
TPL_GRILLE_INFO< CT_POINT< 1 > *, DOUBLEN< N > > grille
void construit(int pas_echan=20, int pas_estim=20, class MG_GROUPE_TOPOLOGIQUE *mggt=NULL)
FCT_GENERATEUR_CONSTANTE(class MG_GESTIONNAIRE &mggest, double dn)
virtual BOITE_3D get_boite_3D(void)
Definition: mg_coque.cpp:212
static void change_pas_echantillon(int val)
static void restaure_pas_echantillon(void)
MG_COQUE * get_mg_coque(unsigned int num)
unsigned int get_nb_mg_coque(void)
MG_VOLUME * get_mg_volume(unsigned int num)
unsigned int get_nb_mg_volume(void)
MG_GEOMETRIE * get_mg_geometrie(unsigned int num)
unsigned int get_nb_mg_geometrie(void)
virtual MG_ELEMENT_TOPOLOGIQUE * get_premier(std::map< class MG_ELEMENT_TOPOLOGIQUE *, MG_ELEMENT_TOPOLOGIQUE * >::iterator &it)
virtual int est_dans_laliste(MG_ELEMENT_TOPOLOGIQUE *ele)
virtual MG_ELEMENT_TOPOLOGIQUE * get_suivant(std::map< class MG_ELEMENT_TOPOLOGIQUE *, MG_ELEMENT_TOPOLOGIQUE * >::iterator &it)
virtual BOITE_3D get_boite_3D(void)
Definition: mg_volume.cpp:109
void change_info(int num, B val)
Definition: tpl_grille.h:114
virtual void ajouter(X x)