ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_maillage.cpp
Revision: 304
Committed: Mon Jan 9 23:42:24 2012 UTC (13 years, 7 months ago) by gervaislavoie
File size: 60283 byte(s)
Log Message:
Erreur si l'axe X est normal a un element de plaque reglee.
Possibilite de desactiver la deforme par l'utilisateur avec l'option "nodeforme".

File Contents

# Content
1 //------------------------------------------------------------
2 //------------------------------------------------------------
3 // MAGiC
4 // Jean Christophe Cuilli�e et Vincent FRANCOIS
5 // D�artement de G�ie M�anique - UQTR
6 //------------------------------------------------------------
7 // Le projet MAGIC est un projet de recherche du d�artement
8 // de g�ie m�anique de l'Universit�du Qu�ec �
9 // Trois Rivi�es
10 // Les librairies ne peuvent �re utilis�s sans l'accord
11 // des auteurs (contact : francois@uqtr.ca)
12 //------------------------------------------------------------
13 //------------------------------------------------------------
14 //
15 // mg_maillage.cpp
16 //
17 //------------------------------------------------------------
18 //------------------------------------------------------------
19 // COPYRIGHT 2000
20 // Version du 02/03/2006 �11H22
21 //------------------------------------------------------------
22 //------------------------------------------------------------
23
24
25 #include "gestionversion.h"
26 #include <fstream>
27 #include <iostream>
28 #include <string.h>
29 #include <math.h>
30
31
32 #include "fem_maillage.h"
33 #include "fem_graph_noeud.h"
34 #include "mg_gestionnaire.h"
35 #include "mc_gestionnaire.h"
36 #include "mc_propriete.h"
37 #include "mc_materiau.h"
38 #include "ot_decalage_parametre.h"
39 #include "tpl_map_entite.h"
40 #include "tpl_liste_entite.h"
41 //#include "message.h"
42
43
44
45 FEM_MAILLAGE::FEM_MAILLAGE(MG_GEOMETRIE* geo,MG_MAILLAGE* mai,int deg):MG_IDENTIFICATEUR(),mg_geometrie(geo),maillage(mai),degre(deg),deforme(0)
46 {
47 }
48
49 FEM_MAILLAGE::FEM_MAILLAGE(unsigned long num,MG_GEOMETRIE* geo,MG_MAILLAGE* mai,int deg):MG_IDENTIFICATEUR(num),mg_geometrie(geo),maillage(mai),degre(deg),deforme(0)
50 {
51 }
52
53 FEM_MAILLAGE::~FEM_MAILLAGE()
54 {
55 supprimer_tout_fem_tetra();
56 supprimer_tout_fem_triangle();
57 supprimer_tout_fem_segment();
58 supprimer_tout_fem_noeud();
59 }
60
61 FEM_MAILLAGE* FEM_MAILLAGE::dupliquer(MG_GESTIONNAIRE* gest)
62 {
63 FEM_MAILLAGE* mai=new FEM_MAILLAGE(mg_geometrie,maillage,degre);
64 gest->ajouter_fem_maillage(mai);
65 long decalage=mai->get_id()-this->get_id();
66 LISTE_ENTITE::const_iterator i;
67 for (i=lst_entite.begin();i!=lst_entite.end();i++)
68 {
69 FEM_ELEMENT_MAILLAGE& ele=(FEM_ELEMENT_MAILLAGE&)(*(*i));
70 ele.dupliquer(mai,decalage);
71 }
72 return mai;
73 }
74
75 MG_GEOMETRIE* FEM_MAILLAGE::get_mg_geometrie(void)
76 {
77 return mg_geometrie;
78 }
79
80 MG_MAILLAGE* FEM_MAILLAGE::get_mg_maillage(void)
81 {
82 return maillage;
83 }
84
85 int FEM_MAILLAGE::get_degre(void)
86 {
87 return degre;
88 }
89
90 bool FEM_MAILLAGE::contient ( MG_IDENTIFICATEUR * id )
91 {
92 return ( lst_entite.find ( id ) != lst_entite.end() );
93 }
94
95 void FEM_MAILLAGE::change_gestionnaire(MG_GESTIONNAIRE* mggest)
96 {
97 gest=mggest;
98 }
99
100 // ENTITE FEM_NOEUD
101 FEM_NOEUD* FEM_MAILLAGE::ajouter_fem_noeud(MG_NOEUD* mgnoeud,unsigned long num)
102 {
103 FEM_NOEUD* femnoeud;
104 if (num==0) femnoeud=new FEM_NOEUD(mgnoeud);
105 else femnoeud=new FEM_NOEUD(num,mgnoeud);
106 int resultat = ajouter_fem_noeud(femnoeud);
107 if (resultat==FAIL)
108 {
109 delete femnoeud;
110 return NULL;
111 }
112 return femnoeud;
113 }
114
115 int FEM_MAILLAGE::ajouter_fem_noeud(FEM_NOEUD *femnoeud)
116 {
117 gest->recherche_bonid(*femnoeud);
118 MG_IDENTIFICATEUR *id=femnoeud;
119 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
120 if (!p.second)
121 {
122 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
123 return FAIL;
124 }
125
126 std::pair<const unsigned long,FEM_NOEUD*> tmp(femnoeud->get_id(),femnoeud);
127 lst_fem_noeud.insert(tmp);
128 return OK;
129 }
130
131
132 FEM_NOEUD* FEM_MAILLAGE::get_fem_noeudid(unsigned long num)
133 {
134 LISTE_FEM_NOEUD::iterator i=lst_fem_noeud.find(num);
135 if (i==lst_fem_noeud.end())
136 {
137 // afficheur << INEXISTE << enderr;
138 return NULL;
139 }
140 return ((*i).second);
141 }
142
143
144
145 FEM_NOEUD* FEM_MAILLAGE::get_fem_noeud(unsigned int num)
146 {
147 if (!(num<lst_fem_noeud.size()))
148 {
149 // afficheur << INEXISTE << enderr;
150 return NULL;
151 }
152 LISTE_FEM_NOEUD::iterator i = lst_fem_noeud.begin();
153 std::advance(i, num);
154
155 return ((*i).second);
156 }
157
158 FEM_NOEUD* FEM_MAILLAGE::get_premier_noeud(LISTE_FEM_NOEUD::iterator & it)
159 {
160 it = lst_fem_noeud.begin();
161 if (it == lst_fem_noeud.end())
162 return NULL;
163 return it->second ;
164 }
165
166 FEM_NOEUD* FEM_MAILLAGE::get_suivant_noeud(LISTE_FEM_NOEUD::iterator & it)
167 {
168 it++;
169 if (it==lst_fem_noeud.end())
170 return NULL;
171 return it->second;
172 }
173
174 unsigned int FEM_MAILLAGE::get_nb_fem_noeud(void)
175 {
176 return lst_fem_noeud.size();
177 }
178
179
180 int FEM_MAILLAGE::supprimer_fem_noeudid(unsigned long num)
181 {
182 FEM_NOEUD* femnoeud=get_fem_noeudid(num);
183 if (femnoeud==NULL)
184 {
185 // afficheur << INEXISTE2 << enderr;
186 return FAIL;
187 }
188 MG_IDENTIFICATEUR* id=femnoeud;
189 LISTE_ENTITE::iterator i=lst_entite.find(id);
190 lst_entite.erase(i);
191 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.find(num);
192 lst_fem_noeud.erase(j);
193 delete femnoeud;
194 return OK;
195 }
196
197
198 int FEM_MAILLAGE::supprimer_fem_noeud(unsigned int num)
199 {
200 FEM_NOEUD* femnoeud=get_fem_noeud(num);
201 if (femnoeud==NULL)
202 {
203 // afficheur << INEXISTE2 << enderr;
204 return FAIL;
205 }
206 MG_IDENTIFICATEUR* id=femnoeud;
207 LISTE_ENTITE::iterator i=lst_entite.find(id);
208 lst_entite.erase(i);
209 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.begin();
210 for (unsigned int k=0;k<num;k++) j++;
211 lst_fem_noeud.erase(j);
212 delete femnoeud;
213 return OK;
214 }
215
216
217 void FEM_MAILLAGE::supprimer_tout_fem_noeud(void)
218 {
219 while (get_nb_fem_noeud()!=0)
220 {
221 LISTE_FEM_NOEUD::iterator j=lst_fem_noeud.begin();
222 FEM_NOEUD* femnoeud=(*j).second;
223 MG_IDENTIFICATEUR* id=femnoeud;
224 LISTE_ENTITE::iterator i=lst_entite.find(id);
225 lst_entite.erase(i);
226 lst_fem_noeud.erase(j);
227 delete femnoeud;
228 }
229 }
230
231
232 // ENTITE FEM_SEGMENT
233
234
235 int FEM_MAILLAGE::ajouter_fem_segment(FEM_SEGMENT *femsegment)
236 {
237 gest->recherche_bonid(*femsegment);
238 MG_IDENTIFICATEUR *id=femsegment;
239 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
240 if (!p.second)
241 {
242 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
243 return FAIL;
244 }
245
246 std::pair<const unsigned long,FEM_SEGMENT*> tmp(femsegment->get_id(),femsegment);
247 lst_fem_segment.insert(tmp);
248 return OK;
249 }
250
251 FEM_SEGMENT* FEM_MAILLAGE::get_fem_segmentid(unsigned long num)
252 {
253 LISTE_FEM_SEGMENT::iterator i=lst_fem_segment.find(num);
254 if (i==lst_fem_segment.end())
255 {
256 // afficheur << INEXISTE << enderr;
257 return NULL;
258 }
259 return ((*i).second);
260 }
261
262 unsigned int FEM_MAILLAGE::get_nb_fem_segment(void)
263 {
264 return lst_fem_segment.size();
265 }
266
267
268
269 FEM_SEGMENT* FEM_MAILLAGE::get_fem_segment(unsigned int num)
270 {
271 if (!(num<lst_fem_segment.size()))
272 {
273 // afficheur << INEXISTE << enderr;
274 return NULL;
275 }
276 LISTE_FEM_SEGMENT::iterator i=lst_fem_segment.begin();
277 for (unsigned long j=0;j<num;j++) i++;
278 return ((*i).second);
279 }
280
281
282
283 int FEM_MAILLAGE::supprimer_fem_segmentid(unsigned long num)
284 {
285 FEM_SEGMENT* femsegment=get_fem_segmentid(num);
286 if (femsegment==NULL)
287 {
288 // afficheur << INEXISTE2 << enderr;
289 return FAIL;
290 }
291 MG_IDENTIFICATEUR* id=femsegment;
292 LISTE_ENTITE::iterator i=lst_entite.find(id);
293 lst_entite.erase(i);
294 LISTE_FEM_SEGMENT::iterator j=lst_fem_segment.find(num);
295 lst_fem_segment.erase(j);
296 delete femsegment;
297 return OK;
298 }
299
300 int FEM_MAILLAGE::supprimer_fem_segment(unsigned int num)
301 {
302 FEM_SEGMENT* femsegment=get_fem_segment(num);
303 if (femsegment==NULL)
304 {
305 // afficheur << INEXISTE2 << enderr;
306 return FAIL;
307 }
308 MG_IDENTIFICATEUR* id=femsegment;
309 LISTE_ENTITE::iterator i=lst_entite.find(id);
310 lst_entite.erase(i);
311 LISTE_FEM_SEGMENT::iterator j=lst_fem_segment.find(num);
312 lst_fem_segment.erase(j);
313 delete femsegment;
314 return OK;
315 }
316
317 void FEM_MAILLAGE::supprimer_tout_fem_segment(void)
318 {
319 while (get_nb_fem_segment()!=0)
320 {
321 LISTE_FEM_SEGMENT::iterator j=lst_fem_segment.begin();
322 FEM_SEGMENT* femsegment=(*j).second;
323 MG_IDENTIFICATEUR* id=femsegment;
324 LISTE_ENTITE::iterator i=lst_entite.find(id);
325 lst_entite.erase(i);
326 lst_fem_segment.erase(j);
327 delete femsegment;
328 }
329 }
330
331
332 FEM_SEGMENT* FEM_MAILLAGE::get_premier_segment(LISTE_FEM_SEGMENT::iterator & it)
333 {
334 it = lst_fem_segment.begin();
335 if (it == lst_fem_segment.end())
336 return NULL;
337 return it->second ;
338 }
339
340 FEM_SEGMENT* FEM_MAILLAGE::get_suivant_segment(LISTE_FEM_SEGMENT::iterator & it)
341 {
342 it++;
343 if (it==lst_fem_segment.end())
344 return NULL;
345 return it->second;
346 }
347
348
349
350 // ENTITE FEM_TRIANGLE
351
352
353 int FEM_MAILLAGE::ajouter_fem_triangle(FEM_TRIANGLE *femtriangle)
354 {
355 gest->recherche_bonid(*femtriangle);
356 MG_IDENTIFICATEUR *id=femtriangle;
357 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
358 if (!p.second)
359 {
360 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
361 return FAIL;
362 }
363
364 std::pair<const unsigned long,FEM_TRIANGLE*> tmp(femtriangle->get_id(),femtriangle);
365 lst_fem_triangle.insert(tmp);
366 return OK;
367 }
368
369 FEM_TRIANGLE* FEM_MAILLAGE::get_fem_triangleid(unsigned long num)
370 {
371 LISTE_FEM_TRIANGLE::iterator i=lst_fem_triangle.find(num);
372 if (i==lst_fem_triangle.end())
373 {
374 // afficheur << INEXISTE << enderr;
375 return NULL;
376 }
377 return ((*i).second);
378 }
379
380 unsigned int FEM_MAILLAGE::get_nb_fem_triangle(void)
381 {
382 return lst_fem_triangle.size();
383 }
384
385
386
387 FEM_TRIANGLE* FEM_MAILLAGE::get_fem_triangle(unsigned int num)
388 {
389 if (!(num<lst_fem_triangle.size()))
390 {
391 // afficheur << INEXISTE << enderr;
392 return NULL;
393 }
394 LISTE_FEM_TRIANGLE::iterator i=lst_fem_triangle.begin();
395 for (unsigned long j=0;j<num;j++) i++;
396 return ((*i).second);
397 }
398
399
400
401 int FEM_MAILLAGE::supprimer_fem_triangleid(unsigned long num)
402 {
403 FEM_TRIANGLE* femtriangle=get_fem_triangleid(num);
404 if (femtriangle==NULL)
405 {
406 // afficheur << INEXISTE2 << enderr;
407 return FAIL;
408 }
409 MG_IDENTIFICATEUR* id=femtriangle;
410 LISTE_ENTITE::iterator i=lst_entite.find(id);
411 lst_entite.erase(i);
412 LISTE_FEM_TRIANGLE::iterator j=lst_fem_triangle.find(num);
413 lst_fem_triangle.erase(j);
414 delete femtriangle;
415 return OK;
416 }
417
418 int FEM_MAILLAGE::supprimer_fem_triangle(unsigned int num)
419 {
420 FEM_TRIANGLE* femtriangle=get_fem_triangle(num);
421 if (femtriangle==NULL)
422 {
423 // afficheur << INEXISTE2 << enderr;
424 return FAIL;
425 }
426 MG_IDENTIFICATEUR* id=femtriangle;
427 LISTE_ENTITE::iterator i=lst_entite.find(id);
428 lst_entite.erase(i);
429 LISTE_FEM_TRIANGLE::iterator j=lst_fem_triangle.find(num);
430 lst_fem_triangle.erase(j);
431 delete femtriangle;
432 return OK;
433 }
434
435 void FEM_MAILLAGE::supprimer_tout_fem_triangle(void)
436 {
437 while (get_nb_fem_triangle()!=0)
438 {
439 LISTE_FEM_TRIANGLE::iterator j=lst_fem_triangle.begin();
440 FEM_TRIANGLE* femtriangle=(*j).second;
441 MG_IDENTIFICATEUR* id=femtriangle;
442 LISTE_ENTITE::iterator i=lst_entite.find(id);
443 lst_entite.erase(i);
444 lst_fem_triangle.erase(j);
445 delete femtriangle;
446 }
447 }
448
449
450 FEM_TRIANGLE* FEM_MAILLAGE::get_premier_triangle(LISTE_FEM_TRIANGLE::iterator & it)
451 {
452 it = lst_fem_triangle.begin();
453 if (it == lst_fem_triangle.end())
454 return NULL;
455 return it->second ;
456 }
457
458 FEM_TRIANGLE* FEM_MAILLAGE::get_suivant_triangle(LISTE_FEM_TRIANGLE::iterator & it)
459 {
460 it++;
461 if (it==lst_fem_triangle.end())
462 return NULL;
463 return it->second;
464 }
465
466
467 // ENTITE FEM_TETRA
468
469
470 int FEM_MAILLAGE::ajouter_fem_tetra(FEM_TETRA *femtetra)
471 {
472 gest->recherche_bonid(*femtetra);
473 MG_IDENTIFICATEUR *id=femtetra;
474 std::pair<LISTE_ENTITE::iterator,bool> p=lst_entite.insert(id);
475 if (!p.second)
476 {
477 // afficheur << ENTITEID << id->get_id() << DUPLIQUE << enderr;
478 return FAIL;
479 }
480
481 std::pair<const unsigned long,FEM_TETRA*> tmp(femtetra->get_id(),femtetra);
482 lst_fem_tetra.insert(tmp);
483 return OK;
484 }
485
486 FEM_TETRA* FEM_MAILLAGE::get_fem_tetraid(unsigned long num)
487 {
488 LISTE_FEM_TETRA::iterator i=lst_fem_tetra.find(num);
489 if (i==lst_fem_tetra.end())
490 {
491 // afficheur << INEXISTE << enderr;
492 return NULL;
493 }
494 return ((*i).second);
495 }
496
497 unsigned int FEM_MAILLAGE::get_nb_fem_tetra(void)
498 {
499 return lst_fem_tetra.size();
500 }
501
502
503
504 FEM_TETRA* FEM_MAILLAGE::get_fem_tetra(unsigned int num)
505 {
506 if (!(num<lst_fem_tetra.size()))
507 {
508 // afficheur << INEXISTE << enderr;
509 return NULL;
510 }
511 LISTE_FEM_TETRA::iterator i=lst_fem_tetra.begin();
512 for (unsigned long j=0;j<num;j++) i++;
513 return ((*i).second);
514 }
515
516
517
518 int FEM_MAILLAGE::supprimer_fem_tetraid(unsigned long num)
519 {
520 FEM_TETRA* femtetra=get_fem_tetraid(num);
521 if (femtetra==NULL)
522 {
523 // afficheur << INEXISTE2 << enderr;
524 return FAIL;
525 }
526 MG_IDENTIFICATEUR* id=femtetra;
527 LISTE_ENTITE::iterator i=lst_entite.find(id);
528 lst_entite.erase(i);
529 LISTE_FEM_TETRA::iterator j=lst_fem_tetra.find(num);
530 lst_fem_tetra.erase(j);
531 delete femtetra;
532 return OK;
533 }
534
535 int FEM_MAILLAGE::supprimer_fem_tetra(unsigned int num)
536 {
537 FEM_TETRA* femtetra=get_fem_tetra(num);
538 if (femtetra==NULL)
539 {
540 // afficheur << INEXISTE2 << enderr;
541 return FAIL;
542 }
543 MG_IDENTIFICATEUR* id=femtetra;
544 LISTE_ENTITE::iterator i=lst_entite.find(id);
545 lst_entite.erase(i);
546 LISTE_FEM_TETRA::iterator j=lst_fem_tetra.find(num);
547 lst_fem_tetra.erase(j);
548 delete femtetra;
549 return OK;
550 }
551
552 void FEM_MAILLAGE::supprimer_tout_fem_tetra(void)
553 {
554 while (get_nb_fem_tetra()!=0)
555 {
556 LISTE_FEM_TETRA::iterator j=lst_fem_tetra.begin();
557 FEM_TETRA* femtetra=(*j).second;
558 MG_IDENTIFICATEUR* id=femtetra;
559 LISTE_ENTITE::iterator i=lst_entite.find(id);
560 lst_entite.erase(i);
561 lst_fem_tetra.erase(j);
562 delete femtetra;
563 }
564 }
565
566
567 FEM_TETRA* FEM_MAILLAGE::get_premier_tetra(LISTE_FEM_TETRA::iterator & it)
568 {
569 it = lst_fem_tetra.begin();
570 if (it == lst_fem_tetra.end())
571 return NULL;
572 return it->second ;
573 }
574
575 FEM_TETRA* FEM_MAILLAGE::get_suivant_tetra(LISTE_FEM_TETRA::iterator & it)
576 {
577 it++;
578 if (it==lst_fem_tetra.end())
579 return NULL;
580 return it->second;
581 }
582
583
584
585
586
587
588 void FEM_MAILLAGE::construire(int num)
589 {
590 if (degre==1) construire_lineraire();
591 if (degre==2) construire_quadratique();
592 if (num>0) optimise_numerotation();
593 if (num>1) echange_numerotation();
594
595 }
596
597
598
599
600 void FEM_MAILLAGE::construire_lineraire(void)
601 {
602 LISTE_MG_NOEUD::iterator it_noeud;
603 MG_NOEUD* mgnoeud=maillage->get_premier_noeud(it_noeud);
604 std::vector<FEM_NOEUD*> lstnoeuddirect;
605 unsigned int i=0;
606 while (mgnoeud)
607 {
608 mgnoeud->change_nouveau_numero(i);
609 FEM_NOEUD* femnoeud=new FEM_NOEUD(mgnoeud);
610 femnoeud->change_numero(i+1);
611 i++;
612 ajouter_fem_noeud(femnoeud);
613 mgnoeud=maillage->get_suivant_noeud(it_noeud);
614 lstnoeuddirect.insert(lstnoeuddirect.end(),femnoeud);
615 }
616 int dimsansgeo=0;
617 if (get_mg_geometrie()==NULL)
618 {
619 if (maillage->get_nb_mg_tetra()!=0) dimsansgeo=3;
620 else if (maillage->get_nb_mg_triangle()!=0) dimsansgeo=2;
621 else if (maillage->get_nb_mg_segment()!=0) dimsansgeo=1;
622 }
623 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==1)))
624 {
625 LISTE_MG_SEGMENT::iterator it_seg;
626 MG_SEGMENT * mgseg = maillage->get_premier_segment(it_seg);
627 while (mgseg)
628 {
629 if (mgseg->get_lien_topologie()!=NULL) if (mgseg->get_lien_topologie()->get_dimension()!=1) {
630 mgseg=maillage->get_suivant_segment(it_seg);
631 continue;
632 }
633 {
634 FEM_NOEUD *tabnoeud[2];
635 tabnoeud[0]=lstnoeuddirect[mgseg->get_noeud1()->get_nouveau_numero()];
636 tabnoeud[1]=lstnoeuddirect[mgseg->get_noeud2()->get_nouveau_numero()];
637 FEM_SEGMENT2* seg=new FEM_SEGMENT2(mgseg,tabnoeud);
638 ajouter_fem_segment(seg);
639 }
640 mgseg=maillage->get_suivant_segment(it_seg);
641 }
642 }
643 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==2)))
644 {
645 LISTE_MG_TRIANGLE::iterator it_tri;
646 MG_TRIANGLE* mgtri=maillage->get_premier_triangle(it_tri);
647 while (mgtri)
648 {
649 if (mgtri->get_lien_topologie()!=NULL) if (mgtri->get_lien_topologie()->get_dimension()!=2) {
650 mgtri=maillage->get_suivant_triangle(it_tri);
651 continue;
652 }
653 FEM_NOEUD *tabnoeud[3];
654 tabnoeud[0]=lstnoeuddirect[mgtri->get_noeud1()->get_nouveau_numero()];
655 tabnoeud[1]=lstnoeuddirect[mgtri->get_noeud2()->get_nouveau_numero()];
656 tabnoeud[2]=lstnoeuddirect[mgtri->get_noeud3()->get_nouveau_numero()];
657 FEM_TRIANGLE3* tri=new FEM_TRIANGLE3(mgtri,tabnoeud);
658 ajouter_fem_triangle(tri);
659 mgtri=maillage->get_suivant_triangle(it_tri);
660 }
661 }
662 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==3)))
663 {
664 LISTE_MG_TETRA::iterator it_tetra;
665 MG_TETRA* mgtetra=maillage->get_premier_tetra(it_tetra);
666 while (mgtetra)
667 {
668 FEM_NOEUD *tabnoeud[4];
669 tabnoeud[0]=lstnoeuddirect[mgtetra->get_noeud1()->get_nouveau_numero()];
670 tabnoeud[1]=lstnoeuddirect[mgtetra->get_noeud2()->get_nouveau_numero()];
671 tabnoeud[2]=lstnoeuddirect[mgtetra->get_noeud3()->get_nouveau_numero()];
672 tabnoeud[3]=lstnoeuddirect[mgtetra->get_noeud4()->get_nouveau_numero()];
673 FEM_TETRA4* tet=new FEM_TETRA4(mgtetra,tabnoeud);
674 ajouter_fem_tetra(tet);
675 mgtetra=maillage->get_suivant_tetra(it_tetra);
676 }
677 }
678 }
679
680
681 void FEM_MAILLAGE::construire_quadratique(void)
682 {
683 LISTE_MG_NOEUD::iterator it_nd;
684 MG_NOEUD* mgnoeud=maillage->get_premier_noeud(it_nd);
685 std::vector<FEM_NOEUD*> lstnoeuddirect;
686 unsigned int i=0;
687 while (mgnoeud)
688 {
689 mgnoeud->change_nouveau_numero(i);
690 FEM_NOEUD* femnoeud=new FEM_NOEUD(mgnoeud);
691 femnoeud->change_numero(i+1);
692 i++ ;
693 ajouter_fem_noeud(femnoeud);
694 mgnoeud=maillage->get_suivant_noeud(it_nd);
695 lstnoeuddirect.insert(lstnoeuddirect.end(),femnoeud);
696 }
697 int dimsansgeo=0;
698 if (get_mg_geometrie()==NULL)
699 {
700 if (maillage->get_nb_mg_tetra()!=0) dimsansgeo=3;
701 else if (maillage->get_nb_mg_triangle()!=0) dimsansgeo=2;
702 else if (maillage->get_nb_mg_segment()!=0) dimsansgeo=1;
703 }
704 int nbmgnoeud = maillage->get_nb_mg_noeud();
705
706 LISTE_MG_SEGMENT::iterator it_seg;
707 MG_SEGMENT* mgseg=maillage->get_premier_segment(it_seg);
708 i=0;
709 while (mgseg)
710 {
711 mgseg->change_nouveau_numero(i++);
712 MG_NOEUD *noeud1=mgseg->get_noeud1();
713 MG_NOEUD *noeud2=mgseg->get_noeud2();
714 double *xyz1=noeud1->get_coord();
715 double *xyz2=noeud2->get_coord();
716 FEM_NOEUD* femnoeud;
717 if (mgseg->get_lien_topologie()!=NULL)
718 if (mgseg->get_lien_topologie()->get_dimension()==1)
719 {
720 MG_ARETE* arete=(MG_ARETE*)(mgseg->get_lien_topologie());
721 double t1,t2;
722 arete->inverser(t1,xyz1);
723 arete->inverser(t2,xyz2);
724 if (arete->get_courbe()->est_periodique())
725 if (t1>t2) t2=t2+arete->get_courbe()->get_periode();
726 double t=0.5*(t1+t2);
727 double xyz[2];
728 arete->evaluer(t,xyz);
729 femnoeud= new FEM_NOEUD(mgseg,xyz[0],xyz[1],xyz[2]);
730 }
731 if (mgseg->get_lien_topologie()!=NULL)
732 if (mgseg->get_lien_topologie()->get_dimension()==2)
733 {
734 MG_FACE* face=(MG_FACE*)(mgseg->get_lien_topologie());
735 double uv1[2],uv2[2];
736 OT_DECALAGE_PARAMETRE decalage(face->get_surface()->get_periode_u(),face->get_surface()->get_periode_v());
737 face->inverser(uv1,xyz1);
738 face->inverser(uv2,xyz2);
739 double du=decalage.calcul_decalage_parametre_u(uv1[0]);
740 double dv=decalage.calcul_decalage_parametre_v(uv1[1]);
741 double u1=decalage.decalage_parametre_u(uv1[0],du);
742 double v1=decalage.decalage_parametre_v(uv1[1],dv);
743 double u2=decalage.decalage_parametre_u(uv2[0],du);
744 double v2=decalage.decalage_parametre_v(uv2[1],dv);
745 double ui=0.5*(u1+u2);
746 double vi=0.5*(v1+v2);
747 double uii=decalage.decalage_parametre_u(ui,-du);
748 double vii=decalage.decalage_parametre_v(vi,-dv);
749 double uv[2],xyz[3];
750 uv[0]=uii;
751 uv[1]=vii;
752 face->evaluer(uv,xyz);
753 femnoeud= new FEM_NOEUD(mgseg,xyz[0],xyz[1],xyz[2]);
754 }
755 if (mgseg->get_lien_topologie()!=NULL)
756 {
757 if (mgseg->get_lien_topologie()->get_dimension()==3)
758 {
759 double x=0.5*(xyz1[0]+xyz2[0]);
760 double y=0.5*(xyz1[1]+xyz2[1]);
761 double z=0.5*(xyz1[2]+xyz2[2]);
762 femnoeud= new FEM_NOEUD(mgseg,x,y,z);
763 }
764 }
765 else
766 {
767 double x=0.5*(xyz1[0]+xyz2[0]);
768 double y=0.5*(xyz1[1]+xyz2[1]);
769 double z=0.5*(xyz1[2]+xyz2[2]);
770 femnoeud= new FEM_NOEUD(mgseg,x,y,z);
771 }
772 femnoeud->change_numero(i+nbmgnoeud+1);
773 ajouter_fem_noeud(femnoeud);
774 mgseg=maillage->get_suivant_segment(it_seg);
775 lstnoeuddirect.insert(lstnoeuddirect.end(),femnoeud);
776 }
777
778 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==1)))
779 {
780
781 mgseg=maillage->get_premier_segment(it_seg);
782 while (mgseg)
783 {
784 if (mgseg->get_lien_topologie()!=NULL) if (mgseg->get_lien_topologie()->get_dimension()!=1) {
785 mgseg=maillage->get_suivant_segment(it_seg);
786 continue;
787 }
788 {
789 FEM_NOEUD *tabnoeud[3];
790 tabnoeud[0]=lstnoeuddirect[mgseg->get_noeud1()->get_nouveau_numero()];
791 tabnoeud[1]=lstnoeuddirect[mgseg->get_nouveau_numero()+nbmgnoeud];
792 tabnoeud[2]=lstnoeuddirect[mgseg->get_noeud2()->get_nouveau_numero()];
793 FEM_SEGMENT3* seg=new FEM_SEGMENT3(mgseg,tabnoeud);
794 ajouter_fem_segment(seg);
795 }
796 mgseg=maillage->get_suivant_segment(it_seg);
797 }
798 }
799 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==2)))
800 {
801 LISTE_MG_TRIANGLE::iterator it_tri;
802 MG_TRIANGLE* mgtri=maillage->get_premier_triangle(it_tri);
803
804 while (mgtri)
805 {
806 if (mgtri->get_lien_topologie()!=NULL) if (mgtri->get_lien_topologie()->get_dimension()!=2) {
807 mgtri=maillage->get_suivant_triangle(it_tri);
808 continue;
809 }
810 {
811 FEM_NOEUD *tabnoeud[6];
812 tabnoeud[0]=lstnoeuddirect[mgtri->get_noeud1()->get_nouveau_numero()];
813 tabnoeud[1]=lstnoeuddirect[mgtri->get_segment1()->get_nouveau_numero()+nbmgnoeud];
814 tabnoeud[2]=lstnoeuddirect[mgtri->get_noeud2()->get_nouveau_numero()];
815 tabnoeud[3]=lstnoeuddirect[mgtri->get_segment2()->get_nouveau_numero()+nbmgnoeud];
816 tabnoeud[4]=lstnoeuddirect[mgtri->get_noeud3()->get_nouveau_numero()];
817 tabnoeud[5]=lstnoeuddirect[mgtri->get_segment3()->get_nouveau_numero()+nbmgnoeud];
818 FEM_TRIANGLE6* tri=new FEM_TRIANGLE6(mgtri,tabnoeud);
819 ajouter_fem_triangle(tri);
820 }
821 mgtri=maillage->get_suivant_triangle(it_tri);
822 }
823 }
824 if ((get_mg_geometrie()!=NULL) || ( (get_mg_geometrie()==NULL) && (dimsansgeo==3)))
825 {
826
827 LISTE_MG_TETRA::iterator it_tetra;
828 MG_TETRA* mgtetra=maillage->get_premier_tetra(it_tetra);
829 while (mgtetra)
830 {
831 FEM_NOEUD *tabnoeud[10];
832 tabnoeud[0]=lstnoeuddirect[mgtetra->get_noeud1()->get_nouveau_numero()];
833 tabnoeud[1]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud1()->get_id(),mgtetra->get_noeud2()->get_id())->get_nouveau_numero()+nbmgnoeud];
834 tabnoeud[2]=lstnoeuddirect[mgtetra->get_noeud2()->get_nouveau_numero()];
835 tabnoeud[3]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud2()->get_id(),mgtetra->get_noeud3()->get_id())->get_nouveau_numero()+nbmgnoeud];
836 tabnoeud[4]=lstnoeuddirect[mgtetra->get_noeud3()->get_nouveau_numero()];
837 tabnoeud[5]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud3()->get_id(),mgtetra->get_noeud1()->get_id())->get_nouveau_numero()+nbmgnoeud];
838 tabnoeud[6]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud1()->get_id(),mgtetra->get_noeud4()->get_id())->get_nouveau_numero()+nbmgnoeud];
839 tabnoeud[7]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud2()->get_id(),mgtetra->get_noeud4()->get_id())->get_nouveau_numero()+nbmgnoeud];
840 tabnoeud[8]=lstnoeuddirect[maillage->get_mg_segment(mgtetra->get_noeud3()->get_id(),mgtetra->get_noeud4()->get_id())->get_nouveau_numero()+nbmgnoeud];
841 tabnoeud[9]=lstnoeuddirect[mgtetra->get_noeud4()->get_nouveau_numero()];
842 FEM_TETRA10* tet=new FEM_TETRA10(mgtetra,tabnoeud);
843 ajouter_fem_tetra(tet);
844 mgtetra=maillage->get_suivant_tetra(it_tetra);
845 }
846 }
847 }
848
849
850
851 void FEM_MAILLAGE::enregistrer(std::ostream& o)
852 {
853
854 if (mg_geometrie==NULL) o << "%" << get_id() << "=FEM_MAILLAGE(" << degre << ",$" << maillage->get_id() << " );" << std::endl;
855 else o << "%" << get_id() << "=FEM_MAILLAGE("<< degre << ",$" << maillage->get_id() << ",$" << mg_geometrie->get_id() <<");" << std::endl;
856 LISTE_ENTITE::const_iterator i;
857 for (i=lst_entite.begin();i!=lst_entite.end();i++)
858 (*i)->enregistrer(o);
859 }
860
861
862 void FEM_MAILLAGE::exporter_cosmos(std::string& nomfic)
863 {
864 char chaine[500];
865 sprintf(chaine,"%s.ses",nomfic.c_str());
866 std::ofstream of1(chaine,std::ios::out|std::ios::trunc);
867 of1.precision(16);
868 of1.setf(std::ios::showpoint);
869 of1 << "TITLE, " << chaine << " : Fichier FEM de maillage MAGiC" << std::endl;
870 if (degre==1) of1 << "EGROUP,1,TETRA4,0,0,0,0,0,0,0,0;" << std::endl;
871 if (degre==2) of1 << "EGROUP,1,TETRA10,0,0,0,0,0,0,0,0;" << std::endl;
872 int nb_volume=mg_geometrie->get_nb_mg_volume();
873 int nbNoeuds = 0;
874
875
876 for (int i=0;i<nb_volume;i++)
877 {
878 MG_VOLUME *mgvol=mg_geometrie->get_mg_volume(i);
879 if (mgvol->get_num_materiau()>=0)
880 {
881 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
882 MC_MATERIAU* mat=mtgest.get_materiau(mgvol->get_num_materiau());
883 for (int m=0; m<mat->get_nb_propriete();m++)
884 {
885 MC_PROPRIETE* prop=mat->get_propriete(m);
886 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
887 }
888 /* MT_PROPRIETE* prop=mat->get_propriete("EX");
889 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", EX, " << prop->get_valeur(2) << ";" << std::endl;
890 prop=mat->get_propriete("NUXY");
891 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", NUXY, " << prop->get_valeur(2) << ";" << std::endl;
892 prop=mat->get_propriete("GXY");
893 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", GXY, " << prop->get_valeur(2) << ";" << std::endl;
894 prop=mat->get_propriete("DENS");
895 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", DENS, " << prop->get_valeur(2) << ";" << std::endl;
896 prop=mat->get_propriete("SIGXT");
897 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", SIGXT, " << prop->get_valeur(2) << ";" << std::endl;
898 prop=mat->get_propriete("SIGYLD");
899 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", SIGYLD, " << prop->get_valeur(2) << ";" << std::endl;
900 prop=mat->get_propriete("ALPX");
901 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", ALPX, " << prop->get_valeur(2) << ";" << std::endl;
902 prop=mat->get_propriete("KX");
903 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", KX, " << prop->get_valeur(2) << ";" << std::endl;
904 prop=mat->get_propriete("C");
905 of1<< "MPROP, "<< mgvol->get_num_materiau()+1 << ", C , " << prop->get_valeur(2) << ";" << std::endl;*/
906 }
907 }
908 int nb_coques = mg_geometrie->get_nb_mg_coque();
909 for (int i=0;i<nb_coques;i++)
910 {
911 MG_COQUE *mgcoque=mg_geometrie->get_mg_coque(i);
912 if (mgcoque->get_num_materiau()>=0)
913 {
914 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
915 MC_MATERIAU* mat=mtgest.get_materiau(mgcoque->get_num_materiau());
916 for (int m=0; m<mat->get_nb_propriete();m++)
917 {
918 MC_PROPRIETE* prop=mat->get_propriete(m);
919 of1<< "MPROP, "<< mgcoque->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
920 }
921 }
922 }
923 int nb_poutres = mg_geometrie->get_nb_mg_poutre();
924 for (int i=0;i<nb_poutres;i++)
925 {
926 MG_POUTRE *mgpoutre=mg_geometrie->get_mg_poutre(i);
927 if (mgpoutre->get_num_materiau()>=0)
928 {
929 MC_GESTIONNAIRE mtgest(mg_geometrie->get_gest_materiau());
930 MC_MATERIAU* mat=mtgest.get_materiau(mgpoutre->get_num_materiau());
931
932 for (int m=0; m<mat->get_nb_propriete();m++)
933 {
934 MC_PROPRIETE* prop=mat->get_propriete(m);
935 of1<< "MPROP, "<< mgpoutre->get_num_materiau()+1 << ", " << prop->get_nom() <<", " << prop->get_valeur(m) << ";" << std::endl;
936 }
937 }
938 }
939
940
941
942 of1 << "ACTSET,CS,0;" << std::endl;
943 of1 << "ACTSET,EG,1;" << std::endl;
944
945 // �riture des noeuds
946 int ii=0;
947 double valeurunite=mg_geometrie->get_valeur_unite();
948 for (LISTE_FEM_NOEUD::iterator i=lst_fem_noeud.begin();i!=lst_fem_noeud.end();i++)
949 {
950 FEM_NOEUD* noeud=((*i).second);
951 of1 << "ND, " << noeud->get_numero() << ", " << noeud->get_x()*valeurunite << ", " << noeud->get_y()*valeurunite << ", " << noeud->get_z()*valeurunite << ";" << std::endl;
952 char nom[3];
953 int nb=noeud->get_lien_topologie()->get_nb_ccf();
954 for (int k=0;k<nb;k++)
955 {
956 noeud->get_lien_topologie()->get_type_ccf(k,nom);
957 if (strcmp(nom,"Da")==0) of1 << "DND , " << noeud->get_numero() << ", AL, " << noeud->get_lien_topologie()->get_valeur_ccf(k) << ", " << noeud->get_numero() << ", 1;" << std::endl;
958 if (strcmp(nom,"Dx")==0) of1 << "DND , " << noeud->get_numero() << ", UX, " << noeud->get_lien_topologie()->get_valeur_ccf(k) << ", " << noeud->get_numero() << ", 1;" << std::endl;
959 if (strcmp(nom,"Dy")==0) of1 << "DND , " << noeud->get_numero() << ", UY, " << noeud->get_lien_topologie()->get_valeur_ccf(k) << ", " << noeud->get_numero() << ", 1;" << std::endl;
960 if (strcmp(nom,"Dz")==0) of1 << "DND , " << noeud->get_numero() << ", UZ, " << noeud->get_lien_topologie()->get_valeur_ccf(k) << ", " << noeud->get_numero() << ", 1;" << std::endl;
961 if (strcmp(nom,"Fx")==0) of1 << "FND , " << noeud->get_numero() << ", FX, " << noeud->get_lien_topologie()->get_valeur_ccf(k) << ", " << noeud->get_numero() << ", 1;" << std::endl;
962 if (strcmp(nom,"Fy")==0) of1 << "FND , " << noeud->get_numero() << ", FY, " << noeud->get_lien_topologie()->get_valeur_ccf(k) << ", " << noeud->get_numero() << ", 1;" << std::endl;
963 if (strcmp(nom,"Fz")==0) of1 << "FND , " << noeud->get_numero() << ", FZ, " << noeud->get_lien_topologie()->get_valeur_ccf(k) << ", " << noeud->get_numero() << ", 1;" << std::endl;
964 }
965 ii++;
966 }
967 nbNoeuds = ii;
968 ii=0;
969
970 // �criture des t�tra�dres
971 int nummat=-10; // num�o du mat�iau
972 for (LISTE_FEM_TETRA::iterator i=lst_fem_tetra.begin();i!=lst_fem_tetra.end();i++)
973 {
974 FEM_TETRA* tetra=((*i).second);
975 MG_VOLUME* vol=(MG_VOLUME*)tetra->get_lien_topologie();
976 int nummatac=vol->get_num_materiau();
977 if ((nummatac!=nummat) && (nummatac!=-1))
978 {
979 nummat=nummatac;
980 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
981 }
982 if (degre==1) of1 << "EL, " << ii+1 << ", VL, 1, 4, " << tetra->get_fem_noeud(0)->get_numero() << ", " << tetra->get_fem_noeud(1)->get_numero() << ", " << tetra->get_fem_noeud(2)->get_numero() << ", " << tetra->get_fem_noeud(3)->get_numero() << ", " ;
983 if (degre==2) of1 << "EL, " << ii+1 << ", VL, 1,10, " << tetra->get_fem_noeud(0)->get_numero() << ", " << tetra->get_fem_noeud(2)->get_numero() << ", " << tetra->get_fem_noeud(4)->get_numero() << ", " << tetra->get_fem_noeud(9)->get_numero() << ", " << tetra->get_fem_noeud(1)->get_numero() << ", " << tetra->get_fem_noeud(3)->get_numero() << ", " << tetra->get_fem_noeud(5)->get_numero() << ", " << tetra->get_fem_noeud(6)->get_numero() << ", " << tetra->get_fem_noeud(7)->get_numero() << ", " << tetra->get_fem_noeud(8)->get_numero() << ", " ;
984 ii++;
985 MG_TETRA* tet=(MG_TETRA*)tetra->get_mg_element_maillage();
986 if (tet->get_triangle1()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
987 else of1 << "0, ";
988 if (tet->get_triangle2()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
989 else of1 << "0, ";
990 if (tet->get_triangle3()->get_lien_topologie()->get_dimension()!=3) of1 << "1, ";
991 else of1 << "0, ";
992 if (tet->get_triangle4()->get_lien_topologie()->get_dimension()!=3) of1 << "1;" << std::endl ;
993 else of1 << "0;" << std::endl;
994 char nom[3];
995 int nb=tet->get_triangle1()->get_lien_topologie()->get_nb_ccf();
996 for (int k=0;k<nb;k++)
997 {
998 tet->get_triangle1()->get_lien_topologie()->get_type_ccf(k,nom);
999 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 1;" << std::endl;
1000 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 2;" << std::endl;
1001 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 3;" << std::endl;
1002 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle1()->get_lien_topologie()->get_valeur_ccf(k) << ", 1, " << ii << ", 1, 4;" << std::endl;
1003 }
1004 nb=tet->get_triangle2()->get_lien_topologie()->get_nb_ccf();
1005 for (int k=0;k<nb;k++)
1006 {
1007 tet->get_triangle2()->get_lien_topologie()->get_type_ccf(k,nom);
1008 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 1;" << std::endl;
1009 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 2;" << std::endl;
1010 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 3;" << std::endl;
1011 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle2()->get_lien_topologie()->get_valeur_ccf(k) << ", 2, " << ii << ", 1, 4;" << std::endl;
1012 }
1013 nb=tet->get_triangle3()->get_lien_topologie()->get_nb_ccf();
1014 for (int k=0;k<nb;k++)
1015 {
1016 tet->get_triangle3()->get_lien_topologie()->get_type_ccf(k,nom);
1017 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 1;" << std::endl;
1018 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 2;" << std::endl;
1019 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 3;" << std::endl;
1020 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle3()->get_lien_topologie()->get_valeur_ccf(k) << ", 3, " << ii << ", 1, 4;" << std::endl;
1021 }
1022 nb=tet->get_triangle4()->get_lien_topologie()->get_nb_ccf();
1023 for (int k=0;k<nb;k++)
1024 {
1025 tet->get_triangle4()->get_lien_topologie()->get_type_ccf(k,nom);
1026 if (strcmp(nom,"Px")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 1;" << std::endl;
1027 if (strcmp(nom,"Py")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 2;" << std::endl;
1028 if (strcmp(nom,"Pz")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 3;" << std::endl;
1029 if (strcmp(nom,"Pn")==0) of1 << "PEL , " << ii << ", " << tet->get_triangle4()->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 4;" << std::endl;
1030 }
1031 }
1032
1033
1034 //*********************************************************
1035 // Les t�tras sont finis, maintenant le maillage des Coques
1036 //*********************************************************
1037 //nb_coques=mg_geometrie->get_nb_mg_coque(); //variable d��d�lar� plus haut, elle devrait avoir conserv�sa valeur
1038 if (nb_coques>0)
1039 {
1040 if (degre==1) of1 << "EGROUP,2,SHELL3,0,0,0,0,0,0,0,0;" << std::endl; // Formulation coques minces... SHELL3T pout �aisses
1041 if (degre==2) of1 << "EGROUP,2,SHELL6,0,0,0,0,0,0,0,0;" << std::endl;
1042 }
1043
1044 if (nb_poutres>0 || nb_coques>0 )
1045 {
1046 of1 << "EGROUP,3,BEAM3D,0,0,0,0,0,0,0,0;"<< std::endl; //Egroup des mini-poutres
1047 of1 << "RCONST,3,3,1,3," << "1, 1 , 1; " << std::endl;
1048 of1 << "EGROUP,4,RBAR;"<< std::endl; // EGroup des RBAR
1049 of1 << "EGROUP,5,BEAM3D,0,0,0,0,0,0,0,0;"<< std::endl; //Egroup des mini-poutres infiniment rigide
1050 of1 << "RCONST,5,5,1,3," << "0.01, 0.01 , 0.01; " << std::endl;
1051 of1 << "EGROUP,6,BEAM3D,0,0,0,0,0,0,0,0;"<< std::endl; //Egroup des mini-poutres avec inertie dans juste une direction (je sais, il n'est pas obligatoire, mais �a aide au d�buggage d'avoir un #5...)
1052 of1 << "RCONST,6,6,1,3," << "1e-16, 0.01 , 1e-16; " << std::endl;
1053 }
1054
1055 int RCset =7;
1056
1057 LISTE_MG_COQUE::iterator ico;
1058 MG_COQUE *mgcoque=mg_geometrie->get_premier_coque(ico);
1059 while (mgcoque)
1060 {
1061 int nummatac=mgcoque->get_num_materiau();
1062 if ((nummatac!=nummat)&&(nummatac!=-1)) // si c'est = 0 alors on place le dernier mat�iau choisi.
1063 {
1064 nummat=nummatac;
1065 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
1066 }
1067
1068 for (int numcoquille=0;numcoquille<mgcoque->get_nb_mg_coquille();numcoquille++)
1069 {
1070 MG_COQUILLE* mgcoquille = mgcoque->get_mg_coquille(numcoquille);
1071 for (int cf = 0; cf<mgcoquille->get_nb_mg_coface();cf++)
1072 {
1073 MG_COFACE* mgcoface = mgcoquille->get_mg_coface(cf);
1074 MG_FACE* mgface = mgcoface->get_face();
1075
1076 double epaisseur=-1;
1077 for (int k=0;k<mgface->get_nb_ccf();k++) // aller chercher l'�aisseur de la coque
1078 {
1079 char nomCCF[3];
1080 mgface->get_type_ccf(k,nomCCF);
1081 if (strcmp(nomCCF,"EP")==0)
1082 epaisseur = mgface-> get_valeur_ccf(k);
1083 }
1084 of1 << "ACTSET,EG,2;"<< std::endl;
1085 of1 << "RCONST,2,"<< ++RCset << ",1,1," << epaisseur << ";" << std::endl; // le real constant, s'active automatiquement
1086
1087 TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> * lien_maillage = mgface->get_lien_fem_maillage();
1088 int nbelem=lien_maillage->get_nb();
1089 for (int i=0;i<nbelem;i++)
1090 {
1091 FEM_TRIANGLE* femtriangle=(FEM_TRIANGLE*)lien_maillage->get(i);
1092 if (!contient(femtriangle)) continue;
1093 if (degre==1) of1 << "EL, " << ++ii << ", SF, 0, 3, " <<femtriangle->get_fem_noeud(0)->get_numero()<< ","<< femtriangle->get_fem_noeud(1)->get_numero()<<","<<femtriangle->get_fem_noeud(2)->get_numero()<< ";" << std::endl;
1094 if (degre==2) of1 << "EL, " << ++ii << ", SF, 0, 6, " <<femtriangle->get_fem_noeud(0)->get_numero()<< ","<< femtriangle->get_fem_noeud(2)->get_numero()<<","<<femtriangle->get_fem_noeud(4)->get_numero()<< ","<<femtriangle->get_fem_noeud(1)->get_numero()<< ","<<femtriangle->get_fem_noeud(3)->get_numero()<<","<<femtriangle->get_fem_noeud(5)->get_numero()<<";"<< std::endl;
1095 // dans les noeuds des sommets sont, 1, 2 et 3. les noeuds sur les segments sont 4 5 et 6
1096
1097 long nbc;
1098 MG_TRIANGLE* mgtri=(MG_TRIANGLE*)femtriangle->get_mg_element_maillage();
1099 char nom[3];
1100
1101 nbc = mgtri->get_segment1()->get_lien_topologie()->get_nb_ccf();
1102 for (int z =0 ; z< nbc; z++) // le premier segment
1103 { // il y a au moins une CCF "EP" qu'il faut ignorer
1104 mgtri->get_segment1()->get_lien_topologie()->get_type_ccf(z,nom); // ->get_triangle3()->get_lien_topologie()->get_type_ccf(k,nom);
1105 if (strcmp(nom,"EP")==0) continue;
1106 if (strcmp(nom,"Px")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment1()->get_lien_topologie()->get_valeur_ccf(z) << ", 1, " << ii << ", 1, 1; C* CCF de Coque... " << std::endl;
1107 if (strcmp(nom,"Py")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment1()->get_lien_topologie()->get_valeur_ccf(z)<< ", 1, " << ii << ", 1, 2; C* CCF de Coque... " << std::endl;
1108 if (strcmp(nom,"Pz")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment1()->get_lien_topologie()->get_valeur_ccf(z) << ", 1, " << ii << ", 1, 3; C* CCF de Coque... "<< std::endl;
1109 if (strcmp(nom,"Pn")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment1()->get_lien_topologie()->get_valeur_ccf(z) << ", 1, " << ii << ", 1, 4; C* CCF de Coque... " << std::endl;
1110 }
1111 nbc = mgtri->get_segment2()->get_lien_topologie()->get_nb_ccf();
1112 for (int z =0 ; z< nbc; z++)
1113 {
1114 mgtri->get_segment2()->get_lien_topologie()->get_type_ccf(z,nom);
1115 if (strcmp(nom,"EP")==0) continue;
1116 if (strcmp(nom,"Px")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment2()->get_lien_topologie()->get_valeur_ccf(z) << ", 2, " << ii << ", 1, 1; C* CCF de Coque... " << std::endl;
1117 if (strcmp(nom,"Py")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment2()->get_lien_topologie()->get_valeur_ccf(z) << ", 2, " << ii << ", 1, 2; C* CCF de Coque... " << std::endl;
1118 if (strcmp(nom,"Pz")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment2()->get_lien_topologie()->get_valeur_ccf(z) << ", 2, " << ii << ", 1, 3; C* CCF de Coque... "<< std::endl;
1119 if (strcmp(nom,"Pn")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment2()->get_lien_topologie()->get_valeur_ccf(z) << ", 2, " << ii << ", 1, 4; C* CCF de Coque... " << std::endl;
1120 }
1121 nbc = mgtri->get_segment3()->get_lien_topologie()->get_nb_ccf();
1122 for (int z =0 ; z< nbc; z++)
1123 {
1124 mgtri->get_segment3()->get_lien_topologie()->get_type_ccf(z,nom);
1125 if (strcmp(nom,"EP")==0) continue;
1126 if (strcmp(nom,"Px")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment3()->get_lien_topologie()->get_valeur_ccf(z) << ", 3, " << ii << ", 1, 1; C* CCF de Coque... " << std::endl;
1127 if (strcmp(nom,"Py")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment3()->get_lien_topologie()->get_valeur_ccf(z) << ", 3, " << ii << ", 1, 2; C* CCF de Coque... " << std::endl;
1128 if (strcmp(nom,"Pz")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment3()->get_lien_topologie()->get_valeur_ccf(z) << ", 3, " << ii << ", 1, 3; C* CCF de Coque... "<< std::endl;
1129 if (strcmp(nom,"Pn")==0) of1 << "PEL, " << ii << ", " << mgtri->get_segment3()->get_lien_topologie()->get_valeur_ccf(z) << ", 3, " << ii << ", 1, 4; C* CCF de Coque... " << std::endl;
1130 }
1131
1132
1133 nbc = mgtri->get_lien_topologie()->get_nb_ccf(); // et pour la face elle-m�e
1134 for (int z =0 ; z< nbc; z++)
1135 {
1136 mgtri->get_lien_topologie()->get_type_ccf(z,nom);
1137 if (strcmp(nom,"EP")==0) continue;
1138 if (strcmp(nom,"Px")==0) of1 << "PEL, " << ii << ", " << mgtri->get_lien_topologie()->get_valeur_ccf(z) << ", 4, " << ii << ", 1, 1; C* CCF de Coque... " << std::endl;
1139 if (strcmp(nom,"Py")==0) of1 << "PEL, " << ii << ", " << mgtri->get_lien_topologie()->get_valeur_ccf(z) << ", 4, " << ii << ", 1, 2; C* CCF de Coque... " << std::endl;
1140 if (strcmp(nom,"Pz")==0) of1 << "PEL, " << ii << ", " << mgtri->get_lien_topologie()->get_valeur_ccf(z) << ", 4, " << ii << ", 1, 3; C* CCF de Coque... "<< std::endl;
1141 if (strcmp(nom,"Pn")==0) of1 << "PEL, " << ii << ", " << mgtri->get_lien_topologie()->get_valeur_ccf(z) << ", 4, " << ii << ", 1, 4; C* CCF de Coque... " << std::endl;
1142 }
1143
1144 }
1145
1146 } // next face
1147 } // next coquille
1148 mgcoque = mg_geometrie->get_suivant_coque(ico);
1149 }// next coque
1150
1151
1152 // **************************
1153 // maintenant les poutres
1154 // **************************
1155
1156
1157
1158 //for (int i = 0 ; i<nb_poutres;i++)
1159 LISTE_MG_POUTRE::iterator it_po;
1160 MG_POUTRE* mgpoutre = mg_geometrie->get_premier_poutre(it_po);
1161 while (mgpoutre)
1162 {
1163 //MG_POUTRE* mgpoutre = mg_geometrie->get_mg_poutre(i);
1164 int nummatac=mgpoutre->get_num_materiau();
1165 if ((nummatac!=nummat)&&(nummatac!=-1))
1166 {
1167 nummat=nummatac;
1168 of1 << "ACTSET, MP," << nummat+1 << ";" << std::endl;
1169 }
1170
1171 for (int j = 0;j<mgpoutre->get_nb_mg_boucle();j++)
1172 {
1173 MG_BOUCLE* mgboucle = mgpoutre->get_mg_boucle(j);
1174
1175 for (int k = 0 ; k<mgboucle->get_nb_mg_coarete();k++)
1176 {
1177 MG_COARETE* mgcoarete = mgboucle->get_mg_coarete(k);
1178 MG_ARETE* mgarete = mgcoarete->get_arete();
1179
1180 double IXX = 0;
1181 double IYY = 0;
1182 double Aire = 0;
1183 double x3 = 0;
1184 double y3 = 0;
1185 double z3 = 0;
1186
1187 for (int k=0;k<mgarete->get_nb_ccf();k++)
1188 {
1189 char nomCCF[3];
1190 mgarete->get_type_ccf(k,nomCCF);
1191 if (strcmp(nomCCF,"As")==0)
1192 Aire = mgarete->get_valeur_ccf(k);
1193 if (strcmp(nomCCF,"IX")==0)
1194 IXX = mgarete->get_valeur_ccf(k);
1195 if (strcmp(nomCCF,"IY")==0)
1196 IYY = mgarete->get_valeur_ccf(k);
1197 if (strcmp(nomCCF,"NX")==0)
1198 x3 = mgarete->get_valeur_ccf(k);
1199 if (strcmp(nomCCF, "NY")==0)
1200 y3 = mgarete->get_valeur_ccf(k);
1201 if (strcmp(nomCCF, "NZ")==0)
1202 z3 = mgarete->get_valeur_ccf(k);
1203 }
1204
1205 if ( Aire==-7) // -7 est un flag pour diff�rencier les mini-poutres...
1206 { // mini-poutre
1207 of1 << "Actset,EG,5;"<<std::endl;
1208 of1 << "Actset,RC,5;"<<std::endl;
1209 of1 << "C* MINI - POUTRE" << std:: endl;
1210
1211 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
1212 {
1213 FEM_SEGMENT* femseg = (FEM_SEGMENT*)mgarete->get_lien_fem_maillage()->get(t);
1214 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<femseg->get_fem_noeud(0)->get_numero()<< ","<< femseg->get_fem_noeud(1)->get_numero()<<";" << std::endl;
1215 } // next segment
1216 }
1217 else
1218 { // poutre normale
1219 of1 << "Actset,EG,3;"<<std::endl;
1220 of1 << "ND,"<< ++nbNoeuds/* NDMAX+1 */ << "," << x3*valeurunite << "," << y3*valeurunite << "," << z3*valeurunite << ";" << std::endl; // cr�ation du trois�me point (qui est un noeud) ND,1,5,6,7
1221 of1 << "RCONST,3,"<< ++RCset << ",1,3," << Aire << "," << IXX << "," << IYY << ";" << std::endl; //RCONST,3,66,1,3,99,98,97 ; EG associ�e RC , start location, nombre de constantes, aire, inertie XX, inertie YY
1222
1223 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
1224 {
1225 FEM_SEGMENT* femseg = (FEM_SEGMENT*)mgarete->get_lien_fem_maillage()->get(t);
1226 if (!contient(femseg)) continue;
1227 if (degre==1) of1 << "EL, " << ++ii << ", CR, 0, 3, " <<femseg->get_fem_noeud(0)->get_numero()<< ","<< femseg->get_fem_noeud(1)->get_numero()<<","<< nbNoeuds << ";" << std::endl;
1228
1229 for (int k=0;k<mgarete->get_nb_ccf();k++)
1230 {
1231 char nom[3];
1232 mgarete->get_type_ccf(k,nom);
1233 if (strcmp(nom,"Px")==0) of1 << "PEL, " << ii << ", " << femseg->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 1; C* CCF de Coque... " << std::endl;
1234 if (strcmp(nom,"Py")==0) of1 << "PEL, " << ii << ", " << femseg->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 2; C* CCF de Coque... " << std::endl;
1235 if (strcmp(nom,"Pz")==0) of1 << "PEL, " << ii << ", " << femseg->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 3; C* CCF de Coque... "<< std::endl;
1236 if (strcmp(nom,"Pn")==0) of1 << "PEL, " << ii << ", " << femseg->get_lien_topologie()->get_valeur_ccf(k) << ", 4, " << ii << ", 1, 4; C* CCF de Coque... " << std::endl; // l�� va en arracher!!!
1237 }
1238 } // next segment
1239 }
1240
1241
1242 } // next arete
1243 } // next boucle
1244 mgpoutre=mg_geometrie->get_suivant_poutre(it_po);
1245 } // next poutre
1246
1247 // Cas sp�cial, une ar�te normale est flagg�e comme une mini-poutre (dans coupecot�)
1248 LISTE_MG_ARETE::iterator ita;
1249 MG_ARETE* mgarete = mg_geometrie->get_premier_arete(ita);
1250
1251 while (mgarete)
1252 {
1253 double Aire = 0;
1254
1255 for (int k=0;k<mgarete->get_nb_ccf();k++)
1256 {
1257 char nomCCF[3];
1258 mgarete->get_type_ccf(k,nomCCF);
1259 if (strcmp(nomCCF,"As")==0)
1260 Aire = mgarete->get_valeur_ccf(k);
1261 }
1262
1263 if ( Aire==-7) // -7 est un flag pour diff�rencier les mini-poutres... non orient�e
1264 { // mini-poutre
1265 of1 << "Actset,EG,5;"<<std::endl;
1266 of1 << "Actset,RC,5;"<<std::endl;
1267 of1 << "C* MINI - POUTRE" << std:: endl;
1268
1269 for (int t = 0; t< mgarete->get_lien_fem_maillage()->get_nb();t++)
1270 {
1271 FEM_SEGMENT* femseg = (FEM_SEGMENT*)mgarete->get_lien_fem_maillage()->get(t);
1272 if (!contient(femseg)) continue;
1273 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<femseg->get_fem_noeud(0)->get_numero()<< ","<< femseg->get_fem_noeud(1)->get_numero()<<";" << std::endl;
1274 }
1275 }
1276 mgarete=mg_geometrie->get_suivant_arete(ita);
1277 }
1278
1279
1280
1281 //************************************************************
1282 // Pour mettre des mini-poutres sur les faces concern�es *****
1283 //*************************************************************
1284 // identifications des faces du qui sont des faces internes.
1285
1286 LISTE_MG_FACE::iterator itf;
1287 MG_FACE* mgface = mg_geometrie->get_premier_face(itf);
1288
1289
1290 while (mgface)
1291 {
1292 for (int k=0;k<mgface->get_nb_ccf();k++)
1293 {
1294 char nomCCF[3];
1295 mgface->get_type_ccf(k,nomCCF);
1296
1297 if (strcmp(nomCCF,"FI")==0)
1298 {
1299 TPL_LISTE_ENTITE<FEM_ELEMENT_MAILLAGE*> * lien_fem_maillage = mgface->get_lien_fem_maillage();
1300 FEM_ELEMENT_MAILLAGE* element;
1301
1302 //si on a une faceinterne de poutre alors on a une CCF "Po" = 0
1303 // sinon la CCF Po est �gale � 1 et on a une coque
1304 int Poutre = -1;
1305
1306 for (int z=0;z<mgface->get_nb_ccf();z++)
1307 {
1308 char nomCCF2[3];
1309 mgface->get_type_ccf(z,nomCCF);
1310 if (strcmp(nomCCF,"Po")==0)
1311 {
1312 Poutre = mgface->get_valeur_ccf(z);
1313 }
1314 }
1315
1316
1317 if (Poutre ==0)
1318 { // mini-poutres pour des poutres
1319 of1 << "ACTSET,EG,5; C* Face avec mini-poutres de POUTRE"<<std::endl;
1320 of1 << "ACTSET,RC,5;"<<std::endl;
1321 for (int i = 0 ; i< lien_fem_maillage->get_nb();i++)
1322 {
1323 FEM_TRIANGLE* femtriangle=(FEM_TRIANGLE*)lien_fem_maillage->get(i) ;
1324
1325 FEM_NOEUD* nd0 =femtriangle->get_fem_noeud(0);
1326 FEM_NOEUD* nd1 =femtriangle->get_fem_noeud(1);
1327 FEM_NOEUD* nd2= femtriangle->get_fem_noeud(2);
1328
1329 // Pour des mini-poutres de rigidit� infinie //EL,1,CR,0,3,1,2,3,0,0,0,0,0,0 num ��ent, CR, flag asso, nb noeuds, #1, #2, #3 ;
1330 //si on veut orienter les propri�t�s,
1331 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd0->get_numero()<< "," << nd1->get_numero()<< ";" << std::endl;
1332 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd1->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
1333 of1 << "EL, " << ++ii << ", CR, 0, 2, " <<nd0->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
1334 }
1335 }
1336 else if (Poutre==1)
1337 { // mini-poutres pour des coques
1338 of1 << "ACTSET,EG,6; C* Face avec mini-poutres de COQUE"<<std::endl;
1339 of1 << "ACTSET,RC,6;"<<std::endl;
1340 for (int i = 0 ; i< lien_fem_maillage->get_nb();i++)
1341 {
1342 FEM_TRIANGLE* femtriangle=(FEM_TRIANGLE*)lien_fem_maillage->get(i) ;
1343
1344 FEM_NOEUD* nd0 =femtriangle->get_fem_noeud(0);
1345 FEM_NOEUD* nd1 =femtriangle->get_fem_noeud(1);
1346 FEM_NOEUD* nd2= femtriangle->get_fem_noeud(2);
1347
1348 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd0->get_numero()<< "," << nd1->get_numero()<< "," << nd2->get_numero()<< ";" << std::endl;
1349 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd1->get_numero()<< "," << nd2->get_numero()<< "," << nd0->get_numero()<< ";" << std::endl;
1350 of1 << "EL, " << ++ii << ", CR, 0, 3, " <<nd0->get_numero()<< "," << nd2->get_numero()<< "," << nd1->get_numero()<< ";" << std::endl;
1351 }
1352 }
1353 } // end if FI
1354 } // next CCF
1355 mgface= mg_geometrie->get_suivant_face(itf);
1356 } // end while face
1357
1358
1359
1360 //of1<< "NMERGE;" <<std::endl;
1361 //of1<< "NCOMPRESS;" <<std::endl;
1362
1363 //of1<< "SETEPLOT,1,1,0,0;"<<std::endl;
1364 //of1<< "ACTECLR,1,RC,1;"<<std::endl;
1365
1366 of1<< "EPLOT;"<<std::endl;
1367 of1<< "PSCALE;"<<std::endl;
1368 //lst_FaceInternes.vide();
1369
1370 }
1371
1372
1373 double FEM_MAILLAGE::calcul_coef(void)
1374 {
1375 if (!deforme) return 0.;
1376 LISTE_FEM_NOEUD::iterator it;
1377 double max=0.,dmax=0.;
1378 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1379 {
1380 double x=noeud->get_x();
1381 double y=noeud->get_y();
1382 double z=noeud->get_z();
1383 double dx=noeud->get_dx();
1384 double dy=noeud->get_dy();
1385 double dz=noeud->get_dz();
1386 if (fabs(x)>max) max=fabs(x);
1387 if (fabs(y)>max) max=fabs(y);
1388 if (fabs(z)>max) max=fabs(z);
1389 if (fabs(dx)>dmax) dmax=fabs(dx);
1390 if (fabs(dy)>dmax) dmax=fabs(dy);
1391 if (fabs(dz)>dmax) dmax=fabs(dz);
1392 }
1393 if (dmax<1e-10) return 0;
1394 double coef=0.1*max/dmax;
1395 return coef;
1396 }
1397
1398
1399
1400
1401 void FEM_MAILLAGE::calcul_deforme(FEM_SOLUTION* solx,int numx,FEM_SOLUTION* soly,int numy,FEM_SOLUTION* solz,int numz)
1402 {
1403 LISTE_FEM_NOEUD::iterator it;
1404 solx->active_solution(numx);
1405 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1406
1407 noeud->change_dx(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
1408
1409 soly->active_solution(numy);
1410 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1411
1412 noeud->change_dy(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
1413
1414 solz->active_solution(numz);
1415 for (FEM_NOEUD* noeud=get_premier_noeud(it);noeud;noeud=get_suivant_noeud(it))
1416
1417 noeud->change_dz(noeud->get_solution()/get_mg_geometrie()->get_valeur_unite());
1418
1419 deforme=1;
1420 }
1421
1422
1423 int FEM_MAILLAGE::existe_deforme(void)
1424 {
1425 return deforme;
1426 }
1427
1428 void FEM_MAILLAGE::active_deforme(void)
1429 {
1430 deforme=1;
1431 }
1432
1433 void FEM_MAILLAGE::desactive_deforme(void)
1434 {
1435 deforme=0;
1436 }
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447 void FEM_MAILLAGE::optimise_numerotation(void)
1448 {
1449 FEM_NOEUD* noeud=get_fem_noeud(0);
1450 FEM_GRAPH_NOEUD *graph;
1451 graph=new FEM_GRAPH_NOEUD(noeud,this);
1452 int e=graph->get_excentricite();
1453 TPL_MAP_ENTITE<FEM_NOEUD*> dernierniveau=graph->get_dernier_niveau();
1454 int nbdernierniveau=dernierniveau.get_nb();
1455 for (int i=0;i<nbdernierniveau;i++)
1456 {
1457 FEM_GRAPH_NOEUD* graphtmp=new FEM_GRAPH_NOEUD(dernierniveau.get(i),this);
1458 int etmp=graphtmp->get_excentricite();
1459 if (etmp>e)
1460 {
1461 delete graph;
1462 graph=graphtmp;
1463 dernierniveau=graph->get_dernier_niveau();
1464 nbdernierniveau=dernierniveau.get_nb();
1465 i=-1;
1466 e=etmp;
1467 }
1468 else delete graphtmp;
1469 }
1470 int numero=get_nb_fem_noeud();
1471 for (int i=0;i<e+1;i++)
1472 {
1473 TPL_MAP_ENTITE<FEM_NOEUD*> niveau=graph->get_niveau(i);
1474 int nbnoeud=niveau.get_nb();
1475 for (int j=0;j<nbnoeud;j++)
1476 {
1477 FEM_NOEUD* noeud=niveau.get(j);
1478 noeud->change_numero_opt(numero);
1479 numero--;
1480 }
1481 }
1482
1483
1484 delete graph;
1485 }
1486
1487 void FEM_MAILLAGE::echange_numerotation(void)
1488 {
1489 int nbnoeud=get_nb_fem_noeud();
1490 for (int i=0;i<nbnoeud;i++)
1491 {
1492 FEM_NOEUD* noeud=get_fem_noeud(i);
1493 int num=noeud->get_numero();
1494 noeud->change_numero(noeud->get_numero_opt());
1495 noeud->change_numero_opt(num);
1496 }
1497
1498 }
1499
1500
1501
1502
1503 std::ostream& operator << (std::ostream& o,FEM_MAILLAGE& maillage)
1504 {
1505 maillage.enregistrer(o);
1506 return o;
1507 }
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522