ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_quadrangle4.cpp
Revision: 684
Committed: Tue Jun 30 15:21:22 2015 UTC (9 years, 10 months ago) by francois
File size: 11129 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 310 //------------------------------------------------------------
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_triangle3.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_quadrangle4.h"
27     #include "fem_maillage.h"
28     #include "fem_noeud.h"
29     #include "mg_element_maillage.h"
30    
31    
32     FEM_QUADRANGLE4::FEM_QUADRANGLE4(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,mai),FEM_TEMPLATE_ELEMENT<4>(tabnoeud)
33     {
34     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
35     tab[0]->get_lien_element2()->ajouter(this);
36     tab[1]->get_lien_element2()->ajouter(this);
37     tab[2]->get_lien_element2()->ajouter(this);
38     tab[3]->get_lien_element2()->ajouter(this);
39     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
40     }
41    
42     FEM_QUADRANGLE4::FEM_QUADRANGLE4(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(mai),FEM_TEMPLATE_ELEMENT<4>(tabnoeud)
43     {
44     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
45     tab[0]->get_lien_element2()->ajouter(this);
46     tab[1]->get_lien_element2()->ajouter(this);
47     tab[2]->get_lien_element2()->ajouter(this);
48     tab[3]->get_lien_element2()->ajouter(this);
49     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
50     }
51    
52 francois 378 FEM_QUADRANGLE4::FEM_QUADRANGLE4(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo),FEM_TEMPLATE_ELEMENT<4>(tabnoeud)
53     {
54     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
55     tab[0]->get_lien_element2()->ajouter(this);
56     tab[1]->get_lien_element2()->ajouter(this);
57     tab[2]->get_lien_element2()->ajouter(this);
58     tab[3]->get_lien_element2()->ajouter(this);
59     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
60     }
61    
62     FEM_QUADRANGLE4::FEM_QUADRANGLE4(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo),FEM_TEMPLATE_ELEMENT<4>(tabnoeud)
63     {
64     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
65     tab[0]->get_lien_element2()->ajouter(this);
66     tab[1]->get_lien_element2()->ajouter(this);
67     tab[2]->get_lien_element2()->ajouter(this);
68     tab[3]->get_lien_element2()->ajouter(this);
69     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
70     }
71     FEM_QUADRANGLE4::FEM_QUADRANGLE4(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo,mai),FEM_TEMPLATE_ELEMENT<4>(tabnoeud)
72     {
73     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
74     tab[0]->get_lien_element2()->ajouter(this);
75     tab[1]->get_lien_element2()->ajouter(this);
76     tab[2]->get_lien_element2()->ajouter(this);
77     tab[3]->get_lien_element2()->ajouter(this);
78     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
79     }
80    
81     FEM_QUADRANGLE4::FEM_QUADRANGLE4(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo,mai),FEM_TEMPLATE_ELEMENT<4>(tabnoeud)
82     {
83     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
84     tab[0]->get_lien_element2()->ajouter(this);
85     tab[1]->get_lien_element2()->ajouter(this);
86     tab[2]->get_lien_element2()->ajouter(this);
87     tab[3]->get_lien_element2()->ajouter(this);
88     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
89     }
90    
91    
92    
93    
94    
95    
96    
97    
98    
99    
100    
101 francois 310 FEM_QUADRANGLE4::FEM_QUADRANGLE4(FEM_QUADRANGLE4& mdd):FEM_ELEMENT2(mdd),FEM_TEMPLATE_ELEMENT<4>(mdd)
102     {
103     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
104     tab[0]->get_lien_element2()->ajouter(this);
105     tab[1]->get_lien_element2()->ajouter(this);
106     tab[2]->get_lien_element2()->ajouter(this);
107     tab[3]->get_lien_element2()->ajouter(this);
108     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
109     }
110     FEM_QUADRANGLE4::~FEM_QUADRANGLE4()
111     {
112 francois 663 if (liaison_topologique!=NULL)
113     if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
114 francois 310 tab[0]->get_lien_element2()->supprimer(this);
115     tab[1]->get_lien_element2()->supprimer(this);
116     tab[2]->get_lien_element2()->supprimer(this);
117     tab[3]->get_lien_element2()->supprimer(this);
118     get_fem_noeudpetitid()->get_lien_petit_element2()->supprimer(this);
119     }
120    
121    
122     FEM_ELEMENT_MAILLAGE* FEM_QUADRANGLE4::dupliquer(FEM_MAILLAGE *femmai,long decalage)
123     {
124     FEM_NOEUD* tabnoeud[4];
125     tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage);
126     tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage);
127     tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage);
128     tabnoeud[3]=femmai->get_fem_noeudid(tab[3]->get_id()+decalage);
129     FEM_QUADRANGLE4* quad=new FEM_QUADRANGLE4(get_id()+decalage,maillage,tabnoeud);
130     femmai->ajouter_fem_element2(quad);
131     return quad;
132     }
133    
134    
135    
136    
137    
138     int FEM_QUADRANGLE4::get_type_entite(void)
139     {
140     return IDFEM_QUADRANGLE4;
141     }
142    
143     int FEM_QUADRANGLE4::get_dimension(void)
144     {
145     return 2;
146     }
147    
148    
149    
150     int FEM_QUADRANGLE4::get_nb_fem_noeud(void)
151     {
152     return FEM_TEMPLATE_ELEMENT<4>::get_nb_fem_noeud();
153     }
154    
155     FEM_NOEUD* FEM_QUADRANGLE4::get_fem_noeud(int num)
156     {
157     return FEM_TEMPLATE_ELEMENT<4>::get_fem_noeud(num);
158     }
159    
160     void FEM_QUADRANGLE4::change_noeud(int num,FEM_NOEUD* noeud)
161     {
162     FEM_TEMPLATE_ELEMENT<4>::change_noeud(num,noeud);
163     }
164    
165     BOITE_3D& FEM_QUADRANGLE4::get_boite_3D(void)
166     {
167     return FEM_TEMPLATE_ELEMENT<4>::get_boite_3D();
168     }
169    
170    
171     void FEM_QUADRANGLE4::enregistrer(std::ostream& o)
172     {
173 francois 378 if (maillage!=NULL)
174     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_QUADRANGLE4($"<< get_lien_topologie()->get_id() << ",$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ");" << std::endl;
175     else o << "%" << get_id() << "=FEM_QUADRANGLE4(NULL,$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ");" << std::endl;
176     else
177     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_QUADRANGLE4($"<< get_lien_topologie()->get_id() << ",NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ");" << std::endl;
178     else o << "%" << get_id() << "=FEM_QUADRANGLE4(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ",$" << tab[3]->get_id()<< ");" << std::endl;
179    
180 francois 310 }
181 francois 637
182    
183     int FEM_QUADRANGLE4::get_nb_pt_gauss(int degre)
184     {
185     if (degre<3) return 3;
186     if (degre<4) return 4;
187     if (degre<6) return 7;
188     return 0;
189     }
190    
191     void FEM_QUADRANGLE4::get_pt_gauss(int degre,int num,double &w,double *uv)
192     {
193     if (degre<3)
194     {
195     if (num==0) {w=1.333333333333333;uv[0]=0.816496580927726;uv[1]=0.;}
196     if (num==1) {w=1.333333333333333;uv[0]=-0.408248290463863;uv[1]=-0.707106781186548;}
197     if (num==2) {w=1.333333333333333;uv[0]=-0.408248290463863;uv[1]=0.707106781186548;}
198     return;
199     }
200     if (degre<4)
201     {
202     if (num==0) {w=1.;uv[0]=0.816496580927726;uv[1]=0.;}
203     if (num==1) {w=1.;uv[0]=-0.816496580927726;uv[1]=0.;}
204     if (num==2) {w=1.;uv[0]=0.;uv[1]=0.816496580927726;}
205     if (num==3) {w=1.;uv[0]=0.;uv[1]=-0.816496580927726;}
206     return;
207     }
208     if (degre<6)
209     {
210     if (num==0) {w=1.142857142857140;uv[0]=0.;uv[1]=0.;}
211     if (num==1) {w=0.317460317460317;uv[0]=0.;uv[1]=0.966091783079296;}
212     if (num==2) {w=0.317460317460317;uv[0]=0.;uv[1]=-0.966091783079296;}
213     if (num==3) {w=0.555555555555556;uv[0]=0.774596669241483;uv[1]=-0.577350269189626;}
214     if (num==4) {w=0.555555555555556;uv[0]=-0.774596669241483;uv[1]=-0.577350269189626;}
215     if (num==5) {w=0.555555555555556;uv[0]=-0.774596669241483;uv[1]=0.577350269189626;}
216     if (num==6) {w=0.555555555555556;uv[0]=0.774596669241483;uv[1]=0.577350269189626;}
217     return;
218     }
219     }
220 francois 638 int FEM_QUADRANGLE4::get_nb_fonction_interpolation(void)
221 francois 310 {
222     return 4;
223     }
224 francois 638 int FEM_QUADRANGLE4::get_degremax_fonction_interpolation(void)
225     {
226     return 2;
227     }
228 francois 310
229     double FEM_QUADRANGLE4::get_fonction_interpolation(int num,double *uv)
230     {
231     double val;
232     switch (num)
233     {
234     case 1:
235     val=0.25*(1-uv[0])*(1-uv[1]);
236     break;
237     case 2:
238     val=0.25*(1+uv[0])*(1-uv[1]);
239     break;
240     case 3:
241     val=0.25*(1+uv[0])*(1+uv[1]);
242     break;
243     case 4:
244     val=0.25*(1-uv[0])*(1+uv[1]);
245     break;
246     }
247     return val;
248     }
249    
250     double FEM_QUADRANGLE4::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
251     {
252     double val;
253    
254     switch (num)
255     {
256     case 1:
257     switch (num_variable)
258     {
259     case 1:
260     val=0.25*(-1+uv[1]);
261     break;
262     case 2:
263     val=0.25*(-1+uv[0]);
264     break;
265     } break;
266     case 2:
267     switch (num_variable)
268     {
269     case 1:
270     val=0.25*(1-uv[1]);
271     break;
272     case 2:
273     val=0.25*(-1-uv[0]);
274     break;
275     }break;
276     case 3:
277     switch (num_variable)
278     {
279     case 1:
280     val=0.25*(1+uv[1]);
281     break;
282     case 2:
283     val=0.25*(1+uv[0]);
284     break;
285     }break;
286     case 4:
287     switch (num_variable)
288     {
289     case 1:
290     val=0.25*(-1-uv[1]);
291     break;
292     case 2:
293     val=0.25*(1-uv[0]);
294     break;
295     }break;
296    
297     }
298     return val;
299     }
300    
301 francois 635 bool FEM_QUADRANGLE4::valide_parametre_EF(double* uvw)
302     {
303 francois 674 if (uvw[0]>=-1.-1e-10)
304     if (uvw[1]>=-1.-1e-10)
305 francois 635 if (uvw[0]<=1.+1e-10)
306     if (uvw[1]<=1.+1e-10)
307     return true;
308     return false;
309     }
310    
311 francois 684
312     void FEM_QUADRANGLE4::reinit_boite_3D(void)
313     {
314     FEM_TEMPLATE_ELEMENT<4>::reinit_boite_3D();
315     }
316    
317 francois 310 double FEM_QUADRANGLE4::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
318     {
319    
320     }
321    
322     void FEM_QUADRANGLE4::get_inverse_jacob(double* j,double *uv,double unite)
323     {
324    
325     }