ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_hexa20.cpp
Revision: 406
Committed: Wed Jun 5 20:13:26 2013 UTC (12 years, 2 months ago) by francois
File size: 29638 byte(s)
Log Message:
Procedure d'autoevaluation du decoupage xfem

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()==2) 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()==2) 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()==2) 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()==2) 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()==2) 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()==2) 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()==2) 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()==0) 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 int FEM_HEXA20::nb_fonction_interpolation(void)
326 {
327 return 20;
328 }
329
330
331 double FEM_HEXA20::get_fonction_interpolation(int num,double *uv)
332 {
333 double val;
334 switch (num)
335 {
336 case 1:
337 {double a=-1;
338 double b=-1;
339 double c=-1;
340 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);
341 break;}
342 case 3:
343 {double a=1;
344 double b=-1;
345 double c=-1;
346 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);
347 break;}
348 case 5:
349 {double a=1;
350 double b=1;
351 double c=-1;
352 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);
353 break;}
354 case 7:
355 {double a=-1;
356 double b=1;
357 double c=-1;
358 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);
359 break;}
360 case 13:
361 {double a=-1;
362 double b=-1;
363 double c=1;
364 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);
365 break;}
366 case 15:
367 {double a=1;
368 double b=-1;
369 double c=1;
370 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);
371 break;}
372 case 17:
373 {double a=1;
374 double b=1;
375 double c=1;
376 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);
377 break;}
378 case 19:
379 {double a=-1;
380 double b=1;
381 double c=1;
382 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);
383 break;}
384 case 2:
385 {double a=0.;
386 double b=-1;
387 double c=-1;
388 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
389 break;}
390 case 6:
391 {double a=0.;
392 double b=1;
393 double c=-1;
394 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
395 break;}
396 case 14:
397 {double a=0.;
398 double b=-1;
399 double c=1;
400 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
401 break;}
402 case 18:
403 {double a=0.;
404 double b=1;
405 double c=1;
406 val=0.25*(1.-uv[0]*uv[0])*(1.+uv[1]*b)*(1.+uv[2]*c);
407 break;}
408 case 4:
409 {double a=1.;
410 double b=0.;
411 double c=-1;
412 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
413 break;}
414 case 8:
415 {double a=-1.;
416 double b=0.;
417 double c=-1;
418 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
419 break;}
420 case 16:
421 {double a=1.;
422 double b=0.;
423 double c=1;
424 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
425 break;}
426 case 20:
427 {double a=-1.;
428 double b=0.;
429 double c=1;
430 val=0.25*(1.+uv[0]*a)*(1.-uv[1]*uv[1])*(1.+uv[2]*c);
431 break;}
432 case 9:
433 {double a=-1.;
434 double b=-1.;
435 double c=0.;
436 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
437 break;}
438 case 10:
439 {double a=1.;
440 double b=-1.;
441 double c=0.;
442 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
443 break;}
444 case 11:
445 {double a=1.;
446 double b=1.;
447 double c=0.;
448 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
449 break;}
450 case 12:
451 {double a=-1.;
452 double b=1.;
453 double c=0.;
454 val=0.25*(1.+uv[0]*a)*(1.+uv[1]*b)*(1.-uv[2]*uv[2]);
455 break;}
456
457
458 }
459 return val;
460 }
461
462 double FEM_HEXA20::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
463 {
464 double val;
465 switch (num)
466 {
467 case 1:
468 {
469 double a=-1;
470 double b=-1;
471 double c=-1;
472 switch (num_variable)
473 {
474 case 1:
475 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
476 break;
477 case 2:
478 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
479 break;
480 case 3:
481 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
482 break;
483 } break;}
484 case 3:
485 {
486 double a=1;
487 double b=-1;
488 double c=-1;
489 switch (num_variable)
490 {
491 case 1:
492 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
493 break;
494 case 2:
495 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
496 break;
497 case 3:
498 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
499 break;
500 } break;}
501 case 5:
502 {
503 double a=1;
504 double b=1;
505 double c=-1;
506 switch (num_variable)
507 {
508 case 1:
509 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
510 break;
511 case 2:
512 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
513 break;
514 case 3:
515 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
516 break;
517 } break;}
518 case 7:
519 {
520 double a=-1;
521 double b=1;
522 double c=-1;
523 switch (num_variable)
524 {
525 case 1:
526 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
527 break;
528 case 2:
529 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
530 break;
531 case 3:
532 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
533 break;
534 } break;}
535 case 13:
536 {
537 double a=-1;
538 double b=-1;
539 double c=1;
540 switch (num_variable)
541 {
542 case 1:
543 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
544 break;
545 case 2:
546 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
547 break;
548 case 3:
549 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
550 break;
551 } break;}
552 case 15:
553 {
554 double a=1;
555 double b=-1;
556 double c=1;
557 switch (num_variable)
558 {
559 case 1:
560 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
561 break;
562 case 2:
563 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
564 break;
565 case 3:
566 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
567 break;
568 } break;}
569 case 17:
570 {
571 double a=1;
572 double b=1;
573 double c=1;
574 switch (num_variable)
575 {
576 case 1:
577 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
578 break;
579 case 2:
580 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
581 break;
582 case 3:
583 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
584 break;
585 } break;}
586 case 19:
587 {
588 double a=-1;
589 double b=1;
590 double c=1;
591 switch (num_variable)
592 {
593 case 1:
594 val=0.125*a*(1+uv[1]*b)*(1+uv[2]*c)*(-1+2*uv[0]*a+uv[1]*b+uv[2]*c);
595 break;
596 case 2:
597 val=0.125*b*(1+uv[0]*a)*(1+uv[2]*c)*(-1+uv[0]*a+2*uv[1]*b+uv[2]*c);
598 break;
599 case 3:
600 val=0.125*c*(1+uv[0]*a)*(1+uv[1]*b)*(-1+uv[0]*a+uv[1]*b+2*uv[2]*c);
601 break;
602 } break;}
603 case 2:
604 {
605 double a=0;
606 double b=-1;
607 double c=-1;
608 switch (num_variable)
609 {
610 case 1:
611 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
612 break;
613 case 2:
614 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
615 break;
616 case 3:
617 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
618 break;
619 } break;}
620 case 18:
621 {
622 double a=0;
623 double b=1;
624 double c=1;
625 switch (num_variable)
626 {
627 case 1:
628 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
629 break;
630 case 2:
631 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
632 break;
633 case 3:
634 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
635 break;
636 } break;}
637 case 14:
638 {
639 double a=0;
640 double b=-1;
641 double c=1;
642 switch (num_variable)
643 {
644 case 1:
645 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
646 break;
647 case 2:
648 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
649 break;
650 case 3:
651 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
652 break;
653 } break;}
654 case 6:
655 {
656 double a=0;
657 double b=1;
658 double c=-1;
659 switch (num_variable)
660 {
661 case 1:
662 val=-0.5*uv[0]*(1+uv[1]*b)*(1+uv[2]*c);
663 break;
664 case 2:
665 val=0.25*b*(1-uv[0]*uv[0])*(1+uv[2]*c);
666 break;
667 case 3:
668 val=0.25*c*(1-uv[0]*uv[0])*(1+uv[1]*b);
669 break;
670 } break;}
671 case 4:
672 {
673 double a=1;
674 double b=0;
675 double c=-1;
676 switch (num_variable)
677 {
678 case 1:
679 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
680 break;
681 case 2:
682 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
683 break;
684 case 3:
685 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
686 break;
687 } break;}
688 case 8:
689 {
690 double a=-1;
691 double b=0;
692 double c=-1;
693 switch (num_variable)
694 {
695 case 1:
696 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
697 break;
698 case 2:
699 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
700 break;
701 case 3:
702 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
703 break;
704 } break;}
705 case 16:
706 {
707 double a=1;
708 double b=0;
709 double c=1;
710 switch (num_variable)
711 {
712 case 1:
713 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
714 break;
715 case 2:
716 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
717 break;
718 case 3:
719 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
720 break;
721 } break;}
722 case 20:
723 {
724 double a=-1;
725 double b=0;
726 double c=1;
727 switch (num_variable)
728 {
729 case 1:
730 val=0.25*a*(1-uv[1]*uv[1])*(1+uv[2]*c);
731 break;
732 case 2:
733 val=-0.5*uv[1]*(1+uv[0]*a)*(1+uv[2]*c);
734 break;
735 case 3:
736 val=0.25*c*(1+uv[0]*a)*(1-uv[1]*uv[1]);
737 break;
738 } break;}
739 case 9:
740 {
741 double a=-1;
742 double b=-1;
743 double c=0.;
744 switch (num_variable)
745 {
746 case 1:
747 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
748 break;
749 case 2:
750 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
751 break;
752 case 3:
753 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
754 break;
755 } break;}
756 case 10:
757 {
758 double a=1;
759 double b=-1;
760 double c=0.;
761 switch (num_variable)
762 {
763 case 1:
764 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
765 break;
766 case 2:
767 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
768 break;
769 case 3:
770 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
771 break;
772 } break;}
773 case 11:
774 {
775 double a=1;
776 double b=1;
777 double c=0.;
778 switch (num_variable)
779 {
780 case 1:
781 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
782 break;
783 case 2:
784 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
785 break;
786 case 3:
787 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
788 break;
789 } break;}
790 case 12:
791 {
792 double a=-1;
793 double b=1;
794 double c=0.;
795 switch (num_variable)
796 {
797 case 1:
798 val=0.25*a*(1+uv[1]*b)*(1-uv[2]*uv[2]);
799 break;
800 case 2:
801 val=0.25*b*(1+uv[0]*a)*(1-uv[2]*uv[2]);
802 break;
803 case 3:
804 val=-0.5*uv[2]*(1+uv[0]*a)*(1+uv[1]*b);
805 break;
806 } break;}
807
808 }
809 return val;
810 }
811
812 double FEM_HEXA20::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
813 {
814 li=3;col=3;
815 OT_TENSEUR Ni(3,20),Xi(20,3);
816 for (int i=0;i<3;i++)
817 for (int j=0;j<20;j++)
818 Ni(i,j)=get_fonction_derive_interpolation(j+1,i+1,uv);
819 for (int i=0;i<20;i++)
820 {
821 double *xyz=tab[i]->get_coord();
822 Xi(i,0)=xyz[0]*unite;
823 Xi(i,1)=xyz[1]*unite;
824 Xi(i,2)=xyz[2]*unite;
825 }
826 OT_TENSEUR jacobi=Ni*Xi;
827 jac[0]=jacobi(0,0).get_x();
828 jac[1]=jacobi(0,1).get_x();
829 jac[2]=jacobi(0,2).get_x();
830 jac[3]=jacobi(1,0).get_x();
831 jac[4]=jacobi(1,1).get_x();
832 jac[5]=jacobi(1,2).get_x();
833 jac[6]=jacobi(2,0).get_x();
834 jac[7]=jacobi(2,1).get_x();
835 jac[8]=jacobi(2,2).get_x();
836 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];
837 return det;
838
839 }
840
841 void FEM_HEXA20::get_inverse_jacob(double* j,double *uv,double unite)
842 {
843 double jac[9];
844 int li,col;
845 double detj=get_jacobien(jac,uv,li,col,unite);
846 j[0*3+0] = (jac[1*3+1]*jac[2*3+2]-jac[1*3+2]*jac[2*3+1])/(detj);
847 j[0*3+1] = -(jac[0*3+1]*jac[2*3+2]-jac[0*3+2]*jac[2*3+1])/(detj);
848 j[0*3+2] =-(-jac[0*3+1]*jac[1*3+2]+jac[0*3+2]*jac[1*3+1])/(detj);
849
850 j[1*3+0] = -(jac[1*3+0]*jac[2*3+2]-jac[1*3+2]*jac[2*3+0])/(detj);
851 j[1*3+1] = (jac[0*3+0]*jac[2*3+2]-jac[0*3+2]*jac[2*3+0])/(detj);
852 j[1*3+2] = -(jac[0*3+0]*jac[1*3+2]-jac[0*3+2]*jac[1*3+0])/(detj);
853
854 j[2*3+0] =-(-jac[1*3+0]*jac[2*3+1]+jac[1*3+1]*jac[2*3+0])/(detj);
855 j[2*3+1] = -(jac[0*3+0]*jac[2*3+1]-jac[0*3+1]*jac[2*3+0])/(detj);
856 j[2*3+2] = (jac[0*3+0]*jac[1*3+1]-jac[0*3+1]*jac[1*3+0])/(detj);
857
858 }
859
860
861
862 int FEM_HEXA20::verifie_validite_decoupage_xfem(double *vol)
863 {
864
865 }