ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_hexa20.cpp
Revision: 637
Committed: Mon Jan 26 21:26:37 2015 UTC (10 years, 7 months ago) by francois
File size: 31886 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_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::nb_fonction_interpolation(void)
381 {
382 return 20;
383 }
384
385
386 double FEM_HEXA20::get_fonction_interpolation(int num,double *uv)
387 {
388 double val;
389 switch (num)
390 {
391 case 1:
392 {double a=-1;
393 double b=-1;
394 double c=-1;
395 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);
396 break;}
397 case 3:
398 {double a=1;
399 double b=-1;
400 double c=-1;
401 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);
402 break;}
403 case 5:
404 {double a=1;
405 double b=1;
406 double c=-1;
407 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);
408 break;}
409 case 7:
410 {double a=-1;
411 double b=1;
412 double c=-1;
413 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);
414 break;}
415 case 13:
416 {double a=-1;
417 double b=-1;
418 double c=1;
419 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);
420 break;}
421 case 15:
422 {double a=1;
423 double b=-1;
424 double c=1;
425 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);
426 break;}
427 case 17:
428 {double a=1;
429 double b=1;
430 double c=1;
431 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);
432 break;}
433 case 19:
434 {double a=-1;
435 double b=1;
436 double c=1;
437 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);
438 break;}
439 case 2:
440 {double a=0.;
441 double b=-1;
442 double c=-1;
443 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
444 break;}
445 case 6:
446 {double a=0.;
447 double b=1;
448 double c=-1;
449 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
450 break;}
451 case 14:
452 {double a=0.;
453 double b=-1;
454 double c=1;
455 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
456 break;}
457 case 18:
458 {double a=0.;
459 double b=1;
460 double c=1;
461 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
462 break;}
463 case 4:
464 {double a=1.;
465 double b=0.;
466 double c=-1;
467 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
468 break;}
469 case 8:
470 {double a=-1.;
471 double b=0.;
472 double c=-1;
473 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
474 break;}
475 case 16:
476 {double a=1.;
477 double b=0.;
478 double c=1;
479 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
480 break;}
481 case 20:
482 {double a=-1.;
483 double b=0.;
484 double c=1;
485 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
486 break;}
487 case 9:
488 {double a=-1.;
489 double b=-1.;
490 double c=0.;
491 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
492 break;}
493 case 10:
494 {double a=1.;
495 double b=-1.;
496 double c=0.;
497 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
498 break;}
499 case 11:
500 {double a=1.;
501 double b=1.;
502 double c=0.;
503 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
504 break;}
505 case 12:
506 {double a=-1.;
507 double b=1.;
508 double c=0.;
509 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
510 break;}
511
512
513 }
514 return val;
515 }
516
517 double FEM_HEXA20::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
518 {
519 double val;
520 switch (num)
521 {
522 case 1:
523 {
524 double a=-1;
525 double b=-1;
526 double c=-1;
527 switch (num_variable)
528 {
529 case 1:
530 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
531 break;
532 case 2:
533 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
534 break;
535 case 3:
536 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
537 break;
538 } break;}
539 case 3:
540 {
541 double a=1;
542 double b=-1;
543 double c=-1;
544 switch (num_variable)
545 {
546 case 1:
547 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
548 break;
549 case 2:
550 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
551 break;
552 case 3:
553 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
554 break;
555 } break;}
556 case 5:
557 {
558 double a=1;
559 double b=1;
560 double c=-1;
561 switch (num_variable)
562 {
563 case 1:
564 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
565 break;
566 case 2:
567 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
568 break;
569 case 3:
570 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
571 break;
572 } break;}
573 case 7:
574 {
575 double a=-1;
576 double b=1;
577 double c=-1;
578 switch (num_variable)
579 {
580 case 1:
581 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
582 break;
583 case 2:
584 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
585 break;
586 case 3:
587 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
588 break;
589 } break;}
590 case 13:
591 {
592 double a=-1;
593 double b=-1;
594 double c=1;
595 switch (num_variable)
596 {
597 case 1:
598 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
599 break;
600 case 2:
601 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
602 break;
603 case 3:
604 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
605 break;
606 } break;}
607 case 15:
608 {
609 double a=1;
610 double b=-1;
611 double c=1;
612 switch (num_variable)
613 {
614 case 1:
615 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
616 break;
617 case 2:
618 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
619 break;
620 case 3:
621 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
622 break;
623 } break;}
624 case 17:
625 {
626 double a=1;
627 double b=1;
628 double c=1;
629 switch (num_variable)
630 {
631 case 1:
632 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
633 break;
634 case 2:
635 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
636 break;
637 case 3:
638 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
639 break;
640 } break;}
641 case 19:
642 {
643 double a=-1;
644 double b=1;
645 double c=1;
646 switch (num_variable)
647 {
648 case 1:
649 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
650 break;
651 case 2:
652 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
653 break;
654 case 3:
655 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
656 break;
657 } break;}
658 case 2:
659 {
660 double a=0;
661 double b=-1;
662 double c=-1;
663 switch (num_variable)
664 {
665 case 1:
666 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
667 break;
668 case 2:
669 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
670 break;
671 case 3:
672 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
673 break;
674 } break;}
675 case 18:
676 {
677 double a=0;
678 double b=1;
679 double c=1;
680 switch (num_variable)
681 {
682 case 1:
683 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
684 break;
685 case 2:
686 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
687 break;
688 case 3:
689 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
690 break;
691 } break;}
692 case 14:
693 {
694 double a=0;
695 double b=-1;
696 double c=1;
697 switch (num_variable)
698 {
699 case 1:
700 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
701 break;
702 case 2:
703 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
704 break;
705 case 3:
706 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
707 break;
708 } break;}
709 case 6:
710 {
711 double a=0;
712 double b=1;
713 double c=-1;
714 switch (num_variable)
715 {
716 case 1:
717 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
718 break;
719 case 2:
720 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
721 break;
722 case 3:
723 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
724 break;
725 } break;}
726 case 4:
727 {
728 double a=1;
729 double b=0;
730 double c=-1;
731 switch (num_variable)
732 {
733 case 1:
734 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
735 break;
736 case 2:
737 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
738 break;
739 case 3:
740 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
741 break;
742 } break;}
743 case 8:
744 {
745 double a=-1;
746 double b=0;
747 double c=-1;
748 switch (num_variable)
749 {
750 case 1:
751 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
752 break;
753 case 2:
754 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
755 break;
756 case 3:
757 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
758 break;
759 } break;}
760 case 16:
761 {
762 double a=1;
763 double b=0;
764 double c=1;
765 switch (num_variable)
766 {
767 case 1:
768 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
769 break;
770 case 2:
771 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
772 break;
773 case 3:
774 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
775 break;
776 } break;}
777 case 20:
778 {
779 double a=-1;
780 double b=0;
781 double c=1;
782 switch (num_variable)
783 {
784 case 1:
785 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
786 break;
787 case 2:
788 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
789 break;
790 case 3:
791 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
792 break;
793 } break;}
794 case 9:
795 {
796 double a=-1;
797 double b=-1;
798 double c=0.;
799 switch (num_variable)
800 {
801 case 1:
802 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
803 break;
804 case 2:
805 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
806 break;
807 case 3:
808 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
809 break;
810 } break;}
811 case 10:
812 {
813 double a=1;
814 double b=-1;
815 double c=0.;
816 switch (num_variable)
817 {
818 case 1:
819 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
820 break;
821 case 2:
822 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
823 break;
824 case 3:
825 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
826 break;
827 } break;}
828 case 11:
829 {
830 double a=1;
831 double b=1;
832 double c=0.;
833 switch (num_variable)
834 {
835 case 1:
836 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
837 break;
838 case 2:
839 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
840 break;
841 case 3:
842 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
843 break;
844 } break;}
845 case 12:
846 {
847 double a=-1;
848 double b=1;
849 double c=0.;
850 switch (num_variable)
851 {
852 case 1:
853 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
854 break;
855 case 2:
856 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
857 break;
858 case 3:
859 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
860 break;
861 } break;}
862
863 }
864 return val;
865 }
866
867 double FEM_HEXA20::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
868 {
869 li=3;col=3;
870 OT_TENSEUR Ni(3,20),Xi(20,3);
871 for (int i=0;i<3;i++)
872 for (int j=0;j<20;j++)
873 Ni(i,j)=get_fonction_derive_interpolation(j+1,i+1,uv);
874 for (int i=0;i<20;i++)
875 {
876 double *xyz=tab[i]->get_coord();
877 Xi(i,0)=xyz[0]*unite;
878 Xi(i,1)=xyz[1]*unite;
879 Xi(i,2)=xyz[2]*unite;
880 }
881 OT_TENSEUR jacobi=Ni*Xi;
882 jac[0]=jacobi(0,0).get_x();
883 jac[1]=jacobi(0,1).get_x();
884 jac[2]=jacobi(0,2).get_x();
885 jac[3]=jacobi(1,0).get_x();
886 jac[4]=jacobi(1,1).get_x();
887 jac[5]=jacobi(1,2).get_x();
888 jac[6]=jacobi(2,0).get_x();
889 jac[7]=jacobi(2,1).get_x();
890 jac[8]=jacobi(2,2).get_x();
891 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];
892 return det;
893
894 }
895
896 void FEM_HEXA20::get_inverse_jacob(double* j,double *uv,double unite)
897 {
898 double jac[9];
899 int li,col;
900 double detj=get_jacobien(jac,uv,li,col,unite);
901 j[0*3+0] = (jac[1*3+1]*jac[2*3+2]-jac[1*3+2]*jac[2*3+1])/(detj);
902 j[0*3+1] = -(jac[0*3+1]*jac[2*3+2]-jac[0*3+2]*jac[2*3+1])/(detj);
903 j[0*3+2] =-(-jac[0*3+1]*jac[1*3+2]+jac[0*3+2]*jac[1*3+1])/(detj);
904
905 j[1*3+0] = -(jac[1*3+0]*jac[2*3+2]-jac[1*3+2]*jac[2*3+0])/(detj);
906 j[1*3+1] = (jac[0*3+0]*jac[2*3+2]-jac[0*3+2]*jac[2*3+0])/(detj);
907 j[1*3+2] = -(jac[0*3+0]*jac[1*3+2]-jac[0*3+2]*jac[1*3+0])/(detj);
908
909 j[2*3+0] =-(-jac[1*3+0]*jac[2*3+1]+jac[1*3+1]*jac[2*3+0])/(detj);
910 j[2*3+1] = -(jac[0*3+0]*jac[2*3+1]-jac[0*3+1]*jac[2*3+0])/(detj);
911 j[2*3+2] = (jac[0*3+0]*jac[1*3+1]-jac[0*3+1]*jac[1*3+0])/(detj);
912
913 }
914
915 bool FEM_HEXA20::valide_parametre_EF(double* uvw)
916 {
917 if (uvw[0]>=-1e-10)
918 if (uvw[1]>=-1e-10)
919 if (uvw[2]>=-1e-10)
920 if (uvw[0]<=1.+1e-10)
921 if (uvw[1]<=1.+1e-10)
922 if (uvw[2]<=1.+1e-10)
923 return true;
924 return false;
925 }
926
927 int FEM_HEXA20::verifie_validite_decoupage_xfem(double *vol)
928 {
929
930 }