ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_segment2.cpp
Revision: 786
Committed: Wed Mar 9 21:10:49 2016 UTC (9 years, 2 months ago) by francois
File size: 7673 byte(s)
Log Message:
Possibilité d'obtenir la matrice de rigidite de code aster sous form de matrice bande.
Pour cela ajouter -opt dans l'operation -fem à la création du maillage FEM et dans -calculaster utiliser les nouveaux types d'étude rigidite.
Attention pour cela il faut une version de code aster modifiée
De manière automatique elle peut etre optenu en faisant ./instal_aster 12.5mod
Uniquement implantée avec la version 12.5 de code 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 786 void FEM_SEGMENT2::get_voisin_noeud(class FEM_NOEUD* no,TPL_LISTE_ENTITE<FEM_NOEUD*> &voisin)
95     {
96     voisin.vide();
97     if (no==tab[0])
98     {
99     voisin.ajouter(tab[1]);
100     }
101     if (no==tab[1])
102     {
103     voisin.ajouter(tab[0]);
104     }
105     }
106    
107 francois 635 bool FEM_SEGMENT2::valide_parametre_EF(double* uvw)
108     {
109     if (uvw[0]>=-1e-10)
110     if (uvw[0]<=1.+1e-10)
111     return true;
112     return false;
113     }
114 francois 283
115 francois 684 void FEM_SEGMENT2::reinit_boite_3D(void)
116     {
117     FEM_TEMPLATE_ELEMENT<2>::reinit_boite_3D();
118     }
119 francois 283
120     int FEM_SEGMENT2::get_type_entite(void)
121     {
122     return IDFEM_SEGMENT2;
123     }
124    
125     int FEM_SEGMENT2::get_dimension(void)
126     {
127     return 1;
128     }
129    
130    
131    
132     int FEM_SEGMENT2::get_nb_fem_noeud(void)
133     {
134     return FEM_TEMPLATE_ELEMENT<2>::get_nb_fem_noeud();
135     }
136    
137     FEM_NOEUD* FEM_SEGMENT2::get_fem_noeud(int num)
138     {
139     return FEM_TEMPLATE_ELEMENT<2>::get_fem_noeud(num);
140     }
141    
142     void FEM_SEGMENT2::change_noeud(int num,FEM_NOEUD* noeud)
143     {
144     FEM_TEMPLATE_ELEMENT<2>::change_noeud(num,noeud);
145     }
146    
147     BOITE_3D& FEM_SEGMENT2::get_boite_3D(void)
148     {
149     return FEM_TEMPLATE_ELEMENT<2>::get_boite_3D();
150     }
151    
152    
153 francois 763 void FEM_SEGMENT2::enregistrer(std::ostream& o,double version)
154 francois 283 {
155 francois 378 if (maillage!=NULL)
156     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;
157 francois 283 else o << "%" << get_id() << "=FEM_SEGMENT2(NULL,$" << maillage->get_id() <<",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl;
158 francois 378 if (maillage==NULL)
159     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;
160     else o << "%" << get_id() << "=FEM_SEGMENT2(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl;
161 francois 283 }
162 francois 310
163    
164 francois 637 int FEM_SEGMENT2::get_nb_pt_gauss(int degre)
165     {
166 francois 754 return OT_POINTS_GAUSS::get_nb_point_seg(degre);
167 francois 637 }
168    
169     void FEM_SEGMENT2::get_pt_gauss(int degre,int num,double &w,double *u)
170     {
171 francois 754 return OT_POINTS_GAUSS::get_pt_gauss_seg(degre,num,w,u);
172 francois 637 }
173    
174 francois 757 int FEM_SEGMENT2::get_degre_gauss(int num)
175     {
176     return OT_POINTS_GAUSS::get_degre_gauss_seg(num);
177     }
178    
179 francois 638 int FEM_SEGMENT2::get_nb_fonction_interpolation(void)
180 francois 310 {
181     return 2;
182     }
183 francois 638 int FEM_SEGMENT2::get_degremax_fonction_interpolation(void)
184     {
185     return 1;
186     }
187 francois 310 double FEM_SEGMENT2::get_fonction_interpolation(int num,double *uv)
188     {
189     double val;
190     switch (num)
191     {
192     case 1:
193     val=0.5*(1.-uv[0]);
194     break;
195     case 2:
196     val=0.5*(1.+uv[0]);
197     break;
198     }
199     return val;
200     }
201    
202     double FEM_SEGMENT2::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
203     {
204     double val;
205    
206     switch (num)
207     {
208     case 1:
209     switch (num_variable)
210     {
211     case 1:
212     val=-0.5;
213     break;
214     case 2:
215     val=-0.5;
216     break;
217     }
218     break;
219    
220     }
221     return val;
222     }
223    
224     double FEM_SEGMENT2::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
225     {
226     /*li=1;
227     col=1;
228     double *xyz1=tab[0]->get_coord();
229     double *xyz2=tab[1]->get_coord();
230    
231     jac[0]=0.5*unite*(xyz2[0] - xyz1[0]) ;
232    
233    
234    
235     return jac[0];*/
236     }
237    
238     void FEM_SEGMENT2::get_inverse_jacob(double* j,double *uv,double unite)
239     {
240     /*double *xyz1=tab[0]->get_coord();
241     double *xyz2=tab[1]->get_coord();
242    
243     j[0]=1./(0.5*unite*(xyz2[0] - xyz1[0])) ;*/
244     }