1 |
francois |
283 |
//------------------------------------------------------------ |
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_segment3.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_segment3.h" |
27 |
|
|
#include "fem_noeud.h" |
28 |
|
|
#include "fem_maillage.h" |
29 |
|
|
#include "mg_element_maillage.h" |
30 |
francois |
754 |
#include "ot_quadrature_gauss.h" |
31 |
francois |
283 |
|
32 |
|
|
|
33 |
francois |
309 |
FEM_SEGMENT3::FEM_SEGMENT3(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
34 |
francois |
283 |
{ |
35 |
francois |
378 |
tab[0]->get_lien_element1()->ajouter(this); |
36 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
37 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
38 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
39 |
francois |
283 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
40 |
francois |
378 |
|
41 |
|
|
} |
42 |
|
|
FEM_SEGMENT3::FEM_SEGMENT3(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,topo),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
43 |
|
|
{ |
44 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
45 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
46 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
47 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
48 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
49 |
francois |
283 |
} |
50 |
|
|
|
51 |
francois |
378 |
FEM_SEGMENT3::FEM_SEGMENT3(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,topo,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
52 |
|
|
{ |
53 |
|
|
tab[0]->get_lien_element1()->ajouter(this); |
54 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
55 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
56 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
57 |
|
|
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
58 |
|
|
} |
59 |
francois |
309 |
FEM_SEGMENT3::FEM_SEGMENT3(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
60 |
francois |
283 |
{ |
61 |
francois |
378 |
tab[0]->get_lien_element1()->ajouter(this); |
62 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
63 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
64 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
65 |
francois |
283 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
66 |
francois |
378 |
|
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
FEM_SEGMENT3::FEM_SEGMENT3(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(topo),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
70 |
|
|
{ |
71 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
72 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
73 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
74 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
75 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
76 |
francois |
283 |
} |
77 |
|
|
|
78 |
francois |
378 |
FEM_SEGMENT3::FEM_SEGMENT3(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(topo,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud) |
79 |
|
|
{ |
80 |
|
|
tab[0]->get_lien_element1()->ajouter(this); |
81 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
82 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
83 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
84 |
|
|
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
85 |
|
|
} |
86 |
|
|
|
87 |
francois |
786 |
void FEM_SEGMENT3::get_voisin_noeud(class FEM_NOEUD* no,TPL_LISTE_ENTITE<FEM_NOEUD*> &voisin) |
88 |
|
|
{ |
89 |
|
|
voisin.vide(); |
90 |
|
|
if (no==tab[0]) |
91 |
|
|
{ |
92 |
|
|
voisin.ajouter(tab[1]); |
93 |
|
|
} |
94 |
|
|
if (no==tab[1]) |
95 |
|
|
{ |
96 |
|
|
voisin.ajouter(tab[0]); |
97 |
|
|
voisin.ajouter(tab[2]); |
98 |
|
|
} |
99 |
|
|
if (no==tab[2]) |
100 |
|
|
{ |
101 |
|
|
voisin.ajouter(tab[1]); |
102 |
|
|
} |
103 |
|
|
} |
104 |
francois |
378 |
|
105 |
|
|
|
106 |
francois |
684 |
void FEM_SEGMENT3::reinit_boite_3D(void) |
107 |
|
|
{ |
108 |
|
|
FEM_TEMPLATE_ELEMENT<3>::reinit_boite_3D(); |
109 |
|
|
} |
110 |
francois |
378 |
|
111 |
|
|
|
112 |
francois |
309 |
FEM_SEGMENT3::FEM_SEGMENT3(FEM_SEGMENT3& mdd):FEM_ELEMENT1(mdd),FEM_TEMPLATE_ELEMENT<3>(mdd) |
113 |
francois |
283 |
{ |
114 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
115 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
116 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
117 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
118 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
119 |
|
|
|
120 |
francois |
283 |
} |
121 |
|
|
|
122 |
|
|
FEM_SEGMENT3::~FEM_SEGMENT3() |
123 |
|
|
{ |
124 |
francois |
663 |
if (liaison_topologique!=NULL) |
125 |
|
|
if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this); |
126 |
francois |
309 |
tab[0]->get_lien_element1()->supprimer(this); |
127 |
|
|
tab[1]->get_lien_element1()->supprimer(this); |
128 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->supprimer(this); |
129 |
francois |
283 |
} |
130 |
|
|
|
131 |
|
|
FEM_ELEMENT_MAILLAGE* FEM_SEGMENT3::dupliquer(FEM_MAILLAGE *femmai,long decalage) |
132 |
|
|
{ |
133 |
|
|
FEM_NOEUD* tabnoeud[3]; |
134 |
|
|
tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage); |
135 |
|
|
tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage); |
136 |
|
|
tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage); |
137 |
|
|
FEM_SEGMENT3* seg=new FEM_SEGMENT3(get_id()+decalage,maillage,tabnoeud); |
138 |
francois |
309 |
femmai->ajouter_fem_element1(seg); |
139 |
francois |
283 |
return seg; |
140 |
|
|
} |
141 |
|
|
|
142 |
francois |
635 |
bool FEM_SEGMENT3::valide_parametre_EF(double* uvw) |
143 |
|
|
{ |
144 |
|
|
if (uvw[0]>=-1e-10) |
145 |
|
|
if (uvw[0]<=1.+1e-10) |
146 |
|
|
return true; |
147 |
|
|
return false; |
148 |
|
|
} |
149 |
francois |
283 |
|
150 |
|
|
|
151 |
francois |
635 |
|
152 |
francois |
283 |
int FEM_SEGMENT3::get_type_entite(void) |
153 |
|
|
{ |
154 |
|
|
return IDFEM_SEGMENT3; |
155 |
|
|
} |
156 |
|
|
|
157 |
|
|
int FEM_SEGMENT3::get_dimension(void) |
158 |
|
|
{ |
159 |
|
|
return 1; |
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
|
163 |
|
|
int FEM_SEGMENT3::get_nb_fem_noeud(void) |
164 |
|
|
{ |
165 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_nb_fem_noeud(); |
166 |
|
|
} |
167 |
|
|
|
168 |
|
|
FEM_NOEUD* FEM_SEGMENT3::get_fem_noeud(int num) |
169 |
|
|
{ |
170 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_fem_noeud(num); |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
void FEM_SEGMENT3::change_noeud(int num,FEM_NOEUD* noeud) |
174 |
|
|
{ |
175 |
|
|
FEM_TEMPLATE_ELEMENT<3>::change_noeud(num,noeud); |
176 |
|
|
} |
177 |
|
|
|
178 |
|
|
BOITE_3D& FEM_SEGMENT3::get_boite_3D(void) |
179 |
|
|
{ |
180 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_boite_3D(); |
181 |
|
|
} |
182 |
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
francois |
763 |
void FEM_SEGMENT3::enregistrer(std::ostream& o,double version) |
186 |
francois |
283 |
{ |
187 |
francois |
378 |
if (maillage!=NULL) |
188 |
|
|
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_SEGMENT3($"<< get_lien_topologie()->get_id() << ",$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
189 |
|
|
else o << "%" << get_id() << "=FEM_SEGMENT3(NULL,$" << maillage->get_id() <<",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
190 |
|
|
else |
191 |
|
|
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_SEGMENT3($"<< get_lien_topologie()->get_id() << ",NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
192 |
|
|
else o << "%" << get_id() << "=FEM_SEGMENT3(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
193 |
|
|
|
194 |
francois |
283 |
} |
195 |
francois |
637 |
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
int FEM_SEGMENT3::get_nb_pt_gauss(int degre) |
199 |
|
|
{ |
200 |
francois |
754 |
return OT_POINTS_GAUSS::get_nb_point_seg(degre); |
201 |
francois |
637 |
} |
202 |
|
|
|
203 |
|
|
void FEM_SEGMENT3::get_pt_gauss(int degre,int num,double &w,double *u) |
204 |
|
|
{ |
205 |
francois |
754 |
return OT_POINTS_GAUSS::get_pt_gauss_seg(degre,num,w,u); |
206 |
francois |
637 |
} |
207 |
francois |
757 |
|
208 |
|
|
int FEM_SEGMENT3::get_degre_gauss(int num) |
209 |
|
|
{ |
210 |
|
|
return OT_POINTS_GAUSS::get_degre_gauss_seg(num); |
211 |
|
|
} |
212 |
|
|
|
213 |
francois |
638 |
int FEM_SEGMENT3::get_nb_fonction_interpolation(void) |
214 |
francois |
310 |
{ |
215 |
|
|
return 3; |
216 |
|
|
} |
217 |
|
|
|
218 |
francois |
638 |
int FEM_SEGMENT3::get_degremax_fonction_interpolation(void) |
219 |
|
|
{ |
220 |
|
|
return 2; |
221 |
|
|
} |
222 |
francois |
310 |
double FEM_SEGMENT3::get_fonction_interpolation(int num,double *uv) |
223 |
|
|
{ |
224 |
|
|
double val; |
225 |
|
|
switch (num) |
226 |
|
|
{ |
227 |
|
|
case 1: |
228 |
|
|
val=-0.5*uv[0]*(1.-uv[0]); |
229 |
|
|
break; |
230 |
|
|
case 2: |
231 |
|
|
val=1.-uv[0]*uv[0]; |
232 |
|
|
break; |
233 |
|
|
case 3: |
234 |
|
|
val=0.5*uv[0]*(1.+uv[0]); |
235 |
|
|
break; |
236 |
|
|
} |
237 |
|
|
return val; |
238 |
|
|
} |
239 |
|
|
|
240 |
|
|
double FEM_SEGMENT3::get_fonction_derive_interpolation(int num,int num_variable,double *uv) |
241 |
|
|
{ |
242 |
|
|
double val; |
243 |
|
|
|
244 |
|
|
switch (num) |
245 |
|
|
{ |
246 |
|
|
case 1: |
247 |
|
|
switch (num_variable) |
248 |
|
|
{ |
249 |
|
|
case 1: |
250 |
|
|
val=-0.5+uv[0]; |
251 |
|
|
break; |
252 |
|
|
case 2: |
253 |
|
|
val=-2.*uv[0]; |
254 |
|
|
break; |
255 |
|
|
case 3: |
256 |
|
|
val=0.5+uv[0]; |
257 |
|
|
break; |
258 |
|
|
} |
259 |
|
|
break; |
260 |
|
|
|
261 |
|
|
} |
262 |
|
|
return val; |
263 |
|
|
} |
264 |
|
|
|
265 |
|
|
double FEM_SEGMENT3::get_jacobien(double* jac,double *uv,int& li,int& col,double unite) |
266 |
|
|
{ |
267 |
|
|
|
268 |
|
|
} |
269 |
|
|
|
270 |
|
|
void FEM_SEGMENT3::get_inverse_jacob(double* j,double *uv,double unite) |
271 |
|
|
{ |
272 |
|
|
|
273 |
|
|
} |