ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_segment2.cpp
Revision: 684
Committed: Tue Jun 30 15:21:22 2015 UTC (9 years, 10 months ago) by francois
File size: 9296 byte(s)
Log Message:
mise a jour de la boite englobante quand une coordonnees change  dans un fem_noeud

File Contents

# User Rev Content
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 francois 663 if (liaison_topologique!=NULL)
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 francois 684 void FEM_SEGMENT2::reinit_boite_3D(void)
102     {
103     FEM_TEMPLATE_ELEMENT<2>::reinit_boite_3D();
104     }
105 francois 283
106     int FEM_SEGMENT2::get_type_entite(void)
107     {
108     return IDFEM_SEGMENT2;
109     }
110    
111     int FEM_SEGMENT2::get_dimension(void)
112     {
113     return 1;
114     }
115    
116    
117    
118     int FEM_SEGMENT2::get_nb_fem_noeud(void)
119     {
120     return FEM_TEMPLATE_ELEMENT<2>::get_nb_fem_noeud();
121     }
122    
123     FEM_NOEUD* FEM_SEGMENT2::get_fem_noeud(int num)
124     {
125     return FEM_TEMPLATE_ELEMENT<2>::get_fem_noeud(num);
126     }
127    
128     void FEM_SEGMENT2::change_noeud(int num,FEM_NOEUD* noeud)
129     {
130     FEM_TEMPLATE_ELEMENT<2>::change_noeud(num,noeud);
131     }
132    
133     BOITE_3D& FEM_SEGMENT2::get_boite_3D(void)
134     {
135     return FEM_TEMPLATE_ELEMENT<2>::get_boite_3D();
136     }
137    
138    
139     void FEM_SEGMENT2::enregistrer(std::ostream& o)
140     {
141 francois 378 if (maillage!=NULL)
142     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;
143 francois 283 else o << "%" << get_id() << "=FEM_SEGMENT2(NULL,$" << maillage->get_id() <<",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl;
144 francois 378 if (maillage==NULL)
145     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;
146     else o << "%" << get_id() << "=FEM_SEGMENT2(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl;
147 francois 283 }
148 francois 310
149    
150 francois 637 int FEM_SEGMENT2::get_nb_pt_gauss(int degre)
151     {
152     if (degre<2) return 1;
153     if (degre<4) return 2;
154     if (degre<6) return 3;
155     if (degre<8) return 4;
156     if (degre<10) return 5;
157     if (degre<12) return 6;
158     if (degre<14) return 7;
159     return 0;
160     }
161    
162     void FEM_SEGMENT2::get_pt_gauss(int degre,int num,double &w,double *u)
163     {
164     if (degre<2)
165     {
166     if (num==0) {w=2;u[0]=0;}
167     return;
168     }
169     if (degre<4)
170     {
171     if (num==0) {w=1;u[0]=-0.577350269189626;}
172     if (num==1) {w=1;u[0]=0.577350269189626;}
173     return;
174     }
175     if (degre<6)
176     {
177     if (num==0) {w=0.888888888888889;u[0]=0.;}
178     if (num==1) {w=0.555555555555556;u[0]=-0.774596669241483;}
179     if (num==2) {w=0.555555555555556;u[0]=0.774596669241483;}
180     return;
181     }
182     if (degre<8)
183     {
184     if (num==0) {w=0.652145154862546;u[0]=-0.339981043584856;}
185     if (num==1) {w=0.652145154862546;u[0]=0.339981043584856;}
186     if (num==2) {w=0.347854845137454;u[0]=-0.861136311594053;}
187     if (num==3) {w=0.347854845137454;u[0]=0.861136311594053;}
188     return;
189     }
190     if (degre<10)
191     {
192     if (num==0) {w=0.568888888888889;u[0]=0.;}
193     if (num==1) {w=0.478628670499366;u[0]=-0.538469310105683;}
194     if (num==2) {w=0.478628670499366;u[0]=0.538469310105683;}
195     if (num==3) {w=0.236926885056189;u[0]=-0.906179845938664;}
196     if (num==4) {w=0.236926885056189;u[0]=0.906179845938664;}
197     return;
198     }
199     if (degre<12)
200     {
201     if (num==0) {w=0.467913934572691;u[0]=-0.238619186083197;}
202     if (num==1) {w=0.467913934572691;u[0]=0.238619186083197;}
203     if (num==2) {w=0.360761573048139;u[0]=-0.661209386466265;}
204     if (num==3) {w=0.360761573048139;u[0]=0.661209386466265;}
205     if (num==4) {w=0.171324492379170;u[0]=-0.932469514203152;}
206     if (num==5) {w=0.171324492379170;u[0]=0.932469514203152;}
207     return;
208     }
209     if (degre<14)
210     {
211     if (num==0) {w=0.417959183673469;u[0]=0;}
212     if (num==1) {w=0.381830050505119;u[0]=-0.405845151377397;}
213     if (num==2) {w=0.381830050505119;u[0]=0.405845151377397;}
214     if (num==3) {w=0.279705391489277;u[0]=-0.741531185599394;}
215     if (num==4) {w=0.279705391489277;u[0]=0.741531185599394;}
216     if (num==5) {w=0.129484966168870;u[0]=-0.949107912342759;}
217     if (num==6) {w=0.129484966168870;u[0]=0.949107912342759;}
218     return;
219     }
220     }
221    
222    
223 francois 638 int FEM_SEGMENT2::get_nb_fonction_interpolation(void)
224 francois 310 {
225     return 2;
226     }
227 francois 638 int FEM_SEGMENT2::get_degremax_fonction_interpolation(void)
228     {
229     return 1;
230     }
231 francois 310 double FEM_SEGMENT2::get_fonction_interpolation(int num,double *uv)
232     {
233     double val;
234     switch (num)
235     {
236     case 1:
237     val=0.5*(1.-uv[0]);
238     break;
239     case 2:
240     val=0.5*(1.+uv[0]);
241     break;
242     }
243     return val;
244     }
245    
246     double FEM_SEGMENT2::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
247     {
248     double val;
249    
250     switch (num)
251     {
252     case 1:
253     switch (num_variable)
254     {
255     case 1:
256     val=-0.5;
257     break;
258     case 2:
259     val=-0.5;
260     break;
261     }
262     break;
263    
264     }
265     return val;
266     }
267    
268     double FEM_SEGMENT2::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
269     {
270     /*li=1;
271     col=1;
272     double *xyz1=tab[0]->get_coord();
273     double *xyz2=tab[1]->get_coord();
274    
275     jac[0]=0.5*unite*(xyz2[0] - xyz1[0]) ;
276    
277    
278    
279     return jac[0];*/
280     }
281    
282     void FEM_SEGMENT2::get_inverse_jacob(double* j,double *uv,double unite)
283     {
284     /*double *xyz1=tab[0]->get_coord();
285     double *xyz2=tab[1]->get_coord();
286    
287     j[0]=1./(0.5*unite*(xyz2[0] - xyz1[0])) ;*/
288     }