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