ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_noeud.cpp
Revision: 414
Committed: Mon Aug 19 16:27:06 2013 UTC (12 years ago) by francois
File size: 10190 byte(s)
Log Message:
ajout d'une methode de recuperation des equivalences entre les numero FEM et les numeros gmsh.
Ajout d'une méthode pour verifier qu'une entité fait partie de la toplogogie sous jacente d'une autre.

File Contents

# Content
1 //------------------------------------------------------------
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_noeud.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_noeud.h"
27 #include "fem_maillage.h"
28 #include "mg_noeud.h"
29
30
31
32
33
34 FEM_NOEUD::FEM_NOEUD(MG_NOEUD* noeud):FEM_ELEMENT_MAILLAGE(noeud),numero(-1),numero_opt(-1),activedeplacement1(0),activedeplacement2(0),activedeplacement3(0),activereaction1(0),activereaction2(0),activereaction3(0)
35 {
36 xyz[0]=noeud->get_x();
37 xyz[1]=noeud->get_y();
38 xyz[2]=noeud->get_z();
39 dxyz[0]=0.;
40 dxyz[1]=0.;
41 dxyz[2]=0.;
42 rxyz[0]=0.;
43 rxyz[1]=0.;
44 rxyz[2]=0.;
45 if (liaison_topologique==NULL) return;
46 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
47 }
48
49 FEM_NOEUD::FEM_NOEUD(unsigned long num,MG_NOEUD* noeud):FEM_ELEMENT_MAILLAGE(num,noeud),numero(-1),numero_opt(-1),activedeplacement1(0),activedeplacement2(0),activedeplacement3(0),activereaction1(0),activereaction2(0),activereaction3(0)
50 {
51 xyz[0]=noeud->get_x();
52 xyz[1]=noeud->get_y();
53 xyz[2]=noeud->get_z();
54 dxyz[0]=0.;
55 dxyz[1]=0.;
56 dxyz[2]=0.;
57 rxyz[0]=0.;
58 rxyz[1]=0.;
59 rxyz[2]=0.;
60 if (liaison_topologique==NULL) return;
61 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
62 }
63
64 FEM_NOEUD::FEM_NOEUD(MG_ELEMENT_MAILLAGE* mai,double x,double y,double z):FEM_ELEMENT_MAILLAGE(mai),numero(-1),numero_opt(-1),activedeplacement1(0),activedeplacement2(0),activedeplacement3(0),activereaction1(0),activereaction2(0),activereaction3(0)
65 {
66 xyz[0]=x;
67 xyz[1]=y;
68 xyz[2]=z;
69 dxyz[0]=0.;
70 dxyz[1]=0.;
71 dxyz[2]=0.;
72 rxyz[0]=0.;
73 rxyz[1]=0.;
74 rxyz[2]=0.;
75 if (liaison_topologique==NULL) return;
76 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
77 }
78
79 FEM_NOEUD* FEM_NOEUD::dupliquer(FEM_MAILLAGE *femmai,long decalage)
80 {
81 FEM_NOEUD* noeud=new FEM_NOEUD(this->get_id()+decalage,liaison_topologique,xyz[0],xyz[1],xyz[2]);
82 femmai->ajouter_fem_noeud(noeud);
83 return noeud;
84 }
85
86
87 FEM_NOEUD::FEM_NOEUD(unsigned long num,MG_ELEMENT_TOPOLOGIQUE* topo,double x,double y,double z):FEM_ELEMENT_MAILLAGE(num,topo),numero(-1),numero_opt(-1),activedeplacement1(0),activedeplacement2(0),activedeplacement3(0),activereaction1(0),activereaction2(0),activereaction3(0)
88 {
89 xyz[0]=x;
90 xyz[1]=y;
91 xyz[2]=z;
92 dxyz[0]=0.;
93 dxyz[1]=0.;
94 dxyz[2]=0.;
95 rxyz[0]=0.;
96 rxyz[1]=0.;
97 rxyz[2]=0.;
98 if (liaison_topologique==NULL) return;
99 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
100 }
101
102 FEM_NOEUD::FEM_NOEUD(MG_ELEMENT_TOPOLOGIQUE* topo,double x,double y,double z):FEM_ELEMENT_MAILLAGE(topo),numero(-1),numero_opt(-1),activedeplacement1(0),activedeplacement2(0),activedeplacement3(0),activereaction1(0),activereaction2(0),activereaction3(0)
103 {
104 xyz[0]=x;
105 xyz[1]=y;
106 xyz[2]=z;
107 dxyz[0]=0.;
108 dxyz[1]=0.;
109 dxyz[2]=0.;
110 rxyz[0]=0.;
111 rxyz[1]=0.;
112 rxyz[2]=0.;
113 if (liaison_topologique==NULL) return;
114 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
115 }
116
117 FEM_NOEUD::FEM_NOEUD(unsigned long num,MG_ELEMENT_MAILLAGE* mai,double x,double y,double z):FEM_ELEMENT_MAILLAGE(num,mai),numero(-1),numero_opt(-1),activedeplacement1(0),activedeplacement2(0),activedeplacement3(0),activereaction1(0),activereaction2(0),activereaction3(0)
118 {
119 xyz[0]=x;
120 xyz[1]=y;
121 xyz[2]=z;
122 dxyz[0]=0.;
123 dxyz[1]=0.;
124 dxyz[2]=0.;
125 rxyz[0]=0.;
126 rxyz[1]=0.;
127 rxyz[2]=0.;
128 if (liaison_topologique==NULL) return;
129 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
130 }
131
132
133
134 FEM_NOEUD::FEM_NOEUD(FEM_NOEUD& mdd):FEM_ELEMENT_MAILLAGE(mdd),numero(-1),numero_opt(-1),activedeplacement1(mdd.activedeplacement1),activedeplacement2(mdd.activedeplacement2),activedeplacement3(mdd.activedeplacement3),activereaction1(mdd.activereaction1),activereaction2(mdd.activereaction2),activereaction3(mdd.activereaction3)
135 {
136 xyz[0]=mdd.xyz[0];
137 xyz[1]=mdd.xyz[1];
138 xyz[2]=mdd.xyz[2];
139 dxyz[0]=mdd.dxyz[0];
140 dxyz[1]=mdd.dxyz[1];
141 dxyz[2]=mdd.dxyz[2];
142 rxyz[0]=mdd.rxyz[0];
143 rxyz[1]=mdd.rxyz[1];
144 rxyz[2]=mdd.rxyz[2];
145 if (liaison_topologique==NULL) return;
146 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
147 }
148
149 FEM_NOEUD::~FEM_NOEUD()
150 {
151 if (liaison_topologique==NULL) return;
152 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->supprimer(this);
153 }
154
155 void FEM_NOEUD::change_topologie_null(MG_ELEMENT_TOPOLOGIQUE* ele)
156 {
157 if (liaison_topologique!=NULL) return;
158 liaison_topologique=ele;
159 if (liaison_topologique==NULL) return;
160 if (liaison_topologique->get_dimension()==0) liaison_topologique->get_lien_fem_maillage()->ajouter(this);
161 }
162
163 int FEM_NOEUD::get_type_entite(void)
164 {
165 return IDFEM_NOEUD;
166 }
167
168 double FEM_NOEUD::get_x(double coef)
169 {
170 return xyz[0]+coef*dxyz[0];
171 }
172
173 double FEM_NOEUD::get_y(double coef)
174 {
175 return xyz[1]+coef*dxyz[1];
176 }
177
178 double FEM_NOEUD::get_z(double coef)
179 {
180 return xyz[2]+coef*dxyz[2];
181 }
182
183 double FEM_NOEUD::get_dx(double coef)
184 {
185 return dxyz[0]*coef;
186 }
187
188 double FEM_NOEUD::get_dy(double coef)
189 {
190 return dxyz[1]*coef;
191 }
192
193 double FEM_NOEUD::get_dz(double coef)
194 {
195 return dxyz[2]*coef;
196 }
197
198
199
200 double FEM_NOEUD::get_rx(void)
201 {
202 return rxyz[0];
203 }
204 double FEM_NOEUD::get_ry(void)
205 {
206 return rxyz[1];
207 }
208
209 double FEM_NOEUD::get_rz(void)
210 {
211 return rxyz[2];
212 }
213
214
215
216
217 double* FEM_NOEUD::get_coord(void)
218 {
219 return xyz;
220 }
221
222
223 void FEM_NOEUD::change_x(double xx)
224 {
225 xyz[0]=xx;
226 }
227
228 void FEM_NOEUD::change_y(double yy)
229 {
230 xyz[1]=yy;
231 }
232
233 void FEM_NOEUD::change_z(double zz)
234 {
235 xyz[2]=zz;
236 }
237 void FEM_NOEUD::change_rx(double xx)
238 {
239 rxyz[0]=xx;
240 activereaction1=1;
241 }
242
243 void FEM_NOEUD::change_ry(double yy)
244 {
245 rxyz[1]=yy;
246 activereaction2=1;
247 }
248
249 void FEM_NOEUD::change_rz(double zz)
250 {
251 rxyz[2]=zz;
252 activereaction3=1;
253
254 }
255
256 void FEM_NOEUD::change_dx(double xx)
257 {
258 dxyz[0]=xx;
259 activedeplacement1=1;
260 }
261
262 void FEM_NOEUD::change_dy(double yy)
263 {
264 dxyz[1]=yy;
265 activedeplacement2=1;
266 }
267
268 void FEM_NOEUD::change_dz(double zz)
269 {
270 dxyz[2]=zz;
271 activedeplacement3=1;
272 }
273
274 void FEM_NOEUD::change_coord(double *coo)
275 {
276 xyz[0]=coo[0];
277 xyz[1]=coo[1];
278 xyz[2]=coo[2];
279 }
280
281 int FEM_NOEUD::get_numero(void)
282 {
283 return numero;
284 }
285
286 void FEM_NOEUD::change_numero(int num)
287 {
288 numero=num;
289 }
290
291 int FEM_NOEUD::get_numero_opt(void)
292 {
293 return numero_opt;
294 }
295
296 void FEM_NOEUD::change_numero_opt(int num)
297 {
298 numero_opt=num;
299 }
300
301
302
303 int FEM_NOEUD::get_dimension(void)
304 {
305 return 0;
306 }
307
308 void FEM_NOEUD::change_solution(double val,int num)
309 {
310 solution[num]=val;
311 }
312
313
314 double FEM_NOEUD::get_solution(int num)
315 {
316 return solution[num];
317 }
318
319 BOITE_3D FEM_NOEUD::get_boite_3D(void)
320 {
321 BOITE_3D boite(xyz[0],xyz[1],xyz[2],xyz[0],xyz[1],xyz[2]);
322 return boite;
323
324 }
325
326 void FEM_NOEUD::enregistrer(std::ostream& o)
327 {
328 if ((get_mg_element_maillage()!=NULL) && (get_lien_topologie()!=NULL)) o << "%" << get_id() << "=FEM_NOEUD($"<< get_lien_topologie()->get_id() << ",$" << maillage->get_id() << "," << xyz[0] << "," << xyz[1] << "," << xyz[2] << "," << numero << "," << numero_opt << ");" << std::endl;
329 else if ((get_mg_element_maillage()!=NULL) && (get_lien_topologie()==NULL)) o << "%" << get_id() << "=FEM_NOEUD(NULL,$" << maillage->get_id() << "," << xyz[0] << "," << xyz[1] << "," << xyz[2] << "," << numero << "," << numero_opt << ");" << std::endl;
330 else if ((get_mg_element_maillage()==NULL) && (get_lien_topologie()!=NULL)) o << "%" << get_id() << "=FEM_NOEUD($" << get_lien_topologie()->get_id() << ",NULL," << xyz[0] << "," << xyz[1] << "," << xyz[2] << "," << numero << "," << numero_opt << ");" << std::endl;
331 else o << "%" << get_id() << "=FEM_NOEUD(NULL,NULL," << xyz[0] << "," << xyz[1] << "," << xyz[2] << "," << numero << "," << numero_opt << ");" << std::endl;
332 if (activereaction1==1)
333 if (activereaction2==1)
334 if (activereaction3==1)
335 o << "%" << get_id() << "=FEM_NOEUD_REAC(" << rxyz[0] << "," << rxyz[1] << "," << rxyz[2] << ");" << std::endl;
336 if (activedeplacement1==1)
337 if (activedeplacement2==1)
338 if (activedeplacement3==1)
339 o << "%" << get_id() << "=FEM_NOEUD_DEF(" << dxyz[0] << "," << dxyz[1] << "," << dxyz[2] << ");" << std::endl;
340 }
341
342
343
344 TPL_LISTE_ENTITE<class FEM_ELEMENT1*>* FEM_NOEUD::get_lien_element1(void)
345 {
346 return &element1;
347 }
348
349
350 TPL_LISTE_ENTITE<class FEM_ELEMENT1*>* FEM_NOEUD::get_lien_petit_element1(void)
351 {
352 return &petit_element1;
353 }
354
355
356 TPL_LISTE_ENTITE<class FEM_ELEMENT2*>* FEM_NOEUD::get_lien_element2(void)
357 {
358 return &element2;
359 }
360
361
362 TPL_LISTE_ENTITE<class FEM_ELEMENT2*>* FEM_NOEUD::get_lien_petit_element2(void)
363 {
364 return &petit_element2;
365 }
366
367 TPL_LISTE_ENTITE<class FEM_ELEMENT3*>* FEM_NOEUD::get_lien_element3(void)
368 {
369 return &element3;
370 }
371
372
373 TPL_LISTE_ENTITE<class FEM_ELEMENT3*>* FEM_NOEUD::get_lien_petit_element3(void)
374 {
375 return &petit_element3;
376 }
377 /*
378 int FEM_NOEUD::get_etat(void)
379 {
380 return etat;
381 }
382 void FEM_NOEUD::change_etat(int num)
383 {
384 etat=num;
385 }
386 */