ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_segment2.cpp
Revision: 310
Committed: Thu Jan 26 21:14:45 2012 UTC (13 years, 3 months ago) by francois
File size: 5374 byte(s)
Log Message:
Ajout des elements quadrangle et hexaedre dans les maillages FEM
Changement de la version des fichier de visu sous GMSH. Les .pos ont disparus et tout est intégré dans les .msh

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    
31 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)
32 francois 283 {
33     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
34 francois 309 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 }
38    
39 francois 309 FEM_SEGMENT2::FEM_SEGMENT2(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT1(mai),FEM_TEMPLATE_ELEMENT<2>(tabnoeud)
40 francois 283 {
41     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
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 283 }
46    
47 francois 309 FEM_SEGMENT2::FEM_SEGMENT2(FEM_SEGMENT2& mdd):FEM_ELEMENT1(mdd),FEM_TEMPLATE_ELEMENT<2>(mdd)
48 francois 283 {
49     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==1) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
50 francois 309 tab[0]->get_lien_element1()->ajouter(this);
51     tab[1]->get_lien_element1()->ajouter(this);
52     get_fem_noeudpetitid()->get_lien_petit_element1()->ajouter(this);
53 francois 283 }
54    
55     FEM_SEGMENT2::~FEM_SEGMENT2()
56     {
57     if (liaison_topologique==NULL) return;
58     if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
59 francois 309 tab[0]->get_lien_element1()->supprimer(this);
60     tab[1]->get_lien_element1()->supprimer(this);
61     get_fem_noeudpetitid()->get_lien_petit_element1()->supprimer(this);
62 francois 283 }
63    
64     FEM_ELEMENT_MAILLAGE* FEM_SEGMENT2::dupliquer(FEM_MAILLAGE *femmai,long decalage)
65     {
66     FEM_NOEUD* tabnoeud[2];
67     tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage);
68     tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage);
69     FEM_SEGMENT2* seg=new FEM_SEGMENT2(get_id()+decalage,maillage,tabnoeud);
70 francois 309 femmai->ajouter_fem_element1(seg);
71 francois 283 return seg;
72     }
73    
74    
75    
76    
77     int FEM_SEGMENT2::get_type_entite(void)
78     {
79     return IDFEM_SEGMENT2;
80     }
81    
82     int FEM_SEGMENT2::get_dimension(void)
83     {
84     return 1;
85     }
86    
87    
88    
89     int FEM_SEGMENT2::get_nb_fem_noeud(void)
90     {
91     return FEM_TEMPLATE_ELEMENT<2>::get_nb_fem_noeud();
92     }
93    
94     FEM_NOEUD* FEM_SEGMENT2::get_fem_noeud(int num)
95     {
96     return FEM_TEMPLATE_ELEMENT<2>::get_fem_noeud(num);
97     }
98    
99     void FEM_SEGMENT2::change_noeud(int num,FEM_NOEUD* noeud)
100     {
101     FEM_TEMPLATE_ELEMENT<2>::change_noeud(num,noeud);
102     }
103    
104     BOITE_3D& FEM_SEGMENT2::get_boite_3D(void)
105     {
106     return FEM_TEMPLATE_ELEMENT<2>::get_boite_3D();
107     }
108    
109    
110     void FEM_SEGMENT2::enregistrer(std::ostream& o)
111     {
112     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;
113     else o << "%" << get_id() << "=FEM_SEGMENT2(NULL,$" << maillage->get_id() <<",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ");" << std::endl;
114     }
115 francois 310
116    
117     int FEM_SEGMENT2::nb_fonction_interpolation(void)
118     {
119     return 2;
120     }
121    
122    
123     double FEM_SEGMENT2::get_fonction_interpolation(int num,double *uv)
124     {
125     double val;
126     switch (num)
127     {
128     case 1:
129     val=0.5*(1.-uv[0]);
130     break;
131     case 2:
132     val=0.5*(1.+uv[0]);
133     break;
134     }
135     return val;
136     }
137    
138     double FEM_SEGMENT2::get_fonction_derive_interpolation(int num,int num_variable,double *uv)
139     {
140     double val;
141    
142     switch (num)
143     {
144     case 1:
145     switch (num_variable)
146     {
147     case 1:
148     val=-0.5;
149     break;
150     case 2:
151     val=-0.5;
152     break;
153     }
154     break;
155    
156     }
157     return val;
158     }
159    
160     double FEM_SEGMENT2::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
161     {
162     /*li=1;
163     col=1;
164     double *xyz1=tab[0]->get_coord();
165     double *xyz2=tab[1]->get_coord();
166    
167     jac[0]=0.5*unite*(xyz2[0] - xyz1[0]) ;
168    
169    
170    
171     return jac[0];*/
172     }
173    
174     void FEM_SEGMENT2::get_inverse_jacob(double* j,double *uv,double unite)
175     {
176     /*double *xyz1=tab[0]->get_coord();
177     double *xyz2=tab[1]->get_coord();
178    
179     j[0]=1./(0.5*unite*(xyz2[0] - xyz1[0])) ;*/
180     }