ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_quadrangle8.cpp
Revision: 637
Committed: Mon Jan 26 21:26:37 2015 UTC (10 years, 7 months ago) by francois
File size: 14518 byte(s)
Log Message:
entree des points de gauss pour les différents éléments finis depuis reference JCC

File Contents

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