MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
mstruct_analyse_cao.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_analyse_cao.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:57 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #include "mstruct_analyse_cao.h"
23 #include "mstruct_ves.h"
24 #include "mstruct_outils.h"
25 #include "mstruct_definition.h"
26 #include "mg_cg_forme.h"
27 #include "mg_cg_groupe_forme.h"
28 #include "mg_cg_assemblage.h"
29 #include "mg_cg_modele.h"
30 #include "magic_plot.h"
32 {
33 }
34 
36  std::string identifiant,
37  double largeur_colonne_volume_forme,
38  std::string nom_groupe_forme): MSTRUCT_ANALYSE(ves,identifiant,nom_groupe_forme)
39 {
40  m_volume_forme_histogramme.fixe_largeur_colonne(largeur_colonne_volume_forme);
41 }
42 
44 {
45  if(cpy_data)
46  {
54  }
55  else
56  {
58  }
59 }
60 
62 {
63 }
64 
66 {
67  return m_nb_forme;
68 }
69 
71 {
72  return m_nb_volume;
73 }
74 
76 {
77  return m_volume_forme_min;
78 }
79 
81 {
82  return m_volume_forme_max;
83 }
84 
86 {
88 }
89 
91 {
93 }
94 
96 {
98 }
99 
101 {
102  return m_volume;
103 }
104 
106 {
107  return m_fraction_volumique;
108 }
109 
111 {
113 }
114 
116 {
117  MG_CG_GROUPE_FORME* groupe_forme=NULL;
119  TPL_MAP_ENTITE<MG_CG_FORME*> tpl_map_forme;
120  if(groupe_forme!=NULL)
121  {
122  std::map<long,MG_CG_FORME*>::iterator it_forme;
123  for(MG_CG_FORME* forme=groupe_forme->get_premiere_mgcg_forme(it_forme);forme!=NULL;forme=groupe_forme->get_suivante_mgcg_forme(it_forme))
124  {
125  tpl_map_forme.ajouter(forme);
126  }
127  }
128  else
129  {
130  std::map<long,MG_CG_FORME*>::iterator it_forme;
132  for(MG_CG_FORME*forme=mgcg_ass->get_premiere_mgcg_forme(it_forme);forme!=NULL;forme=mgcg_ass->get_suivante_mgcg_forme(it_forme))
133  {
134  tpl_map_forme.ajouter(forme);
135  }
136  }
138  tpl_map_forme,
139  m_nb_forme,
140  m_nb_volume,
146  m_volume,
148 }
149 
150 void MSTRUCT_ANALYSE_CAO::exporter(std::ofstream& ofstrm, long i, bool avec_entete, bool avec_graph, char* prefix_graph)
151 {
152  if(avec_entete)
153  ofstrm << "#(1) volume(1) frac_vol(2) nb_forme(3) nb_volume(4) volume_forme[moy(5) ±(6) min(7) max(8)]" << std::endl;
154  ofstrm << i << " "
155  << m_volume << " "
156  << m_fraction_volumique << " "
157  << m_nb_forme << " "
158  << m_nb_volume << " "
159  << m_volume_forme_moyenne << " "
160  << m_volume_forme_ecart_type << " "
161  << m_volume_forme_min << " "
162  << m_volume_forme_max << std::endl;
163  if(avec_graph)
164  {
165  char nom_fichier[500];
166  char nom_plot[500];
167  MAGIC_PLOT magic_plot;
168  sprintf(nom_fichier,"%s/histo_%s_volume_forme.txt",prefix_graph,m_identifiant.c_str());
169  std::ofstream of_histo_volume_forme(nom_fichier,std::ios::out|std::ios::trunc);
170  of_histo_volume_forme.precision(16);
171  of_histo_volume_forme.setf(std::ios::showpoint);
172  m_volume_forme_histogramme.exporter(of_histo_volume_forme);
173  of_histo_volume_forme.close();
174  sprintf(nom_plot,"%s/histo_%s_volume_forme.plt",prefix_graph,m_identifiant.c_str());
175  magic_plot.histogramme_couleur=MAGIC_PLOT::COULEUR::BLEU;
176  magic_plot.histogramme_titre=m_identifiant.c_str();
177  magic_plot.histogramme_axeX_nom="Volume forme";
178  magic_plot.histogramme_axeY_nom="";
179  magic_plot.histogramme_nom_fichier_eps=std::string(m_identifiant+".eps").c_str();
180  sprintf(nom_fichier,"histo_%s_volume_forme.txt",m_identifiant.c_str());
181  magic_plot.plot_script_histogramme(nom_fichier,nom_plot,true);
182  }
183 
184 }
185 
186 void MSTRUCT_ANALYSE_CAO::enregistrer(std::ofstream& ofstrm)
187 {
188  long type_analyse=get_type();
189  ofstrm.write((char*)&type_analyse,sizeof(long));
191  ofstrm.write((char*)&m_nb_forme,sizeof(long));
192  ofstrm.write((char*)&m_nb_volume,sizeof(long));
193  ofstrm.write((char*)&m_volume_forme_moyenne,sizeof(double));
194  ofstrm.write((char*)&m_volume_forme_ecart_type,sizeof(double));
195  ofstrm.write((char*)&m_volume_forme_min,sizeof(double));
196  ofstrm.write((char*)&m_volume_forme_max,sizeof(double));
198  ofstrm.write((char*)&m_volume,sizeof(double));
199  ofstrm.write((char*)&m_fraction_volumique,sizeof(double));
200 }
201 
202 void MSTRUCT_ANALYSE_CAO::ouvrir(std::ifstream& ifstrm)
203 {
204  MSTRUCT_ANALYSE::ouvrir(ifstrm);
205  ifstrm.read((char*)&m_nb_forme,sizeof(long));
206  ifstrm.read((char*)&m_nb_volume,sizeof(long));
207  ifstrm.read((char*)&m_volume_forme_moyenne,sizeof(double));
208  ifstrm.read((char*)&m_volume_forme_ecart_type,sizeof(double));
209  ifstrm.read((char*)&m_volume_forme_min,sizeof(double));
210  ifstrm.read((char*)&m_volume_forme_max,sizeof(double));
212  ifstrm.read((char*)&m_volume,sizeof(double));
213  ifstrm.read((char*)&m_fraction_volumique,sizeof(double));
214 }
215 
217 {
219  char ligne[5000];
220  sprintf(ligne,"MSTRUCT_ANALYSE_CAO");fonc(ligne);
221  sprintf(ligne,"-> Nb forme : %li",m_nb_forme); fonc(ligne);
222  sprintf(ligne,"-> Nb volume : %li",m_nb_volume); fonc(ligne);
223  sprintf(ligne,"-> Volume : %lf",m_volume); fonc(ligne);
224  sprintf(ligne,"-> Fraction volumique : %lf",m_fraction_volumique); fonc(ligne);
225  sprintf(ligne,"-> Moyenne volume forme : %lf",m_volume_forme_moyenne); fonc(ligne);
226  sprintf(ligne,"-> Ecart-type volume forme : %lf",m_volume_forme_ecart_type); fonc(ligne);
227  sprintf(ligne,"-> Min volume forme : %lf",m_volume_forme_min); fonc(ligne);
228  sprintf(ligne,"-> Max volume forme : %lf",m_volume_forme_max); fonc(ligne);
229  sprintf(ligne,"-> OT_HISTOGRAMME volume forme : nb_colonne(%li), largeur_colonne(%lf), xmin(%lf), xmax(%lf)", m_volume_forme_histogramme.get_nb_colonne(),
233  fonc(ligne);
234 }
MSTRUCT_OUTILS::statistiques_CAO
static int statistiques_CAO(BOITE_3D boite_VES, TPL_MAP_ENTITE< MG_CG_FORME * > &tpl_map_forme, long &nb_forme, long &nb_volume, double &volume_forme_moyenne, double &volume_forme_ecart_type, double &volume_forme_min, double &volume_forme_max, OT_HISTOGRAMME &volume_forme_histogramme, double &volume_total, double &fraction_volumique, double precision=1e-06)
Definition: mstruct_outils.cpp:323
mg_cg_forme.h
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_outils.h
MSTRUCT_ANALYSE_CAO::m_nb_forme
long m_nb_forme
Definition: mstruct_analyse_cao.h:56
MSTRUCT_ANALYSE_CAO::m_fraction_volumique
double m_fraction_volumique
Definition: mstruct_analyse_cao.h:64
OT_HISTOGRAMME
Definition: ot_mathematique.h:34
TPL_MAP_ENTITE< MG_CG_FORME * >
mstruct_ves.h
MSTRUCT_ANALYSE_CAO::m_volume_forme_min
double m_volume_forme_min
Definition: mstruct_analyse_cao.h:60
MSTRUCT_ANALYSE_CAO::m_volume_forme_max
double m_volume_forme_max
Definition: mstruct_analyse_cao.h:61
OT_HISTOGRAMME::get_nb_colonne
long get_nb_colonne(void)
Definition: ot_mathematique.cpp:200
MSTRUCT_ANALYSE::enregistrer
virtual void enregistrer(std::ofstream &ofstrm)
Definition: mstruct_analyse.cpp:100
mg_cg_groupe_forme.h
MG_CG_ASSEMBLAGE::get_suivante_mgcg_forme
virtual MG_CG_FORME * get_suivante_mgcg_forme(std::map< long, MG_CG_FORME * >::iterator &it)
Definition: mg_cg_assemblage.cpp:104
MG_CG_MODELE::get_mgcg_groupe_forme
MG_CG_GROUPE_FORME * get_mgcg_groupe_forme(std::string nom)
Definition: mg_cg_modele.cpp:504
MSTRUCT_ANALYSE_CAO::get_type
virtual long get_type(void)
Definition: mstruct_analyse_cao.cpp:110
MSTRUCT_ANALYSE_CAO::executer
virtual void executer(void)
Definition: mstruct_analyse_cao.cpp:115
MAGIC_PLOT::histogramme_titre
std::string histogramme_titre
Definition: magic_plot.h:53
MSTRUCT_ANALYSE_CAO::get_volume_forme_ecart_type
virtual double get_volume_forme_ecart_type(void)
Definition: mstruct_analyse_cao.cpp:90
MSTRUCT_ANALYSE_CAO::m_volume_forme_histogramme
OT_HISTOGRAMME m_volume_forme_histogramme
Definition: mstruct_analyse_cao.h:62
MSTRUCT_ANALYSE_CAO
Definition: mstruct_analyse_cao.h:30
MSTRUCT_ANALYSE_CAO::~MSTRUCT_ANALYSE_CAO
~MSTRUCT_ANALYSE_CAO(void)
Definition: mstruct_analyse_cao.cpp:61
MSTRUCT_ANALYSE::m_nom_groupe_forme
std::string m_nom_groupe_forme
Definition: mstruct_analyse.h:54
MSTRUCT_VES::get_mgcg_assemblage
virtual MG_CG_ASSEMBLAGE * get_mgcg_assemblage(void)
Definition: mstruct_ves.cpp:158
MSTRUCT_VES::get_mgcg_modele
virtual MG_CG_MODELE * get_mgcg_modele(void)
Definition: mstruct_ves.cpp:170
magic_plot.h
MSTRUCT_ANALYSE_CAO::m_volume_forme_ecart_type
double m_volume_forme_ecart_type
Definition: mstruct_analyse_cao.h:59
MSTRUCT_ANALYSE_CAO::get_distribution_volume_forme
virtual OT_HISTOGRAMME * get_distribution_volume_forme(void)
Definition: mstruct_analyse_cao.cpp:95
MSTRUCT_ANALYSE_CAO::get_nb_forme
virtual long get_nb_forme(void)
Definition: mstruct_analyse_cao.cpp:65
OT_HISTOGRAMME::enregistrer_bin
void enregistrer_bin(std::ofstream &ofstr)
Definition: ot_mathematique.cpp:236
MSTRUCT_ANALYSE_CAO::m_nb_volume
long m_nb_volume
Definition: mstruct_analyse_cao.h:57
MSTRUCT_ANALYSE_CAO::ouvrir
virtual void ouvrir(std::ifstream &ifstrm)
Definition: mstruct_analyse_cao.cpp:202
MSTRUCT_ANALYSE_CAO::m_volume_forme_moyenne
double m_volume_forme_moyenne
Definition: mstruct_analyse_cao.h:58
MG_CG_ASSEMBLAGE::get_premiere_mgcg_forme
virtual MG_CG_FORME * get_premiere_mgcg_forme(std::map< long, MG_CG_FORME * >::iterator &it)
Definition: mg_cg_assemblage.cpp:96
MSTRUCT_ANALYSE::m_ves
MSTRUCT_VES * m_ves
Definition: mstruct_analyse.h:55
MSTRUCT_ANALYSE_CAO::get_volume_forme_min
virtual double get_volume_forme_min(void)
Definition: mstruct_analyse_cao.cpp:75
MSTRUCT_VES::get_boite3d_ves
virtual BOITE_3D get_boite3d_ves(void)
Definition: mstruct_ves.cpp:197
MG_CG_FORME
Definition: mg_cg_forme.h:41
MSTRUCT::CAO
@ CAO
Definition: mstruct_definition.h:60
MSTRUCT_ANALYSE
Definition: mstruct_analyse.h:30
MSTRUCT_ANALYSE_CAO::get_nb_volume
virtual long get_nb_volume(void)
Definition: mstruct_analyse_cao.cpp:70
MSTRUCT_ANALYSE_CAO::m_volume
double m_volume
Definition: mstruct_analyse_cao.h:63
OT_HISTOGRAMME::exporter
void exporter(std::ofstream &ofstrm)
Definition: ot_mathematique.cpp:291
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_ANALYSE_CAO::get_fraction_volumique
virtual double get_fraction_volumique(void)
Definition: mstruct_analyse_cao.cpp:105
mstruct_definition.h
MSTRUCT_VES
Definition: mstruct_ves.h:45
MG_CG_GROUPE_FORME
Definition: mg_cg_groupe_forme.h:30
MSTRUCT_ANALYSE_CAO::get_volume_forme_max
virtual double get_volume_forme_max(void)
Definition: mstruct_analyse_cao.cpp:80
mg_cg_modele.h
MSTRUCT_ANALYSE_CAO::get_volume_forme_moyenne
virtual double get_volume_forme_moyenne(void)
Definition: mstruct_analyse_cao.cpp:85
TPL_MAP_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_map_entite.h:55
mg_cg_assemblage.h
mstruct_analyse_cao.h
MSTRUCT_ANALYSE_CAO::enregistrer
virtual void enregistrer(std::ofstream &ofstrm)
Definition: mstruct_analyse_cao.cpp:186
OT_HISTOGRAMME::ouvrir_bin
void ouvrir_bin(std::ifstream &ifstr)
Definition: ot_mathematique.cpp:254
MSTRUCT_ANALYSE::affiche_contenu
virtual void affiche_contenu(fonction_affiche *fonc)
Definition: mstruct_analyse.cpp:171
MAGIC_PLOT
Definition: magic_plot.h:27
MSTRUCT_ANALYSE::m_identifiant
std::string m_identifiant
Definition: mstruct_analyse.h:52
fonction_affiche
void fonction_affiche(char *)
Definition: fct_taille.h:28
MSTRUCT_ANALYSE::ouvrir
virtual void ouvrir(std::ifstream &ifstrm)
Definition: mstruct_analyse.cpp:131
MAGIC_PLOT::histogramme_nom_fichier_eps
std::string histogramme_nom_fichier_eps
Definition: magic_plot.h:54
MAGIC_PLOT::histogramme_axeX_nom
std::string histogramme_axeX_nom
Definition: magic_plot.h:55
MSTRUCT_ANALYSE_CAO::affiche_contenu
virtual void affiche_contenu(fonction_affiche *fonc)
Definition: mstruct_analyse_cao.cpp:216
MAGIC_PLOT::plot_script_histogramme
void plot_script_histogramme(std::string data_histogramme, std::string output, bool aveccouleur=false)
Definition: magic_plot.cpp:147
OT_HISTOGRAMME::get_largeur_colonne
double get_largeur_colonne(void)
Definition: ot_mathematique.cpp:85
OT_HISTOGRAMME::fixe_largeur_colonne
void fixe_largeur_colonne(double largeur_colonne)
Definition: ot_mathematique.cpp:80
MAGIC_PLOT::histogramme_couleur
int histogramme_couleur
Definition: magic_plot.h:52
MSTRUCT_ANALYSE_CAO::exporter
virtual void exporter(std::ofstream &ofstrm, long i, bool avec_entete=false, bool avec_graph=false, char *prefix_graph=(char *)"")
Definition: mstruct_analyse_cao.cpp:150
MSTRUCT_ANALYSE_CAO::MSTRUCT_ANALYSE_CAO
MSTRUCT_ANALYSE_CAO(void)
Definition: mstruct_analyse_cao.cpp:31
MSTRUCT_ANALYSE_CAO::get_volume
virtual double get_volume(void)
Definition: mstruct_analyse_cao.cpp:100
MAGIC_PLOT::histogramme_axeY_nom
std::string histogramme_axeY_nom
Definition: magic_plot.h:56
OT_HISTOGRAMME::get_x_min
double get_x_min(void)
Definition: ot_mathematique.cpp:205
OT_HISTOGRAMME::get_x_max
double get_x_max(void)
Definition: ot_mathematique.cpp:210