ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_hexa20.cpp
Revision: 944
Committed: Tue Jun 12 15:51:19 2018 UTC (6 years, 11 months ago) by couturad
File size: 32711 byte(s)
Log Message:
Correction des bugs detectes par Cppcheck

File Contents

# User Rev Content
1 francois 310 //------------------------------------------------------------
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_hexa20.h"
27     #include "fem_maillage.h"
28     #include "fem_noeud.h"
29     #include "mg_element_maillage.h"
30     #include "ot_tenseur.h"
31 francois 754 #include "ot_quadrature_gauss.h"
32 francois 310
33    
34     FEM_HEXA20::FEM_HEXA20(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT3(num,mai),FEM_TEMPLATE_ELEMENT<20>(tabnoeud)
35     {
36 francois 581 if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
37 francois 310 tab[0]->get_lien_element3()->ajouter(this);
38     tab[1]->get_lien_element3()->ajouter(this);
39     tab[2]->get_lien_element3()->ajouter(this);
40     tab[3]->get_lien_element3()->ajouter(this);
41     tab[4]->get_lien_element3()->ajouter(this);
42     tab[5]->get_lien_element3()->ajouter(this);
43     tab[6]->get_lien_element3()->ajouter(this);
44     tab[7]->get_lien_element3()->ajouter(this);
45     tab[8]->get_lien_element3()->ajouter(this);
46     tab[9]->get_lien_element3()->ajouter(this);
47     tab[10]->get_lien_element3()->ajouter(this);
48     tab[11]->get_lien_element3()->ajouter(this);
49     tab[12]->get_lien_element3()->ajouter(this);
50     tab[13]->get_lien_element3()->ajouter(this);
51     tab[14]->get_lien_element3()->ajouter(this);
52     tab[15]->get_lien_element3()->ajouter(this);
53     tab[16]->get_lien_element3()->ajouter(this);
54     tab[17]->get_lien_element3()->ajouter(this);
55     tab[18]->get_lien_element3()->ajouter(this);
56     tab[19]->get_lien_element3()->ajouter(this);
57     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
58     }
59    
60     FEM_HEXA20::FEM_HEXA20(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT3(mai),FEM_TEMPLATE_ELEMENT<20>(tabnoeud)
61     {
62 francois 581 if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
63 francois 310 tab[0]->get_lien_element3()->ajouter(this);
64     tab[1]->get_lien_element3()->ajouter(this);
65     tab[2]->get_lien_element3()->ajouter(this);
66     tab[3]->get_lien_element3()->ajouter(this);
67     tab[4]->get_lien_element3()->ajouter(this);
68     tab[5]->get_lien_element3()->ajouter(this);
69     tab[6]->get_lien_element3()->ajouter(this);
70     tab[7]->get_lien_element3()->ajouter(this);
71     tab[8]->get_lien_element3()->ajouter(this);
72     tab[9]->get_lien_element3()->ajouter(this);
73     tab[10]->get_lien_element3()->ajouter(this);
74     tab[11]->get_lien_element3()->ajouter(this);
75     tab[12]->get_lien_element3()->ajouter(this);
76     tab[13]->get_lien_element3()->ajouter(this);
77     tab[14]->get_lien_element3()->ajouter(this);
78     tab[15]->get_lien_element3()->ajouter(this);
79     tab[16]->get_lien_element3()->ajouter(this);
80     tab[17]->get_lien_element3()->ajouter(this);
81     tab[18]->get_lien_element3()->ajouter(this);
82     tab[19]->get_lien_element3()->ajouter(this);
83     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
84     }
85    
86 francois 378 FEM_HEXA20::FEM_HEXA20(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class FEM_NOEUD** tabnoeud):FEM_ELEMENT3(num,topo),FEM_TEMPLATE_ELEMENT<20>(tabnoeud)
87     {
88 francois 581 if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
89 francois 378 tab[0]->get_lien_element3()->ajouter(this);
90     tab[1]->get_lien_element3()->ajouter(this);
91     tab[2]->get_lien_element3()->ajouter(this);
92     tab[3]->get_lien_element3()->ajouter(this);
93     tab[4]->get_lien_element3()->ajouter(this);
94     tab[5]->get_lien_element3()->ajouter(this);
95     tab[6]->get_lien_element3()->ajouter(this);
96     tab[7]->get_lien_element3()->ajouter(this);
97     tab[8]->get_lien_element3()->ajouter(this);
98     tab[9]->get_lien_element3()->ajouter(this);
99     tab[10]->get_lien_element3()->ajouter(this);
100     tab[11]->get_lien_element3()->ajouter(this);
101     tab[12]->get_lien_element3()->ajouter(this);
102     tab[13]->get_lien_element3()->ajouter(this);
103     tab[14]->get_lien_element3()->ajouter(this);
104     tab[15]->get_lien_element3()->ajouter(this);
105     tab[16]->get_lien_element3()->ajouter(this);
106     tab[17]->get_lien_element3()->ajouter(this);
107     tab[18]->get_lien_element3()->ajouter(this);
108     tab[19]->get_lien_element3()->ajouter(this);
109     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
110     }
111    
112     FEM_HEXA20::FEM_HEXA20(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT3(topo),FEM_TEMPLATE_ELEMENT<20>(tabnoeud)
113     {
114 francois 581 if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
115 francois 378 tab[0]->get_lien_element3()->ajouter(this);
116     tab[1]->get_lien_element3()->ajouter(this);
117     tab[2]->get_lien_element3()->ajouter(this);
118     tab[3]->get_lien_element3()->ajouter(this);
119     tab[4]->get_lien_element3()->ajouter(this);
120     tab[5]->get_lien_element3()->ajouter(this);
121     tab[6]->get_lien_element3()->ajouter(this);
122     tab[7]->get_lien_element3()->ajouter(this);
123     tab[8]->get_lien_element3()->ajouter(this);
124     tab[9]->get_lien_element3()->ajouter(this);
125     tab[10]->get_lien_element3()->ajouter(this);
126     tab[11]->get_lien_element3()->ajouter(this);
127     tab[12]->get_lien_element3()->ajouter(this);
128     tab[13]->get_lien_element3()->ajouter(this);
129     tab[14]->get_lien_element3()->ajouter(this);
130     tab[15]->get_lien_element3()->ajouter(this);
131     tab[16]->get_lien_element3()->ajouter(this);
132     tab[17]->get_lien_element3()->ajouter(this);
133     tab[18]->get_lien_element3()->ajouter(this);
134     tab[19]->get_lien_element3()->ajouter(this);
135     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
136     }
137    
138     FEM_HEXA20::FEM_HEXA20(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT3(num,topo,mai),FEM_TEMPLATE_ELEMENT<20>(tabnoeud)
139     {
140 francois 581 if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
141 francois 378 tab[0]->get_lien_element3()->ajouter(this);
142     tab[1]->get_lien_element3()->ajouter(this);
143     tab[2]->get_lien_element3()->ajouter(this);
144     tab[3]->get_lien_element3()->ajouter(this);
145     tab[4]->get_lien_element3()->ajouter(this);
146     tab[5]->get_lien_element3()->ajouter(this);
147     tab[6]->get_lien_element3()->ajouter(this);
148     tab[7]->get_lien_element3()->ajouter(this);
149     tab[8]->get_lien_element3()->ajouter(this);
150     tab[9]->get_lien_element3()->ajouter(this);
151     tab[10]->get_lien_element3()->ajouter(this);
152     tab[11]->get_lien_element3()->ajouter(this);
153     tab[12]->get_lien_element3()->ajouter(this);
154     tab[13]->get_lien_element3()->ajouter(this);
155     tab[14]->get_lien_element3()->ajouter(this);
156     tab[15]->get_lien_element3()->ajouter(this);
157     tab[16]->get_lien_element3()->ajouter(this);
158     tab[17]->get_lien_element3()->ajouter(this);
159     tab[18]->get_lien_element3()->ajouter(this);
160     tab[19]->get_lien_element3()->ajouter(this);
161     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
162     }
163    
164     FEM_HEXA20::FEM_HEXA20(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT3(topo,mai),FEM_TEMPLATE_ELEMENT<20>(tabnoeud)
165     {
166 francois 581 if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
167 francois 378 tab[0]->get_lien_element3()->ajouter(this);
168     tab[1]->get_lien_element3()->ajouter(this);
169     tab[2]->get_lien_element3()->ajouter(this);
170     tab[3]->get_lien_element3()->ajouter(this);
171     tab[4]->get_lien_element3()->ajouter(this);
172     tab[5]->get_lien_element3()->ajouter(this);
173     tab[6]->get_lien_element3()->ajouter(this);
174     tab[7]->get_lien_element3()->ajouter(this);
175     tab[8]->get_lien_element3()->ajouter(this);
176     tab[9]->get_lien_element3()->ajouter(this);
177     tab[10]->get_lien_element3()->ajouter(this);
178     tab[11]->get_lien_element3()->ajouter(this);
179     tab[12]->get_lien_element3()->ajouter(this);
180     tab[13]->get_lien_element3()->ajouter(this);
181     tab[14]->get_lien_element3()->ajouter(this);
182     tab[15]->get_lien_element3()->ajouter(this);
183     tab[16]->get_lien_element3()->ajouter(this);
184     tab[17]->get_lien_element3()->ajouter(this);
185     tab[18]->get_lien_element3()->ajouter(this);
186     tab[19]->get_lien_element3()->ajouter(this);
187     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
188     }
189    
190    
191    
192    
193    
194    
195    
196    
197    
198 francois 310 FEM_HEXA20::FEM_HEXA20(FEM_HEXA20& mdd):FEM_ELEMENT3(mdd),FEM_TEMPLATE_ELEMENT<20>(mdd)
199     {
200 francois 581 if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
201 francois 310 tab[0]->get_lien_element3()->ajouter(this);
202     tab[1]->get_lien_element3()->ajouter(this);
203     tab[2]->get_lien_element3()->ajouter(this);
204     tab[3]->get_lien_element3()->ajouter(this);
205     tab[4]->get_lien_element3()->ajouter(this);
206     tab[5]->get_lien_element3()->ajouter(this);
207     tab[6]->get_lien_element3()->ajouter(this);
208     tab[7]->get_lien_element3()->ajouter(this);
209     tab[8]->get_lien_element3()->ajouter(this);
210     tab[9]->get_lien_element3()->ajouter(this);
211     tab[10]->get_lien_element3()->ajouter(this);
212     tab[11]->get_lien_element3()->ajouter(this);
213     tab[12]->get_lien_element3()->ajouter(this);
214     tab[13]->get_lien_element3()->ajouter(this);
215     tab[14]->get_lien_element3()->ajouter(this);
216     tab[15]->get_lien_element3()->ajouter(this);
217     tab[16]->get_lien_element3()->ajouter(this);
218     tab[17]->get_lien_element3()->ajouter(this);
219     tab[18]->get_lien_element3()->ajouter(this);
220     tab[19]->get_lien_element3()->ajouter(this);
221     get_fem_noeudpetitid()->get_lien_petit_element3()->ajouter(this);
222     }
223     FEM_HEXA20::~FEM_HEXA20()
224     {
225 francois 663 if (liaison_topologique!=NULL)
226     if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
227 francois 310 tab[0]->get_lien_element3()->supprimer(this);
228     tab[1]->get_lien_element3()->supprimer(this);
229     tab[2]->get_lien_element3()->supprimer(this);
230     tab[3]->get_lien_element3()->supprimer(this);
231     tab[4]->get_lien_element3()->supprimer(this);
232     tab[5]->get_lien_element3()->supprimer(this);
233     tab[6]->get_lien_element3()->supprimer(this);
234     tab[7]->get_lien_element3()->supprimer(this);
235     tab[8]->get_lien_element3()->supprimer(this);
236     tab[9]->get_lien_element3()->supprimer(this);
237     tab[10]->get_lien_element3()->supprimer(this);
238     tab[11]->get_lien_element3()->supprimer(this);
239     tab[12]->get_lien_element3()->supprimer(this);
240     tab[13]->get_lien_element3()->supprimer(this);
241     tab[14]->get_lien_element3()->supprimer(this);
242     tab[15]->get_lien_element3()->supprimer(this);
243     tab[16]->get_lien_element3()->supprimer(this);
244     tab[17]->get_lien_element3()->supprimer(this);
245     tab[18]->get_lien_element3()->supprimer(this);
246     tab[19]->get_lien_element3()->supprimer(this);
247     get_fem_noeudpetitid()->get_lien_petit_element3()->supprimer(this);
248     }
249    
250    
251     FEM_ELEMENT_MAILLAGE* FEM_HEXA20::dupliquer(FEM_MAILLAGE *femmai,long decalage)
252     {
253 couturad 944 FEM_NOEUD* tabnoeud[20];
254 francois 310 tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage);
255     tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage);
256     tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage);
257     tabnoeud[3]=femmai->get_fem_noeudid(tab[3]->get_id()+decalage);
258     tabnoeud[4]=femmai->get_fem_noeudid(tab[4]->get_id()+decalage);
259     tabnoeud[5]=femmai->get_fem_noeudid(tab[5]->get_id()+decalage);
260     tabnoeud[6]=femmai->get_fem_noeudid(tab[6]->get_id()+decalage);
261     tabnoeud[7]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
262     tabnoeud[8]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
263     tabnoeud[9]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
264     tabnoeud[10]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
265     tabnoeud[11]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
266     tabnoeud[12]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
267     tabnoeud[13]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
268     tabnoeud[14]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
269     tabnoeud[15]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
270     tabnoeud[16]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
271     tabnoeud[17]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
272     tabnoeud[18]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
273     tabnoeud[19]=femmai->get_fem_noeudid(tab[7]->get_id()+decalage);
274     FEM_HEXA20* quad=new FEM_HEXA20(get_id()+decalage,maillage,tabnoeud);
275     femmai->ajouter_fem_element3(quad);
276     return quad;
277     }
278    
279    
280 francois 786 void FEM_HEXA20::get_voisin_noeud(class FEM_NOEUD* no,TPL_LISTE_ENTITE<FEM_NOEUD*> &voisin)
281     {
282     voisin.vide();
283     if (no==tab[0])
284     {
285     voisin.ajouter(tab[1]);
286     voisin.ajouter(tab[7]);
287     voisin.ajouter(tab[8]);
288     }
289     if (no==tab[1])
290     {
291     voisin.ajouter(tab[0]);
292     voisin.ajouter(tab[2]);
293     }
294     if (no==tab[2])
295     {
296     voisin.ajouter(tab[1]);
297     voisin.ajouter(tab[3]);
298     voisin.ajouter(tab[9]);
299     }
300     if (no==tab[3])
301     {
302     voisin.ajouter(tab[2]);
303     voisin.ajouter(tab[4]);
304     }
305     if (no==tab[4])
306     {
307     voisin.ajouter(tab[3]);
308     voisin.ajouter(tab[5]);
309     voisin.ajouter(tab[10]);
310     }
311     if (no==tab[5])
312     {
313     voisin.ajouter(tab[4]);
314     voisin.ajouter(tab[6]);
315     }
316     if (no==tab[6])
317     {
318     voisin.ajouter(tab[5]);
319     voisin.ajouter(tab[7]);
320     voisin.ajouter(tab[11]);
321     }
322     if (no==tab[7])
323     {
324     voisin.ajouter(tab[0]);
325     voisin.ajouter(tab[6]);
326     }
327     if (no==tab[8])
328     {
329     voisin.ajouter(tab[0]);
330     voisin.ajouter(tab[12]);
331     }
332     if (no==tab[9])
333     {
334     voisin.ajouter(tab[2]);
335     voisin.ajouter(tab[14]);
336     }
337     if (no==tab[10])
338     {
339     voisin.ajouter(tab[4]);
340     voisin.ajouter(tab[16]);
341     }
342     if (no==tab[11])
343     {
344     voisin.ajouter(tab[6]);
345     voisin.ajouter(tab[18]);
346     }
347 francois 310
348 francois 786 if (no==tab[12])
349     {
350     voisin.ajouter(tab[8]);
351     voisin.ajouter(tab[13]);
352     voisin.ajouter(tab[19]);
353     }
354     if (no==tab[13])
355     {
356     voisin.ajouter(tab[12]);
357     voisin.ajouter(tab[14]);
358     }
359     if (no==tab[14])
360     {
361     voisin.ajouter(tab[9]);
362     voisin.ajouter(tab[13]);
363     voisin.ajouter(tab[15]);
364     }
365     if (no==tab[15])
366     {
367     voisin.ajouter(tab[14]);
368     voisin.ajouter(tab[16]);
369     }
370     if (no==tab[16])
371     {
372     voisin.ajouter(tab[10]);
373     voisin.ajouter(tab[15]);
374     voisin.ajouter(tab[17]);
375     }
376     if (no==tab[17])
377     {
378     voisin.ajouter(tab[16]);
379     voisin.ajouter(tab[18]);
380     }
381     if (no==tab[18])
382     {
383     voisin.ajouter(tab[11]);
384     voisin.ajouter(tab[17]);
385     voisin.ajouter(tab[19]);
386     }
387     if (no==tab[19])
388     {
389     voisin.ajouter(tab[18]);
390     voisin.ajouter(tab[12]);
391     }
392     }
393 francois 310
394    
395     int FEM_HEXA20::get_type_entite(void)
396     {
397     return IDFEM_HEXA20;
398     }
399    
400     int FEM_HEXA20::get_dimension(void)
401     {
402     return 3;
403     }
404    
405    
406    
407     int FEM_HEXA20::get_nb_fem_noeud(void)
408     {
409     return FEM_TEMPLATE_ELEMENT<20>::get_nb_fem_noeud();
410     }
411    
412     FEM_NOEUD* FEM_HEXA20::get_fem_noeud(int num)
413     {
414     return FEM_TEMPLATE_ELEMENT<20>::get_fem_noeud(num);
415     }
416    
417     void FEM_HEXA20::change_noeud(int num,FEM_NOEUD* noeud)
418     {
419     FEM_TEMPLATE_ELEMENT<20>::change_noeud(num,noeud);
420     }
421    
422     BOITE_3D& FEM_HEXA20::get_boite_3D(void)
423     {
424     return FEM_TEMPLATE_ELEMENT<20>::get_boite_3D();
425     }
426    
427    
428 francois 763 void FEM_HEXA20::enregistrer(std::ostream& o,double version)
429 francois 310 {
430 francois 378 if (maillage!=NULL)
431     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_HEXA20($"<< 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()<< ",$" << tab[8]->get_id() << ",$" << tab[9]->get_id() << ",$" << tab[10]->get_id()<< ",$" << tab[11]->get_id() << ",$" << tab[12]->get_id() << ",$" << tab[13]->get_id() << ",$" << tab[14]->get_id() << ",$" << tab[15]->get_id() << ",$" << tab[16]->get_id()<< ",$" << tab[17]->get_id()<< ",$" << tab[18]->get_id()<< ",$" << tab[19]->get_id()<< ");" << std::endl;
432     else o << "%" << get_id() << "=FEM_HEXA20(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()<< ",$" << tab[8]->get_id() << ",$" << tab[9]->get_id() << ",$" << tab[10]->get_id()<< ",$" << tab[11]->get_id() << ",$" << tab[12]->get_id() << ",$" << tab[13]->get_id() << ",$" << tab[14]->get_id() << ",$" << tab[15]->get_id() << ",$" << tab[16]->get_id()<< ",$" << tab[17]->get_id()<< ",$" << tab[18]->get_id()<< ",$" << tab[19]->get_id()<<");" << std::endl;
433     else
434     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_HEXA20($"<< 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()<< ",$" << tab[8]->get_id() << ",$" << tab[9]->get_id() << ",$" << tab[10]->get_id()<< ",$" << tab[11]->get_id() << ",$" << tab[12]->get_id() << ",$" << tab[13]->get_id() << ",$" << tab[14]->get_id() << ",$" << tab[15]->get_id() << ",$" << tab[16]->get_id()<< ",$" << tab[17]->get_id()<< ",$" << tab[18]->get_id()<< ",$" << tab[19]->get_id()<< ");" << std::endl;
435     else o << "%" << get_id() << "=FEM_HEXA20(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()<< ",$" << tab[8]->get_id() << ",$" << tab[9]->get_id() << ",$" << tab[10]->get_id()<< ",$" << tab[11]->get_id() << ",$" << tab[12]->get_id() << ",$" << tab[13]->get_id() << ",$" << tab[14]->get_id() << ",$" << tab[15]->get_id() << ",$" << tab[16]->get_id()<< ",$" << tab[17]->get_id()<< ",$" << tab[18]->get_id()<< ",$" << tab[19]->get_id()<<");" << std::endl;
436    
437 francois 310 }
438 francois 637
439    
440    
441     int FEM_HEXA20::get_nb_pt_gauss(int degre)
442     {
443 francois 754 return OT_POINTS_GAUSS::get_nb_point_hexa_prod(degre);
444 francois 637 }
445    
446     void FEM_HEXA20::get_pt_gauss(int degre,int num,double &w,double *uvw)
447     {
448 francois 754 return OT_POINTS_GAUSS::get_pt_gauss_hex_prod(degre,num,w,uvw);
449 francois 637 }
450 francois 638 int FEM_HEXA20::get_nb_fonction_interpolation(void)
451 francois 310 {
452     return 20;
453     }
454 francois 638 int FEM_HEXA20::get_degremax_fonction_interpolation(void)
455     {
456     return 4;
457     }
458 francois 310
459 francois 757 int FEM_HEXA20::get_degre_gauss(int num)
460     {
461     return OT_POINTS_GAUSS::get_degre_gauss_hexa_prod(num);
462     }
463    
464    
465 francois 310 double FEM_HEXA20::get_fonction_interpolation(int num,double *uv)
466     {
467     double val;
468     switch (num)
469     {
470     case 1:
471     {double a=-1;
472     double b=-1;
473     double c=-1;
474     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
475     break;}
476     case 3:
477     {double a=1;
478     double b=-1;
479     double c=-1;
480     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
481     break;}
482     case 5:
483     {double a=1;
484     double b=1;
485     double c=-1;
486     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
487     break;}
488     case 7:
489     {double a=-1;
490     double b=1;
491     double c=-1;
492     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
493     break;}
494     case 13:
495     {double a=-1;
496     double b=-1;
497     double c=1;
498     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
499     break;}
500     case 15:
501     {double a=1;
502     double b=-1;
503     double c=1;
504     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
505     break;}
506     case 17:
507     {double a=1;
508     double b=1;
509     double c=1;
510     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
511     break;}
512     case 19:
513     {double a=-1;
514     double b=1;
515     double c=1;
516     val=0.125*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.+uv[2]*c)*(-2.+uv[0]*a+uv[1]*b+uv[2]*c);
517     break;}
518     case 2:
519     {double a=0.;
520     double b=-1;
521     double c=-1;
522     val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
523     break;}
524     case 6:
525     {double a=0.;
526     double b=1;
527     double c=-1;
528     val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
529     break;}
530     case 14:
531     {double a=0.;
532     double b=-1;
533     double c=1;
534     val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
535     break;}
536     case 18:
537     {double a=0.;
538     double b=1;
539     double c=1;
540     val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
541     break;}
542     case 4:
543     {double a=1.;
544     double b=0.;
545     double c=-1;
546     val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
547     break;}
548     case 8:
549     {double a=-1.;
550     double b=0.;
551     double c=-1;
552     val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
553     break;}
554     case 16:
555     {double a=1.;
556     double b=0.;
557     double c=1;
558     val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
559     break;}
560     case 20:
561     {double a=-1.;
562     double b=0.;
563     double c=1;
564     val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
565     break;}
566     case 9:
567     {double a=-1.;
568     double b=-1.;
569     double c=0.;
570     val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
571     break;}
572     case 10:
573     {double a=1.;
574     double b=-1.;
575     double c=0.;
576     val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
577     break;}
578     case 11:
579     {double a=1.;
580     double b=1.;
581     double c=0.;
582     val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
583     break;}
584     case 12:
585     {double a=-1.;
586     double b=1.;
587     double c=0.;
588     val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
589     break;}
590    
591    
592     }
593     return val;
594     }
595 francois 684 void FEM_HEXA20::reinit_boite_3D(void)
596     {
597     FEM_TEMPLATE_ELEMENT<20>::reinit_boite_3D();
598     }
599 francois 310
600     double FEM_HEXA20::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
601     {
602     double val;
603     switch (num)
604     {
605     case 1:
606     {
607     double a=-1;
608     double b=-1;
609     double c=-1;
610     switch (num_variable)
611     {
612     case 1:
613     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
614     break;
615     case 2:
616     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
617     break;
618     case 3:
619     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
620     break;
621     } break;}
622     case 3:
623     {
624     double a=1;
625     double b=-1;
626     double c=-1;
627     switch (num_variable)
628     {
629     case 1:
630     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
631     break;
632     case 2:
633     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
634     break;
635     case 3:
636     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
637     break;
638     } break;}
639     case 5:
640     {
641     double a=1;
642     double b=1;
643     double c=-1;
644     switch (num_variable)
645     {
646     case 1:
647     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
648     break;
649     case 2:
650     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
651     break;
652     case 3:
653     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
654     break;
655     } break;}
656     case 7:
657     {
658     double a=-1;
659     double b=1;
660     double c=-1;
661     switch (num_variable)
662     {
663     case 1:
664     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
665     break;
666     case 2:
667     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
668     break;
669     case 3:
670     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
671     break;
672     } break;}
673     case 13:
674     {
675     double a=-1;
676     double b=-1;
677     double c=1;
678     switch (num_variable)
679     {
680     case 1:
681     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
682     break;
683     case 2:
684     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
685     break;
686     case 3:
687     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
688     break;
689     } break;}
690     case 15:
691     {
692     double a=1;
693     double b=-1;
694     double c=1;
695     switch (num_variable)
696     {
697     case 1:
698     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
699     break;
700     case 2:
701     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
702     break;
703     case 3:
704     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
705     break;
706     } break;}
707     case 17:
708     {
709     double a=1;
710     double b=1;
711     double c=1;
712     switch (num_variable)
713     {
714     case 1:
715     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
716     break;
717     case 2:
718     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
719     break;
720     case 3:
721     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
722     break;
723     } break;}
724     case 19:
725     {
726     double a=-1;
727     double b=1;
728     double c=1;
729     switch (num_variable)
730     {
731     case 1:
732     val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
733     break;
734     case 2:
735     val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
736     break;
737     case 3:
738     val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
739     break;
740     } break;}
741     case 2:
742     {
743     double a=0;
744     double b=-1;
745     double c=-1;
746     switch (num_variable)
747     {
748     case 1:
749     val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
750     break;
751     case 2:
752     val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
753     break;
754     case 3:
755     val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
756     break;
757     } break;}
758     case 18:
759     {
760     double a=0;
761     double b=1;
762     double c=1;
763     switch (num_variable)
764     {
765     case 1:
766     val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
767     break;
768     case 2:
769     val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
770     break;
771     case 3:
772     val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
773     break;
774     } break;}
775     case 14:
776     {
777     double a=0;
778     double b=-1;
779     double c=1;
780     switch (num_variable)
781     {
782     case 1:
783     val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
784     break;
785     case 2:
786     val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
787     break;
788     case 3:
789     val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
790     break;
791     } break;}
792     case 6:
793     {
794     double a=0;
795     double b=1;
796     double c=-1;
797     switch (num_variable)
798     {
799     case 1:
800     val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
801     break;
802     case 2:
803     val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
804     break;
805     case 3:
806     val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
807     break;
808     } break;}
809     case 4:
810     {
811     double a=1;
812     double b=0;
813     double c=-1;
814     switch (num_variable)
815     {
816     case 1:
817     val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
818     break;
819     case 2:
820     val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
821     break;
822     case 3:
823     val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
824     break;
825     } break;}
826     case 8:
827     {
828     double a=-1;
829     double b=0;
830     double c=-1;
831     switch (num_variable)
832     {
833     case 1:
834     val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
835     break;
836     case 2:
837     val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
838     break;
839     case 3:
840     val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
841     break;
842     } break;}
843     case 16:
844     {
845     double a=1;
846     double b=0;
847     double c=1;
848     switch (num_variable)
849     {
850     case 1:
851     val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
852     break;
853     case 2:
854     val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
855     break;
856     case 3:
857     val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
858     break;
859     } break;}
860     case 20:
861     {
862     double a=-1;
863     double b=0;
864     double c=1;
865     switch (num_variable)
866     {
867     case 1:
868     val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
869     break;
870     case 2:
871     val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
872     break;
873     case 3:
874     val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
875     break;
876     } break;}
877     case 9:
878     {
879     double a=-1;
880     double b=-1;
881     double c=0.;
882     switch (num_variable)
883     {
884     case 1:
885     val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
886     break;
887     case 2:
888     val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
889     break;
890     case 3:
891     val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
892     break;
893     } break;}
894     case 10:
895     {
896     double a=1;
897     double b=-1;
898     double c=0.;
899     switch (num_variable)
900     {
901     case 1:
902     val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
903     break;
904     case 2:
905     val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
906     break;
907     case 3:
908     val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
909     break;
910     } break;}
911     case 11:
912     {
913     double a=1;
914     double b=1;
915     double c=0.;
916     switch (num_variable)
917     {
918     case 1:
919     val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
920     break;
921     case 2:
922     val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
923     break;
924     case 3:
925     val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
926     break;
927     } break;}
928     case 12:
929     {
930     double a=-1;
931     double b=1;
932     double c=0.;
933     switch (num_variable)
934     {
935     case 1:
936     val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
937     break;
938     case 2:
939     val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
940     break;
941     case 3:
942     val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
943     break;
944     } break;}
945    
946     }
947     return val;
948     }
949    
950     double FEM_HEXA20::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
951     {
952     li=3;col=3;
953     OT_TENSEUR Ni(3,20),Xi(20,3);
954     for (int i=0;i<3;i++)
955     for (int j=0;j<20;j++)
956     Ni(i,j)=get_fonction_derive_interpolation(j+1,i+1,uv);
957     for (int i=0;i<20;i++)
958     {
959     double *xyz=tab[i]->get_coord();
960     Xi(i,0)=xyz[0]*unite;
961     Xi(i,1)=xyz[1]*unite;
962     Xi(i,2)=xyz[2]*unite;
963     }
964     OT_TENSEUR jacobi=Ni*Xi;
965     jac[0]=jacobi(0,0).get_x();
966     jac[1]=jacobi(0,1).get_x();
967     jac[2]=jacobi(0,2).get_x();
968     jac[3]=jacobi(1,0).get_x();
969     jac[4]=jacobi(1,1).get_x();
970     jac[5]=jacobi(1,2).get_x();
971     jac[6]=jacobi(2,0).get_x();
972     jac[7]=jacobi(2,1).get_x();
973     jac[8]=jacobi(2,2).get_x();
974     double det=jac[0]*jac[4]*jac[8]+jac[3]*jac[7]*jac[2]+jac[6]*jac[1]*jac[5]-jac[2]*jac[4]*jac[6]-jac[5]*jac[7]*jac[0]-jac[8]*jac[1]*jac[3];
975     return det;
976    
977     }
978    
979     void FEM_HEXA20::get_inverse_jacob(double* j,double *uv,double unite)
980     {
981     double jac[9];
982     int li,col;
983     double detj=get_jacobien(jac,uv,li,col,unite);
984     j[0*3+0] = (jac[1*3+1]*jac[2*3+2]-jac[1*3+2]*jac[2*3+1])/(detj);
985     j[0*3+1] = -(jac[0*3+1]*jac[2*3+2]-jac[0*3+2]*jac[2*3+1])/(detj);
986     j[0*3+2] =-(-jac[0*3+1]*jac[1*3+2]+jac[0*3+2]*jac[1*3+1])/(detj);
987    
988     j[1*3+0] = -(jac[1*3+0]*jac[2*3+2]-jac[1*3+2]*jac[2*3+0])/(detj);
989     j[1*3+1] = (jac[0*3+0]*jac[2*3+2]-jac[0*3+2]*jac[2*3+0])/(detj);
990     j[1*3+2] = -(jac[0*3+0]*jac[1*3+2]-jac[0*3+2]*jac[1*3+0])/(detj);
991    
992     j[2*3+0] =-(-jac[1*3+0]*jac[2*3+1]+jac[1*3+1]*jac[2*3+0])/(detj);
993     j[2*3+1] = -(jac[0*3+0]*jac[2*3+1]-jac[0*3+1]*jac[2*3+0])/(detj);
994     j[2*3+2] = (jac[0*3+0]*jac[1*3+1]-jac[0*3+1]*jac[1*3+0])/(detj);
995    
996 francois 405 }
997    
998 francois 635 bool FEM_HEXA20::valide_parametre_EF(double* uvw)
999     {
1000 francois 674 if (uvw[0]>=-1.-1e-10)
1001     if (uvw[1]>=-1.-1e-10)
1002     if (uvw[2]>=-1.-1e-10)
1003 francois 635 if (uvw[0]<=1.+1e-10)
1004     if (uvw[1]<=1.+1e-10)
1005     if (uvw[2]<=1.+1e-10)
1006     return true;
1007     return false;
1008     }
1009 francois 405
1010 francois 406 int FEM_HEXA20::verifie_validite_decoupage_xfem(double *vol)
1011 francois 405 {
1012    
1013 couturad 944 }