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