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