ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_segment2.cpp
Revision: 378
Committed: Tue Nov 27 20:54:58 2012 UTC (12 years, 5 months ago) by francois
File size: 6744 byte(s)
Log Message:
ajout de methode de construction pour les fem elements compatible avec le decoupage XFEM. + bug de format de fichier dans les fem elements non visible en dehors du xfem

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