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 |
|
|
|
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 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
francois |
309 |
FEM_SEGMENT3::FEM_SEGMENT3(FEM_SEGMENT3& mdd):FEM_ELEMENT1(mdd),FEM_TEMPLATE_ELEMENT<3>(mdd) |
92 |
francois |
283 |
{ |
93 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
94 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
95 |
|
|
tab[2]->get_lien_element1()->ajouter(this); |
96 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
97 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
98 |
|
|
|
99 |
francois |
283 |
} |
100 |
|
|
|
101 |
|
|
FEM_SEGMENT3::~FEM_SEGMENT3() |
102 |
|
|
{ |
103 |
|
|
if (liaison_topologique==NULL) return; |
104 |
|
|
if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this); |
105 |
francois |
309 |
tab[0]->get_lien_element1()->supprimer(this); |
106 |
|
|
tab[1]->get_lien_element1()->supprimer(this); |
107 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->supprimer(this); |
108 |
francois |
283 |
} |
109 |
|
|
|
110 |
|
|
FEM_ELEMENT_MAILLAGE* FEM_SEGMENT3::dupliquer(FEM_MAILLAGE *femmai,long decalage) |
111 |
|
|
{ |
112 |
|
|
FEM_NOEUD* tabnoeud[3]; |
113 |
|
|
tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage); |
114 |
|
|
tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage); |
115 |
|
|
tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage); |
116 |
|
|
FEM_SEGMENT3* seg=new FEM_SEGMENT3(get_id()+decalage,maillage,tabnoeud); |
117 |
francois |
309 |
femmai->ajouter_fem_element1(seg); |
118 |
francois |
283 |
return seg; |
119 |
|
|
} |
120 |
|
|
|
121 |
francois |
635 |
bool FEM_SEGMENT3::valide_parametre_EF(double* uvw) |
122 |
|
|
{ |
123 |
|
|
if (uvw[0]>=-1e-10) |
124 |
|
|
if (uvw[0]<=1.+1e-10) |
125 |
|
|
return true; |
126 |
|
|
return false; |
127 |
|
|
} |
128 |
francois |
283 |
|
129 |
|
|
|
130 |
francois |
635 |
|
131 |
francois |
283 |
int FEM_SEGMENT3::get_type_entite(void) |
132 |
|
|
{ |
133 |
|
|
return IDFEM_SEGMENT3; |
134 |
|
|
} |
135 |
|
|
|
136 |
|
|
int FEM_SEGMENT3::get_dimension(void) |
137 |
|
|
{ |
138 |
|
|
return 1; |
139 |
|
|
} |
140 |
|
|
|
141 |
|
|
|
142 |
|
|
int FEM_SEGMENT3::get_nb_fem_noeud(void) |
143 |
|
|
{ |
144 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_nb_fem_noeud(); |
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
FEM_NOEUD* FEM_SEGMENT3::get_fem_noeud(int num) |
148 |
|
|
{ |
149 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_fem_noeud(num); |
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
void FEM_SEGMENT3::change_noeud(int num,FEM_NOEUD* noeud) |
153 |
|
|
{ |
154 |
|
|
FEM_TEMPLATE_ELEMENT<3>::change_noeud(num,noeud); |
155 |
|
|
} |
156 |
|
|
|
157 |
|
|
BOITE_3D& FEM_SEGMENT3::get_boite_3D(void) |
158 |
|
|
{ |
159 |
|
|
return FEM_TEMPLATE_ELEMENT<3>::get_boite_3D(); |
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
void FEM_SEGMENT3::enregistrer(std::ostream& o) |
165 |
|
|
{ |
166 |
francois |
378 |
if (maillage!=NULL) |
167 |
|
|
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; |
168 |
|
|
else o << "%" << get_id() << "=FEM_SEGMENT3(NULL,$" << maillage->get_id() <<",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
169 |
|
|
else |
170 |
|
|
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; |
171 |
|
|
else o << "%" << get_id() << "=FEM_SEGMENT3(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl; |
172 |
|
|
|
173 |
francois |
283 |
} |
174 |
francois |
310 |
int FEM_SEGMENT3::nb_fonction_interpolation(void) |
175 |
|
|
{ |
176 |
|
|
return 3; |
177 |
|
|
} |
178 |
|
|
|
179 |
|
|
|
180 |
|
|
double FEM_SEGMENT3::get_fonction_interpolation(int num,double *uv) |
181 |
|
|
{ |
182 |
|
|
double val; |
183 |
|
|
switch (num) |
184 |
|
|
{ |
185 |
|
|
case 1: |
186 |
|
|
val=-0.5*uv[0]*(1.-uv[0]); |
187 |
|
|
break; |
188 |
|
|
case 2: |
189 |
|
|
val=1.-uv[0]*uv[0]; |
190 |
|
|
break; |
191 |
|
|
case 3: |
192 |
|
|
val=0.5*uv[0]*(1.+uv[0]); |
193 |
|
|
break; |
194 |
|
|
} |
195 |
|
|
return val; |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
double FEM_SEGMENT3::get_fonction_derive_interpolation(int num,int num_variable,double *uv) |
199 |
|
|
{ |
200 |
|
|
double val; |
201 |
|
|
|
202 |
|
|
switch (num) |
203 |
|
|
{ |
204 |
|
|
case 1: |
205 |
|
|
switch (num_variable) |
206 |
|
|
{ |
207 |
|
|
case 1: |
208 |
|
|
val=-0.5+uv[0]; |
209 |
|
|
break; |
210 |
|
|
case 2: |
211 |
|
|
val=-2.*uv[0]; |
212 |
|
|
break; |
213 |
|
|
case 3: |
214 |
|
|
val=0.5+uv[0]; |
215 |
|
|
break; |
216 |
|
|
} |
217 |
|
|
break; |
218 |
|
|
|
219 |
|
|
} |
220 |
|
|
return val; |
221 |
|
|
} |
222 |
|
|
|
223 |
|
|
double FEM_SEGMENT3::get_jacobien(double* jac,double *uv,int& li,int& col,double unite) |
224 |
|
|
{ |
225 |
|
|
|
226 |
|
|
} |
227 |
|
|
|
228 |
|
|
void FEM_SEGMENT3::get_inverse_jacob(double* j,double *uv,double unite) |
229 |
|
|
{ |
230 |
|
|
|
231 |
|
|
} |