ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_quadrangle4.cpp
Revision: 635
Committed: Fri Jan 16 22:48:47 2015 UTC (10 years, 3 months ago) by francois
File size: 9567 byte(s)
Log Message:
Generalisation de la projection d'une solution sur un maillage avec gestion d'erreur

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     if (liaison_topologique==NULL) return;
113     if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
114     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     int FEM_QUADRANGLE4::nb_fonction_interpolation(void)
182     {
183     return 4;
184     }
185    
186    
187     double FEM_QUADRANGLE4::get_fonction_interpolation(int num,double *uv)
188     {
189     double val;
190     switch (num)
191     {
192     case 1:
193     val=0.25*(1-uv[0])*(1-uv[1]);
194     break;
195     case 2:
196     val=0.25*(1+uv[0])*(1-uv[1]);
197     break;
198     case 3:
199     val=0.25*(1+uv[0])*(1+uv[1]);
200     break;
201     case 4:
202     val=0.25*(1-uv[0])*(1+uv[1]);
203     break;
204     }
205     return val;
206     }
207    
208     double FEM_QUADRANGLE4::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
209     {
210     double val;
211    
212     switch (num)
213     {
214     case 1:
215     switch (num_variable)
216     {
217     case 1:
218     val=0.25*(-1+uv[1]);
219     break;
220     case 2:
221     val=0.25*(-1+uv[0]);
222     break;
223     } break;
224     case 2:
225     switch (num_variable)
226     {
227     case 1:
228     val=0.25*(1-uv[1]);
229     break;
230     case 2:
231     val=0.25*(-1-uv[0]);
232     break;
233     }break;
234     case 3:
235     switch (num_variable)
236     {
237     case 1:
238     val=0.25*(1+uv[1]);
239     break;
240     case 2:
241     val=0.25*(1+uv[0]);
242     break;
243     }break;
244     case 4:
245     switch (num_variable)
246     {
247     case 1:
248     val=0.25*(-1-uv[1]);
249     break;
250     case 2:
251     val=0.25*(1-uv[0]);
252     break;
253     }break;
254    
255     }
256     return val;
257     }
258    
259 francois 635 bool FEM_QUADRANGLE4::valide_parametre_EF(double* uvw)
260     {
261     if (uvw[0]>=-1e-10)
262     if (uvw[1]>=-1e-10)
263     if (uvw[0]<=1.+1e-10)
264     if (uvw[1]<=1.+1e-10)
265     return true;
266     return false;
267     }
268    
269 francois 310 double FEM_QUADRANGLE4::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
270     {
271    
272     }
273    
274     void FEM_QUADRANGLE4::get_inverse_jacob(double* j,double *uv,double unite)
275     {
276    
277     }