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 |
// fem_triangle3.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_quadrangle8.h" |
27 |
#include "fem_maillage.h" |
28 |
#include "fem_noeud.h" |
29 |
#include "mg_element_maillage.h" |
30 |
#include "ot_quadrature_gauss.h" |
31 |
|
32 |
|
33 |
FEM_QUADRANGLE8::FEM_QUADRANGLE8(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,mai),FEM_TEMPLATE_ELEMENT<8>(tabnoeud) |
34 |
{ |
35 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
36 |
tab[0]->get_lien_element2()->ajouter(this); |
37 |
tab[1]->get_lien_element2()->ajouter(this); |
38 |
tab[2]->get_lien_element2()->ajouter(this); |
39 |
tab[3]->get_lien_element2()->ajouter(this); |
40 |
tab[4]->get_lien_element2()->ajouter(this); |
41 |
tab[5]->get_lien_element2()->ajouter(this); |
42 |
tab[6]->get_lien_element2()->ajouter(this); |
43 |
tab[7]->get_lien_element2()->ajouter(this); |
44 |
get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this); |
45 |
} |
46 |
|
47 |
FEM_QUADRANGLE8::FEM_QUADRANGLE8(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(mai),FEM_TEMPLATE_ELEMENT<8>(tabnoeud) |
48 |
{ |
49 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
50 |
tab[0]->get_lien_element2()->ajouter(this); |
51 |
tab[1]->get_lien_element2()->ajouter(this); |
52 |
tab[2]->get_lien_element2()->ajouter(this); |
53 |
tab[3]->get_lien_element2()->ajouter(this); |
54 |
tab[4]->get_lien_element2()->ajouter(this); |
55 |
tab[5]->get_lien_element2()->ajouter(this); |
56 |
tab[6]->get_lien_element2()->ajouter(this); |
57 |
tab[7]->get_lien_element2()->ajouter(this); |
58 |
get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this); |
59 |
} |
60 |
FEM_QUADRANGLE8::FEM_QUADRANGLE8(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo),FEM_TEMPLATE_ELEMENT<8>(tabnoeud) |
61 |
{ |
62 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
63 |
tab[0]->get_lien_element2()->ajouter(this); |
64 |
tab[1]->get_lien_element2()->ajouter(this); |
65 |
tab[2]->get_lien_element2()->ajouter(this); |
66 |
tab[3]->get_lien_element2()->ajouter(this); |
67 |
tab[4]->get_lien_element2()->ajouter(this); |
68 |
tab[5]->get_lien_element2()->ajouter(this); |
69 |
tab[6]->get_lien_element2()->ajouter(this); |
70 |
tab[7]->get_lien_element2()->ajouter(this); |
71 |
get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this); |
72 |
} |
73 |
|
74 |
FEM_QUADRANGLE8::FEM_QUADRANGLE8(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo),FEM_TEMPLATE_ELEMENT<8>(tabnoeud) |
75 |
{ |
76 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
77 |
tab[0]->get_lien_element2()->ajouter(this); |
78 |
tab[1]->get_lien_element2()->ajouter(this); |
79 |
tab[2]->get_lien_element2()->ajouter(this); |
80 |
tab[3]->get_lien_element2()->ajouter(this); |
81 |
tab[4]->get_lien_element2()->ajouter(this); |
82 |
tab[5]->get_lien_element2()->ajouter(this); |
83 |
tab[6]->get_lien_element2()->ajouter(this); |
84 |
tab[7]->get_lien_element2()->ajouter(this); |
85 |
get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this); |
86 |
} |
87 |
FEM_QUADRANGLE8::FEM_QUADRANGLE8(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo,mai),FEM_TEMPLATE_ELEMENT<8>(tabnoeud) |
88 |
{ |
89 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
90 |
tab[0]->get_lien_element2()->ajouter(this); |
91 |
tab[1]->get_lien_element2()->ajouter(this); |
92 |
tab[2]->get_lien_element2()->ajouter(this); |
93 |
tab[3]->get_lien_element2()->ajouter(this); |
94 |
tab[4]->get_lien_element2()->ajouter(this); |
95 |
tab[5]->get_lien_element2()->ajouter(this); |
96 |
tab[6]->get_lien_element2()->ajouter(this); |
97 |
tab[7]->get_lien_element2()->ajouter(this); |
98 |
get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this); |
99 |
} |
100 |
|
101 |
FEM_QUADRANGLE8::FEM_QUADRANGLE8(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo,mai),FEM_TEMPLATE_ELEMENT<8>(tabnoeud) |
102 |
{ |
103 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
104 |
tab[0]->get_lien_element2()->ajouter(this); |
105 |
tab[1]->get_lien_element2()->ajouter(this); |
106 |
tab[2]->get_lien_element2()->ajouter(this); |
107 |
tab[3]->get_lien_element2()->ajouter(this); |
108 |
tab[4]->get_lien_element2()->ajouter(this); |
109 |
tab[5]->get_lien_element2()->ajouter(this); |
110 |
tab[6]->get_lien_element2()->ajouter(this); |
111 |
tab[7]->get_lien_element2()->ajouter(this); |
112 |
get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this); |
113 |
} |
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
FEM_QUADRANGLE8::FEM_QUADRANGLE8(FEM_QUADRANGLE8& mdd):FEM_ELEMENT2(mdd),FEM_TEMPLATE_ELEMENT<8>(mdd) |
124 |
{ |
125 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
126 |
tab[0]->get_lien_element2()->ajouter(this); |
127 |
tab[1]->get_lien_element2()->ajouter(this); |
128 |
tab[2]->get_lien_element2()->ajouter(this); |
129 |
tab[3]->get_lien_element2()->ajouter(this); |
130 |
tab[4]->get_lien_element2()->ajouter(this); |
131 |
tab[5]->get_lien_element2()->ajouter(this); |
132 |
tab[6]->get_lien_element2()->ajouter(this); |
133 |
tab[7]->get_lien_element2()->ajouter(this); |
134 |
get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this); |
135 |
} |
136 |
FEM_QUADRANGLE8::~FEM_QUADRANGLE8() |
137 |
{ |
138 |
if (liaison_topologique!=NULL) |
139 |
if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this); |
140 |
tab[0]->get_lien_element2()->supprimer(this); |
141 |
tab[1]->get_lien_element2()->supprimer(this); |
142 |
tab[2]->get_lien_element2()->supprimer(this); |
143 |
tab[3]->get_lien_element2()->supprimer(this); |
144 |
tab[4]->get_lien_element2()->supprimer(this); |
145 |
tab[5]->get_lien_element2()->supprimer(this); |
146 |
tab[6]->get_lien_element2()->supprimer(this); |
147 |
tab[7]->get_lien_element2()->supprimer(this); |
148 |
get_fem_noeudpetitid()->get_lien_petit_element2()->supprimer(this); |
149 |
} |
150 |
|
151 |
|
152 |
FEM_ELEMENT_MAILLAGE* FEM_QUADRANGLE8::dupliquer(FEM_MAILLAGE *femmai,long decalage) |
153 |
{ |
154 |
FEM_NOEUD* tabnoeud[8]; |
155 |
tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage); |
156 |
tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage); |
157 |
tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage); |
158 |
tabnoeud[3]=femmai->get_fem_noeudid(tab[3]->get_id()+decalage); |
159 |
tabnoeud[4]=femmai->get_fem_noeudid(tab[4]->get_id()+decalage); |
160 |
tabnoeud[5]=femmai->get_fem_noeudid(tab[5]->get_id()+decalage); |
161 |
tabnoeud[6]=femmai->get_fem_noeudid(tab[6]->get_id()+decalage); |
162 |
tabnoeud[7]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage); |
163 |
FEM_QUADRANGLE8* quad=new FEM_QUADRANGLE8(get_id()+decalage,maillage,tabnoeud); |
164 |
femmai->ajouter_fem_element2(quad); |
165 |
return quad; |
166 |
} |
167 |
|
168 |
bool FEM_QUADRANGLE8::valide_parametre_EF(double* uvw) |
169 |
{ |
170 |
if (uvw[0]>=-1.-1e-10) |
171 |
if (uvw[1]>=-1.-1e-10) |
172 |
if (uvw[0]<=1.+1e-10) |
173 |
if (uvw[1]<=1.+1e-10) |
174 |
return true; |
175 |
return false; |
176 |
} |
177 |
|
178 |
void FEM_QUADRANGLE8::get_voisin_noeud(FEM_NOEUD* no, TPL_LISTE_ENTITE< FEM_NOEUD* >& voisin) |
179 |
{ |
180 |
voisin.vide(); |
181 |
if (no==tab[0]) |
182 |
{ |
183 |
voisin.ajouter(tab[1]); |
184 |
voisin.ajouter(tab[7]); |
185 |
} |
186 |
if (no==tab[1]) |
187 |
{ |
188 |
voisin.ajouter(tab[0]); |
189 |
voisin.ajouter(tab[2]); |
190 |
} |
191 |
if (no==tab[2]) |
192 |
{ |
193 |
voisin.ajouter(tab[1]); |
194 |
voisin.ajouter(tab[3]); |
195 |
} |
196 |
if (no==tab[3]) |
197 |
{ |
198 |
voisin.ajouter(tab[2]); |
199 |
voisin.ajouter(tab[4]); |
200 |
} |
201 |
if (no==tab[4]) |
202 |
{ |
203 |
voisin.ajouter(tab[3]); |
204 |
voisin.ajouter(tab[5]); |
205 |
} |
206 |
if (no==tab[5]) |
207 |
{ |
208 |
voisin.ajouter(tab[4]); |
209 |
voisin.ajouter(tab[6]); |
210 |
} |
211 |
if (no==tab[6]) |
212 |
{ |
213 |
voisin.ajouter(tab[5]); |
214 |
voisin.ajouter(tab[7]); |
215 |
} |
216 |
if (no==tab[7]) |
217 |
{ |
218 |
voisin.ajouter(tab[6]); |
219 |
voisin.ajouter(tab[0]); |
220 |
} |
221 |
} |
222 |
|
223 |
|
224 |
int FEM_QUADRANGLE8::get_type_entite(void) |
225 |
{ |
226 |
return IDFEM_QUADRANGLE8; |
227 |
} |
228 |
|
229 |
int FEM_QUADRANGLE8::get_dimension(void) |
230 |
{ |
231 |
return 2; |
232 |
} |
233 |
|
234 |
void FEM_QUADRANGLE8::reinit_boite_3D(void) |
235 |
{ |
236 |
FEM_TEMPLATE_ELEMENT<8>::reinit_boite_3D(); |
237 |
} |
238 |
|
239 |
int FEM_QUADRANGLE8::get_nb_fem_noeud(void) |
240 |
{ |
241 |
return FEM_TEMPLATE_ELEMENT<8>::get_nb_fem_noeud(); |
242 |
} |
243 |
|
244 |
FEM_NOEUD* FEM_QUADRANGLE8::get_fem_noeud(int num) |
245 |
{ |
246 |
return FEM_TEMPLATE_ELEMENT<8>::get_fem_noeud(num); |
247 |
} |
248 |
|
249 |
void FEM_QUADRANGLE8::change_noeud(int num,FEM_NOEUD* noeud) |
250 |
{ |
251 |
FEM_TEMPLATE_ELEMENT<8>::change_noeud(num,noeud); |
252 |
} |
253 |
|
254 |
BOITE_3D& FEM_QUADRANGLE8::get_boite_3D(void) |
255 |
{ |
256 |
return FEM_TEMPLATE_ELEMENT<8>::get_boite_3D(); |
257 |
} |
258 |
|
259 |
|
260 |
void FEM_QUADRANGLE8::enregistrer(std::ostream& o,double version) |
261 |
{ |
262 |
if (maillage!=NULL) |
263 |
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_QUADRANGLE8($"<< get_lien_topologie()->get_id() << ",$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ",$" << tab[6]->get_id()<< ",$" << tab[7]->get_id()<< ");" << std::endl; |
264 |
else o << "%" << get_id() << "=FEM_QUADRANGLE8(NULL,$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ",$" << tab[6]->get_id()<< ",$" << tab[7]->get_id()<<");" << std::endl; |
265 |
else |
266 |
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_QUADRANGLE8($"<< get_lien_topologie()->get_id() << ",NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ",$" << tab[6]->get_id()<< ",$" << tab[7]->get_id()<< ");" << std::endl; |
267 |
else o << "%" << get_id() << "=FEM_QUADRANGLE8(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ",$" << tab[4]->get_id() << ",$" << tab[5]->get_id() << ",$" << tab[6]->get_id()<< ",$" << tab[7]->get_id()<<");" << std::endl; |
268 |
|
269 |
} |
270 |
|
271 |
int FEM_QUADRANGLE8::get_nb_pt_gauss(int degre) |
272 |
{ |
273 |
return OT_POINTS_GAUSS::get_nb_point_quad_prod(degre); |
274 |
} |
275 |
|
276 |
void FEM_QUADRANGLE8::get_pt_gauss(int degre,int num,double &w,double *uv) |
277 |
{ |
278 |
return OT_POINTS_GAUSS::get_pt_gauss_qua_prod(degre,num,w,uv); |
279 |
} |
280 |
|
281 |
int FEM_QUADRANGLE8::get_degre_gauss(int num) |
282 |
{ |
283 |
return OT_POINTS_GAUSS::get_degre_gauss_quad_prod(num); |
284 |
} |
285 |
|
286 |
|
287 |
int FEM_QUADRANGLE8::get_nb_fonction_interpolation(void) |
288 |
{ |
289 |
return 8; |
290 |
} |
291 |
|
292 |
int FEM_QUADRANGLE8::get_degremax_fonction_interpolation(void) |
293 |
{ |
294 |
return 3; |
295 |
} |
296 |
double FEM_QUADRANGLE8::get_fonction_interpolation(int num,double *uv) |
297 |
{ |
298 |
double val; |
299 |
switch (num) |
300 |
{ |
301 |
case 1: |
302 |
val=-0.25*(1-uv[0])*(1-uv[1])*(1.+uv[0]+uv[1]); |
303 |
break; |
304 |
case 2: |
305 |
val=0.5*(1-uv[0]*uv[0])*(1-uv[1]); |
306 |
break; |
307 |
case 3: |
308 |
val=-0.25*(1+uv[0])*(1-uv[1])*(1.-uv[0]+uv[1]); |
309 |
break; |
310 |
case 4: |
311 |
val=0.5*(1+uv[0])*(1-uv[1]*uv[1]); |
312 |
break; |
313 |
case 5: |
314 |
val=-0.25*(1+uv[0])*(1+uv[1])*(1.-uv[0]-uv[1]); |
315 |
break; |
316 |
case 6: |
317 |
val=0.5*(1-uv[0]*uv[0])*(1+uv[1]); |
318 |
break; |
319 |
case 7: |
320 |
val=-0.25*(1-uv[0])*(1+uv[1])*(1.+uv[0]-uv[1]); |
321 |
break; |
322 |
case 8: |
323 |
val=0.5*(1-uv[0])*(1-uv[1]*uv[1]); |
324 |
break; |
325 |
} |
326 |
return val; |
327 |
} |
328 |
|
329 |
double FEM_QUADRANGLE8::get_fonction_derive_interpolation(int num,int num_variable,double *uv) |
330 |
{ |
331 |
double val; |
332 |
|
333 |
switch (num) |
334 |
{ |
335 |
case 1: |
336 |
switch (num_variable) |
337 |
{ |
338 |
case 1: |
339 |
val=0.25*(1-uv[1])*(2*uv[0]+uv[1]); |
340 |
break; |
341 |
case 2: |
342 |
val=0.25*(1-uv[0])*(uv[0]+2.*uv[1]); |
343 |
break; |
344 |
} break; |
345 |
case 2: |
346 |
switch (num_variable) |
347 |
{ |
348 |
case 1: |
349 |
val=-uv[0]*(1.-uv[1]); |
350 |
break; |
351 |
case 2: |
352 |
val=-0.5*(1-uv[0]*uv[0]); |
353 |
break; |
354 |
}break; |
355 |
case 3: |
356 |
switch (num_variable) |
357 |
{ |
358 |
case 1: |
359 |
val=0.25*(1.-uv[1])*(2*uv[0]-uv[1]); |
360 |
break; |
361 |
case 2: |
362 |
val=-0.25*(1.+uv[0])*(uv[0]-2.*uv[1]); |
363 |
break; |
364 |
}break; |
365 |
case 4: |
366 |
switch (num_variable) |
367 |
{ |
368 |
case 1: |
369 |
val=0.5*(1.-uv[1]*uv[1]); |
370 |
break; |
371 |
case 2: |
372 |
val=-uv[1]*(1+uv[0]); |
373 |
break; |
374 |
}break; |
375 |
case 5: |
376 |
switch (num_variable) |
377 |
{ |
378 |
case 1: |
379 |
val=0.25*(1+uv[1])*(2*uv[0]+uv[1]); |
380 |
break; |
381 |
case 2: |
382 |
val=0.25*(1+uv[0])*(uv[0]+2.*uv[1]); |
383 |
break; |
384 |
} break; |
385 |
case 6: |
386 |
switch (num_variable) |
387 |
{ |
388 |
case 1: |
389 |
val=-uv[0]*(1.+uv[1]); |
390 |
break; |
391 |
case 2: |
392 |
val=-0.5*(1-uv[0]*uv[0]); |
393 |
break; |
394 |
}break; |
395 |
case 7: |
396 |
switch (num_variable) |
397 |
{ |
398 |
case 1: |
399 |
val=0.25*(1.+uv[1])*(2*uv[0]-uv[1]); |
400 |
break; |
401 |
case 2: |
402 |
val=-0.25*(1.-uv[0])*(uv[0]-2.*uv[1]); |
403 |
break; |
404 |
}break; |
405 |
case 8: |
406 |
switch (num_variable) |
407 |
{ |
408 |
case 1: |
409 |
val=-0.5*(1.-uv[1]*uv[1]); |
410 |
break; |
411 |
case 2: |
412 |
val=-uv[1]*(1+uv[0]); |
413 |
break; |
414 |
}break; |
415 |
|
416 |
} |
417 |
return val; |
418 |
} |
419 |
|
420 |
double FEM_QUADRANGLE8::get_jacobien(double* jac,double *uv,int& li,int& col,double unite) |
421 |
{ |
422 |
return 0.; |
423 |
} |
424 |
|
425 |
void FEM_QUADRANGLE8::get_inverse_jacob(double* j,double *uv,double unite) |
426 |
{ |
427 |
|
428 |
} |