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 |
francois |
309 |
// fem_element12.cpp |
16 |
francois |
283 |
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H22 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h" |
26 |
|
|
#include "fem_segment2.h" |
27 |
|
|
#include "fem_noeud.h" |
28 |
|
|
#include "fem_maillage.h" |
29 |
|
|
#include "mg_element_maillage.h" |
30 |
|
|
|
31 |
francois |
309 |
FEM_SEGMENT2::FEM_SEGMENT2(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,mai),FEM_TEMPLATE_ELEMENT<2>(tabnoeud) |
32 |
francois |
283 |
{ |
33 |
francois |
378 |
tab[0]->get_lien_element1()->ajouter(this); |
34 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
35 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
36 |
francois |
283 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
37 |
francois |
378 |
|
38 |
|
|
} |
39 |
|
|
FEM_SEGMENT2::FEM_SEGMENT2(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT1(num,topo,mai),FEM_TEMPLATE_ELEMENT<2>(tabnoeud) |
40 |
|
|
{ |
41 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
42 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
43 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
44 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
45 |
|
|
|
46 |
francois |
283 |
} |
47 |
|
|
|
48 |
francois |
378 |
FEM_SEGMENT2::FEM_SEGMENT2(class MG_ELEMENT_TOPOLOGIQUE* topo,class FEM_NOEUD** tabnoeud):FEM_ELEMENT1(topo),FEM_TEMPLATE_ELEMENT<2>(tabnoeud) |
49 |
|
|
{ |
50 |
|
|
tab[0]->get_lien_element1()->ajouter(this); |
51 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
52 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
53 |
|
|
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
54 |
|
|
|
55 |
|
|
} |
56 |
francois |
309 |
FEM_SEGMENT2::FEM_SEGMENT2(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(mai),FEM_TEMPLATE_ELEMENT<2>(tabnoeud) |
57 |
francois |
283 |
{ |
58 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
59 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
60 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
61 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
62 |
|
|
|
63 |
francois |
283 |
} |
64 |
|
|
|
65 |
francois |
309 |
FEM_SEGMENT2::FEM_SEGMENT2(FEM_SEGMENT2& mdd):FEM_ELEMENT1(mdd),FEM_TEMPLATE_ELEMENT<2>(mdd) |
66 |
francois |
283 |
{ |
67 |
francois |
309 |
tab[0]->get_lien_element1()->ajouter(this); |
68 |
|
|
tab[1]->get_lien_element1()->ajouter(this); |
69 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this); |
70 |
francois |
378 |
if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this); |
71 |
|
|
|
72 |
francois |
283 |
} |
73 |
|
|
|
74 |
|
|
FEM_SEGMENT2::~FEM_SEGMENT2() |
75 |
|
|
{ |
76 |
|
|
if (liaison_topologique==NULL) return; |
77 |
|
|
if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this); |
78 |
francois |
309 |
tab[0]->get_lien_element1()->supprimer(this); |
79 |
|
|
tab[1]->get_lien_element1()->supprimer(this); |
80 |
|
|
get_fem_noeudpetitid()->get_lien_petit_element1()->supprimer(this); |
81 |
francois |
283 |
} |
82 |
|
|
|
83 |
|
|
FEM_ELEMENT_MAILLAGE* FEM_SEGMENT2::dupliquer(FEM_MAILLAGE *femmai,long decalage) |
84 |
|
|
{ |
85 |
|
|
FEM_NOEUD* tabnoeud[2]; |
86 |
|
|
tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage); |
87 |
|
|
tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage); |
88 |
|
|
FEM_SEGMENT2* seg=new FEM_SEGMENT2(get_id()+decalage,maillage,tabnoeud); |
89 |
francois |
309 |
femmai->ajouter_fem_element1(seg); |
90 |
francois |
283 |
return seg; |
91 |
|
|
} |
92 |
|
|
|
93 |
francois |
635 |
bool FEM_SEGMENT2::valide_parametre_EF(double* uvw) |
94 |
|
|
{ |
95 |
|
|
if (uvw[0]>=-1e-10) |
96 |
|
|
if (uvw[0]<=1.+1e-10) |
97 |
|
|
return true; |
98 |
|
|
return false; |
99 |
|
|
} |
100 |
francois |
283 |
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
int FEM_SEGMENT2::get_type_entite(void) |
104 |
|
|
{ |
105 |
|
|
return IDFEM_SEGMENT2; |
106 |
|
|
} |
107 |
|
|
|
108 |
|
|
int FEM_SEGMENT2::get_dimension(void) |
109 |
|
|
{ |
110 |
|
|
return 1; |
111 |
|
|
} |
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
int FEM_SEGMENT2::get_nb_fem_noeud(void) |
116 |
|
|
{ |
117 |
|
|
return FEM_TEMPLATE_ELEMENT<2>::get_nb_fem_noeud(); |
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
FEM_NOEUD* FEM_SEGMENT2::get_fem_noeud(int num) |
121 |
|
|
{ |
122 |
|
|
return FEM_TEMPLATE_ELEMENT<2>::get_fem_noeud(num); |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
void FEM_SEGMENT2::change_noeud(int num,FEM_NOEUD* noeud) |
126 |
|
|
{ |
127 |
|
|
FEM_TEMPLATE_ELEMENT<2>::change_noeud(num,noeud); |
128 |
|
|
} |
129 |
|
|
|
130 |
|
|
BOITE_3D& FEM_SEGMENT2::get_boite_3D(void) |
131 |
|
|
{ |
132 |
|
|
return FEM_TEMPLATE_ELEMENT<2>::get_boite_3D(); |
133 |
|
|
} |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
void FEM_SEGMENT2::enregistrer(std::ostream& o) |
137 |
|
|
{ |
138 |
francois |
378 |
if (maillage!=NULL) |
139 |
|
|
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_SEGMENT2($"<< get_lien_topologie()->get_id() << ",$"<< maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl; |
140 |
francois |
283 |
else o << "%" << get_id() << "=FEM_SEGMENT2(NULL,$" << maillage->get_id() <<",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl; |
141 |
francois |
378 |
if (maillage==NULL) |
142 |
|
|
if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_SEGMENT2($"<< get_lien_topologie()->get_id() << ",NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl; |
143 |
|
|
else o << "%" << get_id() << "=FEM_SEGMENT2(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl; |
144 |
francois |
283 |
} |
145 |
francois |
310 |
|
146 |
|
|
|
147 |
|
|
int FEM_SEGMENT2::nb_fonction_interpolation(void) |
148 |
|
|
{ |
149 |
|
|
return 2; |
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
|
153 |
|
|
double FEM_SEGMENT2::get_fonction_interpolation(int num,double *uv) |
154 |
|
|
{ |
155 |
|
|
double val; |
156 |
|
|
switch (num) |
157 |
|
|
{ |
158 |
|
|
case 1: |
159 |
|
|
val=0.5*(1.-uv[0]); |
160 |
|
|
break; |
161 |
|
|
case 2: |
162 |
|
|
val=0.5*(1.+uv[0]); |
163 |
|
|
break; |
164 |
|
|
} |
165 |
|
|
return val; |
166 |
|
|
} |
167 |
|
|
|
168 |
|
|
double FEM_SEGMENT2::get_fonction_derive_interpolation(int num,int num_variable,double *uv) |
169 |
|
|
{ |
170 |
|
|
double val; |
171 |
|
|
|
172 |
|
|
switch (num) |
173 |
|
|
{ |
174 |
|
|
case 1: |
175 |
|
|
switch (num_variable) |
176 |
|
|
{ |
177 |
|
|
case 1: |
178 |
|
|
val=-0.5; |
179 |
|
|
break; |
180 |
|
|
case 2: |
181 |
|
|
val=-0.5; |
182 |
|
|
break; |
183 |
|
|
} |
184 |
|
|
break; |
185 |
|
|
|
186 |
|
|
} |
187 |
|
|
return val; |
188 |
|
|
} |
189 |
|
|
|
190 |
|
|
double FEM_SEGMENT2::get_jacobien(double* jac,double *uv,int& li,int& col,double unite) |
191 |
|
|
{ |
192 |
|
|
/*li=1; |
193 |
|
|
col=1; |
194 |
|
|
double *xyz1=tab[0]->get_coord(); |
195 |
|
|
double *xyz2=tab[1]->get_coord(); |
196 |
|
|
|
197 |
|
|
jac[0]=0.5*unite*(xyz2[0] - xyz1[0]) ; |
198 |
|
|
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
return jac[0];*/ |
202 |
|
|
} |
203 |
|
|
|
204 |
|
|
void FEM_SEGMENT2::get_inverse_jacob(double* j,double *uv,double unite) |
205 |
|
|
{ |
206 |
|
|
/*double *xyz1=tab[0]->get_coord(); |
207 |
|
|
double *xyz2=tab[1]->get_coord(); |
208 |
|
|
|
209 |
|
|
j[0]=1./(0.5*unite*(xyz2[0] - xyz1[0])) ;*/ |
210 |
|
|
} |