ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_segment2.cpp
Revision: 763
Committed: Wed Dec 2 19:55:53 2015 UTC (9 years, 5 months ago) by francois
File size: 7435 byte(s)
Log Message:
Le fichier MAGiC est maintenant versionné. LA version actuelle est 2.0. L'ancienne version est 1.0.
Tout est transparent pour l'utilisateur. Les vieilles versions sont lisibles mais les nouveaux enregistrements sont dans la version la plus récente.
Changement des conditions aux limites : ajout d'un parametre pour dire si la condition numerique est une valeur ou une formule ou un lien vers une autre entité magic.
Les parametres pour saisir sont maintenant -ccf -ccfi -ccff -ccft -ccfit -ccfft

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 francois 763 void FEM_SEGMENT2::enregistrer(std::ostream& o,double version)
141 francois 283 {
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 francois 757 int FEM_SEGMENT2::get_degre_gauss(int num)
162     {
163     return OT_POINTS_GAUSS::get_degre_gauss_seg(num);
164     }
165    
166 francois 638 int FEM_SEGMENT2::get_nb_fonction_interpolation(void)
167 francois 310 {
168     return 2;
169     }
170 francois 638 int FEM_SEGMENT2::get_degremax_fonction_interpolation(void)
171     {
172     return 1;
173     }
174 francois 310 double FEM_SEGMENT2::get_fonction_interpolation(int num,double *uv)
175     {
176     double val;
177     switch (num)
178     {
179     case 1:
180     val=0.5*(1.-uv[0]);
181     break;
182     case 2:
183     val=0.5*(1.+uv[0]);
184     break;
185     }
186     return val;
187     }
188    
189     double FEM_SEGMENT2::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
190     {
191     double val;
192    
193     switch (num)
194     {
195     case 1:
196     switch (num_variable)
197     {
198     case 1:
199     val=-0.5;
200     break;
201     case 2:
202     val=-0.5;
203     break;
204     }
205     break;
206    
207     }
208     return val;
209     }
210    
211     double FEM_SEGMENT2::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
212     {
213     /*li=1;
214     col=1;
215     double *xyz1=tab[0]->get_coord();
216     double *xyz2=tab[1]->get_coord();
217    
218     jac[0]=0.5*unite*(xyz2[0] - xyz1[0]) ;
219    
220    
221    
222     return jac[0];*/
223     }
224    
225     void FEM_SEGMENT2::get_inverse_jacob(double* j,double *uv,double unite)
226     {
227     /*double *xyz1=tab[0]->get_coord();
228     double *xyz2=tab[1]->get_coord();
229    
230     j[0]=1./(0.5*unite*(xyz2[0] - xyz1[0])) ;*/
231     }