ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_triangle3.cpp
Revision: 378
Committed: Tue Nov 27 20:54:58 2012 UTC (12 years, 5 months ago) by francois
File size: 8344 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     // fem_triangle3.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 � 11H22
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25     #include "gestionversion.h"
26     #include "fem_triangle3.h"
27     #include "fem_maillage.h"
28     #include "fem_noeud.h"
29     #include "mg_element_maillage.h"
30    
31    
32 francois 309 FEM_TRIANGLE3::FEM_TRIANGLE3(unsigned long num,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud)
33 francois 283 {
34     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
35 francois 309 tab[0]->get_lien_element2()->ajouter(this);
36     tab[1]->get_lien_element2()->ajouter(this);
37     tab[2]->get_lien_element2()->ajouter(this);
38     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
39 francois 283 }
40    
41 francois 309 FEM_TRIANGLE3::FEM_TRIANGLE3(class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud)
42 francois 283 {
43     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
44 francois 309 tab[0]->get_lien_element2()->ajouter(this);
45     tab[1]->get_lien_element2()->ajouter(this);
46     tab[2]->get_lien_element2()->ajouter(this);
47     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
48 francois 283 }
49 francois 378 FEM_TRIANGLE3::FEM_TRIANGLE3(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo),FEM_TEMPLATE_ELEMENT<3>(tabnoeud)
50     {
51     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
52     tab[0]->get_lien_element2()->ajouter(this);
53     tab[1]->get_lien_element2()->ajouter(this);
54     tab[2]->get_lien_element2()->ajouter(this);
55     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
56     }
57 francois 283
58 francois 378 FEM_TRIANGLE3::FEM_TRIANGLE3(class MG_ELEMENT_TOPOLOGIQUE* topo,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo),FEM_TEMPLATE_ELEMENT<3>(tabnoeud)
59     {
60     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
61     tab[0]->get_lien_element2()->ajouter(this);
62     tab[1]->get_lien_element2()->ajouter(this);
63     tab[2]->get_lien_element2()->ajouter(this);
64     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
65     }
66     FEM_TRIANGLE3::FEM_TRIANGLE3(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,class FEM_NOEUD** tabnoeud):FEM_ELEMENT2(num,topo,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud)
67     {
68     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
69     tab[0]->get_lien_element2()->ajouter(this);
70     tab[1]->get_lien_element2()->ajouter(this);
71     tab[2]->get_lien_element2()->ajouter(this);
72     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
73     }
74    
75     FEM_TRIANGLE3::FEM_TRIANGLE3(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai,FEM_NOEUD** tabnoeud):FEM_ELEMENT2(topo,mai),FEM_TEMPLATE_ELEMENT<3>(tabnoeud)
76     {
77     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
78     tab[0]->get_lien_element2()->ajouter(this);
79     tab[1]->get_lien_element2()->ajouter(this);
80     tab[2]->get_lien_element2()->ajouter(this);
81     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
82     }
83 francois 309 FEM_TRIANGLE3::FEM_TRIANGLE3(FEM_TRIANGLE3& mdd):FEM_ELEMENT2(mdd),FEM_TEMPLATE_ELEMENT<3>(mdd)
84 francois 283 {
85     if (liaison_topologique!=NULL) if (liaison_topologique->get_dimension()==2) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
86 francois 309 tab[0]->get_lien_element2()->ajouter(this);
87     tab[1]->get_lien_element2()->ajouter(this);
88     tab[2]->get_lien_element2()->ajouter(this);
89     get_fem_noeudpetitid()->get_lien_petit_element2()->ajouter(this);
90 francois 283 }
91     FEM_TRIANGLE3::~FEM_TRIANGLE3()
92     {
93     if (liaison_topologique==NULL) return;
94     if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
95 francois 309 tab[0]->get_lien_element2()->supprimer(this);
96     tab[1]->get_lien_element2()->supprimer(this);
97     tab[2]->get_lien_element2()->supprimer(this);
98     get_fem_noeudpetitid()->get_lien_petit_element2()->supprimer(this);
99 francois 283 }
100    
101    
102     FEM_ELEMENT_MAILLAGE* FEM_TRIANGLE3::dupliquer(FEM_MAILLAGE *femmai,long decalage)
103     {
104     FEM_NOEUD* tabnoeud[3];
105     tabnoeud[0]=femmai->get_fem_noeudid(tab[0]->get_id()+decalage);
106     tabnoeud[1]=femmai->get_fem_noeudid(tab[1]->get_id()+decalage);
107     tabnoeud[2]=femmai->get_fem_noeudid(tab[2]->get_id()+decalage);
108     FEM_TRIANGLE3* tri=new FEM_TRIANGLE3(get_id()+decalage,maillage,tabnoeud);
109 francois 309 femmai->ajouter_fem_element2(tri);
110 francois 283 return tri;
111     }
112    
113    
114    
115    
116    
117     int FEM_TRIANGLE3::get_type_entite(void)
118     {
119     return IDFEM_TRIANGLE3;
120     }
121    
122     int FEM_TRIANGLE3::get_dimension(void)
123     {
124     return 2;
125     }
126    
127    
128    
129     int FEM_TRIANGLE3::get_nb_fem_noeud(void)
130     {
131     return FEM_TEMPLATE_ELEMENT<3>::get_nb_fem_noeud();
132     }
133    
134     FEM_NOEUD* FEM_TRIANGLE3::get_fem_noeud(int num)
135     {
136     return FEM_TEMPLATE_ELEMENT<3>::get_fem_noeud(num);
137     }
138    
139     void FEM_TRIANGLE3::change_noeud(int num,FEM_NOEUD* noeud)
140     {
141     FEM_TEMPLATE_ELEMENT<3>::change_noeud(num,noeud);
142     }
143    
144     BOITE_3D& FEM_TRIANGLE3::get_boite_3D(void)
145     {
146     return FEM_TEMPLATE_ELEMENT<3>::get_boite_3D();
147     }
148    
149    
150     void FEM_TRIANGLE3::enregistrer(std::ostream& o)
151     {
152 francois 378 if (maillage!=NULL)
153     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_TRIANGLE3($"<< get_lien_topologie()->get_id() << ",$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl;
154     else o << "%" << get_id() << "=FEM_TRIANGLE3(NULL,$" << maillage->get_id() << ",$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl;
155     else
156     if (get_lien_topologie()!=NULL) o << "%" << get_id() << "=FEM_TRIANGLE3($"<< get_lien_topologie()->get_id() << ",NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl;
157     else o << "%" << get_id() << "=FEM_TRIANGLE3(NULL,NULL,$" << tab[0]->get_id() << ",$" << tab[1]->get_id() << ",$" << tab[2]->get_id()<< ");" << std::endl;
158    
159     }
160 francois 310
161     int FEM_TRIANGLE3::nb_fonction_interpolation(void)
162     {
163     return 3;
164     }
165    
166     double FEM_TRIANGLE3::get_fonction_interpolation(int num,double *uv)
167     {
168     double val;
169     switch (num)
170     {
171     case 1:
172     val=1-uv[0]-uv[1];
173     break;
174     case 2:
175     val=uv[0];
176     break;
177     case 3:
178     val=uv[1];
179     break;
180    
181     }
182     return val;
183     }
184    
185     double FEM_TRIANGLE3::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=-1;
196     break;
197     case 2:
198     val=-1;
199     break;
200     } break;
201     case 2:
202     switch (num_variable)
203     {
204     case 1:
205     val=1;
206     break;
207     case 2:
208     val=0.;
209     break;
210     }break;
211     case 3:
212     switch (num_variable)
213     {
214     case 1:
215     val=0.;
216     break;
217     case 2:
218     val=1.;
219     break;
220     }break;
221    
222     }
223     return val;
224     }
225    
226     double FEM_TRIANGLE3::get_jacobien(double* jac,double *uv,int& li,int& col,double unite)
227     {
228    
229     }
230    
231     void FEM_TRIANGLE3::get_inverse_jacob(double* j,double *uv,double unite)
232     {
233    
234     }