ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_segment2.cpp
Revision: 754
Committed: Thu Oct 29 21:49:15 2015 UTC (9 years, 6 months ago) by francois
File size: 7319 byte(s)
Log Message:
Centralisation et unification de la définition des points de gauss des elements finis et arrangement dans le meme ordre que Aster

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