ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_hexa20.cpp
Revision: 638
Committed: Mon Jan 26 21:56:20 2015 UTC (10 years, 7 months ago) by francois
File size: 31968 byte(s)
Log Message:
ajout d'une méthode qui renvoit le degre max des fonctions d'interpolation et changement de nom de la fonction qui renvoie le nombre de fonction d'interpolation (ajout d'un get pour uniformiser)

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