1 |
francois |
283 |
//------------------------------------------------------------ |
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_coquille.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_coquille.h" |
27 |
gervaislavoie |
329 |
#include "mg_coque.h" |
28 |
francois |
283 |
//#include "message.h" |
29 |
|
|
|
30 |
francois |
881 |
MG_COQUILLE::MG_COQUILLE(unsigned long num,class MG_VOLUME* mgvol):MG_ELEMENT_COTOPOLOGIQUE(num),volume(mgvol),coque(NULL) |
31 |
francois |
283 |
{ |
32 |
|
|
} |
33 |
|
|
|
34 |
francois |
881 |
MG_COQUILLE::MG_COQUILLE(unsigned long num,class MG_COQUE* mgcoq):MG_ELEMENT_COTOPOLOGIQUE(num),volume(NULL),coque(mgcoq) |
35 |
francois |
283 |
{ |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
|
39 |
francois |
881 |
MG_COQUILLE::MG_COQUILLE(class MG_VOLUME* mgvol):MG_ELEMENT_COTOPOLOGIQUE(),volume(mgvol),coque(NULL) |
40 |
francois |
283 |
{ |
41 |
|
|
} |
42 |
|
|
|
43 |
francois |
881 |
MG_COQUILLE::MG_COQUILLE(class MG_COQUE* mgcoq):MG_ELEMENT_COTOPOLOGIQUE(),volume(NULL),coque(mgcoq) |
44 |
francois |
283 |
{ |
45 |
|
|
} |
46 |
|
|
|
47 |
couturad |
906 |
MG_COQUILLE::MG_COQUILLE(long unsigned int num): MG_ELEMENT_COTOPOLOGIQUE(num),volume(NULL),coque(NULL) |
48 |
|
|
{ |
49 |
|
|
} |
50 |
francois |
283 |
|
51 |
couturad |
906 |
|
52 |
|
|
MG_COQUILLE::MG_COQUILLE():MG_ELEMENT_COTOPOLOGIQUE(),volume(NULL),coque(NULL) |
53 |
|
|
{ |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
francois |
881 |
MG_COQUILLE::MG_COQUILLE(MG_COQUILLE& mdd):MG_ELEMENT_COTOPOLOGIQUE(),volume(mdd.volume),lst_coface(mdd.lst_coface),coque(mdd.coque) |
59 |
francois |
283 |
{ |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
|
63 |
|
|
MG_COQUILLE::~MG_COQUILLE() |
64 |
|
|
{ |
65 |
|
|
} |
66 |
|
|
|
67 |
couturad |
906 |
int MG_COQUILLE::get_type(void) |
68 |
|
|
{ |
69 |
|
|
return TYPE_ELEMENT_COTOPOLOGIQUE::COQUILLE; |
70 |
|
|
} |
71 |
francois |
283 |
|
72 |
couturad |
906 |
|
73 |
francois |
283 |
void MG_COQUILLE::ajouter_mg_coface(class MG_COFACE* mgcoface) |
74 |
|
|
{ |
75 |
|
|
lst_coface.insert(lst_coface.end(),mgcoface); |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
int MG_COQUILLE::get_nb_mg_coface(void) |
79 |
|
|
{ |
80 |
|
|
return lst_coface.size(); |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
MG_VOLUME* MG_COQUILLE::get_mg_volume(void) |
84 |
|
|
{ |
85 |
|
|
return volume; |
86 |
|
|
} |
87 |
|
|
|
88 |
gervaislavoie |
329 |
MG_COQUE* MG_COQUILLE::get_mg_coque(void) |
89 |
|
|
{ |
90 |
|
|
return coque; |
91 |
|
|
} |
92 |
francois |
283 |
MG_COFACE* MG_COQUILLE::get_mg_coface(int num) |
93 |
|
|
{ |
94 |
|
|
return lst_coface[num]; |
95 |
|
|
} |
96 |
|
|
|
97 |
francois |
878 |
MG_COFACE* MG_COQUILLE::get_mg_cofaceid(int num) |
98 |
|
|
{ |
99 |
|
|
for (std::vector<MG_COFACE*>::iterator it=lst_coface.begin();it!=lst_coface.end();it++) |
100 |
|
|
if ((*it)->get_id()==num) return *it; |
101 |
|
|
return NULL; |
102 |
|
|
|
103 |
|
|
} |
104 |
|
|
|
105 |
francois |
283 |
void MG_COQUILLE::supprimer_mg_coface(class MG_COFACE* mgcoface) |
106 |
|
|
{ |
107 |
|
|
std::vector<MG_COFACE*>::iterator i; |
108 |
|
|
for (i=lst_coface.begin();i!=lst_coface.end();i++) |
109 |
|
|
{ |
110 |
|
|
if ((*i)==mgcoface) |
111 |
|
|
{ |
112 |
|
|
lst_coface.erase(i); |
113 |
|
|
return; |
114 |
|
|
} |
115 |
|
|
} |
116 |
|
|
} |
117 |
|
|
|
118 |
|
|
|
119 |
francois |
763 |
void MG_COQUILLE::enregistrer(std::ostream& o,double version) |
120 |
francois |
283 |
{ |
121 |
francois |
876 |
if (volume!=NULL) |
122 |
|
|
{ |
123 |
francois |
881 |
o << "%" << get_id() << "=COQUILLE($"<< volume->get_id() << ",("; |
124 |
francois |
876 |
} |
125 |
francois |
283 |
if (coque!=NULL) o << "%" << get_id() << "=COQUILLE($"<< coque->get_id() << ",("; |
126 |
|
|
for (unsigned int i=0;i<lst_coface.size();i++) |
127 |
|
|
{ |
128 |
|
|
o << "$" << lst_coface[i]->get_id(); |
129 |
|
|
if (i!=lst_coface.size()-1) o << ","; |
130 |
|
|
else o << ")"; |
131 |
|
|
} |
132 |
|
|
o << ");" << std::endl; |
133 |
|
|
} |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|