ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/xfem_tetra4.cpp
Revision: 340
Committed: Wed May 30 19:05:46 2012 UTC (13 years, 3 months ago) by francois
File size: 6879 byte(s)
Log Message:
ajouet commit precedent sur 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_element34.cpp
16 //
17 //------------------------------------------------------------
18 //------------------------------------------------------------
19 // COPYRIGHT 2000
20 // Version du 02/03/2006 � 11H22
21 //------------------------------------------------------------
22 //------------------------------------------------------------
23
24
25 #include "gestionversion.h"
26 #include "xfem_tetra4.h"
27 #include "fem_tetra4.h"
28 #include "fem_noeud.h"
29 #include "mg_element_maillage.h"
30 #include "fem_maillage.h"
31
32
33 XFEM_TETRA4::XFEM_TETRA4(unsigned long num,class FEM_TETRA4* tet,class FEM_NOEUD** tabnoeud):XFEM_ELEMENT3(num,tet->get_mg_element_maillage()),FEM_TEMPLATE_ELEMENT<4>(tabnoeud),tetra(tet)
34 {
35 tetra->ajouter_xfem(this);
36 }
37
38 XFEM_TETRA4::XFEM_TETRA4(class FEM_TETRA4* tet,FEM_NOEUD** tabnoeud):XFEM_ELEMENT3(tet->get_mg_element_maillage()),FEM_TEMPLATE_ELEMENT<4>(tabnoeud),tetra(tet)
39 {
40 tetra->ajouter_xfem(this);
41 }
42
43 XFEM_TETRA4::XFEM_TETRA4(XFEM_TETRA4& mdd):XFEM_ELEMENT3(mdd),FEM_TEMPLATE_ELEMENT<4>(mdd),tetra(mdd.tetra),n1(mdd.n1),n2(mdd.n2),n3(mdd.n3),n4(mdd.n4)
44 {
45 }
46
47 XFEM_TETRA4::~XFEM_TETRA4()
48 {
49 tetra->supprimer_xfem(this);
50 }
51
52 XFEM_TETRA4::XFEM_TETRA4(class FEM_TETRA4 *tet,unsigned long num1,unsigned long num2,unsigned long num3,unsigned long num4):XFEM_ELEMENT3(tet->get_mg_element_maillage()),FEM_TEMPLATE_ELEMENT<4>(),tetra(tet),n1(num1),n2(num2),n3(num3),n4(num4)
53 {
54 tetra->ajouter_xfem(this);
55 }
56
57
58 int XFEM_TETRA4::get_type_entite(void)
59 {
60 return IDXFEM_TETRA4;
61 }
62
63 int XFEM_TETRA4::get_dimension(void)
64 {
65 return 3;
66 }
67
68
69 int XFEM_TETRA4::get_nb_fem_noeud(void)
70 {
71 return FEM_TEMPLATE_ELEMENT<4>::get_nb_fem_noeud();
72 }
73
74 FEM_NOEUD* XFEM_TETRA4::get_fem_noeud(int num)
75 {
76 return FEM_TEMPLATE_ELEMENT<4>::get_fem_noeud(num);
77 }
78
79 void XFEM_TETRA4::change_noeud(int num,FEM_NOEUD* noeud)
80 {
81 FEM_TEMPLATE_ELEMENT<4>::change_noeud(num,noeud);
82 }
83
84
85 BOITE_3D& XFEM_TETRA4::get_boite_3D(void)
86 {
87 return FEM_TEMPLATE_ELEMENT<4>::get_boite_3D();
88 }
89
90 void XFEM_TETRA4::enregistrer(std::ostream& o)
91 {
92 o << "%" << get_id() << "=XFEM_TETRA4($"<< tetra->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id() << ",$" << tab[3]->get_id() << ");" << std::endl;
93
94 }
95
96 FEM_ELEMENT_MAILLAGE* XFEM_TETRA4::dupliquer(FEM_MAILLAGE *femmai,long decalage)
97 {
98 tab[0]=femmai->get_fem_noeudid(n1);
99 tab[1]=femmai->get_fem_noeudid(n2);
100 tab[2]=femmai->get_fem_noeudid(n3);
101 tab[3]=femmai->get_fem_noeudid(n4);
102 }
103
104
105
106 int XFEM_TETRA4::nb_fonction_interpolation(void)
107 {
108 return 4;
109 }
110 double XFEM_TETRA4::get_fonction_interpolation(int num,double *uv)
111 {
112 double val;
113 switch (num)
114 {
115 case 1:
116 val=1-uv[0]-uv[1]-uv[2];
117 break;
118 case 2:
119 val=uv[0];
120 break;
121 case 3:
122 val=uv[1];
123 break;
124 case 4:
125 val=uv[2];
126 break;
127 }
128 return val;
129 }
130 double XFEM_TETRA4::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
131 {
132 double val;
133
134 switch (num)
135 {
136 case 1:
137 switch (num_variable)
138 {
139 case 1:
140 val=-1;
141 break;
142 case 2:
143 val=-1;
144 break;
145 case 3:
146 val=-1;
147 break;
148 } break;
149 case 2:
150 switch (num_variable)
151 {
152 case 1:
153 val=1;
154 break;
155 case 2:
156 val=0;
157 break;
158 case 3:
159 val=0;
160 break;
161 }break;
162 case 3:
163 switch (num_variable)
164 {
165 case 1:
166 val=0;
167 break;
168 case 2:
169 val=1;
170 break;
171 case 3:
172 val=0;
173 break;
174 }break;
175 case 4:
176 switch (num_variable)
177 {
178 case 1:
179 val=0;
180 break;
181 case 2:
182 val=0;
183 break;
184 case 3:
185 val=1;
186 break;
187 }break;
188
189 }
190 return val;
191 }
192 double XFEM_TETRA4::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
193 {
194 li=3;
195 col=3;
196 double *xyz1=tab[0]->get_coord();
197 double *xyz2=tab[1]->get_coord();
198 double *xyz3=tab[2]->get_coord();
199 double *xyz4=tab[3]->get_coord();
200
201 jac[0]=unite*(xyz2[0] - xyz1[0]) ;
202 jac[1]=unite*(xyz2[1] - xyz1[1]) ;
203 jac[2]=unite*(xyz2[2] - xyz1[2]) ;
204
205 jac[3]=unite*(xyz3[0] - xyz1[0]) ;
206 jac[4]=unite*(xyz3[1] - xyz1[1]) ;
207 jac[5]=unite*(xyz3[2] - xyz1[2]) ;
208
209 jac[6]=unite*(xyz4[0] - xyz1[0]) ;
210 jac[7]=unite*(xyz4[1] - xyz1[1]) ;
211 jac[8]=unite*(xyz4[2] - xyz1[2]) ;
212
213 double SIX_V= jac[0]*(jac[4]*jac[8]-jac[7]*jac[5])+jac[1]*(jac[5]*jac[6]-jac[8]*jac[3])+jac[2]*(jac[3]*jac[7]-jac[6]*jac[4]);
214
215 return SIX_V;
216 }
217 void XFEM_TETRA4::get_inverse_jacob(double* j,double *uv,double unite)
218 {
219 double *xyz1=tab[0]->get_coord();
220 double *xyz2=tab[1]->get_coord();
221 double *xyz3=tab[2]->get_coord();
222 double *xyz4=tab[3]->get_coord();
223
224 double jac[9];
225
226 jac[0*3+0]= unite*(xyz2[0] - xyz1[0]) ;
227 jac[0*3+1]= unite*(xyz2[1] - xyz1[1]) ;
228 jac[0*3+2]= unite*(xyz2[2] - xyz1[2]) ;
229
230 jac[1*3+0]= unite*(xyz3[0] - xyz1[0]) ;
231 jac[1*3+1]= unite*(xyz3[1] - xyz1[1]) ;
232 jac[1*3+2]= unite*(xyz3[2] - xyz1[2]) ;
233
234 jac[2*3+0]= unite*(xyz4[0] - xyz1[0]) ;
235 jac[2*3+1]= unite*(xyz4[1] - xyz1[1]) ;
236 jac[2*3+2]= unite*(xyz4[2] - xyz1[2]) ;
237
238 double detj=(jac[0*3+0]*jac[1*3+1]*jac[2*3+2]-jac[0*3+0]*jac[1*3+2]*jac[2*3+1]-jac[1*3+0]*jac[0*3+1]*jac[2*3+2]+jac[1*3+0]*jac[0*3+2]*jac[2*3+1]+jac[2*3+0]*jac[0*3+1]*jac[1*3+2]-jac[2*3+0]*jac[0*3+2]*jac[1*3+1]);
239
240 j[0*3+0] = (jac[1*3+1]*jac[2*3+2]-jac[1*3+2]*jac[2*3+1])/(detj);
241 j[0*3+1] = -(jac[0*3+1]*jac[2*3+2]-jac[0*3+2]*jac[2*3+1])/(detj);
242 j[0*3+2] =-(-jac[0*3+1]*jac[1*3+2]+jac[0*3+2]*jac[1*3+1])/(detj);
243
244 j[1*3+0] = -(jac[1*3+0]*jac[2*3+2]-jac[1*3+2]*jac[2*3+0])/(detj);
245 j[1*3+1] = (jac[0*3+0]*jac[2*3+2]-jac[0*3+2]*jac[2*3+0])/(detj);
246 j[1*3+2] = -(jac[0*3+0]*jac[1*3+2]-jac[0*3+2]*jac[1*3+0])/(detj);
247
248 j[2*3+0] =-(-jac[1*3+0]*jac[2*3+1]+jac[1*3+1]*jac[2*3+0])/(detj);
249 j[2*3+1] = -(jac[0*3+0]*jac[2*3+1]-jac[0*3+1]*jac[2*3+0])/(detj);
250 j[2*3+2] = (jac[0*3+0]*jac[1*3+1]-jac[0*3+1]*jac[1*3+0])/(detj);
251
252 }