ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_segment3.cpp
Revision: 663
Committed: Fri Apr 10 20:13:11 2015 UTC (10 years, 1 month ago) by francois
File size: 10488 byte(s)
Log Message:
resolution de bug de desallocation + resolution du mailleur bloc avec optimisateur de coin active

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     // 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 francois 663 if (liaison_topologique!=NULL)
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 637
175    
176    
177     int FEM_SEGMENT3::get_nb_pt_gauss(int degre)
178     {
179     if (degre<2) return 1;
180     if (degre<4) return 2;
181     if (degre<6) return 3;
182     if (degre<8) return 4;
183     if (degre<10) return 5;
184     if (degre<12) return 6;
185     if (degre<14) return 7;
186     return 0;
187     }
188    
189     void FEM_SEGMENT3::get_pt_gauss(int degre,int num,double &w,double *u)
190     {
191     if (degre<2)
192     {
193     if (num==0) {w=2;u[0]=0;}
194     return;
195     }
196     if (degre<4)
197     {
198     if (num==0) {w=1;u[0]=-0.577350269189626;}
199     if (num==1) {w=1;u[0]=0.577350269189626;}
200     return;
201     }
202     if (degre<6)
203     {
204     if (num==0) {w=0.888888888888889;u[0]=0.;}
205     if (num==1) {w=0.555555555555556;u[0]=-0.774596669241483;}
206     if (num==2) {w=0.555555555555556;u[0]=0.774596669241483;}
207     return;
208     }
209     if (degre<8)
210     {
211     if (num==0) {w=0.652145154862546;u[0]=-0.339981043584856;}
212     if (num==1) {w=0.652145154862546;u[0]=0.339981043584856;}
213     if (num==2) {w=0.347854845137454;u[0]=-0.861136311594053;}
214     if (num==3) {w=0.347854845137454;u[0]=0.861136311594053;}
215     return;
216     }
217     if (degre<10)
218     {
219     if (num==0) {w=0.568888888888889;u[0]=0.;}
220     if (num==1) {w=0.478628670499366;u[0]=-0.538469310105683;}
221     if (num==2) {w=0.478628670499366;u[0]=0.538469310105683;}
222     if (num==3) {w=0.236926885056189;u[0]=-0.906179845938664;}
223     if (num==4) {w=0.236926885056189;u[0]=0.906179845938664;}
224     return;
225     }
226     if (degre<12)
227     {
228     if (num==0) {w=0.467913934572691;u[0]=-0.238619186083197;}
229     if (num==1) {w=0.467913934572691;u[0]=0.238619186083197;}
230     if (num==2) {w=0.360761573048139;u[0]=-0.661209386466265;}
231     if (num==3) {w=0.360761573048139;u[0]=0.661209386466265;}
232     if (num==4) {w=0.171324492379170;u[0]=-0.932469514203152;}
233     if (num==5) {w=0.171324492379170;u[0]=0.932469514203152;}
234     return;
235     }
236     if (degre<14)
237     {
238     if (num==0) {w=0.417959183673469;u[0]=0;}
239     if (num==1) {w=0.381830050505119;u[0]=-0.405845151377397;}
240     if (num==2) {w=0.381830050505119;u[0]=0.405845151377397;}
241     if (num==3) {w=0.279705391489277;u[0]=-0.741531185599394;}
242     if (num==4) {w=0.279705391489277;u[0]=0.741531185599394;}
243     if (num==5) {w=0.129484966168870;u[0]=-0.949107912342759;}
244     if (num==6) {w=0.129484966168870;u[0]=0.949107912342759;}
245     return;
246     }
247     }
248    
249 francois 638 int FEM_SEGMENT3::get_nb_fonction_interpolation(void)
250 francois 310 {
251     return 3;
252     }
253    
254 francois 638 int FEM_SEGMENT3::get_degremax_fonction_interpolation(void)
255     {
256     return 2;
257     }
258 francois 310 double FEM_SEGMENT3::get_fonction_interpolation(int num,double *uv)
259     {
260     double val;
261     switch (num)
262     {
263     case 1:
264     val=-0.5*uv[0]*(1.-uv[0]);
265     break;
266     case 2:
267     val=1.-uv[0]*uv[0];
268     break;
269     case 3:
270     val=0.5*uv[0]*(1.+uv[0]);
271     break;
272     }
273     return val;
274     }
275    
276     double FEM_SEGMENT3::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
277     {
278     double val;
279    
280     switch (num)
281     {
282     case 1:
283     switch (num_variable)
284     {
285     case 1:
286     val=-0.5+uv[0];
287     break;
288     case 2:
289     val=-2.*uv[0];
290     break;
291     case 3:
292     val=0.5+uv[0];
293     break;
294     }
295     break;
296    
297     }
298     return val;
299     }
300    
301     double FEM_SEGMENT3::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
302     {
303    
304     }
305    
306     void FEM_SEGMENT3::get_inverse_jacob(double* j,double *uv,double unite)
307     {
308    
309     }