1 |
//------------------------------------------------------------ |
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_poutre.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_poutre.h" |
27 |
//#include "message.h" |
28 |
|
29 |
MG_POUTRE::MG_POUTRE(std::string idori,unsigned long num):MG_ELEMENT_TOPOLOGIQUE(num,idori),num_materiau(-1) |
30 |
{ |
31 |
} |
32 |
|
33 |
MG_POUTRE::MG_POUTRE(std::string idori):MG_ELEMENT_TOPOLOGIQUE(idori),num_materiau(-1) |
34 |
{ |
35 |
} |
36 |
|
37 |
MG_POUTRE::MG_POUTRE(MG_POUTRE& mdd):MG_ELEMENT_TOPOLOGIQUE(mdd),lst_boucle(mdd.lst_boucle) |
38 |
{ |
39 |
} |
40 |
|
41 |
MG_POUTRE::~MG_POUTRE() |
42 |
{ |
43 |
} |
44 |
|
45 |
void MG_POUTRE::ajouter_mg_boucle(class MG_BOUCLE* mgbou) |
46 |
{ |
47 |
lst_boucle.insert(lst_boucle.end(),mgbou); |
48 |
} |
49 |
bool MG_POUTRE::est_une_poutre_element(void) |
50 |
{ |
51 |
return false; |
52 |
} |
53 |
void MG_POUTRE::supprimer_mg_boucle(class MG_BOUCLE* mgbou) |
54 |
{ |
55 |
std::vector<MG_BOUCLE*>::iterator i; |
56 |
for (i=lst_boucle.begin();i!=lst_boucle.end();i++) |
57 |
{ |
58 |
if ((*i)==mgbou) |
59 |
{ |
60 |
lst_boucle.erase(i); |
61 |
return; |
62 |
} |
63 |
} |
64 |
} |
65 |
|
66 |
|
67 |
int MG_POUTRE::get_nb_mg_boucle(void) |
68 |
{ |
69 |
return lst_boucle.size(); |
70 |
} |
71 |
|
72 |
MG_BOUCLE* MG_POUTRE::get_mg_boucle(int num) |
73 |
{ |
74 |
return lst_boucle[num]; |
75 |
} |
76 |
|
77 |
int MG_POUTRE::get_dimension(void) |
78 |
{ |
79 |
return 1; |
80 |
} |
81 |
|
82 |
int MG_POUTRE::get_type(void) |
83 |
{ |
84 |
return TYPE_ELEMENT_TOPOLOGIQUE::POUTRE; |
85 |
} |
86 |
|
87 |
void MG_POUTRE::get_topologie_sousjacente(TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> *lst) |
88 |
{ |
89 |
int nb=lst_boucle.size(); |
90 |
for (int i=0;i<nb;i++) |
91 |
{ |
92 |
MG_BOUCLE* bou=lst_boucle[i]; |
93 |
int nb2=bou->get_nb_mg_coarete(); |
94 |
for (int j=0;j<nb2;j++) |
95 |
{ |
96 |
MG_ARETE* are=bou->get_mg_coarete(j)->get_arete(); |
97 |
lst->ajouter(are); |
98 |
are->get_topologie_sousjacente(lst); |
99 |
} |
100 |
} |
101 |
} |
102 |
|
103 |
void MG_POUTRE::enregistrer(std::ostream& o,double version) |
104 |
{ |
105 |
o << "%" << get_id() << "=POUTRE(" << get_idoriginal() << ",("; |
106 |
for (unsigned int i=0;i<lst_boucle.size();i++) |
107 |
{ |
108 |
o << "$" << lst_boucle[i]->get_id(); |
109 |
if (i!=lst_boucle.size()-1) o << ","; |
110 |
else o << ")"; |
111 |
} |
112 |
int nb=get_nb_ccf(); |
113 |
if (version<2) |
114 |
{ |
115 |
o << "," << num_materiau << "," << nb; |
116 |
if (nb!=0) |
117 |
{ |
118 |
o << ",("; |
119 |
for (int i=0;i<nb;i++) |
120 |
{ |
121 |
char nom[3]; |
122 |
get_type_ccf(i,nom); |
123 |
o << "(" << nom << "," << get_valeur_ccf(i) << ")"; |
124 |
if (i!=nb-1) o << "," ; |
125 |
} |
126 |
o << ")"; |
127 |
} |
128 |
o << ");" << std::endl; |
129 |
} |
130 |
else |
131 |
{ |
132 |
o << "," ; |
133 |
enregistrer_ccf(o,version); |
134 |
o << ");" << std::endl; |
135 |
} |
136 |
} |
137 |
|
138 |
void MG_POUTRE::change_num_materiau(int num) |
139 |
{ |
140 |
num_materiau=num; |
141 |
} |
142 |
|
143 |
int MG_POUTRE::get_num_materiau(void) |
144 |
{ |
145 |
return num_materiau; |
146 |
} |
147 |
bool MG_POUTRE::contient_element(MG_ELEMENT_MAILLAGE *ele) |
148 |
{ |
149 |
bool res=get_lien_maillage()->contient(ele); |
150 |
return res; |
151 |
} |
152 |
|
153 |
VCT& MG_POUTRE::get_vectorisation(void) |
154 |
{ |
155 |
VCT *p=NULL; |
156 |
return *p; |
157 |
} |