1 |
|
5 |
//------------------------------------------------------------
|
2 |
|
|
//------------------------------------------------------------
|
3 |
|
|
// MAGiC
|
4 |
|
|
// Jean Christophe Cuillière et Vincent FRANCOIS
|
5 |
|
|
// Département de Génie Mécanique - UQTR
|
6 |
|
|
//------------------------------------------------------------
|
7 |
|
|
// Le projet MAGIC est un projet de recherche du département
|
8 |
|
|
// de génie mécanique de l'Université du Québec à
|
9 |
|
|
// Trois Rivières
|
10 |
|
|
// Les librairies ne peuvent être utilisées sans l'accord
|
11 |
|
|
// des auteurs (contact : francois@uqtr.ca)
|
12 |
|
|
//------------------------------------------------------------
|
13 |
|
|
//------------------------------------------------------------
|
14 |
|
|
//
|
15 |
|
|
// mg_sommet.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 à 11H22
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
#include "mg_sommet.h"
|
27 |
souaissa |
71 |
#include "vct_sommet.h"
|
28 |
|
5 |
//#include "affiche.h"
|
29 |
|
|
//#include "message.h"
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
souaissa |
71 |
MG_SOMMET::MG_SOMMET(std::string idori,unsigned long num,MG_POINT* mgpt):MG_ELEMENT_TOPOLOGIQUE(num,idori),point(mgpt),vect(NULL)
|
34 |
|
5 |
{
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
|
38 |
souaissa |
71 |
MG_SOMMET::MG_SOMMET(std::string idori,MG_POINT* mgpt):MG_ELEMENT_TOPOLOGIQUE(idori),point(mgpt),vect(NULL)
|
39 |
|
5 |
{
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
souaissa |
71 |
MG_SOMMET::MG_SOMMET(MG_SOMMET& mdd):MG_ELEMENT_TOPOLOGIQUE(mdd),point(mdd.point),vect(NULL)
|
45 |
|
5 |
{
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
MG_SOMMET::~MG_SOMMET()
|
50 |
|
|
{
|
51 |
|
|
// if (lst_cosommet.size()!=0) afficheur << WARCOSOMMET << this->get_id() << enderr;
|
52 |
souaissa |
71 |
if (vect!=NULL) delete vect;
|
53 |
|
5 |
}
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
MG_POINT* MG_SOMMET::get_point(void)
|
57 |
|
|
{
|
58 |
|
|
return point;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
void MG_SOMMET::ajouter_mg_cosommet(class MG_COSOMMET* cosom)
|
64 |
|
|
{
|
65 |
|
|
lst_cosommet.insert(lst_cosommet.end(),cosom);
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
int MG_SOMMET::get_nb_mg_cosommet(void)
|
69 |
|
|
{
|
70 |
|
|
return lst_cosommet.size();
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
void MG_SOMMET::supprimer_mg_cosommet(class MG_COSOMMET* cosom)
|
75 |
|
|
{
|
76 |
|
|
std::vector<MG_COSOMMET*>::iterator i;
|
77 |
|
|
for (i=lst_cosommet.begin();i!=lst_cosommet.end();i++)
|
78 |
|
|
{
|
79 |
souaissa |
71 |
if ((*i)==cosom)
|
80 |
|
5 |
{
|
81 |
|
|
lst_cosommet.erase(i);
|
82 |
|
|
return;
|
83 |
|
|
}
|
84 |
|
|
}
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
MG_COSOMMET* MG_SOMMET::get_mg_cosommet(int num)
|
90 |
|
|
{
|
91 |
|
|
return lst_cosommet[num];
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
int MG_SOMMET::get_dimension(void)
|
95 |
|
|
{
|
96 |
|
|
return 0;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
souaissa |
71 |
VCT& MG_SOMMET::get_vectorisation(void)
|
100 |
|
|
{
|
101 |
|
|
if (vect==NULL) vect=new VCT_SOMMET(this);
|
102 |
|
|
return *vect;
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
5 |
void MG_SOMMET::enregistrer(std::ostream& o)
|
106 |
|
|
{
|
107 |
|
|
int nb=get_nb_ccf();
|
108 |
|
|
o <<"%" << get_id() << "=SOMMET("<< get_idoriginal() << ",$" << point->get_id() << "," << nb;
|
109 |
|
|
if (nb!=0)
|
110 |
|
|
{
|
111 |
|
|
o << ",(";
|
112 |
|
|
for (int i=0;i<nb;i++)
|
113 |
|
|
{
|
114 |
|
|
char nom[3];
|
115 |
|
|
get_type_ccf(i,nom);
|
116 |
|
|
o << "(" << nom << "," << get_valeur_ccf(i) << ")";
|
117 |
|
|
if (i!=nb-1) o << "," ;
|
118 |
|
|
}
|
119 |
|
|
o << ")";
|
120 |
|
|
}
|
121 |
|
|
o << ");" << std::endl;
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|