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 |
|
|
// fem_segment3.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H22 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h" |
26 |
|
|
#include "fem_segment3.h" |
27 |
|
|
#include "fem_noeud.h" |
28 |
|
|
#include "fem_maillage.h" |
29 |
|
|
#include "mg_element_maillage.h" |
30 |
|
|
|
31 |
|
|
|
32 |
francois |
309 |
FEM_SEGMENT3::FEM_SEGMENT3(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
33 |
francois |
283 |
{ |
34 |
francois |
378 |
tab[0]->get_lien_element1()->ajouter(this); |
35 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
36 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
37 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
38 |
francois |
283 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
39 |
francois |
378 |
|
40 |
|
|
} |
41 |
|
|
FEM_SEGMENT3::FEM_SEGMENT3(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,topo),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
42 |
|
|
{ |
43 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
44 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
45 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
46 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
47 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
48 |
francois |
283 |
} |
49 |
|
|
|
50 |
francois |
378 |
FEM_SEGMENT3::FEM_SEGMENT3(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,topo,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
51 |
|
|
{ |
52 |
|
|
tab[0]->get_lien_element1()->ajouter(this); |
53 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
54 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
55 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
56 |
|
|
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
57 |
|
|
} |
58 |
francois |
309 |
FEM_SEGMENT3::FEM_SEGMENT3(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
59 |
francois |
283 |
{ |
60 |
francois |
378 |
tab[0]->get_lien_element1()->ajouter(this); |
61 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
62 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
63 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
64 |
francois |
283 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
65 |
francois |
378 |
|
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
FEM_SEGMENT3::FEM_SEGMENT3(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(topo),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
69 |
|
|
{ |
70 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
71 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
72 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
73 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
74 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
75 |
francois |
283 |
} |
76 |
|
|
|
77 |
francois |
378 |
FEM_SEGMENT3::FEM_SEGMENT3(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(topo,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
78 |
|
|
{ |
79 |
|
|
tab[0]->get_lien_element1()->ajouter(this); |
80 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
81 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
82 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
83 |
|
|
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
francois |
684 |
void FEM_SEGMENT3::reinit_boite_3D(void) |
89 |
|
|
{ |
90 |
|
|
FEM_TEMPLATE_ELEMENT<3>::reinit_boite_3D(); |
91 |
|
|
} |
92 |
francois |
378 |
|
93 |
|
|
|
94 |
francois |
309 |
FEM_SEGMENT3::FEM_SEGMENT3(FEM_SEGMENT3& mdd):FEM_ELEMENT1(mdd),FEM_TEMPLATE_ELEMENT<3>(mdd) |
95 |
francois |
283 |
{ |
96 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
97 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
98 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
99 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
100 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
101 |
|
|
|
102 |
francois |
283 |
} |
103 |
|
|
|
104 |
|
|
FEM_SEGMENT3::~FEM_SEGMENT3() |
105 |
|
|
{ |
106 |
francois |
663 |
if (liaison_topologique!=NULL) |
107 |
|
|
if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this); |
108 |
francois |
309 |
tab[0]->get_lien_element1()->supprimer(this); |
109 |
|
|
tab[1]->get_lien_element1()->supprimer(this); |
110 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->supprimer(this); |
111 |
francois |
283 |
} |
112 |
|
|
|
113 |
|
|
FEM_ELEMENT_MAILLAGE* FEM_SEGMENT3::dupliquer(FEM_MAILLAGE *femmai,long decalage) |
114 |
|
|
{ |
115 |
|
|
FEM_NOEUD* tabnoeud[3]; |
116 |
|
|
tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage); |
117 |
|
|
tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage); |
118 |
|
|
tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage); |
119 |
|
|
FEM_SEGMENT3* seg=new FEM_SEGMENT3(get_id()+decalage,maillage,tabnoeud); |
120 |
francois |
309 |
femmai->ajouter_fem_element1(seg); |
121 |
francois |
283 |
return seg; |
122 |
|
|
} |
123 |
|
|
|
124 |
francois |
635 |
bool FEM_SEGMENT3::valide_parametre_EF(double* uvw) |
125 |
|
|
{ |
126 |
|
|
if (uvw[0]>=-1e-10) |
127 |
|
|
if (uvw[0]<=1.+1e-10) |
128 |
|
|
return true; |
129 |
|
|
return false; |
130 |
|
|
} |
131 |
francois |
283 |
|
132 |
|
|
|
133 |
francois |
635 |
|
134 |
francois |
283 |
int FEM_SEGMENT3::get_type_entite(void) |
135 |
|
|
{ |
136 |
|
|
return IDFEM_SEGMENT3; |
137 |
|
|
} |
138 |
|
|
|
139 |
|
|
int FEM_SEGMENT3::get_dimension(void) |
140 |
|
|
{ |
141 |
|
|
return 1; |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
|
145 |
|
|
int FEM_SEGMENT3::get_nb_fem_noeud(void) |
146 |
|
|
{ |
147 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_nb_fem_noeud(); |
148 |
|
|
} |
149 |
|
|
|
150 |
|
|
FEM_NOEUD* FEM_SEGMENT3::get_fem_noeud(int num) |
151 |
|
|
{ |
152 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_fem_noeud(num); |
153 |
|
|
} |
154 |
|
|
|
155 |
|
|
void FEM_SEGMENT3::change_noeud(int num,FEM_NOEUD* noeud) |
156 |
|
|
{ |
157 |
|
|
FEM_TEMPLATE_ELEMENT<3>::change_noeud(num,noeud); |
158 |
|
|
} |
159 |
|
|
|
160 |
|
|
BOITE_3D& FEM_SEGMENT3::get_boite_3D(void) |
161 |
|
|
{ |
162 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_boite_3D(); |
163 |
|
|
} |
164 |
|
|
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
void FEM_SEGMENT3::enregistrer(std::ostream& o) |
168 |
|
|
{ |
169 |
francois |
378 |
if (maillage!=NULL) |
170 |
|
|
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_SEGMENT3($"<< get_lien_topologie()->get_id() << ",$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
171 |
|
|
else o << "%" << get_id() << "=FEM_SEGMENT3(NULL,$" << maillage->get_id() <<",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
172 |
|
|
else |
173 |
|
|
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_SEGMENT3($"<< get_lien_topologie()->get_id() << ",NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
174 |
|
|
else o << "%" << get_id() << "=FEM_SEGMENT3(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
175 |
|
|
|
176 |
francois |
283 |
} |
177 |
francois |
637 |
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
int FEM_SEGMENT3::get_nb_pt_gauss(int degre) |
181 |
|
|
{ |
182 |
|
|
if (degre<2) return 1; |
183 |
|
|
if (degre<4) return 2; |
184 |
|
|
if (degre<6) return 3; |
185 |
|
|
if (degre<8) return 4; |
186 |
|
|
if (degre<10) return 5; |
187 |
|
|
if (degre<12) return 6; |
188 |
|
|
if (degre<14) return 7; |
189 |
|
|
return 0; |
190 |
|
|
} |
191 |
|
|
|
192 |
|
|
void FEM_SEGMENT3::get_pt_gauss(int degre,int num,double &w,double *u) |
193 |
|
|
{ |
194 |
|
|
if (degre<2) |
195 |
|
|
{ |
196 |
|
|
if (num==0) {w=2;u[0]=0;} |
197 |
|
|
return; |
198 |
|
|
} |
199 |
|
|
if (degre<4) |
200 |
|
|
{ |
201 |
|
|
if (num==0) {w=1;u[0]=-0.577350269189626;} |
202 |
|
|
if (num==1) {w=1;u[0]=0.577350269189626;} |
203 |
|
|
return; |
204 |
|
|
} |
205 |
|
|
if (degre<6) |
206 |
|
|
{ |
207 |
|
|
if (num==0) {w=0.888888888888889;u[0]=0.;} |
208 |
|
|
if (num==1) {w=0.555555555555556;u[0]=-0.774596669241483;} |
209 |
|
|
if (num==2) {w=0.555555555555556;u[0]=0.774596669241483;} |
210 |
|
|
return; |
211 |
|
|
} |
212 |
|
|
if (degre<8) |
213 |
|
|
{ |
214 |
|
|
if (num==0) {w=0.652145154862546;u[0]=-0.339981043584856;} |
215 |
|
|
if (num==1) {w=0.652145154862546;u[0]=0.339981043584856;} |
216 |
|
|
if (num==2) {w=0.347854845137454;u[0]=-0.861136311594053;} |
217 |
|
|
if (num==3) {w=0.347854845137454;u[0]=0.861136311594053;} |
218 |
|
|
return; |
219 |
|
|
} |
220 |
|
|
if (degre<10) |
221 |
|
|
{ |
222 |
|
|
if (num==0) {w=0.568888888888889;u[0]=0.;} |
223 |
|
|
if (num==1) {w=0.478628670499366;u[0]=-0.538469310105683;} |
224 |
|
|
if (num==2) {w=0.478628670499366;u[0]=0.538469310105683;} |
225 |
|
|
if (num==3) {w=0.236926885056189;u[0]=-0.906179845938664;} |
226 |
|
|
if (num==4) {w=0.236926885056189;u[0]=0.906179845938664;} |
227 |
|
|
return; |
228 |
|
|
} |
229 |
|
|
if (degre<12) |
230 |
|
|
{ |
231 |
|
|
if (num==0) {w=0.467913934572691;u[0]=-0.238619186083197;} |
232 |
|
|
if (num==1) {w=0.467913934572691;u[0]=0.238619186083197;} |
233 |
|
|
if (num==2) {w=0.360761573048139;u[0]=-0.661209386466265;} |
234 |
|
|
if (num==3) {w=0.360761573048139;u[0]=0.661209386466265;} |
235 |
|
|
if (num==4) {w=0.171324492379170;u[0]=-0.932469514203152;} |
236 |
|
|
if (num==5) {w=0.171324492379170;u[0]=0.932469514203152;} |
237 |
|
|
return; |
238 |
|
|
} |
239 |
|
|
if (degre<14) |
240 |
|
|
{ |
241 |
|
|
if (num==0) {w=0.417959183673469;u[0]=0;} |
242 |
|
|
if (num==1) {w=0.381830050505119;u[0]=-0.405845151377397;} |
243 |
|
|
if (num==2) {w=0.381830050505119;u[0]=0.405845151377397;} |
244 |
|
|
if (num==3) {w=0.279705391489277;u[0]=-0.741531185599394;} |
245 |
|
|
if (num==4) {w=0.279705391489277;u[0]=0.741531185599394;} |
246 |
|
|
if (num==5) {w=0.129484966168870;u[0]=-0.949107912342759;} |
247 |
|
|
if (num==6) {w=0.129484966168870;u[0]=0.949107912342759;} |
248 |
|
|
return; |
249 |
|
|
} |
250 |
|
|
} |
251 |
|
|
|
252 |
francois |
638 |
int FEM_SEGMENT3::get_nb_fonction_interpolation(void) |
253 |
francois |
310 |
{ |
254 |
|
|
return 3; |
255 |
|
|
} |
256 |
|
|
|
257 |
francois |
638 |
int FEM_SEGMENT3::get_degremax_fonction_interpolation(void) |
258 |
|
|
{ |
259 |
|
|
return 2; |
260 |
|
|
} |
261 |
francois |
310 |
double FEM_SEGMENT3::get_fonction_interpolation(int num,double *uv) |
262 |
|
|
{ |
263 |
|
|
double val; |
264 |
|
|
switch (num) |
265 |
|
|
{ |
266 |
|
|
case 1: |
267 |
|
|
val=-0.5*uv[0]*(1.-uv[0]); |
268 |
|
|
break; |
269 |
|
|
case 2: |
270 |
|
|
val=1.-uv[0]*uv[0]; |
271 |
|
|
break; |
272 |
|
|
case 3: |
273 |
|
|
val=0.5*uv[0]*(1.+uv[0]); |
274 |
|
|
break; |
275 |
|
|
} |
276 |
|
|
return val; |
277 |
|
|
} |
278 |
|
|
|
279 |
|
|
double FEM_SEGMENT3::get_fonction_derive_interpolation(int num,int num_variable,double *uv) |
280 |
|
|
{ |
281 |
|
|
double val; |
282 |
|
|
|
283 |
|
|
switch (num) |
284 |
|
|
{ |
285 |
|
|
case 1: |
286 |
|
|
switch (num_variable) |
287 |
|
|
{ |
288 |
|
|
case 1: |
289 |
|
|
val=-0.5+uv[0]; |
290 |
|
|
break; |
291 |
|
|
case 2: |
292 |
|
|
val=-2.*uv[0]; |
293 |
|
|
break; |
294 |
|
|
case 3: |
295 |
|
|
val=0.5+uv[0]; |
296 |
|
|
break; |
297 |
|
|
} |
298 |
|
|
break; |
299 |
|
|
|
300 |
|
|
} |
301 |
|
|
return val; |
302 |
|
|
} |
303 |
|
|
|
304 |
|
|
double FEM_SEGMENT3::get_jacobien(double* jac,double *uv,int& li,int& col,double unite) |
305 |
|
|
{ |
306 |
|
|
|
307 |
|
|
} |
308 |
|
|
|
309 |
|
|
void FEM_SEGMENT3::get_inverse_jacob(double* j,double *uv,double unite) |
310 |
|
|
{ |
311 |
|
|
|
312 |
|
|
} |